LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to force a new period to a timed loop?

Solved!
Go to solution

Hello.

Here my question:

 

I need to change programmatically the period of a timed loop. This is not a problem but:

 

I have to wait up to the next loop to submit the new period value. For example if my previous period was 20 minutes, now I have to wait 20 minutes in order to submit a new period.

 

This beacause the code to change the period must be inside the timed loop itself. You can see what I mean in the attached image.

Cattura.PNG

 

The subVI gets the new period from a operator console. It will be executed only at the end of the period previously configured.

 

My question is: Is it possible to force the timed loop to get the new value without to wait the execution of the previous period?

 

Thank you

 

fpia

0 Kudos
Message 1 of 5
(3,696 Views)
Solution
Accepted by topic author fpia

Hi fpia,

 

sometimes it might be more useful to wait for 1200 seconds instead of 20 mins 😉

It has been suggested a lot of times before: instead of waiting for a long time with just a single call of a Wait function you should split that amount of time into several smaller pieces!

 

- Why don't you use a timing period of e.g. 5s and just count the iterations to know when 20 mins are over?

- Why don't you use the "Elapsed time" function to know when 20 mins are over?

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,691 Views)

Gerd beat me to it.  You really should make your loop iteration much smaller and then use a count of number of cycles before performing your next operation.  Then you can easily change how long to wait for each operation.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(3,688 Views)

Thank you Gerd.

 

My labview experience is not very good. I believed that one iteration over 1200 seconds was less CPU consuming. This beacause I've several loops like that, not just one. So in my head I thougth to execute each loop in 1200 seconds and to "wake up" them (if necessary) with some function or someting that I don't know!

 

Anyway, because you wrote "it has been suggested a lot of times", I think your solution is better than what I tried to do. I'm going to write it.

 

 

Thank you for you suggestion.

 

fpia

0 Kudos
Message 4 of 5
(3,668 Views)

@fpia wrote:

My labview experience is not very good. I believed that one iteration over 1200 seconds was less CPU consuming.


To the computer, anything more than a few milliseconds is an eternity.  So having 1 second loop vs 1200 second loop will do next to nothing to the CPU consumption.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(3,665 Views)