Home

Awesome

<a href="http://www.kios.ucy.ac.cy"><img src="https://www.kios.ucy.ac.cy/wp-content/uploads/2021/07/Logotype-KIOS.svg" width="200" height="100"/><a>

license pypi Downloads Downloads build Documentation Status DOI

EPANET Python Toolkit (EPyT)

The EPANET-Python Toolkit is an open-source software, originally developed by the KIOS Research and Innovation Center of Excellence, University of Cyprus which operates within the Python environment, for providing a programming interface for the latest version of EPANET, a hydraulic and quality modeling software created by the US EPA, with Python, a high-level technical computing software. The goal of the EPANET Python Toolkit is to serve as a common programming framework for research and development in the growing field of smart water networks.

The EPANET-Python Toolkit features easy to use commands/wrappers for viewing, modifying, simulating and plotting results produced by the EPANET libraries.

For support, please use the OWA community forum : http://community.wateranalytics.org/

Table of Contents

How to cite

Kyriakou, M. S., Demetriades, M., Vrachimis, S. G., Eliades, D. G., & Polycarpou, M. M. (2023). EPyT: An EPANET-Python Toolkit for Smart Water Network Simulations. Journal of Open Source Software, 8(92), 5947. https://doi.org/10.21105/joss.05947

@article{Kyriakou2023,
author = {Kyriakou, Marios S. and Demetriades, Marios and Vrachimis, Stelios G. and Eliades, Demetrios G. and Polycarpou, Marios M.},
doi = {10.21105/joss.05947},
journal = {Journal of Open Source Software},
month = dec,
number = {92},
pages = {5947},
title = {{EPyT: An EPANET-Python Toolkit for Smart Water Network Simulations}},
url = {https://joss.theoj.org/papers/10.21105/joss.05947},
volume = {8},
year = {2023}
}

Back to top

Requirements

Linux: sudo cp libepanet2.so /lib/x86_64-linux-gnu/libepanet.so

Back to top

How to install

Environments -> base (root) -> open terminal -> pip install epyt

Back to top

How to use the Toolkit

Minimum Example:

>>> from epyt import epanet
>>> 
>>> d = epanet('Net1.inp')
>>> d.getNodeCount()
>>> d.getNodeElevations()

Minumun Example using custom Library:

>>> from epyt import epanet
>>>
>>>epanetlib=os.path.join(os.getcwd(), 'epyt','libraries','win','epanet2.dll')
>>>msxlib=os.path.join(os.getcwd(), 'epyt','libraries','win','epanetmsx.dll')
>>>d = epanet(inpname, customlib=epanetlib)
>>>d.loadMSXFile(msxname, customMSXlib=msxlib)

More examples:

https://github.com/KIOS-Research/EPYT/tree/main/epyt/examples

Back to top

How to fix/report bugs

To fix a bug Fork the EPyT, Edit the code and make the appropriate change, and then Pull it so that we evaluate it.

Keep in mind that some bugs may exist in the EPANET libraries, in case you are not receiving the expected results.

Back to top

Licenses

Back to top

Contributors

The EPyT is based/inspired on the EPANET-Matlab Toolkit.

Contributing

If you want to contribute, please check out our Code of Conduct. Everyone is welcome to contribute whether reporting a new issue, suggesting a new feature, or writing code. If you want to contribute code, you can create a new fork in the repo to your own account. Make your commits on your dev branch (based on dev) and when you are finished then you can create a pull request to test the code and discuss your changes.

Recommendation

Settings on Spyder IDE

Back to top

List of Python Class Functions

FunctionDescription
addControlsAdds a new simple control
addCurveAdds a new curve appended to the end of the existing curves
addLinkPipeAdds a new pipe
addLinkPipeCVAdds a new control valve pipe
addLinkPumpAdds a new pump
addLinkValveFCVAdds a new FCV valve
addLinkValveGPVAdds a new GPV valve
addLinkValvePBVAdds a new PBV valve
addLinkValvePRVAdds a new PRV valve
addLinkValvePSVAdds a new PSV valve
addLinkValveTCVAdds a new TCV valve
addNodeJunctionAdds a new junction
addNodeJunctionDemandAdds a new demand to a junction given the junction index, base demand, demand time pattern and demand category name
addNodeReservoirAdds a new reservoir
addNodeTankAdds a new tank
addPatternAdds a new time pattern to the network
addRulesAdds a new rule-based control to a project
appRotateNetworkRotates the network by theta degrees counter-clockwise
appShiftNetworkShifts the network
clearReportClears the contents of a project's report file
closeHydraulicAnalysisCloses the hydraulic analysis system, freeing all allocated memory
closeNetworkCloses down the Toolkit system
closeQualityAnalysisCloses the water quality analysis system, freeing all allocated memory
copyReportCopies the current contents of a project's report file to another file
createProjectCreates a new epanet projec
deleteAllTempsDelete all temporary files (.inp, .bin) created in networks folder
deleteControlsDeletes an existing simple control
deleteCurveDeletes a data curve from a project
deleteLinkDeletes a link
deleteNodeDeletes nodes
deletePatternDeletes a time pattern from a project
deletePatternsAllDeletes all time patterns from a project
deleteProjectDeletes the epanet project
deleteRulesDeletes an existing rule-based control given it's index
getAdjacencyMatrixCompute the adjacency matrix (connectivity graph) considering the flows, using mean flow
getAllAttributesGet all attributes of a given Python object
getCMDCODERetrieves the CMC code
getComputedHydraulicTimeSeriesComputes hydraulic simulation and retrieves all time-series
getComputedQualityTimeSeriesComputes Quality simulation and retrieves all or some time-series
getComputedTimeSeriesRun analysis with binary fil
getConnectivityMatrixRetrieve the Connectivity Matrix of the networ
getControlRulesCountRetrieves the number of controls
getControlsRetrieves the parameters of all control statements
getCountsRetrieves the number of network components
getCurveCommentRetrieves the comment string of a curve
getCurveCountRetrieves the number of curves
getCurveIndexRetrieves the index of a curve with specific ID
getCurveLengthsRetrieves number of points in a curve
getCurveNameIDRetrieves the IDs of curves
getCurveTypeRetrieves the curve-type for all curves
getCurveTypeIndexRetrieves the curve-type index for all curves
getCurveValueRetrieves the X, Y values of points of curves
getCurvesInfoRetrieves all the info of curves
getDemandModelRetrieves the type of demand model in use and its parameters
getENfunctionsImpementedRetrieves the epanet functions that have been developed
getErrorRetrieves the text of the message associated with a particular error or warning code
getFlowUnitsRetrieves flow units used to express all flow rates
getLibFunctionsRetrieves the functions of DLL
getLinkActualQualityRetrieves the current computed link quality (read only)
getLinkBulkReactionCoeffRetrieves the value of all link bulk chemical reaction coefficient
getLinkCommentRetrieves the comment string assigned to the link object
getLinkCountRetrieves the number of links
getLinkDiameterRetrieves the value of link diameters
getLinkEnergyRetrieves the current computed pump energy usage (read only)
getLinkFlowsRetrieves the current computed flow rate (read only)
getLinkHeadlossRetrieves the current computed head loss (read only)
getLinkIndexRetrieves the indices of all links, or the indices of an ID set of links
getLinkInitialSettingRetrieves the value of all link roughness for pipes or initial speed for pumps or initial setting for valves
getLinkInitialStatusRetrieves the value of all link initial status
getLinkLengthRetrieves the value of link lengths
getLinkMinorLossCoeffRetrieves the value of link minor loss coefficients
getLinkNameIDRetrieves the ID label(s) of all links, or the IDs of an index set of links
getLinkNodesIndexRetrieves the indexes of the from/to nodes of all links
getLinkPipeCountRetrieves the number of pipes
getLinkPipeIndexRetrieves the pipe indices
getLinkPipeNameIDRetrieves the pipe ID
getLinkPumpCountRetrieves the number of pumps
getLinkPumpECostRetrieves the pump average energy price
getLinkPumpECurveRetrieves the pump efficiency v
getLinkPumpEPatRetrieves the pump energy price time pattern index
getLinkPumpEfficiencyRetrieves the current computed pump efficiency (read only)
getLinkPumpHCurveRetrieves the pump head v
getLinkPumpHeadCurveIndexRetrieves the index of a head curve for all pumps
getLinkPumpIndexRetrieves the pump indices
getLinkPumpNameIDRetrieves the pump ID
getLinkPumpPatternIndexRetrieves the pump speed time pattern index
getLinkPumpPatternNameIDRetrieves pump pattern name ID
getLinkPumpPowerRetrieves the pump constant power rating (read only)
getLinkPumpStateRetrieves the current computed pump state (read only) (see @ref EN_PumpStateType)
getLinkPumpSwitchesRetrieves the number of pump switches
getLinkPumpTypeRetrieves the type of a pump
getLinkPumpTypeCodeRetrieves the code of type of a pump
getLinkQualityRetrieves the value of link quality
getLinkResultIndexRetrieves the order in which a link's results were saved to an output file
getLinkRoughnessCoeffRetrieves the value of link roughness coefficient
getLinkSettingsRetrieves the current computed value of all link roughness for pipes or actual speed for pumps or actual setting for valves
getLinkStatusRetrieves the current link status (see @ref EN_LinkStatusType) (0 = closed, 1 = open)
getLinkTypeRetrieves the link-type code for all links
getLinkTypeIndexRetrieves the link-type code for all links
getLinkValveCountRetrieves the number of valves
getLinkValveIndexRetrieves the valve indices
getLinkValveNameIDRetrieves the valve ID
getLinkVelocityRetrieves the current computed flow velocity (read only)
getLinkVerticesRetrieves the coordinate's of a vertex point assigned to a link
getLinkVerticesCountRetrieves the number of internal vertex points assigned to a link
getLinkWallReactionCoeffRetrieves the value of all pipe wall chemical reaction coefficient
getLinksInfoRetrieves all link info
getNetworksDatabaseRetrieves all EPANET Input Files from EPyT database
getNodeActualDemandRetrieves the computed value of all node actual demands
getNodeActualDemandSensingNodesRetrieves the computed demand values at some sensing nodes
getNodeActualQualityRetrieves the computed values of the actual quality for all nodes
getNodeActualQualitySensingNodesRetrieves the computed quality values at some sensing node
getNodeBaseDemandsRetrieves the value of all node base demands
getNodeCommentRetrieves the comment string assigned to the node object
getNodeCoordinates
getNodeCountRetrieves the number of nodes
getNodeDemandCategoriesNumberRetrieves the value of all node base demands categorie number
getNodeDemandDeficitRetrieves the amount that full demand is reduced under PDA
getNodeDemandPatternIndexRetrieves the value of all node base demands pattern index
getNodeDemandPatternNameIDRetrieves the value of all node base demands pattern name ID
getNodeElevationsRetrieves the value of all node elevations
getNodeEmitterCoeffRetrieves the value of all node emmitter coefficients
getNodeHydraulicHeadRetrieves the computed values of all node hydraulic heads
getNodeIndexRetrieves the indices of all nodes or some nodes with a specified ID
getNodeInitialQualityRetrieves the value of all node initial quality
getNodeJunctionCountRetrieves the number of junction nodes
getNodeJunctionDemandIndexRetrieves the demand index of the junctions
getNodeJunctionDemandNameGets the name of a node's demand category
getNodeJunctionIndexRetrieves the indices of junctions
getNodeJunctionNameIDRetrieves the junction ID label
getNodeMassFlowRateRetrieves the computed mass flow rates per minute of chemical sources for all nodes
getNodeNameIDRetrieves the ID label of all nodes or some nodes with a specified index
getNodePatternIndexRetrieves the value of all node demand pattern indices
getNodePressureRetrieves the computed values of all node pressures
getNodeReservoirCountRetrieves the number of Reservoirs
getNodeReservoirIndexRetrieves the indices of reservoirs
getNodeReservoirNameIDRetrieves the reservoir ID label
getNodeResultIndexRetrieves the order in which a node's results were saved to an output file
getNodeSourcePatternIndexRetrieves the value of all node source pattern index
getNodeSourceQualityRetrieves the value of all node source quality
getNodeSourceTypeRetrieves the value of all node source type
getNodeSourceTypeIndexRetrieves the value of all node source type index
getNodeTankBulkReactionCoeffRetrieves the tank bulk rate coefficient
getNodeTankCanOverFlowRetrieves the tank can overflow (= 1) or not (= 0)
getNodeTankCountRetrieves the number of Tanks
getNodeTankDataRetrieves a group of properties for a tank
getNodeTankDiameterRetrieves the tank diameters
getNodeTankIndexRetrieves the tank indices
getNodeTankInitialLevelRetrieves the value of all tank initial water levels
getNodeTankInitialWaterVolumeRetrieves the tank initial water volume
getNodeTankMaximumWaterLevelRetrieves the tank maximum water level
getNodeTankMaximumWaterVolumeRetrieves the tank maximum water volume
getNodeTankMinimumWaterLevelRetrieves the tank minimum water level
getNodeTankMinimumWaterVolumeRetrieves the tank minimum water volume
getNodeTankMixZoneVolumeRetrieves the tank mixing zone volume
getNodeTankMixingFractionRetrieves the tank Fraction of total volume occupied by the inlet/outlet zone in a 2-compartment tank
getNodeTankMixingModelCodeRetrieves the tank mixing model code
getNodeTankMixingModelTypeRetrieves the tank mixing model type
getNodeTankNameIDRetrieves the tank IDs
getNodeTankReservoirCountRetrieves the number of tanks
getNodeTankVolumeRetrieves the tank volume
getNodeTankVolumeCurveIndexRetrieves the tank volume curve index
getNodeTypeRetrieves the node-type code for all nodes
getNodeTypeIndexRetrieves the node-type code for all nodes
getNodesConnectingLinksIDRetrieves the id of the from/to nodes of all links
getNodesConnectingLinksIndexRetrieves the indexes of the from/to nodes of all links
getNodesInfoRetrieves nodes info (elevations, demand patterns, emmitter coeff, initial quality, source quality, source pattern index, source type index, node type index)
getOptionsAccuracyValueRetrieves the total normalized flow change for hydraulic convergence
getOptionsCheckFrequencyRetrieves the frequency of hydraulic status checks
getOptionsDampLimitRetrieves the accuracy level where solution damping begins
getOptionsDemandChargeRetrieves the energy charge per maximum KW usage
getOptionsEmitterExponentRetrieves the power exponent for the emmitters
getOptionsExtraTrialsRetrieves the extra trials allowed if hydraulics don't converge
getOptionsFlowChangeRetrieves the maximum flow change for hydraulic convergence
getOptionsGlobalEfficRetrieves the global efficiency for pumps(percent)
getOptionsGlobalPatternRetrieves the index of the global energy price pattern
getOptionsGlobalPriceRetrieves the global average energy price per kW-Hour
getOptionsHeadErrorRetrieves the maximum head loss error for hydraulic convergence
getOptionsHeadLossFormulaRetrieves the headloss formula
getOptionsLimitingConcentrationRetrieves the limiting concentration for growth reactions
getOptionsMaxTrialsRetrieves the maximum hydraulic trials allowed for hydraulic convergence
getOptionsMaximumCheckRetrieves the maximum trials for status checking
getOptionsPatternDemandMultiplierRetrieves the global pattern demand multiplier
getOptionsPipeBulkReactionOrderRetrieves the bulk water reaction order for pipes
getOptionsPipeWallReactionOrderRetrieves the wall reaction order for pipes (either 0 or 1)
getOptionsQualityToleranceRetrieves the water quality analysis tolerance
getOptionsSpecificDiffusivityRetrieves the specific diffusivity (relative to chlorine at 20 deg C)
getOptionsSpecificGravityRetrieves the specific gravity
getOptionsSpecificViscosityRetrieves the specific viscosity
getOptionsTankBulkReactionOrderRetrieves the bulk water reaction order for tanks
getPatternRetrieves the multiplier factor for all patterns and all times
getPatternAverageValueRetrieves the average values of all the time patterns
getPatternCommentRetrieves the comment string assigned to the pattern object
getPatternCountRetrieves the number of patterns
getPatternIndexRetrieves the index of all or some time patterns given their IDs
getPatternLengthsRetrieves the number of time periods in all or some time patterns
getPatternNameIDRetrieves the ID label of all or some time patterns indices
getPatternValueRetrieves the multiplier factor for a certain pattern and time
getQualityCodeRetrieves the code of water quality analysis type
getQualityInfoRetrieves quality analysis information (type, chemical name, units, trace node ID)
getQualityTraceNodeIndexRetrieves the trace node index of water quality analysis type
getQualityTypeRetrieves the type of water quality analysis type
getRuleCountRetrieves the number of rules
getRuleIDRetrieves the ID name of a rule-based control given its index
getRuleInfoRetrieves summary information about a rule-based control given it's index
getRulesRetrieves the rule - based control statements
getStatisticReturns error code
getTimeHTimeRetrieves the elapsed time of current hydraulic solution
getTimeHaltFlagRetrieves the number of halt flag indicating if the simulation was halted
getTimeHydraulicStepRetrieves the value of the hydraulic time step
getTimeNextEventRetrieves the shortest time until a tank becomes empty or full
getTimeNextEventTankRetrieves the index of tank with shortest time to become empty or full
getTimePatternStartRetrieves the value of pattern start time
getTimePatternStepRetrieves the value of the pattern time step
getTimeQTimeRetrieves the elapsed time of current quality solution
getTimeQualityStepRetrieves the value of the water quality time step
getTimeReportingPeriodsRetrieves the number of reporting periods saved to the binary
getTimeReportingStartRetrieves the value of the reporting start time
getTimeReportingStepRetrieves the value of the reporting time step
getTimeRuleControlStepRetrieves the time step for evaluating rule-based controls
getTimeSimulationDurationRetrieves the value of simulation duration
getTimeStartTimeRetrieves the simulation starting time of day
getTimeStatisticsIndexRetrieves the index of the type of time series post-processing
getTimeStatisticsTypeRetrieves the type of time series post-processing
getTitleRetrieves the title lines of the project
getUnitsRetrieves the Units of Measurement
getVersionRetrieves the current EPANET version of DLL
initializeEPANETInitializes an EPANET project that isn't opened with an input fil
initializeHydraulicAnalysisInitializes storage tank levels, link status and settings, and the simulation clock time prior to running a hydraulic analysis
initializeQualityAnalysisInitializes water quality and the simulation clock time prior to running a water quality analysis
loadEPANETFileLoad epanet file when use bin functions
loadMSXEPANETFileRe-Load EPANET MSX file - parfor
nextHydraulicAnalysisStepDetermines the length of time until the next hydraulic event occurs in an extended period simulation
nextQualityAnalysisStepAdvances the water quality simulation to the start of the next hydraulic time period
openAnyInpOpen as on matlab editor any EPANET input file using built function open
openCurrentInpOpens EPANET input file who is loade
openHydraulicAnalysisOpens the hydraulics analysis system
openQualityAnalysisOpens the water quality analysis system
plotPlot Network, show all components, plot pressure/flow/elevation
plot_closeClose all open figures
plot_saveSave plot
plot_showShow plot
reloadNetworkReloads the Network (ENopen)
runEPANETexeRuns epanet .exe file
runHydraulicAnalysisRuns a single period hydraulic analysis, retrieving the current simulation clock time t
runQualityAnalysisMakes available the hydraulic and water quality results that occur at the start of the next time period of a water quality analysis, where the start of the period is returned in t
runsCompleteSimulationRuns a complete hydraulic and water simulation to create binary & report files with name: [NETWORK_temp.txt], [NETWORK_temp.bin] OR you can use argument to runs a complete simulation via self.api.en_epane
saveHydraulicFileSaves the current contents of the binary hydraulics file to a file
saveHydraulicsOutputReportingFileTransfers results of a hydraulic simulation from the binary Hydraulics file to the binary Output file, where results are only reported at uniform reporting intervals
saveInputFileWrites all current network input data to a file using the format of an EPANET input file
setCMDCODESets the CMC code
setControlsSets the parameters of a simple control statement
setCurveSets x, y values for a specific curve
setCurveCommentSets the comment string of a curve
setCurveNameIDSets the name ID of a curve given it's index and the new ID
setCurveValueSets x, y point for a specific point number and curve
setDemandModelSets the type of demand model to use and its parameters
setFlowUnitsAFDSets flow units to AFD(Acre-Feet per Day)
setFlowUnitsCFSSets flow units to CFS(Cubic Feet per Second)
setFlowUnitsCMDSets flow units to CMD(Cubic Meters per Day)
setFlowUnitsCMHSets flow units to CMH(Cubic Meters per Hour)
setFlowUnitsGPMSets flow units to GPM(Gallons Per Minute)
setFlowUnitsIMGDSets flow units to IMGD(Imperial Million Gallons per Day)
setFlowUnitsLPMSets flow units to LPM(Liters Per Minute)
setFlowUnitsLPSSets flow units to LPS(Liters Per Second)
setFlowUnitsMGDSets flow units to MGD(Million Gallons per Day)
setFlowUnitsMLDSets flow units to MLD(Million Liters per Day)
setLinkBulkReactionCoeffSets the value of bulk chemical reaction coefficient
setLinkCommentSets the comment string assigned to the link object
setLinkDiameterSets the values of diameters
setLinkInitialSettingSets the values of initial settings, roughness for pipes or initial speed for pumps or initial setting for valves
setLinkInitialStatusSets the values of initial status
setLinkLengthSets the values of lengths
setLinkMinorLossCoeffSets the values of minor loss coefficient
setLinkNameIDSets the ID name for links
setLinkNodesIndexSets the indexes of a link's start- and end-nodes
setLinkPipeDataSets a group of properties for a pipe
setLinkPumpECostSets the pump average energy price
setLinkPumpECurveSets the pump efficiency v
setLinkPumpEPatSets the pump energy price time pattern index
setLinkPumpHCurveSets the pump head v
setLinkPumpHeadCurveIndexSets the curves index for pumps index
setLinkPumpPatternIndexSets the pump speed time pattern index
setLinkPumpPowerSets the power for pumps
setLinkRoughnessCoeffSets the values of roughness coefficient
setLinkSettingsSets the values of current settings, roughness for pipes or initial speed for pumps or initial setting for valves
setLinkStatusSets the values of current status for links
setLinkTypePipeSets the link type pipe for a specified link
setLinkTypePipeCVSets the link type cvpipe(pipe with check valve) for a specified link
setLinkTypePumpSets the link type pump for a specified link
setLinkTypeValveFCVSets the link type valve FCV(flow control valve) for a specified link
setLinkTypeValveGPVSets the link type valve GPV(general purpose valve) for a specified link
setLinkTypeValvePBVSets the link type valve PBV(pressure breaker valve) for a specified link
setLinkTypeValvePRVSets the link type valve PRV(pressure reducing valve) for a specified link
setLinkTypeValvePSVSets the link type valve PSV(pressure sustaining valve) for a specified link
setLinkTypeValveTCVSets the link type valve TCV(throttle control valve) for a specified link
setLinkVerticesAssigns a set of internal vertex points to a link
setLinkWallReactionCoeffSets the value of wall chemical reaction coefficient
setNodeBaseDemandsSets the values of demand for nodes
setNodeCommentSets the comment string assigned to the node object
setNodeCoordinatesSets node coordinates
setNodeDemandPatternIndexSets the values of demand time pattern indices
setNodeElevationsSets the values of elevation for nodes
setNodeEmitterCoeffSets the values of emitter coefficient for nodes
setNodeInitialQualitySets the values of initial quality for nodes
setNodeJunctionDataSets a group of properties for a junction node
setNodeJunctionDemandNameAssigns a name to a node's demand category
setNodeNameIDSets the ID name for nodes
setNodeSourcePatternIndexSets the values of quality source pattern index
setNodeSourceQualitySets the values of quality source strength
setNodeSourceTypeSets the values of quality source type
setNodeTankBulkReactionCoeffSets the tank bulk reaction coefficient
setNodeTankCanOverFlowSets the tank can-overflow (= 1) or not (= 0)
setNodeTankDataSets a group of properties for a tank
setNodeTankDiameterSets the diameter value for tanks
setNodeTankInitialLevelSets the values of initial level for tanks
setNodeTankMaximumWaterLevelSets the maximum water level value for tanks
setNodeTankMinimumWaterLevelSets the minimum water level value for tanks
setNodeTankMinimumWaterVolumeSets the minimum water volume value for tanks
setNodeTankMixingFractionSets the tank mixing fraction of total volume occupied by the inlet/outlet zone in a 2-compartment tank
setNodeTankMixingModelTypeSets the mixing model type value for tanks
setNodeTypeJunctionTransforms a node to JUNCTION The new node keeps the id,coordinates and elevation of the deleted on
setNodeTypeReservoirTransforms a node to RESERVOIR The new node keeps the id,coordinates and elevation of the deleted on
setNodeTypeTankTransforms a node to TANK The new node keeps the id,coordinates and elevation of the deleted on
setNodesConnectingLinksIDSets the IDs of a link's start- and end-nodes
setOptionsAccuracyValueSets the total normalized flow change for hydraulic convergence
setOptionsCheckFrequencySets the frequency of hydraulic status checks
setOptionsDampLimitSets the accuracy level where solution damping begins
setOptionsDemandChargeSets the energy charge per maximum KW usage
setOptionsEmitterExponentSets the power exponent for the emmitters
setOptionsExtraTrialsSets the extra trials allowed if hydraulics don't converge
setOptionsFlowChangeSets the maximum flow change for hydraulic convergence
setOptionsGlobalEfficSets the global efficiency for pumps(percent)
setOptionsGlobalPatternSets the global energy price pattern
setOptionsGlobalPriceSets the global average energy price per kW-Hour
setOptionsHeadErrorSets the maximum head loss error for hydraulic convergence
setOptionsHeadLossFormulaSets the headloss formula
setOptionsLimitingConcentrationSets the limiting concentration for growth reactions
setOptionsMaxTrialsSets the maximum hydraulic trials allowed for hydraulic convergence
setOptionsMaximumCheckSets the maximum trials for status checking
setOptionsPatternDemandMultiplierSets the global pattern demand multiplier
setOptionsPipeBulkReactionOrderSets the bulk water reaction order for pipes
setOptionsPipeWallReactionOrderSets the wall reaction order for pipes (either 0 or 1)
setOptionsQualityToleranceSets the water quality analysis tolerance
setOptionsSpecificDiffusivitySets the specific diffusivity (relative to chlorine at 20 deg C)
setOptionsSpecificGravitySets the specific gravity
setOptionsSpecificViscositySets the specific viscosity
setOptionsTankBulkReactionOrderSets the bulk water reaction order for tanks
setPatternSets all of the multiplier factors for a specific time pattern
setPatternCommentSets the comment string assigned to the pattern object
setPatternMatrixSets all of the multiplier factors for all time patterns
setPatternNameIDSets the name ID of a time pattern given it's index and the new ID
setPatternValueSets the multiplier factor for a specific period within a time pattern
setQualityTypeSets the type of water quality analysis called for
setReportIssues a report formatting command
setReportFormatResetResets a project's report options to their default values
setReportStatusSets the level of hydraulic status reporting
setRuleElseActionSets rule - based control else actions
setRulePremiseSets the premise of a rule - based control
setRulePremiseObejctNameIDSets the ID of an object in a premise of a rule-based control
setRulePremiseStatusSets the status being compared to in a premise of a rule-based control
setRulePremiseValueSets the value being compared to in a premise of a rule-based control
setRulePrioritySets rule - based control priority
setRuleThenActionSets rule - based control then actions
setRulesSets a rule - based control
setTimeHydraulicStepSets the hydraulic time step
setTimePatternStartSets the time when time patterns begin
setTimePatternStepSets the time pattern step
setTimeQualityStepSets the quality time step
setTimeReportingStartSets the time when reporting starts
setTimeReportingStepSets the reporting time step
setTimeRuleControlStepSets the rule-based control evaluation time step
setTimeSimulationDurationSets the simulation duration (in seconds)
setTimeStatisticsTypeSets the statistic type
setTitleSets the title lines of the project
solveCompleteHydraulicsRuns a complete hydraulic simulation with results for all time periods written to the binary Hydraulics file
solveCompleteQualityRuns a complete water quality simulation with results at uniform reporting intervals written to EPANET's binary Output file
splitPipeSplits a pipe, creating two new pipes and adds a junction/node in between
stepQualityAnalysisTimeLeftAdvances the water quality simulation one water quality time step
unloadunload library and close the EPANET Toolkit system
useHydraulicFileUses the contents of the specified file as the current binary hydraulics file
writeLineInReportFileWrites a line of text to the EPANET report file
writeReportWrites a formatted text report on simulation results to the Report file
<b> MSX Functions </b>
loadMSXFileOpens the EPANET-MSX toolkit system
unloadMSXCloses the EPANET-MSX toolkit system
addMSXPatternAdds a new, empty MSX source time pattern to the project
writeMSXFileWrite a new MSX file
initializeMSXQualityAnalysisInitializes the MSX system before solving for water quality results in step-wise fashion
getMethodsReturns all methods of epanet
getMSXComputedQualitySpecieRetrieves the quality values for specific specie (e.g getMSXComputedQualitySpecie('CL2'))
getMSXComputedLinkQualitySpecieReturns the link quality for specific specie
getMSXComputedNodeQualitySpecieReturns the node quality for specific specie
getMSXComputedQualityNodeRetrieves the concentration of a chemical species at a specific node of the network at the current simulation time step.
stepMSXQualityAnalysisTimeLeftAdvances the water quality solution through a single water quality time step when performing a step-wise simulation
saveMSXFileSaves the data associated with the current MSX project into a new MSX input file
saveMSXQualityFileSaves water quality results computed for each node, link and reporting time period to a named binary file
getMSXSourcePatternIndexRetrieves the value of all node source pattern index
getMSXLinkInitqualValueRetrieves the initial concentration of chemical species assigned to links of the pipe network
getMSXNodeInitqualValueRetrieves the initial concentration of chemical species assigned to nodes
getMSXSourceLevelRetrieves the value of all nodes source level
getMSXSourceTypeRetrieves the value of all node source type
getMSXSourceNodeNameIDRetrieves the ID label of all nodes
getMSXSpeciesCountRetrieves the number of species
getMSXSpeciesNameIDRetrieves the species IDs
getMSXSpeciesIndexRetrieves the indices of species
getMSXSpeciesTypeRetrieves the type of all species (BULK/WALL)
getMSXSpeciesUnitsRetrieves the species mass units
getMSXSpeciesATOLRetrieves the atol
getMSXSpeciesRTOLRetrieves the rtol
getMSXSpeciesConcentrationRetrieves the concentration of chemical species for nodes and links
getMSXConstantsCountRetrieves the number of constants
getMSXConstantsNameIDRetrieves the ID name of constants (given its internal index number)
getMSXConstantsIndexRetrieves the internal index number of constants (given its ID name)
getMSXPatternRetrieves the multiplier factor for all patterns and all times
getMSXPatternsCountRetrieves the number of patterns
getMSXPatternValueRetrieves the multiplier at a specific time period for a given source time pattern
getMSXPatternsNameIDRetrieves the patterns IDs
getMSXPatternsIndexRetrieves the indices of patterns
getMSXPatternsLengthsRetrieves the number of time periods in all or some patterns
getMSXParametersCountRetrieves the number of parameters
getMSXParametersNameIDRetrieves the ID name of parameters
getMSXParametersIndexRetrieves the indices of parameters
getMSXParametersPipesValueRetrieves the value of reaction parameters for pipes
getMSXParametersTanksValueRetrieves the value of reaction parameters for tanks
solveMSXCompleteHydraulicsSolves for system hydraulics over the entire simulation period saving results to an internal scratch file
solveMSXCompleteQualitySolves for water quality over the entire simulation period and saves the results to an internal scratch file
getMSXErrorReturns the text for an error message given its error code
getMSXOptionsRetrieves all the msx option parameters
getMSXTimeStepRetrieves the time step
getMSXRateUnitsRetrieves the rate/time units (SEC/MIN/HR/DAY)
getMSXAreaUnitsRetrieves the area units (FT2/M2/CM2)
getMSXCompilerRetrieves the compiler (NONE/VC/GC)
getMSXCouplingRetrieves the coupling (FULL/NONE)
getMSXAtolRetrieves the absolute concentration tolerance
getMSXRtolRetrieves the relative concentration tolerance
getMSXComputedQualitySpecieRetrieves the quality values for specific specie (e.g getMSXComputedQualitySpecie(['CL2']))
getMSXEquationsPipesRetrieves the species dynamics in pipes
getMSXEquationsTanksRetrieves the species dynamics in tanks
getMSXEquationsTermsRetrieves the species dynamics in terms
setMSXAreaUnitsCM2Sets area units to CM2
setMSXAreaUnitsFT2Sets area units to FT2
setMSXAreaUnitsM2Sets area units to M2
setMSXAtolSets the value of Atol
setMSXRtolSets the value of Rtol
setMSXCompilerGCSets compilet to GC
setMSXCompilerNONESets compiler to None
setMSXCompilerVCSets compiler to VC
setMSXCouplingFULLSets coupling option to FULL
setMSXCouplingNONESets coupling option to NONE
setMSXRateUnitsDAYSets rate units to DAY
setMSXRateUnitsHRSets rate units to HR
setMSXRateUnitsMINSets rate units to MIN
setMSXRateUnitsSECSets rate units to SEC
setMSXSolverEULSets solver to EUL (standard Euler integrator)
setMSXSolverRK5Sets solver to RK5 (Runge-Kutta 5th order integrator)
setMSXSolverROS2Sets solver to ROS2 (2nd order Rosenbrock integrator)
setMSXTimeStepSets time step
setMSXPatternValueAssigns a new value to the multiplier for a specific time period in a given MSX source time pattern
setMSXPatternSets all of the multiplier factors for a specific time pattern
setMSXParametersPipesValueAssigns a value to a particular reaction parameter for given pipes
setMSXParametersTanksValueAssigns a value to a particular reaction parameter for given tanks
setMSXConstantsValueAssigns a new value to a specific reaction constant
setMSXLinkInitqualValueAssigns an initial concentration of chemical species to links
setMSXNodeInitqualValueAssigns an initial concentration of chemical species to nodes
setMSXSourcesSets the attributes of an external source of a particular chemical species to a specific node of the pipe network
useMSXHydraulicFileUses a previously saved EPANET hydraulics file as the source of hydraulic information

List of EPANET 2.2 Functions

FunctionDescription
ENepanetRuns a complete EPANET simulation
ENaddcontrolAdds a new simple control to a project
ENaddcurveAdds a new data curve to a project
ENadddemandAppends a new demand to a junction node demands list
ENaddlinkAdds a new link to a project
ENaddnodeAdds a new node to a project
ENaddpatternAdds a new time pattern to a project
ENaddruleAdds a new rule-based control to a project
ENclearreportClears the contents of a project's report file
ENcloseCloses a project and frees all of its memory
ENcloseHCloses the hydraulic solver freeing all of its allocated memory
ENcloseQCloses the water quality solver, freeing all of its allocated memory
ENcopyreportCopies the current contents of a project's report file to another file
ENcreateprojectCopies the current contents of a project's report file to another file
ENdeletecontrolDeletes an existing simple control
ENdeletecurveDeletes a data curve from a project
ENdeletedemandDeletes a demand from a junction node
ENdeletelinkDeletes a link from the project
ENdeletenodeDeletes a node from a project
ENdeletepatternDeletes a time pattern from a project
ENdeleteprojectDeletes an EPANET project
ENdeleteruleDeletes an existing rule-based control
ENgetaveragepatternvalueRetrieves the average of all pattern factors in a time pattern
ENgetbasedemandGets the base demand for one of a node's demand categories
ENgetcommentSets a comment to a specific index
ENgetcontrolRetrieves the comment of a specific index of a type object
ENgetcoordGets the (x,y) coordinates of a node
ENgetcountRetrieves the number of objects of a given type in a project
ENgetcurveRetrieves all of a curve's data
ENgetcurveidRetrieves the ID name of a curve given its index
ENgetcurveindexRetrieves the index of a curve given its ID name
ENgetcurvelenRetrieves the number of points in a curve
ENgetcurvetypeRetrieves a curve's type
ENgetcurvevalueRetrieves the value of a single data point for a curve
ENgetdemandindexRetrieves the index of a node's named demand category
ENgetdemandmodelRetrieves the type of demand model in use and its parameters
ENgetdemandnameRetrieves the name of a node's demand category
ENgetdemandpatternRetrieves the index of a time pattern assigned to one of a node's demand categories
ENgetelseactionGets the properties of an ELSE action in a rule-based control
ENgeterrorReturns the text of an error message generated by an error code, as warning
ENgetflowunitsRetrieves a project's flow units
ENgetheadcurveindexRetrieves the curve assigned to a pump's head curve
ENgetlinkidGets the ID name of a link given its index
ENgetlinkindexGets the index of a link given its ID name
ENgetlinknodesGets the indexes of a link's start- and end-nodes
ENgetlinktypeRetrieves a link's type
ENgetlinkvalueRetrieves a property value for a link
ENgetnodeidGets the ID name of a node given its index
ENgetnodeindexGets the index of a node given its ID name
ENgetnodetypeRetrieves a node's type given its index
ENgetnodevalueRetrieves a property value for a node
ENgetnumdemandsRetrieves the number of demand categories for a junction node
ENgetoptionRetrieves the value of an analysis option
ENgetpatternidRetrieves the ID name of a time pattern given its index
ENgetpatternindexRetrieves the index of a time pattern given its ID name
ENgetpatternlenRetrieves the number of time periods in a time pattern
ENgetpatternvalueRetrieves a time pattern's factor for a given time period
ENgetpremiseGets the properties of a premise in a rule-based control
ENgetpumptypeRetrieves the type of head curve used by a pump
ENgetqualinfoGets information about the type of water quality analysis requested
ENgetqualtypeRetrieves the type of water quality analysis to be run
ENgetresultindexRetrieves the order in which a node or link appears in an output file
ENgetruleRetrieves summary information about a rule-based control
ENgetruleIDGets the ID name of a rule-based control given its index
ENgetstatisticRetrieves a particular simulation statistic
ENgetthenactionGets the properties of a THEN action in a rule-based control
ENgettimeparamRetrieves the value of a time parameter
ENgettitleRetrieves the title lines of the project
ENgetversionRetrieves the toolkit API version number
ENgetvertexRetrieves the coordinate's of a vertex point assigned to a link
ENgetvertexcountRetrieves the number of internal vertex points assigned to a link
ENinitInitializes an EPANET project
ENinitHInitializes a network prior to running a hydraulic analysis
ENinitQInitializes a network prior to running a water quality analysis
ENnextHDetermines the length of time until the next hydraulic event occurs in an extended period simulation
ENnextQAdvances a water quality simulation over the time until the next hydraulic event
ENopenOpens an EPANET input file & reads in network data
ENopenHOpens a project's hydraulic solver
ENopenQOpens a project's water quality solver
ENreportWrites simulation results in a tabular format to a project's report file
ENresetreportResets a project's report options to their default values
ENrunHComputes a hydraulic solution for the current point in time
ENrunQMakes hydraulic and water quality results at the start of the current time period available to a project's water quality solver
ENsaveHTransfers a project's hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals
ENsavehydfileSaves a project's temporary hydraulics file to disk
ENsaveinpfileSaves a project's data to an EPANET-formatted text file
ENsetbasedemandSets the base demand for one of a node's demand categories
ENsetcommentSets a comment to a specific index
ENsetcontrolSets the properties of an existing simple control
ENsetcoordSets the (x,y) coordinates of a node
ENsetcurveAssigns a set of data points to a curve
ENsetcurveidChanges the ID name of a data curve given its index
ENsetcurvevalueSets the value of a single data point for a curve
ENsetdemandmodelSets the Type of demand model to use and its parameters
ENsetdemandnameAssigns a name to a node's demand category
ENsetdemandpatternSets the index of a time pattern used for one of a node's demand categories
ENsetelseactionSets the properties of an ELSE action in a rule-based control
ENsetflowunitsSets a project's flow units
ENsetheadcurveindexAssigns a curve to a pump's head curve
ENsetjuncdataSets a group of properties for a junction node
ENsetlinkidChanges the ID name of a link
ENsetlinknodesSets the indexes of a link's start- and end-nodes
ENsetlinktypeChanges a link's type
ENsetlinkvalueSets a property value for a link
ENsetnodeidChanges the ID name of a node
ENsetnodevalueSets a property value for a node
ENsetoptionSets the value for an anlysis option
ENsetpatternSets the pattern factors for a given time pattern
ENsetpatternidChanges the ID name of a time pattern given its index
ENsetpatternvalueSets a time pattern's factor for a given time period
ENsetpipedataSets a group of properties for a pipe link
ENsetpremiseSets the properties of a premise in a rule-based control
ENsetpremiseindexSets the index of an object in a premise of a rule-based control
ENsetpremisestatusSets the status being compared to in a premise of a rule-based control
ENsetpremisevalueSets the value in a premise of a rule-based control
ENsetqualtypeSets the type of water quality analysis to run
ENsetreportProcesses a reporting format command
ENsetruleprioritySets the priority of a rule-based control
ENsetstatusreportSets the level of hydraulic status reporting
ENsettankdataSets a group of properties for a tank node
ENsetthenactionSets the properties of a THEN action in a rule-based control
ENsettimeparamSets the value of a time parameter
ENsettitleSets the title lines of the project
ENsetverticesAssigns a set of internal vertex points to a link
ENsolveHRuns a complete hydraulic simulation with results for all time periods written to a temporary hydraulics file
ENsolveQRuns a complete water quality simulation with results at uniform reporting intervals written to the project's binary output file
ENstepQAdvances a water quality simulation by a single water quality time step
ENusehydfileUses a previously saved binary hydraulics file to supply a project's hydraulics
ENwritelineWrites a line of text to a project's report file

Back to top