Skip to content

Simple Control Functions

These functions are used for working with simple conditional controls.

FunctionVersionsDescription
addControl2.2+Adds a new simple control to a project.
deleteControl2.2+Deletes an existing simple control.
getControl2.2+Retrieves the properties of a simple control.
setControl2.2+Sets the properties of an existing simple control.
getControlEnabled2.3+Checks whether a simple control is enabled.
setControlEnabled2.3+Enables or disables a 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.

Checks whether a simple control is enabled. Disabled controls are kept in the project but skipped during simulation.

getControlEnabled(index: number): number;

Parameters

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

Returns

Number 1 if the control is enabled, 0 if disabled.


Enables or disables a simple control without deleting it.

setControlEnabled(index: number, enabled: number): void;

Parameters

ParameterTypeDescription
indexnumberthe control’s index (starting from 1).
enablednumber1 to enable the control, 0 to disable it.