SWMM - Control Rules - Format of the Rules


Each control rule is a series of statements of the form:

 RULE rule_id
 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.
 PRIORITY value

Where keywords are shown in bold and rule_ID 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 (for example, a number from 1 to 5).

Each rule clause must begin with one of the bolded keywords shown above, and only one clause per line is allowed.

Only the RULE, IF, and THEN parts of a rule are required; the ELSE and PRIORITY parts 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 should be:

IF A OR (B AND C)

Then this can be expressed using two rules as in:

 RULE A1
 IF A 
 THEN...

 RULE A2
 IF B  AND C 
 THEN...

The PRIORITY value is used to determine which rule applies when two or more rules require conflicting actions to be performed on a link. A conflicting rule with a higher priority value takes precedence over one with a lower value (for example, PRIORITY 5 trumps PRIORITY 1). 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 gets the highest priority.

Some observations regarding the clause editor of SOLIDOS:


See also: SWMM Rules Controls