Control Set Formats
Formats
Each control set consists of a series of statements of the form:
RULE ruleID IF condition_1AND condition_2 OR condition_3 AND condition_4
Etc.
THEN action_1 AND action_2
Etc.
ELSE action_3 AND action_4
Etc.
PRIORITY value
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).
Condition Clauses
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:
Objects and Attributes in Condition Clauses
Object | Attribute | Value |
---|---|---|
NODE | DEPTHHEADINFLOW | numerical valuenumerical valuenumerical value |
LINK | FLOWDEPTH | numerical valuenumerical value |
PUMP | STATUSFLOW | ON or OFFnumerical value |
ORIFICEWEIR | SETTING | fraction open |
SIMULATION | TIMEDATECLOCKTIME | elapsed time in decimal hours or hr:min:sec month/day/year time of day in hr:min:sec |
Action Clauses
An Action Clause of a Control Rule can have one of the following formats:
PUMP id STATUS = ON/OFF ORIFICE id SETTING = value WEIR id SETTING = value
Where SETTING is the fractional amount that an orifice is fully open or to the fractional amount of the original height between the crest and the top of a weir that remains (i.e., weir control is accomplished by moving the crest height up and down).
Some examples of action clauses are:
PUMP P67 STATUS = OFF ORIFICE O212 SETTING = 0.5
Only the RULE, IF and THEN portions of a rule are required; the other portions are optional.
Blank lines between clauses are allowed, 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.
Examples
The following are examples of 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 (as in a SWMM4 Type5 pump)
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