What is the recommended way to record timestamps associated with measurement acquisitions from NI DAQmx, DCPower, DMM, etc.? #863
Unanswered
sjdemartini
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
General question/motivation
Our team records varying-duration acquisitions across several different NI cards, most notably DAQmx, DCPower, and DMM cards. We're using gRPC to configure the cards and collect measurements. It is very useful to be able to know the date/time that a measurement occurred (at least to within some level of precision) so that it can be correlated/aligned with other instruments (NI and otherwise).
What is the recommended way to infer or record timestamps (e.g. seconds since epoch,
"2023-02-24T00:47:30.160005+00:00"
, etc) so that we can know when a given measurement was taken? In our investigation of NI APIs/documentation, it seems this is not supported in a native/straightforward way.What we've been doing
In our gRPC client-side code now, we've added custom logic to attempt to "infer" timestamps of the recorded measurement data as we fetch it:
t0
right before callingstart_task
, then calculate timestamps based on the "sample clock rate" attributetimestamp = t0 + (1 / sample_rate_hz) * current_sample_number
t0
right before callinginitiate
, then calculate timestamps based on the "measure record delta time" attributetimestamp = t0 + measure_record_delta * current_sample_number
t0
right before callinginitiate
, (2) record an "end time"t_end
right before callingread_status
, (3) callfetch_multi_point
witharray_size=read_status.acquisition_backlog
, then (4) calculate timestamps for each point by "interpolating" the number of measurements betweent0
andt_end
.With the above examples for DAQmx and DCPower, I do worry that there may be "drift" as continuous acquisitions get to be long-duration (many hours or days), which could make interpreting data error-prone. This seems particularly relevant if multiple DAQs, DCPower units, DMMs, and/or non-NI devices are all being used together and measurements need to be aligned. Also, not all NI cards seem to support all attributes in the same way (e.g. "measure record delta" is not always available).
With other brands of equipment (e.g. Keithley, Zurich Instruments, etc.), timestamps are natively returned/reported along with the measurements, which is quite helpful. It feels like there must be a way to do something more equivalent with NI.
Is there a better way? Are there other APIs/attributes/cards that would be of use to us? Any improvements we can make to our above logic? I've seen mentions of NI-SYNC and timing cards in various NI forums, though I don't know how/whether these do what I'm describing or if they can be used in association with the aforementioned cards. Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions