02-24-2011 01:46 PM
I am trying to implement a master slave design as shown in the VI attached. The main loop acquires temperature and pressure data and displays it. I would like to trigger loop 1 and 2 from the main loop using queues and/or notifiers. My knowledge in this area is limited and I would like to know if there is a better way to make this work. Any suggestions and corrections are appreciated.
02-24-2011 03:02 PM
Queues and notifiers are the right way to go. I think you may misunderstand the event structure though. Your timeout event essentially looks like your state machine. This should probably be in its own loop separated from the UI events. You want to respond quickly to the user events (button presses or whatever) and as written you could potentially stay in one of the cases (you state you will continually acquire data in one case) and that would prevent you from processing any other events. You generally want to keep all processing in event cases as fast as possible.
I would create a true state machine that will run your image collection. Depending on what you are doing here and how quickly you need to get the images you may or may not want process them here. If the processing is fairly fast than you can do it here. If it will take longer do it in another task (parallel loop). At the moment you are passing a cluster that only contains a Boolean. You might want to pass more meaningful messages in your queue/notifier. If you use a cluster with a message ID (typedefed ENUM or string) and specific elements for the message data you can consumers can do more than simply chose between true and false. Your consumer can process a wider range of messages. If your data is very large you may need to consider a way to operate on a single copy of it. Posting to a queue will result in a copy of the data and you can take a performance hit if you are continually copying large amounts of data.
02-26-2011 12:06 AM
Ok so here's my attempt at your solution.I decided to have most of the data processing in separate loops. The idea with the event structure was to have a timer to trigger events (feed, log, vision) and also be able to use buttons on the UI. I'd also like to get continous images (video) and apparently thats not happening.
02-26-2011 06:22 AM
Charles,
I don't know wether you cruised through the examples yet, but this one is pretty good if you want to get to know the basics.
Goto your LabVIEW folder in program files : examples\general\queue.llb\Queue Basics.vi
If it not good enough, just let me know, and I will make a custom made VI for your needs.
But I'd rather have you to find it out for yourself, cause you will learn the most of it.
Kind regards,
Bjorn