LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop and data acquisition timing worries

Hello everyone, 

 

I apologize in advance if this is a silly question, but I could not find the answer around here. 

I have made a VI to record continuously from 64 analog channels at a 5kHz sampling rate. I then stream this data to a tdms file. The data acquisition and write functions are in a while loop. 

I the same loop, I have a bunch of other loops, that each run on their own wait timers to help limit the amount of memory they take up. I am now worried that this may somehow affect my data acquisition timing.

If I put a bunch of timed loops within another loop, does the outer loop run at the same pace as the slowest of the inner loops? And could that mess up my sampling rate?

I have attached my VI, in case what I just wrote makes no sense at all. 

 

Thanks for any tips...

0 Kudos
Message 1 of 4
(2,342 Views)

@WorkingCat wrote:

...

If I put a bunch of timed loops within another loop, does the outer loop run at the same pace as the slowest of the inner loops? And could that mess up my sampling rate?

...


The data flow paradigm says yes.

 

Search on "design patterns" for Producer/Consumer, Master/Slave and others.

 

Keep you acquisition loop lean and mean.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,338 Views)

For your first question, yes I think so.

For the second question, if they are in separate loops I don't think your sampling rate will be affacted.

0 Kudos
Message 3 of 4
(2,311 Views)

Well, looking at your code you will only write to your TDMS file one time. You have multiple infinite loops within the main/outer loop. That means that the main loop will only run a single iteration because it cannot complete an iteration until all code within it completes. With at least two infinite loops inside the loop it will never complete. Not too mention the only way to stop your code is to hit the stop/abort button. NOt a very good way to stop your code. As someone once said using the abort to stop your code is like using a tree to stop your car. It will work but not advised.

 

As Ben mentioned try to understand data flow better. You have unnecessary sequence frames in your code where normal data flow will control the execution sequence.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(2,303 Views)