07-07-2009 12:19 PM
07-07-2009 12:37 PM
1. No the data will be divided between the 3 consumer loops. Not necessarily evenly divided either. If one loop runs fast than the other two, it might get more than 1/3 of the queue elements.
2. If you want all 3 loops to get the same data, create 3 separate queues and place the same data in all 3 queues. All 3 consumer loops will get the data and work on it at their own pace.
07-07-2009 01:06 PM
Another option for this situation is to use an Action Engine. You Write to it in the Producer and Read from it as many places as you need without losing the data. Look at Ben's Nugget on Action Engines as a starting place to learn about this useful technique.
Lynn
07-09-2009 04:23 AM - edited 07-09-2009 04:24 AM
Hello gimmie code gimmie,,
Herewith a simple example. You will find the DADS and the Plotting in the producer loop, when you the loop is awaiting for the sample there will be enough time to plot the data. In the consumer depends on the data rate of the producer loop, so there will be time to do some processing and write the data to (binary) file.
As you wish you can adjust this example to your needs.
Regards Casper
07-09-2009 04:50 AM - edited 07-09-2009 04:53 AM
I can think of a solution but it may be overly complicated. 🙂
Basically, the producer loop enqueues elements into a single queue. Each consumer loop then uses the 'Preview Queue Element' to look at the next element in the queue without removing it.
The rendezvous then synchronise the loops.
I've included a simple picture outlining my thought - i don't know how feasable it is though since it would mean that all three consumer loops would execute (although at different speeds) the same number of times.
07-09-2009 05:03 AM
Use User Events instead of Queues.
Events can be registered for n consumers and every data piece sent is sent to EACH and each one can work on the data at their own speed.
Shane.
08-14-2009 08:34 AM
08-14-2009 08:49 AM
I would concider a hibrid version using both queues and an Action Engine.
Use a unique queue for display and logging. Both of them can fall behind and catch up later.
To enusre the Safety checks are implemented as quickly as possible, I'd concider using an AE in the DAQ function (producer) to check the conditions and act accordingly if required.
Ben