LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding timestamp to DAQMX data stream

Good Day, LabVIEW users!
I am working on a VI that I am using to sample multiple channels at different sampling rates. For the sake of discussion, lets say that I'm sampling 15 channels at 1 Hz and 1 channel at 120 Hz. I need to add the same timestamp to all channels so I can synchronize the data that is coming through on the high-speed channel with the data that is coming through on the low-speed channels. I have attached my VI. Any help would be greatly appreciated!

 

Thanks,

Dominic

0 Kudos
Message 1 of 21
(5,001 Views)

Your DAQmx Read functions are producing data in an array of Waveforms.  Do you know about Waveforms?  Do you know they consist of a Cluster of four elements:  t0, a Timestamp of the start of the Waveform; dt, the time between samples; Y, the array of samples; and attribute, a variant?  

 

Please learn how to use Waveforms (there's a Waveform Palette on the Block Diagram functions) and avoid the Dynamic Data Wire, which I find difficult to use and very confusing.  You already have the data you need, but are largely "hiding it from yourself" using the Dynamic Data Wire.

 

Bob Schor

Message 2 of 21
(4,956 Views)

Bob,

Thanks for the reply. Can you point me towards resources to learn about waveforms?

 

Regards,

Dom

0 Kudos
Message 3 of 21
(4,902 Views)

Hi meier,

 

in addition to Bob's comment:

I need to add the same timestamp to all channels so I can synchronize the data that is coming through on the high-speed channel with the data that is coming through on the low-speed channels.

- They are already in synch as they use the very same timebase! Once you start to fiddle with their timestamps you are counterfeiting your data…

- why do you read both DAQmx tasks in one loop? Why don't you use the hardware timing to determine the loop rate?

- why do you read "N channels" for a task which is configured to contain just one (1) channel?

- you could apply scales on your DAQmx channels to avoid all those calculations (using all those formula nodes) in your DAQmx loop…

and yes: get rid of all that ExpressVI stuff!

 

To learn about waveforms you could read the LabVIEW help and examine the example VIs coming with LabVIEW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 21
(4,898 Views)

Good Morning,

Is there not a way to have the DAQMX read VI save a timestamp in the data file? I know that the DAQMX read VI outputs dynamic data, which includes timing data. Is there any way to just save this timing data to the data file I'm already saving? I understand that I'm not doing this in the most efficient way, but it seems like simply timestamping data should be very simple. 

 

 

0 Kudos
Message 5 of 21
(4,879 Views)

Under the waveform palette you will find file functions and VI called "Write Waveforms to File.vi"

 

See if that gets you somewhere.

 

Ben

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

Hi meier,

 

I know that the DAQMX read VI outputs dynamic data

That is wrong.

DAQmxRead gives you either scalars, (1D/2D) arrays, or waveforms, but no DDT…

Waveforms include timestamps!

 

You already create TDMS files with your DAQmx setup, they also contain timing information.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 21
(4,860 Views)

Gerd,

Thank you for the reply.

 

With regard to scaling my data to eliminate the messy calibration equations I have... Each of my "DAQmx Create Virtual Channel" VI's are creating several channels under the same VI. For example, referring to the screenshot I have attached to this message, my DAQmx Create Channel VI for voltage is creating a channel for each of the inputs on Mod2 of cDAQ9184. Since the transducers attached to these channels all have different calibrations, I need to independently scale each channel. In other words, I need to assign different scaling factors to each of the 4 channels on this card. Is there a way to do this?

 

Thanks,

Dominic

0 Kudos
Message 8 of 21
(4,839 Views)

Sure.  Here's a snippet of a routine I used to set the linear scales of a Tri-axial Accelerometer (I'd previously determined the Gain and Offset for the X, Y, and Z axes).

Scales.png

Message 9 of 21
(4,834 Views)

Bob,

Would you mind posting the LabVIEW file(s) for that snippet?

0 Kudos
Message 10 of 21
(4,812 Views)