LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS Write data (1000 channels , 10 samples per second) ,

Hey,

So I'm reading in 1000 values @10hz each and then writing them to a TDMS file and flushing. Now each value is from a unique source and in the TDMS must be it's own channel. I am building an array (2d) of these single precision data points in a feedback node type pseudo buffer and then every 1 second ( so 1000channels x 10 points go to the true case which writes to TDMS)

For some reason the execution time is very inconsistent when I do this. anywhere from 10ms to 150ms spikes occasionally. What could be causing this. 

0 Kudos
Message 1 of 7
(3,248 Views)

Always helpful to provide some code if you can Smiley Very Happy



-Matt
0 Kudos
Message 2 of 7
(3,084 Views)

The orange wire coming from the left to the write is a 1D array of N values (aka the 100 channels), and the pink/purple wire is the N number of channels (their names)

Download All
0 Kudos
Message 3 of 7
(3,081 Views)

Colours Define the datatype, So Its always good  to represent in terms of Programmer.

Try to share the code or Vi Snippet, Not the Image.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 7
(3,048 Views)

Personally, I would just use a Producer/Consumer setup where your current loop sends the data to a parallel loop (the consumer) with a queue.  The consumer can then write the data to the TDMS file as it comes in.  No need to "buffer" the data with an inefficient feedback node and build array.


GCentral
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
0 Kudos
Message 5 of 7
(3,011 Views)

Do you really need to buffer? I write 25 values to a TDMS at 10 hz without a buffer (I just write every 0.1 s) without any problems or spikes, I did not think the number of elements would matter that much. Are you sure it is the TDMS functions that is causing your spikes?

 

That aside, I think this is the actual problem with your code: Do not resize the array each iteration! Use a fixed size array, you know maximum number of elements. The constant array allocations may cause your problems.

 

Also, IF you need to buffer, use the native TDMS functionality instead.

Use NI_MinimumBufferSize and TDMS Flush, or simply let TDMS Write do the buffering automatically.

0 Kudos
Message 6 of 7
(2,997 Views)

There are other recent new functions that might help out too, like the TDMS in memory which allows you to read and write to a TDMS reference, but that reference isn't to a file, it is to a set of memory.  Have you also thought about using the Asynchronous Write functions which will command the data to be written, and then return immediatly?  It is more work but is an alternative to the producer consumer, which is also a fine solution in this case.

0 Kudos
Message 7 of 7
(2,988 Views)