LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmax read error: Error 200279

In my DAQ system, I read 5 channels data (256 samples per channel) and then use Matlab script to do some processings. The results will be shown in XY graph.

The program is simple. Sometimes I got the following error (not always):

Error-200279 occurred at DAQmx Read(Analog 2D DBL NChan NSamp)

Possible reason(s):

Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.

Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.

Property: RelativeTo
Corresponding Value: Current Read Position

Property: Offset
Corresponding Value:


Task Name: _unnamedTask<4E>

I am a newbie to LV.  Anyone can help me? Thanks in advance.

I attached the program here.


0 Kudos
Message 1 of 13
(7,141 Views)
I tried queues too. I got the same error.
0 Kudos
Message 2 of 13
(7,140 Views)
Try to open the file before the while loop (open file.vi) and use write to text file. To find out which string you want to write, look inside 'write to spreadsheet file.vi'  you already use.
Maybe opening and closing (constantly) harm you.

Remove the wait statement, the read daqmx function will limit you speed to 2.56 seconds per run.
I don't understand your matlab code but it looks like you don't use y2 through y4

Try to time the mathscript node (measure the time for and after the node) and subtract them. In your app. they should stay under 2 seconds to prevent the error you see.


Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 13
(7,133 Views)
Hi kkccoo,

Error -200279 indicates that the buffer is being overwritten before all of the samples are acquired.  It is likely that processing the data in your MATLAB Script Node and constructing an XY graph is taking too much time which is causing the samples on the buffer to be overwritten.  Ton is correct in that both the MATLAB Script Node and the XY graph should not take more than 2 seconds to complete.

You said that you had already tried queues, but did you try a producer/consumer design pattern using queues?  A queue should work if you acquire all of your data in the producer loop and process/graph the data in the consumer loop.  That way you ensure that the producer loop runs quickly enough to grab all of the samples off of the buffer.  There is a Producer/Consumer template that can be found by selecting File » New... » From Template » Frameworks » Design Patterns » Producer/Consumer Design Pattern (Data).

If queues do not work for you, I would suggest decreasing the sampling rate, increasing the buffer size (by wiring a number, say 1000, to the samples per channel input on the DAQmx Timing VI), or increasing the number of samples per channel to read.

Also, is it necessary to construct a new XY graph on every iteration of the while loop (every 2.56 seconds)?  You could store the data in a shift register and plot the XY graph at the end of the acquisition.  This depends on the amount of data you are acquiring, your shift register may become large if you acquire for too long.

I hope this helps!  Let me know if you have any other questions.

Regards,
Erik J.
National Instruments
Message 4 of 13
(7,117 Views)
Thank you very much, Erik. I fixed my architecture and now I have the data collection and writing to files separately. But still I got the same error randomly. I am wondering if there is a formula to calculate the relationship between the waiting time in the while loop, sampling rate, buffer size, N samples, N channels and other numbers.

Thanks again,
0 Kudos
Message 5 of 13
(7,081 Views)
Hey kkccoo,

One of the inputs to either the DAQmx Timing VI or DAQmx Read VI is called number of samples per channel, which determines the buffer size.  We want to make sure the buffer does not overflow.  For the buffer to not overflow, LabVIEW must finish executing an iteration of the while loop before the buffer is full.  So if you are looking for an equation, here it is:

time in while loop < number of samples per channel / rate

Or, the time in LabVIEW while loop must be less than the number of samples per channel divided by the rate.

For example, say your rate is 100 samples per second and number of samples per channel is 200, then your while loop cannot take more than 2 seconds to execute (time < 200/100).

I would not suggest putting any kind of wait in a while loop that acquires data continuously.  If you don't have a wait and you are still getting a buffer overflow error, you will need to somehow decrease the time spent in the while loop, increase the number of samples per channel, or decrease the rate.

Regards,
Erik
0 Kudos
Message 6 of 13
(7,060 Views)

hi

i m facing the same problem during my acquisition.

can anybody plzzzzzzzzz specify the error and also let me know what is the aactual problem that i m facing?..also let me know the solution...

Sahara

0 Kudos
Message 7 of 13
(6,737 Views)
It means you are not reading the data out of the buffer as fast as the data is being put in by the acquisition.  Your code that reads the data in the buffer is executing too slowly, as indicated in the other messages in this thread.  If you are having trouble understanding why your code is doing this, perhaps posting your VI so others can look at it and provide tips.  Smiley Wink  It's hard to know what the solution would be for you without seeing what is the problem.
0 Kudos
Message 8 of 13
(6,719 Views)
I am having a similar problem to the one described below.  I have read several threads and have tried several options to no avail.  I get the 200279 error either when I acquire slightly more than 400 seconds of continuous data (then the message disappears for a while) or when I acquire some data, pause the acquisition, and then try to restart it.  There are a few options that I could try still like increasing my buffer, but I feel like that will just delay the problem not eliminate it.  I have attached my VI.  Could someone recommend the best course of action?  Should I reformat my VI using the producer/consumer technique?  Thank you much!
 
Brad
0 Kudos
Message 9 of 13
(6,053 Views)

Hi Brad,

I took a look at your VI and do think that you could benefit from using a producer/consumer design pattern. You might also consider replacing the DAQ Assistant with using the lower level DAQmx VI’s. Using the lower level VI’s correctly will be more efficient than the DAQ assistant. Also to decrease overhead in the VI try to eliminate all or at least most of the local variable usage and the stacked sequence structures. Use data flow to control when things execute instead of the sequences. If you need data transferred between iterations of a loop use shift registers instead of local variables. Local variables are much less efficient than just connecting items together with wires. Below are links to some great resources on these topics.

Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

Application Design Patterns: Producer/Consumer

Tutorial: Timing, Shift Registers, and Case Structures

Let me know if you have any questions and take care.

Thanks,

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 10 of 13
(6,037 Views)