LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queued SM

Hi,

 

 

     I have learned state machines from my previous post http://forums.ni.com/t5/LabVIEW/How-can-I-stop-the-inner-while-loop-when-the-outer-while-loop/m-p/18....

 I want to learn more about Queued State Machines.

 

  Can anyone post a  simple example using DAQ? 

 

Using LabVIEW 2010, 2011

 

0 Kudos
Message 1 of 6
(2,446 Views)

Hi,

 

I found the following example:

 

Using Queues to Create a More Flexible State Machine:

http://zone.ni.com/devzone/cda/epd/p/id/3909

 

Its not an example with DAQ but maybe it will help you.

_____________________________________________________________________

---Please mark a post as a Solution if it solved your problem ---
Message 2 of 6
(2,434 Views)

thanks, hadnt thought of running my state machines that way

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 3 of 6
(2,425 Views)

Thank you Xenox and Akiel, 

It's a good example . 🙂

What is an enqueue element? and how does it jump between state if there is no shift register?

When do we use a queued SM rather than SM? I have read the 

Using Queues to Create a More Flexible State Machine.

But the  article dates back to 2003.

Does it simplify the code ?

 

Best

0 Kudos
Message 4 of 6
(2,411 Views)

enqueue element simply places an item on an existing queue.

 

what i expect would happen is you would place the initial states on the queue, then as the state machine starts to run you would add and remove items from the queue as the situation dictates. the while loop will ensure the state machine keeps running and the queue will keep defining the next state, so should run indefinatly until a stop condition is reached 

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
Message 5 of 6
(2,407 Views)

@A.A.A. wrote:

...

When do we use a queued SM rather than SM? ...

Does it simplify the code ?

 

Best


 

Warning!

 

The are different opinions about when to use a Queued State Machine (QSM).

 

QSM's are the favorites on old-school coders that use a programming paraidgm similar to pushing and popping from Stacks. THe QSM is a natural for them and they use that construct like they would have in other langauges.

 

I use State Mahcines and seldom QSMs. The big differnce is I can draw up a State Transition Diagram for a SM. Due to the nature of the QSM (call any one or more of all states from any state) I run into transitons that can not be documented.

 

I also find SM easier to trouble shoot becuase I KNOW what states executed prior to a failure. In a QSM I only know if I am single-stepping.

 

Ben

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 6
(2,401 Views)