04-14-2017 02:00 PM
Hello,
I am experimenting with the framework presented here:
...essentially a many-to-many communication bus using user defined events.
The problem I am seeing is that occupationally one of the event loops seems to miss an event being fired. I can't see any pattern except that it occurs more often if events are rapid, though they can be missed even with 50ms or more between events. It looks like about one in every 70 events or so are missed with a 5ms between events, maybe a tenth of this at 50 ms between events.
The parts are summarized in the images below. The VI is attached. If you run it a few times, and this isn't a machine related issue, you'l see one of loops not process the same set of events as the other.
Thanks for any guidance that may be on offer.
Creation of event:
Firing off events:
Event processing loops, one handles one task, another the other. both handle exit:
Front panel after an error run:
Solved! Go to Solution.
04-14-2017 02:20 PM
You cannot use the same registration. You need a registration for the event at each place you want to "listen" for the event.
Think of each registration as a queue. If you dequeue from the same queue in multiple loops, you do not know who will read which element. Works the same for the registration.
04-14-2017 02:30 PM
Great, makes sense. Thank you.
04-14-2017 03:25 PM
It is probably also not a great idea to bury event structures inside case structures. Under error condition, the events will accumulate forever in the event queue because it cannot react due to dataflow, and once the error condition clears, you get the oldest event first, which might be stale by then, or not even valid because it happened during an error condition.