From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cycle boolean based on pressure

Solved!
Go to solution

I want to enter in a low limit, high limit and read pressure. When the pressure is above the high limit then the Boolean is False until the pressure is below the low limit. At that point the Boolean is true until the pressure is above the high limit. This should cycle on and off.

0 Kudos
Message 1 of 9
(2,710 Views)

The output not only depends on the input values, but also on the history. You need a feedback node to retain state. See how far you get.

0 Kudos
Message 2 of 9
(2,703 Views)

Still having trouble after I tried that.

0 Kudos
Message 3 of 9
(2,670 Views)

Hi bassin,

 

you are looking for a comparison including a hysteresis.

Many other had the same task before, so you surely will find solutions or atleast descriptions of…

 

IF value > high THEN
  boolean := FALSE
ELSEIF value < low THEN
  boolean := TRUE
ELSE
  boolean := boolean
ENDIF

or

IF value > high OR value < low THEN
   boolean := value < high
ELSE
  boolean := boolean
ENDIF

 Edit:

Still having trouble after I tried that.

There is no feedbacknode (or shift register) in your VI.

Even worse: there is a classic Rube-Goldberg and a global not needed for the task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(2,669 Views)

This will be a rapidly changing pressure. It will need to turn off as soon as it goes above a high limit. It will need to stay off until it goes below a low limit. At that time it need to come on and stay on until it goes above the high limit again. It will have to know the previous value and needs a way to assure which direction the pressure is going (Up or Down). IF it is within the range (not below low limit and not above high limit) then the direction the pressure is going will decide if it is on or off. On if it is going up. Off is it is going down. Needs a hysteresis I assume to assure the direction of pressure.

0 Kudos
Message 5 of 9
(2,664 Views)

Hi bassin,

 

I posted this example long time ago:

check.png

Simple comparison with hysteresis…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(2,659 Views)

Thanks. I figured it out and will post it here in case someone would like to see the answer. I can't believe how simple it was. Guess I was way over thinking it.

0 Kudos
Message 7 of 9
(2,639 Views)
Solution
Accepted by topic author bassinbc

Why do you have a For Loop executing twice?

 

For something with simple Either/Or values, it is easier to read code using the Select function rather than embedded case structures.

 

Here is a message where I posted a Vi called DeadBand.vi  http://forums.ni.com/t5/LabVIEW/refrigerator-temperature-control/m-p/1096003#M484777

 

It is easy enough to modify if you need the reverse actions for On and Off.

0 Kudos
Message 8 of 9
(2,628 Views)

Thanks, I took this and modified it to work for my needs.

0 Kudos
Message 9 of 9
(2,600 Views)