12-02-2022 02:11 PM
I have been trying to figure out how to end all 3 of these loops with one user click on an "emergency stop" button. The emergency stop button event needs to cycle through several messages to safely shut down equipment. Then at the end all 3 loops need to end. I keep having one loop hang without closing.
My very tired brain has attempted to leave comments to ease understanding. Any help is appreciated.
12-02-2022 03:48 PM
Two of your loops have this in them:
Because of dataflow and the fact that this has zero input wires, it reads the Boolean immediately at the start of each loop, and not after it finishes a case.
So if your exit Boolean is set to True, the loop will only end at the end of the next completed loop instead of the current one.
As a general recommendation I would set it up so that your "Exit" case(s) in any given loop outputs a True constant to the Stop button and every other case uses the "use default if unwired" option to not stop the loop.
I'd also set it up so that whatever code currently sets the Boolean to True, instead is set to send a message to one of those exit cases, possibly with a priority message (i.e. enqueue at opposite end, or generate user event with the optional input set to high priority).
12-03-2022 10:48 AM
Hello, CatDoe. LabVIEW Giveth, and LabVIEW Taketh Away (but, fortunately, Asynchronous Channel Wires can "come to the rescue").
One of the great strengths of LabVIEW is that the principles of Data Flow programming allows and encourages programs to have loops running in parallel. The problem then becomes getting them to stop in an orderly fashion.
You seem to be using the Queued Message Handler template (which I personally found too confusing, so I constructed a simpler Queued State Machine that I migrated to use Messenger Channel Wires when LabVIEW 2016 introduced this (wonderful) feature (I called this pattern a Channel Message Handler design). Stopping then became quite simple:
Hope this gives you some ideas.
Bob Schor