LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed loop/queues or producer/consumer

Gurus,

 

I am using a large, but uncomplicated data acquisition program. I generate two 2D-arrays queues from reading and writing to an analogue in/out card at 10Hz in a timed loop. A couple of parallel timed loops preview the queues and average these once per second to produce two 1D array queues.Let's call them the temperature and flow queues.

 

An another timed loop does a couple of serial port read/writes per second to produce a 1Hz counts queue. In this loop, the temp and flow queues are called (previewed), and along with the counts converted to array of strings and written to file at 1Hz.I put offsets in my loops to hopefully allow 10Hz stuff to update before the temp and flow queue average before the counts timed loop previews them.

 

Although the time stamp increments in the file, I am losing seconds/system is running slow.....

 

Is this good programming or should I be looking at otherways of handling this data?

 

Paul

"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 1 of 4
(3,253 Views)

The offset can not guaranty the correct order of the code flow.

Use a notifier. You should be able to add one without big changes in your code

0 Kudos
Message 2 of 4
(3,239 Views)

Thanks for that. New to Notifiers, so need to do some reading.

 

Looking quickly at this, are notifiers some sort of data queue? It looks like you could acheive the same result with a queue and some functional global variables.

 

I also read on the help that the if a notifier is in a loop it creates a new reference on each iteration (effective memory leak). Anyway to avoid that? I am running stuff at 1Hz - 10Hz for several days-weeks.

 

Paul

Message Edited by Manc Pablo on 03-05-2009 03:53 AM
Message Edited by Manc Pablo on 03-05-2009 03:53 AM
"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 3 of 4
(3,205 Views)

The Obtain Notifier will be outside the loop, the Wait for notification will be inside. No memory leak.

 

I think you can achieve the same with just a functional global. A boolean with two states

0 Kudos
Message 4 of 4
(3,194 Views)