Simple Control Functions
These functions are used for working with simple conditional controls.
| Function | Description |
|---|---|
addControl | Adds a new simple control to a project. |
deleteControl | Deletes an existing simple control. |
getControl | Retrieves the properties of a simple control. |
setControl | Sets the properties of an existing simple control. |
addControl
Section titled “addControl”Adds a new simple control to a project.
addControl(type: ControlType, linkIndex: number, setting: number, nodeIndex: number, level: number): number;Parameters
| Parameter | Type | Description |
|---|---|---|
| type | ControlType | the type of control to add (see ControlType). |
| linkIndex | number | the index of a link to control (starting from 1). |
| setting | number | control setting applied to the link. |
| nodeIndex | number | index of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls). |
| level | number | action level (tank level, junction pressure, or time in seconds) that triggers the control. |
Returns
Number
index of the new control.
deleteControl
Section titled “deleteControl”Deletes an existing simple control.
deleteControl(index: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | the index of the control to delete (starting from 1). |
getControl
Section titled “getControl”Retrieves the properties of a simple control.
getControl(index: number): {type: ControlType;linkIndex: number;setting: number;nodeIndex: number;level: number;};Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | the control’s index (starting from 1). |
Returns
Object
{ type: ControlType; linkIndex: number; setting: number; nodeIndex: number; level: number;}| Property | Type | Description |
|---|---|---|
| type | ControlType | the type of control to add (see ControlType). |
| linkIndex | number | the index of a link to control (starting from 1). |
| setting | number | control setting applied to the link. |
| nodeIndex | number | index of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls). |
| level | number | action level (tank level, junction pressure, or time in seconds) that triggers the control. |
setControl
Section titled “setControl”Sets the properties of an existing simple control.
setControl(index: number, type: ControlType, linkIndex: number, setting: number, nodeIndex: number, level: number): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| index | number | the control’s index (starting from 1). |
| type | ControlType | the type of control to add (see ControlType). |
| linkIndex | number | the index of a link to control (starting from 1). |
| setting | number | control setting applied to the link. |
| nodeIndex | number | index of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls). |
| level | number | action level (tank level, junction pressure, or time in seconds) that triggers the control. |