LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimizing Speed

Solved!
Go to solution

Hello all,

 

I am using Measurement Computing's USB 2416 to acquire 14 channels of temperature data. My VI is reading the board @ 100 Hz, and I am taking a running average of 100 data points per second (purpose: reduce noise).  Trying to displaying/graph/log the data once per second, but it usually takes around 17 seconds to do this! The program should be able to process the data much faster than that, am I right?

 

This leads me to believe I have a massive performance bottleneck(s) somewhere in this VI.

 

Does anyone have any suggestions that will allow me to keep the 100 Hz rate of acquisition while not sacrificing any functionality? FYI, I need to be able to set scale/offset for each channel individually.

Attached is my main VI "Time Slicing 100 Hz" and my two custom Sub-VIs.

 

Any help would be much appreciated and I am a LabView beginner so please explain everything thoroughly!

 

Thank you,

Laura

0 Kudos
Message 1 of 7
(1,353 Views)

Also another important bit of info: I will eventually be adding 3 more boards with roughly 8 channels each to this VI and subjecting the data to the same process the current channels are going through. Is this even feasible at my desired rates?

0 Kudos
Message 2 of 7
(1,351 Views)

First of all, you should stick to one data type and learn how to use arrays efficiently. That constant conversion from waveform to dynamic data, to arrays and scalars and back is expensive.

 

Can't you sample it as 2D array directly instead of waveforms (you are throwing away any timing information anyway)?

 

Your scaling can be done directly on the array using arrays of scales and offset (You don't even need the subVIs).

Same for the running average. Make your own that operates on all channels at once. (start e.g. here)

 

17 seconds is a very long time, so there might be other issues, e.g. with the USB. You might also want to take the file IO out of the loop so it can continue to spin for the other 10 iterations.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 7
(1,335 Views)
I took your advice and sampled as 2D array instead of waveforms, works perfectly for scale & offset.

Same for the running average. Make your own that operates on all channels at once. (start e.g. here


I looked into this^^ example and it's exactly what I need, but it doesn't seem to be able to handle 2d arrays. Tried to convert to 1D using this example: http://forums.ni.com/t5/LabVIEW/running-average-of-a-2d-array/m-p/94656#M58019, but it isn't working properly. It seems that the 1D array it produces contains the last 20 or so values from the running avg of the 1st channel as rows. How can I configure the VI to show the most recent value (after using the running avg) of each channel in a 1D array?

 

I have attached my (mostly) fixed VI.

 

Thank you for your help!

0 Kudos
Message 4 of 7
(1,305 Views)

Don't convert to a 1D array! Use 1sampNchannels to get a 1D array directly. Since you want to keep a running average for each channel, you need a 2D array in the shift register. Remove the ptbypt VI, it was only used for comparison. All you need is the lower part of the FOR loop.

 

Also don't use duplicate names for front panel objects and don't call charts graphs. very confusing....

 

I'll look at it later....


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 7
(1,300 Views)
Solution
Accepted by topic author lauraalkhoury

Try this.... (LV 2011)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 6 of 7
(1,293 Views)

You are a LabView GOD. I am forever in your debt.

 

Haha thanks a million.

 

-Laura

0 Kudos
Message 7 of 7
(1,284 Views)