取消
显示结果 
搜索替代 
您的意思是: 

Cycle boolean based on pressure

已解决!
转到解答

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 项奖励
1 条消息(共 9 条)
3,979 次查看

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 项奖励
2 条消息(共 9 条)
3,972 次查看

Still having trouble after I tried that.

0 项奖励
3 条消息(共 9 条)
3,939 次查看

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 项奖励
4 条消息(共 9 条)
3,938 次查看

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 项奖励
5 条消息(共 9 条)
3,933 次查看

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 项奖励
6 条消息(共 9 条)
3,928 次查看

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 项奖励
7 条消息(共 9 条)
3,908 次查看
解答
已被主题作者 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 项奖励
8 条消息(共 9 条)
3,897 次查看

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

0 项奖励
9 条消息(共 9 条)
3,869 次查看