04-12-2017 06:12 AM
Hi everyone, I kind of understand what my problem is. It's bad software structure, due to lack of knowledge basically. So I am looking for suggestions here to solve my problem.
I have a while loop which is used for continuous data acquisition. I am Ni-daq USB 6251 with sampling rate of 20K and reading 2k samples and an accelerometer for some analysis . Now at each iteration I get a 1D array with 2000 values, these values are basically the vibration measured by the sensor. I need to use each of these values to do a computation, so I pass the array with indexing to a for loop (which is part of my code inside the while loop) and the number of iterations for the for loop is the size of the array. My VI obviously won't stop unless the for loop finishes computation for all 2000 values.
Does anybody know of any alternative way to achieve this without the need to use the for loop or wait for it till its done?
04-12-2017 06:43 AM
If your problem is the calculation takes a long time and is slowing down your nice acquisition (or producer) loop, the pattern you're looking for is called "producer-consumer".
A link explaining some common design patterns in LabVIEW, including producer-consumer, is here:
https://forums.ni.com/t5/Developer-Center-Resources/Scalable-Design-Patterns-in-LabVIEW/ta-p/3534309
04-12-2017
07:48 AM
- last edited on
05-13-2025
10:34 PM
by
Content Cleaner
A more direct link: Producer/Consumer