07-08-2024 03:35 AM
Hi,
Sorry for disturbing you.
I want to introduce/control the run time of code.
Solved! Go to Solution.
07-08-2024 05:49 AM
I got solution by adding elapsed time within while loop and its working....
Kind regards
Hasham
07-08-2024 12:26 PM - edited 07-08-2024 12:29 PM
Why do you keep attaching the same Rube Goldberg code over and over again, even though we told you how to simplify it by 90%! (... and please don't maximize the front panel and diagram to the screen!).
If you want to stop the loop after a certain time, it should be a while loop because you don't know the number of iterations unless you have a defined loop time. Do you? If you would define a loop time using a suitable wait, you could keep the FOR loop and calculate the number of iterations before the loop even starts. No need to even measure the time.
There are much easier ways to measure elapsed time than a gigantic express VI. You already measure the elapsed time, so all you need is a "greater than" comparison to stop the loop!
This is still an one-shot downhill program that requires the run button to start. Shouldn't this be a proper state machine instead?
07-09-2024 02:06 AM
Hi,
Thanks for your reply; yes, you are right; I tried, but I stuck to this code as it is working, and I use the elapsed time function to set the total time run and. I will also try your suggestions and share an update with you.
Once again, thanks.
Kind regards
Hasham
07-09-2024 05:17 AM
Hi,
I am using this elapsed time VI is this Ok to use with WHILE loop.
07-09-2024 06:43 AM
Hi Hasham,
@Hasham622x wrote:
I am using this elapsed time VI is this Ok to use with WHILE loop.
It's "ok" as long as it works for you...
We still strongly recommend to cleanup your code by following our suggestions! (Cleaner code is much easier to maintain!)
07-09-2024 06:50 AM
Hi,
Thanks for your reply and you are right. I prepared the test code by following suggestions and changes in the current code, and tomorrow, I will try that code and then share an update.
07-10-2024 10:52 PM
Hi,
First of all, thanks for the guidance. I tried both options to simplify the code. A Simpler approach is working, and the best approach, unflatten/flatten subVI based, is not working in which I am making any wrong connection within a FOR loop / conditional loop due to that it is giving only for columns of an array whose all values are zeros.
I attached both codes (LV19) with this message.
Kind regards
Hasham
07-10-2024 10:54 PM
Hi,
First of all, thanks for the guidance. I tried both options to simplify the code. A Simpler approach is working, and the best approach, unflatten/flatten subVI based, is not working in which I am making any wrong connection within a FOR loop / conditional loop due to that it is giving only for columns of an array whose all values are zeros.
I attached both codes (LV19) with this message.
Kind regards
Hasham
07-11-2024 12:52 AM
Hi Hasham,
@Hasham622x wrote:
the best approach, unflatten/flatten subVI based, is not working in which I am making any wrong connection within a FOR loop / conditional loop due to that it is giving only for columns of an array whose all values are zeros.
Nobody told you to use orange wires in this conversion step: so why did you use them???