04-12-2018 03:47 AM
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
04-12-2018 09:14 AM
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
04-12-2018 09:20 AM
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 😉
04-13-2018 02:22 AM
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.
04-13-2018 03:19 AM
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.
04-13-2018 07:47 AM
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 😉
04-16-2018 02:54 AM
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!
04-16-2018 08:15 AM
Works perfectly for me...
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 ?