From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple simultaneous AI voltage measurement and varying sampling rates virtually

Hello. 

 

I have a two part question regarding a voltage measurement I'm trying to build. I have no prior DAQmx experience so the first question is simple:

 

How should I build multiple measurements to execute at the same time? I tried building parallel measurement branches in to the example in the attachment but apparently I cant run two tasks at the same time? I would like to get multiple measurement from multiple DAQ modules. 

 

Second question is: can I (or should I) vary sampling rates virtually with for example a for loop? I would need to record voltages logarithmically so that I have fast sampling speeds in the beginning and it slows down. Is there a better way of doing this? When Im done with the program (and after upgrading my module) I should have measurements at 1 MS/s in the beginning and 1 S/s in the end. In between around 30-50k samples. 

 

At the moment I have NI 9205 modules for testing but Im planning on upgrading to NI 9223 later for faster sampling speeds. 

0 Kudos
Message 1 of 5
(1,344 Views)

1. The easiest way to take multiple measurements at the same time is to combine those multiple channels into a single task.  cDAQ supports a feature known as channel expansion which allows you to do this even if you're combining channels from different modules.

 

2. No, don't try to change sample rate with a For loop.  You'd be stopping and restarting the acquisition, thus missing data during the idle time.  Perform acquisition at your highest sampling rate and post-process it afterward to create your logrithmically-varying sample rate.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 5
(1,287 Views)

+1 to what @Kevin_Price stated.

 

One more thing to considered, if you are collecting multiple channels and multiple modules at 1 MSa/s, then make sure the number of points you collect per "iteration" is an even integer of the the disk sector size.

 

mcduff

0 Kudos
Message 3 of 5
(1,275 Views)

Thanks for the reply Kevin! I got the acquisition working!

 

One more question regarding post-processing though. I will now be left with a huge chunk of data. Possibly in the range of 100 million data points. Do you have recommendations on what would be the way to remove the excess data. Is this possible maybe within labview and within the same program? 

 

 

0 Kudos
Message 4 of 5
(1,225 Views)

1. Define for yourself exactly what you mean by this "logarithmically-varying" sample rate.  As you reduce the data, will you simply be plucking individual samples out of the original stream?  Or will you want to apply any smoothing (such as filtering or averaging)?

 

2. Work on utility function(s) that help you in this process.  One possible set:

a. a function to identify the sample #'s that represent the times where you want to keep data.

b. a function that will receive this sample time & the original data and then output the appropriate sample value.  This function can include the smoothing mentioned earlier.

 

3. TEST THESE FUNCTIONS WITH KNOWN DATA!   For example, try it out over something like 10 seconds and 1 million original samples.  Generate 10 seconds worth of data for a 5 kHz sine wave, sampled at 100 kHz.  Create an XY plot of data vs. time (seconds relative to start).

    Now pass this data through your utility functions.  Form another XY plot of this output data along with its relative times.  Show this plot merely as points, with no lines.  The points should land on the original curve and should span the full time.

 

4. Once tested with various sample rates, capture times, waveform types, *THEN* use them with your real acquisition data. 

    You might start by making it a post-processing function.  Run your data acq app to simply capture the data and store it to disk.  Then run your post-processing function to read it in, resample logarithmically, and then write back out to disk.  Optionally delete the original data if you're sure the resampling was successful.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 5
(1,207 Views)