Author Topic: DataSubscriber  (Read 1584 times)

Uncle3MTA3

  • Newbie
  • *
  • Posts: 7
    • View Profile
DataSubscriber
« on: July 02, 2020, 09:28:14 AM »
I'm trying to set up fault logging for an entire plant. The AHMI application will be running on a computer and will do nothing more then record when a machine has faulted and put the fault information into a central database.
This mean that the application will be talking to a dozen PLCs and recording data on scores or individual pieces of equipment.
I have some code written and functional on of one the lines, but before I expand it to cover everything, I want to make sure I'm doing it intelligently.
Right now I'm using a lot of DataSubscribers to monitor individual bits in the PLCs and then I have code in the DataChanged function to execute the sql query. But the number of functions is already pretty large and will only be growing. My thinking is that since each piece of equipment I will be monitoring runs asynchronously with everything else, I need the functions to be able to run independently, that's why I'm using the DataSubscriber and not the DataSubscriber2 with multiple trigger bits.
Does this seem like the right way to do what I want? How would the DataSubscriber2 respond to multiple triggers happening, potentially, simultaneoulsy?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: DataSubscriber
« Reply #1 on: July 02, 2020, 11:47:48 AM »
Whether you use mutiple DataSubscribers or 1 DataSubscriber2, the result in the back end is the same. The driver tries to optimize the communications to each PLC.

If it were me, I would probably use 1 DataSubscriber 2 for each PLC.

Uncle3MTA3

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: DataSubscriber
« Reply #2 on: July 10, 2020, 10:05:33 AM »
Thanks for the response.
Just to make sure I'm understanding you, if I used the DataSubscriber2 and 2 of the fault conditions happened at the same time, they would both cause the DataChanged sub to run? There is nothing time consuming in that sub, so even a fraction of a second time difference should let the sub finish before needing to be run again, but let's think worst case scenario where 2 faults occur at the exact same moment and both want to trigger the DataChanged sub. Will they run in their own thread? Will they be queued to run one after another? Will the second trigger be ignored?
I like the idea of cleaning up the scores of subscribers I currently have, but I want to make sure nothing is missed.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: DataSubscriber
« Reply #3 on: July 10, 2020, 07:53:00 PM »
The event will sequentially fire for each value that changes.