LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional While Loop Timeout

Solved!
Go to solution

Hello Dear LabVIEW Forum,

I have developed a Control Loop in Labview where i can enter a Setpoint as a dbl from 1-12 and it gets compared to the Real Value of a Flow meter the flow is Controled by my loop already.

The Error from comparing Setpoint and Real Flow should be -0,1 to 0,1 wich also works by now.

 

 

The Problem i have is that sometimes when i use different valves(and i have to) lets say 11 or 12 cant be reached so the error stays bigger that 0,1 for a certain amount of time and i want to implement a timeout of the while loop for that case and also specify a routine wich should be executed in that case.

How can i do that in LabVIEW?

 

Thank you to all the Helpers

 

 

0 Kudos
Message 1 of 4
(1,100 Views)

Hi Tom,

 


@Tomlab wrote:

cant be reached so the error stays bigger that 0,1 for a certain amount of time and i want to implement a timeout of the while loop for that case


Read the timestamp before the loop and inside the loop. Get the difference and end the loop when the difference gets larger than your timeout value…

 


@Tomlab wrote:

 specify a routine wich should be executed in that case.


Use a case structure after the loop, connected to your timeout comparison result…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,084 Views)

Hi Gerd,

thank you for your fast answer.

 

Read the timestamp before the loop and inside the loop. Get the difference and end the loop when the difference gets larger than your timeout value…

 

1. How do i read the timestamp?

2. the loop should only terminate after a duration that the error is big enough the requested value should be changeable at any given time wich makes it hard to figure a set timeout so i basically would need a check if error bigger 0,1 then count time if time bigger 30s for example then shut down.

is there a good way to do that?

I thought maybe i make a case struct for + error and 1 for- error where it compares the error to 0,1 and if its bigger makes +1 on a counter but for that id need to set the time of a loop circle for that to happen fix.

0 Kudos
Message 3 of 4
(1,067 Views)
Solution
Accepted by topic author Tomlab

Hi Tom,

 


@Tomlab wrote:

1. How do i read the timestamp?


GetTickCount. GetDateTimeInSeconds, HighResolutionRelativeTime…

 


@Tomlab wrote:

2. the loop should only terminate after a duration that the error is big 


Get the timestamp based on that condition!

Put the "pre-loop timestamp" in a shift register and its value when the error falls below the limit…

 

(My suggestion basically is the same as the ElapsedTime function, but without using an ExpressVI.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(1,064 Views)