12-29-2017 04:50 PM
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
12-30-2017 06:19 AM
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
01-03-2018 09:15 AM
Bob,
Thanks for the reply. Can you point me towards resources to learn about waveforms?
Regards,
Dom
01-03-2018 09:36 AM - edited 01-03-2018 09:36 AM
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!
01-03-2018 11:26 AM
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.
01-03-2018 11:55 AM
Under the waveform palette you will find file functions and VI called "Write Waveforms to File.vi"
See if that gets you somewhere.
Ben
01-03-2018 01:50 PM
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.
01-11-2018 05:10 PM
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
01-11-2018 08:55 PM
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).
01-15-2018 10:39 AM
Bob,
Would you mind posting the LabVIEW file(s) for that snippet?