ENepanet#
module wntr.epanet.toolkit
- class ENepanet[source]#
Bases:
object
Wrapper class to load the EPANET DLL object, then perform operations on the EPANET object that is created when a file is loaded.
This simulator is thread safe only for EPANET version=2.2.
- Parameters:
- ENdeletecontrol(iControlIndex)[source]#
Delete a control.
- Parameters:
iControlIndex (int) – the simple control to delete
- ENgetcontrol(iIndex)[source]#
Get values defined by a control.
- Parameters:
iIndex (int) – the control number
- ENgetflowunits()[source]#
Retrieves flow units code
- Return type:
Code of flow units in use (see toolkit.optFlowUnits)
- ENgetlinkindex(sId)[source]#
Retrieves index of a link with specific ID
- Parameters:
sId (int) – Link ID
- Return type:
Index of link in list of links
- ENgetnodeindex(sId)[source]#
Retrieves index of a node with specific ID
- Parameters:
sId (int) – Node ID
- Return type:
Index of node in list of nodes
- ENgettimeparam(eParam)[source]#
Get a time parameter value
- Parameters:
eParam (int) – the time parameter to get
- Returns:
the value of the time parameter, in seconds
- Return type:
long
- ENinitH(iFlag)[source]#
Initializes hydraulic analysis
- Parameters:
iFlag (2-digit flag) – 2-digit flag where 1st (left) digit indicates if link flows should be re-initialized (1) or not (0) and 2nd digit indicates if hydraulic results should be saved to file (1) or not (0)
- ENinitQ(iSaveflag)[source]#
Initializes water quality analysis
- Parameters:
iSaveflag (int) – EN_SAVE (1) if results saved to file, EN_NOSAVE (0) if not
- ENnextH()[source]#
Determines time until next hydraulic event
This function is used in a loop with ENrunH() to run an extended period hydraulic simulation. See ENsolveH() for an example.
- Returns:
Time (seconds) until next hydraulic event (0 marks end of simulation period)
- Return type:
- ENnextQ()[source]#
Advances water quality simulation to next hydraulic event
This function is used in a loop with ENrunQ() to run an extended period water quality simulation. See ENsolveQ() for an example.
- Returns:
Time (seconds) until next hydraulic event (0 marks end of simulation period)
- Return type:
- ENopen(inpfile=None, rptfile=None, binfile=None)[source]#
Opens an EPANET input file and reads in network data
- ENrunH()[source]#
Solves hydraulics for conditions at time t
This function is used in a loop with ENnextH() to run an extended period hydraulic simulation. See ENsolveH() for an example.
- Returns:
Current simulation time (seconds)
- Return type:
- ENrunQ()[source]#
Retrieves hydraulic and water quality results at time t
This function is used in a loop with ENnextQ() to run an extended period water quality simulation. See ENsolveQ() for an example.
- Returns:
Current simulation time (seconds)
- Return type:
- ENsaveH()[source]#
Solves for network hydraulics in all time periods
Must be called before ENreport() if no water quality simulation made. Should not be called if ENsolveQ() will be used.
- ENsavehydfile(filename)[source]#
Copies binary hydraulics file to disk
- Parameters:
filename (str) – Name of hydraulics file to output
- ENsaveinpfile(inpfile)[source]#
Saves EPANET input file
- Parameters:
inpfile (str) – EPANET INP output file
- ENsetcontrol(iIndex, iType, iLinkIndex, dSetting, iNodeIndex, dLevel)[source]#
Change values on a simple control
- Parameters:
Warning
There is an error in EPANET 2.2 that sets the dLevel parameter to 0.0 on Macs regardless of the value the user passes in. This means that to use this toolkit functionality on a Mac, the user must delete and create a new control to change the level.
- ENsettimeparam(eParam, lValue)[source]#
Set a time parameter value
- Parameters:
eParam (int) – the time parameter to set
lValue (long) – the value to set, in seconds