Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronization and writing data in to a file at the rate of 600K...

Hello,
 
I am Preetam. I am trying to synchronize three E-series MIO cards(PXI-6071E) and also i want to acquire the data at 600Ks/s.
 
I am using the attached VI.
 
It is giving the error message that "attempted to read the samples that are no longer available.either increase the size of the buffer or read the samples frequently"
 
I tried to put the buffer size which is thrice the sampling rate. But then also the same error
 
please help me in this regard
 
regards
 
Preetam
0 Kudos
Message 1 of 2
(2,745 Views)
Hello Preetam,

The error message you are getting is due to a buffer overflow.  Basically, you are not reading values from the buffer fast enough and previously acquired samples are being overwritten. 

I took a quick look at your code, and it looks like this is happening because you are trying to write all of the data to file in the same loop in which you are reading from the buffer with DAQmx Read.  You are reading 600,000 points on three channels, so 1,800,000 total points.  Each of these is a double-precision, floating point number which is 8 bytes long.  This corresponds to 14,400,000 total bytes, or ~13.73 MB of data.  Writing such a large chunk of data to file in your loop can drastically slow down your loop rate resulting in an overflow error. 

There are two possible approaches to improving the performance of your code.  One approach would be to acquire all of the available samples rather than a fixed number of samples on each channel (600,000).  This can be done by wiring a constant of -1 to the number of samples per channel input to DAQmx Read.  This would allow you to "catch up" to the total number of samples that have been transferred from your DAQ board to the PC memory.  Using this approach, I would suggest that you decrease the number of samples that are read with each iteration.  This will decrease the likelihood that your buffer will overflow after only one iteration of the loop. 

The second approach would be to use a producer/consumer design pattern with the File I/O portion of your code in the consumer loop.  This would allow the data acquisition portion of the code to run at the maximum rate, reducing the chance of a buffer overflow.  For more information on using producer/consumer loops, please refer to Application Design Patterns: Producer/Consumer

I hope this information helps!

Best regards,
0 Kudos
Message 2 of 2
(2,727 Views)