LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Gap between DAQmx and computer clock

Hello,


For quite some time I have been experiencing a gap between the PC time and the time returned by the DAQmx waveforms.
I designed a test software with a simple principle, which is responsible for performing test sequences.
At each test step, the software positions the outputs of the test means (DAQmx of laboratory devices).
Continually during all the operation (which can last up to a week), I acquire the inputs of the test means, generally at a frequency of 3kH or 20kHz, continuously, to lose no value.
The problem is that it creates a gap between the time given to me by the PC and the time returned by the waveform DAQmx, which generates me errors!

To illustrate and verify this phenomenon I made a VI that compares the time from the DAQmx waveform and PC time :

Acquisition continue_Programme de capture.png

 

We see that there may be a gap of more than one second over 24 hours of execution :Acquisition continue_Capture.PNG

 
How to remedy this problem?

Thank you for your help.
Cyril

 

0 Kudos
Message 1 of 6
(3,439 Views)

Hi CHI,

 

replace the TimedWhileLoop by a simple While loop. Then wire a sample count for the DAQmxRead function, I suggest 10000 as right now you have set the TWL to iterate at 500ms.

Let DAQmx do the timing of the loop!

 

DAQmx devices (most often) have their own clock. (You use this clock when you set a sample rate.) The timestamp youget from DAQmx is basically start time (t0) ot the DAQmx task with added sample number times sample interval (dt).

Remember: even then you might get small deviations between DAQmx clock and PC time: both clocks have their inaccuracies! BUt DAQmx hardware clock most often is more accurate then PC clock or software loop timing…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,430 Views)

You are also comparing when the data was actually taken vs when you happen to check the time (some time later after any data transfer, Windows stealing clock cycles, etc).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(3,392 Views)

I agree with the previous replies that the DAQmx time will be better than the PC clock. Also check if your PC is synchronized with a time server which will adjust the PC time periodically.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(3,377 Views)

It is my impression that when doing a continuous  acquisition, DAQmx gets the start time from the computer all other subsequent times reported in logging files are calculated from the sampling rate.

 

You can test the accuracy of your DAQmx clock by using a known frequency standard, check the FFT and its higher order harmonics. The higher frequencies are more susceptible to any clock inaccuracies. For example, assume you have a stable 10kHz frequency standard, look at the FFT of a long time acquisition. If you measure 10.001kHz on your DAQ you gets its accuracy.

 

mcduff

0 Kudos
Message 5 of 6
(3,373 Views)

I was in a *very* extensive discussion over this issue a little while ago.  I highly encourage you to read through this thread very carefully.

 

In addition to all that detail about clock accuracy and skew, don't ignore the very salient point made by crossrulz that there's some unavoidable time uncertainty in your measurement method.  You've done all you can to get the dataflow sequencing right when comparing waveform time with system query time.  But there's still some uncertainty that is outside your ability to influence.   (Note:  this same uncertainty is also present in the code snippet for time correction that I posted in the linked thread, in fact even more so as my dataflow sequencing is less strict than yours).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 6
(3,366 Views)