Learn R Programming

epanet2toolkit (version 1.0.8)

ENsetlinkvalue: Set a parameter value for a link

Description

Set a parameter value for a link

Usage

ENsetlinkvalue(index, paramcode, value)

Value

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

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_DIAMETER0Diameter
EN_LENGTH1Length
EN_ROUGHNESS2Roughness coeff.
EN_MINORLOSS3Minor loss coeff.
EN_INITSTATUS4Initial link status (0 = closed, 1 = open)
EN_INITSETTING5Pipe roughness
Initial pump speed
Initial valve setting
EN_KBULK6Bulk reaction coeff.
EN_KWALL7Wall reaction coeff.
EN_STATUS11Current pump or valve status (0 = closed, 1 = open)
EN_SETTING12Current 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.

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")
ENgetlinkvalue(8, "EN_LENGTH")
ENsetlinkvalue(8, "EN_LENGTH", 3333)
ENgetlinkvalue(8, "EN_DIAMETER")
ENclose()

Run the code above in your browser using DataLab