10-17-2010 01:26 PM
Hi Everyone,
I am very confused about the efficiency of DAQmx read function. In one experiment, it takes longer time to acquire specific amount of data than expectation.
Attached is the demo code. I intend to read analog voltage from 4 AI channels of PCI-6110 board simultaneously at a sampling rate of 1MS/s for each channel. The code is based on while loop. In each iteration, I read 136 samples. The program iterates 1001 times and the total time lapse could be recorded. The total time lapse/1001 is the time it takes to acquire 136 samples from each channel. Theoretically, it should be 136/1000000=1.36e-4s. However, in the test, it took 2.5e-4s. I have no idea what makes the acquisition slower than it should be.
Is that a problem with my code, hardware or the performance of my computer? How to increase the data acquisiton efficiency of labview?
Thank you very much.
Hall
10-17-2010 01:56 PM
I think there are several flaws in your thinking. First, the windows clock is simply not that accurate. You also seem to think that the write to file takes no time or that windows will not pause for some interminate time between loop iteations, You should really, imo, be acquiring a waveform datatype and use the timestamp information that is included with that.
10-17-2010 02:01 PM
Thank you for your suggestion. I agree the windoes clock is not that accurate. But even if I don't write the data to a file, it is still slower than expected.
I will try the waveform idea and do more test. My concern is that, if what I am saying is true, does that mean I would lose some data within the interminate time? How to avoid this situation? Thanks.
10-17-2010 02:04 PM
I don't think you will be losing any data since you are running in continuous acquisition mode.
10-17-2010 02:07 PM
I find that the total amount of data in the file is shorter than sample rate multiplied by the time lapse, especially when the sample rate is > 1MS/s. That's why I am worried. Did I calculate something wrong? Thanks.
10-17-2010 02:17 PM
The total number of samples in the file should be the number of loop iterations times the number of samples requested each iteration. No relationship to the calculated time.
10-17-2010 02:25 PM
Hi Dennis,
I agree with you that we should use iteration to calculate the length of data.
Why couldn't we use sample rate multiplied by the time to estimate the total amount of data we acquired?
Thanks.
Hall
10-17-2010 03:49 PM
Your time calculation is only approximate. I thought you already agreed that you cannot depend on that. Start looking at the timestamp provided in the waveform.
10-17-2010 04:09 PM
I know what you mean. If I use waveform and timestamp, the length of data file should be equal to the multiplication of time and sampling rate, right?
10-18-2010 09:03 AM
Hi Dennis,
I acquired and stored the data using waveform, and did several tests. I find that if we only acquire and view the waveform, the efficiency is high enough to track all the signal. However, if we store the data at the same time, we will lose data when the sampling rate is high. When I say "lose data", I mean the timing of the waveform is intermittent. What should I do then?
Hall