LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Running Time

Hello All-
 
I currently have a vi that works the way I want only the first time I run it.  What I am trying to do is capture waveform data, get an averaged RMS and then log that value, along with the time the averaged value occurs at.  The first time I run it, it works exactly as I want it to.  If I run it a second time all I get is the number  3223399424 everytime.  If I close out Labview and start over it works good again. 
 
Can someone please explain to me what is going on and how I fix it?  I have attached the .vi and an example of the output for a first run and a second run.
 
Thanks a million.
Trent
Download All
0 Kudos
Message 1 of 6
(3,193 Views)

I'm not sure why it's working the first time. When DAQmx Read returns a waveform, the t0 is the actual date and time of the acquisition. The Get Waveform Time Array converts the timestamps to DBLs and that is the very large number you are seeing. If you don't want to save the actual time to your file, Don't use Get Waveform Time Array. Get the dt from the waveform data type and build an array in a for loop that has a shift register. Initialize the shift register with 0 and then add dt to the shift register value.

Message Edited by Dennis Knutson on 02-22-2006 12:21 PM

Message Edited by Dennis Knutson on 02-22-2006 12:22 PM

Message 2 of 6
(3,178 Views)

Hi Trent,

Dennis is exactly right (of course...).  The large number you're seeing is the time stamp--a time-zone-independent number of seconds that have elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time.  You can feed the output of WDT Get Waveform Time Array VI into a To Time Stamp VI and see the actual timestamps.

Hope this helps!
Megan B.
National Instruments

0 Kudos
Message 3 of 6
(3,165 Views)

Hi

I am facing a similar problem of waveform timing; in that, I am sampling a waveform using Finite samples mode and then passing them to another section of the program using notifiers.  At the receiving end, I reconstruct the wave (by simply building an array) once the sampling ends and then display it one a XY graph.  When I used the 'dt' method to create the time array, the resulting wave does not match the input wave.  I reckon the reason to be the delay in acquiring the wave casued by other processes.  So instead, I acquired the time array from the waveform using the 'Get Time Array' vi and once I had reconstructed the wave, I simply subtracted the time value in TimeArray, index 0, from rest of the elements so that they were referenced to zero.  The result seems to be improved but I wa wondering whether there is any other novel way of doing this?

Zulfi

0 Kudos
Message 4 of 6
(3,126 Views)

Hi Zulfi,

If I understand your explanation, you are reading finite samples from your waveform in a loop, but when you try to reconstruct the waveform, it isn't exactly right because of the delay between samples.  A better solution might be to sample the waveform continuously or in larger sample sets.  The solution you have come up with looks like it should work pretty well, and I can't think of something significantly simpler with the Data Acquisition occuring in spurts like I think it is.

Perhaps if you posted a simplified section of code it would be clearer exactly how everything is working.  By the way--you will typically get many more responses if you create a new post rather than posting on an old thread.

Cheers!
Megan B.
Applications Engineer
National Instruments

Message 5 of 6
(3,106 Views)

Thanx Megan... initially I was doubtful whether the loop would be able to send out notifications fast enough if I run the DAQ continuously but I tried it and also increased the number of samples being acquired and it works like a charm... Now I dont need to offset my timings; instead I just create a time array using the sampling rate. And also thanx for the advice on posting in new threads... I just thought of posting it here as it was related to my problem so making it easier for someone else who has the same problem in future to find the solution in one place.

Zulfi

0 Kudos
Message 6 of 6
(3,094 Views)