Rule-based Controls are statements of the form:
RULE ruleID
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 priority
where
|
ruleID
|
=
|
an ID label assigned to the rule
|
|
conditon_n
|
=
|
a condition clause
|
|
action_n
|
=
|
an action clause
|
|
priority
|
=
|
a priority value (e.g., a number from 1 to 5)
|
The following conventions apply to rule statements:
1. Only the RULE, IF and THEN portions of a rule are required; the other portions are optional.
2. Any number and combination of AND and OR clauses can be used in a rule.
3. 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
Rule 1: IF A THEN ...
Rule 2: IF B and C THEN ...
4. The PRIORITY value is used to determine which rule applies when two or more rules require that conflicting actions be taken on a link. The higher the value the higher the priority. 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.
5. There is no limit on the number of rule statements that can be added to a project.
A condition clause in a Rule-Based Control takes the form of:
object id attribute relation value
where
|
object
|
=
|
a category of network object
|
|
id
|
=
|
the object's ID label
|
|
attribute
|
=
|
an attribute or property of the object
|
|
relation
|
=
|
a relational operator
|
|
value
|
=
|
an attribute value
|
Some example conditional clauses are:
JUNCTION 23 PRESSURE > 20
TANK T200 FILLTIME BELOW 3.5
LINK 44 STATUS IS OPEN
SYSTEM DEMAND >= 1500
SYSTEM CLOCKTIME = 7:30 AM
The Object keyword can be any of the following:
NODE LINK SYSTEM
JUNCTION PIPE
RESERVOIR PUMP
TANK VALVE
When SYSTEM is used in a condition no ID is supplied.
The following attributes can be used with Node-type objects:
DEMAND
HEAD
PRESSURE
The following attributes can be used with Tanks:
LEVEL
FILLTIME (hours needed to fill a tank)
DRAINTIME (hours needed to empty a tank)
These attributes can be used with Link-Type objects:
FLOW
STATUS (OPEN, CLOSED, or ACTIVE)
SETTING (Pump speed or Valve setting)
The SYSTEM object can use the following attributes:
DEMAND (total system demand)
TIME (hours from the start of the simulation)
CLOCKTIME (24-hour clock time with AM or PM appended)
Relation operators consist of the following:
= IS
<> NOT
< BELOW
> ABOVE
<= >=
An action clause in a Rule-Based Control takes the form of:
object id STATUS/SETTING IS value
where
|
object
|
=
|
LINK, PIPE, PUMP, or VALVE keyword
|
|
id
|
=
|
the object's ID label
|
|
value
|
=
|
a status condition (OPEN or CLOSED), pump speed setting, or valve setting
|
Some example action clauses are:
LINK 23 STATUS IS CLOSED
PUMP P100 SETTING IS 1.5
VALVE 123 SETTING IS 90