06-08-2014 11:49 AM
Hello,
What are the advantages of using a Queued Message Handler? Also, why are they more powerful than using Standard State Machines?
Thanks!
06-08-2014 12:12 PM
They are really just sort of an extension of a state machine. The general idea is that you have one loop doing a specific job. You then use a queue to tell it how/when to do this job. For instance, I might have a log file loop. I will send it commands to open a file, write some data, write some more data, and finally close the file. Each of those commands are coming from the queue. The beauty with this setup is that anybody that can get a reference to that queue can send the command to that loop.
So the QMH is "better" than a state machine mostly because of the decoupling of functions. In a given application, I will have a loop for log file writing, GUI updates, reading of a DAQ, instrumenet communications, server communications, etc. Trying to do all of that in a single loop state machine is a major pain in the rear end. Seperating them out makes life so much easier.
06-08-2014 12:23 PM
Thanks CrossRulz - I am new to Queues and Queued Message Handlers. Are there any basic examples out there that would give someone a good grasp on how a QMH works?
Thanks!
06-08-2014 01:19 PM
Hello hobby1,
If you're using LabVIEW 2012 or newer, there is a QMH template that ships with it, and the documentation on how it works and how to modify it for your needs is fairly extensive. This documentation is included in the template project itself (under the Project Documentation virtual folder); instructions for locating it can be found here:
http://www.ni.com/white-paper/14119/en/
Regards,
06-08-2014 01:20 PM
After a quick search, you might want to start here: Queued Message Handler using Variants
Once you get a good handle on queues, you could go into the QMH Sample Project. Here's a presentation Darren did on the sample project and the decisions that went into the design:[NIWeek 2013] Queued Message Handler: Caveats and Design Decisions
10-19-2020 07:25 AM
One of the differences noted in the excellent links provided in the Reply from @crossrulz was that the QMH was designed for parallel loops, while the Simple State Machine was a single-loop design. There are two other (much more advanced) designs that extend the Parallel Loop theme, but involve LabVIEW Classes (which have their own "Learning Curve" -- the Actor Framework and the Delacor Queued Message Handler (or "DQMH"), recognized as a 2016 "Product of the Year" Award from NI.
You are probably not ready for either of these at this time -- I'm mentioning them here to illustrate that LabVIEW and its tools can help you design and maintain Projects with many "movable, interacting parts".
Bob Schor
10-19-2020 09:41 AM - edited 10-19-2020 09:41 AM
@0utlaw wrote:
Hello hobby1,
If you're using LabVIEW 2012 or newer, there is a QMH template that ships with it, and the documentation on how it works and how to modify it for your needs is fairly extensive.
The QMH concept makes sense but that example program/template really makes no sense to me.
I have been coming back to that QMH Template over and over again since probably 2014 and still have not managed to modify it for any of my needs. Everything is so tightly coupled that it is impossible to make any changes without blowing the whole thing up.
In the end it has always been faster to just start from scratch than try to modify a program template.