06-25-2020 06:54 AM
I want to know how to determine the 2d array row size manually? is there a relation between sample clock rate, read samples per channel and the target time. To determine the size of the array.
Solved! Go to Solution.
06-25-2020 07:06 AM - edited 06-25-2020 07:10 AM
Hi trishulniak,
@trishulnaik wrote:
I want to know how to determine the 2d array row size manually? is there a relation between sample clock rate, read samples per channel and the target time. To determine the size of the array.
You already determine the ArraySize using the ArraySize function…
In the loop you are reading 20000 samples per DAQmxRead call (I guess, but you should use the AutoCleanup button more often!): so you should also get a row size of 20k elements (in case there's no DAQmx error)!
And yes, there is a relation between samplerate and number of samples:
num_samples := elapsed_time * sample_rate
06-25-2020 07:17 AM - edited 06-25-2020 07:18 AM
sir, when i'm playing with values of rate=1,sampled rate=1, elapsed time=5sec, i'm getting 7x1 array. why 7?
06-25-2020 07:30 AM
Hi trishulniak,
@trishulnaik wrote:
sir, when i'm playing with values of rate=1,sampled rate=1, elapsed time=5sec, i'm getting 7x1 array. why 7?
Because of THINK DATAFLOW and race conditions!
ElapsedTime is called in parallel to DAQmxRead, but DAQmxRead takes (way) more time to execute than ElapsedTime…
06-25-2020 07:35 AM
You'd need to show code. I don't know why you'd refer to "rate" and "sampled rate" as 2 distinct things for example. I don't know if you've changed the dataflow relationship between the DAQ operations and the Elapsed Time check.
In your original screenshot, you set a sample rate of 10k and request 20k samples per iteration. That'll take 2 seconds to return with data. Elapsed Time has no dataflow relationship to the DAQ process, so it'll get checked at the beginning of that 2 seconds.
So at the first iteration, Elapsed Time will be ~0 sec, the second iteration it will be ~2, the third iteration it will be ~4, and finally on the 4th iteration it will be ~6. That's when the boolean output will become true, the loop will terminate, and you'll have accumulated a 4 x 20k array of data at the auto-indexing tunnel.
If you understand why your original posted screenshot would behave that way, you might be able to figure out the present behavior too. Or post the code. (Actual code is better than a screenshot, best to use "Save for Previous Version" if necessary back to ~LV 2016 I'd recommend.)
-Kevin P
06-25-2020 07:55 AM
Sir,
Thank you for your detailed explanation, now I understand the thing going on. Yesterday I wrote CLAD exam and scored(67%) , there were 2 questions on the same model. I didn't consider the 1st case were my 1st iteration elasped time would be 0 sec. Rather I took 1st iteration 2 sec.