From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Determining TDMS file size during execution.

Solved!
Go to solution

I have an application where the .tdms file will grow very quickly, because of the amount of data being stored  - 7 channels of DAQ at 50,000 samples a sec.

 

I wish to determine when the file has reached around 2GB and want to close the .tdms file and create a new one with a different name/timestamp.  I want to break these files up due to portability issues.

 

Question is, how do I determine .tdms file size?  When I try to give the "get file size" subvi the path to the .tdms file, an GPIB controller needs to be in charge error occurs.  Also, the refnum of the tdms file is not the same as file refnums, so the "get file pointer" subvi will not accept the tdms refnums.


I probably could somehow calculate what is going into the tdms file, but that seems like a workaround and will not be accurate because of the header information.

Ben Yeske
0 Kudos
Message 1 of 4
(6,921 Views)

Try doing the size check from the subVI that is writing the data.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(6,909 Views)
Solution
Accepted by topic author BYeske

You can't get the size directly from the file refnum, but you can probably still get the size another way. Use the function File/Directory Info from the Advanced File I/O palette. This takes a path as an input, not a refnum. This should give a semi-accurate file size value, although it will be possible that there is some cached data that hasn't been flushed to the file yet. Still, when you're talking about file sizes in the range of 2GB, this should be close.

 

This is pretty much the same thing as watching in Windows Explorer as the TDMS file size gets bigger while it's written. 

Jarrod S.
National Instruments
Message 3 of 4
(6,895 Views)

When I have a TDMS file that is only build of direct DAQmx data I use the 'Samples Acquired Per Channel' and 'Number of Channels' properties to calculate the total number of channels, by multiplying this with 8 (byte size for Doubles) you get the file size (missing a few bytes).

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 4
(6,889 Views)