03-07-2012 09:44 PM
I am looking for the same double floating point precision and range that a hypothetical [0,360] dice would give.
03-07-2012 09:46 PM
I agree with Ravens Fan. If the precision of your simuation is so good that you can detect the extremely tiny deviations from uniformity (if there are any), you probably have a lot of other things to worry about first.
Lynn
03-07-2012 09:58 PM
Ravens Fan:
Is the difference between 'iteration duration' indicator on the output node in a timed structure and 'Elapsed Time VI' just that the former gives only the time to execute the code within the structure, while the latter gives the total time spent before transferring to the next iteration?
03-07-2012 10:03 PM
For the Iteration duration, it is the time it took for the last iteration of that timed loop to execute.
I don't see any Elapsed Time Express VI in your VI. But if you had it, it will give the time since the Express either was originally executed or since it was last reset.
03-07-2012 10:09 PM
So if I had a timed loop with a single elementary operation but made to wait for 3 seconds before the next iteration, the iteration indicator would show close to 0, while the elapsed time would show 3, assuming it is reset after time target. Correct?
03-07-2012 10:13 PM
Is the wait because of the period of the timed loop, or because you put a 3 second wait statement in there?
Try coding it up and see what you can figure out.
03-07-2012 10:21 PM
Well I did, and that's what I got ( the 3 seconds was the loop time period). But I raised the question because when I use them in my vi, the iter. indicator shows around 0.5~0.6 seconds every time while the elapsed time constantly alternates between ~0.5 and 1 second. I don't know why because the period is actually much smaller than that , around 0.5-1 millisec, meaning the loop constantly finishes late. So there is no apparent reason for elapsed time to show 1 sec.
03-07-2012 10:40 PM
There must be something in your while loop (or a combination of things happening in series) that is taking about 1/2 second. Delete or disable sections of code that you think may take some time and see if the loop iteration time drops. Use the Tick Count function and some flat sequence structures to see what may be taking longer.
As Lynn had said, look at the Matlab node.
Also I'm wondering, why do you have a value wired into the dT of the timed loop that comes from a feedback node that comes from the value that goes into the Coherence Time indicator?
03-07-2012 10:46 PM
Oh the intention was to generate a new coherence time every time and make the loop run only for that time. But I have since realized that loopback won't solve the purpose because the current iteration would then run on the prev iteration's coherence time. So it has to be taken out.
03-07-2012 10:49 PM
That will set the period of the loop. But it won't change it from iteration to iteration. It would change it from one run of the VI to the next time you restart your VI.
If you want to change it from iteration to iteration, you need to wire it inside the loop to the nodes on the right inside of the loop. But remember, that just changes the loop rate, it's not going to change how long it takes for a given iteration to actually take.