Trouble understanding the Logic Actuator

I am using the Logic Actuator to drive a Mock Pin, I wanted to use the logic operators to only turn on the glycol pump when any one of the tank valves are open (these are driven by the usual Sensor-Setpoint-PID-PWM-Actuator-PIN chain of blocks). I cant figure out why a logical (False & True) is resolving to TRUE.

Grateful for any insights.

Cheers

Logic1

Could you please export your blocks? (admin page -> spark service)

Edit: it looks like there’s a minor display bug in the widget (the red circles don’t turn green).

Otherwise, the widget suggests that FV-1 Cool Actuator is currently ON, and FV-3 Cool Actuator is currently OFF.

From your description, I would expect the comparisons to both be “Measured state == ON”, and the expression to be a|b. (result is true if FV-1 is ON or FV-3 is ON)

You are currently evaluating “FV1 is ON and FV-3 is OFF”.

brewblox-blocks-spark-fv-control.json (10.3 KB)

blocks attached:
Yes agree with your description of logic behaviour. Clearly I would need an OR expression for my use-case, however the logic did not make sense to me, so I tried the AND instead and it still did not make sense. Result should be FALSE if a is ON AND b is OFF, not TRUE (or ON as in the Actuator display)

What am i not getting here?

You definitely want to reason while using the “measured state == ON” for both actuators. This makes it simpler. By using “measured state == OFF”, you invert the result (true becomes false for this actuator, and vice versa).

If you use a|b, then you get the the following behavior:

  • OFF + OFF => false
  • ON + OFF => true
  • OFF + ON => true
  • ON + ON => true

If you use a&b, this becomes:

  • OFF + OFF => false
  • ON + OFF => false
  • OFF + ON => false
  • ON + ON => true

Logical OR can be described as “one or more conditions must be true”.
Logical AND means “all conditions must be true”.

You’re saying what I am saying. But the brewblox result is different from what we are both saying LogicActuator and I am wondering if you can tell me why. Please see the screen grab.
Thanks

Note that you have 2 different actuators.
If both a and b would use the same actuator the expression would indeed be always false.

The red dots should show the state, but as Bob said there is a bug causing them to show red incorrectly here.

The equation also shows the state of each expression, and it seems to work in my test.


The expression you want is probably this: