Author Topic: Data changed event triggering twice for data subscriber  (Read 1990 times)

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Data changed event triggering twice for data subscriber
« on: January 13, 2015, 05:37:57 PM »
Have someone noticed that the data chaged event for data subscribers triggers twice or sometimes more?

I use AHMI v3.6.2 in a project we started but was put on hold months ago. Updating to "after v3.8.0" version it will be unlikely as we only use a simple tags monitoring. We connect to two Compact Logix and monitor only a couple of string tags in each of them. One of those tags holds a number and on the change event I analize its value with a case function. What I see when debugging, is that the event starts and finishes normally, then starts over without having to change the value contained in the data subscriber, executing the same code again. No problem so far, as my code will not have a negative effect from that, but I do not like the idea when I use something that has to be executed just once.

I'm on VB.net 2013, pro edition.
« Last Edit: January 13, 2015, 05:40:20 PM by Sprungmonkey »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Data changed event triggering twice for data subscriber
« Reply #1 on: January 13, 2015, 06:04:56 PM »
Version 3.71 included a fix to the DataSubscriber to address it firing multiple times. I don't remember the exact change, but you may be able to compare the code for the DataSubscriber in the latest version to the version you have to find the difference.

DougLyons

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Data changed event triggering twice for data subscriber
« Reply #2 on: January 13, 2015, 06:44:35 PM »
Sprungmonkey,

Please see http://advancedhmi.com/forum/index.php?topic=238.0
Look near the bottom of the first page for what worked for me.

It shows the following:

I saw that you noted that the value change testing is done in the PolledDataReturnedValue event handler.
I went to this routine and did some testing and found that changing one statement fixes this for me.
The statement "LastValue = m_Value" can be changed to "LastValue = e.Values(0)" and now I get no duplications.

Hopefully, this should help you with your problem.

Doug Lyons

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Data changed event triggering twice for data subscriber
« Reply #3 on: January 14, 2015, 09:50:07 AM »
DougLyons, I will try it as soon as I can, thank you for your contribution.

Archie, version 3.71 seems to have been deleted from sourceforge. It looks like you have been cleaning most of the old versions, so there is only 3.70 and 3.80. Do you have another repository?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Data changed event triggering twice for data subscriber
« Reply #4 on: January 14, 2015, 09:55:22 AM »
Once there is a critical bug found and fixed, I delete the bugged version. There is no other place to get the other versions

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Data changed event triggering twice for data subscriber
« Reply #5 on: January 14, 2015, 10:32:10 AM »
DougLyons,

Seems to have fixed it correctly, really appreciated!