LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Queued State Machine as Parellel Process Enabler

Nice article!

However, I found that if we keep separate notions for state, action, and event, think (and treat) the code in the cases of the consumer loop as actions rather than states, maintain separate queues for events and actions, not only it allows creating a more flexible and powerful architecture, but, most importantly, developing code on a higher level of abstraction (when in this state and this event happens I need to do this, this and this action and switch to that state). Please see the following for further discussion and a more advanced architecture:

http://forums.lavag.org/Simple-Event-Driven-Queued-State-Machine-with-Front-Panel-Events-and-a-Timer...

Despite the pattern discussed there doesn't support hierarchical states (for those implemented see labhsm.com) I found it much more powerful and flexible (yet producing uniformly looking and easily modifiable/maintainable code) than the standard producer consumer single queue QSM pattern.

0 Kudos
Message 21 of 37
(3,427 Views)
Hi, I wanted to thank you for such a nice article. It helped me a lot in past couple of months. But I have a question that doesn't let me sleep. I realized that couple of you when designing QSM and using separate loop to handle UI you don't wire and handle errors there. I know that it is mostly just adding states into the queue but I think that in certain circumstances an error can occur even during that. So should I concern about it or forget it and sleep tightly? Thx
LV 2011, Win7
0 Kudos
Message 22 of 37
(3,281 Views)
Hi ceties,

I would always recommend implementing error handling;  it doesn't really hurt anything, and it can often be very useful.  There is a great Developer's Zone article that discusses the benefits of error handling in LabVIEW.
Eric V
National Instruments
Applications Engineer
Certified LabVIEW Associate Developer


"I'm a Ramblin' Wreck from Georgia Tech and a helluva (NI Applications) Engineer!"
0 Kudos
Message 23 of 37
(3,256 Views)

Hi,

 

     This is an excellent article. Thanks, Anthony. 

 

     A question for everyone:  has anybody made any progress in integrating labview classes into their QSMs?  If so, can you describe how you've used classes?

 

     Quick comments to Anthony: 

1)  I agree that the queuing/dequeing operations probably should have error handling. 

2)  If you're using a global variable (Exit) across all of your loops and subvi's, won't this global actually prevent the separate loops/subvi's from being "chunked" and distributed to multiple processors?  I may be wrong about this, but if I'm not, you may want to handle this differently, e.g., with a functional global or with more queue messaging.  Otherwise, I think your code may wind up running mostly on one processor, even on a 4- or 8-core machine.  Can anyone with more knowledge confirm that the global variable will actually prevent parallel processing here?

 

    Regardless of the issues above, really nice article.

 

Thanks,

Eric 

 

 

 

 

    

 

0 Kudos
Message 24 of 37
(3,049 Views)

tst,

 

I don't suppose your code to clone the VIs and typedefs is freely available? 😉

 

 

0 Kudos
Message 25 of 37
(3,046 Views)
No, but OpenG and MGI should both have renaming tools which can help you. A quick look at the OpenG one indicates that it also has support for changing a prefix or suffix, which I believe should give you what you want.

___________________
Try to take over the world!
Message 26 of 37
(3,058 Views)

Hello, i cannot find the article Days of the Queued state machine are now behind...

can someone post me the correct link for this?

thanks

 

Riccardo

 

 

Stradis:

Your comments are appreciated. I am revising the article and will definitely include the material. I have yet to install LabVIEW 8.5 but once I do I will review your examples. I also spotted an interesting LAVA thread on this same topic which questions whether the Days of the Queued State Machine are now behind us.  I will include a link to that discussion as well. Regarding that specific thread, I think  the queued state machine is still important because it can be adapted to take advantage of LabVIEW upgrades and features such as LV Classes and hyperthreading.

Anthony L.

0 Kudos
Message 27 of 37
(2,517 Views)

🙂  Well I have changed my handle such that I do not need to worry about changing it again.. But I am still using my (OK, several of us worked together on this over the years, so should read OUR) QSM architecture relatively unchanged in the past 3 years.  Just curious, why you revived this thread after so long?

 

[EDIT]  Never mind... I see what your real question is.. You should post this to the LAVA forum, as they have redone their website in the last several months and ask where the archive may exist... if it exists [/EDIT]


Message Edited by PJS on 11-05-2009 11:34 AM

Paul
0 Kudos
Message 28 of 37
(2,515 Views)

Riccardo-99 wrote:

...

Your comments are appreciated. I am revising the article and will definitely include the material. I have yet to install LabVIEW 8.5 but once I do I will review your examples. I also spotted an interesting LAVA thread on this same topic which questions whether the Days of the Queued State Machine are now behind us.  I will include a link to that discussion as well. Regarding that specific thread, I think  the queued state machine is still important because it can be adapted to take advantage of LabVIEW upgrades and features such as LV Classes and hyperthreading.

Anthony L.


That thread (along with about 500 of my posts Smiley Mad Smiley Sad ) were lost in the LAVA crash of 2009.

 

Goolge remebers it but not LAVA.

 

Try posting over there to see if they can find it in their archives.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 29 of 37
(2,493 Views)

Ben,

Isn't there a website that collects old versions of pages on the web?  I don't remember that name of it, nor have time to research today, but maybe there is an archived version there?

-p 


Paul
0 Kudos
Message 30 of 37
(2,489 Views)