Logical rules operate on TRUE/FALSE values. They set an element based on whether some combination of other elements are TRUE or FALSE. The template is as follows:
Set Element1 to Element/Value if Element2 is / is not true and Element3 is / is not true and Element4 is / is not true
NOTE: Unlike differential rules, logical rules can set the target element to any value, not just TRUE. If the conditions in a logical rule are satisfied, the target element (Element1) will be set to the value of the element or number specified in the second parameter.
NOTE: Also unlike differential rules, a logical rule does not set the value of the target element if conditions of the rule are not satisfied. If the rule is not triggered, then the target element remains unchanged.
In logical rules, the last two elements are optional.
The LED Sample rules that are delivered with the Vesta are described in an earlier section. These provide good examples of logical rules.
Multiple Rules and Logical OR
Individual logical rules can contain multiple criteria which are combined with a logical AND. Sometime it's desirable to combine criteria with a logical OR. For instance, suppose that you have a set of discrete inputs connected to switches that detect dangerous conditions and you want to turn on an alarm if any of them are true. A single logical rule can't do this. However, you can create a set of rules all with the same target element as follows:
Set Alarm to TRUE if FloorWet is true
Set Alarm to TRUE if OverTemp is true
Set Alarm to TRUE if DoorOpen is true and PrimaryBlower is true
Since logical rules do not set their target element if they're not triggered, multiple logical rules can act on the same target with the result that the target is set if any of the rules are triggered. Remember that discrete outputs and state variables default to FALSE if no rule acts on them. In this case, Alarm is a discrete output so it will end up with a value of false if none of these rules are triggered.
Example: Setback Rule
In the LED example, all of the logical rules set the target element to TRUE. This is the most common situation, and it makes perfect sense if the target element is a discrete output. However, the target could also be a variable or an analog output. In the differential rules section there was an example of a differential rule that provided the same functionality as a thermostat:
Set ZoneValve1 if TopFloorTemp is less than TopFloorSetpoint with a deadband of 2.0
If there were a discrete input (a switch, or timer contacts, or an occupancy sensor) that indicated whether the heated area were occupied, we could add a couple of logical rules to change the TopFloorSetpoint variable:
Set TopFloorSetpoint to 72 if Occupied is true
Set TopFloorSetpoint to 65 if Occupied is not true
In this example, these elements are used:
- TopFloorSetpoint: A variable that contains the desired temperature for the top floor
- Occupied: A discrete input that indicates whether the area is occupied