From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write waveform x-axes values to tdms file

Hi everyone, 

 

I'm trying to write real-time measurement to tdms file. I have two problems. Firstly, there is only amplitude values of signal, i want to see a time column- it should show which amplitude at which second.(ex : 0.0-0.0, 0.001-0.015 etc.) I will check frequency information.  I used get waveform time array, get waveform components functions but there is date/time information. It is not really what i want.  I read all topics about time in forum, no answer for me. Sorry if i replicated.

Secondly, when i ran the project, tdms file is not opening sometimes, especially first run. After trying again, it's ok. I need your suggestions.

There is a picture of a part of all project, tdms write section, tdms file, and my sample vi with usb 6001 for time column(2017version)( I'm trying to write time column firstly with usb 6001 for sine signal from function generator)

 

Thank you all,

Ozge

 

Download All
0 Kudos
Message 1 of 8
(3,075 Views)

First, let me say I've never used TDMS, so I may be way off base (and apologize in advance).  Second, you do know, I hope, that a Waveform has time implicitly carried in the T0 and dt elements of the Waveform Cluster, thereby eliminating an entire "Time" array and saving significant disk space (the file for a single channel should have size approximately N, for the number of samples, rather than 2*N, for Time + Samples).

 

I would assume that if you write a Waveform into TDMS, you can read a Waveform from TDMS.  If you want to recreate the Time channel (as T0, T0+dt, T0+2*dt, T0+3*dt, ...), you can use the Get Waveform Time Array from the Waveform Palette.

 

Bob Schor

0 Kudos
Message 2 of 8
(3,044 Views)

Took a look at your VI and I am not quite sure to understand what you are trying to achieve. But as Bob mentionned, you don't need to recreate the time array as your waveform already has the time information in it (t0 + dt).

 

Now just a quick advice : do not put the Open TDMS and Close TDMS inside your loop. It will require more time to process as you will continuously open and close your file, but more importantly in your case, it will replace the saved file over and over again 😉

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 3 of 8
(3,043 Views)

Thank you Bob for your answer. Time is needed because i'm not sure about frequency and phase of my measurement. So it is only for correction.  I found an example about get waveform time array.(https://forums.ni.com/t5/Example-Programs/Get-relative-time-of-acquisition-from-Waveform-Dynamic-Dat...) It gave me what i want. But i will think your suggestion. 

0 Kudos
Message 4 of 8
(3,032 Views)

Thank you ML927 for your answer. There was Express Write Measurement File vi instead of tdms file. But it slow down the system when press save button. I changed it with TDMS file. Firstly, i used open/close TDMS inside loop, as you said, nothing changed as before. But now, they are out of loop, there is problem with first run. It doesn't create tdms file at first run. 

Time is only needed to see whether my measurement is correct. It's ok now. 

0 Kudos
Message 5 of 8
(3,029 Views)

What do you mean by "there is a problem at first run" ?

My guess is that your data dependency between the two loop may be a key to your problem now 😉

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 6 of 8
(3,018 Views)

I don't know. When run the code the first time, it does not create tdms file. After, i close code, open and run again, there is tdms file in desktop. Maybe because of file path... I will try to run it without while loop. 

Thanks!

0 Kudos
Message 7 of 8
(3,006 Views)

Works perfectly for me...

 

oztaymor.png

 

You have two loops running with data dependencies, are you sure taht your first loops is done when you first try to save your data ?

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 8 of 8
(2,994 Views)