09-05-2019 06:24 PM
Hi all - I got a weird idea I want to run past the motley mob. I need an "Execution Loop", "task loop", whatever that responds to events from a user interface loop and a DAQ loop. But I also need to be able to iterate in a loop. I've always used queue-driven state machines for this, but this scheme seemed like it might be a bit easier to implement. To iterate in a loop, it needs to be able to "fire its own events" from inside the event structure. I like the fact that it's trivially easy to add a new event source - and each event can carry its own appropriate data type, I'm not stuck with one queue. So - is this crazy or stupid? Thanks for looking, folks - paul
{I saved in LV2 version, hope y'all can open it}
Solved! Go to Solution.
09-05-2019 07:06 PM
While reading this post, I immediately thought of the DQMH (Delacor Queued Message Handler) framework. You might wanna check it out.
Regards,
09-05-2019 08:31 PM
Thanks Oscar, I didn't know about the LabVIEW Tools Network - will check it out when I get this error resolved - Package Manager errors out with "unknown command line arguments blah blah - Unknown Command: then the .vip filename". I'll have to fiddle with it - paul
09-06-2019 03:15 AM - edited 09-06-2019 03:20 AM
I'm not sure, but it sounds more or less like you're describing the Actor Framework...
Might be worth also taking a look at that (but I hear lots of good things about the DQMH).
If you want to try the Actor Framework and have lots of UI-updating based events, it might also be worth looking at the work Allen C Smith and Sam Taggart have done recently here: Events for UI Actor Indicators. There's a video in that post.
09-06-2019 04:40 AM
No it's not stupid. But you do need to be careful.
I disagree that DQMH or Actors are in any way required of even recommended based purely on what you have posted. I would first spend some time trying it out with Events as you already have before switching to a completely different way of doing things.
The problem with having a loop feed itself is the problem of infinite loops occurring. This is a similar problem to infinite recursion. If handling Event X fires Event Y which then also fires Event X, you have an infinite loop and you will have problems. This gets really complicated and problematic when it's a conditional relationship, if it only happens under certain circumstances, it can cause ont of those horrible (impossible to reproduce) problems.
The fourth point is not to be generally recommended if you're not really comfortable with how Events work.
09-06-2019 10:51 AM
Check out the following links
https://decibel.ni.com/content/docs/DOC-12159
I have used the ideas in those links to make a template where I use Events to pass messages around, along with the JKI State Machine which has an event structure built in.
mcduff
09-06-2019 11:02 AM
Fantastic help guys - thanks so much for sharing your experience and insights! This old brain is definitely growing - paul