02-05-2016 12:46 PM
Gregoryj
I think wait vi work in different method than what you expect it I think wait vi just extend time of your code operation up to the time digit that you wire it so wait vi with value under code operation time in normal mode (without wait vi ) will not effect on loop
for proving this i make a simple vi that for my computer any loop take time near 2 second without wait then i regard 3 wait with different time one of them is more that code operation and it is just one that effect on loop time
also if we use some wait vi in one loop just the biggest time wait take effect not sum of time that we attach t this vis
could you please check these in this vi and tell me if i am wrong or not ?
02-05-2016 12:58 PM
@Hatef wrote:Gregoryj
I think wait vi work in different method than what you expect it I think wait vi just extend time of your code operation up to the time digit that you wire it so wait vi with value under code operation time in normal mode (without wait vi ) will not effect on loop
for proving this i make a simple vi that for my computer any loop take time near 2 second without wait then i regard 3 wait with different time one of them is more that code operation and it is just one that effect on loop time
also if we use some wait vi in one loop just the biggest time wait take effect not sum of time that we attach t this vis
could you please check these in this vi and tell me if i am wrong or not ?
Wait 1 causes a wait of 200 msec.
Wait 2 causes a wait of 1.5 sec.
Wait 3 causes a wait of 3 sec.
The generation of 100 million random numbers and building them into an array of 10,000 random numbers takes x amount of time. On my PC that takes about 3.7 seconds. It sounds like you are saying it took about 2 seconds on your PC.
The loop iteration time is going to be the longest of whatever of the parallel operations' execution time is. In my case 3.7 seconds. For someone else on a faster PC, or maybe just fewer samples, it could be less time.
I'm not sure if you are disagreeing with GregoryJ, or have now come to a realization yourself how the wait function works now that you've created a VI that somewhat tests wait functions and execution times. I think Gregory understood all along how wait functions work, he was just trying to explain what you might have been trying to do in earlier code, not trying to say that it was right.
02-05-2016 01:51 PM
RavensFan
if your system answer in 3.7 just change third wait time up to 4000 ms or more and then tell me if the thing that I told is wrong
and also tell me how it is wrong?!
also could you tell me what was wait function with 200 ms or 1500 ms means in your loop that take 3.7 s to work every iteration ?
Is it true to use 200 ms wait in your code now? or it is just mistake? The thing that cause I told before, "it is better first to use elapsed time to know about the code duration time to operate before using wait function ?
02-05-2016 02:21 PM
Correct. Making changes to those waits will cause the behavior to match like you are seeing.
If you are only saying " use elapsed time to know about the code duration time to operate before using wait function", sure there is nothing wrong with that, if you are talking about doing some benchmarking on your code.
But that is not how I read your message. The way I read your message was that you were recommending to the OP that he should use the elapsed time function in his code as the solution for making his loop iterate at a specific rate.
He asked "I want each iteration of while loop to run for specific period of time. How to do that?" So any discussion of using the elapsed time function, which is not needed to solve his problem, it just going on a tangent and confusing the issue, particularly when you don't state that is the purpose of your suggestion was to do some benchmarking.
02-05-2016 03:22 PM
I know my English is not good but also I do not think make some vague sentence here
the answer was given before by Dennis_Knutson (wait function). so I just to point some additional point that is important to attention when try to use wait function
so I wrote this massage” “first use elapsed time vi with appropriate accuracy to find out how much your code make delay in every loop then you can have good view of what you should do for time of iterations"
it is one of common mistake that some of my student done spatially when I learn them some image processing codes that need large number of data and data processing I always mention them before use wait function ,first test if it useless or not based on your code elapsed time then use it
also when you asked me what is relation with my above massage and solution of this post I answer that ""
Indeed what I want to say ,is that we should care about elapsed time for any iteration before use wait
suppose answer is 120 ms elapsed time so does 40 ms wait make sense? when your code make 120ms wait itself ""
So I think any thing is clear enough to understand my means but also if mistake is mine and my English
Sorry about it I just try to bit help to one friend to do not use mistake code not more
Hatef
02-05-2016 04:02 PM
I think you provided much more detail in this last response compared to what you put in that earlier message and it puts the actions of what you are suggesting to do in a much better context of how it can help solve the OP's programming question.
02-05-2016 10:58 PM
RavensFan
last response the last response is just copy and paste my previous responses !
02-05-2016 11:18 PM
Perhaps that you actually put all the responses together in a cohesive paragraph is what made it make sense.