LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A question about improving the efficiency of DAQmx read function

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

0 Kudos
Message 1 of 10
(2,914 Views)

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.

0 Kudos
Message 2 of 10
(2,909 Views)

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.

0 Kudos
Message 3 of 10
(2,906 Views)

I don't think you will be losing any data since you are running in continuous acquisition mode.

0 Kudos
Message 4 of 10
(2,903 Views)

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.

0 Kudos
Message 5 of 10
(2,897 Views)

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.

0 Kudos
Message 6 of 10
(2,889 Views)

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

0 Kudos
Message 7 of 10
(2,884 Views)

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.

0 Kudos
Message 8 of 10
(2,855 Views)

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?

0 Kudos
Message 9 of 10
(2,850 Views)

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

0 Kudos
Message 10 of 10
(2,813 Views)