LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Wait Until Numeric Value is Reached

Ok - i have a very simple state machine, but in one of the states we want to wait until a cylinder is filled to 100 PSI.  How do I make the state machine wait and keep running that logic until the 100 PSI is satisfied?   If I put a comparison in the logic, I then need to wire a true and false out and I dont know where to wire the false to.   I suppose I could wire the false back to the "fill" state, but that seems butch.  There must be some way to have the logic run until this condition is met (pressure sensor = 100 psi).  I love simple examples too is anyone is willing....

 

Thanks,

0 Kudos
Message 1 of 3
(2,576 Views)

In your Wait until threshold state you do the comparison. If True, then Next state = State after satisfied. If False, then Wait ~100 ms (or some small time which is reasonable for your process) and Next state = Wait until threshold. So you enter the state, do the check, then re-enter the same state if the exit criteria have not been met.

 

Doing it this way allows higher priority commands to "break in" if needed and does not tie up the system with extremely rapid iterations as would occur if no wait was included.

 

Lynn

0 Kudos
Message 2 of 3
(2,572 Views)

Indeed, this is absolutely correct.  I'm not sure what you mean by "butch," but returning to the current state is an extremely common practice that is utilized in many state machines.

 

0 Kudos
Message 3 of 3
(2,533 Views)