Virus scan in progress. Please wait to download attachments.
This example show how to use Producer-Consumer design pattern for simulated data acquisition.
TDMS files are a great way to store measurement data quickly and simply in LabVIEW. They are a type of binary file that consists of two separate files, a binary file and a binary index file. Being stored in a simple binary format allows very fast streaming to disk, and the binary index file contains information on all attributes and pointers in the binary file, allowing rapid read access. On top of this, TDMS files allow you to segment your data into specific 'groups' and 'channels' allowing the data to be organised in a logical fashion. Overall, this makes TDMS a very good candidate for applications need:
to store measurement data
to create structured grouping for data
to store information about data
to read and write data at high speeds
In this example, the data we acquiring is simulated with the use of a random number generator. You'll see that I have split the data into two channels; one for the simulated signal and one for a timestamp. By using queues, we can ensure that no data is lost, even if the data acquisition rate is greater than the rate at which we can process the data and save it to file.
LabVIEW Full Development System 2012 or compatible
Steps to Implement or Execute Code
Run the VI
Select a path to save the TDMS File
The VI will write a simulated signal to the TDMS file.
Control the processing time in the producer and consumer loops using their delays respectively
Notice how the number of elements increase in the consumer is slower than producer
Stop the VI to view the TDMS data file
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange. **
Jeremy T Technical Marketing NI
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.