Skip to content

Simple Control Functions

These functions are used for working with simple conditional controls.

FunctionDescription
addControlAdds a new simple control to a project.
deleteControlDeletes an existing simple control.
getControlRetrieves the properties of a simple control.
setControlSets the properties of an existing simple control.

Adds a new simple control to a project.

addControl(type: ControlType, linkIndex: number, setting: number, nodeIndex: number, level: number): number;

Parameters

ParameterTypeDescription
typeControlTypethe type of control to add (see ControlType).
linkIndexnumberthe index of a link to control (starting from 1).
settingnumbercontrol setting applied to the link.
nodeIndexnumberindex of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls).
levelnumberaction level (tank level, junction pressure, or time in seconds) that triggers the control.

Returns

Number index of the new control.


Deletes an existing simple control.

deleteControl(index: number): void;

Parameters

ParameterTypeDescription
indexnumberthe index of the control to delete (starting from 1).

Retrieves the properties of a simple control.

getControl(index: number): {
type: ControlType;
linkIndex: number;
setting: number;
nodeIndex: number;
level: number;
};

Parameters

ParameterTypeDescription
indexnumberthe control’s index (starting from 1).

Returns

Object

{
type: ControlType;
linkIndex: number;
setting: number;
nodeIndex: number;
level: number;
}
PropertyTypeDescription
typeControlTypethe type of control to add (see ControlType).
linkIndexnumberthe index of a link to control (starting from 1).
settingnumbercontrol setting applied to the link.
nodeIndexnumberindex of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls).
levelnumberaction level (tank level, junction pressure, or time in seconds) that triggers the control.

Sets the properties of an existing simple control.

setControl(index: number, type: ControlType, linkIndex: number, setting: number, nodeIndex: number, level: number): void;

Parameters

ParameterTypeDescription
indexnumberthe control’s index (starting from 1).
typeControlTypethe type of control to add (see ControlType).
linkIndexnumberthe index of a link to control (starting from 1).
settingnumbercontrol setting applied to the link.
nodeIndexnumberindex of the node used to control the link (0 for ControlType.Timer and ControlType.TimeOfDay controls).
levelnumberaction level (tank level, junction pressure, or time in seconds) that triggers the control.