Showing results 1 to 3 of 3

Thread: How to implement the communication with Zenon from Windows Service (C#)

  1. #1
    Join Date
    13.05.2020
    Posts
    2

    Default How to implement the communication with Zenon from Windows Service (C#)

    Hoi guys,

    I'm C# developer but Zenon is new for me. For new project I have to work with Zenon editor en runtime. 
    At this moment I try to communicate with Zenon from a Windows Service. But I have no idee how to do that.

    Zenon has a lot of drivers that support the communication with extern devices. But the most of the drivers are for PLC devices. Is there a driver which I can use for the communication with my Windows Service. Further if these driver is available, how can I implement it in my Windows service?

    Thanks a lot for helping me with this problem.

    Best regards,
    Melodie Tran


  2. #2
    Join Date
    31.05.2018
    Posts
    5

    Default Re: How to implement the communication with Zenon from Windows Service (C#)

    Quote Originally Posted by MelodieTran View Post


    I'm C# developer but Zenon is new for me. For new project I have to work with Zenon editor en runtime.


    At this moment I try to communicate with Zenon from a Windows Service. But I have no idee how to do that.

    You've got at least a few options to achieve that. I would say your best bets are:


    • Using zenon's COM Interface (tricky, but doable) and accessing the variables, functions, settings and so on via it.
    • Developing an AddIn (if you want to communicate with Zenon Runtime - use Project Service Extension, docs are on github) which would communicate with your Windows Service via IPC/gRPC/0MQ etc. (might be an overkill and - especially in bigger zenon projects - performance might be tricky, but you can keep your code away from unmanaged resources which might be an advantage). You could also just implement whatever you logic you've got in your Windows Service in the AddIn and run it automatically whenever Zenon Runtime starts.
    • Waiting for 8.20 and implementing your own driver which would be then possible.


    COM Interfacing is not well described in the docs but basically you access zenon's COM Interface in your Windows Service like this


    var zenApp = ((zenOn.Application)Marshal.GetActiveObject("zenOn.Application"));


    and then get into the project and - for example - invoke zenon's functions or read variable's value. Basically same idea follows developing AddIns. There are some snippets about it in the help, but nothing too useful, I am afraid - so I suggest to experimenting on your own and maybe get in touch directly with your local COPA-DATA sales team in case of any further questions.



    Best regards,
    Mikolaj
    Last edited by mwieczorkiewicz : 26th June 2020 at 19:57

  3. #3
    Join Date
    14.10.2020
    Posts
    1

    Default Re: How to implement the communication with Zenon from Windows Service (C#)

    Thank you, will give both a try
    .

Similar Threads

  1. Read zenOn variables from Windows Service
    By matteo.bernardon in forum zenon Supervisor
    Replies: 4
    Last Post: 2nd November 2018, 14:35
  2. Windows driver communication problems
    By xandit in forum zenon Supervisor
    Replies: 0
    Last Post: 11th January 2018, 17:36
  3. Replies: 2
    Last Post: 4th July 2013, 11:45
  4. Replies: 1
    Last Post: 3rd August 2010, 10:02
  5. Replies: 0
    Last Post: 12th May 2010, 09:58

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •