06-11-2023 08:06 AM
Dear all,
I am acquiring data using a higher sampling frequency (above 100k). Whenever I start the program, after a few seconds it stops showing this error (-200279).
Please, help me to resolve this error.
06-11-2023 08:53 AM
1) Increase the number of samples to the Sample Clock Configuration. Thumb of rule, this should be several times the amount of samples you want to read in the loop.
2) Try with bigger reads in the loop per iteration
06-11-2023 10:09 AM
You are sampling 100,000 samples at the rate of 100 kHz, which means that the DAQ Read inside the While Loop gets 100 k Samples every second. Inside the Loop, you take all those Samples and write them to a Waveform Chart, an operation that might take more than 1 second to all those points.
You need to get those data out of the While Loop and get them saved away safely, maybe even foregoing the display. LabVIEW can help -- you can set up a Producer/Consumer Design Pattern, where the While Loop you show (the Producer) shoves the Waveform into a Queue or Stream Channel, instantly "exporting" it from the Loop, and sending it to another While Loop (the Consumer) gets the Data and does "something useful" (like writes it to a Chart) with it. It may still be the case that the Consumer can't "eat" the Data as fast as it comes, but it will accumulate in the Queue (or Stream Channel) until you exhaust memory, but you should be able to get several minutes of data.
Note that with this sort of two-loop pattern, stopping the Loops becomes important. When you want to stop, you stop the Producer (with a Stop Control wired to its Stop Indicator), but let the Consumer keep running (especially if it has a few hundred 100 k data buffers to plot/save to disk/etc.) Stream Channel Writers (which the Producer uses to send data to the Consumer) have an input called "last element?", normally False, which you can set to True to tell the Consumer there's no more data. It has another input, "element valid?" that is normally True. At some point you push the Stop control and stop the Producer Loop. But you have one more Stream Channel Writer adding its input when the Loop exits where you set "last element?" to True (to tell the Consumer no more is coming, it can exit) and "elemant valid" to False (to tell it you aren't attaching the usual 100 k points of data). When the Consumer read this final chunk of data, it knows (a) not to process the (non-existing) data, and (b) to stop itself by wiring the True from "last element?" to its Stop indicator.
You can do the same thing with a Queue (look to "Using sentinels with Queues", there should be something in Google about this), but I prefer Channel Wires (I've been an Enthusiast since before they were an official part of LabVIEW in LabVIEW 2016).
Bob Schor
08-07-2023 02:22 PM
@Bob_Schor,
I liked your reply and am glad that you provided me with a deep understanding of it. But, at one point, you wrote that 'but you should be able to get several minutes of data'. For this very point, If I want to acquire data for a long period of time (eg. 6 hrs. or 360 mins.), then what could be the possible way for it?
I need to run this program for at least 5 hrs. or 300 mins.
Please, suggest on this.
08-07-2023 03:01 PM
@ndLabVIEW wrote:
I need to run this program for at least 5 hrs. or 300 mins.
Please, suggest on this.
I had had programs run continuously for weeks at much higher sample rates than 100k.
What you need to do: