ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variable event handling--spurious events

Solved!
Go to solution

This is more of a nuisance than anything:

 

Using the DSC module to register for shared variable events, the event structure always fires once for each variable registered for. For example, if I register for the shared variables "Var1" and "Var2", upon entering the event structure [in a loop], I'll immediately see two events [one for Var1 and one for Var2] even if the values for Var1 and Var2 haven't changed.

 

I originally figured that it's intentional--it appears to be impossible to use SV events without this "feature"--except it doesn't happen in "highlight execution" mode, which I find puzzling.

 

Why does this exist, and is there some magic way to disable it? Or is it a bug? Anybody who has ever used SV events undoubtedly has some way of dealing with this. Right now I just burn off the first N events, where N is the number of shared variables I'm registered for. But that's extra diagram junk and it really shouldn't be necessary.

0 Kudos
Message 1 of 21
(4,122 Views)

Just curious...do you use the initial value property of your SV's?  I also use NSV events but have not noticed this problem.

0 Kudos
Message 2 of 21
(4,103 Views)

Good question... but no. Some of the SV's have initial values but some don't [and some can't; they're custom data types].

 

I should have mentioned that I'm using 2010 SP1.

0 Kudos
Message 3 of 21
(4,096 Views)

pltrogon,

 

Are you able to post the code youre working on, or a simplified version which demonstrates this behavior? 

 

Regards,

 

Kyle Mozdzyn

Applications Engineering

National Instruments

Regards,

Kyle M.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 21
(4,085 Views)

Kyle:

 

Here's a sample project with two SVs and an event handler VI. SV1 has an initial value but SV2 doesn't.The array displayed in the front panel should be empty after running--the SV's are not written to anywhere. I get two entires--one from each event--when I run the VI.

 

I noticed some new behavior when I put this together. In this example I use the timeout condition to terminate the loop. There is a timeout value around 110ms that defines the cutoff for this behavior--but the value is not consistent. With timeout values ~110 and below, I get no spurious events. But I DO get them for any timeout value of above that. So perhaps this issue is invisible to anybody who is generating events faster than ~10Hz. This may explain why I've been having inconsistent behavior when using the execution trace.

 

[edit: reposted as archive]

0 Kudos
Message 5 of 21
(4,078 Views)

pltrogon,

 

Can you include the  disable/enable/request value change notifications VIs so I can open the VI?

 

Regards,

 

Kyle Mozdzyn

Applications Engineering

National Instruments

Regards,

Kyle M.
Applications Engineering
National Instruments
0 Kudos
Message 6 of 21
(4,061 Views)

Kyle:

 

Sorry about that, here you go.

0 Kudos
Message 7 of 21
(4,049 Views)

Any updates on this? I'm having occasionally inconsitent behavior with this which results in me losing some events [rarely the spurious events DON'T appear and my method for squelching them kills the next real event].

0 Kudos
Message 8 of 21
(4,012 Views)

Just curious...Did you try to disable events on timestamp changes?  That is an option on the Request Value Change Notifications vi.

0 Kudos
Message 9 of 21
(4,009 Views)

thanks, sachsm:

 

I tried and it didn't seem to help, but then I just noticed this:

 

When I select "value change only," any SV that does not have a value does not fire an event on initialization. All SVs with a value--not just an initial value but any current value at all--still fire off extra events. This feels a little bit like a feature now--a current value is, after all, just a value change in the pre-registration past--but if so I would expect people to be familiar with it and I'd sure like a way to disable it.

0 Kudos
Message 10 of 21
(4,004 Views)