ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a New TDMS File Every Hour

Solved!
Go to solution

Hello NI Community,

 

I am currently trying to write a VI that creates a new TDMS file every hour and records displacement data from my CompactDAQ Ethernet Chassis. Please see the code attached. Right now the code only appends the current TDMS file and does not write a new file on the given time interval. I would like for a new file to be created every hour, so the files do not get insanely big.

 

Also my displacement data is not writing data anywhere near the correct collection rate. Right now it seems to be collecting one data point every second, where I have the collection rate at 100. 

 

Any advice would be greatly appreciated!

 

Thanks.

Chris

0 Kudos
Message 1 of 4
(3,566 Views)
Solution
Accepted by topic author cjwarren

1000 points at a rate of 1000S/sec.  That means the DAQ Assistant will take 1 second to read the data.  Now going through the process, you are just getting the first waveform and then taking the first point in that waveform.  Therefore you get 1 sample from the 1000 that you spent a second capturing.

 

So here are a few things I would suggest.

1.  Change your graph to a chart.  A chart keeps a history and it can take the array of waveforms directly.  There is no need to further append any data for this chart.

2.  Play around with the scales in the DAQ Assisant.  You can apply a linear scale to the individual channels, eliminating the need for that FOR loop.

3. Use the Logging option in the DAQ Assistant (there is a tab just for this).  You can enable TDMS logging and it will do everything for you.  You can even have it span multiple files based on the number of samples.

 

So after all of that, your code should be reduced to something like this



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(3,549 Views)

Thank you very much for your help on this topic. I was unaware that the DAQ assistant could enable TDMS logging. I will try and implement this today, and I will let you know what the outcome is.

 

Thanks again,

Chris

 

Edit: The logging through the DAQ assistant couldn't be easier. Thanks for the help.

0 Kudos
Message 3 of 4
(3,484 Views)

I am now able to write TDMS files at given sample intervals, however the only data saved is the displacement. Is it possible to also write the raw data and timestamp to the same TDMS file through the DAQ assistant?

0 Kudos
Message 4 of 4
(3,469 Views)