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§
Constants§
- EN_
Action Code Type_ EN_ CONDITIONAL - !< Cancel object deletion if it appears in controls or has connecting links
- EN_
Action Code Type_ EN_ UNCONDITIONAL - !< Delete all controls and connecting links
- EN_
Analysis Statistic_ EN_ DEFICIENTNODES - !< Number of pressure deficient nodes
- EN_
Analysis Statistic_ EN_ DEMANDREDUCTION - !< % demand reduction at pressure deficient nodes
- EN_
Analysis Statistic_ EN_ ITERATIONS - !< Number of hydraulic iterations taken
- EN_
Analysis Statistic_ EN_ LEAKAGELOSS - !< % flow lost to system leakage
- EN_
Analysis Statistic_ EN_ MASSBALANCE - !< Cumulative water quality mass balance ratio
- EN_
Analysis Statistic_ EN_ MAXFLOWCHANGE - !< Largest flow change in links
- EN_
Analysis Statistic_ EN_ MAXHEADERROR - !< Largest head loss error for links
- EN_
Analysis Statistic_ EN_ RELATIVEERROR - !< Sum of link flow changes / sum of link flows
- EN_
Control Type_ EN_ HILEVEL - !< Act when pressure or tank level rises above a setpoint
- EN_
Control Type_ EN_ LOWLEVEL - !< Act when pressure or tank level drops below a setpoint
- EN_
Control Type_ EN_ TIMEOFDAY - !< Act at a particular time of day
- EN_
Control Type_ EN_ TIMER - !< Act at a prescribed elapsed amount of time
- EN_
Count Type_ EN_ CONTROLCOUNT - !< Number of simple controls
- EN_
Count Type_ EN_ CURVECOUNT - !< Number of data curves
- EN_
Count Type_ EN_ LINKCOUNT - !< Number of links (pipes + pumps + valves)
- EN_
Count Type_ EN_ NODECOUNT - !< Number of nodes (junctions + tanks + reservoirs)
- EN_
Count Type_ EN_ PATCOUNT - !< Number of time patterns
- EN_
Count Type_ EN_ RULECOUNT - !< Number of rule-based controls
- EN_
Count Type_ EN_ TANKCOUNT - !< Number of tanks and reservoirs
- EN_
Curve Type_ EN_ EFFIC_ CURVE - !< Pump efficiency v. flow curve
- EN_
Curve Type_ EN_ GENERIC_ CURVE - !< Generic curve
- EN_
Curve Type_ EN_ HLOSS_ CURVE - !< Valve head loss v. flow curve
- EN_
Curve Type_ EN_ PUMP_ CURVE - !< Pump head v. flow curve
- EN_
Curve Type_ EN_ VALVE_ CURVE - !< % of fully open flow v. % open
- EN_
Curve Type_ EN_ VOLUME_ CURVE - !< Tank volume v. depth curve
- EN_
Demand Model_ EN_ DDA - !< Demand driven analysis
- EN_
Demand Model_ EN_ PDA - !< Pressure driven analysis
- EN_
FALSE - EN_
Flow Units_ EN_ AFD - !< Acre-feet per day
- EN_
Flow Units_ EN_ CFS - !< Cubic feet per second
- EN_
Flow Units_ EN_ CMD - !< Cubic meters per day
- EN_
Flow Units_ EN_ CMH - !< Cubic meters per hour
- EN_
Flow Units_ EN_ CMS - !< Cubic meters per second
- EN_
Flow Units_ EN_ GPM - !< Gallons per minute
- EN_
Flow Units_ EN_ IMGD - !< Imperial million gallons per day
- EN_
Flow Units_ EN_ LPM - !< Liters per minute
- EN_
Flow Units_ EN_ LPS - !< Liters per second
- EN_
Flow Units_ EN_ MGD - !< Million gallons per day
- EN_
Flow Units_ EN_ MLD - !< Million liters per day
- EN_
Head Loss Type_ EN_ CM - !< Chezy-Manning
- EN_
Head Loss Type_ EN_ DW - !< Darcy-Weisbach
- EN_
Head Loss Type_ EN_ HW - !< Hazen-Williams
- EN_
Init HydOption_ EN_ INITFLOW - !< Don’t save hydraulics; re-initialize flows
- EN_
Init HydOption_ EN_ NOSAVE - !< Don’t save hydraulics; don’t re-initialize flows
- EN_
Init HydOption_ EN_ SAVE - !< Save hydraulics to file, don’t re-initialize flows
- EN_
Init HydOption_ EN_ SAVE_ AND_ INIT - !< Save hydraulics; re-initialize flows
- EN_
Link Property_ EN_ DIAMETER - !< Pipe/valve diameter
- EN_
Link Property_ EN_ ENERGY - !< Current computed pump energy usage (read only)
- EN_
Link Property_ EN_ FLOW - !< Current computed flow rate (read only)
- EN_
Link Property_ EN_ GPV_ CURVE - !< GPV head loss v. flow curve index
- EN_
Link Property_ EN_ HEADLOSS - !< Current computed head loss (read only)
- EN_
Link Property_ EN_ INITSETTING - !< Initial pump speed or valve setting
- EN_
Link Property_ EN_ INITSTATUS - !< Initial status (see @ref EN_LinkStatusType)
- EN_
Link Property_ EN_ KBULK - !< Bulk flow chemical reaction coefficient
- EN_
Link Property_ EN_ KWALL - !< Pipe wall chemical reaction coefficient
- EN_
Link Property_ EN_ LEAK_ AREA - !< Pipe leak area (sq mm per 100 length units)
- EN_
Link Property_ EN_ LEAK_ EXPAN - !< Leak expansion rate (sq mm per unit of pressure head)
- EN_
Link Property_ EN_ LENGTH - !< Pipe length
- EN_
Link Property_ EN_ LINKPATTERN - !< Pump speed time pattern index
- EN_
Link Property_ EN_ LINKQUAL - !< Current computed link quality (read only)
- EN_
Link Property_ EN_ LINK_ INCONTROL - !< Is present in any simple or rule-based control (= 1) or not (= 0)
- EN_
Link Property_ EN_ LINK_ LEAKAGE - !< Current leakage rate (read only)
- EN_
Link Property_ EN_ MINORLOSS - !< Pipe/valve minor loss coefficient
- EN_
Link Property_ EN_ PCV_ CURVE - !< PCV characteristic curve index
- EN_
Link Property_ EN_ PUMP_ ECOST - !< Pump average energy price
- EN_
Link Property_ EN_ PUMP_ ECURVE - !< Pump efficiency v. flow curve index
- EN_
Link Property_ EN_ PUMP_ EFFIC - !< Current computed pump efficiency (read only)
- EN_
Link Property_ EN_ PUMP_ EPAT - !< Pump energy price time pattern index
- EN_
Link Property_ EN_ PUMP_ HCURVE - !< Pump head v. flow curve index
- EN_
Link Property_ EN_ PUMP_ POWER - !< Pump constant power rating
- EN_
Link Property_ EN_ PUMP_ STATE - !< Current computed pump state (read only) (see @ref EN_PumpStateType)
- EN_
Link Property_ EN_ ROUGHNESS - !< Pipe roughness coefficient
- EN_
Link Property_ EN_ SETTING - !< Current link setting
- EN_
Link Property_ EN_ STATUS - !< Current link status (see @ref EN_LinkStatusType)
- EN_
Link Property_ EN_ VALVE_ TYPE - !< Type of valve (see @ref EN_LinkType)
- EN_
Link Property_ EN_ VELOCITY - !< Current computed flow velocity (read only)
- EN_
Link Status Type_ EN_ CLOSED - !< Link is closed and cannot convey any flow
- EN_
Link Status Type_ EN_ OPEN - !< Link is open and is able to convey flow
- EN_
Link Type_ EN_ CVPIPE - !< Pipe with check valve
- EN_
Link Type_ EN_ FCV - !< Flow control valve
- EN_
Link Type_ EN_ GPV - !< General purpose valve
- EN_
Link Type_ EN_ PBV - !< Pressure breaker valve
- EN_
Link Type_ EN_ PCV - !< Positional control valve
- EN_
Link Type_ EN_ PIPE - !< Pipe
- EN_
Link Type_ EN_ PRV - !< Pressure reducing valve
- EN_
Link Type_ EN_ PSV - !< Pressure sustaining valve
- EN_
Link Type_ EN_ PUMP - !< Pump
- EN_
Link Type_ EN_ TCV - !< Throttle control valve
- EN_
Mixing Model_ EN_ FIFO - !< First in, first out model
- EN_
Mixing Model_ EN_ LIFO - !< Last in, first out model
- EN_
Mixing Model_ EN_ MIX1 - !< Complete mix model
- EN_
Mixing Model_ EN_ MIX2 - !< 2-compartment model
- EN_
Node Property_ EN_ BASEDEMAND - !< Primary demand baseline value
- EN_
Node Property_ EN_ CANOVERFLOW - !<
EN_TRUE(= 1) if the Tank can overflow,EN_FALSE(= 0) if it cannot - EN_
Node Property_ EN_ DEMAND - !< Current computed demand (read only)
- EN_
Node Property_ EN_ DEMANDDEFICIT - !< Amount that full demand is reduced under PDA (read only)
- EN_
Node Property_ EN_ DEMANDFLOW - !< Current consumer demand delivered (read only)
- EN_
Node Property_ EN_ ELEVATION - !< Elevation
- EN_
Node Property_ EN_ EMITTER - !< Emitter flow coefficient
- EN_
Node Property_ EN_ EMITTERFLOW - !< Current emitter flow (read only)
- EN_
Node Property_ EN_ FULLDEMAND - !< Current consumer demand requested (read only)
- EN_
Node Property_ EN_ HEAD - !< Current computed hydraulic head (read only)
- EN_
Node Property_ EN_ INITQUAL - !< Initial quality
- EN_
Node Property_ EN_ INITVOLUME - !< Tank initial volume (read only)
- EN_
Node Property_ EN_ LEAKAGEFLOW - !< Current leakage flow (read only)
- EN_
Node Property_ EN_ MAXLEVEL - !< Tank maximum level
- EN_
Node Property_ EN_ MAXVOLUME - !< Tank maximum volume (read only)
- EN_
Node Property_ EN_ MINLEVEL - !< Tank minimum level
- EN_
Node Property_ EN_ MINVOLUME - !< Tank minimum volume
- EN_
Node Property_ EN_ MIXFRACTION - !< Tank mixing fraction
- EN_
Node Property_ EN_ MIXMODEL - !< Tank mixing model (see @ref EN_MixingModel)
- EN_
Node Property_ EN_ MIXZONEVOL - !< Tank mixing zone volume (read only)
- EN_
Node Property_ EN_ NODE_ INCONTROL - !<
EN_TRUE(= 1) if the node appears in any control,EN_FALSE(= 0) if not - EN_
Node Property_ EN_ PATTERN - !< Primary demand time pattern index
- EN_
Node Property_ EN_ PRESSURE - !< Current computed pressure (read only)
- EN_
Node Property_ EN_ QUALITY - !< Current computed quality (read only)
- EN_
Node Property_ EN_ SOURCEMASS - !< Current computed quality source mass inflow (read only)
- EN_
Node Property_ EN_ SOURCEPAT - !< Quality source pattern index
- EN_
Node Property_ EN_ SOURCEQUAL - !< Quality source strength
- EN_
Node Property_ EN_ SOURCETYPE - !< Quality source type (see @ref EN_SourceType)
- EN_
Node Property_ EN_ TANKDIAM - !< Tank diameter
- EN_
Node Property_ EN_ TANKLEVEL - !< Current computed tank water level (read only)
- EN_
Node Property_ EN_ TANKVOLUME - !< Current computed tank volume (read only)
- EN_
Node Property_ EN_ TANK_ KBULK - !< Tank bulk decay coefficient
- EN_
Node Property_ EN_ VOLCURVE - !< Tank volume curve index
- EN_
Node Type_ EN_ JUNCTION - !< Junction node
- EN_
Node Type_ EN_ RESERVOIR - !< Reservoir node
- EN_
Node Type_ EN_ TANK - !< Storage tank node
- EN_
Object Type_ EN_ CONTROL - !< Simple controls
- EN_
Object Type_ EN_ CURVE - !< Data curves
- EN_
Object Type_ EN_ LINK - !< Links
- EN_
Object Type_ EN_ NODE - !< Nodes
- EN_
Object Type_ EN_ RULE - !< Control rules
- EN_
Object Type_ 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_
Press Units_ EN_ BAR - !< Bar
- EN_
Press Units_ EN_ FEET - !< Feet
- EN_
Press Units_ EN_ KPA - !< Kilopascals
- EN_
Press Units_ EN_ METERS - !< Meters
- EN_
Press Units_ EN_ PSI - !< Pounds per square inch
- EN_
Pump State Type_ EN_ PUMP_ CLOSED - !< Pump closed
- EN_
Pump State Type_ EN_ PUMP_ OPEN - !< Pump open
- EN_
Pump State Type_ EN_ PUMP_ XFLOW - !< Pump open - cannot supply flow
- EN_
Pump State Type_ EN_ PUMP_ XHEAD - !< Pump closed - cannot supply head
- EN_
Pump Type_ EN_ CONST_ HP - !< Constant horsepower
- EN_
Pump Type_ EN_ CUSTOM - !< User-defined custom curve
- EN_
Pump Type_ EN_ NOCURVE - !< No curve
- EN_
Pump Type_ EN_ POWER_ FUNC - !< Power function
- EN_
Quality Type_ EN_ AGE - !< Water age analysis
- EN_
Quality Type_ EN_ CHEM - !< Chemical fate and transport
- EN_
Quality Type_ EN_ NONE - !< No quality analysis
- EN_
Quality Type_ EN_ TRACE - !< Source tracing analysis
- EN_
Rule Object_ EN_ R_ LINK - !< Clause refers to a link
- EN_
Rule Object_ EN_ R_ NODE - !< Clause refers to a node
- EN_
Rule Object_ EN_ R_ SYSTEM - !< Clause refers to a system parameter (e.g., time)
- EN_
Rule Operator_ EN_ R_ ABOVE - !< Is above
- EN_
Rule Operator_ EN_ R_ BELOW - !< Is below
- EN_
Rule Operator_ EN_ R_ EQ - !< Equal to
- EN_
Rule Operator_ EN_ R_ GE - !< Greater than or equal to
- EN_
Rule Operator_ EN_ R_ GT - !< Greater than
- EN_
Rule Operator_ EN_ R_ IS - !< Is equal to
- EN_
Rule Operator_ EN_ R_ LE - !< Less than or equal to
- EN_
Rule Operator_ EN_ R_ LT - !< Less than
- EN_
Rule Operator_ EN_ R_ NE - !< Not equal
- EN_
Rule Operator_ EN_ R_ NOT - !< Is not equal to
- EN_
Rule Status_ EN_ R_ IS_ ACTIVE - !< Control valve is active
- EN_
Rule Status_ EN_ R_ IS_ CLOSED - !< Link is closed
- EN_
Rule Status_ EN_ R_ IS_ OPEN - !< Link is open
- EN_
Rule Variable_ EN_ R_ CLOCKTIME - !< Time of day
- EN_
Rule Variable_ EN_ R_ DEMAND - !< Nodal demand
- EN_
Rule Variable_ EN_ R_ DRAINTIME - !< Time to drain a tank
- EN_
Rule Variable_ EN_ R_ FILLTIME - !< Time to fill a tank
- EN_
Rule Variable_ EN_ R_ FLOW - !< Link flow rate
- EN_
Rule Variable_ EN_ R_ GRADE - !< Nodal hydraulic grade
- EN_
Rule Variable_ EN_ R_ HEAD - !< Nodal hydraulic head
- EN_
Rule Variable_ EN_ R_ LEVEL - !< Tank water level
- EN_
Rule Variable_ EN_ R_ POWER - !< Pump power output
- EN_
Rule Variable_ EN_ R_ PRESSURE - !< Nodal pressure
- EN_
Rule Variable_ EN_ R_ SETTING - !< Link setting
- EN_
Rule Variable_ EN_ R_ STATUS - !< Link status
- EN_
Rule Variable_ EN_ R_ TIME - !< Elapsed simulation time
- EN_
Size Limits_ EN_ MAXID - !< Max. # characters in ID name
- EN_
Size Limits_ EN_ MAXMSG - !< Max. # characters in message text
- EN_
Source Type_ EN_ CONCEN - !< Sets the concentration of external inflow entering a node
- EN_
Source Type_ EN_ FLOWPACED - !< Adds a given value to the concentration leaving a node
- EN_
Source Type_ EN_ MASS - !< Injects a given mass/minute into a node
- EN_
Source Type_ EN_ SETPOINT - !< Sets the concentration leaving a node to a given value
- EN_
Statistic Type_ EN_ AVERAGE - !< Report average value over simulation period
- EN_
Statistic Type_ EN_ MAXIMUM - !< Report maximum value over simulation period
- EN_
Statistic Type_ EN_ MINIMUM - !< Report minimum value over simulation period
- EN_
Statistic Type_ EN_ RANGE - !< Report maximum - minimum over simulation period
- EN_
Statistic Type_ EN_ SERIES - !< Report all time series points
- EN_
Status Report_ EN_ FULL_ REPORT - !< Full level of status reporting
- EN_
Status Report_ EN_ NORMAL_ REPORT - !< Normal level of status reporting
- EN_
Status Report_ EN_ NO_ REPORT - !< No status reporting
- EN_TRUE
- EN_
Time Parameter_ EN_ DURATION - !< Total simulation duration
- EN_
Time Parameter_ EN_ HALTFLAG - !< Flag indicating if the simulation was halted (read only)
- EN_
Time Parameter_ EN_ HTIME - !< Elapsed time of current hydraulic solution (read only)
- EN_
Time Parameter_ EN_ HYDSTEP - !< Hydraulic time step
- EN_
Time Parameter_ EN_ NEXTEVENT - !< Shortest time until a tank becomes empty or full (read only)
- EN_
Time Parameter_ EN_ NEXTEVENTTANK - !< Index of tank with shortest time to become empty or full (read only)
- EN_
Time Parameter_ EN_ PATTERNSTART - !< Time when time patterns begin
- EN_
Time Parameter_ EN_ PATTERNSTEP - !< Time pattern period
- EN_
Time Parameter_ EN_ PERIODS - !< Number of reporting time periods (read only)
- EN_
Time Parameter_ EN_ QTIME - !< Elapsed time of current quality solution (read only)
- EN_
Time Parameter_ EN_ QUALSTEP - !< Water quality time step
- EN_
Time Parameter_ EN_ REPORTSTART - !< Time when reporting starts
- EN_
Time Parameter_ EN_ REPORTSTEP - !< Reporting time step
- EN_
Time Parameter_ EN_ RULESTEP - !< Rule-based control evaluation time step
- EN_
Time Parameter_ EN_ STARTTIME - !< Simulation starting time of day
- EN_
Time Parameter_ EN_ STATISTIC - !< Reporting statistic code (see @ref EN_StatisticType)
- EN_
Timestep Event_ EN_ STEP_ CONTROLEVENT - !< A link control needs to be activated
- EN_
Timestep Event_ EN_ STEP_ HYD - !< A hydraulic time step has ended
- EN_
Timestep Event_ EN_ STEP_ REPORT - !< A reporting time step has ended
- EN_
Timestep Event_ EN_ STEP_ TANKEVENT - !< A tank has become empty or full
- EN_
Timestep Event_ 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_TIMERandEN_TIMEOFDAYcontrols). @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_TIMERandEN_TIMEOFDAYcontrols). @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 orEN_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 toEN_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_TIMERandEN_TIMEOFDAYcontrols). @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_
Action Code Type - 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_
Analysis Statistic - 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_
Control Type - 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_
Count Type - Types of objects to count ** These options tell @ref EN_getcount which type of object to count. */
- EN_
Curve Type - 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_
Demand Model - Demand models ** These choices for modeling consumer demands are used with @ref EN_getdemandmodel and @ref EN_setdemandmodel.
- EN_
Flow Units - 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_CFSthroughEN_AFD) then all other quantities are in US Customary units. Otherwise they are in metric units. */ - EN_
Head Loss Type - Head loss formulas
**
The available choices for the
EN_HEADLOSSFORMoption 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_
Init HydOption - Hydraulic initialization options ** These options are used to initialize a new hydraulic analysis when @ref EN_initH is called. */
- EN_
Link Property - 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_
Link Status Type - 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_
Link Type - Link types ** These are the different types of links that can be returned by calling @ref EN_getlinktype. */
- EN_
Mixing Model - 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_MIXMODELproperty of a Tank node using @ref EN_getnodevalue and @ref EN_setnodevalue. */ - EN_
Node Property - Node properties *! \enum EN_NodeProperty
- EN_
Node Type - Node Types ** These are the different types of nodes that can be returned by calling @ref EN_getnodetype. */
- EN_
Object Type - 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_
Press Units - Pressure units
**
The available choices for pressure units for the
EN_PRESS_UNITSoption in @ref EN_getoption and @ref EN_setoption. */ - EN_
Project - @brief The EPANET Project wrapper object
- EN_
Pump State Type - 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_XHEADindicates that the pump has been shut down because it is being asked to deliver more than its shutoff head.EN_PUMP_XFLOWindicates that the pump is being asked to deliver more than its maximum flow. */ - EN_
Pump Type - Types of pump curves ** @ref EN_getpumptype returns one of these values when it is called. */
- EN_
Quality Type - 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_
Rule Object - Network objects used in rule-based controls
- EN_
Rule Operator - Comparison operators used in rule-based controls
- EN_
Rule Status - Link status codes used in rule-based controls
- EN_
Rule Variable - Object variables used in rule-based controls
- EN_
Size Limits - Character array size limits *! \enum EN_SizeLimits
- EN_
Source Type - Water quality source types
**
These are the different types of external water quality sources that can be assigned
to a node’s
EN_SOURCETYPEproperty as used by @ref EN_getnodevalue and @ref EN_setnodevalue. */ - EN_
Statistic Type - 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_STATISTICis the time parameter being set or retrieved. */ - EN_
Status Report - 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_
Time Parameter - 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_
Timestep Event - Time step events ** These are the types of events that can cause a new time step to be taken. **/