LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI_MinimumBufferSize not working?

Solved!
Go to solution

Attempting to use NI_MinimumBufferSize but it is not behaving the way I expect.  The attached VI will never stop iterating.  I would expect it to stop iterating immediately, because setting NI_MinimumBufferSize to 1 should cause the tdms file to grow with every write, shouldn't it?

 

Also, does TDMS have automatic compression built into it?  Seems like the filesizes being created for simple tests like this are much smaller than I would expect.

Nate Moehring

SDG
0 Kudos
Message 1 of 8
(3,346 Views)

NI_MinimumBufferSize is not designed for when to flush data into disk, it is for optimizing the writing performance. If you want to flush the data into disk for every writing operation, you can call the 'TDMS Flush" explicitly that is what it is designed for. If you have some reasons to avoid using this node, you can use the 'NI_DiskCacheSize' property. It works as you expect with your attached VI.

 

Thanks,

zaizhou.ma

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

I'm trying to get TDMS to write to the file automatically after every call to TDMS Write without calling flush, but don't know how to make it do that.  This serves the purpose of reducing memory use and guarenteeing no data loss (for extremely low sampling rates), without inserting a blocking call to Flush.  Help on DiskCacheSize is also lacking.  Is this bytes, elements, per file, per channel?  Is there an optimal number?  Does it depend on the datatype?

Nate Moehring

SDG
0 Kudos
Message 3 of 8
(3,291 Views)
Solution
Accepted by topic author Nate_Moehring

NI_DiskCacheSize works on file. In your case, you don't intend TDMS to do any caching, thus you can set it to 0. Please see the attached file.

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

Thanks, but I still don't understand what MinimumBufferSize does???

Nate Moehring

SDG
0 Kudos
Message 5 of 8
(3,271 Views)

NI_MinimumBufferSize

 

This property works on channel  and the unit is "sample",  TDMS will try to write the data only when the number of samples of the specified channel reaches the number you set.

 

NI_DiskCacheSize

 

This property works on file and the unit is "byte", TDMS has an internal cache beyond the OS cache, by default, it is 2MB. You can use this property to alter the size of the TDMS cache.

0 Kudos
Message 6 of 8
(3,250 Views)

At the risk of talking in circles, I agree with your explanation of NI_MinimumBufferSize, that was my understanding too.  But that's why I don't understand why the example VI I attached doesn't work.

Nate Moehring

SDG
0 Kudos
Message 7 of 8
(3,224 Views)

Hi Nate_Moehring,

 

NI_MinimumBufferSize is meant to improve performance by writing to a file less often, not meant to force a write. Essentially, NI_MinimumBufferSize is only a minimum, not a limit. If the minimum is less than the NI_DiskCacheSize (or the default cache settings if this property isn't used) then the buffer will still keep filling past the minimum until it reaches that buffer level.

 

What the NI_MinimumBufferSize if meant for is if you set NI_MinimumBufferSize to a setting greater than the default buffer size, your TDMS Write will wait beyond the default buffer size until the minimum buffer size has been met.

 

I hope this helps!

 

 

Emily C
Applications Engineer
National Instruments
Message 8 of 8
(3,198 Views)