11-11-2021 04:11 PM
Hello,
I'm using a NI 9220 slot board in a cDAQ chassis. I search on the different manuals and supports but I didn't find what I want to know. It is a technical information.
I don't understand how the DAQmx (on continues mode) could lose data during the communication from the cDAQ and the PC(if is possible). I know that my 16 adc have a sample rate of 100kS/s. If all are collecting data when the data buffer on the cDAQ could lose data because the communication with the PC is too slow? Is it possible or the cDAQ stopped the acquisition until the buffer is already ready?So which is the size of the maximum memory buffer of the cDAQ ?
Thanks a lot, Nicola.
Solved! Go to Solution.
11-11-2021 05:37 PM
First - you should not try to read faster than your communication bus can support
If you do not read fast enough, the buffer on the host will be overwritten with new data thereby you lose the overwritten data.
11-12-2021 06:57 AM
Just to add a little note:
The standard behavior of DAQmx will be to latch itself into an error state (that it will report to you if you look for it) when the host-side buffer is about to be overwritten. So you won't lose data without knowing about it. That's the main thing I wanted to emphasize -- for as along as you are able to keep retrieving data from the task, you can be sure that none has been missed.
(There are ways to override this behavior and *allow* overwriting without latching an error, but you have to go out of your way to configure that behavior explicitly.)
-Kevin P
11-12-2021 07:00 AM
Thanks a lot for you answer.
For the first point, are there some information about the size of the waveform data? I know is an array but How could I calculate the size of all samples that i send?
Other point: Is there a best way to set the number of samples? My question is relatated at the DAQ settings. My sample frequency is relates to the my application and the Ni 9220 that i use. If i set a lot of number of samples I have a big size of buffer pack from the device to the PC but more seconds from different pack (My VI may be more slowly) in the other wise i have a lot of data pack form the instrument but a less size of the pack. How could I choose the best number of samples? Are there any guide for choose that?
11-12-2021 07:28 AM
I'll answer from a LabVIEW perspective as that's what I know.
The fact that you aren't sure about the # samples leads me to suppose you're doing Continuous Sampling. And it turns out that the "# samples" input for DAQmx Timing is only treated as a suggestion. DAQmx will make a host-side task buffer that's no smaller than that # samples, but it might be considerably larger. See this article for details.
Part of the take-away lesson is that for Continuous Sampling, there's generally no need to optimize for a specific exact buffer size. Just make it "big enough", and if you choose a size that's bigger than you really needed, it won't have any impact on you.
I personally will generally set my buffer size somewhere in the 2-10 second range, *knowing* that I don't really need it to be that big, but liking the safety of having a big margin of error for any PC CPU-starvation hiccups due to Windows doing unexpected and unasked-for things behind my back.
-Kevin P
11-15-2021 05:46 AM
Thanks a lot! I had read the article that you attach me but now is all more clear!