LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating .tdms file using write to measurement

I am trying to record data from my DAQ device using a write to measurement file. I have everything set up so that each time I run labview it creates a .tdms file that I can open in excell with the time and the data in columns. However for what ever reason the data is being rounded down to the last second, which means if I record for 4.9 seconds only data from 0 to 3.98 seconds will appear in the file. This is the same for any time limit that I use and I would like to have real time data not rounded down data.

 

Attached is the labview code.

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

Hiya Alana,

 

I am afraid I am not seeing the same issue as you.

I took your code and made some (very) minor modifications. I did add some bench marking, so we could see how long the code had been aquiring data. Everything seemed to corrolate well.

When I run the attached code, the "total acquisition time" updates each 0.5 seconds (approx). This makes perfect sense ofcourse, as you have set up the simulate signal and daq tasks to work at 2Hz.

 

Number of samples to read/Sample rate = iteration rate of your loop (ie. how often the DAQ card passes data tpo your vi).

25 / 50 = 2Hz

 

I ran the code for 9.5seconds, and when I open the generated tdms file, I can see that it has logged 9.4800 seconds worth of data. This is perfectly reasonable. Here is a subset of data from the file.

 

time

9.240000 0.253948 0.998027
9.260000 0.253948 0.998027
9.280000 0.253786 0.982287
9.300000 0.253786 0.951057
9.320000 0.253948 0.904827
9.340000 0.253948 0.844328
9.360000 0.253948 0.770513
9.380000 0.253948 0.684547
9.400000 0.253786 0.587785
9.420000 0.253948 0.481754
9.440000 0.254110 0.368125
9.460000 0.253948 0.248690
9.480000 0.253948 0.125333

 

Also, note that the time between samples is correct. 20ms. This is defined by the specified sample  rate = 50Hz.

 

Please correct me if I have missed something, but this seems to be working as expected.

Thanks for your time,

Best wishes,

 

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
0 Kudos
Message 2 of 2
(2,244 Views)