UPC Scenario items can be imported into Control Data for use as UPC Scripts. See the Updating Control Data from a UPC Scenario topic for details.
This topic describes the conversion of UPC Scenario control definitions into UPC Script Language.
Ranges
A Range in the UPC Scenario with a defined minimum and/or maximum is converted into a COND[ITION] in the UPC Script:
COND range name = Type and Location >= Minimum AND Type and Location < Maximum
Example
UPC Scenario Range
Range Name = LowLevel
Type = Pressure
Location Node = CRES2
Min value = 3
Max value = 3.7
UPC Script
COND LowLevel = NODE CRES2 PRESSURE >= 3 AND NODE CRES2 PRESSURE < 3.7
A Range in the UPC Scenario without a defined minimum or maximum is converted into a VAR[IABLE] in the UPC Script.
UPC Range Attribute | Mapping | |
---|---|---|
Name |
Name |
|
Type and Location |
Z - head |
NODE <node id> HEAD |
DZ - change in head |
NODE <node id> DHDT |
|
P - pressure |
NODE <node id> PRESSURE |
|
Q - flow |
LINK <link id> FLOW |
|
REG - regulator state |
VALVE <valve id> OPENING |
|
PUMP pump state |
PST <pst id> PUMP STATE |
|
VAR - variable value |
<variable name> |
|
T - time |
RUN DATETIME (Date is specified in ISO Standard format: YYYY-MM-DD HH:MM) |
|
TR - time repeat |
RUN TIME (Time is specified as HH:MM) Note:
Time Repeat attributes are converted into Daily times. Day of the week settings are not imported. |
|
Minimum |
>= |
|
Maximum |
< |
Logic
A Logic dependent in the UPC Scenario is converted into a COND[ITION] in the UPC Script:
Example
UPC Scenario Logic
Logic Name = LLMorning
Operator = AND
Dependent Condition 1 = Morning
Dependent condition 2 = LowLevel
UPC Script
COND LLMorning = Morning AND LowLevel
UPC Scenario Attribute | Mapping |
---|---|
Name |
Name |
Operator and Dependent Conditions |
Expression using operator and dependent conditions |
Rule
A Rule in a UPC Scenario is converted into a RULE in the UPC Script.
The following table details the conversion of rules from a UPC Scenario to a Global UPC Script. If a rule is imported into a local UPC Script, references to valve and pump station IDs are omitted.
UPC Rule Type |
UPC Scenario Attribute |
Mapping |
---|---|---|
Ctrl |
|
Example UPC ScenarioRange Name = Range1 Range Type = Pressure Location Node = K124 Minimum = 35 Controller Name = Control1 Controller Type = Reducing/Downstream Controller Sensor = Range1 Rule Condition = Range1 Rule Type = Ctrl Rule Controller = Control1 Setpoint Type = Fixed (35) UPC ScriptCOND Range1 = NODE K124 PRESSURE >= 35 RULE Range1 IF Range1 THEN NODE K124 PRESSURE = 35 USING UPSTREAM VALVE <valve id> ENDIF IF <condition> THEN NODE/LINK <controller sensor node/link id> <attribute> USING UPSTREAM/DOWNSTREAM VALVE/PST <valve/pst id> ENDIF If the rule is imported into a local UPC script, 'VALVE/PST <valve.pst id>' is replaced by 'REGULATOR' |
POS |
|
Example UPC ScenarioRange Name = Range1 Range Type = Pressure Location Node = K124 Maximum = 60 Rule Condition = Range1 Rule Type = POS Setpoint Type = Fixed (70) UPC ScriptCOND Range1 = NODE K124 PRESSURE < 60 RULE Range1 IF Range1 THEN VALVE <valve id> OPENING = 80 ENDIF Valve RegulatorIF <condition> THEN VALVE <valve id> OPENING = <setpoint value> ENDIF PST RegulatorIF <condition> THEN PST <pst id> SPEED = <setpoint value> ENDIF |
ON |
|
Example UPC ScenarioRange Name = Range1 Range Type = Pressure Location Node = CRES2 Minimum = 2 Rule Condition = Range1 Rule Type = ON UPC ScriptCOND Range1 = NODE CRES2 PRESSURE >= 2 RULE Range1 IF Range1 THEN PST <pst id> PUMP 1 = ON ENDIF IF <condition> THEN PST <pst id> PUMP 1 = ON ENDIF |
OFF |
|
IF <condition> THEN PST <pst id> PUMP 1 = OFF ENDIF |
Variable
Most Variables in a UPC Scenario are converted into a VAR[IABLE] in the UPC Script.
A Timer variable in a UPC Scenario is converted into a TIMER in the UPC Script.
Example
UPC Scenario
Range Name = Range1
Range Type = Pressure
Range Location Node = CRES2
Range Minimum = 2
Variable Name = Variable1
Variable Measurement = Pressure
Variable Operator = Equals
Variable Argument 1 = Range1
UPC Script
COND Range1 = NODE CRES2 PRESSURE >= 2 VAR Variable1 = Range1
UPC Variable Operator |
Import |
---|---|
Equals |
VAR <variable name> = <Argument 1> |
Plus Minus Times Divide |
VAR <variable name> = <Argument 1> <operator> <Argument 2> |
IF |
VAR <variable name> = <Argument 2> IF <Argument 1> ELSE <Argument 3> |
TIMER |
TIMER <variable name> START <Argument 1> RESET <Argument 2> [PAUSE <Argument 3>] |
Table
A Table in a UPC Scenario is converted into a TABLE in the UPC Script:
TABLE <name> IN <input range> OUT <measurement> TYPE STEP/LINEAR
Input range mappings are as for Ranges.
Example
UPC Scenario
Range Name = Range1
Range Type = Time Repeat
Range Minimum = 00:00 Daily
Range Maximum = 12:00 Daily
Table Name = Table1
Table Measurement = Opening
Table Input Range = Range1
Table Type = STEP (00:00, 80; 05:00, 0; 07:00, 80)
Rule Condition = Range1
Rule Type = POS
Setpoint Type = Variable (Table1)
UPC Script
COND Range1 = RUN TIME >= 00:00 AND RUN TIME < 12:00 TABLE Table1 IN RUN TIME OUT OPENING TYPE STEP 00:00 80 05:00 0 07:00 80 RULE Range1 IF Range1 THEN VALVE <valve id> OPENING = Table1 ENDIF
Comment
Comments are imported as Comments into the UPC Script.
For example:
COMMENT Logical Rule for controlling Pump Station KCH2PMP
Override Other Control
If the Override Other Control box is unchecked for a regulator in the UPC Scenario; on import to a local UPC Script, the Disable UPC setting in the Control Data for that regulator will be turned on.
Initialise
Initial settings in the UPC Scenario are imported as INITIALISE statements in the UPC Script.
For example:
INITIALISE OPENING = 75