LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging Data From A Front Pannel (Numeric) Indicator

So I am nearing completion on a VI that controls a pump based on readings from a pressure transducer. There are several loops, sequence structures, and conditional statements in the VI that measure and manipulate the pressure transducer readings. I am reading the pressure transducer using a non-NI brand DAQ box. Everything is working great, but now I realize that I have to log the pressure data from each run of the VI.
 
The front pannel of the VI is relatively simple - a numeric indicator of the pressure, a chart of the pressure, and a numeric indicator of the volume delivered by the pump. The code updates the pressure indicator at several places using (primarily) local variables. I started to lay in arrays commands to collect the pressure data as code progressed, but then thought of coming here to ask if anyone knows of a better way.
 
Here is the question: is there a way to grab the values indicated on a front pannel indicator (no matter where in the code they came from), and write those values to an array that I can then dump to a spreadsheet when the run is complete? It seems to me that the answer may lie in a separate VI communicating with the primary VI via a global variable - both running simultaneously. Any comments or suggestions would be greatly appreciated.
 
 
0 Kudos
Message 1 of 2
(2,510 Views)
The two simplest ways would be to either branch a wire off before it heads into the indicator and send that to a VI which does the logging for you.  This will work if the logging function VI is in the same loop.
 
Or, use a local variable of the indicator.   (I see by your description you are using some local variables.)  This would allow the logging feature to be put into another loop.  There is a lot of talk in the forum about avoiding using local variables due to race conditions.  Another concern is that if the loops are running at different rates, or get out of synch with each other, you run the risk of losing a piece of data (which may or may not be important to you.).  Or you could wind up logging the same piece of data twice.
 
A little more sophisticated alternative is to use queues.  In this situation, the first loop puts the data into the indicator, but also puts it in a queue that got created before the loops started.  The second loop pulls data off the queue and does the logging function.  This is probably the better structure to use.  Look for the producer/consumer architecture in File/New .... and the design patterns template.
Message 2 of 2
(2,501 Views)