ENsetlinkvalue: Set a parameter value for a link

View source: R/links.r

ENsetlinkvalueR Documentation

Set a parameter value for a link

Description

Set a parameter value for a link

Usage

ENsetlinkvalue(index, paramcode, value)

Arguments

index

of the link

paramcode

number or name of parameter code, see details

value

new value of the parameter.

Details

Links are indexed starting from 1.

Link parameter codes consist of the following constants:

EN_DIAMETER 0 Diameter
EN_LENGTH 1 Length
EN_ROUGHNESS 2 Roughness coeff.
EN_MINORLOSS 3 Minor loss coeff.
EN_INITSTATUS 4 Initial link status (0 = closed, 1 = open)
EN_INITSETTING 5 Pipe roughness
Initial pump speed
Initial valve setting
EN_KBULK 6 Bulk reaction coeff.
EN_KWALL 7 Wall reaction coeff.
EN_STATUS 11 Current pump or valve status (0 = closed, 1 = open)
EN_SETTING 12 Current pump speed of valve setting.

Values are supplied in units which depend on the units used for flow rate in the EPANET input file (see Units of Measurement). Use EN_INITSTATUS and EN_INITSETTING to set the design value for a link's status or setting that exists prior to the start of a simulation. Use EN_STATUS and EN_SETTING to change these values while a simulation is being run (within the ENrunH - ENnextH loop).

If a control valve has its status explicitly set to OPEN or CLOSED, then to make it active again during a simulation you must provide a new valve setting value using the EN_SETTING parameter.

For pipes, either EN_ROUGHNESS or EN_INITSETTING can be used to change roughness.

Value

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

Examples

# path to Net1.inp example file included with this package
inp <- file.path( find.package("epanet2toolkit"), "extdata","Net1.inp")  
ENopen(inp, "Net1.rpt")
ENgetlinkvalue(8, "EN_LENGTH")
ENsetlinkvalue(8, "EN_LENGTH", 3333)
ENgetlinkvalue(8, "EN_DIAMETER")
ENclose()

epanet2toolkit documentation built on Nov. 6, 2023, 9:06 a.m.