Skip to main content

Crate epanet_sys

Crate epanet_sys 

Source
Expand description

§epanet-sys

Raw FFI bindings to the EPANET 2.3 C library for water distribution network modeling and simulation.

The EPANET source is included as a git submodule and compiled via CMake at build time. Rust bindings are generated by bindgen.

If you want a safe, idiomatic Rust API, use the rusty-epanet crate instead.

§Prerequisites

  • CMake and a C compiler (MSVC on Windows, GCC/Clang on Linux/macOS)
  • libclang (for bindgen)

§Usage

[dependencies]
epanet-sys = "2.3"

All EPANET C API functions are available as unsafe extern functions:

use epanet_sys::*;

unsafe {
    let mut ph: EN_Project = std::ptr::null_mut();
    EN_createproject(&mut ph);
    // ...
    EN_deleteproject(ph);
}

§Linking

By default the EPANET C library is statically linked into your binary.

To use dynamic linking instead:

[dependencies]
epanet-sys = { version = "2.3", default-features = false, features = ["dynamic-link"] }

§Versioning

The crate version tracks the EPANET C library version (2.3.x).

§License

MIT

Structs§

Project

Constants§

EN_ActionCodeType_EN_CONDITIONAL
!< Cancel object deletion if it appears in controls or has connecting links
EN_ActionCodeType_EN_UNCONDITIONAL
!< Delete all controls and connecting links
EN_AnalysisStatistic_EN_DEFICIENTNODES
!< Number of pressure deficient nodes
EN_AnalysisStatistic_EN_DEMANDREDUCTION
!< % demand reduction at pressure deficient nodes
EN_AnalysisStatistic_EN_ITERATIONS
!< Number of hydraulic iterations taken
EN_AnalysisStatistic_EN_LEAKAGELOSS
!< % flow lost to system leakage
EN_AnalysisStatistic_EN_MASSBALANCE
!< Cumulative water quality mass balance ratio
EN_AnalysisStatistic_EN_MAXFLOWCHANGE
!< Largest flow change in links
EN_AnalysisStatistic_EN_MAXHEADERROR
!< Largest head loss error for links
EN_AnalysisStatistic_EN_RELATIVEERROR
!< Sum of link flow changes / sum of link flows
EN_ControlType_EN_HILEVEL
!< Act when pressure or tank level rises above a setpoint
EN_ControlType_EN_LOWLEVEL
!< Act when pressure or tank level drops below a setpoint
EN_ControlType_EN_TIMEOFDAY
!< Act at a particular time of day
EN_ControlType_EN_TIMER
!< Act at a prescribed elapsed amount of time
EN_CountType_EN_CONTROLCOUNT
!< Number of simple controls
EN_CountType_EN_CURVECOUNT
!< Number of data curves
EN_CountType_EN_LINKCOUNT
!< Number of links (pipes + pumps + valves)
EN_CountType_EN_NODECOUNT
!< Number of nodes (junctions + tanks + reservoirs)
EN_CountType_EN_PATCOUNT
!< Number of time patterns
EN_CountType_EN_RULECOUNT
!< Number of rule-based controls
EN_CountType_EN_TANKCOUNT
!< Number of tanks and reservoirs
EN_CurveType_EN_EFFIC_CURVE
!< Pump efficiency v. flow curve
EN_CurveType_EN_GENERIC_CURVE
!< Generic curve
EN_CurveType_EN_HLOSS_CURVE
!< Valve head loss v. flow curve
EN_CurveType_EN_PUMP_CURVE
!< Pump head v. flow curve
EN_CurveType_EN_VALVE_CURVE
!< % of fully open flow v. % open
EN_CurveType_EN_VOLUME_CURVE
!< Tank volume v. depth curve
EN_DemandModel_EN_DDA
!< Demand driven analysis
EN_DemandModel_EN_PDA
!< Pressure driven analysis
EN_FALSE
EN_FlowUnits_EN_AFD
!< Acre-feet per day
EN_FlowUnits_EN_CFS
!< Cubic feet per second
EN_FlowUnits_EN_CMD
!< Cubic meters per day
EN_FlowUnits_EN_CMH
!< Cubic meters per hour
EN_FlowUnits_EN_CMS
!< Cubic meters per second
EN_FlowUnits_EN_GPM
!< Gallons per minute
EN_FlowUnits_EN_IMGD
!< Imperial million gallons per day
EN_FlowUnits_EN_LPM
!< Liters per minute
EN_FlowUnits_EN_LPS
!< Liters per second
EN_FlowUnits_EN_MGD
!< Million gallons per day
EN_FlowUnits_EN_MLD
!< Million liters per day
EN_HeadLossType_EN_CM
!< Chezy-Manning
EN_HeadLossType_EN_DW
!< Darcy-Weisbach
EN_HeadLossType_EN_HW
!< Hazen-Williams
EN_InitHydOption_EN_INITFLOW
!< Don’t save hydraulics; re-initialize flows
EN_InitHydOption_EN_NOSAVE
!< Don’t save hydraulics; don’t re-initialize flows
EN_InitHydOption_EN_SAVE
!< Save hydraulics to file, don’t re-initialize flows
EN_InitHydOption_EN_SAVE_AND_INIT
!< Save hydraulics; re-initialize flows
EN_LinkProperty_EN_DIAMETER
!< Pipe/valve diameter
EN_LinkProperty_EN_ENERGY
!< Current computed pump energy usage (read only)
EN_LinkProperty_EN_FLOW
!< Current computed flow rate (read only)
EN_LinkProperty_EN_GPV_CURVE
!< GPV head loss v. flow curve index
EN_LinkProperty_EN_HEADLOSS
!< Current computed head loss (read only)
EN_LinkProperty_EN_INITSETTING
!< Initial pump speed or valve setting
EN_LinkProperty_EN_INITSTATUS
!< Initial status (see @ref EN_LinkStatusType)
EN_LinkProperty_EN_KBULK
!< Bulk flow chemical reaction coefficient
EN_LinkProperty_EN_KWALL
!< Pipe wall chemical reaction coefficient
EN_LinkProperty_EN_LEAK_AREA
!< Pipe leak area (sq mm per 100 length units)
EN_LinkProperty_EN_LEAK_EXPAN
!< Leak expansion rate (sq mm per unit of pressure head)
EN_LinkProperty_EN_LENGTH
!< Pipe length
EN_LinkProperty_EN_LINKPATTERN
!< Pump speed time pattern index
EN_LinkProperty_EN_LINKQUAL
!< Current computed link quality (read only)
EN_LinkProperty_EN_LINK_INCONTROL
!< Is present in any simple or rule-based control (= 1) or not (= 0)
EN_LinkProperty_EN_LINK_LEAKAGE
!< Current leakage rate (read only)
EN_LinkProperty_EN_MINORLOSS
!< Pipe/valve minor loss coefficient
EN_LinkProperty_EN_PCV_CURVE
!< PCV characteristic curve index
EN_LinkProperty_EN_PUMP_ECOST
!< Pump average energy price
EN_LinkProperty_EN_PUMP_ECURVE
!< Pump efficiency v. flow curve index
EN_LinkProperty_EN_PUMP_EFFIC
!< Current computed pump efficiency (read only)
EN_LinkProperty_EN_PUMP_EPAT
!< Pump energy price time pattern index
EN_LinkProperty_EN_PUMP_HCURVE
!< Pump head v. flow curve index
EN_LinkProperty_EN_PUMP_POWER
!< Pump constant power rating
EN_LinkProperty_EN_PUMP_STATE
!< Current computed pump state (read only) (see @ref EN_PumpStateType)
EN_LinkProperty_EN_ROUGHNESS
!< Pipe roughness coefficient
EN_LinkProperty_EN_SETTING
!< Current link setting
EN_LinkProperty_EN_STATUS
!< Current link status (see @ref EN_LinkStatusType)
EN_LinkProperty_EN_VALVE_TYPE
!< Type of valve (see @ref EN_LinkType)
EN_LinkProperty_EN_VELOCITY
!< Current computed flow velocity (read only)
EN_LinkStatusType_EN_CLOSED
!< Link is closed and cannot convey any flow
EN_LinkStatusType_EN_OPEN
!< Link is open and is able to convey flow
EN_LinkType_EN_CVPIPE
!< Pipe with check valve
EN_LinkType_EN_FCV
!< Flow control valve
EN_LinkType_EN_GPV
!< General purpose valve
EN_LinkType_EN_PBV
!< Pressure breaker valve
EN_LinkType_EN_PCV
!< Positional control valve
EN_LinkType_EN_PIPE
!< Pipe
EN_LinkType_EN_PRV
!< Pressure reducing valve
EN_LinkType_EN_PSV
!< Pressure sustaining valve
EN_LinkType_EN_PUMP
!< Pump
EN_LinkType_EN_TCV
!< Throttle control valve
EN_MixingModel_EN_FIFO
!< First in, first out model
EN_MixingModel_EN_LIFO
!< Last in, first out model
EN_MixingModel_EN_MIX1
!< Complete mix model
EN_MixingModel_EN_MIX2
!< 2-compartment model
EN_NodeProperty_EN_BASEDEMAND
!< Primary demand baseline value
EN_NodeProperty_EN_CANOVERFLOW
!< EN_TRUE (= 1) if the Tank can overflow, EN_FALSE (= 0) if it cannot
EN_NodeProperty_EN_DEMAND
!< Current computed demand (read only)
EN_NodeProperty_EN_DEMANDDEFICIT
!< Amount that full demand is reduced under PDA (read only)
EN_NodeProperty_EN_DEMANDFLOW
!< Current consumer demand delivered (read only)
EN_NodeProperty_EN_ELEVATION
!< Elevation
EN_NodeProperty_EN_EMITTER
!< Emitter flow coefficient
EN_NodeProperty_EN_EMITTERFLOW
!< Current emitter flow (read only)
EN_NodeProperty_EN_FULLDEMAND
!< Current consumer demand requested (read only)
EN_NodeProperty_EN_HEAD
!< Current computed hydraulic head (read only)
EN_NodeProperty_EN_INITQUAL
!< Initial quality
EN_NodeProperty_EN_INITVOLUME
!< Tank initial volume (read only)
EN_NodeProperty_EN_LEAKAGEFLOW
!< Current leakage flow (read only)
EN_NodeProperty_EN_MAXLEVEL
!< Tank maximum level
EN_NodeProperty_EN_MAXVOLUME
!< Tank maximum volume (read only)
EN_NodeProperty_EN_MINLEVEL
!< Tank minimum level
EN_NodeProperty_EN_MINVOLUME
!< Tank minimum volume
EN_NodeProperty_EN_MIXFRACTION
!< Tank mixing fraction
EN_NodeProperty_EN_MIXMODEL
!< Tank mixing model (see @ref EN_MixingModel)
EN_NodeProperty_EN_MIXZONEVOL
!< Tank mixing zone volume (read only)
EN_NodeProperty_EN_NODE_INCONTROL
!< EN_TRUE (= 1) if the node appears in any control, EN_FALSE (= 0) if not
EN_NodeProperty_EN_PATTERN
!< Primary demand time pattern index
EN_NodeProperty_EN_PRESSURE
!< Current computed pressure (read only)
EN_NodeProperty_EN_QUALITY
!< Current computed quality (read only)
EN_NodeProperty_EN_SOURCEMASS
!< Current computed quality source mass inflow (read only)
EN_NodeProperty_EN_SOURCEPAT
!< Quality source pattern index
EN_NodeProperty_EN_SOURCEQUAL
!< Quality source strength
EN_NodeProperty_EN_SOURCETYPE
!< Quality source type (see @ref EN_SourceType)
EN_NodeProperty_EN_TANKDIAM
!< Tank diameter
EN_NodeProperty_EN_TANKLEVEL
!< Current computed tank water level (read only)
EN_NodeProperty_EN_TANKVOLUME
!< Current computed tank volume (read only)
EN_NodeProperty_EN_TANK_KBULK
!< Tank bulk decay coefficient
EN_NodeProperty_EN_VOLCURVE
!< Tank volume curve index
EN_NodeType_EN_JUNCTION
!< Junction node
EN_NodeType_EN_RESERVOIR
!< Reservoir node
EN_NodeType_EN_TANK
!< Storage tank node
EN_ObjectType_EN_CONTROL
!< Simple controls
EN_ObjectType_EN_CURVE
!< Data curves
EN_ObjectType_EN_LINK
!< Links
EN_ObjectType_EN_NODE
!< Nodes
EN_ObjectType_EN_RULE
!< Control rules
EN_ObjectType_EN_TIMEPAT
!< Time patterns
EN_Option_EN_ACCURACY
!< Total normalized flow change for hydraulic convergence
EN_Option_EN_BULKORDER
!< Bulk water reaction order for pipes
EN_Option_EN_CHECKFREQ
!< Frequency of hydraulic status checks
EN_Option_EN_CONCENLIMIT
!< Limiting concentration for growth reactions
EN_Option_EN_DAMPLIMIT
!< Accuracy level where solution damping begins
EN_Option_EN_DEMANDCHARGE
!< Energy charge per max. KW usage
EN_Option_EN_DEMANDMULT
!< Global demand multiplier
EN_Option_EN_DEMANDPATTERN
!< Name of default demand pattern
EN_Option_EN_EMITBACKFLOW
!< EN_TRUE (= 1) if emitters can backflow, EN_FALSE (= 0) if not
EN_Option_EN_EMITEXPON
!< Exponent in emitter discharge formula
EN_Option_EN_FLOWCHANGE
!< Maximum flow change for hydraulic convergence
EN_Option_EN_GLOBALEFFIC
!< Global pump efficiency (percent)
EN_Option_EN_GLOBALPATTERN
!< Index of a global energy price pattern
EN_Option_EN_GLOBALPRICE
!< Global energy price per KWH
EN_Option_EN_HEADERROR
!< Maximum head loss error for hydraulic convergence
EN_Option_EN_HEADLOSSFORM
!< Head loss formula (see @ref EN_HeadLossType)
EN_Option_EN_MAXCHECK
!< Maximum trials for status checking
EN_Option_EN_PRESS_UNITS
!< Pressure units (see @ref EN_PressUnits)
EN_Option_EN_SP_DIFFUS
!< Specific diffusivity (relative to chlorine at 20 deg C)
EN_Option_EN_SP_GRAVITY
!< Specific gravity
EN_Option_EN_SP_VISCOS
!< Specific viscosity (relative to water at 20 deg C)
EN_Option_EN_STATUS_REPORT
!< Type of status report to produce (see @ref EN_StatusReport)
EN_Option_EN_TANKORDER
!< Bulk water reaction order for tanks
EN_Option_EN_TOLERANCE
!< Water quality tolerance
EN_Option_EN_TRIALS
!< Maximum trials allowed for hydraulic convergence
EN_Option_EN_UNBALANCED
!< Extra trials allowed if hydraulics don’t converge
EN_Option_EN_WALLORDER
!< Wall reaction order for pipes (either 0 or 1)
EN_PressUnits_EN_BAR
!< Bar
EN_PressUnits_EN_FEET
!< Feet
EN_PressUnits_EN_KPA
!< Kilopascals
EN_PressUnits_EN_METERS
!< Meters
EN_PressUnits_EN_PSI
!< Pounds per square inch
EN_PumpStateType_EN_PUMP_CLOSED
!< Pump closed
EN_PumpStateType_EN_PUMP_OPEN
!< Pump open
EN_PumpStateType_EN_PUMP_XFLOW
!< Pump open - cannot supply flow
EN_PumpStateType_EN_PUMP_XHEAD
!< Pump closed - cannot supply head
EN_PumpType_EN_CONST_HP
!< Constant horsepower
EN_PumpType_EN_CUSTOM
!< User-defined custom curve
EN_PumpType_EN_NOCURVE
!< No curve
EN_PumpType_EN_POWER_FUNC
!< Power function
EN_QualityType_EN_AGE
!< Water age analysis
EN_QualityType_EN_CHEM
!< Chemical fate and transport
EN_QualityType_EN_NONE
!< No quality analysis
EN_QualityType_EN_TRACE
!< Source tracing analysis
EN_RuleObject_EN_R_LINK
!< Clause refers to a link
EN_RuleObject_EN_R_NODE
!< Clause refers to a node
EN_RuleObject_EN_R_SYSTEM
!< Clause refers to a system parameter (e.g., time)
EN_RuleOperator_EN_R_ABOVE
!< Is above
EN_RuleOperator_EN_R_BELOW
!< Is below
EN_RuleOperator_EN_R_EQ
!< Equal to
EN_RuleOperator_EN_R_GE
!< Greater than or equal to
EN_RuleOperator_EN_R_GT
!< Greater than
EN_RuleOperator_EN_R_IS
!< Is equal to
EN_RuleOperator_EN_R_LE
!< Less than or equal to
EN_RuleOperator_EN_R_LT
!< Less than
EN_RuleOperator_EN_R_NE
!< Not equal
EN_RuleOperator_EN_R_NOT
!< Is not equal to
EN_RuleStatus_EN_R_IS_ACTIVE
!< Control valve is active
EN_RuleStatus_EN_R_IS_CLOSED
!< Link is closed
EN_RuleStatus_EN_R_IS_OPEN
!< Link is open
EN_RuleVariable_EN_R_CLOCKTIME
!< Time of day
EN_RuleVariable_EN_R_DEMAND
!< Nodal demand
EN_RuleVariable_EN_R_DRAINTIME
!< Time to drain a tank
EN_RuleVariable_EN_R_FILLTIME
!< Time to fill a tank
EN_RuleVariable_EN_R_FLOW
!< Link flow rate
EN_RuleVariable_EN_R_GRADE
!< Nodal hydraulic grade
EN_RuleVariable_EN_R_HEAD
!< Nodal hydraulic head
EN_RuleVariable_EN_R_LEVEL
!< Tank water level
EN_RuleVariable_EN_R_POWER
!< Pump power output
EN_RuleVariable_EN_R_PRESSURE
!< Nodal pressure
EN_RuleVariable_EN_R_SETTING
!< Link setting
EN_RuleVariable_EN_R_STATUS
!< Link status
EN_RuleVariable_EN_R_TIME
!< Elapsed simulation time
EN_SizeLimits_EN_MAXID
!< Max. # characters in ID name
EN_SizeLimits_EN_MAXMSG
!< Max. # characters in message text
EN_SourceType_EN_CONCEN
!< Sets the concentration of external inflow entering a node
EN_SourceType_EN_FLOWPACED
!< Adds a given value to the concentration leaving a node
EN_SourceType_EN_MASS
!< Injects a given mass/minute into a node
EN_SourceType_EN_SETPOINT
!< Sets the concentration leaving a node to a given value
EN_StatisticType_EN_AVERAGE
!< Report average value over simulation period
EN_StatisticType_EN_MAXIMUM
!< Report maximum value over simulation period
EN_StatisticType_EN_MINIMUM
!< Report minimum value over simulation period
EN_StatisticType_EN_RANGE
!< Report maximum - minimum over simulation period
EN_StatisticType_EN_SERIES
!< Report all time series points
EN_StatusReport_EN_FULL_REPORT
!< Full level of status reporting
EN_StatusReport_EN_NORMAL_REPORT
!< Normal level of status reporting
EN_StatusReport_EN_NO_REPORT
!< No status reporting
EN_TRUE
EN_TimeParameter_EN_DURATION
!< Total simulation duration
EN_TimeParameter_EN_HALTFLAG
!< Flag indicating if the simulation was halted (read only)
EN_TimeParameter_EN_HTIME
!< Elapsed time of current hydraulic solution (read only)
EN_TimeParameter_EN_HYDSTEP
!< Hydraulic time step
EN_TimeParameter_EN_NEXTEVENT
!< Shortest time until a tank becomes empty or full (read only)
EN_TimeParameter_EN_NEXTEVENTTANK
!< Index of tank with shortest time to become empty or full (read only)
EN_TimeParameter_EN_PATTERNSTART
!< Time when time patterns begin
EN_TimeParameter_EN_PATTERNSTEP
!< Time pattern period
EN_TimeParameter_EN_PERIODS
!< Number of reporting time periods (read only)
EN_TimeParameter_EN_QTIME
!< Elapsed time of current quality solution (read only)
EN_TimeParameter_EN_QUALSTEP
!< Water quality time step
EN_TimeParameter_EN_REPORTSTART
!< Time when reporting starts
EN_TimeParameter_EN_REPORTSTEP
!< Reporting time step
EN_TimeParameter_EN_RULESTEP
!< Rule-based control evaluation time step
EN_TimeParameter_EN_STARTTIME
!< Simulation starting time of day
EN_TimeParameter_EN_STATISTIC
!< Reporting statistic code (see @ref EN_StatisticType)
EN_TimestepEvent_EN_STEP_CONTROLEVENT
!< A link control needs to be activated
EN_TimestepEvent_EN_STEP_HYD
!< A hydraulic time step has ended
EN_TimestepEvent_EN_STEP_REPORT
!< A reporting time step has ended
EN_TimestepEvent_EN_STEP_TANKEVENT
!< A tank has become empty or full
EN_TimestepEvent_EN_STEP_WQ
!< A water quality time step has ended

Functions§

EN_addcontrol
@brief Adds a new simple control to a project. @param ph an EPANET project handle. @param type the type of control to add (see @ref EN_ControlType). @param linkIndex the index of a link to control (starting from 1). @param setting control setting applied to the link. @param nodeIndex index of the node used to control the link (0 for EN_TIMER and EN_TIMEOFDAY controls). @param level action level (tank level, junction pressure, or time in seconds) that triggers the control. @param[out] out_index index of the new control. @return an error code.
EN_addcurve
@brief Adds a new data curve to a project. @param ph an EPANET project handle. @param id The ID name of the curve to be added. @return an error code.
EN_adddemand
@brief appends a new demand to a junction node demands list. @param ph an EPANET project handle. @param nodeIndex the index of a node (starting from 1). @param baseDemand the demand’s base value. @param demandPattern the name of a time pattern used by the demand @param demandName the name of the demand’s category @return an error code.
EN_addlink
@brief Adds a new link to a project. @param ph an EPANET project handle. @param id the ID name of the link to be added. @param linkType The type of link being added (see @ref EN_LinkType) @param fromNode The ID name of the link’s starting node. @param toNode The ID name of the link’s ending node. @param[out] out_index the index of the newly added link. @return an error code.
EN_addnode
@brief Adds a new node to a project. @param ph an EPANET project handle. @param id the ID name of the node to be added. @param nodeType the type of node being added (see @ref EN_NodeType) @param[out] out_index the index of the newly added node @return an error code.
EN_addpattern
@brief Adds a new time pattern to a project. @param ph an EPANET project handle. @param id the ID name of the pattern to add. @return an error code.
EN_addrule
@brief Adds a new rule-based control to a project. @param ph an EPANET project handle. @param rule text of the rule following the format used in an EPANET input file. @return an error code.
EN_clearreport
@brief Clears the contents of a project’s report file. @param ph an EPANET project handle. @return an error code.
EN_close
@brief Closes a project and frees all of its memory. @param ph an EPANET project handle. @return an error code
EN_closeH
@brief Closes the hydraulic solver freeing all of its allocated memory. @return an error code.
EN_closeQ
@brief Closes the water quality solver, freeing all of its allocated memory. @param ph an EPANET project handle. @return an error code.
EN_copyreport
@brief Copies the current contents of a project’s report file to another file. @param ph an EPANET project handle. @param filename the full path name of the destination file. @return an error code.
EN_createproject
@brief Creates an EPANET project. @param[out] ph an EPANET project handle that is passed into all other API functions. @return an error code.
EN_deletecontrol
@brief Deletes an existing simple control. @param ph an EPANET project handle. @param index the index of the control to delete (starting from 1). @return an error code.
EN_deletecurve
@brief Deletes a data curve from a project. @param ph an EPANET project handle. @param index the data curve’s index (starting from 1). @return an error code.
EN_deletedemand
@brief deletes a demand from a junction node. @param ph an EPANET project handle. @param nodeIndex the index of a node (starting from 1). @param demandIndex the position of the demand in the node’s demands list (starting from 1). @return an error code.
EN_deletelink
@brief Deletes a link from the project. @param ph an EPANET project handle. @param index the index of the link to be deleted. @param actionCode The action taken if any control contains the link. @return an error code.
EN_deletenode
@brief Deletes a node from a project. @param ph an EPANET project handle. @param index the index of the node to be deleted. @param actionCode the action taken if any control contains the node and its links. @return an error code.
EN_deletepattern
@brief Deletes a time pattern from a project. @param ph an EPANET project handle. @param index the time pattern’s index (starting from 1). @return an error code.
EN_deleteproject
@brief Deletes a currently opened EPANET project. @param[in,out] ph an EPANET project handle which is returned as NULL. @return an error code.
EN_deleterule
@brief Deletes an existing rule-based control. @param ph an EPANET project handle. @param index the index of the rule to be deleted (starting from 1). @return an error code.
EN_getaveragepatternvalue
@brief Retrieves the average of all pattern factors in a time pattern. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param[out] out_value The average of all of the time pattern’s factors. @return an error code.
EN_getbasedemand
@brief Gets the base demand for one of a node’s demand categories. @param ph an EPANET project handle. @param nodeIndex a node’s index (starting from 1). @param demandIndex the index of a demand category for the node (starting from 1). @param[out] out_baseDemand the category’s base demand. @return an error code.
EN_getcomment
@brief Retrieves a descriptive comment assigned to a Node, Link, Pattern or Curve. @param ph an EPANET project handle. @param object a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE) @param index the object’s index starting from 1 @param[out] out_comment the comment string assigned to the object @return an error code
EN_getcontrol
@brief Retrieves the properties of a simple control. @param ph an EPANET project handle. @param index the control’s index (starting from 1). @param[out] out_type the type of control (see @ref EN_ControlType). @param[out] out_linkIndex the index of the link being controlled. @param[out] out_setting the control setting applied to the link. @param[out] out_nodeIndex the index of the node used to trigger the control (0 for EN_TIMER and EN_TIMEOFDAY controls). @param[out] out_level the action level (tank level, junction pressure, or time in seconds) that triggers the control. @return an error code.
EN_getcontrolenabled
@brief Gets the enabled status of a simple control. @param ph an EPANET project handle. @param index the control’s index (starting from 1). @param out_enabled EN_TRUE (= 1) if the control is enabled or EN_FALSE (= 0) if it is disabled. @return an error code.
EN_getcoord
@brief Gets the (x,y) coordinates of a node. @param ph an EPANET project handle. @param index a node index (starting from 1). @param[out] out_x the node’s X-coordinate value. @param[out] out_y the node’s Y-coordinate value. @return an error code.
EN_getcount
@brief Retrieves the number of objects of a given type in a project. @param ph an EPANET project handle. @param object a type of object to count (see @ref EN_CountType) @param[out] out_count number of objects of the specified type @return an error code
EN_getcurve
@brief Retrieves all of a curve’s data. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param[out] out_id the curve’s ID name. @param[out] out_nPoints the number of data points on the curve. @param[out] out_xValues the curve’s x-values. @param[out] out_yValues the curve’s y-values. @return an error code.
EN_getcurveid
@brief Retrieves the ID name of a curve given its index. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param[out] out_id the curve’s ID name. @return an error code.
EN_getcurveindex
@brief Retrieves the index of a curve given its ID name. @param ph an EPANET project handle. @param id the ID name of a curve. @param[out] out_index The curve’s index (starting from 1). @return an error code.
EN_getcurvelen
@brief Retrieves the number of points in a curve. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param[out] out_len The number of data points assigned to the curve. @return an error code.
EN_getcurvetype
@brief Retrieves a curve’s type. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param[out] out_type the curve’s type (see @ref EN_CurveType). @return an error code.
EN_getcurvevalue
@brief Retrieves the value of a single data point for a curve. @param ph an EPANET project handle. @param curveIndex a curve’s index (starting from 1). @param pointIndex the index of a point on the curve (starting from 1). @param[out] out_x the point’s x-value. @param[out] out_y the point’s y-value. @return an error code.
EN_getdemandindex
@brief Retrieves the index of a node’s named demand category @param ph an EPANET project handle. @param nodeIndex the index of a node (starting from 1) @param demandName the name of a demand category for the node @param[out] out_demandIndex the index of the demand being sought @return an error code
EN_getdemandmodel
@brief Retrieves the type of demand model in use and its parameters. @param ph an EPANET project handle. @param[out] out_type Type of demand model (see @ref EN_DemandModel). @param[out] out_pmin Pressure below which there is no demand. @param[out] out_preq Pressure required to deliver full demand. @param[out] out_pexp Pressure exponent in demand function. @return an error code.
EN_getdemandname
@brief Retrieves the name of a node’s demand category. @param ph an EPANET project handle. @param nodeIndex a node’s index (starting from 1). @param demandIndex the index of one of the node’s demand categories (starting from 1). @param[out] out_demandName The name of the selected category. @return an error code.
EN_getdemandpattern
@brief Retrieves the index of a time pattern assigned to one of a node’s demand categories. @param ph an EPANET project handle. @param nodeIndex the node’s index (starting from 1). @param demandIndex the index of a demand category for the node (starting from 1). @param[out] out_patIndex the index of the category’s time pattern. @return an error code.
EN_getelseaction
@brief Gets the properties of an ELSE action in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param actionIndex the index of the ELSE action to retrieve (starting from 1). @param[out] out_linkIndex the index of the link in the action. @param[out] out_status the status assigned to the link (see @ref EN_RuleStatus). @param[out] out_setting the value assigned to the link’s setting. @return an error code.
EN_geterror
@brief Returns the text of an error message generated by an error code. @param errcode an error code. @param[out] out_errmsg the error message generated by the error code @param maxLen maximum number of characters that errmsg can hold @return an error code
EN_getflowunits
@brief Retrieves a project’s flow units. @param ph an EPANET project handle. @param[out] out_units a flow units code (see @ref EN_FlowUnits) @return an error code.
EN_getheadcurveindex
@brief Retrieves the curve assigned to a pump’s head curve. @param ph an EPANET project handle. @param linkIndex the index of a pump link (starting from 1). @param[out] out_curveIndex the index of the curve assigned to the pump’s head curve. @return an error code.
EN_getlinkid
@brief Gets the ID name of a link given its index. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param[out] out_id The link’s ID name. @return an error code.
EN_getlinkindex
@brief Gets the index of a link given its ID name. @param ph an EPANET project handle. @param id a link’s ID name. @param[out] out_index the link’s index (starting from 1). @return an error code.
EN_getlinknodes
@brief Gets the indexes of a link’s start- and end-nodes. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param[out] out_node1 the index of the link’s start node (starting from 1). @param[out] out_node2 the index of the link’s end node (starting from 1). @return an error code.
EN_getlinktype
@brief Retrieves a link’s type. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param[out] out_linkType the link’s type (see @ref EN_LinkType). @return an error code.
EN_getlinkvalue
@brief Retrieves a property value for a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param property the property to retrieve (see @ref EN_LinkProperty). @param[out] out_value the current value of the property. @return an error code.
EN_getlinkvalues
@brief Retrieves an array of property values for all links. @param ph an EPANET project handle. @param property the property to retrieve (see @ref EN_LinkProperty). @param[out] out_values an array of values for all links. @return an error code.
EN_getnodeid
@brief Gets the ID name of a node given its index. @param ph an EPANET project handle. @param index a node’s index (starting from 1). @param[out] out_id the node’s ID name. @return an error code
EN_getnodeindex
@brief Gets the index of a node given its ID name. @param ph an EPANET project handle. @param id a node ID name. @param[out] out_index the node’s index (starting from 1). @return an error code
EN_getnodetype
@brief Retrieves a node’s type given its index. @param ph an EPANET project handle. @param index a node’s index (starting from 1). @param[out] out_nodeType the node’s type (see @ref EN_NodeType). @return an error code.
EN_getnodevalue
@brief Retrieves a property value for a node. @param ph an EPANET project handle. @param index a node’s index. @param property the property to retrieve (see @ref EN_NodeProperty). @param[out] out_value the current value of the property. @return an error code.
EN_getnodevalues
@brief Retrieves an array of property values for all nodes. @param ph an EPANET project handle. @param property the property to retrieve (see @ref EN_NodeProperty). @param[out] out_values an array of values for all nodes. @return an error code.
EN_getnumdemands
@brief Retrieves the number of demand categories for a junction node. @param ph an EPANET project handle. @param nodeIndex the index of a node (starting from 1). @param[out] out_numDemands the number of demand categories assigned to the node. @return an error code.
EN_getoption
@brief Retrieves the value of an analysis option. @param ph an EPANET project handle. @param option a type of analysis option (see @ref EN_Option). @param[out] out_value the current value of the option. @return an error code
EN_getpatternid
@brief Retrieves the ID name of a time pattern given its index. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param[out] out_id the time pattern’s ID name. @return an error code.
EN_getpatternindex
@brief Retrieves the index of a time pattern given its ID name. @param ph an EPANET project handle. @param id the ID name of a time pattern. @param[out] out_index the time pattern’s index (starting from 1). @return an error code.
EN_getpatternlen
@brief Retrieves the number of time periods in a time pattern. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param[out] out_len the number of time periods in the pattern. @return an error code.
EN_getpatternvalue
@brief Retrieves a time pattern’s factor for a given time period. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param period a time period in the pattern (starting from 1). @param[out] out_value the pattern factor for the given time period. @return an error code.
EN_getpremise
@brief Gets the properties of a premise in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param premiseIndex the position of the premise in the rule’s list of premises (starting from 1). @param[out] out_logop the premise’s logical operator (IF = 1, AND = 2, OR = 3` ). @param[out] out_object the type of object the premise refers to (see @ref EN_RuleObject). @param[out] out_objIndex the index of the object (e.g. the index of a tank). @param[out] out_variable the object’s variable being compared (see @ref EN_RuleVariable). @param[out] out_relop the premise’s comparison operator (see @ref EN_RuleOperator). @param[out] out_status the status that the object’s status is compared to (see @ref EN_RuleStatus). @param[out] out_value the value that the object’s variable is compared to. @return an error code.
EN_getpumptype
@brief Retrieves the type of head curve used by a pump. @param ph an EPANET project handle. @param linkIndex the index of a pump link (starting from 1). @param[out] out_pumpType the type of head curve used by the pump (see @ref EN_PumpType). @return an error code.
EN_getqualinfo
@brief Gets information about the type of water quality analysis requested. @param ph an EPANET project handle. @param[out] out_qualType type of analysis to run (see @ref EN_QualityType). @param[out] out_chemName name of chemical constituent. @param[out] out_chemUnits concentration units of the constituent. @param[out] out_traceNode index of the node being traced (if applicable). @return an error code.
EN_getqualtype
@brief Retrieves the type of water quality analysis to be run. @param ph an EPANET project handle. @param[out] out_qualType the type of analysis to run (see @ref EN_QualityType). @param[out] out_traceNode the index of node being traced if out_qualType = EN_TRACE. @return an error code.
EN_getresultindex
@brief Retrieves the order in which a node or link appears in an @ref OutFile “output file”. @param ph an EPANET project handle. @param type a type of element (either @ref EN_NODE or @ref EN_LINK). @param index the element’s current index (starting from 1). @param[out] out_value the order in which the element’s results were written to file. @return an error code.
EN_getrule
@brief Retrieves summary information about a rule-based control. @param ph an EPANET project handle. @param index the rule’s index (starting from 1). @param[out] out_nPremises number of premises in the rule’s IF section. @param[out] out_nThenActions number of actions in the rule’s THEN section. @param[out] out_nElseActions number of actions in the rule’s ELSE section. @param[out] out_priority the rule’s priority value. @return an error code.
EN_getruleID
@brief Gets the ID name of a rule-based control given its index. @param ph an EPANET project handle. @param index the rule’s index (starting from 1). @param[out] out_id the rule’s ID name. @return an error code.
EN_getruleenabled
@brief Gets the enabled status of a rule-based control. @param ph an EPANET project handle. @param index the rule’s index (starting from 1). @param out_enabled the rule will be either EN_TRUE=enabled or EN_FALSE=disabled. @return an error code.
EN_getstatistic
@brief Retrieves a particular simulation statistic. @param ph an EPANET project handle. @param type the type of statistic to retrieve (see @ref EN_AnalysisStatistic). @param[out] out_value the value of the statistic. @return an error code
EN_gettag
@brief Retrieves a tag string assigned to a Node or Link. @param ph an EPANET project handle. @param object a type of object (either EN_NODE or EN_LINK) @param index the object’s index starting from 1 @param[out] out_tag the tag string assigned to the object @return an error code
EN_getthenaction
@brief Gets the properties of a THEN action in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param actionIndex the index of the THEN action to retrieve (starting from 1). @param[out] out_linkIndex the index of the link in the action (starting from 1). @param[out] out_status the status assigned to the link (see @ref EN_RuleStatus) @param[out] out_setting the value assigned to the link’s setting. @return an error code.
EN_gettimeparam
@brief Retrieves the value of a time parameter. @param ph an EPANET project handle. @param param a time parameter code (see @ref EN_TimeParameter). @param[out] out_value the current value of the time parameter (in seconds). @return an error code.
EN_gettitle
@brief Retrieves the title lines of the project @param ph an EPANET project handle. @param[out] out_line1 first title line @param[out] out_line2 second title line @param[out] out_line3 third title line @return an error code
EN_getversion
@brief Retrieves the toolkit API version number. @param[out] out_version the version of the OWA-EPANET toolkit. @return an error code.
EN_getvertex
@brief Retrieves the coordinates of a vertex point assigned to a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param vertex a vertex point index (starting from 1). @param[out] out_x the vertex’s X-coordinate value. @param[out] out_y the vertex’s Y-coordinate value. @return an error code.
EN_getvertexcount
@brief Retrieves the number of internal vertex points assigned to a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param[out] out_count the number of vertex points that describe the link’s shape. @return an error code.
EN_init
@brief Initializes an EPANET project. @param ph an EPANET project handle. @param rptFile the name of a report file to be created (or “” if not needed). @param outFile the name of a binary output file to be created (or “” if not needed). @param unitsType the choice of flow units (see @ref EN_FlowUnits). @param headLossType the choice of head loss formula (see @ref EN_HeadLossType). @return an error code.
EN_initH
@brief Initializes a network prior to running a hydraulic analysis. @param ph an EPANET project handle. @param initFlag a 2-digit initialization flag (see @ref EN_InitHydOption). @return an error code.
EN_initQ
@brief Initializes a network prior to running a water quality analysis. @param ph an EPANET project handle. @param saveFlag set to EN_SAVE (1) if results are to be saved to the project’s binary output file, or to EN_NOSAVE (0) if not. @return an error code.
EN_loadpatternfile
@brief Loads time patterns from a file into a project under a specific pattern ID. @param ph an EPANET project handle. @param filename the name of the file containing pattern data. @param id the ID name of the new pattern to load. @return an error code.
EN_nextH
@brief Determines the length of time until the next hydraulic event occurs in an extended period simulation. @param ph an EPANET project handle. @param[out] out_tStep the time (in seconds) until the next hydraulic event or 0 if at the end of the full simulation duration. @return an error code.
EN_nextQ
@brief Advances a water quality simulation over the time until the next hydraulic event. @param ph an EPANET project handle. @param[out] out_tStep time (in seconds) until the next hydraulic event or 0 if at the end of the full simulation duration. @return an error code.
EN_open
@brief Reads an EPANET input file with no errors allowed. @param ph an EPANET project handle. @param inpFile the name of an existing EPANET-formatted input file. @param rptFile the name of a report file to be created (or “” if not needed). @param outFile the name of a binary output file to be created (or “” if not needed). @return an error code.
EN_openH
@brief Opens a project’s hydraulic solver. @param ph an EPANET project handle. @return an error code.
EN_openQ
@brief Opens a project’s water quality solver. @param ph an EPANET project handle. @return an error code.
EN_openX
@brief Reads an EPANET input file with errors allowed. @param ph an EPANET project handle. @param inpFile the name of an existing EPANET-formatted input file. @param rptFile the name of a report file to be created (or “” if not needed). @param outFile the name of a binary output file to be created (or “” if not needed). @return an error code.
EN_report
@brief Writes simulation results in a tabular format to a project’s report file. @param ph an EPANET project handle. @return an error code
EN_resetreport
@brief Resets a project’s report options to their default values. @param ph an EPANET project handle. @return an error code
EN_runH
@brief Computes a hydraulic solution for the current point in time. @param ph an EPANET project handle. @param[out] out_currentTime the current simulation time in seconds. @return an error or warning code.
EN_runQ
@brief Makes hydraulic and water quality results at the start of the current time period available to a project’s water quality solver. @param ph an EPANET project handle. @param[out] out_currentTime current simulation time in seconds. @return an error code.
EN_runproject
@brief Runs a complete EPANET simulation. @param ph an EPANET project handle. @param inpFile the name of an existing EPANET-formatted input file. @param rptFile the name of a report file to be created (or “” if not needed) @param outFile the name of a binary output file to be created (or “” if not needed) @param pviewprog a callback function that takes a character string (char *) as its only parameter. @return an error code
EN_saveH
@brief Transfers a project’s hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals. @param ph an EPANET project handle. @return an error code.
EN_savehydfile
@brief Saves a project’s temporary hydraulics file to disk. @param ph an EPANET project handle. @param filename the name of the file to be created. @return an error code.
EN_saveinpfile
@brief Saves a project’s data to an EPANET-formatted text file. @param ph an EPANET project handle. @param filename the name of the file to create. @return an error code
EN_setbasedemand
@brief Sets the base demand for one of a node’s demand categories. @param ph an EPANET project handle. @param nodeIndex a node’s index (starting from 1). @param demandIndex the index of a demand category for the node (starting from 1). @param baseDemand the new base demand for the category. @return an error code.
EN_setcomment
@brief Assigns a descriptive comment to a Node, Link, Pattern or Curve. @param ph an EPANET project handle. @param object a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE) @param index the object’s index starting from 1 @param comment the comment string assigned to the object @return an error code
EN_setcontrol
@brief Sets the properties of an existing simple control. @param ph an EPANET project handle. @param index the control’s index (starting from 1). @param type the type of control (see @ref EN_ControlType). @param linkIndex the index of the link being controlled. @param setting the control setting applied to the link. @param nodeIndex the index of the node used to trigger the control (0 for EN_TIMER and EN_TIMEOFDAY controls). @param level the action level (tank level, junction pressure, or time in seconds) that triggers the control. @return an error code.
EN_setcontrolenabled
@brief Sets the enabled status of a simple control. @param ph an EPANET project handle. @param index the control’s index (starting from 1). @param enabled EN_TRUE (= 1) sets the control to enabled, EN_FALSE (= 0) sets it to disabled. @return an error code.
EN_setcoord
@brief Sets the (x,y) coordinates of a node. @param ph an EPANET project handle. @param index a node index (starting from 1). @param x the node’s X-coordinate value. @param y the node’s Y-coordinate value. @return an error code.
EN_setcurve
@brief assigns a set of data points to a curve. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param xValues an array of new x-values for the curve. @param yValues an array of new y-values for the curve. @param nPoints the new number of data points for the curve. @return an error code.
EN_setcurveid
@brief Changes the ID name of a data curve given its index. @param ph an EPANET project handle. @param index a data curve index (starting from 1). @param id the data curve’s new ID name. @return an error code.
EN_setcurvetype
@brief Sets a curve’s type. @param ph an EPANET project handle. @param index a curve’s index (starting from 1). @param type the curve’s type (see @ref EN_CurveType). @return an error code.
EN_setcurvevalue
@brief Sets the value of a single data point for a curve. @param ph an EPANET project handle. @param curveIndex a curve’s index (starting from 1). @param pointIndex the index of a point on the curve (starting from 1). @param x the point’s new x-value. @param y the point’s new y-value. @return an error code.
EN_setdemandmodel
@brief Sets the type of demand model to use and its parameters. @param ph an EPANET project handle. @param type Type of demand model (see @ref EN_DemandModel). @param pmin Pressure below which there is no demand. @param preq Pressure required to deliver full demand. @param pexp Pressure exponent in demand function. @return an error code.
EN_setdemandname
@brief Assigns a name to a node’s demand category. @param ph an EPANET project handle. @param nodeIndex a node’s index (starting from 1). @param demandIdx the index of one of the node’s demand categories (starting from 1). @param demandName the new name assigned to the category. @return an error code.
EN_setdemandpattern
@brief Sets the index of a time pattern used for one of a node’s demand categories. @param ph an EPANET project handle. @param nodeIndex a node’s index (starting from 1). @param demandIndex the index of one of the node’s demand categories (starting from 1). @param patIndex the index of the time pattern assigned to the category. @return an error code.
EN_setelseaction
@brief Sets the properties of an ELSE action in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param actionIndex the index of the ELSE action being modified (starting from 1). @param linkIndex the index of the link in the action (starting from 1). @param status the new status assigned to the link (see @ref EN_RuleStatus) @param setting the new value assigned to the link’s setting. @return an error code.
EN_setflowunits
@brief Sets a project’s flow units. @param ph an EPANET project handle. @param units a flow units code (see @ref EN_FlowUnits) @return an error code.
EN_setheadcurveindex
@brief Assigns a curve to a pump’s head curve. @param ph an EPANET project handle. @param linkIndex the index of a pump link (starting from 1). @param curveIndex the index of a curve to be assigned as the pump’s head curve. @return an error code.
EN_setjuncdata
@brief Sets a group of properties for a junction node. @param ph an EPANET project handle. @param index a junction node’s index (starting from 1). @param elev the value of the junction’s elevation. @param dmnd the value of the junction’s primary base demand. @param dmndpat the ID name of the demand’s time pattern (“” for no pattern) @return an error code.
EN_setlinkid
@brief Changes the ID name of a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param newid the new ID name for the link. @return an error code.
EN_setlinknodes
@brief Sets the indexes of a link’s start- and end-nodes. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param node1 The index of the link’s start node (starting from 1). @param node2 The index of the link’s end node (starting from 1). @return an error code.
EN_setlinktype
@brief Changes a link’s type. @param ph an EPANET project handle. @param[in,out] inout_index the link’s index before [in] and after [out] the type change. @param linkType the new type to change the link to (see @ref EN_LinkType). @param actionCode the action taken if any controls contain the link. @return an error code.
EN_setlinkvalue
@brief Sets a property value for a link. @param ph an EPANET project handle. @param index a link’s index. @param property the property to set (see @ref EN_LinkProperty). @param value the new value for the property. @return an error code.
EN_setnodeid
@brief Changes the ID name of a node. @param ph an EPANET project handle. @param index a node’s index (starting from 1). @param newid the new ID name for the node. @return an error code.
EN_setnodevalue
@brief Sets a property value for a node. @param ph an EPANET project handle. @param index a node’s index (starting from 1). @param property the property to set (see @ref EN_NodeProperty). @param value the new value for the property. @return an error code.
EN_setoption
@brief Sets the value for an analysis option. @param ph an EPANET project handle. @param option a type of analysis option (see @ref EN_Option). @param value the new value assigned to the option. @return an error code. @see EN_Option
EN_setpattern
@brief Sets the pattern factors for a given time pattern. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param values an array of new pattern factor values. @param len the number of factor values supplied. @return an error code.
EN_setpatternid
@brief Changes the ID name of a time pattern given its index. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param id the time pattern’s new ID name. @return an error code.
EN_setpatternvalue
@brief Sets a time pattern’s factor for a given time period. @param ph an EPANET project handle. @param index a time pattern index (starting from 1). @param period a time period in the pattern (starting from 1). @param value the new value of the pattern factor for the given time period. @return an error code.
EN_setpipedata
@brief Sets a group of properties for a pipe link. @param ph an EPANET project handle. @param index the index of a pipe link (starting from 1). @param length the pipe’s length. @param diam the pipe’s diameter. @param rough the pipe’s roughness coefficient. @param mloss the pipe’s minor loss coefficient. @return an error code.
EN_setpremise
@brief Sets the properties of a premise in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param premiseIndex the position of the premise in the rule’s list of premises. @param logop the premise’s logical operator (IF = 1, AND = 2, OR = 3 ). @param object the type of object the premise refers to (see @ref EN_RuleObject). @param objIndex the index of the object (e.g. the index of a tank). @param variable the object’s variable being compared (see @ref EN_RuleVariable). @param relop the premise’s comparison operator (see @ref EN_RuleOperator). @param status the status that the object’s status is compared to (see @ref EN_RuleStatus). @param value the value that the object’s variable is compared to. @return an error code.
EN_setpremiseindex
@brief Sets the index of an object in a premise of a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param premiseIndex the premise’s index (starting from 1). @param objIndex the index of the premise’s object (e.g. the index of a tank). @return an error code.
EN_setpremisestatus
@brief Sets the status being compared to in a premise of a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param premiseIndex the premise’s index (starting from 1). @param status the status that the premise’s object status is compared to (see @ref EN_RuleStatus). @return an error code.
EN_setpremisevalue
@brief Sets the value in a premise of a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (staring from 1). @param premiseIndex the premise’s index (starting from 1). @param value The value that the premise’s variable is compared to. @return an error code.
EN_setqualtype
@brief Sets the type of water quality analysis to run. @param ph an EPANET project handle. @param qualType the type of analysis to run (see @ref EN_QualityType). @param chemName the name of the quality constituent. @param chemUnits the concentration units of the constituent. @param traceNode the ID name of the node being traced if qualType = EN_TRACE. @return an error code.
EN_setreport
@brief Processes a reporting format command. @param ph an EPANET project handle. @param format a report formatting command. @return an error code
EN_setreportcallback
@brief Sets a user-supplied callback function for reporting @param ph an EPANET project handle. @param callback a function pointer used for reporting. @return an error code.
EN_setreportcallbackuserdata
@brief Sets a pointer to a client-side data object @param ph an EPANET project handle. @param userData a pointer to a client-side data object. @return an error code.
EN_setruleenabled
@brief Sets the enabled status of a rule-based control. @param ph an EPANET project handle. @param index the rule’s index (starting from 1). @param enabled set the rule to either EN_TRUE=enabled or EN_FALSE=disabled. @return an error code.
EN_setrulepriority
@brief Sets the priority of a rule-based control. @param ph an EPANET project handle. @param index the rule’s index (starting from 1). @param priority the priority value assigned to the rule. @return an error code.
EN_setstatusreport
@brief Sets the level of hydraulic status reporting. @param ph an EPANET project handle. @param level a status reporting level code (see @ref EN_StatusReport). @return an error code.
EN_settag
@brief Assigns a tag string to a Node or Link. @param ph an EPANET project handle. @param object a type of object (either EN_NODE or EN_LINK) @param index the object’s index starting from 1 @param tag the tag string assigned to the object @return an error code
EN_settankdata
@brief Sets a group of properties for a tank node. @param ph an EPANET project handle. @param index a tank node’s index (starting from 1). @param elev the tank’s bottom elevation. @param initlvl the initial water level in the tank. @param minlvl the minimum water level for the tank. @param maxlvl the maximum water level for the tank. @param diam the tank’s diameter (0 if a volume curve is supplied). @param minvol the volume of the tank at its minimum water level. @param volcurve the name of the tank’s volume curve (“” for no curve) @return an error code.
EN_setthenaction
@brief Sets the properties of a THEN action in a rule-based control. @param ph an EPANET project handle. @param ruleIndex the rule’s index (starting from 1). @param actionIndex the index of the THEN action to modify (starting from 1). @param linkIndex the index of the link in the action. @param status the new status assigned to the link (see @ref EN_RuleStatus). @param setting the new value assigned to the link’s setting. @return an error code.
EN_settimeparam
@brief Sets the value of a time parameter. @param ph an EPANET project handle. @param param a time parameter code (see @ref EN_TimeParameter). @param value the new value of the time parameter (in seconds) @return an error code.
EN_settitle
@brief Sets the title lines of the project @param ph an EPANET project handle. @param line1 first title line @param line2 second title line @param line3 third title line @return an error code
EN_setvertex
@brief Sets the coordinates of a vertex point assigned to a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param vertex a vertex point index (starting from 1). @param x the vertex’s X-coordinate value. @param y the vertex’s Y-coordinate value. @return an error code.
EN_setvertices
@brief Assigns a set of internal vertex points to a link. @param ph an EPANET project handle. @param index a link’s index (starting from 1). @param x an array of X-coordinates for the vertex points. @param y an array of Y-coordinates for the vertex points. @param count the number of vertex points being assigned. @return an error code.
EN_solveH
@brief Runs a complete hydraulic simulation with results for all time periods written to a temporary hydraulics file. @param ph an EPANET project handle. @return an error code.
EN_solveQ
@brief Runs a complete water quality simulation with results at uniform reporting intervals written to the project’s binary output file. @param ph an EPANET project handle. @return an error code.
EN_stepQ
@brief Advances a water quality simulation by a single water quality time step. @param ph an EPANET project handle. @param[out] out_timeLeft time left (in seconds) to the overall simulation duration. @return an error code.
EN_timetonextevent
@brief Gets information about when the next hydraulic time step occurs. @param ph an EPANET project handle. @param[out] eventType the type of event that will occur (see @ref EN_TimestepEvent). @param[out] duration the amount of time in the future this event will occur @param[out] elementIndex the index of the element causing the event.
EN_usehydfile
@brief Uses a previously saved binary hydraulics file to supply a project’s hydraulics. @param ph an EPANET project handle. @param filename the name of the binary file containing hydraulic results. @return an error code.
EN_writeline
@brief Writes a line of text to a project’s report file. @param ph an EPANET project handle. @param line a text string to write. @return an error code.

Type Aliases§

EN_ActionCodeType
Deletion action codes ** These codes are used in @ref EN_deletenode and @ref EN_deletelink to indicate what action should be taken if the node or link being deleted appears in any simple or rule-based controls or if a deleted node has any links connected to it. */
EN_AnalysisStatistic
Analysis convergence statistics ** These statistics report the convergence criteria for the most current hydraulic analysis and the cumulative water quality mass balance error at the current simulation time. They can be retrieved with @ref EN_getstatistic. */
EN_ControlType
Simple control types ** These are the different types of simple (single statement) controls that can be applied to network links. They are used as an argument to @ref EN_addcontrol,@ref EN_getcontrol, and @ref EN_setcontrol. */
EN_CountType
Types of objects to count ** These options tell @ref EN_getcount which type of object to count. */
EN_CurveType
Types of data curves ** These are the different types of physical relationships that a data curve can represent as returned by calling @ref EN_getcurvetype. */
EN_DemandModel
Demand models ** These choices for modeling consumer demands are used with @ref EN_getdemandmodel and @ref EN_setdemandmodel.
EN_FlowUnits
Flow units ** These choices for flow units are used with @ref EN_getflowunits and @ref EN_setflowunits. They are also used for the flow units type argument in @ref EN_init. If flow units are expressed in US Customary units (EN_CFS through EN_AFD) then all other quantities are in US Customary units. Otherwise they are in metric units. */
EN_HeadLossType
Head loss formulas ** The available choices for the EN_HEADLOSSFORM option in @ref EN_getoption and @ref EN_setoption. They are also used for the head loss type argument in @ref EN_init. Each head loss formula uses a different type of roughness coefficient (EN_ROUGHNESS) that can be set with @ref EN_setlinkvalue. */
EN_InitHydOption
Hydraulic initialization options ** These options are used to initialize a new hydraulic analysis when @ref EN_initH is called. */
EN_LinkProperty
Link properties ** These link properties are used with @ref EN_getlinkvalue and @ref EN_setlinkvalue. Those marked as read only are computed values that can only be retrieved. */
EN_LinkStatusType
Link status ** One of these values is returned when @ref EN_getlinkvalue is used to retrieve a link’s initial status (EN_INITSTATUS) or its current status (EN_STATUS). These options are also used with @ref EN_setlinkvalue to set values for these same properties. */
EN_LinkType
Link types ** These are the different types of links that can be returned by calling @ref EN_getlinktype. */
EN_MixingModel
Tank mixing models ** These are the different types of models that describe water quality mixing in storage tanks. The choice of model is accessed with the EN_MIXMODEL property of a Tank node using @ref EN_getnodevalue and @ref EN_setnodevalue. */
EN_NodeProperty
Node properties *! \enum EN_NodeProperty
EN_NodeType
Node Types ** These are the different types of nodes that can be returned by calling @ref EN_getnodetype. */
EN_ObjectType
Types of network objects ** The types of objects that comprise a network model. */
EN_Option
Simulation options ** These constants identify the hydraulic and water quality simulation options that are applied on a network-wide basis. They are accessed using the @ref EN_getoption and @ref EN_setoption functions. */
EN_PressUnits
Pressure units ** The available choices for pressure units for the EN_PRESS_UNITS option in @ref EN_getoption and @ref EN_setoption. */
EN_Project
@brief The EPANET Project wrapper object
EN_PumpStateType
Pump states ** One of these codes is returned when @ref EN_getlinkvalue is used to retrieve a pump’s current operating state (EN_PUMP_STATE). EN_PUMP_XHEAD indicates that the pump has been shut down because it is being asked to deliver more than its shutoff head. EN_PUMP_XFLOW indicates that the pump is being asked to deliver more than its maximum flow. */
EN_PumpType
Types of pump curves ** @ref EN_getpumptype returns one of these values when it is called. */
EN_QualityType
Types of water quality analyses ** These are the different types of water quality analyses that EPANET can run. They are used with @ref EN_getqualinfo, @ref EN_getqualtype, and @ref EN_setqualtype. */
EN_RuleObject
Network objects used in rule-based controls
EN_RuleOperator
Comparison operators used in rule-based controls
EN_RuleStatus
Link status codes used in rule-based controls
EN_RuleVariable
Object variables used in rule-based controls
EN_SizeLimits
Character array size limits *! \enum EN_SizeLimits
EN_SourceType
Water quality source types ** These are the different types of external water quality sources that can be assigned to a node’s EN_SOURCETYPE property as used by @ref EN_getnodevalue and @ref EN_setnodevalue. */
EN_StatisticType
Reporting statistic choices ** These options determine what kind of statistical post-processing should be done on the time series of simulation results before they are reported using @ref EN_report or saved to the project’s binary output file. These options are used in the @ref EN_gettimeparam and @ref EN_settimeparam functions when EN_STATISTIC is the time parameter being set or retrieved. */
EN_StatusReport
Status reporting levels ** These choices specify the level of status reporting written to a project’s report file during a hydraulic analysis. The level is set using the @ref EN_setstatusreport or the @ref EN_setoption functions. */
EN_TimeParameter
Time parameters ** These time-related options are used with @ref EN_gettimeparam and@ref EN_settimeparam. All times are expressed in seconds The parameters marked as read only are computed values that can only be retrieved. */
EN_TimestepEvent
Time step events ** These are the types of events that can cause a new time step to be taken. **/