LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous measurement periodic logging

Hello, I am trying to adapt the labview 2012 sample project "Continuous Measurement and Logging (NI-DAQmx)" to accomondate the data displayed to be recorded at a user selectable 1-5 minute interval. I need to have continuous monitoring but only log data from 0, 5, 10, 15, 20 mins... or any other interval of time. Is there a way to read the timestamp of a waveform and the only save the ones that are closet to the user set interval and the intial measurement? I would also like to have the timestamp saved as a the first column of data in the .tdms file. The system monitors serial port data (9600 baud, mass scale) and also ai inputs of a usb-6009 and Ni-9217 so my measurements are not synchronized. Any ideas or directions to explore? 

0 Kudos
Message 1 of 2
(2,887 Views)

Wow -- I hadn't really looked at these "simple" examples (not so simple!).  However, it should be fairly easy to do what you want.  Notice that the VI "Log Data" (in the Logging library) has the responsibility of dequeuing samples from the Data Queue and writing them to the TDMS file.  What you really want to do is to write every "n-th" point (it's equivalent to "save a point every M minutes", but a little easier to program).  Say your sampling rate is 100 Hz, and you want to save a sample every 2 minutes.  That's 1 sample every 100*60*2 = 12000 samples.  You could wrap a While loop around the Log Data code, wire True to the Stop terminal (this makes it a "Do Once" loop), run a Shift Register through the loop that increments a U32 counter (and thus becomes a "sample counter", and only pass the data to the TDMS file when the count is a multiple of 12000 (I presume you know how to do this -- one way is to write the sample counter to the top input of the Quotient and Remainder function, 12000 to the bottom input, then test if the remainder = 0).

 

If you want to change the frequency of logging, simply recompute the number of samples per logged sample, as described above.

0 Kudos
Message 2 of 2
(2,858 Views)