LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adjusting time stamp of AI waveform when using pause triggering

Hi Everybody,

I've written a VI that acquires data (AI) at specified time intervals by using pause triggering and a counter signal, but the resulting time stamps associated with the data points in the AI waveform are NOT the actual time relative to the start of the initial acquisition. I was thinking of modifying the time stamps (post-acquisition) for each set of data points per interval by adding the "off" time as set by the counter signal, thereby adjusting the time stamps of the data to real time. I then have a subVI that will convert the time stamps to elapsed time. I also have an AO waveform being generated at the same time, and was wondering if I could somehow use those time stamps values if they were synced to the AI somehow, although this seems more difficult. The adjustment does not need to be extremely accurate, and can vary on the order of seconds (e.g., the last data point could be at 9990 seconds for an acquisition that actually ended after 10000 seconds). Any suggestions?

As an aside, the important point of this part of my program is to reduce the amount of data being collected. I need a high sampling rate to acquire waveforms with pulse widths on the order of milliseconds, but typically run the experiment overnight (+12 hrs.) so the files get really big (e.g., 3 GB!). I could try writing to binary files, but I haven't figured out how to read the file and then split the data into smaller files of user-defined size that can then be converted to text/.xls files. If you have any ideas on how I might do this as well, I'd greatly appreciate the help! Thanks!

Unagi

0 Kudos
Message 1 of 5
(3,062 Views)

Unagi,

I am not exactly sure what you are trying to do, but I can take a guess.  When performing analog input measurements the waveform is composed of t0, dt and Y.  You can manipulate any of these values after the data has been acquired.  If you set up the task the waveform should contain an absolute time, not relative.  If relative is required, as you suggested, this can be done post acquisition with the build waveform components vi. 

I do not understand exactly what you want do with the timestamps for the analog output.  Do you want to use the relative time computed from the analog input data for the analog output waveform?  If so, you could build a waveform and use the t0, dt from the analog input processed/relative time waveform.  Again this would be done with the build waveform components vi.

Finally, a binary file would reduce the amount of memory required when saving your data.  A binary file is fairly simple to save and open in LabVIEW.  There are a couple examples in NI Example Finder (i.e. Write Binary File and Read Binary File) that show you how to write and read binary files.  If you write the data to a binary file during acquisition, and modify/split it later you could open the binary file, retrieve the data in LabVIEW, and write a small subset to a text file.  Alternatively, you could perform some analysis of the data during acquisition and only save the set of data that you require post acquisition.

Regards,

Jesse O.
Application Engineering
National Instruments

Jesse O. | National Instruments R&D
0 Kudos
Message 2 of 5
(3,043 Views)
Jessie O,

Thanks for the reply! I have written a subVI to perform post-acquisition on non-pause-triggered AI data in order to obtain relative time values (i.e., elapsed time), and the results work fine. However, when I run acquisition with pause-triggering, the plotted V vs. time data does not contain the expected "pause times" where no data should exist. Instead it plots a continuous waveform that contains obvious breaks in periodicity where the pauses took place. To make sure I'm understanding your reply, if you were to log data for 2 seconds and pause for 3 seconds (based on the timing of the counter source), I should obtain data points that have a relative time of up to 2 seconds, then the next set of data points should start at 5 seconds relative time, correct? If this is true then I need to take a look at what my subVI may be doing incorrectly. I guess the first step is to make sure the above question is true. Thanks again for the reply!

Unagi

0 Kudos
Message 3 of 5
(3,040 Views)

Unagi,

The waveform data type keeps track of Y, dt and t0, where t0 is the starting time of the acquisition.  The time for each point is then calculated based upon the dt. This means that if you pause your data acquisition (using a counter to generate the sample clock) the duration of the pause is not tracked.  So you are correct is seeing that the pause is missed.

Jesse O.
Application Engineering
National Instruments

Jesse O. | National Instruments R&D
0 Kudos
Message 4 of 5
(3,024 Views)
If you still have a counter available, you could set it up to help you characterize the on and off times.  I've used this type of technique before and there are a few different approaches that can work. 
 
An easy one to conceptualize is to buffer a timestamp count on every AI sample clock edge.  Another way would be to perform buffered semi-period measurement on the Pause Trigger signal.  The details of your app will help to determine which method is best-suited for your needs.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 5
(3,022 Views)