LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Event, Producer- and Consumer Loop

Solved!
Go to solution

I have an application in which I have a Producer Loop, which gives me data and apends this to a queue. The queue elements are then read in a separate consumer loop, since the analysis of the data is rather long. The producer Loop only enqueues every 0.05 seconds or so (as this is the time it takes to make a measurement).

The problem I have is that I have user controls which are required for the analysis, e.g. an Offset value. The user can change this value and the upated value is then applied in the analysis.

What is the best architecture for this?

I was thinking that instead of the present 2 loops, I add a third loop which handles User Events.

But then how do I get the new values into the consumer loop? Another queue? Wouldn't this affect timing? Another alternative would be to put all the controls in the already existing Producer Loop a,d bundle everything into a cluster (controls and data) and add that to the queue. This seems messy though.

Any experiences?

0 Kudos
Message 1 of 5
(2,805 Views)
Solution
Accepted by topic author dougbockILT

having three loops is not a bad idea, so

producer, processing/consumer, display/consumer

 

the information transfer between all of these is the part where it depends on personal preference, i think.

you have globals and local variables (both with the problem of race conditions)

action engines / funtional globals,

notifiers, queues and user events

 

i like the user events, because its mostly the same as queues, but you can act on them with event structure (and therefor also handle UI events)

 

have a look at the example, hope that helps

 

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 5
(2,784 Views)

Have you got a LabVIEW 15 version of this example...?

0 Kudos
Message 3 of 5
(2,772 Views)

here you go


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 5
(2,770 Views)

@dougbockILT wrote:

The problem I have is that I have user controls which are required for the analysis, e.g. an Offset value. The user can change this value and the upated value is then applied in the analysis.


Are those values only needed for the analysis?  If so, just put the terminals in the consumer loop and read them off directly.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(2,727 Views)