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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Data logging speed with USB-6212

Solved!
Go to solution

Hello, 

 

I am setting up a USB-6212 for a teststand we are creating.

 

The teststand should be able to:

 

- measure analog inputs on 3 channels

- measure the frequency of a PWM signal 

- generate an analog output between 0 and 10 volts

- record the data we are logging. 

 

The VI that we have created so far works fine when running up to 500 Hz. At higher speeds, it has trouble keeping up. We can see this from the recorded data where the time is also logged.  

 

I am relatively new to Labview - can anyone tell me what can be done to make this program run faster? We need a speed around 2 kHz.  The program is attached 

Lawaetz_0-1610531249524.pngLawaetz_1-1610531274373.png

 

 

 

 

Thanks in advance

0 Kudos
Message 1 of 3
(1,060 Views)
Solution
Accepted by Lawaetz

1. Very generally, interacting with multiple tasks 1 sample at a time over a USB connection is definitely going to be limiting.   Honestly, I would have bet against achieving even 500 Hz.

 

2. in particular, your AI task should be reading multiple samples at a time.  A typical rule of thumb is to aim for a loop iteration rate of 10 Hz.  Reading 200 samples while sampling at 2000 Hz will help accomplish that.

 

3. Your counter freq measurement task is unbuffered, so each call to DAQmx read will wait for the next *future* interval.  That can limit loop iteration speed as well.

 

4. Your single-sample output signals get their values from the GUI.  You don't need to write those values at 2 kHz or even 500 Hz.  More typically, one would have those in a separate loop with an event structure where you'd only update the output signals when the GUI value changes.

 

5. Helpful tip:  take a step or two back to do some investigation.  You're gonna learn some things.  Make 4 separate vi's for this investigation, one for each of the tasks.  Explore each one on its own. 

    See how fast you can run an AI Read loop when you read 1 sample at a time.  Then try setting the sample rate to 20 kHz and read 2k samples at a time -- notice how much more data bandwidth can be delivered when you do it more efficiently in larger block sizes.

   See how fast the Freq measurement task runs in its own loop.  Then lower the frequency of the signal being measured -- bring it down to the 1-10 Hz range.  Notice how the loop rate depends on the signal because your task is always asking for the *next future* interval.

 

For inspiration, you can have a look at a variety of shipping examples.  At first, you can ignore & cut out all the stuff related to TDMS logging and triggering.   That'll help you focus on some of the bare fundamentals first.

 

 

-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 3
(1,047 Views)

Kevin, 

 

Thanks for the quick reply!

I have implemented some of your suggested changes and it solved my problem 🙂

 

Thanks again, 

 

Jacob

 

0 Kudos
Message 3 of 3
(1,036 Views)