11-02-2017 02:45 AM
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 :
We see that there may be a gap of more than one second over 24 hours of execution :
How to remedy this problem?
Thank you for your help.
Cyril
11-02-2017 03:09 AM - edited 11-02-2017 03:14 AM
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…
11-02-2017 06:19 AM
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).
11-02-2017 08:46 AM
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
11-02-2017 09:01 AM
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
11-02-2017 09:26 AM
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