08-08-2014 11:12 AM
Hi forum,
i have problems streaming a lot of data to a file. I am using write to measurment file with tdms in the while loop but my pc is to slow to do this streaming (100Ks/s for 10s).
For optimizing i was thinking to open a tdms file outside the while loop stream it to file in the recording state and then read it to another file in the logging state, clear it and i could stream again.
But can i delate data from the tdms format, or is there something easier to do?
Thanks and best
Martin
08-08-2014 11:18 AM
Where is the data coming from?
You definately should be opening the file before your loop and closing it after your loop. You can then write as much as you want inside of the loop. Nothing extra should be needed.
But if this data is coming from a DAQmx task, use the DAQmx Configure Logging and it will stream the data to disk for you. You just have to tell it where to put the file.
08-08-2014 12:01 PM
Hi crossruiz,
thanks for your answer i am using a USB cDaq 9171, the problem is i want to have new tdms file every time it gets in the recording state for 5s. The programm will be normal never go out of the while loop so how i could do this? thanks and best,
Martin
08-08-2014 02:12 PM
Martin88 wrote: the problem is i want to have new tdms file every time it gets in the recording state for 5s.
Use the DAQmx Start New File VI.
If you don't want to record everything, then you will need to read the data and then use the TDMS File API or stop and restart your task.
08-11-2014 01:49 AM
HI
thanks for ur answer, is there no other way to use a file reference stream the data to tdms read it from there in another file, and then set the tdms file to 0, so i could stream again?
Best,
Martin
08-11-2014 08:27 PM - edited 08-11-2014 08:27 PM
There is an option called "create or replace" in TDMS Open, you can use it to replace your original TDMS file when you are done with it.
08-13-2014 10:55 AM
Hi deppSu,
thanks for your answer but is till have to leave the while loop to replace the tdms file no? I was thinking about to open a temp tdms file outside the while loop write the data to file in another state i read the data to a new file and then delate the data from the temp tdms file.
May i am wrong?
Best
Martin
08-13-2014 01:35 PM
Run your while loop to collect data continuous. You can put the data in a Que in that loop by using the enqueue element. Use another while loop to dequeue the waveform data and write to the tdms file. The dequeue loop will wait until element is in the Que or time out occurs. You can then write to the tdms file. The file write loop will not effect the data collection loop timing if you have a slow hard drive. You can also open and close the tdms file in the dequeue loop when you want to change the tdms file name as required without loosing waveform data.
08-13-2014 08:37 PM
You might not need to leave the while loop. The TDMS Close has a "file path out" output terminal, you can put it in the while loop when you want to delete the file and followed by a TDMS Open with "create or replace" option.
08-13-2014 11:26 PM
deppSu
thansk for your answer is there an example how to do this i have not get it working i open the tdms file outside the loop write it to file, then delete it in another case but i always get invalide tdms reference.
best
Martin