06-11-2012 07:29 AM
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...
06-11-2012 07:32 AM
@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
06-11-2012 08:28 PM
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.
06-11-2012 09:47 PM
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.