Why Do I See Unexpected Value Change Events for Shared Variables Using LabVIEW DSC?Primary Software: LabVIEW Modules>>DSC ModulePrimary Software Version: N/A Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I dynamically registered value change events for shared variables using the "Request Value Change Notification.vi" in LabVIEW DSC. When I run the VI for the first time, there are multiple value change events fired even though the shared variables have not changed at all. Why am I seeing these events and how can I prevent them? Solution: These events are expected behavior. The reason why they are happening is because when you run a VI for the first time, the shared variables need to connect to the shared variable engine and establish a subscription. This process inherently generates a value change event for every shared variable being monitored, therefore you will get as many value change events fired as you have variables being monitored. In order to prevent this behavior from causing undesired actions these unexpected events need to be handled appropriately. One way to handle these events is to use a flat sequence structure that has two event structures, one after the other one; the first one will be fired by all the unexpected events without taking any action. The second one will only fire when the value of the variables actually changes. It is in the second event structure where you place the code that you want to execute when there is an actual value change. Please take a look at the attachmnet below for an example of the steps mentioned above.Related Links: KnowledgeBase 2E3EMFO9: Event Structure Does Not Capture the 'Value Change' Event When Values are Programmatically Changed KnowledgeBase 30BENK7Y: Value Change Event Case Not Reading the Correct Value Attachments:
Report Date: 09/19/2008 Last Updated: 11/13/2008 Document ID: 4PIF8LEQ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
