LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to automatically tell DAQ assistant to continue?

Hi,
 
DAQ Assistant is set to acquire a set of samples every second, calculate the average and then write it to a measurement file, set to continuous sampling inside a While loop. Generally this works fine but if I leave LabView acquiring data overnight, after a few hours it stops. The error is "Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan Nsamp).v1:1 Possible reasons(s): Measurements: Attempted to read samples that are no longer available." 
 
I presume this is because on this occasion the write to file took longer than one second, so on the next iteration of the loop it asked the CompactDAQ for data that was no longer in memory. It's important that the average is calculated on each second's worth of data, not a longer sample set.
 
The error offers a 'Continue' button and when clicked, the data acquisition continues fine as before. Can I arrange for DAQ Assistant to ignore this error, skip the data and continue looping?
 
Regards,
AndrewInOz (in Australia, that is).
0 Kudos
Message 1 of 3
(3,212 Views)
Hi Andrew  in Australia
 
If you are sure you want to clear the error, you can use the Clear Error.vi to do so. Remember to pass the error cluster from one VI to the the next when possible.
 
The photo illustrates how you can clear specific error  -200279  after it occurs. You unbundle the error cluster and if the error code is  -200279 it will clear it, otherwise it will
 
just pass it to the rest of your program.
 
I hope that helped,
 
KostasB
 
NI Applications Engineer
Download All
0 Kudos
Message 2 of 3
(3,179 Views)

Hello AndrewInOz (err... Australia),

KostasB shows the way to clear the error, however it is troublesome to me that the error is occurring at all.  From your description, it appears that the circular buffer is getting filled at a slightly faster rate than it is getting read (which would explain the overwrite error after an extended period).  If you are reading a full seconds worth of data each time (samples to read), then your loop would have to be running slower than that (one second) for this to happen.  That is a very long iteration time. 

The easiest solution for this, assuming the length of time is most important, is to use a finite acquisition (N points) where you sample 1 seconds worth of data (e.g. 100 points at 100Hz).  If you put this is a loop, each time it runs it will output one seconds worth of data.  This pretty much guarantees that you would not receive a buffer error since it would reset the buffer each loop.

If you would like to acquire continuously and then average your points, then you could use an array as kind of a storage bin for your data.  This way you could read a large amount of data out of your buffer (your DAQ assistant) and append that to your array.  You could then use your iteration marker to read a seconds worth of data and take your average:


The trick with this is that the data array could get very large depending on your sampling rate. I hope this helps, let us know what you do and if it works!



Message Edited by Neal M on 11-19-2007 10:55 AM
Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 3 of 3
(3,168 Views)