The following are example control rules.
; Simple time-based pump control
RULE R1
IF SIMULATION TIME > 8
THEN PUMP 12 STATUS = ON
ELSE PUMP 12 STATUS = OFF
; Multi-condition orifice gate control
RULE R2A
IF NODE 23 DEPTH > 12
AND LINK 165 FLOW > 100
THEN ORIFICE R55 SETTING = 0.5
RULE R2B
IF NODE 23 DEPTH > 12
AND LINK 165 FLOW > 200
THEN ORIFICE R55 SETTING = 1.0
RULE R2C
IF NODE 23 DEPTH <= 12
OR LINK 165 FLOW <= 100
THEN ORIFICE R55 SETTING = 0
; Pump station operation
RULE R3A
IF NODE N1 DEPTH > 5
THEN PUMP N1A STATUS = ON
RULE R3B
IF NODE N1 DEPTH > 7
THEN PUMP N1B STATUS = ON
RULE R3C
IF NODE N1 DEPTH <= 3
THEN PUMP N1A STATUS = OFF
AND PUMP N1B STATUS = OFF
; Modulated weir height control
RULE R4
IF NODE N2 DEPTH >= 0
THEN WEIR W25 SETTING = CURVE C25
Each control rule is a series of statements of the form:
IF condition_1
AND condition_2
OR condition_3
AND condition_4
Etc.
THEN action_1
AND action_2
Etc.
ELSE action_3
AND action_4
Etc.
Where keywords are shown in boldface and ruleID is an ID label assigned to the rule, condition_n is a Condition Clause, action_n is an Action Clause, and value is a priority value (e.g., a number from 1 to 5).
Only the RULE, IF and THEN portions of a rule are required; the ELSE and PRIORITY portions are optional.
Blank lines between clauses are permitted and any text to the right of a semicolon is considered a comment.
When mixing AND and OR clauses, the OR operator has higher precedence than AND, i.e.
IF A or B and C
is equivalent to
IF (A or B) and C.
If the interpretation was meant to be
IF A or (B and C)
then this can be expressed using two rules as in
IF A THEN ...
IF B and C THEN ...
The PRIORITY value is used to determine which rule applies when two or more rules require that conflicting actions be taken on a link. A rule without a priority value always has a lower priority than one with a value. For two rules with the same priority value, the rule that appears first is given the higher priority.
A Condition Clause of a Control Rule has the following format:
object id attribute relation value
where
object = a category of object
id = the object's ID label
attribute = an attribute or property of the object
relation = a relational operator (=, <>, <, <=, >, >=)
value = an attribute value
Some examples of condition clauses are:
NODE N23 DEPTH > 10
PUMP P45 STATUS = OFF
SIMULATION CLOCKTIME = 22:45:00
The objects and attributes that can appear in a condition clause are as follows.
Object
|
Attributes |
Value |
NODE |
DEPTH |
Numerical value. |
LINK |
FLOW |
Numerical value. |
PUMP |
STATUS |
ON or OFF. |
ORIFICE |
SETTING |
Fraction open. |
SIMULATION |
TIME |
Elapsed time in decimal hours or hr:min:sec. |
An Action Clause of a Control Rule can have one of the following formats:
PUMP id STATUS = ON/OFF
PUMP/ORIFICE/WEIR/OUTLET id SETTING = value
where the meaning of SETTING depends on the object being controlled:
For Pumps it is a multiplier applied to the flow computed from the pump curve.
For Orifices it is the fractional amount that the orifice is fully open.
For Weirs it is the fractional amount of the original freeboard that exists i.e. weir control is accomplished by moving the crest height up or down).
Some examples of action clauses are:
PUMP P67 STATUS = OFF
ORIFICE O212 SETTING = 0.5
Modulated Controls are control rules that provide for a continuous degree of control applied to a pump or flow regulator as determined by the value of some controller variable, such as water depth at a node, or by time. The functional relationship between the control setting and the controller variable is specificed by using a Control Curve. Some examples of modulated control rules are:
RULE MC1
IF NODE N2 DEPTH >= 0
THEN WEIR W25 SETTING = CURVE C25
RULE MC2
IF SIMULATION TIME > 0
THEN PUMP P12 SETTING = TIMESERIES TS101
Note how a modified form of the action clause is used to specify the name of the control curve or time series that defines the degree of control. Also, by convention the controller variable used in a Control Curve must always be the object and attribute named in the last condition clause of the rule. As an example, in rule MC1 above Curve C25 would define how the fractional setting at Weir W25 varied with the water depth at Node N2.