In order to use rules effectively, there are a few key concepts that are important to understand. Don't worry about memorizing these, but refer to this section if you get stuck or have unexpected behavior.
Rules set elements
Important Concept: Every rule has a 'target' data element whose value it may set. Only outputs and variables can be set.
Different rule types have different behaviors. There are discussed in more detail in the following sections. In summary:
- Math rules always set their target element every cycle.
- Every differential rule sets its target element to either TRUE or FALSE every cycle.
- Logical rules ONLY change their target if the rule evaluates to true. If the rule evaluates to false, they do nothing.
- Timer rules set their target if the criteria are met. If not, they decrement their target until the target is zero.
Rules can use either numeric values or elements as parameters
Important Concept: Some fields in some rules can refer to a data element OR may simply have a numeric value. This provides flexibility: If the parameter is something that you might want to set via another rule or from the user interface, use a variable. If it's a simple value that's unlikely to change, just use the numeric value, For example, consider a rule that determines whether a zone needs heat. It could compare the current temperature to a fixed numeric value (68 in this case).
However, the same rule could refer to a variable instead - 'Room Setpoint', for instance. The value of the Room Setpoint variable could then be set by other rules or could be set from the standard or a custom user interface:
Rules are evaluated periodically
The task that handles rules runs at a set interval (usually once per second). Every rule is processed, results are sent to Vesta outputs, and the task waits until it's time to run again.
Rules are evaluated sequentially
Rules are evaluated in the sequence displayed. Results are not written to shared memory until all rules have been evaluated. This means that if you have two or more rules that set the same element, the last value is the one that will be written back to shared memory.
In the Front Panel Example, there is an instance of this situation. When the user switch is moved to the 'right' position, LED 3 lights immediately. However, LED 4 does not light until the next cycle. That's because LED 4 is based on the LED Timer variable, and that does not get set until the end of the first cycle.
Default values for elements
Discrete outputs and variables are a special case
At the beginning of each rule cycle, all discrete outputs and variables managed by the rule engine are in effect initialized to FALSE. They will remain FALSE unless a rule sets them to TRUE. One consequence of this behavior is that if a Vesta output is active, there is a rule that's triggered to make that happen. This makes it easy to answer the question "Why is this device on?"
All other elements inherit their previous values. If no rule acts on them, they will retain the same value indefinitely.
Multiple rules for the same element
The basic behavior is that any element affected by multiple rules ends with the value from the last rule that sets it. The exception is logical rules, which only set their target element when triggered and leave it unchanged otherwise. This is covered in more detail in the Logical Rules section.
It's possible and often desirable to have more than one rule that sets the same element. This is particularly true for discrete output elements. If there are multiple rules that set the same element to TRUE, then it will end up as TRUE if any of the rules is triggered.
Deleting, moving and editing rules
Any rule may be deleted by simply clicking the 'X' button next to the rule. There is no 'undo'.
You can move rules up or down by clicking the arrow buttons next to the rules.
To update a rule, click the pencil icon next to the rule. This will open the rule in a new window (or tab):
You can construct your rule by selecting values from the pulldown menus. In each case, the pulldown will only display choices that are valid for that field. For instance, you can't set the value of an input, so sensors are not shown as choices for the 'target' field.
Note that the pulldown menu choices follow the Vesta color coding standard:
|Analog Inputs (sensors)|
If there's a field that can have either a numeric value or an element reference, there will be a pulldown with a text entry box below it. If the pulldown is set to '--' then the value in the text box will be used.