LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic event multiple loops

I'm trying to see if I can use one Dynamic User Event to control multiple Event Structures. It seems that sometimes once a dynamic event occurs and its "interrupt" is answered by an event case, other VIs only have a short amount of time (<50ms) to reach their event case state for accepting this event otherwise the event seems to be cleared and the other VIs are oblivious that the event even occured.
 
My Question: Is it possible to use one dynamic event to control multiple Event Structures reliably?
 
 
A previous post somewhat speaks of this issue but does not provide a solution or anything insightful.
 
I've included an example of my issue
0 Kudos
Message 1 of 4
(3,202 Views)

This help page explains some of the restrictions for using dynamic events. The main one to note is below:

"Avoid branching an event registration refnum wire because that allows multiple Event structures to pull events from one queue and introduces a race condition that can cause unpredictable behavior."

One event based mechanism that allows you to broadcast events to multiple locations is a Notifier. Notifiers can send arbitrary data with their notifications. They operate much like queues, except there is no buffering involved. You send one notification at a time, and that overwrites any previous notifications. But multiple Wait on Notifications can receive the same notification event data. These don't work with Event Structures. You might need a separate listen loop to listen for incoming notifications if you implemented them.

 
Jarrod S.
National Instruments
Message 2 of 4
(3,195 Views)
A further explanation is found here

Basically if you want a dynamic event in multiple event cases you should register multiple times for it (with differen Dynamic Event Registration nodes)

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 4
(3,174 Views)
Thanks to both of you. I found the answer to my question in the second posted link. "the common, correct use case is to have one Event structure per dynamic event registration". I tested this out with the previous attachment by registering the User Event refnum from the ESTOP functional global to another Event Registration node. I then ran this refnum to the top loop. (instread of the top loop sharing the registration refnum with the middle loop). Now I can put a delay of 2000+ ms and not even miss an event. cooool. This will probably NOT be my final solution but its good to know in the future.
 
Most likely I am going to design each of my main VIs to have a main while loop with a User Event Structure listening for dynamic events. Associated with each of these VIs will be a functional global which contains its User Event Refnum and Registration Refnum. This functional global will act as a gateway into the associated VI for other VIs/Subvis to use. This will follow the "one Event structure per dynamic event registration" rule while keeping my API organized and allowing room for scalability by simply adding more functional globals in the future.
 
Just putting this info out there for other users.
 
Thanks again,
Craig
0 Kudos
Message 4 of 4
(3,164 Views)