Learn R Programming

epanet2toolkit (version 1.0.8)

ENsetcontrol: Set the parameters of a simple control statement

Description

ENsetcontrol sets the parameters of a simple control statements.

Usage

ENsetcontrol(
  cindex,
  ctype = NULL,
  lindex = NULL,
  setting = NULL,
  nindex = NULL,
  level = NULL
)

Value

Returns NULL invisibly on success or raises an error or warning.

Arguments

cindex

Integer, control statement index

ctype

Integer or character string, the control type code (see Details below).

lindex

Integer, index of the link being controlled.

setting

Numeric, value of the control setting.

nindex

Integer, the index of the controlling node.

level

value of controlling water level or pressure for level controls or of time of control action (in seconds) for time-based controls

Details

Controls are indexed starting from 1 in the order in which they were entered into the [CONTROLS] section of the EPANET input file. Control type codes consist of the following:

EN_LOWLEVEL0Control applied when tank level or node pressure
drops below specified level
EN_HILEVEL1Control applied when tank level or node pressure
rises above specified level
EN_TIMER2Control applied at specific time into simulation
EN_TIMEOFDAY3Control applied at specific time of day

For pipes, a setting of 0 means the pipe is closed and 1 means it is open. For a pump, the setting contains the pump's speed, with 0 meaning the pump is closed and 1 meaning it is open at its normal speed. For a valve, the setting refers to the valve's pressure, flow, or loss coefficient, depending on valve type.

For Timer or Time-of-Day controls set the nindex parameter to 0.

For level controls, if the controlling node nindex is a tank then the level parameter should be a water level above the tank bottom (not an elevation). Otherwise level should be a junction pressure.

To remove a control on a particular link, set the lindex parameter to 0. Values for the other parameters in the function will be ignored.

See Also

ENsetcontrol

Examples

Run this code
# path to Net1.inp example file included with this package
inp <- file.path( find.package("epanet2toolkit"), "extdata","Net1.inp")  
ENopen( inp, "Net1.rpt")
ENgetcontrol(1)
ENsetcontrol(1, ctype=2, lindex=3, setting=1, nindex=0, level=54)		
ENgetcontrol(1)
ENclose() 

Run the code above in your browser using DataLab