LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decreasing loop duration

Hello all,
I think  I am in need of some basic Labview advice regarding execution time.  We have a main program loop that currently runs every 100ms. When it executes, it pulls N-samples from four AI voltage channels and computes the average value (i.e oversample & average), while updating the AO value of a voltage out channel. There is a small of amount of "downstream" math, like the averaging. When I track the "previous iteration duration", it averages between 6-12ms to accomplish these tasks. Removing the downstream math and writing the straight voltages to shared variables did not *seem* to make a large difference. I was hoping someone could view the code and make suggestions on how to better perform these tasks. We'd like to reduce the speed as much as possible, by an order of magnitude at least, if not more

Does the acquisition occur sequentially? (4 channels @ 1ms of sampling each = 4ms) If so, it makes sense that I need to increase sample rate/decrease total time per read, etc.

Is the math playing a larger role than I assume?

Regards,


Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 1 of 4
(3,131 Views)
Hi Matthew,

I attached a slighty changed version of your vi...

Please remember:
LabView can do math operations on arrays - so try to move as much as possible outside the loop. You can do so for several operations like multiplying with constants...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,122 Views)
GerdW,
Thanks for the quick response. I'll review my math and remove what I can from the main loop and have it perform on the arrays as a whole outside if possible.

Thanks!
Matt
Matthew Pausley
NC State University
Raleigh,NC
0 Kudos
Message 3 of 4
(3,110 Views)
Hi Matthew,

in your case this has not a great impact on speed - the main 'action' is performed in the DAQ vis.
But it will help you in all your programming to program as clean as possible Smiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(3,077 Views)