ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sampling waveform values and writing corresponding time values

I am sampling the frequency of a generator set using a 1126 module. The frequency values I am getting are approximately 60 Hz.

I am sampling at 150 samples per second and using the Index Waveform Array function to peel off the frequency waveform. Then I am running that waveform wire (brown) through a Get Waveform components function to seperate the t0, dt, and y components. I am taking the oranage wire from the Y portion to write those values to a spreadsheet file. Then I want to build an array of the frequency values and the time values and write that to file (transposing the array if need be).

I want one column to be the frequency values and the second column to be the correspond
ing time values for each of those data points. For example, starting at t=0:

Frequency (Hz) Time (s)
60.0 0
60.1 0.0066666
59.9 0.0133333
60.2 0.0200000
60.1 0.0266666
|
|
| end of first second
|
V
60.5 0.9866666
60.1 0.9933333
60.0 1.0000000
59.7 1.0066666


The time interval increments by 1/150 of a second each time a sample is taken (150 times per second).

I tried to use the Get Waveform Time Array function, but that returned a 10 digit number that did not appear to be related to the time in seconds.

Can someone please advise me on how I can get the corresponding time values in seconds for waveform data points in the situation described above? Thanks!
0 Kudos
Message 1 of 3
(2,807 Views)
One of the easiest ways to do this, if your data is always 1/150 second apart, would be to find the index of the point in question within the array and multiply by 1/150 of a second.

First point is stored at index 0 in the array and would be 0 times 1/150 = 0.
Second point is stored at index 1 in the array and would be 1 times 1/150 = 1/150.
etc.
0 Kudos
Message 2 of 3
(2,807 Views)
Since you are aquiring at a constant sample time, you could try using the ramp pattern to generate the time column.
I attach a sample VI in which I generate the ramp starting from waveform characteristics and then create the 2d array to save to disk with Write to Spreadsheet File.vi.
Hope this helps
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(2,807 Views)