Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous flushing of DAQmx task to TDMS to create single waveform per channel

Solved!
Go to solution

Hi, 

 

I would like to log from a DAQmx task over long periods (hours) of time to a TDMS file. I will be acquiring the data from a PXIe-6538 module, among other modules. Ideally, each channel would continuously acquire to one waveform per channel, and the data would be periodically flushing to the TDMS file. 

 

I have tried using the direct to TDMS logging of a task, which works but saves different acquisitions as waveforms but in different groups. I can do continuous logging with a large number of samples, but then the data is not being continuously written to disk, which we would like to occur.

 

Using TDMS write in labVIEW can append new data to existing channels, but cannot create a waveform due to time delay between different calls of the DAQmx read and TDMS write functions, as I understand. 

 

I'm not that familiar with the timing/triggering/buffering aspects of the PXI system. It seems like it should be possible to use the hardware clock to write samples to a buffer that are equally spaced in time, and then the computer can periodically pull from that buffer and append to the waveform already in the TDMS file. Is this possible? We can accept relatively slow sampling rates (1S/s) for this purpose.

0 Kudos
Message 1 of 5
(2,992 Views)

I think you need to share your code.  Are you retriggering your acquisition or do you want continuous acquisition?  To get what you seem to be describing, you need to use Continuous Acquisition.


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 2 of 5
(2,966 Views)

I want continuous acquisition without retriggering.

 

I have setup a task in NIMAX which simply pulls all the inputs from a PXI current card. 

image.png

I then want to start this task and have it continuously write to one individual tdms waveform per DAQ channel. When I do this with the following code:

 

image.png

 

I indeed achieve one waveform per DAQ channel with different acquisitions stitched together:

 

image.png

 

However, this data only shows up once I stop the task. Is there a way to 'flush' the data from a buffer to disk? Where is all of this data being stored before stopping the task? Because these measurements are being taken over hours, we are concerned with some system crash and then losing all of the data that the task has acquired.

 

We would also like to have some indicators of the data being acquired. Right now, the tdms file only appears to be logged properly when the task is set to 'log only' mode, and not 'log and read' mode. If the data could be flushed to a TDMS file then I could just open that in read only mode to create my indicators of the data coming in. 

 

 

0 Kudos
Message 3 of 5
(2,953 Views)
Solution
Accepted by topic author leeaspitarte

It turns out tdms has some built in function that allows it to create a buffer before writing to disk. (Flush2.png).

 Flush2.png

I just threw it into the while loop and it wrote the buffer each time it cycled through the loop. I of course had to open and close the file (I dont create or overwrite to avoid interfering with any procedures the task might do, but this may not be necessary or you may have a better approach.) Flush1.png

Message 4 of 5
(2,947 Views)

Ah, I thought that the TDMS flush only worked after writing data with the TDMS write VI. This solves the problem. 

0 Kudos
Message 5 of 5
(2,940 Views)