LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer array of waveforms to slow down fileprint frequency

I have a loop which currently operates at ca 10Hz, producing an array of currently 14 elements at each iteration where each element currently consist of a single point waveform. I'd like to append these single point waveforms to them selves, or buffer them, for a certain duration and then export the data to a file so that I don't have to print at a high frequency.

 

I thought I'd be simple enough just to use a queue and flush it but that do not release the data in the correct format but to a pink array of whatever that might be. Is there a neat way of buffering up the array of waveforms, or create a multi signal waveform perhaps if that's possible?

 

Or do I simply have to make the routine myself by extracting each array increment and element and build up the waveforms "manually"?

0 Kudos
Message 1 of 4
(2,396 Views)

The concept of a "single point waveform" makes not-so-much sense -- you get a useful t0 (but do you really need a 128-bit TimeStamp?), a meaningless dt (I presume it is 0), and an Array consisting of a single point (more wasted Data Space).

 

Waveforms are an efficient way to store hardware-timed (i.e. "where you trust the timing") data arrays, where (a) the single (large) TimeStamp is a very small part of the Waveform Cluster, (b) dt accurately reflects the (equal) time spacing between the points, and (c) the Data Array (Y) efficiently collect a "chunk" of data.  This works well with DAQmx Multi-Sample acquisition (e.g. 100 points at 1 kHz).  If you are taking single samples at a low data rate (such as 10 Hz), a simple binary write of the data points is fast, efficient, and only requires (somewhere, somehow) saving the equivalent of the Starting Time (if this is important in the context of the data stream -- does it matter if the data are collected on Tuesday or Wednesday?) and the sampling interval.  There are multiple ways to accomplish these goals that are conceptually simple, easy to code, and easy to understand/modify/use.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,354 Views)

I do use DAQmx at 1000Hz and collecting 100 samples at each iteration, then i process my data and downsample it to 10 Hz to get rid of the noise among other things. This means that each iteration of my consumer loop only produces 1 sample point of each channel. Sure, it's not efficient with 1p waveforms but it's only temporary since, according to my question, I'd like to buffer the waveforms, "collect them back together" again but at lower frequency, and export them.

 

Sure, I could collect more points and run the consumer loop slower if that is what it takes, i.e. 200 points or more, but I'd like not to slow down the loop too much since I would like a decent update frequency on my charts etc which are dependent on the consumer loop

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

@KRICLA wrote:

I thought I'd be simple enough just to use a queue and flush it but that do not release the data in the correct format but to a pink array of whatever that might be. 

 

Or do I simply have to make the routine myself by extracting each array increment and element and build up the waveforms "manually"?


That "pink array" from the Flush operation is your data. Create a constant from the terminal to see the format.

To decode it, the first step would be a For Loop since it is an array. From there you have to figure out what is

needed to extract the data (like Get Waveform Components), then concatenate the data to get the format you

want.

 

If you have trouble, attach a vi that has your Queue data type. When I create a queue with type waveform,

the "remaining elements" wire from the Flush function is not pink. (Pink would make sense if you are just

storing a timestamp and a double.)

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 4
(2,318 Views)