11-30-2018 11:41 AM
@Patrem1 wrote:
I would need to do some formating before posting my Vi and I'm using fonctions from the 'Vision and motion'.
But my current situation is like this example :
https://forums.ni.com/t5/Example-Program-Drafts/Queued-State-Machine-with-User-Input/ta-p/3497450
My error I assumed this was named a queued state machine, it is a queued state machine with user input.
So you're saying this is a abomination or it's okay?
EDIT : So to be clear at first I had only a 'Queue state machine' that I'm trying to change to a 'Queued state machine with user input'.
Read the comments below the example you linked.
In a very limited application you can get away with that but it does not scale well and if you do not know that changes "need to be done delicately", the beast can go wild on you. I have seen those growing to use 90 or more states because someone just added states as time went on.
But for what little I know of what you are doing I suspect a "QMH" is better and if you separate the ideas of your "Mode of Operation" from the states of the QMH, it may be easier to avoid conflating states with modes.
Ben
11-30-2018 11:43 AM
@Patrem1 wrote:
But my current situation is like this example :
https://forums.ni.com/t5/Example-Program-Drafts/Queued-State-Machine-with-User-Input/ta-p/3497450
My error I assumed this was named a queued state machine, it is a queued state machine with user input.
So you're saying this is a abomination or it's okay?
Having multiple loops that can affect the state queue is where I call it an abomination. Some ideas:
1. Put the Event Structure in your "Idle" state and react to the user as necessary by enqueuing states.
2. Use a Dequeue element for another queue in your "Idle" state and allow the GUI loop to send messages as necessary. The QSM can then react as it sees fit based on whatever other state information it has.
11-30-2018 12:03 PM
Hi,
Thank you for your answers, I understand the potential problems with this.
I think I will try crossrulz ideas. As my application is simple and I would prefer not having to learn QMH right now with the time I have.
11-30-2018 06:02 PM - edited 11-30-2018 06:26 PM
@Ben wrote:
@crossrulz wrote:
...After reading the OP's response, use a FGV with error in and error out
Actually, it sounds more like I did not properly understand the setup the OP has. QSM is a single loop, which means it should be fine storing it in that loop. But the OP's last post points to them actually using a QMH.
Patrem1, Please post your VI so we can understand what your current situation is.
IN the deepest darkest corners of the LabVIEW wild there exist an abominable beast that is part QSM part QMH.
Spoiler
That critter get feed from an event handling loop or will on occasion eat its own tail. It actions are chaotic and there is no way to predict it next move or tell where is or has come from.
Beware the Beast!
Ben
Ben! I'm amazed that you remember that post! That "Beast" functions exceedingly well when it has a "zookeeper" (That is, don't ever let anyone feed the animals)
So lets expose a definition of "Event Driven Queued Message Handler" EDQMH
This is a twist on an Event Driven P-C pattern where the following rules apply:
An event driven queued message handler it useful when:
lets examine the beast in a Trip to Grandmas house
In that analogy there are only two things of importance.
The down side is that once you let the thing out of its cage- Ben is exactly correct, some "Developer" isn't going to follow the rules and there is no safety net for that fool.