epyt package
Subpackages
- epyt.src package
- Submodules
- epyt.src.epanetapi module
epanetapiepanetapi.EN_MAXIDepanetapi.__init__()epanetapi.errcodeepanetapi.inpfileepanetapi.rptfileepanetapi.binfileepanetapi.solveepanetapi.LibEPANETepanetapi.LibEPANETpathepanetapi.libepanetapi.ENepanet()epanetapi.ENaddcontrol()epanetapi.ENaddcurve()epanetapi.ENadddemand()epanetapi.ENaddlink()epanetapi.ENaddnode()epanetapi.ENaddpattern()epanetapi.ENaddrule()epanetapi.ENclearreport()epanetapi.ENclose()epanetapi.ENcloseH()epanetapi.ENcloseQ()epanetapi.ENcopyreport()epanetapi.ENcreateproject()epanetapi.ENdeletecontrol()epanetapi.ENdeletecurve()epanetapi.ENdeletedemand()epanetapi.ENdeletelink()epanetapi.ENdeletenode()epanetapi.ENdeletepattern()epanetapi.ENdeleteproject()epanetapi.ENdeleterule()epanetapi.ENgetaveragepatternvalue()epanetapi.ENgetbasedemand()epanetapi.ENgetcomment()epanetapi.ENgetcontrol()epanetapi.ENgetcoord()epanetapi.ENgetcount()epanetapi.ENgetcurve()epanetapi.ENgetcurveid()epanetapi.ENgetcurveindex()epanetapi.ENgetcurvelen()epanetapi.ENgetcurvetype()epanetapi.ENsetcurvetype()epanetapi.ENsetvertex()epanetapi.ENtimetonextevent()epanetapi.ENgetcontrolenabled()epanetapi.ENsetcontrolenabled()epanetapi.ENgetruleenabled()epanetapi.ENsetruleenabled()epanetapi.ENopenX()epanetapi.ENgetlinkvalues()epanetapi.ENloadpatternfile()epanetapi.ENgetcurvevalue()epanetapi.ENgetdemandindex()epanetapi.ENgetdemandmodel()epanetapi.ENgetdemandname()epanetapi.ENgetdemandpattern()epanetapi.ENgetelseaction()epanetapi.ENgeterror()epanetapi.ENgetflowunits()epanetapi.ENgetheadcurveindex()epanetapi.ENgetlinkid()epanetapi.ENgetlinkindex()epanetapi.ENgetlinknodes()epanetapi.ENgetlinktype()epanetapi.ENgetlinkvalue()epanetapi.ENgetnodeid()epanetapi.ENgetnodeindex()epanetapi.ENgetnodetype()epanetapi.ENgetnodevalue()epanetapi.ENgetnodevalues()epanetapi.ENgetnumdemands()epanetapi.ENgetoption()epanetapi.ENgetpatternid()epanetapi.ENgetpatternindex()epanetapi.ENgetpatternlen()epanetapi.ENgetpatternvalue()epanetapi.ENgetpremise()epanetapi.ENgetpumptype()epanetapi.ENgetqualinfo()epanetapi.ENgetqualtype()epanetapi.ENgetresultindex()epanetapi.ENgetrule()epanetapi.ENgetruleID()epanetapi.ENgetstatistic()epanetapi.ENgetthenaction()epanetapi.ENgettimeparam()epanetapi.ENgettitle()epanetapi.ENgetversion()epanetapi.ENgetvertex()epanetapi.ENgetvertexcount()epanetapi.ENinit()epanetapi.ENinitH()epanetapi.ENinitQ()epanetapi.ENnextH()epanetapi.ENnextQ()epanetapi.ENopen()epanetapi.ENopenH()epanetapi.ENopenQ()epanetapi.ENreport()epanetapi.ENresetreport()epanetapi.ENrunH()epanetapi.ENrunQ()epanetapi.ENsaveH()epanetapi.ENsavehydfile()epanetapi.ENsaveinpfile()epanetapi.ENsetbasedemand()epanetapi.ENsetcomment()epanetapi.ENsetcontrol()epanetapi.ENsetcoord()epanetapi.ENsetcurve()epanetapi.ENsetcurveid()epanetapi.ENsetcurvevalue()epanetapi.ENsetdemandmodel()epanetapi.ENsetdemandname()epanetapi.ENsetdemandpattern()epanetapi.ENsetelseaction()epanetapi.ENsetflowunits()epanetapi.ENsetheadcurveindex()epanetapi.ENsetjuncdata()epanetapi.ENsetlinkid()epanetapi.ENsetlinknodes()epanetapi.ENsetlinktype()epanetapi.ENsetlinkvalue()epanetapi.ENsetnodeid()epanetapi.ENsetnodevalue()epanetapi.ENsetoption()epanetapi.ENsetpattern()epanetapi.ENsetpatternid()epanetapi.ENsetpatternvalue()epanetapi.ENsetpipedata()epanetapi.ENsetpremise()epanetapi.ENsetpremiseindex()epanetapi.ENsetpremisestatus()epanetapi.ENsetpremisevalue()epanetapi.ENsetqualtype()epanetapi.ENsetreport()epanetapi.ENsetrulepriority()epanetapi.ENsetstatusreport()epanetapi.ENsettankdata()epanetapi.ENsetthenaction()epanetapi.ENsettimeparam()epanetapi.ENsettitle()epanetapi.ENsetvertices()epanetapi.ENsolveH()epanetapi.ENsolveQ()epanetapi.ENstepQ()epanetapi.ENusehydfile()epanetapi.ENwriteline()
- epyt.src.epanetconstants module
EpanetConstantsEpanetConstants.__init__()EpanetConstants.EN_MAXIDEpanetConstants.EN_MAXMSGEpanetConstants.EN_ELEVATIONEpanetConstants.EN_BASEDEMANDEpanetConstants.EN_PATTERNEpanetConstants.EN_EMITTEREpanetConstants.EN_INITQUALEpanetConstants.EN_SOURCEQUALEpanetConstants.EN_SOURCEPATEpanetConstants.EN_SOURCETYPEEpanetConstants.EN_TANKLEVELEpanetConstants.EN_DEMANDEpanetConstants.EN_HEADEpanetConstants.EN_PRESSUREEpanetConstants.EN_QUALITYEpanetConstants.EN_SOURCEMASSEpanetConstants.EN_INITVOLUMEEpanetConstants.EN_MIXMODELEpanetConstants.EN_MIXZONEVOLEpanetConstants.EN_TANKDIAMEpanetConstants.EN_MINVOLUMEEpanetConstants.EN_VOLCURVEEpanetConstants.EN_MINLEVELEpanetConstants.EN_MAXLEVELEpanetConstants.EN_MIXFRACTIONEpanetConstants.EN_TANK_KBULKEpanetConstants.EN_TANKVOLUMEEpanetConstants.EN_MAXVOLUMEEpanetConstants.EN_CANOVERFLOWEpanetConstants.EN_DEMANDDEFICITEpanetConstants.EN_NODE_INCONTROLEpanetConstants.EN_EMITTERFLOWEpanetConstants.EN_LEAKAGEFLOWEpanetConstants.EN_DEMANDFLOWEpanetConstants.EN_FULLDEMANDEpanetConstants.EN_DIAMETEREpanetConstants.EN_LENGTHEpanetConstants.EN_ROUGHNESSEpanetConstants.EN_MINORLOSSEpanetConstants.EN_INITSTATUSEpanetConstants.EN_INITSETTINGEpanetConstants.EN_KBULKEpanetConstants.EN_KWALLEpanetConstants.EN_FLOWEpanetConstants.EN_VELOCITYEpanetConstants.EN_HEADLOSSEpanetConstants.EN_STATUSEpanetConstants.EN_SETTINGEpanetConstants.EN_ENERGYEpanetConstants.EN_LINKQUALEpanetConstants.EN_LINKPATTERNEpanetConstants.EN_PUMP_STATEEpanetConstants.EN_PUMP_EFFICEpanetConstants.EN_PUMP_POWEREpanetConstants.EN_PUMP_HCURVEEpanetConstants.EN_PUMP_ECURVEEpanetConstants.EN_PUMP_ECOSTEpanetConstants.EN_PUMP_EPATEpanetConstants.EN_LINK_INCONTROLEpanetConstants.EN_GPV_CURVEEpanetConstants.EN_PCV_CURVEEpanetConstants.EN_LEAK_AREAEpanetConstants.EN_LEAK_EXPANEpanetConstants.EN_LINK_LEAKAGEEpanetConstants.EN_DURATIONEpanetConstants.EN_HYDSTEPEpanetConstants.EN_QUALSTEPEpanetConstants.EN_PATTERNSTEPEpanetConstants.EN_PATTERNSTARTEpanetConstants.EN_REPORTSTEPEpanetConstants.EN_REPORTSTARTEpanetConstants.EN_RULESTEPEpanetConstants.EN_STATISTICEpanetConstants.EN_PERIODSEpanetConstants.EN_STARTTIMEEpanetConstants.EN_HTIMEEpanetConstants.EN_QTIMEEpanetConstants.EN_HALTFLAGEpanetConstants.EN_NEXTEVENTEpanetConstants.EN_NEXTEVENTTANKEpanetConstants.EN_NODECOUNTEpanetConstants.EN_TANKCOUNTEpanetConstants.EN_LINKCOUNTEpanetConstants.EN_PATCOUNTEpanetConstants.EN_CURVECOUNTEpanetConstants.EN_CONTROLCOUNTEpanetConstants.EN_RULECOUNTEpanetConstants.EN_JUNCTIONEpanetConstants.EN_RESERVOIREpanetConstants.EN_TANKEpanetConstants.EN_CVPIPEEpanetConstants.EN_PIPEEpanetConstants.EN_PUMPEpanetConstants.EN_PRVEpanetConstants.EN_PSVEpanetConstants.EN_PBVEpanetConstants.EN_FCVEpanetConstants.EN_TCVEpanetConstants.EN_GPVEpanetConstants.EN_PCVEpanetConstants.EN_NONEEpanetConstants.EN_CHEMEpanetConstants.EN_AGEEpanetConstants.EN_TRACEEpanetConstants.EN_CONCENEpanetConstants.EN_MASSEpanetConstants.EN_SETPOINTEpanetConstants.EN_FLOWPACEDEpanetConstants.EN_CFSEpanetConstants.EN_GPMEpanetConstants.EN_MGDEpanetConstants.EN_IMGDEpanetConstants.EN_AFDEpanetConstants.EN_LPSEpanetConstants.EN_LPMEpanetConstants.EN_MLDEpanetConstants.EN_CMHEpanetConstants.EN_CMDEpanetConstants.EN_CMSEpanetConstants.EN_PSIEpanetConstants.EN_KPAEpanetConstants.EN_METERSEpanetConstants.EN_DDAEpanetConstants.EN_PDAEpanetConstants.EN_TRIALSEpanetConstants.EN_ACCURACYEpanetConstants.EN_TOLERANCEEpanetConstants.EN_EMITEXPONEpanetConstants.EN_DEMANDMULTEpanetConstants.EN_HEADERROREpanetConstants.EN_FLOWCHANGEEpanetConstants.EN_HEADLOSSFORMEpanetConstants.EN_GLOBALEFFICEpanetConstants.EN_GLOBALPRICEEpanetConstants.EN_GLOBALPATTERNEpanetConstants.EN_DEMANDCHARGEEpanetConstants.EN_SP_GRAVITYEpanetConstants.EN_SP_VISCOSEpanetConstants.EN_UNBALANCEDEpanetConstants.EN_CHECKFREQEpanetConstants.EN_MAXCHECKEpanetConstants.EN_DAMPLIMITEpanetConstants.EN_SP_DIFFUSEpanetConstants.EN_BULKORDEREpanetConstants.EN_WALLORDEREpanetConstants.EN_TANKORDEREpanetConstants.EN_CONCENLIMITEpanetConstants.EN_DEMANDPATTERNEpanetConstants.EN_EMITBACKFLOWEpanetConstants.EN_PRESS_UNITSEpanetConstants.EN_STATUS_REPORTEpanetConstants.EN_LOWLEVELEpanetConstants.EN_HILEVELEpanetConstants.EN_TIMEREpanetConstants.EN_TIMEOFDAYEpanetConstants.EN_AVERAGEEpanetConstants.EN_MINIMUMEpanetConstants.EN_MAXIMUMEpanetConstants.EN_RANGEEpanetConstants.EN_MIX1EpanetConstants.EN_MIX2EpanetConstants.EN_FIFOEpanetConstants.EN_LIFOEpanetConstants.EN_NOSAVEEpanetConstants.EN_SAVEEpanetConstants.EN_INITFLOWEpanetConstants.EN_SAVE_AND_INITEpanetConstants.EN_CONST_HPEpanetConstants.EN_POWER_FUNCEpanetConstants.EN_CUSTOMEpanetConstants.EN_NOCURVEEpanetConstants.EN_VOLUME_CURVEEpanetConstants.EN_PUMP_CURVEEpanetConstants.EN_EFFIC_CURVEEpanetConstants.EN_HLOSS_CURVEEpanetConstants.EN_GENERIC_CURVEEpanetConstants.EN_VALVE_CURVEEpanetConstants.EN_UNCONDITIONALEpanetConstants.EN_CONDITIONALEpanetConstants.EN_NO_REPORTEpanetConstants.EN_NORMAL_REPORTEpanetConstants.EN_FULL_REPORTEpanetConstants.EN_NODEEpanetConstants.EN_LINKEpanetConstants.EN_TIMEPATEpanetConstants.EN_CURVEEpanetConstants.EN_CONTROLEpanetConstants.EN_RULEEpanetConstants.EN_HWEpanetConstants.EN_DWEpanetConstants.EN_CMEpanetConstants.EN_R_NODEEpanetConstants.EN_R_LINKEpanetConstants.EN_R_SYSTEMEpanetConstants.EN_R_DEMANDEpanetConstants.EN_R_HEADEpanetConstants.EN_R_GRADEEpanetConstants.EN_R_LEVELEpanetConstants.EN_R_PRESSUREEpanetConstants.EN_R_FLOWEpanetConstants.EN_R_STATUSEpanetConstants.EN_R_SETTINGEpanetConstants.EN_R_POWEREpanetConstants.EN_R_TIMEEpanetConstants.EN_R_CLOCKTIMEEpanetConstants.EN_R_FILLTIMEEpanetConstants.EN_R_DRAINTIMEEpanetConstants.EN_ITERATIONSEpanetConstants.EN_RELATIVEERROREpanetConstants.EN_MAXHEADERROREpanetConstants.EN_MAXFLOWCHANGEEpanetConstants.EN_MASSBALANCEEpanetConstants.EN_DEFICIENTNODESEpanetConstants.EN_DEMANDREDUCTIONEpanetConstants.EN_LEAKAGELOSSEpanetConstants.EN_R_IS_OPENEpanetConstants.EN_R_IS_CLOSEDEpanetConstants.EN_R_IS_ACTIVEEpanetConstants.EN_STEP_REPORTEpanetConstants.EN_STEP_HYDEpanetConstants.EN_STEP_WQEpanetConstants.EN_STEP_TANKEVENTEpanetConstants.EN_STEP_CONTROLEVENTEpanetConstants.EN_MISSINGEpanetConstants.EN_SET_CLOSEDEpanetConstants.EN_SET_OPENEpanetConstants.MSX_NODEEpanetConstants.MSX_LINKEpanetConstants.MSX_TANKEpanetConstants.MSX_SPECIESEpanetConstants.MSX_TERMEpanetConstants.MSX_PARAMETEREpanetConstants.MSX_CONSTANTEpanetConstants.MSX_PATTERNEpanetConstants.MSX_BULKEpanetConstants.MSX_WALLEpanetConstants.MSX_NOSOURCEEpanetConstants.MSX_CONCENEpanetConstants.MSX_MASSEpanetConstants.MSX_SETPOINTEpanetConstants.MSX_FLOWPACED
- epyt.src.epanetmsxapi module
epanetmsxapiepanetmsxapi.__init__()epanetmsxapi.MSXopen()epanetmsxapi.MSXclose()epanetmsxapi.MSXerror()epanetmsxapi.MSXgetindex()epanetmsxapi.MSXgetID()epanetmsxapi.MSXgetIDlen()epanetmsxapi.MSXgetspecies()epanetmsxapi.MSXgetcount()epanetmsxapi.MSXgetconstant()epanetmsxapi.MSXgetparameter()epanetmsxapi.MSXgetpatternlen()epanetmsxapi.MSXgetpatternvalue()epanetmsxapi.MSXgetinitqual()epanetmsxapi.MSXgetsource()epanetmsxapi.MSXsaveoutfile()epanetmsxapi.MSXsavemsxfile()epanetmsxapi.MSXsetconstant()epanetmsxapi.MSXsetparameter()epanetmsxapi.MSXsetinitqual()epanetmsxapi.MSXsetpattern()epanetmsxapi.MSXsetpatternvalue()epanetmsxapi.MSXsolveQ()epanetmsxapi.MSXsolveH()epanetmsxapi.MSXaddpattern()epanetmsxapi.MSXusehydfile()epanetmsxapi.MSXstep()epanetmsxapi.MSXinit()epanetmsxapi.MSXreport()epanetmsxapi.MSXgetqual()epanetmsxapi.MSXsetsource()epanetmsxapi.MSXgeterror()epanetmsxapi.MSXgetoptions()epanetmsxapi.suppressepanetmsxapi.osepanetmsxapi.warningsepanetmsxapi.copy2()epanetmsxapi.MSXsetoptions()
- epyt.src.epyt_enums module
- Module contents
Submodules
epyt.epanet module
EPANET-Python Toolkit (EPyT): A Python toolkit for EPANET libraries
How to run:
from epyt import epanet
d = epanet(‘Net1.inp’)
EPANET is software that models water distribution piping systems developed by the US EPA and provided under a public domain licence. This python toolkit serves as an interface between Python and EPANET, to assist researchers and the industry when solving problems related with water distribution systems.
EPANET was developed by the Water Supply and Water Resources Division of the U.S. Environmental Protection Agency’s National Risk Management Research Laboratory. EPANET is under the Public Domain.
The latest EPANET files can downloaded at: https://github.com/OpenWaterAnalytics/EPANET
Inspired by: EPANET-MATLAB Toolkit D.G. Eliades, M. Kyriakou, S. Vrachimis and M.M. Polycarpou, “EPANET-MATLAB Toolkit: An Open-Source Software for Interfacing EPANET with MATLAB”, in Proc. 14th International Conference on Computing and Control for the Water Industry (CCWI), The Netherlands, Nov 2016, p.8. (doi:10.5281/zenodo.831493)
Other python packages related to the EPANET engine: wntr Klise, K.A., Murray, R., Haxton, T. (2018). An overview of the Water Network Tool for Resilience (WNTR), In Proceedings of the 1st International WDSA/CCWI Joint Conference, Kingston, Ontario, Canada, July 23-25, 075, 8p.
epanet-python https://github.com/OpenWaterAnalytics/epanet-python
EPANET-Python Toolkit Licence:
Copyright 2022 KIOS Research and Innovation Center of Excellence (KIOS CoE), University of Cyprus (www.kios.org.cy)
Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent libepanets of the EUPL (the “Licence”) You may not use this work except in compliance with the Licence. You may obtain a copy of the Licence at:
https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an “AS IS” basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence for the specific language governing permissions and limitations under the Licence.
- class epyt.epanet.EpytValues[source]
Bases:
object- disp()[source]
Displays the values on the command window
- Parameters:
self (EpytValues class) – Values to be printed on the command window
- Returns:
None
- to_dict()[source]
Transform EpytValues class values to dict format
- Parameters:
self (EpytValues class) – Values to add in the dictionary
- Returns:
dictionary with the values
- Return type:
dict
- to_excel(filename=None, attributes=None, allValues=False, node_id_list=None, link_id_list=None, both=False, header=True)[source]
Save to an Excel file the values of EpytValues class.
- Parameters:
filename (str, optional) – Excel filename, defaults to None
attributes (str or list of str, optional) – Attributes to add to the file, defaults to None
allValues (bool, optional) – If True, writes all the values into a separate “All values” sheet, defaults to False
node_id_list (list or np.ndarray, optional) – Array of IDs for node-related attributes
link_id_list (list or np.ndarray, optional) – Array of IDs for link-related attributes
both (bool, optional) – If True, and ID array available, print both ‘Index’ and ‘Id’. If no ID array, just Index. If False and ID array available, print only ‘Id’; if no ID array, print only ‘Index’.
header (bool, optional) – If False, remove the first row from all sheets and do not write column headers
- Returns:
None
- to_json(filename=None)[source]
Transforms val class values to json object and saves them to a json file if filename is provided
- Parameters:
self (val class) – Values to add in the json file
filename (str, optional) – json filename, defaults to None
- Returns:
the json object with the values
- Return type:
json object
- class epyt.epanet.epanet(*argv, version=2.3, ph=False, loadfile=False, customlib=None, display_msg=True, display_warnings=True, createinp=False)[source]
Bases:
objectEPyt main functions class
- Example with custom library
epanetlib=os.path.join(os.getcwd(), ‘epyt’,’libraries’,’win’,’epanet2.dll’) d = epanet(inpname, msx=True,customlib=epanetlib)
- __init__(*argv, version=2.3, ph=False, loadfile=False, customlib=None, display_msg=True, display_warnings=True, createinp=False)[source]
- addControls(control, *argv)[source]
Adds a new simple control.
- Parameters:
control (float or list) – New Control
- Returns:
Control index
- Return type:
int
The examples are based on d = epanet(‘Net1.inp’)
Example 1: Close Link 12 if the level in Tank 2 exceeds 20 ft.
>>> index = d.addControls('LINK 12 CLOSED IF NODE 2 ABOVE 20') >>> d.getControls(index).disp()
Example 2: Open Link 12 if the pressure at Node 11 is under 30 psi.
>>> index = d.addControls('LINK 12 OPEN IF NODE 11 BELOW 30') >>> d.getControls(index).disp()
Example 3: Pump 9 speed is set to 1.5 at 16 hours or 57600 seconds into the simulation.
>>> index = d.addControls('LINK 9 1.5 AT TIME 16:00') >>> d.getControls(index).disp() >>> index = d.addControls('LINK 9 1.5 AT TIME 57600') #in seconds >>> d.getControls(index).disp()
Example 4: Link 12 is closed at 10 am and opened at 8 pm throughout the simulation.
>>> index_3 = d.addControls('LINK 12 CLOSED AT CLOCKTIME 10:00') >>> d.getControls(index_3).disp() >>> index_4 = d.addControls('LINK 12 OPEN AT CLOCKTIME 20:00') >>> d.getControls(index_4).disp()
Example 5: Adds multiple controls given as cell.
>>> d = epanet("Net1.inp") >>> control_1 = 'LINK 9 OPEN IF NODE 2 BELOW 110' >>> control_2 = 'LINK 9 CLOSED IF NODE 2 ABOVE 200' >>> controls = [control_1, control_2] >>> index = d.addControls(controls) >>> d.getControls(index)[0].Control >>> d.getControls(index)[1].Control
Example 6:
- Notes:
index: return index of the new control.
Type: the type of control to add (see EN_ControlType).
linkIndex: the index of a link to control (starting from 1).
setting: control setting applied to the link.
nodeIndex: index of the node used to control the link
(0 for EN_TIMER and EN_TIMEOFDAY controls). * level: action level (tank level, junction pressure, or time in seconds) that triggers the control.
- Control type codes consist of the following:
EN_LOWLEVEL 0 Control applied when tank level or node
pressure drops below specified level * EN_HILEVEL 1 Control applied when tank level or node pressure rises above specified level * EN_TIMER 2 Control applied at specific time into simulation * EN_TIMEOFDAY 3 Control applied at specific time of day
Code example: index = d.addControls(type, linkIndex, setting, nodeIndex, level)
>>> index = d.addControls(0, 13, 0, 11, 100) # retrieve controls of index in dict format >>> d.getControls(index).to_dict()
See also deleteControls, getControls, setControls, getControlCount.
- addCurve(*argv)[source]
Adds a new curve appended to the end of the existing curves. Returns the new curve’s index.
- Parameters:
*argv –
value index or value
- Raises:
No curve ID or curve values exist
- Returns:
new curve valueIndex
- Return type:
int
Example: ID selected without a space in between the letters
>>> new_curve_ID = 'NewCurve' >>> x_y_1 = [0, 730] >>> x_y_2 = [1000, 500] >>> x_y_3 = [1350, 260] # X and Y values selected >>> values = [x_y_1, x_y_2, x_y_3] # New curve added >>> curve_index = d.addCurve(new_curve_ID, values) # Retrieves all the info of curves >>> d.getCurvesInfo().disp()
See also getCurvesInfo, getCurveType, setCurve,setCurveValue, setCurveNameID, setCurveComment.
- addLinkPipe(pipeID, fromNode, toNode, *argv)[source]
Adds a new pipe. Returns the index of the new pipe.
- Properties that can be set(optional):
Length
Diameter
Roughness Coefficient
Minor Loss Coefficient
- If no properties are given, the default values are:
length = 330 feet (~100.5 m)
diameter = 10 inches (25.4 cm)
- roughness coefficient = 130 (Hazen-Williams formula) or
0.15 mm (Darcy-Weisbach formula) or 0.01 (Chezy-Manning formula)
minor Loss Coefficient = 0
The examples are based on d = epanet(“Net1.inp”)
Example 1: Adds a new pipe given no properties.
>>> pipeID = 'newPipe_1' >>> fromNode = '10' >>> toNode = '21' # Retrieves the number of links >>> d.getLinkPipeCount() >>> pipeIndex = d.addLinkPipe(pipeID, fromNode, toNode) >>> d.getLinkPipeCount() >>> d.plot()
Example 2: Adds a new pipe given it’s length.
>>> pipeID = 'newPipe_2' >>> fromNode = '11' >>> toNode = '22' >>> length = 600 >>> d.getLinkPipeCount() >>> pipeIndex = d.addLinkPipe(pipeID, fromNode, toNode, length) >>> d.getLinkPipeCount() # Retrieves the new link's length >>> d.getLinkLength(pipeIndex) >>> d.plot()
Example 3: Adds a new pipe given it’s length, diameter, roughness coefficient and minor loss coefficient.
>>> pipeID = 'newPipe_3' >>> fromNode = '31' >>> toNode = '22' >>> length = 500 >>> diameter = 15 >>> roughness = 120 >>> minorLossCoeff = 0.2 >>> d.getLinkPipeCount() >>> pipeIndex = d.addLinkPipe(pipeID, fromNode, toNode, length, >>> diameter, roughness, minorLossCoeff) >>> d.getLinkPipeCount() >>> d.getLinkLength(pipeIndex) # Retrieves the new link's diameter >>> d.getLinkDiameter(pipeIndex) # Retrieves the new link's roughness coefficient >>> d.getLinkRoughnessCoeff(pipeIndex) # Retrieves the new link's minor loss coefficient >>> d.getLinkMinorLossCoeff(pipeIndex) >>> d.plot()
See also plot, setLinkNodesIndex, addLinkPipeCV, addNodeJunction, deleteLink, setLinkDiameter.
- addLinkPipeCV(cvpipeID, fromNode, toNode, *argv)[source]
Adds a new control valve pipe. Returns the index of the new control valve pipe.
- Properties that can be set(optional):
Length
Diameter
Roughness Coefficient
Minor Loss Coefficient
- If no properties are given, the default values are:
length = 330 feet (~100.5 m)
diameter = 10 inches (25.4 cm)
- roughness coefficient = 130 (Hazen-Williams formula) or
0.15 mm (Darcy-Weisbach formula) or 0.01 (Chezy-Manning formula)
minor Loss Coefficient = 0
The examples are based on d = epanet(‘Net1.inp’)
Example 1: Adds a new control valve pipe given no properties.
>>> cvPipeID = 'newCVPipe_1' >>> fromNode = '10' >>> toNode = '21' # Retrieves the number of pipes >>> d.getLinkPipeCount() >>> cvPipeIndex = d.addLinkPipeCV(cvPipeID, fromNode, toNode) >>> d.getLinkPipeCount() # Plots the network in a new figure >>> d.plot()
Example 2: Adds a new control valve pipe given it’s length.
>>> cvPipeID = 'newCVPipe_2' >>> fromNode = '11' >>> toNode = '22' >>> length = 600 >>> d.getLinkPipeCount() >>> cvPipeIndex = d.addLinkPipeCV(cvPipeID, fromNode, toNode, length) >>> d.getLinkPipeCount() # Retrieves the new link's length >>> d.getLinkLength(cvPipeIndex) >>> d.plot()
Example 3: Adds a new control valve pipe given it’s length, diameter, roughness coefficient and minor loss coefficient.
>>> cvPipeID = 'newCVPipe_3' >>> fromNode = '31' >>> toNode = '22' >>> length = 500 >>> diameter = 15 >>> roughness = 120 >>> minorLossCoeff = 0.2 >>> d.getLinkPipeCount() >>> cvPipeIndex = d.addLinkPipeCV(cvPipeID, fromNode, toNode, length, >>> diameter, roughness, minorLossCoeff) >>> d.getLinkPipeCount() >>> d.getLinkLength(cvPipeIndex) # Retrieves the new link's diameter >>> d.getLinkDiameter(cvPipeIndex) # Retrieves the new link's roughness coefficient >>> d.getLinkRoughnessCoeff(cvPipeIndex) # Retrieves the new link's minor loss coefficient >>> d.getLinkMinorLossCoeff(cvPipeIndex) >>> d.plot()
See also plot, setLinkNodesIndex, addLinkPipe, addNodeJunction, deleteLink, setLinkDiameter.
- addLinkPump(pumpID, fromNode, toNode, *argv)[source]
Adds a new pump. Returns the index of the new pump.
Parameters
- pumpIDstring
Pump ID.
- fromNodenumeric
Starting node.
- toNodenumeric
End node.
Returns
- indexnumeric
new Pumps index
- Properties that can be set(optional):
Initial Status
Initial Speed setting
Power
Pattern index
- If no properties are given, the default values are:
initial status = 1 (OPEN)
initial speed setting = 1
power = 0
pattern index = 0
Examples
The examples are based on d = epanet(‘Net1.inp’)
Example 1: Adds a new pump given no properties.
>>> pumpID = 'newPump_1' >>> fromNode = '10' >>> toNode = '21' # Retrieves the number of pumps >>> d.getLinkPumpCount() >>> pumpIndex = d.addLinkPump(pumpID, fromNode, toNode) >>> d.getLinkPumpCount() # Plots the network in a new figure >>> d.plot()
Example 2: Adds a new pump given it’s initial status.:
>>> pumpID = 'newPump_2' >>> fromNode = '31' >>> toNode = '22' >>> initialStatus = 0 # (CLOSED) >>> d.getLinkPumpCount() >>> pumpIndex = d.addLinkPump(pumpID, fromNode, toNode, initialStatus) >>> d.getLinkPumpCount()
# Retrieves the new pump’s initial status >>> d.getLinkInitialStatus(pumpIndex) >>> d.plot()
Example 3: Adds a new pump given it’s initial status, initial speed setting, power and pattern index.
>>> pumpID = 'newPump_3' >>> fromNode = '11' >>> toNode = '22' >>> initialStatus = 1 # (OPEN) >>> initialSetting = 1.2 >>> power = 10 >>> patternIndex = 1 >>> d.getLinkPumpCount() >>> pumpIndex = d.addLinkPump(pumpID, fromNode, toNode, initialStatus, >>> initialSetting, power, patternIndex) >>> d.getLinkPumpCount() >>> d.getLinkInitialStatus(pumpIndex) # Retrieves the new pump's initial setting >>> d.getLinkInitialSetting(pumpIndex) # Retrieves the new pump's power >>> d.getLinkPumpPower(pumpIndex) # Retrieves the new pump's pattern index >>> d.getLinkPumpPatternIndex(pumpIndex) >>> d.plot()
See also: plot, setLinkNodesIndex, addLinkPipe, addNodeJunction, deleteLink, setLinkInitialStatus.
- addLinkValveFCV(vID, fromNode, toNode)[source]
Adds a new FCV valve. Returns the index of the new FCV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValveFCV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValveFCV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePRV, deleteLink, setLinkTypeValveTCV.
- addLinkValveGPV(vID, fromNode, toNode)[source]
Adds a new GPV valve. Returns the index of the new GPV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValveGPV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValveGPV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePRV, deleteLink, setLinkTypeValveFCV.
- addLinkValvePCV(vID, fromNode, toNode)[source]
Adds a new PCV valve. Returns the index of the new PCV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValvePCV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValvePCV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePCV, deleteLink, setLinkTypeValvePCV.
- addLinkValvePBV(vID, fromNode, toNode)[source]
Adds a new PBV valve. Returns the index of the new PBV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValvePBV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValvePBV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePRV, deleteLink, setLinkTypeValvePRV.
- addLinkValvePRV(vID, fromNode, toNode)[source]
Adds a new PRV valve. Returns the index of the new PRV valve.
# The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValvePRV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValvePRV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePSV, deleteLink, setLinkTypeValveFCV.
- addLinkValvePSV(vID, fromNode, toNode)[source]
Adds a new PSV valve. Returns the index of the new PSV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValvePSV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValvePSV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePRV, deleteLink, setLinkTypeValveGPV.
- addLinkValveTCV(vID, fromNode, toNode)[source]
Adds a new TCV valve. Returns the index of the new TCV valve.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> valveID = 'newValveTCV' >>> fromNode = '10' >>> toNode = '21' >>> valveIndex = d.addLinkValveTCV(valveID, fromNode, toNode) >>> d.plot()
- See also plot, setLinkNodesIndex, addLinkPipe,
addLinkValvePRV, deleteLink, setLinkTypeValveFCV.
- addNodeJunction(juncID, *argv)[source]
Adds new junction
Returns the index of the new junction.
- The following data can be set(optional):
Coordinates
Elevation
Primary base demand
ID name of the demand’s time pattern
Example 1: Adds a new junction with the default coordinates (i.e. [0, 0]).
>>> junctionID = 'newJunction_1' >>> junctionIndex = d.addNodeJunction(junctionID) >>> d.plot()
Example 2: Adds a new junction with coordinates [X, Y] = [20, 10].
>>> junctionID = 'newJunction_2' >>> junctionCoords = [20, 10] >>> junctionIndex = d.addNodeJunction(junctionID, junctionCoords) >>> d.plot(highlightnode=junctionIndex)
Example 3: Adds a new junction with coordinates [X, Y] = [20, 20] and elevation = 500.
>>> junctionID = 'newJunction_3' >>> junctionCoords = [20, 20] >>> junctionElevation = 500 >>> junctionIndex = d.addNodeJunction(junctionID, junctionCoords, >>> junctionElevation) >>> d.getNodeElevations(junctionIndex) >>> d.plot()
Example 4: Adds a new junction with coordinates [X, Y] = [10, 40], elevation = 500 and demand = 50.
>>> junctionID = 'newJunction_4' >>> junctionCoords = [10, 40] >>> junctionElevation = 500 >>> demand = 50 >>> junctionIndex = d.addNodeJunction(junctionID, junctionCoords, >>> junctionElevation, demand) >>> d.getNodeBaseDemands(junctionIndex) >>> d.plot()
Example 5: Adds a new junction with coordinates [X, Y] = [10, 20], elevation = 500, demand = 50 and pattern ID = the 1st time pattern ID(if exists).
>>> junctionID = 'newJunction_5' >>> junctionCoords = [10, 20] >>> junctionElevation = 500 >>> demand = 50 >>> demandPatternID = d.getPatternNameID(1) >>> junctionIndex = d.addNodeJunction(junctionID, junctionCoords, >>> junctionElevation, demand, >>> demandPatternID) >>> d.getNodeDemandPatternNameID()[1][junctionIndex-1] >>> d.plot()
See also plot, setLinkNodesIndex, addNodeReservoir, setNodeComment, deleteNode, setNodeBaseDemands.
- addNodeJunctionDemand(*argv)[source]
Adds a new demand to a junction given the junction index, base demand, demand time pattern and demand category name. Returns the values of the new demand category index. A blank string can be used for demand time pattern and demand name category to indicate that no time pattern or category name is associated with the demand.
Example 1: New demand added with the name ‘new demand’ to the 1st node, with 100 base demand, using the 1st time pattern.
>>> d.addNodeJunctionDemand(1, 100, '1', 'new demand') # Retrieves the indices of all demands for all nodes. >>> d.getNodeJunctionDemandIndex() # Retrieves the demand category names of the 2nd demand index. >>> d.getNodeJunctionDemandName()[2]
Example 2: New demands added with the name ‘new demand’ to the 1st and 2nd node, with 100 base demand, using the 1st time pattern.
>>> d.addNodeJunctionDemand([1, 2], 100, '1', 'new demand') # Retrieves the indices of all demands for all nodes. >>> d.getNodeJunctionDemandIndex() # Retrieves the demand category names of the 2nd demand index. >>> d.getNodeJunctionDemandName()[2]
Example 3: New demands added with the name ‘new demand’ to the 1st and 2nd node, with 100 and 110 base demand respectively, using the 1st time pattern.
>>> d.addNodeJunctionDemand([1, 2], [100, 110], '1', 'new demand') # Retrieves the indices of all demands for all nodes. >>> d.getNodeJunctionDemandIndex() # Retrieves the demand category names of the 2nd demand index >>> d.getNodeJunctionDemandName()[2] .
Example 4: New demands added with the name ‘new demand’ to the 1st and 2nd node, with 100 and 110 base demand respectively, using the 1st
time pattern.
>>> d.addNodeJunctionDemand([1, 2], [100, 110], ['1', '1'], >>> 'new demand') # Retrieves the indices of all demands for all nodes. >>> d.getNodeJunctionDemandIndex() # Retrieves the demand category names of the 2nd demand index. >>> d.getNodeJunctionDemandName()[2]
Example 5: New demands added with the names ‘new demand1’ and ‘new demand2’ to the 1st and 2nd node, with 100 and 110 base demand respectively, using the 1st and 2nd(if exists) time pattern respectively.
>>> d.addNodeJunctionDemand([1, 2], [100, 110], ['1', '2'], >>> ['new demand1', 'new demand2']) # Retrieves the indices of all demands for all nodes. >>> d.getNodeJunctionDemandIndex() # Retrieves the demand category names of the 2nd demand index. >>> d.getNodeJunctionDemandName()[2] See also deleteNodeJunctionDemand, getNodeJunctionDemandIndex, getNodeJunctionDemandName, setNodeJunctionDemandName, getNodeBaseDemands.
- addNodeReservoir(resID, *argv)[source]
Adds a new reservoir. Returns the index of the new reservoir.
Example 1: Adds a new reservoir with the default coordinates (i.e. [0, 0])
>>> reservoirID = 'newReservoir_1' >>> reservoirIndex = d.addNodeReservoir(reservoirID) >>> d.plot()
Example 2: Adds a new reservoir with coordinates [X, Y] = [20, 30].
>>> reservoirID = 'newReservoir_2' >>> reservoirCoords = [20, 30] >>> reservoirIndex = d.addNodeReservoir(reservoirID, reservoirCoords) >>> d.plot()
See also plot, setLinkNodesIndex, addNodeJunction, self.addLinkPipe, deleteNode, setNodeBaseDemands.
- addNodeTank(tankID, *argv)[source]
Adds a new tank. Returns the index of the new tank.
Example 1: Adds a new tank with the default coordinates (i.e. [0, 0])
>>> tankID = 'newTank_1' >>> tankIndex = d.addNodeTank(tankID) >>> d.plot()
Example 2: Adds a new tank with coordinates [X, Y] = [10, 10]. >>> tankID = ‘newTank_2’ >>> tankCoords = [10, 10] >>> tankIndex = d.addNodeTank(tankID, tankCoords) >>> d.plot()
Example 3: Adds a new tank with coordinates [X, Y] = [20, 20] and elevation = 100.
>>> tankID = 'newTank_3' >>> tankCoords = [20, 20] >>> elevation = 100 >>> tankIndex = d.addNodeTank(tankID, tankCoords, elevation) >>> d.plot()
Example 4: Adds a new tank with coordinates [X, Y] = [20, 30], elevation = 100, initial level = 130, minimum water level = 110, maximum water level = 160, diameter = 60, minimum water volume = 200000, volume curve ID = ‘’.
>>> tankID = 'newTank_4' >>> tankCoords = [20, 30] >>> elevation = 100 >>> initialLevel = 130 >>> minimumWaterLevel = 110 >>> maximumWaterLevel = 160 >>> diameter = 60 >>> minimumWaterVolume = 200000 >>> volumeCurveID = '' # Empty for no curve >>> tankIndex = d.addNodeTank(tankID, tankCoords, elevation, >>> initialLevel, minimumWaterLevel, >>> maximumWaterLevel, diameter, >>> minimumWaterVolume, volumeCurveID) >>> t_data = d.getNodeTankData(tankIndex) >>> d.plot()
See also plot, setLinkNodesIndex, addNodeJunction, addLinkPipe, deleteNode, setNodeBaseDemands.
- addPattern(*argv)[source]
Adds a new time pattern to the network.
Example 1:
# Retrieves the ID labels of time patterns >>> d.getPatternNameID() >>> patternID = ‘new_pattern’ # Adds a new time pattern given it’s ID >>> patternIndex = d.addPattern(patternID) >>> patternIndex = d.addPattern(patternID+’2’, 1) >>> d.getPatternNameID()
Example 2:
>>> patternID = 'new_pattern' >>> patternMult = [1.56, 1.36, 1.17, 1.13, 1.08, ... 1.04, 1.2, 0.64, 1.08, 0.53, 0.29, 0.9, 1.11, ... 1.06, 1.00, 1.65, 0.55, 0.74, 0.64, 0.46, ... 0.58, 0.64, 0.71, 0.66] # Adds a new time pattern given ID and the multiplier >>> patternIndex = d.addPattern(patternID, patternMult) >>> d.getPatternNameID() >>> d.getPattern()
See also getPattern, setPattern, setPatternNameID, setPatternValue, setPatternComment.
- addRules(rule)[source]
Adds a new rule-based control to a project.
Note
- Rule format: Following the format used in an EPANET input
file.
‘RULE ruleid
- IF object objectid attribute relation
attributevalue
- THEN object objectid
STATUS/SETTING IS value
PRIORITY value’
See more: ‘https://nepis.epa.gov/Adobe/PDF/P1007WWU.pdf’ (Page 164)
The example is based on d = epanet(‘Net1.inp’)
Example: >>> d.getRuleCount() >>> d.addRules(‘RULE RULE-1
IF TANK 2 LEVEL >= 140 THEN PUMP 9
>>> STATUS IS CLOSED
- PRIORITY 1’)
>>> d.getRuleCount() >>> d.getRules()[1]['Rule']
See also deleteRules, setRules, getRules, getRuleInfo, setRuleThenAction, setRuleElseAction, setRulePriority.
- appRotateNetwork(theta, indexRot=0)[source]
Rotates the network by theta degrees counter-clockwise, using as pivot the indexRot theta: angle in degrees to rotate the network counter-clockwise indexRot: index of the node/point to be rotated. If it’s not provided then the first index node is used as pivot.
Example 1: Rotate the network by 60 degrees counter-clockwise around the index 1 node. >>> d = epanet(‘Net1.inp’) >>> d.plot() >>> d.appRotateNetwork(60) >>> d.plot()
Example 2: Rotate the network by 150 degrees counter-clockwise around the reservoir with index 921. >>> d = epanet(‘ky10.inp’) >>> d.plot() >>> d.appRotateNetwork(150,921) >>> d.plot()
- appShiftNetwork(xDisp, yDisp)[source]
Shifts the network by xDisp in the x-direction and by yDisp in the y-direction
Example 1: Shift the network by 1000 feet in the x-axis and -1000 feet in the y-axis
>>> d = epanet('Net1.inp') >>> d.getNodeCoordinates(1) # old x coordinates >>> d.getNodeCoordinates(2) # old y coordinates >>> d.appShiftNetwork(1000,-1000) >>> d.getNodeCoordinates(1) # new x coordinates >>> d.getNodeCoordinates(2) # new y coordinates
Example 2: Shift the network,along with the vertices by 1000 feet in the x-axis and -1000 feet in the y-axis
>>> d = epanet('ky10.inp') >>> d.appShiftNetwork(1000,-1000) >>> d.plot()
- clearReport()[source]
Clears the contents of a project’s report file.
Example:
>>> d.clearReport()
See also writeReport, writeLineInReportFile, copyReport.
- closeHydraulicAnalysis()[source]
Closes the hydraulic analysis system, freeing all allocated memory.
Example:
>>> d.closeHydraulicAnalysis()
For more, you can type help getNodePressure and check examples 3 & 4.
See also openHydraulicAnalysis, saveHydraulicFile, closeQualityAnalysis.
- closeNetwork()[source]
Closes down the Toolkit system.
Example:
>>> d.closeNetwork()
See also loadEPANETFile, closeHydraulicAnalysis, closeQualityAnalysis.
- closeQualityAnalysis()[source]
Closes the water quality analysis system, freeing all allocated memory.
Example:
>>> d.closeQualityAnalysis()
For more, you can type help (d.epanet.getNodePressure) and check examples 3 & 4.
See also openQualityAnalysis, initializeQualityAnalysis, closeHydraulicAnalysis.
- copyReport(fileName)[source]
Copies the current contents of a project’s report file to another file.
Example:
>>> fileName = 'Report_copy' >>> d.copyReport(fileName)
See also writeReport, writeLineInReportFile, clearReport.
- deleteControls(*argv)[source]
Deletes an existing simple control.
Example 1:
# Retrieves the parameters of all controls >>> d.getControls() # Deletes the existing simple controls >>> d.deleteControls() >>> d.getControls()
Example 2:
# Adds a new simple control(index = 3) >>> index = d.addControls(‘LINK 9 43.2392 AT TIME 4:00:00’) >>> d.getControls(index) # Deletes the 3rd simple control >>> d.deleteControls(index) >>> d.getControls()
Example 3:
# Adds a new simple control(index = 3) >>> index_3 = d.addControls(‘LINK 9 43.2392 AT TIME 4:00:00’) # Adds a new simple control(index = 4) >>> index_4 = d.addControls(‘LINK 10 43.2392 AT TIME 4:00:00’) >>> d.getControls(index_3) >>> d.getControls(index_4) # Deletes the 3rd and 4th simple controls >>> d.deleteControls([index_3, index_4]) >>> d.getControls()
See also addControls, setControls, getControls, getControlCount.
- deleteCurve(idCurve)[source]
Deletes a data curve from a project.
Example 1:
>>> d = epanet('BWSN_Network_1.inp') # Retrieves the ID of the 1st curve >>> idCurve = d.getCurveNameID(1) # Deletes a curve given it's ID >>> d.deleteCurve(idCurve) >>> d.getCurveNameID()
Example 2:
>>> index = 1 >>> d.deleteCurve(index) # Deletes a curve given it's index >>> d.getCurveNameID()
See also addCurve, setCurve, setCurveNameID, setCurveValue, setCurveComment.
- deleteLink(idLink, *argv)[source]
Deletes a link.
condition = 0 | if is EN_UNCONDITIONAL: Deletes all controls and rules related to the object condition = 1 | if is EN_CONDITIONAL: Cancel object deletion if contained in controls and rules Default condition is 0.
Example 1:
# Retrieves the ID label of all links >>> d.getLinkNameID() # Retrieves the ID label of the 1st link >>> idLink = d.getLinkNameID(1) # Deletes the 1st link given it’s ID >>> d.deleteLink(idLink) >>> d.getLinkNameID()
Example 2:
>>> idLink = d.getLinkPumpNameID(1) >>> condition = 1 # Attempts to delete a link contained in controls (error occurs) >>> d.deleteLink(idLink, condition)
Example 3:
>>> indexLink = 1 # Deletes the 1st link given it's index >>> d.deleteLink(indexLink) >>> d.getLinkNameID()
See also addLinkPipe, deleteNode, deleteRules, setNodeCoordinates, setLinkPipeData.
- deleteNode(idNode, *argv)[source]
Deletes nodes.
condition = 0 | if is EN_UNCONDITIONAL: Deletes all controls, rules and links related to the object condition = 1 | if is EN_CONDITIONAL: Cancel object deletion if contained in controls, rules and links Default condition is 0.
Example 1:
# Retrieves the total number of all nodes >>> d.getNodeCount() # Retrieves the ID label of the 1st node >>> idNode = d.getNodeNameID(1) # Deletes the 1st node given it’s ID >>> d.deleteNode(idNode) >>> d.getNodeCount()
Example 2:
>>> idNode = d.getNodeNameID(1) >>> condition = 1 # Attempts to delete a node connected to links (error occurs) >>> d.deleteNode(idNode, condition)
Example 3:
>>> index = 1 # Deletes the 1st node given it's index >>> d.deleteNode(index) >>> d.getNodeNameID()
Example 4:
>>> idNodes = d.getNodeNameID([1,2]) >>> d.getNodeCount() # Deletes 2 nodes given their IDs >>> d.deleteNode(idNodes) >>> d.getNodeCount()
See also addNodeJunction, deleteLink, deleteRules, setNodeCoordinates, setNodeJunctionData.
- deleteNodeJunctionDemand(*argv)[source]
Deletes a demand from a junction given the junction index and demand index. Returns the remaining(if exist) node demand indices.
Example 1:
>>> nodeIndex = 1 >>> baseDemand = 100 >>> patternId = '1' >>> categoryIndex = 1 # Retrieves the indices of all demands for the 1st node >>> d.getNodeJunctionDemandIndex(nodeIndex) # Retrieves the names of all nodes demand category >>> d.getNodeJunctionDemandName() # Retrieves the name of the 1st demand category of the 1st node >>> d.getNodeJunctionDemandName()[categoryIndex][nodeIndex-1] # Adds a new demand to the 1st node and returns the new # demand index >>> categoryIndex = d.addNodeJunctionDemand(nodeIndex, baseDemand, >>> patternId, 'new demand') # Retrieves the indices of all demands for the 1st node >>> d.getNodeJunctionDemandIndex(nodeIndex) # Retrieves the names of all nodes demand category >>> d.getNodeJunctionDemandName() # Retrieves the name of the 2nd demand category of the 1st node >>> d.getNodeJunctionDemandName()[categoryIndex][nodeIndex-1] # Deletes the 2nd demand of the 1st node >>> d.deleteNodeJunctionDemand(1, 2) >>> d.getNodeJunctionDemandIndex(nodeIndex)
Example 2:
>>> nodeIndex = 1 >>> baseDemand = 100 >>> patternId = '1' # Adds a new demand to the first node and returns the new demand index >>> categoryIndex_2 = d.addNodeJunctionDemand(nodeIndex, ... baseDemand, ... patternId, ... 'new demand_2') # Adds a new demand to the first node and returns the new demand index >>> categoryIndex_3 = d.addNodeJunctionDemand(nodeIndex, ... baseDemand, ... patternId, ... 'new demand_3') # Retrieves the name of the 2nd demand category of the 1st node >>> d.getNodeJunctionDemandName()[categoryIndex_2][nodeIndex-1] # Deletes all the demands of the 1st node >>> d.deleteNodeJunctionDemand(1) # Retrieves the indices of all demands for the 1st node >>> d.getNodeJunctionDemandIndex(nodeIndex)
Example 3:
>>> nodeIndex = [1, 2, 3] >>> baseDemand = [100, 110, 150] >>> patternId = ['1', '1', ''] # Adds 3 new demands to the first 3 nodes >>> categoryIndex = d.addNodeJunctionDemand(nodeIndex, baseDemand, ... patternId, ['new demand_1', ... 'new demand_2', ... 'new demand_3']) # Deletes all the demands of the first 3 nodes >>> d.getNodeJunctionDemandName()[2] >>> d.getNodeJunctionDemandIndex(nodeIndex) >>> d.deleteNodeJunctionDemand([1,2,3]) >>> d.getNodeJunctionDemandIndex(nodeIndex)
See also addNodeJunctionDemand, getNodeJunctionDemandIndex, getNodeJunctionDemandName, setNodeJunctionDemandName, getNodeBaseDemands.
- deletePattern(idPat)[source]
Deletes a time pattern from a project.
Example 1:
# Retrieves the ID of the 1st pattern >>> idPat = d.getPatternNameID(1) # Deletes the 1st pattern given it’s ID >>> d.deletePattern(idPat) >>> d.getPatternNameID()
Example 2:
>>> index = 1 # Deletes the 1st pattern given it's index >>> d.deletePattern(index) >>> d.getPatternNameID()
See also deletePatternsAll, addPattern, setPattern, setPatternNameID, setPatternValue, setPatternComment.
- deletePatternsAll()[source]
Deletes all time patterns from a project.
Example 1:
>>> d.getPatternNameID() # Retrieves the IDs of all the patterns >>> d.deletePatternsAll() # Deletes all the patterns >>> d.getPatternNameID()
See also deletePattern, addPattern, setPattern, setPatternNameID, setPatternValue, setPadtternComment.
- deleteRules(*argv)[source]
Deletes an existing rule-based control given it’s index. Returns error code.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getRuleCount() # Retrieves the number of rules >>> d.deleteRules() # Deletes all the rule-based control >>> d.getRuleCount()
Example 2:
>>> d.deleteRules(1) # Deletes the 1st rule-based control >>> d.getRuleCount()
Example 3:
>>> d.deleteRules([1,2,3]) # Deletes the 1st to 3rd rule-based control >>> d.getRuleCount()
See also addRules, getRules, setRules, getRuleCount().
- getENfunctionsImpemented()[source]
Retrieves the epanet functions that have been developed.
Example:
>>> d.getENfunctionsImpemented()
See also getLibFunctions, getVersion.
- getNodeActualQualitySensingNodes(*argv)[source]
Retrieves the computed quality values at some sensing nodes
Example:
# Retrieves the computed quality value at the first node >>> d.getNodeActualQualitySensingNodes(1) # Retrieves the computed quality value at the first three nodes >>> d.getNodeActualQualitySensingNodes(1,2,3) For more, you can check examples 3 & 4 of getNodePressure.
See also getNodeActualDemand, getNodeActualDemandSensingNodes, getNodePressure, getNodeHydraulicHead, getNodeActualQuality, getNodeMassFlowRate.
- getComputedHydraulicTimeSeries(*argv)[source]
Computes hydraulic simulation and retrieves all time-series.
- Data that is computed:
Time 8) Velocity
Pressure 9) HeadLoss
Demand 10) Status
DemandDeficit 11) Setting
Head 12) Energy
TankVolume 13) Efficiency
7) Flow 14) State 15) LinkLeakageRate 16) EmitterFlow 17) DemandDelivered 18) DemandRequested 19) NodeLeakageFlow
Example 1:
# Retrieves all the time-series data >>> d.getComputedHydraulicTimeSeries()
Example 2:
# Retrieves all the time-series Time, Pressure, Velocity >>> data = d.getComputedHydraulicTimeSeries([‘Time’, … ‘Pressure’, … ‘Velocity’]) >>> time = data.Time >>> pressure = data.Pressure >>> velocity = data.Velocity
See also getComputedQualityTimeSeries, getComputedTimeSeries.
- getComputedQualityTimeSeries(*argv)[source]
Compute the quality simulation and retrieve selected time-series.
- Data that can be computed:
Time
NodeQuality
LinkQuality
MassFlowRate
Demand
QualitySensingNodes
DemandSensingNodes
Example 1:
# Retrieves all time-series data >>> d.getComputedQualityTimeSeries()
Example 2:
# Retrieves the node quality time-series >>> d.getComputedQualityTimeSeries().NodeQuality # Retrieves the link quality time-series >>> d.getComputedQualityTimeSeries().LinkQuality
Example 3:
# Retrieves Time, NodeQuality, LinkQuality >>> data = d.getComputedQualityTimeSeries([‘time’, … ‘nodequality’, … ‘linkquality’]) >>> time = data.Time >>> node_quality = data.NodeQuality >>> link_quality = data.LinkQuality
Example 4:
# Retrieves quality at sensing nodes (pass indices as the second argument) >>> data = d.getComputedQualityTimeSeries([‘time’, ‘qualitysensingnodes’], sensing_node_indices)
See also getComputedHydraulicTimeSeries, getComputedTimeSeries.
- getComputedTimeSeries_ENepanet(tempfile=None, binfile=None, rptfile=None)[source]
Run analysis using ENepanet function
- getAdjacencyMatrix()[source]
Compute the adjacency matrix (connectivity graph) considering the flows, at different time steps or the mean flow, Compute the new adjacency matrix based on the mean flow in the network
- getControls(*argv)[source]
Retrieves the parameters of all control statements.
The example is based on d = epanet(‘Net1.inp’)
Example :
# Retrieves the parameters of all control statements >>> d.getControls() # Retrieves the type of the 1st control >>> d.getControls(1).Type # Retrieves the ID of the link associated with the 1st control >>> d.getControls(1).LinkID # Retrieves the setting of the link associated with the 1st control >>> d.getControls(1).Setting # Retrieves the ID of the node associated with the 1st control >>> d.getControls(1).NodeID # Retrieves the value of the node associated with the 1st control >>> d.getControls(1).Value # Retrieves the 1st control statement >>> d.getControls(1).Control # Retrieves all the parameters of the first control statement in a dict >>> d.getControls(1).to_dict() # Retrieves the parameters of the first two control statements >>> d.getControls([1,2])
See also setControls, addControls, deleteControls, getRules, setRules, addRules, deleteRules.
- getControlRulesCount()[source]
Retrieves the number of controls.
Example:
>>> d.getControlRulesCount()
See also getControls, getRuleCount.
- getControlCount()[source]
Retrieves the number of controls.
Example:
>>> d.getControlCount()
See also getControls, getRuleCount.
- getCurveComment(*argv)[source]
Retrieves the comment string of a curve.
Example 1:
# Retrieves the comment string assigned to all the curves >>> d.getCurveComment()
Example 2:
# Retrieves the comment string assigned to the 1st curve >>> d.getCurveComment(1)
Example 3:
# Retrieves the comment string assigned to the first 2 curves >>> d.getCurveComment([1,2])
See also getCurveNameID, getCurveType, getCurvesInfo
- getCounts()[source]
Retrieves the number of network components. Nodes, Links, Junctions, Reservoirs, Tanks, Pipes, Pumps, Valves, Curves, SimpleControls, RuleBasedControls, Patterns.
Example:
# Retrieves the number of all network components >>> counts = d.getCounts().to_dict() # Retrieves the number of nodes >>> d.getCounts().Nodes # Retrieves the number of simple controls >>> d.getCounts().SimpleControls
See also getNodeCount, getNodeJunctionCount, getLinkCount, getControlCount.
- getCurveCount()[source]
Retrieves the number of curves.
Example:
>>> d.getCurveCount()
See also getCurveIndex, getCurvesInfo.
- getCurveIndex(*argv)[source]
Retrieves the index of a curve with specific ID.
Example 1:
# Retrieves the indices of all the curves >>> d.getCurveIndex()
Example 2:
# Retrieves the index of the 1st curve given it’s ID >>> curveID = d.getCurveNameID(1) >>> d.getCurveIndex(curveID)
Example 3:
# Retrieves the indices of the first 2 curves given their ID >>> curveID = d.getCurveNameID([1,2]) >>> d.getCurveIndex(curveID)
See also getCurveNameID, getCurvesInfo.
- getCurveLengths(*argv)[source]
Retrieves number of points in a curve.
The examples are based on: d = epanet(‘Richmond_standard.inp’)
Example:
# Retrieves the number of points in all the curves >>> d.getCurveLengths() # Retrieves the number of points in the 1st curve >>> d.getCurveLengths(1) # Retrieves the number of points in the first 2 curves >>> d.getCurveLengths([1,2]) # Retrieves the number of points for curve with id = ‘1’ >>> d.getCurveLengths(‘1006’)
See also getCurvesInfo, setCurve.
- getCurveNameID(*argv)[source]
Retrieves the IDs of curves.
Example:
# Retrieves the IDs of all the curves >>> d.getCurveNameID() # Retrieves the ID of the 1st curve >>> d.getCurveNameID(1) # Retrieves the IDs of the first 2 curves >>> d.getCurveNameID([1,2])
See also setCurveNameID, getCurvesInfo.
- getCurvesInfo()[source]
Retrieves all the info of curves.
- Returns the following informations:
Curve Name ID
Number of points on curve
X values of points
Y values of points
Example:
>>> d.getCurvesInfo().disp() # Retrieves the IDs of curves >>> d.getCurvesInfo().CurveNameID # Retrieves the number of points on curv # # Retrieves the number of points on curvee >>> d.getCurvesInfo().CurveNvalue # Retrieves the X values of points of all curves >>> d.getCurvesInfo().CurveXvalue # Retrieves the X values of points of the 1st curve >>> d.getCurvesInfo().CurveXvalue[0] # Retrieves the Y values of points of all curves >>> d.getCurvesInfo().CurveYvalue # Retrieves the Y values of points of the 1st curve >>> d.getCurvesInfo().CurveYvalue[0]
See also setCurve, getCurveType, getCurveLengths, getCurveValue, getCurveNameID, getCurveComment.
- getCurveType(*argv)[source]
Retrieves the curve-type for all curves.
Example:
# Retrieves the curve-type for all curves >>> d.getCurveType() # Retrieves the curve-type for the 1st curve >>> d.getCurveType(1) # Retrieves the curve-type for the first 2 curves >>> d.getCurveType([1,2])
See also getCurveTypeIndex, getCurvesInfo.
- getCurveTypeIndex(*argv)[source]
Retrieves the curve-type index for all curves.
Example:
# Retrieves the curve-type index for all curves >>> d.getCurveTypeIndex() # Retrieves the curve-type index for the 1st curve >>> d.getCurveTypeIndex(1) # Retrieves the curve-type index for the first 2 curves >>> d.getCurveTypeIndex([1,2])
See also getCurveType, getCurvesInfo.
- getCurveValue(*argv)[source]
Retrieves the X, Y values of points of curves.
Example:
# Retrieves all the X and Y values of all curves >>> d.getCurveValue() >>> curveIndex = 1 # Retrieves all the X and Y values of the 1st curve >>> d.getCurveValue(curveIndex) >>> pointIndex = 1 # Retrieves the X and Y values of the 1st point of the 1st curve >>> d.getCurveValue(curveIndex, pointIndex)
See also setCurveValue, setCurve, getCurvesInfo.
- getDemandModel()[source]
Retrieves the type of demand model in use and its parameters.
Demand model code DDA - 0, PDA - 1 Pmin - Pressure below Preq - Pressure required to deliver full demand. Pexp - Pressure exponent in demand function
Example:
>>> model = d.getDemandModel()
See also setDemandModel, getNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternIndex, getNodeDemandPatternNameID.
- getError(Errcode)[source]
Retrieves the text of the message associated with a particular error or warning code.
Example:
>>> error = 250 >>> d.getError(error)
- getFlowUnits()[source]
Retrieves flow units used to express all flow rates.
Example:
>>> d.getFlowUnits()
- getLibFunctions()[source]
Retrieves the functions of DLL.
Example:
>>> d.getLibFunctions()
See also getENfunctionsImpemented, getVersion.
- getLinkComment(*argv)[source]
Retrieves the comment string assigned to the link object.
Example 1:
# Retrieves the comments of all links >>> d.getLinkComment()
Example 2:
>>> linkIndex = 1 # Retrieves the comment of the 1st link >>> d.getLinkComment(linkIndex)
Example 3:
>>> linkIndex = [1,2,3,4,5] # Retrieves the comments of the first 5 links >>> d.getLinkComment(linkIndex)
See also setLinkComment, getLinkNameID, getLinksInfo.
- getLinkCount()[source]
Retrieves the number of links.
Example:
>>> d.getLinkCount()
See also getLinkIndex, getNodeCount.
- getLinkQuality(*argv)[source]
Retrieves the value of link quality. Pipe quality
Example 1:
# Retrieves the value of all link quality >>> d.getLinkQuality()
Example 2:
# Retrieves the value of the first link quality >>> d.getLinkQuality(1)
See also getLinkType, getLinksInfo, getLinkDiameter, getLinkRoughnessCoeff, getLinkMinorLossCoeff.
- getLinkType(*argv)[source]
Retrieves the link-type code for all links.
Example 1:
# Retrieves the link-type code for all links >>> d.getLinkType()
Example 2:
# Retrieves the link-type code for the first link >>> d.getLinkType(1)
See also getLinkTypeIndex, getLinksInfo, getLinkDiameter, getLinkLength, getLinkRoughnessCoeff, getLinkMinorLossCoeff.
- getLinkTypeIndex(*argv)[source]
Retrieves the link-type code for all links.
Example:
# Retrieves the link-type code for all links >>> d.getLinkTypeIndex() # Retrieves the link-type code for the first link >>> d.getLinkTypeIndex(1) # Retrieves the link-type code for the second and third links >>> d.getLinkTypeIndex([2,3])
See also getLinkType, getLinksInfo, getLinkDiameter, getLinkLength, getLinkRoughnessCoeff, getLinkMinorLossCoeff.
- getLinkDiameter(*argv)[source]
Retrieves the value of link diameters. Pipe/valve diameter
Example 1:
# Retrieves the value of all link diameters >>> d.getLinkDiameter() # Retrieves the value of the first link diameter >>> d.getLinkDiameter(1) # Retrieves the value of the second and third link diameter >>> d.getLinkDiameter([1,2])
See also getLinkType, getLinksInfo, getLinkLength, getLinkRoughnessCoeff, getLinkMinorLossCoeff.
- getLinkLength(*argv)[source]
Retrieves the value of link lengths. Pipe length
Example:
# Retrieves the value of all link lengths >>> d.getLinkLength() # Retrieves the value of the first link length >>> d.getLinkLength(1)
See also getLinkType, getLinksInfo, getLinkDiameter, getLinkRoughnessCoeff, getLinkMinorLossCoeff.ughnessCoeff, getLinkMinorLossCoeff.
- getLinkRoughnessCoeff(*argv)[source]
Retrieves the value of link roughness coefficient. Pipe roughness coefficient
Example:
# Retrieves the value of all link roughness coefficients >>> d.getLinkRoughnessCoeff() # Retrieves the value of the first link roughness coefficient >>> d.getLinkRoughnessCoeff(1)
See also getLinkType, getLinksInfo, getLinkDiameter, getLinkLength, getLinkMinorLossCoeff.
- getLinkMinorLossCoeff(*argv)[source]
Retrieves the value of link minor loss coefficients. Pipe/valve minor loss coefficient
Example:
# Retrieves the value of all link minor loss coefficients >>> d.getLinkMinorLossCoeff() # Retrieves the value of the first link minor loss coefficient >>> d.getLinkMinorLossCoeff(1)
See also getLinkType, getLinksInfo, getLinkDiameter, getLinkLength, getLinkRoughnessCoeff.
- getLinkNameID(*argv)[source]
Retrieves the ID label(s) of all links, or the IDs of an index set of links.
Example 1:
# Retrieves the ID’s of all links >>> d.getLinkNameID()
Example 2:
>>> linkIndex = 1 # Retrieves the ID of the link with index = 1 >>> d.getLinkNameID(linkIndex)
Example 3:
>>> linkIndices = [1,2,3] # Retrieves the IDs of the links with indices = 1, 2, 3 >>> d.getLinkNameID(linkIndices)
See also getNodeNameID, getLinkPipeNameID, getLinkIndex.
- getLinkInitialStatus(*argv)[source]
Retrieves the value of all link initial status. Initial status (see @ref EN_LinkStatusType)
Example :
# Retrieves the value of all link initial status >>> d.getLinkInitialStatus() # Retrieves the value of the first link initial status >>> d.getLinkInitialStatus(1)
See also getLinkType, getLinksInfo, getLinkInitialSetting, getLinkBulkReactionCoeff, getLinkWallReactionCoeff.
- getLinkInitialSetting(*argv)[source]
Retrieves the value of all link roughness for pipes or initial speed for pumps or initial setting for valves.
Example:
# Retrieves the value of all link initial settings >>> d.getLinkInitialSetting() # Retrieves the value of the first link initial setting >>> d.getLinkInitialSetting(1)
See also getLinkType, getLinksInfo, getLinkInitialStatus, getLinkBulkReactionCoeff, getLinkWallReactionCoeff.
- getLinkBulkReactionCoeff(*argv)[source]
Retrieves the value of all link bulk chemical reaction coefficient.
Example:
>>> d.getLinkBulkReactionCoeff() # Retrieves the value of all link bulk chemical reaction coefficient # Retrieves the value of the first link bulk chemical reaction coefficient >>> d.getLinkBulkReactionCoeff(1)
See also getLinkType, getLinksInfo, getLinkRoughnessCoeff, getLinkMinorLossCoeff, getLinkInitialStatus, getLinkInitialSetting, getLinkWallReactionCoeff.
- getLinkWallReactionCoeff(*argv)[source]
Retrieves the value of all pipe wall chemical reaction coefficient.
Example:
>>> d.getLinkWallReactionCoeff() # Retrieves the value of all pipe wall chemical reaction coefficient # Retrieves the value of the first pipe wall chemical reaction coefficient >>> d.getLinkWallReactionCoeff(1)
See also getLinkType, getLinksInfo, getLinkRoughnessCoeff, getLinkMinorLossCoeff, getLinkInitialStatus, getLinkInitialSetting, getLinkBulkReactionCoeff.
- getLinkPipeCount()[source]
Retrieves the number of pipes.
Example:
>>> d.getLinkPipeCount()
See also getLinkPumpCount, getLinkCount.
- getLinkPumpEfficiency(*argv)[source]
Retrieves the current computed pump efficiency (read only).
Example:
>>> d.getLinkPumpEfficiency() # Retrieves the current computed pump efficiency for all links # Retrieves the current computed pump efficiency for the first link >>> d.getLinkPumpEfficiency(1)
See also getLinkFlows, getLinkStatus, getLinkPumpState, getLinkSettings, getLinkEnergy, getLinkActualQuality.
- getLinkPumpCount()[source]
Retrieves the number of pumps.
Example:
>>> d.getLinkPumpCount()
See also getLinkPipeCount, getLinkCount.
- getLinkPumpECost(*argv)[source]
Retrieves the pump average energy price.
Example 1: Retrieves the average energy price of all pumps
>>> d.getLinkPumpECost()
Example 2: Retrieves the average energy price of the 1st pump
>>> d.getLinkPumpECost(1)
Example 3:
>>> d = epanet('Richmond_standard.inp') >>> pIndex = 950 >>> pIndices = d.getLinkPumpIndex() # Retrieves the average energy price of the pump with link index 950 >>> d.getLinkPumpECost(pIndex)
See also setLinkPumpECost, getLinkPumpPower, getLinkPumpHCurve, getLinkPumpEPat, getLinkPumpPatternIndex, getLinkPumpPatternNameID.
- getLinkPumpECurve(*argv)[source]
Retrieves the pump efficiency v. flow curve index.
Example 1: Retrieves the efficiency v. flow curve index of all pumps
>>> d.getLinkPumpECurve()
Example 2: Retrieves the efficiency v. flow curve index of the 1st pump
>>> d.getLinkPumpECurve(1)
Example 3: Retrieves the efficiency v. flow curve index of the first 2 pumps
>>> d.getLinkPumpECurve([1,2])
Example 4: Retrieves the efficiency v. flow curve index of the pumps with link index 950
>>> d = epanet('Richmond_standard.inp') >>> pIndex = 950 >>> pIndices = d.getLinkPumpIndex() >>> d.getLinkPumpECurve(pIndex)
See also setLinkPumpECurve, getLinkPumpHCurve, getLinkPumpECost, getLinkPumpEPat, getLinkPumpPatternIndex, getLinkPumpPatternNameID.
- getLinkPumpEPat(*argv)[source]
Retrieves the pump energy price time pattern index.
Example 1: Retrieves the energy price time pattern index of all pumps
>>> d.getLinkPumpEPat()
Example 2: Retrieves the energy price time pattern index of the 1st pump
>>> d.getLinkPumpEPat(1)
Example 3: Retrieves the energy price time pattern index of the first 2 pumps
>>> d.getLinkPumpEPat([1,2])
Example 4: Retrieves the energy price time pattern index of pump with link index 950
>>> d = epanet('Richmond_standard.inp') >>> pIndex = 950 >>> pIndices = d.getLinkPumpIndex() >>> d.getLinkPumpEPat(pIndex)
See also setLinkPumpEPat, getLinkPumpHCurve, getLinkPumpECurve, getLinkPumpECost, getLinkPumpPatternIndex, getLinkPumpPatternNameID.
- getLinkPumpHCurve(*argv)[source]
Retrieves the pump head v. flow curve index.
Example 1: Retrieves the head v. flow curve index of all pumps
>>> d.getLinkPumpHCurve()
Example 2: Retrieves the head v. flow curve index of the 1st pump
>>> d.getLinkPumpHCurve(1)
Example 3: Retrieves the head v. flow curve index of the first 2 pumps
>>> d.getLinkPumpHCurve([1,2])
Example 4: Retrieves the head v. flow curve index of pump with link index 950
>>> d = epanet('Richmond_standard.inp') >>> pIndex = 950 >>> pIndices = d.getLinkPumpIndex() >>> d.getLinkPumpHCurve(pIndex)
See also setLinkPumpHCurve, getLinkPumpECurve, getLinkPumpECost, getLinkPumpEPat, getLinkPumpPatternIndex, getLinkPumpPatternNameID.
- getLinkPumpHeadCurveIndex()[source]
Retrieves the index of a head curve for all pumps.
Example:
>>> [curveIndex, pumpIndex] = d.getLinkPumpHeadCurveIndex()
See also getLinkPumpHCurve, getLinkPumpECurve.
- getLinkPumpPatternIndex(*argv)[source]
Retrieves the pump speed time pattern index.
Example 1: Retrieves the speed time pattern index of all pumps
>>> d.getLinkPumpPatternIndex()
Example 2: Retrieves the speed time pattern index of the 1st pump
>>> d.getLinkPumpPatternIndex(1)
Example 3: Retrieves the speed time pattern index of the first 2 pumps
>>> d.getLinkPumpPatternIndex([1,2])
Example 4: Retrieves the speed time pattern index of the pumps given their indices
>>> pumpIndex = d.getLinkPumpIndex() >>> d.getLinkPumpPatternIndex(pumpIndex)
See also setLinkPumpPatternIndex, getLinkPumpPower, getLinkPumpHCurve, getLinkPumpECost, getLinkPumpEPat, getLinkPumpPatternNameID.
- getLinkPumpPatternNameID(*argv)[source]
Retrieves pump pattern name ID. A value of 0 means empty
Example 1: Retrieves the pattern name ID of all pumps
>>> d = epanet('ky10.inp') >>> d.getLinkPumpPatternNameID()
Example 2: Retrieves the pattern name ID of the 1st pump
>>> d.getLinkPumpPatternNameID(1)
Example 3: Retrieves the pattern name ID of the first 2 pumps
>>> d.getLinkPumpPatternNameID([1,2])
Example 4: Retrieves the pattern name ID of the pumps given their indices
>>> pumpIndex = d.getLinkPumpIndex() >>> d.getLinkPumpPatternNameID(pumpIndex)
See also getLinkPumpPower, getLinkPumpHCurve, getLinkPumpECurve, getLinkPumpECost, getLinkPumpEPat, getLinkPumpPatternIndex.
- getLinkPumpPower(*argv)[source]
Retrieves the pump constant power rating (read only).
Example 1: Retrieves the constant power rating of all pumps
>>> d.getLinkPumpPower()
Example 2: Retrieves the constant power rating of the 1st pump
>>> d.getLinkPumpPower(1)
Example 3: Retrieves the constant power rating of the first 2 pumps
>>> d.getLinkPumpPower([1,2])
Example 4: Retrieves the constant power rating of the pumps given their indices
>>> pumpIndex = d.getLinkPumpIndex() >>> d.getLinkPumpPower(pumpIndex)
See also getLinkPumpHCurve, getLinkPumpECurve, getLinkPumpECost, getLinkPumpEPat, getLinkPumpPatternIndex, getLinkPumpPatternNameID.
- getLinkPumpState(*argv)[source]
Retrieves the current computed pump state (read only) (see @ref EN_PumpStateType). same as status: open, active, closed Using step-by-step hydraulic analysis,
Example:
>>> d.getLinkPumpState() # Retrieves the current computed pump state for all links >>> d.getLinkPumpState(1) # Retrieves the current computed pump state for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkHeadloss, getLinkStatus, getLinkSettings, getLinkEnergy, getLinkPumpEfficiency.
- getLinkPumpSwitches()[source]
Retrieves the number of pump switches.
Example:
>>> d.getLinkPumpSwitches()
- getLinkPumpType()[source]
Retrieves the type of a pump.
Example:
>>> d.getLinkPumpType()
See also getLinkPumpTypeCode(), getLinkPumpPower.
- getLinkPumpTypeCode()[source]
Retrieves the code of type of a pump.
- Type of pump codes:
0 = Constant horsepower 1 = Power function 2 = User-defined custom curve
Example:
>>> d.getLinkPumpTypeCode() # Retrieves the all the pumps type code >>> d.getLinkPumpTypeCode()[0] # Retrieves the first pump type code
See also getLinkPumpType, getLinkPumpPower.
- getLinksInfo()[source]
Retrieves all link info.
Example:
>>> linkInfo = d.getLinksInfo().to_dict() # get links info as a dict >>> linkInf = d.getLinksInfo() # get links info as object >>> linDiam = d.getLinksInfo().LinkDiameter # get link diameters
See also getLinkType, getLinkTypeIndex, getLinkDiameter, getLinkLength, getLinkRoughnessCoeff, getLinkMinorLossCoeff.
- getLinkValveCount()[source]
Retrieves the number of valves.
Example:
>>> d = epanet('BWSN_Network_1.inp') >>> d.getLinkValveCount()
See also getLinkPumpCount, getLinkCount.
- getLinkFlows(*argv)[source]
Retrieves the current computed flow rate (read only). Using step-by-step hydraulic analysis
Example 1:
>>> d.getLinkFlows() # Retrieves the current computed flow rate for all links
Example 2:
>>> d.getLinkFlows(1) # Retrieves the current computed flow rate for the first link
Example 3: Hydraulic analysis step-by-step.
>>> d.openHydraulicAnalysis() >>> d.initializeHydraulicAnalysis() >>> tstep, P, T_H, D, H, F, S =1, [], [], [], [], [], [] >>> while tstep>0: ... t = d.runHydraulicAnalysis() ... P.append(d.getNodePressure()) ... D.append(d.getNodeActualDemand()) ... H.append(d.getNodeHydraulicHead()) ... S.append(d.getLinkStatus()) ... F.append(d.getLinkFlows()) ... T_H.append(t) ... tstep=d.nextHydraulicAnalysisStep() >>> d.closeHydraulicAnalysis()
Example 4: Hydraulic and Quality analysis step-by-step
>>> d.openHydraulicAnalysis() >>> d.openQualityAnalysis() >>> d.initializeHydraulicAnalysis(0) >>> d.initializeQualityAnalysis(d.ToolkitConstants.EN_NOSAVE) >>> tstep, T, P, F, QN, QL = 1, [], [], [], [], [] >>> while (tstep>0): ... t = d.runHydraulicAnalysis() ... qt = d.runQualityAnalysis() ... P.append(d.getNodePressure()) ... F.append(d.getLinkFlows()) ... QN.append(d.getNodeActualQuality()) ... QL.append(d.getLinkActualQuality()) ... T.append(t) ... tstep = d.nextHydraulicAnalysisStep() ... qtstep = d.nextQualityAnalysisStep() >>> d.closeQualityAnalysis() >>> d.closeHydraulicAnalysis()
See also getLinkVelocity, getLinkHeadloss, getLinkStatus, getLinkPumpState, getLinkSettings, getLinkEnergy, getLinkActualQuality, getLinkPumpEfficiency.
- getLinkVelocity(*argv)[source]
Retrieves the current computed flow velocity (read only).
Using step-by-step hydraulic analysis
Example 1:
>>> d.getLinkVelocity() # Retrieves the current computed flow velocity for all links
Example 2:
>>> d.getLinkVelocity(1) # Retrieves the current computed flow velocity for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkHeadloss, getLinkStatus, getLinkPumpState, getLinkSettings, getLinkActualQuality.
- getLinkVertices(*argv)[source]
Retrieves the coordinate’s of a vertex point assigned to a link.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> linkID = '10' >>> x = [22, 24, 28] >>> y = [69, 68, 69] >>> d.setLinkVertices(linkID, x, y) >>> linkID = '112' >>> x = [10, 24, 18] >>> y = [49, 58, 60] >>> d.setLinkVertices(linkID, x, y) >>> d.getLinkVertices(1) >>> d.getLinkVertices(d.getLinkIndex('112'))
See also setLinkVertices, getLinkVerticesCount.
- getLinkVerticesCount(*argv)[source]
Retrieves the number of internal vertex points assigned to a link.
Example 1:
>>> d = epanet('Anytown.inp') >>> d.getLinkVerticesCount() # Retrieves the vertices per link
Example 2:
>>> d = epanet('ky10.inp') >>> link_id = 'P-10' >>> d.getLinkVerticesCount(link_id) # Retrieves the vertices of link 'P-10'
Example 3:
>>> link_index = 31 >>> d.getLinkVerticesCount(link_index) # Retrieves the vertices of link 31
See also getLinkVertices, setLinkVertices.
- getLinkHeadloss(*argv)[source]
Retrieves the current computed head loss (read only).
Using step-by-step hydraulic analysis,
Example :
>>> d.getLinkHeadloss() # Retrieves the current computed head loss for all links >>> d.getLinkHeadloss(1) # Retrieves the current computed head loss for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkVelocity, getLinkStatus, getLinkPumpState, getLinkSettings, getLinkActualQuality.
- getLinkStatus(*argv)[source]
Retrieves the current link status (see @ref EN_LinkStatusType) (0 = closed, 1 = open).
Using step-by-step hydraulic analysis,
Example:
>>> d.getLinkStatus() # Retrieves the current link status for all links >>> d.getLinkStatus(1) # Retrieves the current link status for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkVelocity, getLinkHeadloss, getLinkPumpState, getLinkSettings.
- getLinkSettings(*argv)[source]
Retrieves the current computed value of all link roughness for pipes or actual speed for pumps or actual setting for valves.
Using step-by-step hydraulic analysis,
Example:
>>> d.getLinkSettings() # Retrieves the current values of settings for all links >>> d.getLinkSettings(1) # Retrieves the current value of setting for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkVelocity, getLinkHeadloss, getLinkStatus, getLinkPumpState, getLinkEnergy.
- getLinkEnergy(*argv)[source]
Retrieves the current computed pump energy usage (read only).
Using step-by-step hydraulic analysis,
Example:
>>> d.getLinkEnergy() # Retrieves the current computed pump energy usage for all links >>> d.getLinkEnergy(1) # Retrieves the current computed pump energy usage for the first link
For more, you can check examples 3 & 4 of getLinkFlows function
See also getLinkFlows, getLinkVelocity, getLinkHeadloss, getLinkStatus, getLinkPumpState, getLinkPumpEfficiency.
- getLinkActualQuality(*argv)[source]
Retrieves the current computed link quality (read only).
Example:
>>> d.getLinkActualQuality() # Retrieves the current computed link quality for all links >>> d.getLinkActualQuality(1) # Retrieves the current computed link quality for the first link
Note
check epyt/examples/EX14_hydraulic_and_quality_analysis.py
See also getLinkFlows, getLinkStatus, getLinkPumpState, getLinkSettings, getLinkPumpEfficiency.
- getLinkIndex(*argv)[source]
Retrieves the indices of all links, or the indices of an ID set of links.
Example 1:
>>> d.getLinkIndex() # Retrieves the indices of all links
Example 2:
>>> linkID = d.getLinkNameID() >>> d.getLinkIndex(linkID) # Retrieves the index of the 1st link given it's ID
Example 3:
>>> linkID = d.getLinkNameID([1,2,3]) >>> d.getLinkIndex(linkID) # Retrieves the indices of the first 3 links given their ID
See also getLinkNameID, getLinkPipeIndex, getNodeIndex.
- getLinkNodesIndex(*argv)[source]
Retrieves the indexes of the from/to nodes of all links.
Example:
d.getLinkNodesIndex() d.getLinkNodesIndex(2) # Link index
See also getNodesConnectingLinksID.
- getLinkPipeIndex()[source]
Retrieves the pipe indices.
Example:
>>> d.getLinkPipeIndex()
See also getLinkIndex, getLinkPumpIndex.
- getLinkPipeNameID(*argv)[source]
Retrieves the pipe ID.
Example:
>>> d.getLinkPipeNameID() # Retrieves the ID's of all pipes >>> d.getLinkPipeNameID(1) # Retrieves the ID of the 1st pipe >>> d.getLinkPipeNameID([1,2,3]) # Retrieves the ID of the first 3 pipes
See also getLinkNameID, getLinkPumpNameID, getNodeNameID.
- getLinkPumpIndex(*argv)[source]
Retrieves the pump indices.
Example 1:
>>> d.getLinkPumpIndex() # Retrieves the indices of all pumps
Example 2:
>>> d.getLinkPumpIndex(1) # Retrieves the index of the 1st pump
Example 3:
>>> d = epanet('Richmond_standard.inp') >>> d.getLinkPumpIndex([1,2]) # Retrieves the indices of the first 2 pumps
See also getLinkIndex, getLinkPipeIndex, getLinkValveIndex.
- getLinkPumpNameID(*argv)[source]
Retrieves the pump ID.
Example 1:
>>> d.getLinkPumpNameID() # Retrieves the ID's of all pumps
Example 2:
>>> d.getLinkPumpNameID(1) # Retrieves the ID of the 1st pump
Example 3:
>>> d = epanet('Net3_trace.inp') >>> d.getLinkPumpNameID([1,2]) # Retrieves the ID of the first 2 pumps
See also getLinkNameID, getLinkPipeNameID, getNodeNameID.
- getLinkValveIndex()[source]
Retrieves the valve indices.
Example:
>>> d = epanet('ky10.inp') >>> d.getLinkValveIndex()
See also getLinkIndex, getLinkPipeIndex(), getLinkPumpIndex.
- getLinkValveNameID(*argv)[source]
Retrieves the valve ID.
Example:
>>> d = epanet('BWSN_Network_1.inp') >>> d.getLinkValveNameID() # Retrieves the ID's of all valves >>> d.getLinkValveNameID(1) # Retrieves the ID of the 1st valve >>> d.getLinkValveNameID([1,2,3]) # Retrieves the ID of the first 3 valves
See also getLinkNameID, getLinkPumpNameID, getNodeNameID.
- getNodeActualDemandSensingNodes(*argv)[source]
Retrieves the computed demand values at some sensing nodes.
Example: Retrieves the computed demand value of the first sensing node.
>>> d.getNodeActualDemandSensingNodes(1)
For more, you can type help (d.getNodePressure) and check examples 3 & 4.
See also getNodeActualDemand, getNodeHydraulicHead, getNodePressure, getNodeActualQuality, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
- getNodeCount()[source]
Retrieves the number of nodes.
Example:
>>> d.getNodeCount()
See also getNodeIndex, getLinkCount().
- getNodeActualDemand(*argv)[source]
Retrieves the computed value of all node actual demands.
Example:
>>> d.getNodeActualDemand() # Retrieves the computed value of all node actual demands >>> d.getNodeActualDemand(1) # Retrieves the computed value of the first node actual demand >>> d.getNodeActualDemand([1,2,3]) # Retrieves the computed value of the first 3 nodes actual demand
See also getNodeActualDemandSensingNodes, getNode HydraulicHead, getNodePressure, getNodeActualQuality, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
- getNodeActualQuality(*argv)[source]
Retrieves the computed values of the actual quality for all nodes.
Example:
>>> d.getNodeActualQuality() # Retrieves the computed values of the actual quality for all nodes >>> d.getNodeActualQuality(1) # Retrieves the computed value of the actual quality for the first node
See also getNodeActualDemand, getNodeActualDemandSensingNodes, getNodePressure, getNodeHydraulicHead, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
- getNodeBaseDemands(*argv)[source]
Retrieves the value of all node base demands.
Example 1:
>>> d.getNodeBaseDemands() >>> d.getNodeBaseDemands()[1] # Get categories 1
Example 2:
>>> d.getNodeBaseDemands(2) # Get node base demand with categories for specific node index
See also setNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternIndex, getNodeDemandPatternNameID.
- getNodeComment(*argv)[source]
Retrieves the comment string assigned to the node object.
Example:
>>> d.getNodeComment() # Retrieves the comment string assigned to all node objects >>> d.getNodeComment(4) # Retrieves the comment string assigned to the 4th node object >>> d.getNodeComment([1,2,3,4,5]) # Retrieves the comment string assigned to the 1st to 5th node object
See also setNodeComment, getNodesInfo, getNodeNameID, getNodeType.
- getNodeDemandCategoriesNumber(*argv)[source]
Retrieves the value of all node base demands categorie number.
Example 1:
>>> d.getNodeDemandCategoriesNumber() # Retrieves the value of all node base demands categorie number
Example 2:
>>> d.getNodeDemandCategoriesNumber(1) # Retrieves the value of the first node base demand categorie number
Example 3:
>>> d.getNodeDemandCategoriesNumber([1,2,3,4]) # Retrieves the value of the first 4 nodes base demand categorie number
See also getNodeBaseDemands, getNodeDemandPatternIndex, getNodeDemandPatternNameID.
- getNodeDemandDeficit(*argv)[source]
Retrieves the amount that full demand is reduced under PDA.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> d.setDemandModel('PDA', 0, 0.1, 0.5) # Sets a type of demand model and its parameters >>> d.getComputedHydraulicTimeSeries() # Computes hydraulic simulation and retrieve all time-series >>> d.getNodeDemandDeficit() # Retrieves the amount that full demand is reduced under PDA
See also setDemandModel, getComputedHydraulicTimeSeries, getNodeActualDemand, getNodeActualDemandSensingNodes.
- getNodeDemandPatternIndex()[source]
Retrieves the value of all node base demands pattern index.
Example:
>>> d.getNodeDemandPatternIndex() >>> d.getNodeDemandPatternIndex()[1]
See also getNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternNameID, setNodeDemandPatternIndex.
- getNodeReservoirHeadPatternIndex()[source]
Retrieves the value of all reservoir head pattern index.
- Example:
d = epanet(‘net2-cl2.inp’) res_index = d.addNodeReservoir(“res-1”) pidx = d.addPattern(“pat-1”, [1, 3]) d.setNodeReservoirHeadPatternIndex(res_index, pidx) print(d.getNodeDemandPatternIndex()) print(d.getNodeReservoirHeadPatternIndex())
- getNodeDemandPatternNameID()[source]
Retrieves the value of all node base demands pattern name ID.
Example:
>>> d.getNodeDemandPatternNameID() >>> d.getNodeDemandPatternNameID()[1]
See also getNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternIndex.
- getNodeElevations(*argv)[source]
Retrieves the value of all node elevations. Example:
>>> d.getNodeElevations() # Retrieves the value of all node elevations >>> d.getNodeElevations(1) # Retrieves the value of the first node elevation >>> d.getNodeElevations([4, 5, 6]) # Retrieves the value of the 5th to 7th node elevations
See also setNodeElevations, getNodesInfo, getNodeNameID, getNodeType, getNodeEmitterCoeff, getNodeInitialQuality.
- getNodeEmitterCoeff(*argv)[source]
Retrieves the value of all node emmitter coefficients.
Example:
>>> d.getNodeEmitterCoeff() # Retrieves the value of all node emmitter coefficients >>> d.getNodeEmitterCoeff(1) # Retrieves the value of the first node emmitter coefficient
See also setNodeEmitterCoeff, getNodesInfo, getNodeElevations.
- getNodeHydraulicHead(*argv)[source]
Retrieves the computed values of all node hydraulic heads.
Example 1:
>>> d.getNodeHydraulicHead() # Retrieves the computed value of all node hydraulic heads
Example 2:
>>> d.getNodeHydraulicHead(1) # Retrieves the computed value of the first node hydraulic head
For more, you can type help getNodePressure and check examples 3 & 4.
See also getNodeActualDemand, getNodeActualDemandSensingNodes, getNodePressure, getNodeActualQuality, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
- getNodeIndex(*argv)[source]
Retrieves the indices of all nodes or some nodes with a specified ID.
Example 1:
>>> d.getNodeIndex() # Retrieves the indices of all nodes
Example 2:
>>> nameID = d.getNodeNameID(1) >>> d.getNodeIndex(nameID) # Retrieves the node index given the ID label of the 1st node
See also getNodeNameID, getNodeReservoirIndex, getNodeJunctionIndex, getNodeType, getNodeTypeIndex, getNodesInfo.
- getNodeInitialQuality(*argv)[source]
Retrieves the value of all node initial quality.
Example 1:
>>> d.getNodeInitialQuality() # Retrieves the value of all node initial quality
Example 2:
>>> d.getNodeInitialQuality(1) # Retrieves the value of the first node initial quality
See also setNodeInitialQuality, getNodesInfo, getNodeSourceQuality.
- getNodeJunctionCount()[source]
Retrieves the number of junction nodes.
Example:
>>> d.getNodeJunctionCount()
See also getNodeTankCount, getNodeCount.
- getNodeJunctionDemandIndex(*argv)[source]
Retrieves the demand index of the junctions.
Example 1:
>>> d.getNodeJunctionDemandIndex() # Retrieves the demand index of all junctions
Example 2:
>>> d.getNodeJunctionDemandIndex(1,'') # Retrieves the demand index of the 1st junction given it's name (i.e. '')
Example 3:
>>> d.getNodeJunctionDemandIndex([1,2,3]) # Retrieves the demand index of the first 3 junctions
Example 4: Adds two new demands and retrieves the two new demand indices.
>>> d.addNodeJunctionDemand([1, 2], [100, 110], ['1', '1'], ['new demand1', 'new demand2']) >>> d.getNodeJunctionDemandIndex([1,2],['new demand1','new demand2'])
See also getNodeJunctionDemandName, getNodeJunctionIndex, getNodeJunctionNameID, addNodeJunctionDemand, deleteNodeJunctionDemand, getNodeJunctionCount.
- getNodeJunctionDemandName(*argv)[source]
Gets the name of a node’s demand category.
Example:
>>> model = d.getNodeJunctionDemandName()
See also setNodeJunctionDemandName, getNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternNameID.
- getNodeJunctionIndex(*argv)[source]
Retrieves the indices of junctions.
Example:
>>> d.getNodeJunctionIndex() # Retrieves the indices of all junctions >>> d.getNodeJunctionIndex([1,2]) # Retrieves the indices of the first 2 junctions
See also getNodeNameID, getNodeIndex, getNodeReservoirIndex, getNodeType, getNodeTypeIndex, getNodesInfo.
- getNodeJunctionNameID(*argv)[source]
Retrieves the junction ID label.
Example:
>>> d.getNodeJunctionNameID() # Retrieves the ID of all junctions >>> d.getNodeJunctionNameID(1) # Retrieves the ID of the 1st junction >>> d.getNodeJunctionNameID([1,2]) # Retrieves the ID of the first 2 junction
See also getNodeNameID, getNodeReservoirNameID, getNodeIndex, getNodeJunctionIndex, getNodeType, getNodesInfo.
- getNodeMassFlowRate(*argv)[source]
Retrieves the computed mass flow rates per minute of chemical sources for all nodes.
Example:
>>> d.getNodeMassFlowRate() # Retrieves the computed mass flow rates per minute of chemical sources for all nodes >>> d.getNodeMassFlowRate(1) # Retrieves the computed mass flow rates per minute of chemical sources for the first node
For more, you can type help getNodePressure and check examples 3 & 4.
See also getNodeActualDemand, getNodeActualDemandSensingNodes, getNodePressure, getNodeHydraulicHead, getNodeActualQuality, getNodeActualQualitySensingNodes.
- getNodePatternIndex(*argv)[source]
Retrieves the value of all node demand pattern indices.
Example 1:
>>> d.getNodePatternIndex() # Retrieves the value of all node demand pattern indices
Example 2:
>>> d.getNodePatternIndex(1) # Retrieves the value of the first node demand pattern index
See also getNodeBaseDemands, getNodeDemandCategoriesNumber, getNodeDemandPatternIndex, getNodeDemandPatternNameID.
- getNodePressure(*argv)[source]
Retrieves the computed values of all node pressures.
Example 1:
>>> d.getNodePressure() # Retrieves the computed values of all node pressures
Example 2:
>>> d.getNodePressure(1) # Retrieves the computed value of the first node pressure
Example 3: Hydraulic analysis step-by-step.
>>> d.openHydraulicAnalysis() >>> d.initializeHydraulicAnalysis() >>> tstep,P , T_H, D, H, F, S, = 1, [], [], [], [] ,[], [] >>> while (tstep>0): ... t = d.runHydraulicAnalysis() ... P.append(d.getNodePressure()) ... D.append(d.getNodeActualDemand()) ... H.append(d.getNodeHydraulicHead()) ... S.append(d.getLinkStatus()) ... F.append(d.getLinkFlows()) ... T_H.append(t) ... tstep=d.nextHydraulicAnalysisStep() >>> d.closeHydraulicAnalysis()
Example 4: Hydraulic and Quality analysis step-by-step.
>>> d.openHydraulicAnalysis() >>> d.openQualityAnalysis() >>> d.initializeHydraulicAnalysis(0) >>> d.initializeQualityAnalysis(d.ToolkitConstants.EN_NOSAVE) >>> tstep, P, T, F, QN, QL = 1, [], [], [], [], [] >>> while (tstep>0): ... t = d.runHydraulicAnalysis() ... qt = d.runQualityAnalysis() ... P.append(d.getNodePressure()) ... F.append(d.getLinkFlows()) ... QN.append(d.getNodeActualQuality()) ... QL.append(d.getLinkActualQuality()) ... T.append(t) ... tstep = d.nextHydraulicAnalysisStep() ... qtstep = d.nextQualityAnalysisStep() >>> d.closeQualityAnalysis() >>> d.closeHydraulicAnalysis()
See also getNodeActualDemand, getNodeActualDemandSensingNodes, getNodeHydraulicHead getNodeActualQuality, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
- getNodeReservoirIndex(*argv)[source]
Retrieves the indices of reservoirs.
Example 1:
>>> d.getNodeReservoirIndex() # Retrieves the indices of all reservoirs.
Example 2:
>>> d.getNodeReservoirIndex([1,2,3]) # Retrieves the indices of the first 3 reservoirs, if they exist.
See also getNodeNameID, getNodeIndex, getNodeJunctionIndex, getNodeType, getNodeTypeIndex, getNodesInfo.
- getNodeReservoirNameID(*argv)[source]
Retrieves the reservoir ID label.
Example :
>>> d.getNodeReservoirNameID() # Retrieves the ID of all reservoirs >>> d.getNodeReservoirNameID(1) # Retrieves the ID of the 1st reservoir >>> d.getNodeReservoirNameID([1,2]) # Retrieves the ID of the first 2 reservoirs (if they exist!)
See also getNodeNameID, getNodeJunctionNameID, getNodeIndex, getNodeReservoirIndex, getNodeType, getNodesInfo.
- getNodesConnectingLinksID(*argv)[source]
Retrieves the id of the from/to nodes of all links.
Example:
>>> d.getNodesConnectingLinksID() # Retrieves the id of the from/to nodes of all links >>> linkIndex = 1 >>> d.getNodesConnectingLinksID(1) # Retrieves the id of the from/to nodes of the 1st link
See also getLinkNodesIndex.
- getNodesConnectingLinksIndex()[source]
Retrieves the indexes of the from/to nodes of all links. Duplicate function with getLinkNodesIndex for new version.
Example:
>>> d.getNodesConnectingLinksIndex()
See also getLinkNodesIndex, getNodesConnectingLinksID.
- getNodesInfo()[source]
Retrieves nodes info (elevations, demand patterns, emmitter coeff, initial quality, source quality, source pattern index, source type index, node type index).
Example:
>>> d.getNodesInfo()
See also getNodeElevations, getNodeDemandPatternIndex, getNodeEmitterCoeff, getNodeInitialQuality, NodeTypeIndex.
- getNodeNameID(*argv)[source]
Retrieves the ID label of all nodes or some nodes with a specified index.
Example 1:
>>> d.getNodeNameID() # Retrieves the ID label of all nodes
Example 2:
>>> d.getNodeNameID(1) # Retrieves the ID label of the first node
Example 3:
>>> junctionIndex = d.getNodeJunctionIndex() >>> d.getNodeNameID(junctionIndex) # Retrieves the ID labels of all junctions give their indices
See also getNodeReservoirNameID, getNodeJunctionNameID, getNodeIndex, getNodeType, getNodesInfo.
- getNodeReservoirCount()[source]
Retrieves the number of Reservoirs.
Example:
>>> d.getNodeReservoirCount()
See also getNodeTankCount, getNodeCount.
- getNodeResultIndex(node_index)[source]
Retrieves the order in which a node’s results were saved to an output file.
Example:
>>> node_index = 3 >>> result_index = d.getNodeResultIndex(node_index)
See also getComputedHydraulicTimeSeries, deleteNode, getLinkResultIndex
- getNodeSourcePatternIndex(*argv)[source]
Retrieves the value of all node source pattern index.
Example 1:
d.getNodeSourcePatternIndex() # Retrieves the value of all node source pattern index d.getNodeSourcePatternIndex(1) # Retrieves the value of the first node source pattern index
See also setNodeSourcePatternIndex, getNodeSourceQuality, getNodeSourceTypeIndex, getNodeSourceType.
- getNodeSourceQuality(*argv)[source]
Retrieves the value of all node source quality.
Example 1:
>>> d.getNodeSourceQuality() # Retrieves the value of all node source quality >>> d.getNodeSourceQuality(1) # Retrieves the value of the first node source quality
See also setNodeSourceQuality, getNodeInitialQuality, getNodeSourcePatternIndex, getNodeSourceTypeIndex, getNodeSourceType.
- getNodeSourceType(*argv)[source]
Retrieves the value of all node source type.
Example:
>>> d.getNodeSourceType() # Retrieves the value of all node source type >>> d.getNodeSourceType(1) # Retrieves the value of the first node source type
See also setNodeSourceType, getNodeSourceQuality, getNodeSourcePatternIndex, getNodeSourceTypeIndex.
- getNodeSourceTypeIndex(*argv)[source]
Retrieves the value of all node source type index.
Example:
>>> d.getNodeSourceTypeIndex() # Retrieves the value of all node source type index >>> d.getNodeSourceTypeIndex(1) # Retrieves the value of the first node source type index
See also getNodeSourceQuality, getNodeSourcePatternIndex, getNodeSourceType.
- getNodeTankBulkReactionCoeff(*argv)[source]
Retrieves the tank bulk rate coefficient.
Example 1:
>>> d.getNodeTankBulkReactionCoeff() # Retrieves the bulk rate coefficient of all tanks
Example 2:
>>> d.getNodeTankBulkReactionCoeff(1) # Retrieves the bulk rate coefficient of the 1st tank
Example 3:
>>> d.getNodeTankBulkReactionCoeff([1,2]) # Retrieves the bulk rate coefficient of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankBulkReactionCoeff(tankIndex) # Retrieves the bulk rate coefficient of the tanks given their indices
See also setNodeTankBulkReactionCoeff, getNodeTankData.
- getNodeTankCanOverFlow(*argv)[source]
Retrieves the tank can overflow (= 1) or not (= 0).
Example 1:
>>> d.getNodeTankCanOverFlow() # Retrieves the can overflow of all tanks
Example 2:
>>> d.getNodeTankCanOverFlow(1) # Retrieves the can overflow of the 1st tank
Example 3:
>>> d = epanet('BWSN_Network_1.inp') >>> d.getNodeTankCanOverFlow([1,2]) # Retrieves the can overflow of the first 2 tanks
Example 4:
>>> d = epanet('BWSN_Network_1.inp') >>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankCanOverFlow(tankIndex) # Retrieves the can overflow of the tanks given their indices
See also setNodeTankCanOverFlow, getNodeTankData.
- getNodeTankCount()[source]
Retrieves the number of Tanks.
Example:
>>> d.getNodeTankCount()
See also getNodeReservoirCount, getNodeCount.
- getNodeTankData(*argv)[source]
Retrieves a group of properties for a tank.
Tank data that is retrieved:
Tank index
Elevation
Initial Level
Minimum Water Level
Maximum Water Level
Diameter
Minimum Water Volume
Volume Curve Index
Example 1:
>>> tankData = d.getNodeTankData().to_dict() # Retrieves all the data of all tanks
Example 2:
>>> tankIndex = d.getNodeTankIndex() >>> tankData = d.getNodeTankData(tankIndex) # Retrieves all the data given the index/indices of tanks.
Example 3:
>>> d.getNodeTankData().Elevation # Retrieves the elevations of all tanks.
See also setNodeTankData, getNodeElevations, getNodeTankInitialLevel, getNodeTankMinimumWaterLevel, getNodeTankDiameter.
- getNodeTankDiameter(*argv)[source]
Retrieves the tank diameters.
Example 1:
>>> d.getNodeTankDiameter() # Retrieves the diameters of all tanks
Example 2:
>>> d.getNodeTankDiameter(1) # Retrieves the diameter of the 1st tank
Example 3:
>>> d.getNodeTankDiameter([1,2]) # Retrieves the diameters of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankDiameter(tankIndex) # Retrieves the diameters of the tanks given their indices
See also setNodeTankDiameter, getNodeTankBulkReactionCoeff, getNodeTankInitialLevel, getNodeTankMixingModelType, getNodeTankVolume, getNodeTankNameID.
- getNodeTankIndex(*argv)[source]
Retrieves the tank indices.
Example 1:
d.getNodeTankIndex() # Retrieves the tank indices. d.getNodeTankIndex(1) # Retrieves the first tank index.
See also getNodeTankCount, getNodeTankNameID.
- getNodeTankInitialLevel(*argv)[source]
Retrieves the value of all tank initial water levels.
Example:
>>> d = epanet("ky10.inp") >>> d.getNodeTankInitialLevel() # Retrieves the value of all tank initial water levels >>> d.getNodeTankInitialLevel(11) # Retrieves the value of the eleventh node(tank) water level
See also setNodeTankInitialLevel, getNodeTankInitialWaterVolume, getNodeTankVolume, getNodeTankMaximumWaterLevel, getNodeTankMinimumWaterLevel.
- getNodeTankInitialWaterVolume(*argv)[source]
Retrieves the tank initial water volume.
Example 1:
>>> d.getNodeTankInitialWaterVolume() # Retrieves the initial water volume of all tanks
Example 2:
>>> d.getNodeTankInitialWaterVolume(1) # Retrieves the initial water volume of the 1st tank
Example 3:
>>> d.getNodeTankInitialWaterVolume([1,2]) # Retrieves the initial water volume of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankInitialWaterVolume(tankIndex) # Retrieves the initial water volume of the tanks given their indices
See also getNodeTankInitialLevel, getNodeTankVolume, getNodeTankMaximumWaterVolume, getNodeTankMinimumWaterVolume.
- getNodeTankMaximumWaterLevel(*argv)[source]
Retrieves the tank maximum water level.
Example 1:
>>> d.getNodeTankMaximumWaterLevel() # Retrieves the maximum water level of all tanks
Example 2:
>>> d.getNodeTankMaximumWaterLevel(1) # Retrieves the maximum water level of the 1st tank
Example 3:
>>> d.getNodeTankMaximumWaterLevel([1,2]) # Retrieves the maximum water level of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMaximumWaterLevel(tankIndex) # Retrieves the maximum water level of the tanks given their indices
See also setNodeTankMaximumWaterLevel, getNodeTankMinimumWaterLevel, getNodeTankInitialLevel, getNodeTankMaximumWaterVolume, getNodeTankMinimumWaterVolume, getNodeTankVolume.
- getNodeTankMaximumWaterVolume(*argv)[source]
Retrieves the tank maximum water volume.
Example 1:
>>> d.getNodeTankMaximumWaterVolume() # Retrieves the maximum water volume of all tanks
Example 2:
>>> d.getNodeTankMaximumWaterVolume(1) # Retrieves the maximum water volume of the 1st tank
Example 3:
>>> d.getNodeTankMaximumWaterVolume([1,2]) # Retrieves the maximum water volume of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMaximumWaterVolume(tankIndex) # Retrieves the maximum water volume of the tanks given their indices
See also getNodeTankMinimumWaterVolume, getNodeTankData.
- getNodeTankMinimumWaterLevel(*argv)[source]
Retrieves the tank minimum water level.
Example 1:
>>> d.getNodeTankMinimumWaterLevel() # Retrieves the minimum water level of all tanks
Example 2:
>>> d.getNodeTankMinimumWaterLevel(1) # Retrieves the minimum water level of the 1st tank
Example 3:
>>> d.getNodeTankMinimumWaterLevel([1,2]) # Retrieves the minimum water level of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMinimumWaterLevel(tankIndex) # Retrieves the minimum water level of the tanks given their indices
See also setNodeTankMinimumWaterLevel, getNodeTankMaximumWaterLevel, getNodeTankInitialLevel, getNodeTankMaximumWaterVolume, getNodeTankMinimumWaterVolume, getNodeTankVolume.
- getNodeTankMinimumWaterVolume(*argv)[source]
Retrieves the tank minimum water volume.
Example 1:
>>> d.getNodeTankMinimumWaterVolume() # Retrieves the minimum water volume of all tanks
Example 2:
>>> d.getNodeTankMinimumWaterVolume(1) # Retrieves the minimum water volume of the 1st tank
Example 3:
>>> d.getNodeTankMinimumWaterVolume([1,2]) # Retrieves the minimum water volume of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMinimumWaterVolume(tankIndex) # Retrieves the minimum water volume of the tanks given their indices
See also setNodeTankMinimumWaterVolume, getNodeTankMaximumWaterVolume, getNodeTankInitialWaterVolume, getNodeTankInitialLevel, getNodeTankVolume, getNodeTankMixZoneVolume.
- getNodeTankMixingFraction(*argv)[source]
Retrieves the tank Fraction of total volume occupied by the inlet/outlet zone in a 2-compartment tank.
Example 1:
>>> d.getNodeTankMixingFraction() # Retrieves the mixing fraction of all tanks
Example 2:
>>> d.getNodeTankMixingFraction(1) # Retrieves the mixing fraction of the 1st tank
Example 3:
>>> d.getNodeTankMixingFraction([1,2]) # Retrieves the mixing fraction of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMixingFraction(tankIndex) # Retrieves the mixing fraction of the tanks given their indices
See also setNodeTankMixingFraction, getNodeTankData.
- getNodeTankMixingModelCode(*argv)[source]
Retrieves the tank mixing model code.
- Code meaning:
0 = Complete mix model (MIX1) 1 = 2-compartment model (MIX2) 2 = First in, first out model (FIFO) 3 = Last in, first out model (LIFO)
Example 1:
>>> d.getNodeTankMixingModelCode() # Retrieves the mixing model code of all tanks
Example 2:
>>> d.getNodeTankMixingModelCode(1) # Retrieves the mixing model code of the 1st tank
Example 3:
>>> d.getNodeTankMixingModelCode([1,2]) # Retrieves the mixing model code of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMixingModelCode(tankIndex) # Retrieves the mixing model code of the tanks given their indices
See also setNodeTankMixingModelType, getNodeTankMixingModelType, getNodeTankMixZoneVolume.
- getNodeTankMixingModelType(*argv)[source]
Retrieves the tank mixing model type.
- Types of models that describe water quality mixing in storage tanks:
MIX1 = Complete mix model MIX2 = 2-compartment model FIFO = First in, first out model LIFO = Last in, first out model
Example 1:
>>> d.getNodeTankMixingModelType() # Retrieves the mixing model type of all tanks
Example 2:
>>> d.getNodeTankMixingModelType(1) # Retrieves the mixing model type of the 1st tank
Example 3:
>>> d.getNodeTankMixingModelType([1,2]) # Retrieves the mixing model type of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMixingModelType(tankIndex) # Retrieves the mixing model type of the tanks given their indices
See also setNodeTankMixingModelType, getNodeTankMixingModelCode, getNodeTankMixZoneVolume
- getNodeTankMixZoneVolume(*argv)[source]
Retrieves the tank mixing zone volume.
Example 1:
>>> d.getNodeTankMixZoneVolume() # Retrieves the mixing zone volume of all tanks
Example 2:
>>> d.getNodeTankMixZoneVolume(1) # Retrieves the mixing zone volume of the 1st tank
Example 3:
>>> d.getNodeTankMixZoneVolume([1,2]) # Retrieves the mixing zone volume of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankMixZoneVolume(tankIndex) # Retrieves the mixing zone volume of the tanks given their indices
See also getNodeTankMixingModelCode, getNodeTankMixingModelType.
- getNodeTankNameID(*argv)[source]
Retrieves the tank IDs.
Example:
d.getNodeTankNameID() # Retrieves the IDs of all tanks d.getNodeTankNameID(1) # Retrieves the ID of the 1st tank d.getNodeTankNameID([1,2]) # Retrieves the ID of the first 2 tanks (if they exist!)
See also getNodeTankCount, getNodeTankIndex.
- getNodeTankReservoirCount()[source]
Retrieves the number of tanks/reservoirs.
Example:
>>> d.getNodeTankReservoirCount()
See also getNodeTankIndex, getNodeReservoirIndex.
- getNodeTankVolume(*argv)[source]
Retrieves the tank volume.
Example 1:
>>> d.getNodeTankVolume() # Retrieves the volume of all tanks
Example 2:
>>> d.getNodeTankVolume(1) # Retrieves the volume of the 1st tank
Example 3:
>>> d.getNodeTankVolume([1,2]) # Retrieves the volume of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankVolume(tankIndex) # Retrieves the volume of the tanks given their indices
See also getNodeTankData.
- getNodeTankVolumeCurveIndex(*argv)[source]
Retrieves the tank volume curve index.
Example 1:
>>> d.getNodeTankVolumeCurveIndex() # Retrieves the volume curve index of all tanks
Example 2:
>>> d.getNodeTankVolumeCurveIndex(1) # Retrieves the volume curve index of the 1st tank
Example 3:
>>> d.getNodeTankVolumeCurveIndex([1,2]) # Retrieves the volume curve index of the first 2 tanks
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.getNodeTankVolumeCurveIndex(tankIndex) # Retrieves the volume curve index of the tanks given their indices
See also getNodeTankVolume, getNodeTankMaximumWaterVolume, getNodeTankMinimumWaterVolume, getNodeTankInitialWaterVolume, getNodeTankMixZoneVolume.
- getNodeType(*argv)[source]
Retrieves the node-type code for all nodes.
Example 1:
>>> d.getNodeType() # Retrieves the node-type code for all nodes
Example 2:
>>> d.getNodeType(1) # Retrieves the node-type code for the first node
Example 3:
>>> d.getNodeType([10,11]) # Retrieves the node-type code for the tenth and eleventh nodes
See also getNodeNameID, getNodeIndex, getNodeTypeIndex, getNodesInfo.
- getNodeTypeIndex(*argv)[source]
Retrieves the node-type code for all nodes.
Example:
>>> d.getNodeTypeIndex() # Retrieves the node-type code for all nodes >>> d.getNodeTypeIndex(1) # Retrieves the node-type code for the first node
See also getNodeNameID, getNodeIndex, getNodeType, getNodesInfo.
- getOptionsAccuracyValue()[source]
Retrieves the total normalized flow change for hydraulic convergence.
Example:
>>> d.getOptionsAccuracyValue()
See also setOptionsAccuracyValue, getOptionsExtraTrials, getOptionsMaxTrials.
- getOptionsCheckFrequency()[source]
Retrieves the frequency of hydraulic status checks.
Example:
>>> d.getOptionsCheckFrequency()
See also setOptionsCheckFrequency, getOptionsMaxTrials, getOptionsMaximumCheck.
- getOptionsDampLimit()[source]
Retrieves the accuracy level where solution damping begins.
Example:
>>> d.getOptionsDampLimit()
See also setOptionsDampLimit, getOptionsMaxTrials, getOptionsCheckFrequency.
- getOptionsDemandCharge()[source]
Retrieves the energy charge per maximum KW usage.
Example:
>>> d.getOptionsDemandCharge()
See also setOptionsDemandCharge, getOptionsGlobalPrice, getOptionsGlobalPattern.
- getOptionsEmitterExponent()[source]
Retrieves the power exponent for the emmitters.
Example:
>>> d.getOptionsEmitterExponent()
See also setOptionsEmitterExponent, getOptionsPatternDemandMultiplier, getOptionsAccuracyValue.
- getOptionsExtraTrials()[source]
Retrieves the extra trials allowed if hydraulics don’t converge.
Example:
>>> d.getOptionsExtraTrials()
See also setOptionsExtraTrials, getOptionsMaxTrials, getOptionsMaximumCheck.
- getOptionsFlowChange()[source]
Retrieves the maximum flow change for hydraulic convergence.
Example:
>>> d.getOptionsFlowChange()
See also setOptionsFlowChange, getOptionsHeadError, getOptionsHeadLossFormula.
- getOptionsGlobalEffic()[source]
Retrieves the global efficiency for pumps(percent).
Example:
>>> d.getOptionsGlobalEffic()
See also setOptionsGlobalEffic, getOptionsGlobalPrice, getOptionsGlobalPattern.
- getOptionsGlobalPrice()[source]
Retrieves the global average energy price per kW-Hour.
Example:
>>> d.getOptionsGlobalPrice()
See also setOptionsGlobalPrice, getOptionsGlobalEffic, getOptionsGlobalPattern.
- getOptionsGlobalPattern()[source]
Retrieves the index of the global energy price pattern.
Example:
>>> d.getOptionsGlobalPattern()
See also setOptionsGlobalPattern, getOptionsGlobalEffic, getOptionsGlobalPrice.
- getOptionsHeadError()[source]
Retrieves the maximum head loss error for hydraulic convergence.
Example:
>>> d.getOptionsHeadError()
See also setOptionsHeadError, getOptionsEmitterExponent, getOptionsAccuracyValue.
- getOptionsHeadLossFormula()[source]
Retrieves the headloss formula.
Example:
>>> d.getOptionsHeadLossFormula()
See also setOptionsHeadLossFormula, getOptionsHeadError, getOptionsFlowChange.
- getOptionsLimitingConcentration()[source]
Retrieves the limiting concentration for growth reactions.
Example:
>>> d.getOptionsLimitingConcentration()
See also setOptionsLimitingConcentration, getOptionsPipeBulkReactionOrder, getOptionsPipeWallReactionOrder.
- getOptionsMaximumCheck()[source]
Retrieves the maximum trials for status checking.
Example:
>>> d.getOptionsMaximumCheck()
See also setOptionsMaximumCheck, getOptionsMaxTrials, getOptionsCheckFrequency.
- getOptionsMaxTrials()[source]
Retrieves the maximum hydraulic trials allowed for hydraulic convergence.
Example:
>>> d.getOptionsMaxTrials()
See also setOptionsMaxTrials, getOptionsExtraTrials, getOptionsAccuracyValue.
- getOptionsPatternDemandMultiplier()[source]
Retrieves the global pattern demand multiplier.
Example:
>>> d.getOptionsPatternDemandMultiplier()
See also setOptionsPatternDemandMultiplier, getOptionsEmitterExponent, getOptionsAccuracyValue.
- getOptionsPipeBulkReactionOrder()[source]
Retrieves the bulk water reaction order for pipes.
Example:
>>> d.getOptionsPipeBulkReactionOrder()
See also setOptionsPipeBulkReactionOrder, getOptionsPipeWallReactionOrder, getOptionsTankBulkReactionOrder.
- getOptionsPipeWallReactionOrder()[source]
Retrieves the wall reaction order for pipes (either 0 or 1).
Example:
>>> d.getOptionsPipeWallReactionOrder()
See also setOptionsPipeWallReactionOrder, getOptionsPipeBulkReactionOrder, getOptionsTankBulkReactionOrder.
- getOptionsQualityTolerance()[source]
Retrieves the water quality analysis tolerance.
Example:
>>> d.getOptionsQualityTolerance()
See also setOptionsQualityTolerance, getOptionsSpecificDiffusivity, getOptionsLimitingConcentration.
- getOptionsSpecificDiffusivity()[source]
Retrieves the specific diffusivity (relative to chlorine at 20 deg C).
Example:
>>> d.getOptionsSpecificDiffusivity()
See also setOptionsSpecificDiffusivity, getOptionsSpecificViscosity, getOptionsSpecificGravity.
- getOptionsSpecificGravity()[source]
Retrieves the specific gravity.
Example:
>>> d.getOptionsSpecificGravity()
See also setOptionsSpecificGravity, getOptionsSpecificViscosity, getOptionsHeadLossFormula.
- getOptionsSpecificViscosity()[source]
Retrieves the specific viscosity.
Example:
>>> d.getOptionsSpecificViscosity()
See also setOptionsSpecificViscosity, getOptionsSpecificGravity, getOptionsHeadLossFormula.
- getOptionsTankBulkReactionOrder()[source]
Retrieves the bulk water reaction order for tanks.
Example:
>>> d.getOptionsTankBulkReactionOrder()
See also setOptionsTankBulkReactionOrder, getOptionsPipeBulkReactionOrder, getOptionsPipeWallReactionOrder.
- getOptionsStatusReport()[source]
Gets the status report , (EN_NO_REPORT, EN_NORMAL_REPORT or EN_FULL_REPORT).
- getPattern()[source]
Retrieves the multiplier factor for all patterns and all times.
Example:
>>> d.getPattern()
See also getPatternLengths, getPatternValue, getPatternAverageValue().
- getPatternAverageValue()[source]
Retrieves the average values of all the time patterns.
Example:
>>> d.getPatternAverageValue()
See also getPattern, setPattern, getPatternValue, getPatternLengths.
- getPatternAverageDefaultValue()[source]
Retrieves the average value of the default pattern
- Example:
d = epanet(network.inp) d.getPatternAverageDefaultValue()
- getPatternComment(*argv)[source]
Retrieves the comment string assigned to the pattern object.
Example:
>>> d.getPatternComment() # Retrieves the comments of all the patterns >>> d.getPatternComment(1) # Retrieves the comment of the 1st pattern >>> d.getPatternComment([1,2]) # Retrieves the comments of the first 2 patterns
See also setPatternComment, getPattern.
- getPatternCount()[source]
Retrieves the number of patterns.
Example:
>>> d.getPatternCount()
See also getPatternIndex, getPattern.
- getPatternIndex(*argv)[source]
Retrieves the index of all or some time patterns given their IDs.
Example 1:
>>> d.getPatternIndex() # Retrieves the indices of all time patterns
Example 2:
>>> patternIndex = 1 >>> patternID = d.getPatternNameID(patternIndex) >>> d.getPatternIndex(patternID) # Retrieves the index of the 1st time pattern given it's ID
Example 3:
>>> d = epanet('Richmond_standard.inp') >>> patternIndex = [1,2] >>> patternID = d.getPatternNameID(patternIndex) >>> d.getPatternIndex(patternID) # Retrieves the index of the first 2 time patterns given their IDs
See also getPatternNameID, getPattern.
- getPatternLengths(*argv)[source]
Retrieves the number of time periods in all or some time patterns.
Example 1:
>>> d.getPatternLengths() # Retrieves the number of time periods of all time patterns
Example 2:
>>> patternIndex = 1 >>> d.getPatternLengths(patternIndex) # Retrieves the number of time periods of the 1st time pattern
Example 3:
>>> d = epanet('BWSN_Network_1.inp') >>> patternIndex = [1,2,3] >>> d.getPatternLengths(patternIndex) # Retrieves the number of time periods of the first 2 time patterns
See also getPatternIndex, getPattern.
- getPatternNameID(*argv)[source]
Retrieves the ID label of all or some time patterns indices.
Example 1:
>>> d.getPatternNameID() # Retrieves the IDs of all the patterns
Example 2:
>>> d.getPatternNameID(1) # Retrieves the ID of the 1st pattern
Example 3:
>>> d.getPatternNameID([1,2]) # Retrieves the IDs of the first 2 patterns
See also setPatternNameID, getPattern.
- getPatternValue(patternIndex, patternStep)[source]
Retrieves the multiplier factor for a certain pattern and time.
Example:
>>> patternIndex = 1 >>> patternStep = 5 >>> d.getPatternValue(patternIndex, patternStep) # Retrieves the 5th multiplier factor of the 1st time pattern
See also getPattern, getPatternLengths, getPatternAverageValue().
- getQualityCode()[source]
Retrieves the code of water quality analysis type.
- Water quality analysis code:
0 = No quality analysis 1 = Chemical analysis 2 = Water age analysis 3 = Source tracing
Example:
>>> d.getQualityCode()
See also getQualityInfo, getQualityType.
- getQualityInfo()[source]
Retrieves quality analysis information (type, chemical name, units, trace node ID).
- Information that is retrieved:
Water quality analysis code 0 = No quality analysis 1 = Chemical analysis 2 = Water age analysis 3 = Source tracing
Name of the chemical being analyzed
Units that the chemical is measured in
Index of node traced in a source tracing analysis
Quality type
Example:
>>> qualInfo = d.getQualityInfo() # Retrieves all the quality info >>> qualInfo.to_dict() >>> d.getQualityInfo().QualityCode # Retrieves the water quality analysis code >>> d.getQualityInfo().QualityChemName # Retrieves the name of the chemical being analyzed >>> d.getQualityInfo().QualityChemUnits # Retrieves the units that the chemical is measured in >>> d.getQualityInfo().TraceNode # Retrieves the index of node traced in a source tracing analysis >>> d.getQualityInfo().QualityType # Retrieves the quality type
See also getQualityType, getQualityCode.
- getQualityTraceNodeIndex()[source]
Retrieves the trace node index of water quality analysis type.
Example:
>>> d.getQualityTraceNodeIndex()
See also getQualityInfo, getQualityType.
- getQualityType(*argv)[source]
Retrieves the type of water quality analysis type.
Example:
>>> d.getQualityType()
See also getQualityInfo, getQualityCode.
- getLinkResultIndex(link_index)[source]
Retrieves the order in which a link’s results were saved to an output file.
Example:
>>> link_index = 3 >>> result_index = d.getLinkResultIndex(link_index)
See also getComputedHydraulicTimeSeries, deleteNode, getNodeResultIndex
- getRuleCount()[source]
Retrieves the number of rules.
Example:
>>> d.getRuleCount()
See also getRules, getControlCount.
- getRuleID(*argv)[source]
Retrieves the ID name of a rule-based control given its index.
# The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> d.getRuleID() # Retrieves the ID name of every rule-based control >>> d.getRuleID(1) # Retrieves the ID name of the 1st rule-based control >>> d.getRuleID([1,2,3]) # Retrieves the ID names of the 1st to 3rd rule-based control
See also getRules, getRuleInfo, addRules.
- getRuleInfo(*argv)[source]
Retrieves summary information about a rule-based control given it’s index.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> RuleInfo = d.getRuleInfo() # Retrieves summary information about every rule-based control >>> d.getRuleInfo(1).to_dict() # Retrieves summary information about the 1st rule-based control >>> d.getRuleInfo([1,2,3]).to_dict() # Retrieves summary information about the 1st to 3rd rule-based control
See also getRuleID, getRules, addRules.
- getRules(*argv)[source]
Retrieves the rule - based control statements.
# The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> rules = d.getRules() >>> rule_first_index = 1 >>> rule_first = rules[rule_first_index] # Retrieves all the statements of the 1st rule - based control >>> rule_second_index = 2 >>> rule_second = rules[rule_second_index] # Retrieves all the statements of the 2nd rule - based control
Example 2:
>>> rule_first = d.getRules(1) # Retrieves all the statements of the 1st rule - based control >>> rule_first_ID = d.getRules()[1]['Rule_ID'] # Retrieves the ID of the 1st rule - based control >>> rule_first_premises = d.getRules()[1]['Premises'] # Retrieves all the premises of the 1st rule - based control >>> rule_first_Then_Actions = d.getRules()[1]['Then_Actions'] # Retrieves all the then actions of the 1st rule - based control >>> rule_first_Else_Actions = d.getRules()[1]['Else_Actions'] # Retrieves all the else actions of the 1st rule - based control >>> rule_first_Rule = d.getRules()[1]['Rule']
See also getRuleInfo, getRuleID, getRuleCount, setRules, deleteRules, addRules.
- getStatistic()[source]
Returns error code.
Input: none
- Output:
iter: # of iterations to reach solution
relerr: convergence error in solution
Example:
>>> d.getStatistic().disp()
- getStatisticTotalLeakageLoss()[source]
Retrieves the total leakage loss statistic from the simulation.
- Returns:
float: The total amount of leakage loss in the system,
- getStatisticIterations()[source]
Retrieves the number of iterations taken in the simulation.
- Returns:
int: The total number of iterations performed during the hydraulic analysis,
- getStatisticRelativeError()[source]
Retrieves the relative error statistic from the simulation.
- Returns:
float: The relative error from the last hydraulic iteration
- getStatisticDeficientNodes()[source]
Retrieves the number of deficient nodes in the simulation.
- Returns:
int: The number of nodes in the system that are unable to meet the required demand,
- getStatisticDemandReduction()[source]
Retrieves the demand reduction statistic from the simulation.
- Returns:
float: The total demand reduction in the system
- getTimeSimulationDuration()[source]
Retrieves the value of simulation duration.
Example:
>>> d.getTimeSimulationDuration()
See also getTimePatternStep, getTimeSimulationDuration.
- getTimeHydraulicStep()[source]
Retrieves the value of the hydraulic time step.
Example:
>>> d.getTimeHydraulicStep()
See also getTimeQualityStep, getTimeSimulationDuration.
- getTimeQualityStep()[source]
Retrieves the value of the water quality time step.
Example:
>>> d.getTimeQualityStep()
See also getTimeSimulationDuration, getTimeSimulationDuration.
- getTimePatternStep()[source]
Retrieves the value of the pattern time step.
Example:
>>> d.getTimePatternStep()
See also getTimePatternStart, getTimeSimulationDuration.
- getTimePatternStart()[source]
Retrieves the value of pattern start time.
Example:
>>> d.getTimePatternStart()
See also getTimePatternStep, getTimeSimulationDuration.
- getTimeReportingStep()[source]
Retrieves the value of the reporting time step.
Example:
>>> d.getTimeReportingStep()
See also getTimeReportingPeriods, getTimeReportingStart.
- getTimeReportingStart()[source]
Retrieves the value of the reporting start time.
Example:
>>> d.getTimeReportingStart()
See also getTimeReportingPeriods, getTimeReportingStep.
- getTimeRuleControlStep()[source]
Retrieves the time step for evaluating rule-based controls.
Example:
>>> d.getTimeRuleControlStep()
See also getTimeSimulationDuration.
- getTimeStatisticsType()[source]
Retrieves the type of time series post-processing.
- Types:
NONE: Reports the full time series for all quantities for all nodes and links (default)
AVERAGE: Reports a set of time-averaged results
MINIMUM: Reports only the minimum values
MAXIMUM: Reports only the maximum values
RANGE: Reports the difference between the minimum and maximum values
Example:
>>> d.getTimeStatisticsType()
See also getTimeStatisticsIndex, getTimeSimulationDuration.
- getTimeStatisticsIndex()[source]
Retrieves the index of the type of time series post-processing.
- Type of time series post-processing:
0 = ‘NONE’ 1 = ‘AVERAGE’ 2 = ‘MINIMUM’ 3 = ‘MAXIMUM’ 4 = ‘RANGE’
Example:
>>> d.getTimeStatisticsIndex()
See also getTimeStatisticsType, getTimeSimulationDuration.
- getTimeReportingPeriods()[source]
Retrieves the number of reporting periods saved to the binary.
Example:
>>> d.getTimeReportingPeriods()
See also getTimeReportingStart, getTimeReportingStep.
- getTimeClockStartTime()[source]
Retrieves the simulation starting time of day.
Example:
>>> d.getTimeClockStartTime()
See also getTimeSimulationDuration, getTimePatternStart.
- getTimeStartTime()[source]
Retrieves the simulation starting time of day.
Example:
>>> d.getTimeStartTime()
See also getTimeSimulationDuration, getTimePatternStart.
- getTimeHTime()[source]
Retrieves the elapsed time of current hydraulic solution.
Example:
>>> d.getTimeHTime()
See also getTimeSimulationDuration, getComputedHydraulicTimeSeries.
- getTimeQTime()[source]
Retrieves the elapsed time of current quality solution.
Example:
>>> d.getTimeQTime()
See also getTimeQualityStep, getComputedQualityTimeSeries.
- getTimeHaltFlag()[source]
Retrieves the number of halt flag indicating if the simulation was halted.
Example:
>>> d.getTimeHaltFlag()
See also getTimeClockStartTime, getTimeSimulationDuration.
- getTimeNextEvent()[source]
Retrieves the shortest time until a tank becomes empty or full.
Example:
>>> d.getTimeNextEvent()
See also getTimeNextEventTank.
- getTimeNextEventTank()[source]
Retrieves the index of tank with shortest time to become empty or full.
Example:
>>> d.getTimeNextEventTank()
See also getTimeNextEvent.
- getTitle(*argv)[source]
Retrieves the title lines of the project.
Example: Retrieves the three title lines of the project.
>>> [Line1, Line2, Line3] = d.getTitle()
See also setTitle.
- getUnits()[source]
Retrieves the Units of Measurement.
Example 1:
>>> allUnits = d.getUnits() # Retrieves all the unitperiod >>> allUnits.to_dict() # Print all values
Example 2:
>>> d.getUnits().NodeElevationUnits # Retrieves elevation units >>> d.getUnits().LinkVelocityUnits # Retrieves velocity units
OWA-EPANET Toolkit: https://github.com/OpenWaterAnalytics/EPANET/wiki/Units-of-Measurement
See also getFlowUnits.
- getVersion()[source]
Retrieves the current EPANET version of DLL.
Example:
>>> d.getVersion()
See also getENfunctionsImpemented, getLibFunctions.
- initializeEPANET(unitsType, headLossType)[source]
Initializes an EPANET project that isn’t opened with an input file
Example:
>>> d.initializeEPANET(d.ToolkitConstants.EN_GPM, d.ToolkitConstants.EN_HW)
See also initializeHydraulicAnalysis.
- initializeQualityAnalysis(*argv)[source]
Initializes water quality and the simulation clock time prior to running a water quality analysis.
- Codes:
NOSAVE = 0, Don’t save the results to the project’s binary output file.
SAVE = 1, Save the results to the project’s binary output file.
Example 1:
>>> d.initializeQualityAnalysis() # Uses the default code i.e. SAVE = 1
Example 2:
>>> code = 0 # i.e. Don't save >>> d.initializeQualityAnalysis(code)
For more, you can type help getNodePressure and check examples 3 & 4.
See also openQualityAnalysis, initializeHydraulicAnalysis.
- loadEPANETFile(*argv)[source]
Load epanet file when use bin functions.
Example:
>>> d.loadEPANETFile(d.TempInpFile)
- loadMSXEPANETFile(msxfile)[source]
Load EPANET MSX file.
Example:
>>> d.loadMSXEPANETFile(d.MSXTempFile)
- nextQualityAnalysisStep()[source]
Advances the water quality simulation to the start of the next hydraulic time period.
Example:
>>> d.nextQualityAnalysisStep()
For more, you can type help getNodePressure and check examples 3 & 4.
See also nextHydraulicAnalysisStep, runQualityAnalysis.
- openAnyInp(*argv)[source]
Open as on matlab editor any EPANET input file using built in function open. Open current loaded input file (not temporary)
Example:
>>> d.openAnyInp() >>> d.openAnyInp('epyt/networks/Net2.inp')
- openCurrentInp(*argv)[source]
Opens EPANET input file who is loaded
Example:
>>> d.openCurrentInp()
- openQualityAnalysis()[source]
Opens the water quality analysis system.
Example:
>>> d.openQualityAnalysis()
For more, you can type help getNodePressure and check examples 3 & 4.
See also openHydraulicAnalysis, initializeQualityAnalysis.
- runQualityAnalysis()[source]
Makes 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.
Example:
>>> tstep = d.runQualityAnalysis()
For more, you can type help getNodePressure and check examples 3 & 4.
See also runHydraulicAnalysis, initializeQualityAnalysis.
- runsCompleteSimulation(*argv)[source]
Runs 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_epanet
Example:
>>> d.runsCompleteSimulation() >>> d.runsCompleteSimulation('results') # using d.api.en_epanet
- saveHydraulicFile(hydname)[source]
Saves the current contents of the binary hydraulics file to a file.
Example:
>>> filename = 'test.hyd' >>> d.saveHydraulicFile(filename)
For more, you can type help getNodePressure and check examples 3 & 4.
See also useHydraulicFile, initializeHydraulicAnalysis.
- saveHydraulicsOutputReportingFile()[source]
Transfers results of a hydraulic simulation from the binary Hydraulics file to the binary Output file, where results are only reported at uniform reporting intervals.
Example:
>>> d.saveHydraulicsOutputReportingFile()
See also saveHydraulicFile, closeHydraulicAnalysis.
- saveInputFile(*argv)[source]
Writes all current network input data to a file using the format of an EPANET input file. Returns an error code.
Example:
>>> filename = ('test.inp') >>> d.saveInputFile(filename)
See also unload, saveHydraulicFile.
- setControls(index, control=None, *argv)[source]
Sets the parameters of a simple control statement.
The examples are based on d = epanet(‘Net1.inp’)
Example 1:
>>> controlIndex = 1 >>> d.getControls(controlIndex).disp() # Retrieves the 1st control >>> control = 'LINK 9 CLOSED IF NODE 2 ABOVE 180' >>> d.setControls(controlIndex, control) # Sets a control given it's index and the control statement >>> d.getControls(controlIndex).disp()
Example 2:
>>> controls = d.getControls() >>> d.setControls(controls) # Sets multiple controls given as dicts with keys
Example 3:
>>> control_1 = 'LINK 9 OPEN IF NODE 2 BELOW 110' >>> control_2 = 'LINK 9 CLOSED IF NODE 2 ABOVE 200' >>> controls = [control_1, control_2] >>> d.setControls(controls) # Sets multiple controls given as cell >>> d.getControls(1).disp() >>> d.getControls(2).disp()
- Example 4:
index: control statement index
control: control type code
lindex: index of link being controlled
setting: value of the control setting
nindex: index of controlling node
- level: value of controlling water level or pressure for
level controls or of time of control action (in seconds) for time-based controls
- Control type codes consist of the following:
EN_LOWLEVEL 0 Control applied when tank level or node pressure drops below specified level
EN_HILEVEL 1 Control applied when tank level or node pressure rises above specified level
EN_TIMER 2 Control applied at specific time into simulation
EN_TIMEOFDAY 3 Control applied at specific time of day
Code example: d.setControls(index, control, lindex, setting, nindex, level)
>>> d.setControls(1, 0, 13, 0, 11, 30)
See also getControls, getControlCount, addControls, deleteControls.
- setCurve(index, curveVector)[source]
Sets x, y values for a specific curve.
The example is based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> curveIndex = 1 >>> d.getCurvesInfo().CurveXvalue[curveIndex-1] # Retrieves the X values of the 1st curve >>> d.getCurvesInfo().CurveYvalue[curveIndex-1] # Retrieves the Y values of the 1st curve >>> x_y_1 = [0, 730] >>> x_y_2 = [1000, 500] >>> x_y_3 = [1350, 260] >>> values = [x_y_1, x_y_2, x_y_3] # X and Y values selected. >>> d.setCurve(curveIndex, values) # Sets the X and Y values of the 1st curve >>> d.getCurvesInfo().CurveXvalue[curveIndex-1] >>> d.getCurvesInfo().CurveYvalue[curveIndex-1]
See also setCurveValue, getCurvesInfo.
- setCurveComment(value, *argv)[source]
Sets the comment string of a curve.
Example 1:
>>> d.getCurveComment() # Retrieves the comments of all the curves >>> curveIndex = 1 >>> comment = 'This is a curve' >>> d.setCurveComment(curveIndex, comment) # Sets a comment to the 1st curve >>> d.getCurveComment(curveIndex)
Example 2:
>>> d = epanet('BWSN_Network_1.inp') >>> d.getCurveComment() >>> curveIndex = [1,2] >>> comment = ['This is the 1st curve', 'This is the 2nd curve'] >>> d.setCurveComment(curveIndex, comment) # Sets comments to the first 2 curves >>> d.getCurveComment(curveIndex)
See also getCurveComment, getCurveIndex, getCurvesInfo.
- setCurveNameID(index, Id)[source]
Sets the name ID of a curve given it’s index and the new ID.
Example 1:
>>> d.getCurveNameID() # Retrieves the name IDs of all the curves >>> d.setCurveNameID(1, 'Curve1') # Sets to the 1st curve the new name ID 'Curve1' >>> d.getCurveNameID()
Example 2: Sets to the 1st and 2nd curve the new name IDs ‘Curve1’ and ‘Curve2’ respectively.
>>> d.setCurveNameID([1, 2], ['Curve1', 'Curve2']) >>> d.getCurveNameID()
See also getCurveNameID, getCurveIndex, getCurveLengths, setCurve, setCurveComment, getCurveComment.
- setCurveValue(index, curvePnt, value)[source]
Sets x, y point for a specific point number and curve.
The example is based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> curveIndex = 1 >>> d.getCurvesInfo().CurveXvalue[curveIndex-1] # Retrieves the X values of the 1st curve >>> d.getCurvesInfo().CurveYvalue[curveIndex-1] # Retrieves the Y values of the 1st curve >>> curvePoint = 1 # Point of the curve selected >>> x_y_values = [10, 400] # X and Y values selected >>> d.setCurveValue(curveIndex, curvePoint, x_y_values) # Sets the X and Y values of the 1st point on the 1st curve >>> d.getCurvesInfo().CurveXvalue[curveIndex-1] >>> d.getCurvesInfo().CurveYvalue[curveIndex-1]
See also getCurveValue, setCurve, getCurvesInfo.
- setDemandModel(code, pmin, preq, pexp)[source]
Sets the type of demand model to use and its parameters.
- Parameters:
code (str) – Type of demand model * ‘DDA’ = Demand driven analysis (in which case the remaining three parameter values are ignored) * ‘PDA’ = Pressure driven analysis
pmin (float) – Pressure below which there is no demand
preq (float) – Pressure required to deliver full demand
pexp (float) – Pressure exponent in demand function
- Returns:
None
Example:
>>> d.getDemandModel().disp() # Print the demand model >>> type = 'PDA' >>> pmin = 0 >>> preq = 0.1 >>> pexp = 0.5 >>> d.setDemandModel(type, pmin, preq, pexp) # Sets the demand model >>> d.getDemandModel().to_dict()
See also getDemandModel, setNodeBaseDemands, setNodeJunctionDemandName, addNodeJunctionDemand, deleteNodeJunctionDemand.
- setFlowUnitsAFD(*argv)[source]
Sets flow units to AFD(Acre-Feet per Day).
Example:
>>> d.setFlowUnitsAFD() # d.setFlowUnitsAFD('NET1_AFD.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsCFS(*argv)[source]
Sets flow units to CFS(Cubic Feet per Second).
Example:
>>> d.setFlowUnitsCFS() # d.setFlowUnitsCFS('NET1_CFS.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsCMD(*argv)[source]
Sets flow units to CMD(Cubic Meters per Day).
Example:
>>> d.setFlowUnitsCMD() # d.setFlowUnitsCMD('NET1_CMD.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsCMH(*argv)[source]
Sets flow units to CMH(Cubic Meters per Hour).
Example:
>>> d.setFlowUnitsCMH() # d.setFlowUnitsCMH('NET1_CMH.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsCMS(*argv)[source]
Sets flow units to CMS(Cubic Meters per Second).
Example:
>>> d.setFlowUnitsCMS() >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsGPM(*argv)[source]
Sets flow units to GPM(Gallons Per Minute).
Example:
>>> d.setFlowUnitsGPM() # d.setFlowUnitsGPM('NET1_GPM.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsIMGD(*argv)[source]
Sets flow units to IMGD(Imperial Million Gallons per Day).
Example:
>>> d.setFlowUnitsIMGD() # d.setFlowUnitsIMGD('NET1_IMGD.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsLPM(*argv)[source]
Sets flow units to LPM(Liters Per Minute).
Example:
>>> d.setFlowUnitsLPM() # d.setFlowUnitsLPM('NET1_LPM.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsLPS(*argv)[source]
Sets flow units to LPS(Liters Per Second).
Example:
>>> d.setFlowUnitsLPS() # d.setFlowUnitsLPS('NET1_LPS.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsMGD(*argv)[source]
Sets flow units to MGD(Million Gallons per Day).
Example:
>>> d.setFlowUnitsMGD() # d.setFlowUnitsMGD('NET1_MGD.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setFlowUnitsMLD(*argv)[source]
Sets flow units to MLD(Million Liters per Day).
Example:
>>> d.setFlowUnitsMLD() # d.setFlowUnitsMLD('NET1_MLD.inp') >>> d.getFlowUnits()
See also: # Functions for PSI (sorted by higher to lower capacity): setFlowUnitsAFD() ### Acre-feet per day (higher capacity than GPM) setFlowUnitsIMGD() ### Imperial million gallons per day (higher capacity than AFD) setFlowUnitsCFS() ### Cubic feet per second (higher capacity than IMGD) setFlowUnitsMGD() ### Million gallons per day (similar capacity to IMGD) setFlowUnitsGPM() ### Gallons per minute (lower capacity than AFD, IMGD, CFS, and MGD)
Functions for KPA and meters (sorted by higher to lower capacity): setFlowUnitsCMH() ### Cubic meters per hour (higher capacity than CMS) setFlowUnitsCMS() ### Cubic meters per second (higher capacity than LPS) setFlowUnitsMLD() ### Million liters per day (higher capacity than CMD and LPM) setFlowUnitsCMD() ### Cubic meters per day (lower capacity than MLD) setFlowUnitsLPS() ### Liters per second (lower capacity than CMH and CMS) setFlowUnitsLPM() ### Liters per minute (lower capacity than LPS)
- setLinkBulkReactionCoeff(value, *argv)[source]
Sets the value of bulk chemical reaction coefficient.
Example 1:
>>> index_pipe = 1 >>> d.getLinkBulkReactionCoeff(index_pipe) # Retrieves the bulk chemical reaction coefficient of the 1st link >>> coeff = 0 >>> d.setLinkBulkReactionCoeff(index_pipe, coeff) # Sets the bulk chemical reaction coefficient of the 1st link >>> d.getLinkBulkReactionCoeff(index_pipe)
Example 2:
>>> coeffs = d.getLinkBulkReactionCoeff() # Retrieves the bulk chemical reaction coefficients of all links >>> coeffs_new = [0 for i in coeffs] >>> d.setLinkBulkReactionCoeff(coeffs_new) # Sets the bulk chemical reaction coefficient of all links >>> d.getLinkBulkReactionCoeff()
See also getLinkBulkReactionCoeff, setLinkRoughnessCoeff, setLinkPipeData, addLink, deleteLink.
- setLinkComment(value, *argv)[source]
Sets the comment string assigned to the link object.
Example 1:
>>> linkIndex = 1 >>> d.getLinkComment(linkIndex) >>> comment = 'This is a link' >>> d.setLinkComment(linkIndex, comment) # Sets a comment to the 1st link >>> d.getLinkComment(linkIndex)
Example 2:
>>> linkIndex = [1, 2] >>> d.getLinkComment(linkIndex) >>> comment = ['This is link 1', 'This is link 2'] >>> d.setLinkComment(linkIndex, comment) # Sets comments to the first 2 links >>> d.getLinkComment(linkIndex)
See also getLinkComment, setLinkNameID, setLinkPipeData.
- setLinkDiameter(value, *argv)[source]
Sets the values of diameters.
Example 1:
>>> d.getLinkDiameter() # Retrieves the diameters of all links >>> index_pipe = 1 >>> diameter = 20 >>> d.setLinkDiameter(index_pipe, diameter) # Sets the diameter of the 1st pipe >>> d.getLinkDiameter(index_pipe)
Example 2:
>>> index_pipes = [1, 2] >>> diameters = [20, 25] >>> d.setLinkDiameter(index_pipes, diameters) # Sets the diameters of the first 2 pipes >>> d.getLinkDiameter(index_pipes)
Example 3:
>>> diameters = d.getLinkDiameter() >>> diameters = diameters * 1.5 >>> d.setLinkDiameter(diameters) # Sets the diameters of all the links >>> d.getLinkDiameter()
See also setLinkPipeData, setLinkLength, setLinkBulkReactionCoeff, setLinkTypePipe.
- setLinkInitialSetting(value, *argv)[source]
Sets the values of initial settings, roughness for pipes or initial speed for pumps or initial setting for valves.
Example 1:
>>> index_pipe = 1 >>> d.getLinkInitialSetting(index_pipe) # Retrieves the initial setting of the 1st link >>> setting = 80 >>> d.setLinkInitialSetting(index_pipe, setting) # Sets the initial setting of the 1st link >>> d.getLinkInitialSetting(index_pipe)
Example 2:
>>> settings = d.getLinkInitialSetting() # Retrieves the initial setting of all links >>> settings_new = settings + 140 >>> d.setLinkInitialSetting(settings_new) # Sets the initial setting of all links >>> d.getLinkInitialSetting()
See also getLinkInitialSetting, setLinkInitialStatus, setLinkRoughnessCoeff, setLinkPipeData, addLink, deleteLink.
- setLinkInitialStatus(value, *argv)[source]
Sets the values of initial status.
Note: Cannot set status for a check valve
Example 1:
>>> index_pipe = 1 >>> d.getLinkInitialStatus(index_pipe) # Retrieves the initial status of the 1st link >>> status = 0 >>> d.setLinkInitialStatus(index_pipe, status) # Sets the initial status of the 1st link >>> d.getLinkInitialStatus(index_pipe)
Example 2:
>>> statuses = d.getLinkInitialStatus() # Retrieves the initial status of all links >>> statuses_new = np.zeros(len(statuses)) >>> d.setLinkInitialStatus(statuses_new) # Sets the initial status of all links >>> d.getLinkInitialStatus()
See also getLinkInitialStatus, setLinkInitialSetting, setLinkDiameter, setLinkPipeData, addLink, deleteLink.
- setLinkLength(value, *argv)[source]
Sets the values of lengths.
Example 1:
>>> index_pipe = 1 >>> d.getLinkLength(index_pipe) # Retrieves the length of the 1st link >>> length_pipe = 100 >>> d.setLinkLength(index_pipe, length_pipe) # Sets the length of the 1st link >>> d.getLinkLength(index_pipe)
Example 2:
>>> lengths = d.getLinkLength() # Retrieves the lengths of all the links >>> lengths_new = [i * 1.5 for i in lengths] >>> d.setLinkLength(lengths_new) # Sets the new lengths of all links >>> d.getLinkLength()
See also getLinkLength, setLinkDiameter, setLinkMinorLossCoeff, setLinkPipeData, addLink, deleteLink.
- setLinkMinorLossCoeff(value, *argv)[source]
Sets the values of minor loss coefficient.
Example 1:
>>> index_pipe = 1 >>> d.getLinkMinorLossCoeff(index_pipe) # Retrieves the minor loss coefficient of the 1st link >>> coeff = 105 >>> d.setLinkMinorLossCoeff(index_pipe, coeff) # Sets the minor loss coefficient of the 1st link >>> d.getLinkMinorLossCoeff(index_pipe)
Example 2:
>>> coeffs = d.getLinkMinorLossCoeff() # Retrieves the minor loss coefficients of all the links >>> coeffs_new = coeffs + 0.2 >>> d.setLinkMinorLossCoeff(coeffs_new) # Sets the minor loss coefficient of all links >>> d.getLinkMinorLossCoeff()
See also getLinkMinorLossCoeff, setLinkDiameter, setLinkRoughnessCoeff, setLinkPipeData, addLink, deleteLink.
- setLinkNameID(value, *argv)[source]
Sets the ID name for links.
Example 1:
>>> index_pipe = 1 >>> d.getLinkNameID(index_pipe) # Retrieves the ID of the 1st link >>> linkID = 'New_ID' # ID selected without a space in between the letters >>> d.setLinkNameID(index_pipe, linkID) # Sets the ID name of the 1st link >>> d.getLinkNameID(index_pipe)
Example 2: (the size of the cell must equal to the number of links)
>>> IDs = ['1', '2', '3', '4'] # Select the IDS of the first four links >>> d.setLinkNameID(IDs) # Sets the ID names of the first four links >>> d.getLinkNameID()
See also getLinkNameID, setLinkComment, setLinkDiameter, setLinkPipeData, addLink, deleteLink.
- setLinkNodesIndex(linkIndex, startNode, endNode)[source]
Sets the indexes of a link’s start- and end-nodes.
Example 1: Sets to the 1st link the start-node index = 2 and end-node index = 3
>>> d.getLinkNodesIndex() # Retrieves the indexes of the from/to nodes of all links >>> linkIndex = 1 >>> startNode = 2 >>> endNode = 3 >>> d.setLinkNodesIndex(linkIndex, startNode, endNode) >>> d.getLinkNodesIndex()
Example 2: Sets to the 1st link the start-node index = 2 and end-node index = 3 and to 2nd link the start-node index = 4 and end-node index = 5.
>>> linkIndex = [1, 2] >>> startNode = [2, 4] >>> endNode = [3, 5] >>> d.setLinkNodesIndex(linkIndex, startNode, endNode) >>> d.getLinkNodesIndex()
See also getLinkNodesIndex, setLinkDiameter, setLinkLength, setLinkNameID, setLinkComment.
- setLinkPipeData(Index, Length, Diameter, RoughnessCoeff, MinorLossCoeff)[source]
Sets a group of properties for a pipe.
- Parameters:
Index (int) – Pipe Index
Length (float) – Pipe length
Diameter (float) – Pipe diameter
RoughnessCoeff (float) – Pipe roughness coefficient
MinorLossCoeff (float) – Pipe minor loss coefficient
- Returns:
None
Example: Sets to the 1st pipe the following properties.
>>> pipeIndex = 1 >>> length = 1000 >>> diameter = 20 >>> RoughnessCoeff = 110 >>> MinorLossCoeff = 0.2 >>> d.getLinksInfo() # Retrieves all link info >>> d.setLinkPipeData(pipeIndex, length, diameter, RoughnessCoeff, MinorLossCoeff) >>> d.getLinksInfo()
Example 2: Sets to the 1st and 2nd pipe the following properties.
>>> pipeIndex = [1, 2] >>> length = [1000, 1500] >>> diameter = [20, 23] >>> RoughnessCoeff = [110, 115] >>> MinorLossCoeff = [0.2, 0.3] >>> d.getLinksInfo().disp() # Retrieves all link info >>> d.setLinkPipeData(pipeIndex, length, diameter, RoughnessCoeff, MinorLossCoeff) >>> d.getLinksInfo().to_dict()
See also getLinksInfo, setLinkComment, setLinkDiameter, setLinkLength, setLinkStatus, setNodeTankData.
- setLinkPumpECost(value, *argv)[source]
Sets the pump average energy price.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpECost() # Retrieves the pump average energy price of all pumps >>> d.setLinkPumpECost(0.10) # Sets the pump average energy price = 0.10 to every pump >>> d.getLinkPumpECost()
Example 2: (The input array must have a length equal to the number of pumps).
>>> d.setLinkPumpECost([0.10, 0.12]) # Sets the pump average energy price = 0.10 and 0.12 to the 2 pumps >>> d.getLinkPumpECost()
Example 3:
>>> d.setLinkPumpECost(1, 0.10) # Sets the pump average energy price = 0.10 to the 1st pump >>> d.getLinkPumpECost()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpECost(pumpIndex, 0.10) # Sets the pump average energy price = 0.10 to the pumps with index 118 and 119 >>> d.getLinkPumpECost()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpECost(pumpIndex, [0.10, 0.12]) # Sets the pump average energy price = 0.10 and 0.12 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpECost()
See also getLinkPumpECost, setLinkPumpPower, setLinkPumpHCurve, setLinkPumpECurve, setLinkPumpEPat.
- setLinkPumpECurve(value, *argv)[source]
Sets the pump efficiency v. flow curve index.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpECurve() # Retrieves the pump efficiency v. flow curve index of all pumps >>> d.setLinkPumpECurve(1) # Sets the pump efficiency v. flow curve index = 1 to every pump >>> d.getLinkPumpECurve()
Example 2: The input array must have a length equal to the number of pumps.
>>> d.setLinkPumpECurve([1, 2]) # Sets the pump efficiency v. flow curve index = 1 and 2 to the 2 pumps >>> d.getLinkPumpECurve()
Example 3:
>>> d.setLinkPumpECurve(1, 2) # Sets the pump efficiency v. flow curve index = 2 to the 1st pump >>> d.getLinkPumpECurve()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpECurve(pumpIndex, 1) # Sets the pump efficiency v. flow curve index = 1 to the pumps with index 118 and 119 >>> d.getLinkPumpECurve()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpECurve(pumpIndex,[1, 2]) # Sets the pump efficiency v. flow curve index = 1 and 2 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpECurve()
See also getLinkPumpECurve, setLinkPumpPower, setLinkPumpHCurve, setLinkPumpECost, setLinkPumpEPat.
- setLinkPumpEPat(value, *argv)[source]
Sets the pump energy price time pattern index.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpEPat() # Retrieves the pump energy price time pattern index of all pumps >>> d.setLinkPumpEPat(1) # Sets the pump energy price time pattern index = 1 to every pump >>> d.getLinkPumpEPat()
Example 2: (The input array must have a length equal to the number of pumps).
>>> d.setLinkPumpEPat([1, 2]) # Sets the pump energy price time pattern index = 1 and 2 to the 2 pumps >>> d.getLinkPumpEPat()
Example 3:
>>> d.setLinkPumpEPat(1, 2) # Sets the pump energy price time pattern index = 2 to the 1st pump >>> d.getLinkPumpEPat()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpEPat(pumpIndex, 1) # Sets the pump energy price time pattern index = 1 to the pumps with index 118 and 119 >>> d.getLinkPumpEPat()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpEPat(pumpIndex,[1, 2]) # Sets the pump energy price time pattern index = 1 and 2 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpEPat()
See also getLinkPumpEPat, setLinkPumpPower, setLinkPumpHCurve, setLinkPumpECurve, setLinkPumpECost.
- setLinkPumpHCurve(value, *argv)[source]
Sets the pump head v. flow curve index.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpHCurve() # Retrieves the pump head v. flow curve index of all pumps >>> d.setLinkPumpHCurve(1) # Sets the pump head v. flow curve index = 1 to every pump >>> d.getLinkPumpHCurve()
Example 2: (The input array must have a length equal to the number of pumps
>>> d.setLinkPumpHCurve([1, 2]) # Sets the pump head v. flow curve index = 1 and 2 to the 2 pumps >>> d.getLinkPumpHCurve()
Example 3:
>>> d.setLinkPumpHCurve(1, 2) # Sets the pump head v. flow curve index = 2 to the 1st pump >>> d.getLinkPumpHCurve()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpHCurve(pumpIndex, 1) # Sets the pump head v. flow curve index = 1 to the pumps with index 118 and 119 >>> d.getLinkPumpHCurve()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpHCurve(pumpIndex, [1, 2]) # Sets the pump head v. flow curve index = 1 and 2 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpHCurve()
See also getLinkPumpHCurve, setLinkPumpPower, setLinkPumpECurve, setLinkPumpECost, setLinkPumpEPat.
- setLinkPumpHeadCurveIndex(value, *argv)[source]
Sets the curves index for pumps index
>>> d.getLinkPumpHeadCurveIndex() >>> pumpIndex = d.getLinkPumpIndex(1) >>> curveIndex = d.getLinkCurveIndex(2) >>> d.setLinkPumpHeadCurveIndex(pumpIndex, curveIndex) >>> d.getLinkPumpHeadCurveIndex()
See also setLinkPumpPatternIndex, getLinkPumpPower, setLinkPumpHCurve, setLinkPumpECurve, setLinkPumpECost.
- setLinkPumpPatternIndex(value, *argv)[source]
Sets the pump speed time pattern index.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpPatternIndex() # Retrieves the pump speed time pattern index of all pumps >>> d.setLinkPumpPatternIndex(1) # Sets the speed time pattern index = 1 to every pump >>> d.getLinkPumpPatternIndex()
Example 2: The input array must have a length equal to the number of pumps.
>>> d.setLinkPumpPatternIndex([1, 2]) # Sets the pump speed time pattern index = 1 and 2 to the 2 pumps >>> d.getLinkPumpPatternIndex()
Example 3:
>>> d.setLinkPumpPatternIndex(1, 2) # Sets the pump speed time pattern index = 2 to the 1st pump >>> d.getLinkPumpPatternIndex()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpPatternIndex(pumpIndex, 1) # Sets the pump speed time pattern index = 1 to the pumps with index 118 and 119 >>> d.getLinkPumpPatternIndex()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpPatternIndex(pumpIndex, [1, 2]) # Sets the pump speed time pattern index = 1 and 2 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpPatternIndex()
Example 6: To remove the pattern index from the pumps you can use input 0.
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpPatternIndex(pumpIndex, 0)
See also getLinkPumpPatternIndex, setLinkPumpPower, setLinkPumpHCurve, setLinkPumpECurve, setLinkPumpECost.
- setLinkPumpPower(value, *argv)[source]
Sets the power for pumps.
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1:
>>> d.getLinkPumpPower() # Retrieves the power of all pumps >>> d.setLinkPumpPower(10) # Sets the pump power = 10 to every pump >>> d.getLinkPumpPower()
Example 2: (The input array must have a length equal to the number of pumps).
>>> d.setLinkPumpPower([10, 15]) # Sets the pump power = 10 and 15 to the 2 pumps >>> d.getLinkPumpPower()
Example 3:
>>> d.setLinkPumpPower(1, 10) # Sets the pump power = 10 to the 1st pump >>> d.getLinkPumpPower()
Example 4:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpPower(pumpIndex, 10) # Sets the pump power = 10 to the pumps with index 118 and 119 >>> d.getLinkPumpPower()
Example 5:
>>> pumpIndex = d.getLinkPumpIndex() >>> d.setLinkPumpPower(pumpIndex, [10, 15]) # Sets the pump power = 10 and 15 to the pumps with index 118 and 119 respectively >>> d.getLinkPumpPower()
See also getLinkPumpPower, setLinkPumpHCurve, setLinkPumpECurve, setLinkPumpECost, setLinkPumpEPat.
- setLinkRoughnessCoeff(value, *argv)[source]
Sets the values of roughness coefficient.
Example 1:
>>> index_pipe = 1 >>> d.getLinkRoughnessCoeff(index_pipe) # Retrieves the roughness coefficient of the 1st link >>> coeff = 105 >>> d.setLinkRoughnessCoeff(index_pipe, coeff) # Sets the roughness coefficient of the 1st link >>> d.getLinkRoughnessCoeff(index_pipe)
Example 2:
>>> coeffs = d.getLinkRoughnessCoeff() # Retrieves the roughness coefficients of all the links >>> coeffs_new = coeffs + 10 >>> d.setLinkRoughnessCoeff(coeffs_new) # Sets the roughness coefficient of all links >>> d.getLinkRoughnessCoeff()
See also getLinkRoughnessCoeff, setLinkDiameter, setLinkMinorLossCoeff, setLinkPipeData, addLink, deleteLink.
- setLinkSettings(value, *argv)[source]
Sets the values of current settings, roughness for pipes or initial speed for pumps or initial setting for valves.
Example 1:
>>> index_pipe = 1 >>> d.getLinkSettings(index_pipe) # Retrieves the current setting of the 1st link >>> setting = 80 >>> d.setLinkSettings(index_pipe, setting) # Sets the current setting of the 1st link >>> d.getLinkSettings(index_pipe)
Example 2:
>>> settings = d.getLinkSettings() # Retrieves the current setting of all links >>> settings_new = [i + 40 for i in settings] >>> d.setLinkSettings(settings_new) # Sets the current setting of all links >>> d.getLinkSettings()
- See also getLinkSettings, setLinkStatus, setLinkRoughnessCoeff,
setLinkPipeData, addLink, deleteLink.
- setLinkStatus(value, *argv)[source]
Sets the values of current status for links.
Note: Cannot set status for a check valve
Example 1:
>>> index_pipe = 1 >>> d.getLinkStatus(index_pipe) # Retrieves the current status of the 1st link >>> status = 1 >>> d.setLinkStatus(index_pipe, status) # Sets the current status of the 1st link >>> d.getLinkStatus(index_pipe)
Example 2:
>>> statuses = d.getLinkStatus() # Retrieves the current status of all links >>> statuses_new = [0 for i in statuses] >>> d.setLinkStatus(statuses_new) # Sets the current status of all links >>> d.getLinkStatus()
See also getLinkStatus, setLinkInitialStatus, setLinkDiameter, setLinkPipeData, addLink, deleteLink.
- setLinkTypePipe(Id, *argv)[source]
Sets the link type pipe for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType() >>> linkid = d.getLinkPumpNameID(1) >>> index = d.setLinkTypePipe(linkid) # Changes the 1st pump to pipe given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPumpNameID(1) >>> condition = 1 >>> index = d.setLinkTypePipe(linkid, condition) # Changes the 1st pump to pipe given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPumpNameID, setLinkTypePipeCV, setLinkTypePump, setLinkTypeValveFCV.
- setLinkTypePipeCV(Id, *argv)[source]
Sets the link type cvpipe(pipe with check valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypePipeCV(linkid) # Changes the 1st pipe to cvpipe given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypePipeCV(linkid, condition) # Changes the 1st pipe to cvpipe given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValveFCV.
- setLinkTypePump(Id, *argv)[source]
Sets the link type pump for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypePump(linkid) # Changes the 1st pipe to pump given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypePump(linkid, condition) # Changes the 1st pipe to pump given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePipeCV, setLinkTypeValveFCV.
- setLinkTypeValveFCV(Id, *argv)[source]
Sets the link type valve FCV(flow control valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValveFCV(linkid) # Changes the 1st pipe to valve FCV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValveFCV(linkid, condition) # Changes the 1st pipe to valve FCV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValveGPV.
- setLinkTypeValveGPV(Id, *argv)[source]
Sets the link type valve GPV(general purpose valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValveGPV(linkid) # Changes the 1st pipe to valve GPV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValveGPV(linkid, condition) # Changes the 1st pipe to valve GPV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValveFCV.
- setLinkTypeValvePCV(Id, *argv)[source]
Sets the link type valve PCV(Position control valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValvePCV(linkid) # Changes the 1st pipe to valve PCV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValvePCV(linkid, condition) # Changes the 1st pipe to valve PCV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValveFCV.
- setLinkTypeValvePBV(Id, *argv)[source]
Sets the link type valve PBV(pressure breaker valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValvePBV(linkid) # Changes the 1st pipe to valve PBV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValvePBV(linkid, condition) # Changes the 1st pipe to valve PBV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValvePRV.
- setLinkTypeValvePRV(Id, *argv)[source]
Sets the link type valve PRV(pressure reducing valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValvePRV(linkid) # Changes the 1st pipe to valve PRV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValvePRV(linkid, condition) # Changes the 1st pipe to valve PRV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValvePSV.
- setLinkTypeValvePSV(Id, *argv)[source]
Sets the link type valve PSV(pressure sustaining valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValvePSV(linkid) # Changes the 1st pipe to valve PSV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValvePSV(linkid, condition) # Changes the 1st pipe to valve PSV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValvePBV.
- setLinkTypeValveTCV(Id, *argv)[source]
Sets the link type valve TCV(throttle control valve) for a specified link.
- Note:
condition = 0 | if is EN_UNCONDITIONAL: Delete all controls that contain object
condition = 1 | if is EN_CONDITIONAL: Cancel object type change if contained in controls
Default condition is 0.
Example 1:
>>> d.getLinkType(1) # Retrieves the type of the 1st link >>> linkid = d.getLinkPipeNameID(1) # Retrieves the ID of the 1t pipe >>> index = d.setLinkTypeValveTCV(linkid) # Changes the 1st pipe to valve TCV given it's ID >>> d.getLinkType(index)
Example 2:
>>> linkid = d.getLinkPipeNameID(1) >>> condition = 1 >>> index = d.setLinkTypeValveTCV(linkid, condition) # Changes the 1st pipe to valve TCV given it's ID and a condition (if possible) >>> d.getLinkType(index)
See also getLinkType, getLinkPipeNameID, setLinkTypePipe, setLinkTypePump, setLinkTypeValveGPV.
- setLinkVertices(linkID, x, y, *argv)[source]
Assigns a set of internal vertex points to a link.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> d = epanet('Net1.inp') >>> linkID = '10' >>> x = [22, 24, 28] >>> y = [69, 68, 69] >>> d.setLinkVertices(linkID, x, y)
See also getLinkVertices, getLinkVerticesCount.
- setLinkWallReactionCoeff(value, *argv)[source]
Sets the value of wall chemical reaction coefficient.
Example 1:
>>> index_pipe = 1 >>> d.getLinkWallReactionCoeff(index_pipe) # Retrieves the wall chemical reaction coefficient of the 1st link >>> coeff = 0 >>> d.setLinkWallReactionCoeff(index_pipe, coeff) # Sets the wall chemical reaction coefficient of the 1st link >>> d.getLinkWallReactionCoeff(index_pipe)
Example 2:
>>> coeffs = d.getLinkWallReactionCoeff() # Retrieves the wall chemical reaction coefficients of all links >>> coeffs_new = [0] * len(coeffs) >>> d.setLinkWallReactionCoeff(coeffs_new) # Sets the wall chemical reaction coefficient of all links >>> d.getLinkWallReactionCoeff()
See also getLinkWallReactionCoeff, setLinkBulkReactionCoeff, setLinkPipeData, addLink, deleteLink.
- setNodeBaseDemands(value, *argv)[source]
Sets the values of demand for nodes. The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> index_node = 1 >>> d.getNodeBaseDemands()[1][index_node] # Retrieves the demand of the 1st node >>> demand = 5 >>> d.setNodeBaseDemands(index_node, demand) # Sets the demand of the 1st node >>> d.getNodeBaseDemands()[1][index_node-1]
Example 2:
>>> nodeIndex = list(range(1,6)) >>> BaseDems = d.getNodeBaseDemands()[1] >>> baseDems = list(np.array(BaseDems)[0:5]) # Retrieves the demands of first 5 nodes >>> demands = [10, 5, 15, 20, 5] >>> d.setNodeBaseDemands(nodeIndex, demands) # Sets the demands of first 5 nodes >>> newBaseDems = d.getNodeBaseDemands()[1][0:5] >>> newbaseDems = newBaseDems
Example 3:
>>> demands = d.getNodeBaseDemands()[1] # Retrieves the demands of all nodes >>> demands_new = [i+15 for i in demands] >>> d.setNodeBaseDemands(demands_new) # Sets the demands of all nodes >>> d.getNodeBaseDemands()[1]
If a category is not given, the default is categoryIndex = 1.
Example 4:
>>> d = epanet('BWSN_Network_1.inp') >>> nodeIndex = 121 >>> categoryIndex = 2 >>> d.getNodeBaseDemands()[categoryIndex][nodeIndex-1] # Retrieves the demand of the 2nd category of the 121th node >>> demand = 25 >>> d.setNodeBaseDemands(nodeIndex, categoryIndex, demand) # Sets the demand of the 2nd category of the 121th node >>> d.getNodeBaseDemands()[categoryIndex][nodeIndex-1]
Example 5:
>>> d = epanet('BWSN_Network_1.inp') >>> nodeIndex = list(range(1,6)) >>> categoryIndex = 1 >>> baseDems = d.getNodeBaseDemands()[categoryIndex] >>> baseDems = baseDems[0:5] # Retrieves the demands of the 1st category of the first 5 nodes >>> demands = [10, 5, 15, 20, 5] >>> d.setNodeBaseDemands(nodeIndex, categoryIndex, demands) # Sets the demands of the 1st category of the first 5 nodes >>> newbaseDems = d.getNodeBaseDemands()[categoryIndex] >>> newbaseDems = newbaseDems[0:5]
See also getNodeBaseDemands, setNodeJunctionDemandName, setNodeDemandPatternIndex, addNodeJunction, deleteNode.
- setNodeComment(value, *argv)[source]
Sets the comment string assigned to the node object.
Example 1:
>>> d.setNodeComment(1, 'This is a node') # Sets a comment to the 1st node >>> d.getNodeComment(1)
Example 2:
>>> d.setNodeComment([1,2], ['This is a node', 'Test comm']) # Sets a comment to the 1st and 2nd node >>> d.getNodeComment([1,2])
See also getNodeComment, getNodesInfo, setNodeNameID, setNodeCoordinates.
- setNodeCoordinates(value, *argv)[source]
Sets node coordinates.
Example 1:
>>> nodeIndex = 1 >>> d.getNodeCoordinates(nodeIndex) # Retrieves the X and Y coordinates of the 1st node >>> coords = [0,0] >>> d.setNodeCoordinates(nodeIndex, coords) # Sets the coordinates of the 1st node >>> d.getNodeCoordinates(nodeIndex)
Example 2:
>>> x_values = d.getNodeCoordinates('x') >>> y_values = d.getNodeCoordinates('y') >>> x_new = [x_values[i]+10 for i in x_values] >>> y_new = [y_values[i]+10 for i in y_values] >>> new_coords = [x_new, y_new] # Creates a cell array with the new coordinates >>> d.setNodeCoordinates(new_coords) # Sets the coordinates of all nodes >>> x_values_new = d.getNodeCoordinates('x') >>> y_values_new = d.getNodeCoordinates('y')
See also getNodeCoordinates, setNodeElevations, plot, addNodeJunction, addNodeTank, deleteNode.
- setNodeDemandPatternIndex(value, *argv)[source]
Sets the values of demand time pattern indices.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> nodeIndex = 1 >>> d.getNodeDemandPatternIndex()[1][nodeIndex-1] # Retrieves the index of the 1st category's time pattern of the 1st node >>> patternIndex = 2 >>> d.setNodeDemandPatternIndex(nodeIndex, patternIndex) # Sets the demand time pattern index to the 1st node >>> d.getNodeDemandPatternIndex()[1][nodeIndex-1]
Example 2:
>>> nodeIndex = np.array(range(1,6)) >>> d.getNodeDemandPatternIndex()[1][0:5] >>> patternIndices = [1, 3, 2, 4, 2] >>> d.setNodeDemandPatternIndex(nodeIndex, patternIndices) # Sets the demand time pattern index to the first 5 nodes >>> d.getNodeDemandPatternIndex()[1][0:5]
Example 3:
>>> patternIndices = d.getNodeDemandPatternIndex()[1] >>> patternIndices_new = [i+1 for i in patternIndices] >>> d.setNodeDemandPatternIndex(patternIndices_new) # Sets all primary demand time pattern indices >>> d.getNodeDemandPatternIndex()[1]
If a category is not given, the default is categoryIndex = 1.
Example 4:
>>> nodeIndex = 121 >>> categoryIndex = 2 >>> d.getNodeDemandPatternIndex()[categoryIndex][nodeIndex-1] # Retrieves the index of the 2nd category's time pattern of the 121th node >>> patternIndex = 4 >>> d.setNodeDemandPatternIndex(nodeIndex, categoryIndex, patternIndex) # Sets the demand time pattern index of the 2nd category of the 121th node >>> d.getNodeDemandPatternIndex()[categoryIndex][nodeIndex-1]
Example 5:
>>> nodeIndex = np.array(range(1,6)) >>> categoryIndex = 1 >>> patDems = d.getNodeDemandPatternIndex()[categoryIndex] >>> patDems = list(np.array(patDems)[0:5]) >>> patternIndices = [1, 3, 2, 4, 2] >>> d.setNodeDemandPatternIndex(nodeIndex, categoryIndex, patternIndices) # Sets the demand time pattern index of the 1st category of the first 5 nodes >>> patDems_new = d.getNodeDemandPatternIndex()[categoryIndex][0:5]
See also getNodeDemandPatternIndex, getNodeDemandCategoriesNumber, setNodeBaseDemands, addPattern, deletePattern.
- setNodeReservoirHeadPatternIndex(value, *argv)[source]
Sets the pattern index for a reservoir node head This is a duplicate function—identical in behavior to setNodeDemandPatternIndex
- Example 1:
d = epanet(‘net2-cl2.inp’) res_index = d.addNodeReservoir(“res-1”) pidx = d.addPattern(“pat-1”) d.setNodeReservoirHeadPatternIndex(res_index, pidx) d.setPattern(pidx, 1)
- setNodeElevations(value, *argv)[source]
Sets the values of elevation for nodes.
Example 1:
>>> index_node = 1 >>> d.getNodeElevations(index_node) # Retrieves the elevation of the 1st node >>> elev = 500 >>> d.setNodeElevations(index_node, elev) # Sets the elevation of the 1st node >>> d.getNodeElevations(index_node)
Example 2:
>>> elevs = d.getNodeElevations() # Retrieves the elevations of all the nodes >>> elevs_new = elevs + 100 >>> d.setNodeElevations(elevs_new) # Sets the elevations of all nodes >>> d.getNodeElevations()
See also getNodeElevations, setNodeCoordinates, setNodeBaseDemands, setNodeJunctionData, addNodeJunction, deleteNode.
- setNodeEmitterCoeff(value, *argv)[source]
Sets the values of emitter coefficient for nodes.
Example 1:
>>> nodeset = d.getNodeEmitterCoeff() # Retrieves the value of all nodes emmitter coefficients >>> nodeset[0] = 0.1 # First node emitter coefficient = 0.1 >>> d.setNodeEmitterCoeff(nodeset) # Sets the value of all nodes emitter coefficient >>> d.getNodeEmitterCoeff()
Example 2:
>>> nodeIndex = 1 >>> d.getNodeEmitterCoeff(nodeIndex) >>> emitterCoeff = 0 >>> d.setNodeEmitterCoeff(nodeIndex, emitterCoeff) # Sets the value of the 1st node emitter coefficient = 0 >>> d.getNodeEmitterCoeff(nodeIndex)
See also getNodeEmitterCoeff, setNodeBaseDemands, setNodeJunctionData.
- setNodeInitialQuality(value, *argv)[source]
Sets the values of initial quality for nodes.
Example 1:
>>> nodeset = d.getNodeInitialQuality() # Retrieves the value of all nodes initial qualities >>> nodeset[0] = 0.5 # First node initial quality = 0.5 >>> d.setNodeInitialQuality(nodeset) # Sets the values of all nodes initial quality >>> d.getNodeInitialQuality()
Example 2:
>>> nodeIndex = 1 >>> d.getNodeInitialQuality(nodeIndex) >>> initialQuality = 1 >>> d.setNodeInitialQuality(nodeIndex, initialQuality) # Sets the value of the 1st node initial quality >>> d.getNodeInitialQuality(nodeIndex)
See also getNodeInitialQuality, getNodeActualQuality, setNodeJunctionData.
- setNodeJunctionData(index, elev, dmnd, dmndpat)[source]
Sets a group of properties for a junction node.
- Parameters:
index (int) – a junction node’s index (starting from 1).
elev (float) – the value of the junction’s elevation.
dmnd (float) – the value of the junction’s primary base demand.
dmndpat (str) – the ID name of the demand’s time pattern (”” for no pattern)
- Returns:
None
Example:
>>> junctionIndex = 1 >>> elev = 35 >>> dmnd = 100 >>> dmndpat = 'NEW_PATTERN' >>> d.addPattern(dmndpat) # Adds a new pattern >>> d.setNodeJunctionData(junctionIndex, elev, dmnd, dmndpat) # Sets the elevation, primary base demand and time pattern of the 1st junction >>> d.getNodeElevations(junctionIndex) # Retrieves the elevation of the 1st junction >>> d.getNodeBaseDemands(junctionIndex) # Retrieves the primary base demand of the 1st junction >>> d.getNodeDemandPatternNameID()[junctionIndex] # Retrieves the demand pattern ID (primary base demand is the first category)
See also setNodeTankData, getNodeElevations, getNodeBaseDemands, getNodeDemandPatternNameID, addPattern, setNodeJunctionDemandName.
- setNodeJunctionDemandName(nodeIndex, demandIndex, demandName)[source]
Assigns a name to a node’s demand category.
Example:
>>> nodeIndex = 1 >>> demandIndex = 1 >>> d.getNodeJunctionDemandName()[demandIndex][nodeIndex-1] # Retrieves the name of the 1st node, 1st demand category >>> demandName = 'NEW NAME' >>> d.setNodeJunctionDemandName(nodeIndex, demandIndex, demandName) # Sets a new name of the 1st node, 1st demand category >>> d.getNodeJunctionDemandName()[demandIndex][nodeIndex-1]
See also getNodeJunctionDemandName, setNodeBaseDemands, setDemandModel, addNodeJunctionDemand, deleteNodeJunctionDemand.
- setNodeNameID(value, *argv)[source]
Sets the ID name for nodes.
Example 1:
>>> nodeIndex = 1 >>> d.getNodeNameID(nodeIndex) # Retrieves the ID of the 1st node >>> nameID = 'newID' >>> d.setNodeNameID(nodeIndex, nameID) # Sets the ID of the 1st node. >>> d.getNodeNameID(nodeIndex)
Example 2:
>>> nameID = d.getNodeNameID() # Retrieves the IDs of all nodes >>> nameID[0] = 'newID_1' >>> nameID[4] = 'newID_5' >>> d.setNodeNameID(nameID) # Sets the IDs of all nodes >>> d.getNodeNameID()
See also getNodeNameID, setNodeComment, setNodeJunctionData.
- setNodesConnectingLinksID(linkIndex, startNodeID, endNodeID)[source]
Sets the IDs of a link’s start- and end-nodes.
Example 1:
>>> d.getNodesConnectingLinksID() # Retrieves the ids of the from/to nodes of all links >>> linkIndex = 2 >>> startNodeID = '11' >>> endNodeID = '22' >>> d.setNodesConnectingLinksID(linkIndex, startNodeID, endNodeID) >>> d.getNodesConnectingLinksID()
Example 2:
>>> linkIndex = [2, 3] >>> startNodeID = ['12', '13'] >>> endNodeID = ['21', '22'] >>> d.setNodesConnectingLinksID(linkIndex, startNodeID, endNodeID) >>> d.getNodesConnectingLinksID() >>> d.plot()
See also getLinkNodesIndex, getNodesConnectingLinksID, setLinkLength, setLinkNameID, setLinkComment.
- setNodeSourcePatternIndex(value, *argv)[source]
Sets the values of quality source pattern index.
Example 1:
>>> nodeIndex = 1 >>> d.getNodeSourcePatternIndex(nodeIndex) # Retrieves the quality source pattern index of the 1st node >>> sourcePatternIndex = 1 >>> d.setNodeSourcePatternIndex(nodeIndex, sourcePatternIndex) # Sets the quality source pattern index = 1 to the 1st node >>> d.getNodeSourcePatternIndex(nodeIndex)
Example 2:
>>> nodeIndex = [1,2,3] >>> d.getNodeSourcePatternIndex(nodeIndex) # Retrieves the quality source pattern index of the first 3 nodes >>> sourcePatternIndex = [1, 1, 1] >>> d.setNodeSourcePatternIndex(nodeIndex, sourcePatternIndex) # Sets the quality source pattern index = 1 to the first 3 nodes >>> d.getNodeSourcePatternIndex(nodeIndex)
See also getNodeSourcePatternIndex, setNodeSourceQuality, setNodeSourceType.
- setNodeSourceQuality(value, *argv)[source]
Sets the values of quality source strength.
Example 1:
>>> nodeIndex = 1 >>> d.getNodeSourceQuality(nodeIndex) # Retrieves the quality source strength of the 1st node >>> sourceStrength = 10 >>> d.setNodeSourceQuality(nodeIndex, sourceStrength) # Sets the quality source strength = 10 to the 1st node >>> d.getNodeSourceQuality(nodeIndex)
Example 2:
>>> nodeIndex = [1,2,3] >>> d.getNodeSourceQuality(nodeIndex) # Retrieves the quality source strength of the first 3 nodes >>> sourceStrength = [10, 12, 8] >>> d.setNodeSourceQuality(nodeIndex, sourceStrength) # Sets the quality source strength = 10, 12 and 8 to the first 3 nodes >>> d.getNodeSourceQuality(nodeIndex)
See also getNodeSourceQuality, setNodeSourcePatternIndex, setNodeSourceType.
- setNodeSourceType(index, value)[source]
Sets the values of quality source type.
- Types of external water quality sources that can be set:
CONCEN Sets the concentration of external inflow entering a node
MASS Injects a given mass/minute into a node
SETPOINT Sets the concentration leaving a node to a given value
FLOWPACED Adds a given value to the concentration leaving a node
Example:
>>> nodeIndex = 1 >>> d.getNodeSourceType(nodeIndex) # Retrieves the quality source type of the 1st node >>> sourceType = 'MASS' >>> d.setNodeSourceType(nodeIndex, sourceType) # Sets the quality source type = 'MASS' to the 1st node >>> d.getNodeSourceType(nodeIndex)
See also getNodeSourceType, setNodeSourceQuality, setNodeSourcePatternIndex.
- setNodeTankBulkReactionCoeff(value, *argv)[source]
Sets the tank bulk reaction coefficient.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankBulkReactionCoeff() # Retrieves the bulk reaction coefficient of all tanks >>> d.setNodeTankBulkReactionCoeff(-0.5) # Sets the bulk reaction coefficient = -0.5 to every tank >>> d.getNodeTankBulkReactionCoeff()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankBulkReactionCoeff([0, -0.5]) # Sets the bulk reaction coefficient = 0 and -0.5 to the 2 tanks >>> d.getNodeTankBulkReactionCoeff()
Example 3:
>>> d.setNodeTankBulkReactionCoeff(1, -0.8) # Sets the bulk reaction coefficient = -0.5 to the 1st tank >>> d.getNodeTankBulkReactionCoeff()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankBulkReactionCoeff(tankIndex, 0) # Sets the bulk reaction coefficient = 0 to the tanks with index 128 and 129 >>> d.getNodeTankBulkReactionCoeff()
Example 5:
>>> tankIndex = d.getNodeTankIndex([1,2]) >>> d.setNodeTankBulkReactionCoeff(tankIndex, [-0.5, 0]) # Sets the bulk reaction coefficient = -0.5 and 0 to the tanks with index 128 and 129 respectively >>> d.getNodeTankBulkReactionCoeff()
See also getNodeTankBulkReactionCoeff, setNodeTankInitialLevel, setNodeTankMixingModelType, setNodeTankCanOverFlow, setNodeTankDiameter, setNodeTankData.
- setNodeTankCanOverFlow(value, *argv)[source]
Sets the tank can-overflow (= 1) or not (= 0).
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankCanOverFlow() # Retrieves the can-overflow of all tanks >>> d.setNodeTankCanOverFlow(1) # Sets the can-overflow = 1 to every tank >>> d.getNodeTankCanOverFlow()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankCanOverFlow([1, 0]) # Sets the can-overflow = 1 and 0 to the 2 tanks >>> d.getNodeTankCanOverFlow()
Example 3:
>>> d.setNodeTankCanOverFlow(1, 0) # Sets the can-overflow = 0 to the 1st tank >>> d.getNodeTankCanOverFlow()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankCanOverFlow(tankIndex, 1) # Sets the can-overflow = 1 to the tanks with index 128 and 129 >>> d.getNodeTankCanOverFlow()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankCanOverFlow(tankIndex, [0, 1]) # Sets the can-overflow = 0 and 1 to the tanks with index 128 and 129 respectively >>> d.getNodeTankCanOverFlow()
See also getNodeTankCanOverFlow, setNodeTankBulkReactionCoeff, setNodeTankMinimumWaterLevel, setNodeTankMinimumWaterVolume, setNodeTankDiameter, setNodeTankData.
- setNodeTankData(index, elev, intlvl, minlvl, maxlvl, diam, minvol, volcurve)[source]
Sets a group of properties for a tank.
- Parameters:
index (int) – Tank index
elev (float) – Tank Elevation
intlvl (float) – Tank Initial water Level
minlvl (float) – Tank Minimum Water Level
maxlvl (float) – Tank Maximum Water Level
diam (float) – Tank Diameter (0 if a volume curve is supplied)
minvol (float) – Tank Minimum Water Volume
volcurve (str) – Tank Volume Curve Index (”” for no curve)
- Returns:
None
The examples are based on d = epanet(‘Net3_trace.inp’)
Example 1: (Sets to the 1st tank the following properties).
>>> tankIndex = 1 # You can also use tankIndex = 95 (i.e. the index of the tank). >>> elev = 100 >>> intlvl = 13 >>> minlvl = 0.2 >>> maxlvl = 33 >>> diam = 80 >>> minvol = 50000 >>> volcurve = '' # For no curve >>> d.setNodeTankData(tankIndex, elev, intlvl, minlvl, maxlvl, diam, minvol, volcurve) >>> d.getNodeTankData().disp()
Example 2: (Sets to the 1st and 2nd tank the following properties).
>>> tankIndex = [1, 2] # You can also use tankIndex = [95, 96] (i.e. the indices of the tanks). >>> elev = [100, 105] >>> intlvl = [13, 13.5] >>> minlvl = [0.2, 0.25] >>> maxlvl = [30, 35] >>> diam = [80, 85] >>> minvol = [50000, 60000] >>> volcurve = ['', ''] # For no curves >>> d.setNodeTankData(tankIndex, elev, intlvl, minlvl, maxlvl, diam, minvol, volcurve) >>> d.getNodeTankData(tankIndex).disp()
See also getNodeTankData, setNodeTankInitialLevel, setNodeTankMinimumWaterLevel, setNodeTankDiameter.
- setNodeTankDiameter(value, *argv)[source]
Sets the diameter value for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankDiameter() # Retrieves the diameter of all tanks >>> d.setNodeTankDiameter(120) # Sets the diameter = 120 to every tank >>> d.getNodeTankDiameter()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankDiameter([110, 130]) # Sets the diameter = 110 and 130 to the 2 tanks >>> d.getNodeTankDiameter()
Example 3:
>>> d.setNodeTankDiameter(1, 120) # Sets the diameter = 120 to the 1st tank >>> d.getNodeTankDiameter()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankDiameter(tankIndex, 150) # Sets the diameter = 150 to the tanks with index 128 and 129 >>> d.getNodeTankDiameter()
Example 5:
>>> tankIndex = d.getNodeTankIndex([1,2]) >>> d.setNodeTankDiameter(tankIndex, [100, 120]) # Sets the diameter = 100 and 120 to the tanks with index 128 and 129 respectively >>> d.getNodeTankDiameter()
See also getNodeTankDiameter, setNodeTankInitialLevel, setNodeTankMinimumWaterLevel, setNodeTankBulkReactionCoeff, setNodeTankCanOverFlow, setNodeTankData.
- setNodeTankInitialLevel(value, *argv)[source]
Sets the values of initial level for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankInitialLevel() # Retrieves the initial level of all tanks >>> d.setNodeTankInitialLevel(10) # Sets the initial level = 10 to every tank >>> d.getNodeTankInitialLevel()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankInitialLevel([10, 15]) # Sets the initial level = 10 and 15 to the 2 tanks >>> d.getNodeTankInitialLevel()
Example 3:
>>> d.setNodeTankInitialLevel(1, 10) # Sets the initial level = 10 to the 1st tank >>> d.getNodeTankInitialLevel()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankInitialLevel(tankIndex, 10) # Sets the initial level = 10 to the tanks with index 128 and 129 >>> d.getNodeTankInitialLevel()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankInitialLevel(tankIndex, [10, 15]) # Sets the initial level = 10 and 15 to the tanks with index 128 and 129 respectively >>> d.getNodeTankInitialLevel()
See also getNodeTankInitialLevel, setNodeTankMinimumWaterLevel, setNodeTankMaximumWaterLevel, setNodeTankMinimumWaterVolume, setNodeTankMixingFraction, setNodeTankData.
- setNodeTankMaximumWaterLevel(value, *argv)[source]
Sets the maximum water level value for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankMaximumWaterLevel() # Retrieves the maximum water level of all tanks >>> d.setNodeTankMaximumWaterLevel(35) # Sets the maximum water level = 35 to every tank >>> d.getNodeTankMaximumWaterLevel()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankMaximumWaterLevel([30, 40]) # Sets the maximum water level = 30 and 40 to the 2 tanks >>> d.getNodeTankMaximumWaterLevel()
Example 3:
>>> d.setNodeTankMaximumWaterLevel(1, 35) # Sets the maximum water level = 35 to the 1st tank >>> d.getNodeTankMaximumWaterLevel()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMaximumWaterLevel(tankIndex, 30) # Sets the maximum water level = 30 to the tanks with index 128 and 129 >>> d.getNodeTankMaximumWaterLevel()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMaximumWaterLevel(tankIndex, [35, 45]) # Sets the maximum water level = 35 and 45 to the tanks with index 128 and 129 respectively >>> d.getNodeTankMaximumWaterLevel()
See also getNodeTankMaximumWaterLevel, setNodeTankInitialLevel, setNodeTankMinimumWaterLevel, setNodeTankMinimumWaterVolume, setNodeTankMixingFraction, setNodeTankData.
- setNodeTankMinimumWaterLevel(value, *argv)[source]
Sets the minimum water level value for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankMinimumWaterLevel() # Retrieves the minimum water level of all tanks >>> d.setNodeTankMinimumWaterLevel(5) # Sets the minimum water level = 5 to every tank >>> d.getNodeTankMinimumWaterLevel()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankMinimumWaterLevel([10, 15]) # Sets the minimum water level = 10 and 15 to the 2 tanks >>> d.getNodeTankMinimumWaterLevel()
Example 3:
>>> d.setNodeTankMinimumWaterLevel(1, 5) # Sets the minimum water level = 5 to the 1st tank >>> d.getNodeTankMinimumWaterLevel()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMinimumWaterLevel(tankIndex, 10) # Sets the minimum water level = 10 to the tanks with index 128 and 129 >>> d.getNodeTankMinimumWaterLevel()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMinimumWaterLevel(tankIndex, [5, 15]) # Sets the minimum water level = 5 and 15 to the tanks with index 128 and 129 respectively >>> d.getNodeTankMinimumWaterLevel()
See also getNodeTankMinimumWaterLevel, setNodeTankInitialLevel, setNodeTankMaximumWaterLevel, setNodeTankMinimumWaterVolume, setNodeTankMixingFraction, setNodeTankData.
- setNodeTankMinimumWaterVolume(value, *argv)[source]
Sets the minimum water volume value for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankMinimumWaterVolume() # Retrieves the minimum water volume of all tanks >>> d.setNodeTankMinimumWaterVolume(1000) # Sets the minimum water volume = 1000 to every tank >>> d.getNodeTankMinimumWaterVolume()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankMinimumWaterVolume([1500, 2000]) # Sets the minimum water volume = 1500 and 2000 to the 2 tanks >>> d.getNodeTankMinimumWaterVolume()
Example 3:
>>> d.setNodeTankMinimumWaterVolume(1, 1000) # Sets the minimum water volume = 1000 to the 1st tank >>> d.getNodeTankMinimumWaterVolume()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMinimumWaterVolume(tankIndex, 1500) # Sets the minimum water volume = 1500 to the tanks with index 128 and 129 >>> d.getNodeTankMinimumWaterVolume()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMinimumWaterVolume(tankIndex, [1000, 2000]) # Sets the minimum water volume = 1000 and 2000 to the tanks with index 128 and 129 respectively >>> d.getNodeTankMinimumWaterVolume()
See also getNodeTankMinimumWaterVolume, setNodeTankInitialLevel, setNodeTankMinimumWaterLevel, setNodeTankMaximumWaterLevel, setNodeTankMixingFraction, setNodeTankData.
- setNodeTankMixingFraction(value, *argv)[source]
Sets the tank mixing fraction of total volume occupied by the inlet/outlet zone in a 2-compartment tank.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankMixingFraction() # Retrieves the mixing fraction of all tanks >>> d.setNodeTankMixingFraction(0) # Sets the mixing fraction = 0 to every tank >>> d.getNodeTankMixingFraction()
Example 2: (The input array must have a length equal to the number of tanks).
>>> d.setNodeTankMixingFraction([1, 0]) # Sets the mixing fraction = 1 and 0 to the 2 tanks >>> d.getNodeTankMixingFraction()
Example 3:
>>> d.setNodeTankMixingFraction(1, 0) # Sets the mixing fraction = 0 to the 1st tank >>> d.getNodeTankMixingFraction()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMixingFraction(tankIndex, 1) # Sets the mixing fraction = 1 to the tanks with index 128 and 129 >>> d.getNodeTankMixingFraction()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMixingFraction(tankIndex, [1, 0]) # Sets the mixing fraction = 1 and 0 to the tanks with index 128 and 129 respectively >>> d.getNodeTankMixingFraction()
See also getNodeTankMixingFraction, setNodeTankMixingModelType, setNodeTankMinimumWaterLevel, setNodeTankMinimumWaterVolume, setNodeTankDiameter, setNodeTankData.
- setNodeTankMixingModelType(value, *argv)[source]
Sets the mixing model type value for tanks.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getNodeTankMixingModelType() # Retrieves the mixing model type of all tanks >>> d.setNodeTankMixingModelType('MIX2') # Sets the mixing model type = 'MIX2' to every tank >>> d.getNodeTankMixingModelType()
Example 2: (The input array must have a length equal to the number of tanks)
>>> d.setNodeTankMixingModelType(['MIX1', 'LIFO']) # Sets the mixing model type = 'MIX1' and 'LIFO' to the 2 tanks >>> d.getNodeTankMixingModelType()
Example 3:
>>> d.setNodeTankMixingModelType(1, 'FIFO') # Sets the mixing model type = 'FIFO' to the 1st tank >>> d.getNodeTankMixingModelType()
Example 4:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMixingModelType(tankIndex, 'MIX1') # Sets the mixing model type = 'MIX1' to the tanks with index 128 and 129 >>> d.getNodeTankMixingModelType()
Example 5:
>>> tankIndex = d.getNodeTankIndex() >>> d.setNodeTankMixingModelType(tankIndex, ['MIX2', 'LIFO']) # Sets the mixing model type = 'MIX2' and 'LIFO' to the tanks with index 128 and 129 respectively >>> d.getNodeTankMixingModelType()
See also getNodeTankMixingModelType, setNodeTankBulkReactionCoeff, setNodeTankMixingFraction, setNodeTankMinimumWaterVolume, setNodeTankMinimumWaterLevel, setNodeTankData.
- setNodeTypeJunction(Id)[source]
Transforms a node to JUNCTION The new node keeps the id,coordinates and elevation of the deleted one
Example 1:
>>> d = epanet('Net1.inp') >>> index = d.setNodeTypeJunction('2') >>> d.getNodeType(index) >>> d.plot()
- setNodeTypeReservoir(Id)[source]
Transforms a node to RESERVOIR The new node keeps the id,coordinates and elevation of the deleted one
Example 1:
>>> d = epanet('Net1.inp') >>> index = d.setNodeTypeReservoir('13') >>> d.getNodeType(index) >>> d.plot()
- setNodeTypeTank(Id)[source]
Transforms a node to TANK The new node keeps the id,coordinates and elevation of the deleted one
Example 1:
>>> d = epanet('Net1.inp') >>> index = d.setNodeTypeTank('13') >>> d.getNodeType(index) >>> d.plot()
- setOptionsAccuracyValue(value)[source]
Sets the total normalized flow change for hydraulic convergence.
Example:
>>> d.setOptionsAccuracyValue(0.001) >>> d.getOptionsAccuracyValue()
See also getOptionsAccuracyValue, setOptionsExtraTrials, setOptionsMaxTrials.
- setOptionsCheckFrequency(value)[source]
Sets the frequency of hydraulic status checks.
Example:
>>> d.setOptionsCheckFrequency(2) >>> d.getOptionsCheckFrequency()
See also getOptionsCheckFrequency, setOptionsMaxTrials, setOptionsMaximumCheck.
- setOptionsDampLimit(value)[source]
Sets the accuracy level where solution damping begins.
Example:
>>> d.setOptionsDampLimit(0) >>> d.getOptionsDampLimit()
See also getOptionsDampLimit, setOptionsMaxTrials, setOptionsCheckFrequency.
- setOptionsDemandCharge(value)[source]
Sets the energy charge per maximum KW usage.
Example:
>>> d.setOptionsDemandCharge(0) >>> d.getOptionsDemandCharge()
See also getOptionsDemandCharge, setOptionsGlobalPrice, setOptionsGlobalPattern.
- setOptionsEmitterExponent(value)[source]
Sets the power exponent for the emmitters.
Example:
>>> d.setOptionsEmitterExponent(0.5) >>> d.getOptionsEmitterExponent()
See also getOptionsEmitterExponent, setOptionsPatternDemandMultiplier, setOptionsAccuracyValue.
- setOptionsExtraTrials(value)[source]
Sets the extra trials allowed if hydraulics don’t converge.
Example:
>>> d.setOptionsExtraTrials(10) >>> d.getOptionsExtraTrials() >>> # Set UNBALANCED to STOP >>> d.setOptionsExtraTrials(-1)
See also getOptionsExtraTrials, setOptionsMaxTrials, setOptionsMaximumCheck.
- setOptionsFlowChange(value)[source]
Sets the maximum flow change for hydraulic convergence.
Example:
>>> d.setOptionsFlowChange(0) >>> d.getOptionsFlowChange()
See also getOptionsFlowChange, setOptionsHeadError, setOptionsHeadLossFormula.
- setOptionsGlobalEffic(value)[source]
Sets the global efficiency for pumps(percent).
Example:
>>> d.setOptionsGlobalEffic(75) >>> d.getOptionsGlobalEffic()
See also getOptionsGlobalEffic, setOptionsGlobalPrice, setOptionsGlobalPattern.
- setOptionsGlobalPrice(value)[source]
Sets the global average energy price per kW-Hour.
Example:
>>> d.setOptionsGlobalPrice(0) >>> d.getOptionsGlobalPrice()
See also getOptionsGlobalPrice, setOptionsGlobalEffic, setOptionsGlobalPattern.
- setOptionsGlobalPattern(value)[source]
Sets the global energy price pattern.
Example:
>>> d.setOptionsGlobalPattern(1) >>> d.getOptionsGlobalPattern()
See also getOptionsGlobalPattern, setOptionsGlobalEffic, setOptionsGlobalPrice.
- setOptionsHeadError(value)[source]
Sets the maximum head loss error for hydraulic convergence.
Example:
>>> d.setOptionsHeadError(0) >>> d.getOptionsHeadError()
See also getOptionsHeadError, setOptionsEmitterExponent, setOptionsAccuracyValue.
- setOptionsHeadLossFormula(value)[source]
Sets the headloss formula. ‘HW’ = 0, ‘DW’ = 1, ‘CM’ = 2
Example:
>>> d.setOptionsHeadLossFormula('HW') # Sets the 'HW' headloss formula >>> d.getOptionsHeadLossFormula()
See also getOptionsHeadLossFormula, setOptionsHeadError, setOptionsFlowChange.
- setOptionsLimitingConcentration(value)[source]
Sets the limiting concentration for growth reactions.
Example:
>>> d.setOptionsLimitingConcentration(0) >>> d.getOptionsLimitingConcentration()
See also getOptionsLimitingConcentration, setOptionsPipeBulkReactionOrder, setOptionsPipeWal
- setOptionsMaximumCheck(value)[source]
Sets the maximum trials for status checking.
Example:
>>> d.setOptionsMaximumCheck(10) >>> d.getOptionsMaximumCheck()
See also getOptionsMaximumCheck, setOptionsMaxTrials, setOptionsCheckFrequency.
- setOptionsMaxTrials(value)[source]
Sets the maximum hydraulic trials allowed for hydraulic convergence.
Example:
>>> d.setOptionsMaxTrials(40) >>> d.getOptionsMaxTrials()
See also getOptionsMaxTrials, setOptionsExtraTrials, setOptionsAccuracyValue.
- setOptionsPatternDemandMultiplier(value)[source]
Sets the global pattern demand multiplier.
Example:
>>> d.setOptionsPatternDemandMultiplier(1) >>> d.getOptionsPatternDemandMultiplier()
See also getOptionsPatternDemandMultiplier, setOptionsEmitterExponent, setOptionsAccuracyValue.
- setOptionsPipeBulkReactionOrder(value)[source]
Sets the bulk water reaction order for pipes.
Example:
>>> d.setOptionsPipeBulkReactionOrder(1) >>> d.getOptionsPipeBulkReactionOrder()
See also getOptionsPipeBulkReactionOrder, setOptionsPipeWallReactionOrder, setOptionsTankBulkReactionOrder.
- setOptionsPipeWallReactionOrder(value)[source]
Sets the wall reaction order for pipes (either 0 or 1).
Example:
>>> d.setOptionsPipeWallReactionOrder(1) >>> d.getOptionsPipeWallReactionOrder()
See also getOptionsPipeWallReactionOrder, setOptionsPipeBulkReactionOrder, setOptionsTankBulkReactionOrder.
- setOptionsQualityTolerance(value)[source]
Sets the water quality analysis tolerance.
Example:
>>> d.setOptionsQualityTolerance(0.01) >>> d.getOptionsQualityTolerance()
See also getOptionsQualityTolerance, setOptionsSpecificDiffusivity, setOptionsLimitingConcentration.
- setOptionsSpecificDiffusivity(value)[source]
Sets the specific diffusivity (relative to chlorine at 20 deg C).
Example:
>>> d.setOptionsSpecificDiffusivity(1) >>> d.getOptionsSpecificDiffusivity()
See also getOptionsSpecificDiffusivity, setOptionsSpecificViscosity, setOptionsSpecificGravity.
- setOptionsSpecificGravity(value)[source]
Sets the specific gravity.
Example:
>>> d.setOptionsSpecificGravity(1) >>> d.getOptionsSpecificGravity()
See also getOptionsSpecificGravity, setOptionsSpecificViscosity, setOptionsHeadLossFormula.
- setOptionsSpecificViscosity(value)[source]
Sets the specific viscosity.
Example:
>>> d.setOptionsSpecificViscosity(1) >>> d.getOptionsSpecificViscosity()
See also getOptionsSpecificViscosity, setOptionsSpecificGravity, setOptionsHeadLossFormula.
- setOptionsTankBulkReactionOrder(value)[source]
Sets the bulk water reaction order for tanks.
Example:
>>> d.setOptionsTankBulkReactionOrder(1) >>> d.getOptionsTankBulkReactionOrder()
See also getOptionsTankBulkReactionOrder, setOptionsPipeBulkReactionOrder, setOptionsPipeWallReactionOrder.
- setOptionsPressureUnits(value)[source]
Sets the pressure unit used in Epanet Example:
inpfile = “Net3.inp” d = epanet(inpfile) d.setPressureUnit(1)
- setOptionsPressureUnitsMeters()[source]
Function to set pressure units to meters and check if the change is possible.
If not possible, suggests functions to the user to enable the change.
- Example:
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsPressureUnitsMeters() x = d.getOptionsPressureUnits()
- setOptionsPressureUnitsPSI()[source]
Function to set pressure units to PSI and check if the change is possible.
If not possible, suggests functions to the user to enable the change.
- Example:
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsPressureUnitsPSI() x = d.getOptionsPressureUnits()
- setOptionsPressureUnitsKPA()[source]
Function to set pressure units to meters and check if the change is possible.
If not possible, suggests functions to the user to enable the change.
- Example:
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsPressureUnitsKPA() x = d.getOptionsPressureUnits()
- setOptionsStatusReport(value)[source]
Sets the status report for epanet (EN_NO_REPORT, EN_NORMAL_REPORT or EN_FULL_REPORT).
- setOptionsStatusReportNo()[source]
Function to set the status report option to ‘No Report’.
Returns: The result of the API call to set the status report option. In this case “NO REPORT”
- Example :
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsStatusReportNo() x = d.getOptionsStatusReport() print(x)
See Also: setOptionsStatusReportFull , setOptionsStatusReportNormal
- setOptionsStatusReportFull()[source]
Function to set the status report option to ‘No Report’.
Returns: The result of the API call to set the status report option. In this case “FULL REPORT”
- Example :
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsStatusReportFull() x = d.getOptionsStatusReport() print(x)
See Also: setOptionsStatusReportNo , setOptionsStatusReportNormal
- setOptionsStatusReportNormal()[source]
Function to set the status report option to ‘No Report’.
Returns: The result of the API call to set the status report option. In this case “NORMAL REPORT”
- Example :
inpfile = “Net3.inp” d = epanet(inpfile) d.setOptionsStatusReportNormal() x = d.getOptionsStatusReport() print(x)
See Also: setOptionsStatusReportNo , setOptionsStatusReportFull
- setQualityType(*argv)[source]
Sets the type of water quality analysis called for.
Example 1:
>>> d.setQualityType('none') # Sets no quality analysis. >>> qualInfo = d.getQualityInfo() # Retrieves quality analysis information
Example 2:
>>> d.setQualityType('age') # Sets water age analysis >>> qualInfo = d.getQualityInfo()
Example 3:
>>> d.setQualityType('chem', 'Chlorine') # Sets chemical analysis given the name of the chemical being analyzed >>> qualInfo = d.getQualityInfo() >>> d.setQualityType('chem', 'Chlorine', 'mg/Kg') # Sets chemical analysis given the name of the chemical being analyzed and units that the chemical is measured in >>> qualInfo = d.getQualityInfo()
Example 4:
>>> nodeID = d.getNodeNameID(1) >>> d.setQualityType('trace', nodeID) # Sets source tracing analysis given the ID label of node traced in a source tracing analysis >>> qualInfo = d.getQualityInfo()
See also getQualityInfo, getQualityType, getQualityCode, getQualityTraceNodeIndex.
- setPattern(index, patternVector)[source]
Sets all of the multiplier factors for a specific time pattern.
Example:
>>> patternID = 'new_pattern' >>> patternIndex = d.addPattern(patternID) # Adds a new time pattern >>> patternMult = [1.56, 1.36, 1.17, 1.13, 1.08, ... 1.04, 1.2, 0.64, 1.08, 0.53, 0.29, 0.9, 1.11, ... 1.06, 1.00, 1.65, 0.55, 0.74, 0.64, 0.46, ... 0.58, 0.64, 0.71, 0.66] >>> d.setPattern(patternIndex, patternMult) # Sets the multiplier factors for the new time pattern >>> d.getPattern() # Retrieves the multiplier factor for all patterns and all times
See also getPattern, setPatternValue, setPatternMatrix, setPatternNameID, addPattern, deletePattern.
- setPatternComment(value, *argv)[source]
Sets the comment string assigned to the pattern object.
Example 1:
>>> patternIndex = 1 >>> patternComment = 'This is a PATTERN' >>> d.setPatternComment(patternIndex, patternComment) # Sets the comment of the 1st pattern >>> d.getPatternComment(patternIndex) # Retrieves the comment of the 1st pattern
Example 2:
>>> patternIndex = [1,2] >>> patternComment = ['1st PATTERN', '2nd PATTERN'] >>> d.setPatternComment(patternIndex, patternComment) # Sets the comments of the first 2 patterns (if exist) >>> d.getPatternComment(patternIndex)
Example 3:
>>> d = epanet('BWSN_Network_1.inp') >>> patternComment = ['1st PAT', '2nd PAT', '3rd PAT', "4rth PAT"] >>> d.setPatternComment(patternComment) # Sets the comments of all the patterns (the length of the list must be equal to the number of patterns) >>> d.getPatternComment()
See also getPatternComment, setPatternNameID, setPattern.
- setPatternMatrix(patternMatrix)[source]
Sets all of the multiplier factors for all time patterns.
Example:
>>> patternID_1 = 'new_pattern_1' >>> patternIndex_1 = d.addPattern(patternID_1) # Adds a new time pattern >>> patternID_2 = 'new_pattern_2' >>> patternIndex_2 = d.addPattern(patternID_2) # Adds a new time pattern >>> patternMult = d.getPattern() >>> patternMult[patternIndex_1-1, 1] = 5 # The 2nd multiplier = 5 of the 1st time pattern >>> patternMult[patternIndex_2-1, 2] = 7 # The 3rd multiplier = 7 of the 2nd time pattern >>> d.setPatternMatrix(patternMult) # Sets all of the multiplier factors for all the time patterns given a matrix >>> d.getPattern() # Retrieves the multiplier factor for all patterns and all times
See also getPattern, setPattern, setPatternValue, setPatternNameID, addPattern, deletePattern.
- setPatternNameID(index, Id)[source]
Sets the name ID of a time pattern given it’s index and the new ID.
Example 1:
>>> d.getPatternNameID() # Retrieves the name IDs of all the time patterns >>> d.setPatternNameID(1, 'Pattern1') # Sets to the 1st time pattern the new name ID 'Pattern1' >>> d.getPatternNameID()
Example 2:
>>> d.setPatternNameID([1, 2], ['Pattern1', 'Pattern2']) # Sets to the 1st and 2nd time pattern the new name IDs 'Pattern1' and 'Pattern2' respectively >>> d.getPatternNameID()
See also getPatternNameID, getPatternIndex, getPatternLengths, setPatternComment, setPattern.
- setPatternValue(index, patternTimeStep, patternFactor)[source]
Sets the multiplier factor for a specific period within a time pattern.
Example:
>>> patternID = 'new_pattern' >>> patternIndex = d.addPattern(patternID) # Adds a new time pattern >>> patternTimeStep = 2 >>> patternFactor = 5 >>> d.setPatternValue(patternIndex, patternTimeStep, patternFactor) # Sets the multiplier factor = 5 to the 2nd time period of the new time pattern >>> d.getPattern() # Retrieves the multiplier factor for all patterns and all times
See also getPattern, setPattern, setPatternMatrix, setPatternNameID, addPattern, deletePattern.
- setReport(value)[source]
Issues a report formatting command. Formatting commands are the same as used in the [REPORT] section of the EPANET Input file. More: https://github.com/OpenWaterAnalytics/EPANET/wiki/%5BREPORT%5D
Example 1:
>>> d.setReport('FILE TestReport.txt')
Example 2:
>>> d.setReport('STATUS YES')
See also setReportFormatReset, setReport.
- setReportFormatReset()[source]
Resets a project’s report options to their default values.
Example:
>>> d.setReportFormatReset()
See also setReport, setReportStatus.
- setReportStatus(value)[source]
Sets the level of hydraulic status reporting.
- Possible status that can be set:
‘yes’
‘no’
‘full’
Example:
>>> d.setReportStatus('full')
See also setReport, setReportFormatReset.
- setRulePremise(ruleIndex, premiseIndex, premise)[source]
Sets the premise of a rule - based control.
The examples are based on d = epanet(‘BWSN_Network_1.inp’)
Example 1:
>>> d.getRules()[1]['Premises'] # Retrieves the premise of the 1st rule >>> ruleIndex = 1 >>> premiseIndex = 1 >>> premise = 'IF SYSTEM CLOCKTIME >= 8 PM' >>> d.setRulePremise(ruleIndex, premiseIndex, premise) # Sets the 1st premise of the 1st rule - based control >>> d.getRules()[1]['Premises']
Example 2:
>>> d.getRules()[1]['Premises'] >>> ruleIndex = 1 >>> premiseIndex = 1 >>> premise = 'IF NODE TANK-131 LEVEL > 20' >>> d.setRulePremise(ruleIndex, premiseIndex, premise) # Sets the 1st premise of the 1st rule - based control >>> d.getRules()[1]['Premises']
See also setRulePremiseObjectNameID, setRulePremiseStatus, setRulePremiseValue, setRules, getRules, addRules, deleteRules.
- setRulePremiseObjectNameID(ruleIndex, premiseIndex, objNameID)[source]
Sets the ID of an object in a premise of a rule-based control.
# The example is based on d = epanet(‘BWSN_Network_1.inp’)
Example: Sets the node’s ID = ‘TANK-131’ to the 1st premise of the 1st rule - based control.
>>> d.getRules()[1]['Premises'] >>> ruleIndex = 1 >>> premiseIndex = 1 >>> objNameID = 'TANK-131' >>> d.setRulePremiseObjectNameID(ruleIndex, premiseIndex, objNameID) >>> d.getRules()[1]['Premises']
See also setRulePremise, setRulePremiseStatus, setRulePremiseValue, setRules, getRules, addRules, deleteRules.
- setRulePremiseValue(ruleIndex, premiseIndex, value)[source]
Sets the value being compared to in a premise of a rule-based control.
The example is based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> d.getRules()[1]['Premises'] >>> ruleIndex = 1 >>> premiseIndex = 1 >>> value = 20 >>> d.setRulePremiseValue(ruleIndex, premiseIndex, value) # Sets the value = 20 to the 1st premise of the 1st rule - based control >>> d.getRules()[1]['Premises']
See also setRulePremise, setRulePremiseObjectNameID, setRulePremiseStatus, setRules, getRules, addRules, deleteRules.
- setRules(ruleIndex, rule)[source]
Sets a rule - based control.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> rule = 'RULE RULE-1
IF NODE 2 LEVEL >= 140 THEN PIPE 10 STATUS IS CLOSED ELSE PIPE 10 STATUS IS OPEN PRIORITY 1’
>>> d.addRules(rule) # Adds a new rule - based control >>> d.getRules()[1]['Rule'] # Retrieves the 1st rule - based control >>> ruleIndex = 1 >>> rule_new = 'IF NODE 2 LEVEL > 150
THEN PIPE 10 STATUS IS OPEN ELSE PIPE 11 STATUS IS OPEN PRIORITY 2’
>>> d.setRules(ruleIndex, rule_new) # Sets rule - based control >>> d.getRules()[1]['Rule']
See also setRulePremise, setRuleThenAction, setRuleElseAction, getRules, addRules, deleteRules.
- setRuleElseAction(ruleIndex, actionIndex, else_action)[source]
Sets rule - based control else actions.
- Input Arguments:
Rule Index
Action Index
Link Index
Type
Value
Where Type = ‘STATUS’ or ‘SETTING’ and Value = the value of STATUS/SETTING
See more: ‘https://nepis.epa.gov/Adobe/PDF/P1007WWU.pdf’ (Page 164)
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> d.addRules("RULE RULE-1
IF TANK 2 LEVEL >= 140 THEN PIPE 10 STATUS IS CLOSED ELSE PIPE 10 STATUS IS OPEN PRIORITY 1”) # Adds a new rule - based control
>>> rule = d.getRules(1) # Retrieves the 1st rule - based control >>> ruleIndex = 1 >>> actionIndex = 1 >>> else_action = 'ELSE PIPE 11 STATUS IS CLOSED' >>> d.setRuleElseAction(ruleIndex, actionIndex, else_action) # Sets the new else - action in the 1st rule - based control, in the 1st else - action. >>> rule = d.getRules(1)
See also setRules, setRuleThenAction, setRulePriority, getRuleInfo, getRules, addRules, deleteRules.
- setRulePremiseStatus(ruleIndex, premiseIndex, status)[source]
Sets the status being compared to in a premise of a rule-based control.
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> d.getRules() >>> d.addRules('RULE RULE-1
IF LINK 110 STATUS = CLOSED THEN PUMP 9 STATUS IS CLOSED PRIORITY 1’)
>>> d.getRules(1) >>> ruleIndex = 1 >>> premiseIndex = 1 >>> status = 'OPEN' >>> d.setRulePremiseStatus(ruleIndex, premiseIndex, status) # Sets the status = 'OPEN' to the 1st premise of the 1st rule - based control >>> d.getRules()[1]['Premises']
See also setRulePremise, setRulePremiseObjectNameID, setRulePremiseValue, setRules, getRules, addRules, deleteRules.
- setRulePriority(ruleIndex, priority)[source]
Sets rule - based control priority.
The example is based on d = epanet(‘BWSN_Network_1.inp’)
Example:
>>> d.getRules()[1]['Rule'] # Retrieves the 1st rule - based control >>> ruleIndex = 1 >>> priority = 2 >>> d.setRulePriority(ruleIndex, priority) # Sets the 1st rule - based control priority = 2 >>> d.getRules()[1]['Rule']
See also setRules, setRuleThenAction, setRuleElseAction, getRuleInfo, getRules, addRules, deleteRules.
- setRuleThenAction(ruleIndex, actionIndex, then_action)[source]
Sets rule - based control then actions.
- Input Arguments:
Rule Index
Action Index
Then clause
See more: ‘https://nepis.epa.gov/Adobe/PDF/P1007WWU.pdf’ (Page 164)
The example is based on d = epanet(‘Net1.inp’)
Example:
>>> d.addRules('RULE RULE-1
IF TANK 2 LEVEL >= 140 THEN PIPE 10 STATUS IS CLOSED ELSE PIPE 10 STATUS IS OPEN PRIORITY 1’) # Adds a new rule - based control
>>> rule = d.getRules(1) # Retrieves the 1st rule - based control >>> ruleIndex = 1 >>> actionIndex = 1 >>> then_action = 'THEN PIPE 11 STATUS IS OPEN' >>> d.setRuleThenAction(ruleIndex, actionIndex, then_action) >>> rule = d.getRules(1)
See also setRules, setRuleElseAction, setRulePriority, getRuleInfo, getRules, addRules, deleteRules.
- setTimeHydraulicStep(value)[source]
Sets the hydraulic time step.
Example:
>>> Hstep = 1800 >>> d.setTimeHydraulicStep(Hstep) >>> d.getTimeHydraulicStep()
See also getTimeSimulationDuration, setTimeQualityStep, setTimePatternStep.
- setTimePatternStart(value)[source]
Sets the time when time patterns begin.
Example:
>>> patternStart = 0 >>> d.setTimePatternStart(patternStart) >>> d.getTimePatternStart()
See also getTimePatternStart, setTimePatternStep, setTimeHydraulicStep.
- setTimeClockStartTime(value)[source]
Sets the start time for the simulation.
- Parameters:
- value (long): The start time of the simulation in seconds.
Warning: The value must be smaller than the total number of seconds in a day (i.e., 86400 seconds).
- setTimePatternStep(value)[source]
Sets the time pattern step.
Example:
>>> patternStep = 3600 >>> d.setTimePatternStep(patternStep) >>> d.getTimePatternStep()
See also getTimePatternStep, setTimePatternStart, setTimeHydraulicStep.
- setTimeQualityStep(value)[source]
Sets the quality time step.
Example:
>>> Qstep = 1800 >>> d.setTimeQualityStep(Qstep) >>> d.getTimeQualityStep()
See also getTimeQualityStep, setTimeHydraulicStep, setTimePatternStep.
- setTimeReportingStart(value)[source]
Sets the time when reporting starts.
Example:
>>> reportingStart = 0 >>> d.setTimeReportingStart(reportingStart) >>> d.getTimeReportingStart()
See also getTimeReportingStart, setTimeReportingStep, setTimePatternStart.
- setTimeReportingStep(value)[source]
Sets the reporting time step.
Example:
>>> reportingStep = 3600 >>> d.setTimeReportingStep(reportingStep) >>> d.getTimeReportingStep()
See also getTimeReportingStep(), setTimeReportingStart, setTimeRuleControlStep.
- setTimeRuleControlStep(value)[source]
Sets the rule-based control evaluation time step.
Example:
>>> ruleControlStep = 360 >>> d.setTimeRuleControlStep(ruleControlStep) >>> d.getTimeRuleControlStep()
See also getTimeRuleControlStep, setTimeReportingStep, setTimePatternStep.
- setTimeSimulationDuration(value)[source]
Sets the simulation duration (in seconds).
Example:
>>> simulationDuration = 172800 # 172800 seconds = 2days >>> d.setTimeSimulationDuration(simulationDuration) >>> d.getTimeSimulationDuration()
See also getTimeSimulationDuration(), getTimeClockStartTime(), getTimeHaltFlag().
- setTimeStatisticsType(value)[source]
Sets the statistic type.
- Types that can be set:
‘NONE’
‘AVERAGE’
‘MINIMUM’
‘MAXIMUM’
‘RANGE’
Example:
>>> d.getTimeStatisticsType() >>> statisticsType = 'AVERAGE' >>> d.setTimeStatisticsType(statisticsType) >>> d.getTimeStatisticsType()
See also getTimeStatisticsType, setTimeReportingStart, setTimeReportingStep.
- setTitle(*argv)[source]
Sets the title lines of the project.
Example:
>>> line_1 = 'This is a title' >>> line_2 = 'This is a test line 2' >>> line_3 = 'This is a test line 3' >>> d.setTitle(line_1, line_2, line_3) >>> [Line1, Line2, Line3] = d.getTitle()
See also getTitle, setLinkComment, setNodeComment.
- solveCompleteHydraulics()[source]
Runs a complete hydraulic simulation with results for all time periods written to the binary Hydraulics file.
Example:
>>> d.solveCompleteHydraulics()
See also solveCompleteQuality.
- solveCompleteQuality()[source]
Runs a complete water quality simulation with results at uniform reporting intervals written to EPANET’s binary Output file.
Example:
>>> d.solveCompleteQuality()
See also solveCompleteHydraulics.
- splitPipe(pipeID, newPipeID, newNodeID)[source]
Splits a pipe (pipeID), creating two new pipes (pipeID and newPipeID) and adds a junction/node (newNodeID) in between. If the pipe is linear the pipe is splitted in half, otherwisw the middle point of the vertice array elemnts is taken as the split point. The two new pipes have the same properties as the one which is splitted. The new node’s properties are the same with the nodes on the left and right and New Node Elevation and Initial quality is the average of the two.
Example 1: Splits pipe with ID ‘11’ to pipes ‘11’ and ‘11a’ and creates the node ‘11a’ in the link of the two new pipes.
>>> d = epanet('Net1.inp') >>> pipeID = '11' >>> newPipeID = '11a' >>> newNodeID = '11node' >>> [leftPipeIndex, rightPipeIndex] = d.splitPipe(pipeID,newPipeID,newNodeID) >>> d.getLinkIndex() >>> d.getNodesConnectingLinksID() >>> d.plot('highlightlink', pipeID)
Example 2: Splits pipe with ID ‘P-837’ to pipes ‘P-837’ and ‘P-837a’ and creates the node ‘P-837node’ in the link of the two new pipes, using vertices. (The new left pipe can be noticed at the top left of the plot in red colour)
>>> d = epanet('ky10.inp') >>> pipeID = 'P-837' >>> newPipeID= 'P-837a' >>> newNodeID= 'P-837node' >>> [leftPipeIndex, rightPipeIndex] = d.splitPipe(pipeID,newPipeID,newNodeID) >>> d.plot('highlightlink', pipeID)
- stepQualityAnalysisTimeLeft()[source]
Advances the water quality simulation one water quality time step. The time remaining in the overall simulation is returned in tleft.
Example:
>>> tleft = d.stepQualityAnalysisTimeLeft()
For more, you can type help getNodePressure and check examples 3 & 4.
See also runQualityAnalysis, closeQualityAnalysis.
- initializeHydraulicAnalysis(*argv)[source]
Initializes storage tank levels, link status and settings, and the simulation clock time prior to running a hydraulic analysis.
- Codes:
NOSAVE = 0, Don’t save hydraulics don’t re-initialize flows
SAVE = 1, Save hydraulics to file, don’t re-initialize flows
INITFLOW = 10, Don’t save hydraulics re-initialize flows
SAVE_AND_INIT = 11 Save hydraulics re-initialize flows
Example 1:
>>> d.initializeHydraulicAnalysis() # Uses the default code i.e. SAVE = 1
Example 2:
>>> code = 0 # i.e. Don't save >>> d.initializeHydraulicAnalysis(code)
For more, you can type help d.getNodePressure and check examples 3 & 4.
See also saveHydraulicFile, initializeQualityAnalysis.
- nextHydraulicAnalysisStep()[source]
Determines the length of time until the next hydraulic event occurs in an extended period simulation.
Example:
>>> d.nextHydraulicAnalysisStep()
For more, you can type help (d.getNodePressure) and check examples 3 & 4.
See also nextQualityAnalysisStep, runHydraulicAnalysis.
- openHydraulicAnalysis()[source]
Opens the hydraulics analysis system.
Example:
>>> d.openHydraulicAnalysis()
For more, you can type help d.getNodePressure and check examples 3 & 4.
See also openQualityAnalysis, initializeHydraulicAnalysis.
- plot(title=None, line=None, point=None, nodesID=None, nodesindex=None, linksID=None, linksindex=None, highlightlink=None, highlightnode=None, legend=True, fontsize=5, figure=True, fig_size=[3, 2], dpi=300, node_values=None, node_text=False, link_values=None, link_text=False, colorbar='turbo', min_colorbar=None, max_colorbar=None, colors=None, colorbar_label=None, highligthlink_linewidth=1, highligthnode_linewidth=3.5, *argv)[source]
Plot Network, show all components, plot pressure/flow/elevation/waterage/anyvalue
Example 1:
>>> d = epanet('Net1.inp') >>> d.plot() # Plot Net1.inp network
Example 2:
>>> d = epanet('Net1.inp') # Run hydralic analysis and plot the pressures at 10hrs >>> d.openHydraulicAnalysis() >>> d.initializeHydraulicAnalysis() >>> tstep, P = 1, [] >>> while tstep>0: ... t = d.runHydraulicAnalysis() ... P.append(d.getNodePressure()) ... tstep=d.nextHydraulicAnalysisStep() >>> d.closeHydraulicAnalysis() >>> hr = 10 >>> d.plot(node_values = P[hr])
- plot_ts(X=None, Y=None, title='', xlabel='', ylabel='', color=None, marker='x', figure_size=[3, 2.5], constrained_layout=True, fontweight='normal', fontsize_title=8, fontsize=8, labels=None, save_fig=False, filename='temp', tight_layout=False, dpi=300, filetype='png', legend_location='best')[source]
Plot X Y data
- runHydraulicAnalysis()[source]
Runs a single period hydraulic analysis, retrieving the current simulation clock time t.
Example:
>>> tstep = d.runHydraulicAnalysis()
For more, you can type help getNodePressure and check examples 3 & 4.
See also runQualityAnalysis, initializeHydraulicAnalysis.
- unload()[source]
unload() library and close the EPANET Toolkit system.
Example:
>>> d.unload()
See also epanet, saveInputFile, closeNetwork().
- useHydraulicFile(hydname)[source]
Uses the contents of the specified file as the current binary hydraulics file.
Example:
>>> filename = 'test.hyd' >>> d.useHydraulicFile(filename)
See also saveHydraulicFile, initializeHydraulicAnalysis.
- writeLineInReportFile(line)[source]
Writes a line of text to the EPANET report file.
Example:
>>> line = 'Status YES' >>> d.writeLineInReportFile(line)
See also writeReport, copyReport.
- writeReport()[source]
Writes a formatted text report on simulation results to the Report file.
Example:
>>> d = epanet('Net1.inp') >>> d.solveCompleteHydraulics() >>> d.solveCompleteQuality() >>> d.setReportFormatReset() >>> d.setReport('FILE TestReport3.txt') >>> d.setReport('NODES ALL') >>> d.setReport('LINKS ALL') >>> d.writeReport() >>> report_file_string = open('TestReport3.txt').read()
See also copyReport, writeLineInReportFile.
- loadMSXFile(msxname, customMSXlib=None, ignore_properties=False)[source]
Loads an msx file Example:
d.loadMSXFile(‘net2-cl2.msx’)
Example using custom msx library : msxlib=os.path.join(os.getcwd(), ‘epyt’,’libraries’,’win’,’epanetmsx.dll’)
d = epanet(inpname, msx=True, customlib=epanetlib) d.loadMSXFile(msxname, customMSXlib=msxlib)
- getMSXSpeciesCount()[source]
Retrieves the number of species.
- Example:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.getMSXSpeciesCount()
- See also getMSXSpeciesIndex, getMSXSpeciesNameID, getMSXSpeciesConcentration,
getMSXSpeciesType, getMSXSpeciesUnits, getMSXSpeciesATOL, getMSXSpeciesRTOL.
- getMSXConstantsCount()[source]
Retrieves the number of constants.
- Example:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.getMSXConstantsCount()
- See also getMSXConstantsIndex, getMSXConstantsValue,
getMSXConstantsNameID.
- getMSXParametersCount()[source]
Retrieves the number of parameters.
- Example:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.getMSXParametersCount()
- See also setMSXParametersTanksValue, setMSXParametersPipesValue,
getMSXParametersIndex, getMSXParametersTanksValue, getMSXParametersPipesValue.
- getMSXPatternsCount()[source]
Retrieves the number of patterns.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.addMSXPattern(‘P1’, [1.0, 0.0 1.0]) d.addMSXPattern(‘P2’, [0.0, 0.0 2.0]) d.getMSXPatternsCount()
See also setMSXPattern, setMSXPatternValue, addMSXPattern.
- saveMSXFile(msxname)[source]
Saves the data associated with the current MSX project into a new MSX input file.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.saveMSXFile(‘testMSX.msx’)
See also writeMSXFile.
- saveMSXQualityFile(outfname)[source]
Saves the quality as bin file.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXComputedQualitySpecie(‘CL2’) d.saveMSXQualityFile(‘testMSXQuality.bin’)
- solveMSXCompleteHydraulics()[source]
Solve complete hydraulic over the entire simulation period. % % Example: % d = epanet(‘net2-cl2.inp’) % d.loadMSXFile(‘net2-cl2.msx’) % d.solveMSXCompleteHydraulics() % % See also solveMSXCompleteQuality.
- solveMSXCompleteQuality()[source]
Solve complete hydraulic over the entire simulation period.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.solveMSXCompleteQuality()
See also solveMSXCompleteHydraulics.
- useMSXHydraulicFile(hydname)[source]
% Uses a previously saved EPANET hydraulics file as the source % of hydraulic information. % % Example: % d = epanet(‘net2-cl2.inp’); % d.loadMSXFile(‘net2-cl2.msx’); % d.saveHydraulicsOutputReportingFile % d.saveHydraulicFile(‘testMSXHydraulics.hyd’) % d.useMSXHydraulicFile(‘testMSXHydraulics.hyd’) % % See also saveHydraulicsOutputReportingFile, saveHydraulicFile.
- getMSXPatternValue(patternIndex, patternStep)[source]
Retrieves the multiplier at a specific time period for a given source time pattern.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.addMSXPattern(‘P1’, [1.0 0.0 3.0]) d.getMSXPatternValue(1,3) Retrieves the third multiplier of the first pattern.
- See also setMSXPatternValue, setMSXPattern, setMSXPatternMatrix,
getMSXPatternsIndex, getMSXPatternsNameID.
- initializeMSXQualityAnalysis(flag)[source]
Initializes the MSX system before solving for water quality results in step-wise fashion.
- flag options:
- 1: if water quality results should be saved to a scratch
binary file or
0: if results are not saved to file.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) tleft = 1 d.solveMSXCompleteHydraulics() d.initializeMSXQualityAnalysis(0) while(tleft>0):
t,tleft = d.stepMSXQualityAnalysisTimeLeft
See also solveMSXCompleteHydraulics, stepMSXQualityAnalysisTimeLeft.
- stepMSXQualityAnalysisTimeLeft()[source]
- Advances the water quality solution through a single water quality time step when
performing a step-wise simulation.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) tleft = 1 d.solveMSXCompleteHydraulics() d.initializeMSXQualityAnalysis(0) while(tleft>0):
t,tleft = d.stepMSXQualityAnalysisTimeLeft()
% See also solveMSXCompleteHydraulics, initializeMSXQualityAnalysis.
- getMSXError(code)[source]
Retrieves the MSX erorr message for specific erorr code.
- Example:
d.getMSXError(510)
- getMSXOptions()[source]
Retrieves all the options.
- Example:
d=epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXOptions()
- getMSXTimeStep()[source]
Retrieves the time step.
- Example:
d=epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXTimeStep()
See also setMSXTimeStep.
- getMSXRateUnits()[source]
Retrieves rate units. Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRateUnits()
See also setMSXRateUnits.
- getMSXAreaUnits()[source]
Retrieves Are units. Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXAreaUnits()
See also setMSXAreaUnits.
- getMSXCompiler()[source]
Retrieves the chemistry function compiler code.
- Compiler Options:
NONE: no compiler (default option) gc: MinGW or Gnu C++ compilers vc: Visual C++ compiler
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXCompiler()
- See also setMSXCompilerNONE, setMSXCompilerVC,
setMSXCompilerGC.
- getMSXCoupling()[source]
Retrieves the degree of coupling for solving DAE’s.
- Coupling Options:
- NONE: The solution to the algebraic equations is only updated
at the end of each integration time step.
- FULL: The updating is done whenever a new set of values for the
rate-dependent variables in the reaction rate expressions is computed.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXCoupling()
See also setMSXCouplingFULL, setMSXCouplingNONE.
- getMSXSolver()[source]
Retrieves the solver method.
- Numerical integration methods:
EUL = standard Euler integrator RK5 = Runge-Kutta 5th order integrator ROS2 = 2nd order Rosenbrock integrator.
- Example:
d=epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXSolver()
See also setMSXSolverEUL, setMSXSolverRK5, setMSXSolverROS2.
- getMSXAtol()[source]
Retrieves the absolute tolerance.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXAtol()
See also getMSXRtol.
- getMSXRtol()[source]
Retrieves the relative accuracy level.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRtol()
See also getMSXAtol.
- getMSXConstantsNameID(*ids)[source]
Return one or more MSX constant names by index.
Parameters
- *idsint or iterable of int, optional
Indices (1-based) of the constants to retrieve. • If no ids are given, all constants are returned. • If the first and only positional argument is an iterable
(list/tuple/set), its contents are used as the index list.
Returns
- list[str]
Constant names in the order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXConstantsNameID() # all constants >>> d.getMSXConstantsNameID(1) # first constant >>> d.getMSXConstantsNameID(1, 2) # constants 1, 2 >>> d.getMSXConstantsNameID([1, 2]) # constants 1, 2
- See also getMSXConstantsCount, getMSXConstantsValue,
getMSXConstantsNameID.
- getMSXParametersNameID(*ids)[source]
Return one or more MSX parameter names (IDs) by index.
Parameters
- *idsint or iterable of int, optional
1-based indices of the parameters to retrieve. • No arguments -> all parameters are returned. • One iterable -> its contents are treated as the index list. • Several ints -> those specific indices are returned.
Returns
- list[str]
Parameter names in the order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXParametersNameID() # all parameters >>> d.getMSXParametersNameID(1) # first parameter >>> d.getMSXParametersNameID(1, 3) # parameters 1 and 3 >>> d.getMSXParametersNameID([2, 4, 5]) # parameters 2, 4, 5
- See also getMSXParametersCount, getMSXParametersIndex,
getMSXParametersTanksValue, getMSXParametersPipesValue.
- getMSXPatternsNameID(*ids)[source]
Return one or more MSX pattern names (IDs) by index.
Parameters
- *idsint or iterable of int, optional
1-based indices of the patterns to retrieve. • Call with no arguments → all patterns are returned. • Pass a single iterable → its contents are treated as the index list. • Pass several ints → those specific indices are returned.
Returns
- list[str]
Pattern names in the order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.addMSXPattern(‘P1’, [1.0, 0.0, 1.0]) d.addMSXPattern(‘P2’, [0.0, 0.0, 2.0]) d.addMSXPattern(‘P3’, [0.0, 1.0, 2.0]) d.addMSXPattern(‘P4’, [1.0, 1.0, 2.0])
Examples
>>> d.getMSXPatternsNameID() # all patterns >>> d.getMSXPatternsNameID(1) # first pattern >>> d.getMSXPatternsNameID(1, 3) # patterns 1 and 3 >>> d.getMSXPatternsNameID([2, 4, 5]) # patterns 2, 4, 5
- See also getMSXPattern, getMSXPatternsIndex, getMSXPatternsLengths,
setMSXPattern, setMSXPatternMatrix, setMSXPatternValue.
- getMSXSpeciesNameID(*argv)[source]
Retrieves the species’ ID.
- Example:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.getMSXSpeciesNameID() Retrieves the IDs of all the species. d.getMSXSpeciesNameID(1) Retrieves the IDs of the first specie.
- See also getMSXSpeciesIndex, getMSXSpeciesCount, getMSXSpeciesConcentration,
getMSXSpeciesType, getMSXSpeciesUnits, getMSXSpeciesATOL, getMSXSpeciesRTOL.
- getMSXParametersIndex(*names)[source]
Return the MSX index of one or more parameters, looked up by name.
Parameters
- *namesstr or iterable of str, optional
Parameter IDs (names) to look up. • Call with no arguments → all parameters are returned. • A single iterable → its contents are used as the name list. • Several strings → those exact names are looked up.
Returns
- list[int]
Parameter indices, in the same order the names were requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXParametersIndex() # all parameters >>> d.getMSXParametersIndex('k1') # index of 'k1' >>> d.getMSXParametersIndex('k1', 'k3', 'kDOC1') # specific set >>> d.getMSXParametersIndex(['k1', 'k3']) # list/iterable
- See also getMSXParametersCount, getMSXParametersIndex,
getMSXParametersTanksValue, getMSXParametersPipesValue.
- getMSXSpeciesIndex(*names)[source]
Return the MSX index (1-based) of one or more species.
Parameters
- *namesstr | iterable[str], optional
Species IDs (names) to look up.
No arguments – return indices for all species.
One iterable – its elements are treated as the list of names.
Several strings – those specific species names.
Returns
- list[int]
Indices in the same order the names were requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSpeciesIndex() # all species >>> d.getMSXSpeciesIndex('NH3') # index of Na >>> d.getMSXSpeciesIndex('NH2CL', 'NH3', 'H') # CL2, Nb, Na >>> d.getMSXSpeciesIndex(['NH3', 'TOC']) # iterable form
- See also getMSXSpeciesUnits, getMSXSpeciesCount, getMSXSpeciesConcentration,
getMSXSpeciesType, getMSXSpeciesNameID, getMSXSpeciesRTOL, getMSXSpeciesATOL.
- getMSXPatternsIndex(*names)[source]
Return the MSX index (1-based) of one or more patterns.
Parameters
- *namesstr | iterable[str], optional
Pattern names (IDs) to look up. • No arguments – indices of all patterns are returned. • One iterable – its elements are treated as the name list. • Several strings – those exact pattern names.
Returns
- list[int]
Pattern indices in the same order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.addMSXPattern(‘P1’, [1.0, 0.0, 1.0]) d.addMSXPattern(‘P2’, [0.0, 0.0, 2.0]) d.addMSXPattern(‘P3’, [0.0, 1.0, 2.0]) d.addMSXPattern(‘P4’, [1.0, 1.0, 2.0])
Examples:
>>> d.getMSXPatternsIndex() # all patterns >>> d.getMSXPatternsIndex('P1') # index of 'P1' >>> d.getMSXPatternsIndex('P1', 'P2', 'P3') # specific set >>> d.getMSXPatternsIndex(['P1', 'P3']) # iterable form
- See also getMSXPattern, getMSXPatternsNameID, getMSXPatternsLengths,
setMSXPattern, setMSXPatternMatrix, setMSXPatternValue.
- getMSXConstantsIndex(*names)[source]
Return the MSX indices (1-based) of one or more constants.
Parameters
- *namesstr | iterable[str], optional
Constant IDs to look up. • No arguments – return indices for all constants. • One iterable – its elements form the lookup list. • Several strings – those exact constant names.
Returns
- list[int]
Indices in the same order the names were requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXConstantsIndex() # all constants >>> d.getMSXConstantsIndex('S1') # index of 'S1' >>> d.getMSXConstantsIndex('S1', 'S2') # specific set >>> d.getMSXConstantsIndex(['S2', 'S1']) # iterable form
- See also getMSXConstantsCount, getMSXConstantsValue,
getMSXConstantsNameID.
- getMSXConstantsValue(*indices)[source]
Return the value of one or more MSX constants, addressed by index.
Parameters
- *indicesint | iterable[int], optional
1-based constant indices. • No arguments → values for all constants. • One iterable → its items are the index list. • Several ints → those exact indices.
Returns
- list[float]
Constant values, in the same order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXConstantsValue() # all constants >>> d.getMSXConstantsValue(1) # constant 1 >>> d.getMSXConstantsValue(1, 2) # constants 1 and 2 >>> d.getMSXConstantsValue([2, 1]) # iterable form
- See also setMSXConstantsValue, getMSXConstantsCount,
getMSXConstantsIndex, getMSXConstantsNameID
- getMSXParametersPipesValue()[source]
Retrieves the parameters pipes value.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXParametersPipesValue()
- See also setMSXParametersPipesValue, getMSXParametersTanksValue,
getMSXParametersCount, getMSXParametersIndex.
- getMSXParametersTanksValue()[source]
Retrieves the parameters tanks value.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) tankIndex = d.getNodeTankIndex() d.getMSXParametersTanksValue{tankIndex} Retrieves the value of the first tank.
- See also setMSXParametersTanksValue, getMSXParametersCount,
getMSXParametersIndex, getMSXParametersPipesValue.
- getMSXPatternsLengths(*indices)[source]
Return the length (number of factors) of one or more MSX patterns.
Parameters
- *indicesint | iterable[int], optional
1-based pattern indices. • No arguments → return the length of all patterns. • One iterable → its items are treated as the index list. • Several ints → those exact pattern indices.
Returns
- list[int]
Pattern lengths in the same order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’) d.addMSXPattern(‘P1’, [1.0, 0.0, 1.0]) d.addMSXPattern(‘P2’, [0.0, 0.0, 2.0]) d.addMSXPattern(‘P3’, [0.0, 1.0, 2.0]) d.addMSXPattern(‘P4’, [1.0, 1.0, 2.0])
Examples:
>>> d.getMSXPatternsLengths() # all patterns >>> d.getMSXPatternsLengths(1) # pattern 1 >>> d.getMSXPatternsLengths(1, 2) # patterns 1 and 2 >>> d.getMSXPatternsLengths([2, 4]) # iterable form
- getMSXPattern()[source]
Retrieves the time patterns.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.addMSXPattern(‘P1’, [1.0 0.0 1.0]) d.addMSXPattern(‘P2’, [1.0 0.0 1.0]) d.addMSXPattern(‘P3’, [0.0 1.0 2.0]) d.addMSXPattern(‘P4’, [1.0 2.0 2.5]) patterns = d.getMSXPattern() Retrieves all the patterns.
- See also setMSXPattern, setMSXPatternMatrix, setMSXPatternValue,
getMSXPatternsIndex, getMSXPatternsNameID,.
- getMSXSpeciesType(*indices)[source]
Return the MSX type (bulk-flow, wall, etc.) of one or more species.
Parameters
- *indicesint | iterable[int], optional
1-based species indices. • No arguments → types for all species. • One iterable → its items are treated as the index list. • Several ints → those exact species indices.
Returns
- list[int]
Species-type codes in the same order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSpeciesType() # all species >>> d.getMSXSpeciesType(1) # species 1 >>> d.getMSXSpeciesType(5, 7) # species 5 and 7 >>> d.getMSXSpeciesType([2, 4, 6]) # iterable form
- See also getMSXSpeciesIndex, getMSXSpeciesCount, getMSXSpeciesConcentration,
getMSXSpeciesnameID, getMSXSpeciesUnits, getMSXSpeciesATOL, getMSXSpeciesRTOL.
- getMSXSpeciesUnits(*indices)[source]
Return the units string for one or more MSX species.
Parameters
- *indicesint | iterable[int], optional
1-based species indices. • No arguments – return units for all species. • One iterable – its elements are treated as the index list. • Several ints – those exact species indices.
Returns
- list[str]
Units strings in the same order requested.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSpeciesUnits() # all species >>> d.getMSXSpeciesUnits(1) # species 1 >>> d.getMSXSpeciesUnits(1, 16) # species 1 and 16 >>> d.getMSXSpeciesUnits([2, 4, 5]) # iterable form See also getMSXSpeciesIndex, getMSXSpeciesCount, getMSXSpeciesConcentration, getMSXSpeciesType, getMSXSpeciesNameID, getMSXSpeciesATOL, getMSXSpeciesRTOL.
- getMSXEquationsTerms()[source]
Retrieves equation terms.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXEquationsTerms()
See also getMSXEquationsPipes, getMSXEquationsTanks.
- getMSXEquationsPipes()[source]
Retrieves equation for pipes.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXEquationsPipes()
See also getMSXEquationsTerms, getMSXEquationsTanks.
- getMSXEquationsTanks()[source]
Retrieves equation for tanks.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXEquationsTanks()
See also getMSXEquationsTerms, getMSXEquationsPipes.
- getMSXSourceType(*nodes)[source]
Return the source-type code(s) for one or more nodes.
Each MSX source is defined per (node, species). The toolkit call
MSXgetsource(node, species)returns a 4-tuple(type, level, pattern, _reserved); we keep only the first element (the type code).Parameters
- *nodesint | iterable[int], optional
1-based node indices. • No arguments → all nodes. • One iterable → its items are treated as the node list. • Several ints → those exact nodes.
Returns
- list[list[int]]
Outer list follows the order requested; inner list contains the source- type code for every species at that node (length = getMSXSpeciesCount()).
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSourceType() # all nodes >>> d.getMSXSourceType(1) # node 1 >>> d.getMSXSourceType(1, 2) # nodes 1 and 2 >>> d.getMSXSourceType([3, 5, 7]) # iterable form
- See also getMSXSources, getMSXSourceNodeNameID
getMSXSourceLevel, getMSXSourcePatternIndex.
- getMSXSourceLevel(*nodes)[source]
Return the level value of one or more MSX sources.
For every (node, species) pair the EPANET-MSX toolkit call
MSXgetsource(node, species)returns a 4-tuple(type, level, pattern, _reserved). This helper extracts only level (index 1).Parameters
- *nodesint | iterable[int], optional
1-based node indices. • No arguments – all nodes. • One iterable – its items are treated as the node list. • Several ints – those exact node indices.
Returns
- list[list[float]]
Outer list follows the order requested; each inner list contains the level for every species at that node (length = getMSXSpeciesCount()).
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSourceLevel() # levels for all nodes >>> d.getMSXSourceLevel(1) # node 1 >>> d.getMSXSourceLevel(1, 5) # nodes 1 and 5 >>> d.getMSXSourceLevel([2, 4, 7]) # iterable form
- See also getMSXSources, getMSXSourceNodeNameID
getMSXSourceType, getMSXSourcePatternIndex.
- getMSXSourcePatternIndex(*nodes)[source]
Return the pattern index associated with the source at one or more nodes.
For every (node, species) pair the EPANET-MSX call
MSXgetsource(node, species)
returns a 4-tuple (type, level, patternIndex, _reserved). This helper extracts only patternIndex (element 2).
Parameters
- *nodesint | iterable[int], optional
1-based node indices. • No arguments → pattern indices for all nodes. • One iterable → its elements are the node list. • Several ints → those exact nodes.
Returns
- list[list[int]]
Outer list follows the order requested; each inner list contains the pattern index for every species at that node (length =
getMSXSpeciesCount()).- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXSourcePatternIndex() # every node >>> d.getMSXSourcePatternIndex(1) # node 1 >>> d.getMSXSourcePatternIndex(1, 5) # nodes 1 and 5 >>> d.getMSXSourcePatternIndex([2, 4, 7]) # iterable form
- See also getMSXSources, getMSXSourceNodeNameID
getMSXSourceType, getMSXSourceLevel.
- getMSXLinkInitqualValue(*links)[source]
Return the initial-quality value for one or more links.
Parameters
- *linksint | iterable[int], optional
1-based link indices. • No arguments → values for all links. • One iterable → its items are treated as the index list. • Several ints → those exact link indices.
Returns
- list[list[float]]
Outer list follows the order requested; each inner list contains the initial-quality value for every species at that link (length =
getMSXSpeciesCount()).- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXLinkInitqualValue() # every link >>> d.getMSXLinkInitqualValue(1) # link 1 >>> d.getMSXLinkInitqualValue(1, 3) # links 1 and 3 >>> d.getMSXLinkInitqualValue([2, 5, 7]) # iterable form
See also setMSXLinkInitqualValue
- getMSXNodeInitqualValue(*nodes)[source]
Return the initial-quality values for one or more nodes.
Parameters
- *nodesint or iterable of int, optional
1-based node indices. • No arguments → all nodes. • One iterable → the iterable’s contents are the node list. • Several ints → those specific nodes.
Returns
- list[list[float]]
Outer list is in the same order requested; each inner list contains the species-quality values for that node.
- Setup:
d = epanet(‘Net3-NH2CL.inp’) d.loadMSXFile(‘Net3-NH2CL.msx’)
Examples:
>>> d.getMSXNodeInitqualValue() # all nodes >>> d.getMSXNodeInitqualValue(1) # node 1 >>> d.getMSXNodeInitqualValue(1, 3, 7) # nodes 1, 3, 7 >>> d.getMSXNodeInitqualValue([2, 5]) # nodes 2 and 5
See also setMSXNodeInitqualValue.
- getMSXSpeciesATOL()[source]
Retrieves the species’ absolute tolerance.
- Example:
d = epanet(‘net3-bio.inp’) d.loadMSXFile(‘net3-bio.msx’) d.getMSXSpeciesATOL()
- See also getMSXSpeciesIndex, getMSXSpeciesCount, getMSXSpeciesConcentration,
getMSXSpeciesType, getMSXSpeciesNameID, getMSXSpeciesUnits, getMSXSpeciesRTOL.
- getMSXSpeciesRTOL()[source]
Retrieves the species’ relative accuracy level.
- Example:
d = epanet(‘net3-bio.inp’) d.loadMSXFile(‘net3-bio.msx’) d.getMSXSpeciesRTOL()
- See also getMSXSpeciesIndex, getMSXSpeciesCount, getMSXSpeciesConcentration,
getMSXSpeciesType, getMSXSpeciesNameID, getMSXSpeciesUnits, getMSXSpeciesATOL.
- getMSXSpeciesConcentration(type, index, species)[source]
Returns the node/link concentration for specific specie.
- type options:
node = 0 link = 1
- Example:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); d.getMSXComputedQualitySpecie(‘CL2’) speciesIndex = d.getMSXSpeciesIndex(‘CL2’) d.getMSXSpeciesConcentration(0, 1, spIndex) Retrieves the CL2 concentration of the first node. d.getMSXSpeciesConcentration(1, 1, spIndex) Retrieves the CL2 concentration of the first link.
- See also getMSXSpeciesIndex, getMSXSpeciesNameID,
getMSXSpeciesCount, getMSXSpeciesType, getMSXSpeciesUnits, getMSXSpeciesATOL, getMSXSpeciesRTOL.
- getMSXSourceNodeNameID()[source]
Retrieves the sources node ID.
- Example:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); d.getMSXSourceNodeNameID Retrieves all the source node IDs.
- See also getMSXSources, getMSXSourceType
getMSXSourceLevel, getMSXSourcePatternIndex.
- setMSXAreaUnitsCM2()[source]
Sets the area units to square centimeters.
The default is FT2.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXAreaUnits() d.setMSXAreaUnitsCM2() d.getMSXAreaUnits()
See also setMSXAreaUnitsFT2, setMSXAreaUnitsM2.
- setMSXAreaUnitsFT2()[source]
Sets the area units to square feet.
The default is FT2.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXAreaUnits() d.setMSXAreaUnitsFT2() d.getMSXAreaUnits()
See also setMSXAreaUnitsM2, setMSXAreaUnitsCM2.
- setMSXAreaUnitsM2()[source]
Sets the area units to square meters.
The default is FT2.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXAreaUnits() d.setMSXAreaUnitsM2() d.getMSXAreaUnits()
See also setMSXAreaUnitsFT2, setMSXAreaUnitsCM2.
- setMSXAtol(value)[source]
- Sets the absolute tolerance used to determine when two concentration levels of a
species are the same.
If no ATOL option is specified then it defaults to 0.01 (regardless of species concentration units).
- Example:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); d.getMSXAtol() d.setMSXAtol(2e-3); d.getMSXAtol()
% See also setMSXRtol.
- setMSXRtol(value)[source]
Sets the relative accuracy level on a species’ concentration used to adjust time steps in the RK5 and ROS2 integration methods.
If no RTOL option is specified then it defaults to 0.001.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRtol() d.setMSXRtol(2e-3) d.getMSXRtol()
See also setMSXAtol.
- setMSXCompilerGC()[source]
Sets chemistry function compiler code to GC.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2-vc.msx’) d.getMSXCompiler() d.setMSXCompilerGC() d.getMSXCompiler()
See also setMSXCompilerNONE, setMSXCompilerVC.
- setMSXCompilerVC()[source]
Sets chemistry function compiler code to VC.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXCompiler() d.setMSXCompilerVC() d.getMSXCompiler()
See also setMSXCompilerNONE, setMSXCompilerGC.
- setMSXCompilerNONE()[source]
Sets chemistry function compiler code to NONE.
- Example:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); d.getMSXCompiler() d.setMSXCompilerNONE() d.getMSXCompiler()
See also setMSXCompilerVC, setMSXCompilerGC.
- setMSXCouplingFULL()[source]
Sets coupling to FULL.
COUPLING determines to what degree the solution of any algebraic equilibrium equations is coupled to the integration of the reaction rate equations. With FULL coupling the updating is done whenever a new set of values for the rate-dependent variables in the reaction rate expressions is computed. The default is FULL coupling.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXCoupling() d.setMSXCouplingFULL() d.getMSXCoupling()
See also setMSXCouplingNONE.
- setMSXCouplingNONE()[source]
Sets coupling to NONE.
COUPLING determines to what degree the solution of any algebraic equilibrium equations is coupled to the integration of the reaction rate equations. If coupling is NONE then the solution to the algebraic equations is only updated at the end of each integration time step. The default is FULL coupling.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXCoupling() d.setMSXCouplingFULL() d.getMSXCoupling()
See also setMSXCouplingFULL.
- setMSXRateUnitsDAY()[source]
Sets the rate units to days.
The default units are hours (HR)
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRateUnits() d.setMSXRateUnitsDAY() d.getMSXRateUnits()
- See also setMSXRateUnitsSEC, setMSXRateUnitsMIN
setMSXRateUnitsHR.
- setMSXRateUnitsHR()[source]
Sets the rate units to hours.
The default units are hours (HR)
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRateUnits() d.setMSXRateUnitsHR() d.getMSXRateUnits()
- See also setMSXRateUnitsSEC, setMSXRateUnitsMIN
setMSXRateUnitsDAY.
- setMSXRateUnitsMIN()[source]
Sets the rate units to minutes.
The default units are hours (HR)
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRateUnits() d.setMSXRateUnitsMIN() d.getMSXRateUnits()
- See also setMSXRateUnitsSEC, setMSXRateUnitsHR,
setMSXRateUnitsDAY.
- setMSXRateUnitsSEC()[source]
Sets the rate units to seconds.
The default units are hours (HR)
Example: d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXRateUnits() d.setMSXRateUnitsSEC() d.getMSXRateUnits()
- See also setMSXRateUnitsMIN, setMSXRateUnitsHR,
setMSXRateUnitsDAY.
- setMSXSolverEUL()[source]
Sets the numerical integration method to solve the reaction system to standard Euler integrator (EUL).
The default solver is EUL.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXSolver() d.setMSXSolverEUL() d.getMSXSolver()
See also setMSXSolverRK5, setMSXSolverROS2.
- setMSXSolverRK5()[source]
- Sets the numerical integration method to solve the reaction
system to Runge-Kutta 5th order integrator (RK5).
The default solver is EUL.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXSolver() d.setMSXSolverRK5() d.getMSXSolver()
% See also setMSXSolverEUL, setMSXSolverROS2.
- setMSXSolverROS2()[source]
Sets the numerical integration method to solve the reaction system to 2nd order Rosenbrock integrator (ROS2).
The default solver is EUL.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXSolver() d.setMSXSolverROS2() d.getMSXSolver()
See also setMSXSolverEUL, setMSXSolverRK5.
- setMSXTimeStep(value)[source]
Sets the time step.
The default timestep is 300 seconds (5 minutes).
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.getMSXTimeStep() d.setMSXTimeStep(3600) d.getMSXTimeStep()
See also getMSXTimeStep.
- setMSXPatternValue(index, patternTimeStep, patternFactor)[source]
Sets the pattern factor for an index for a specific time step.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.addMSXPattern(‘P1’, [2.0 2.0 2.0 2.0]) d.getMSXPatternValue(1,1) d.setMSXPatternValue(1,1,3.0) Sets the first timestep of the first pattern to 3.0. d.getMSXPatternValue(1,1)
See also getMSXPatternValue, getMSXPattern, addMSXPattern.
- setMSXPattern(index, patternVector)[source]
Sets the multiplier at a specific time period for a given pattern.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.addMSXPattern(‘Pl’, [1.0 2.0 1.5 1.0]) d.getMSXPattern() d.setMSXPattern(1, [1.0 0.0 3.0]) d.getMSXPattern()
See also getMSXPattern, addMSXPattern.
- setMSXParametersTanksValue(NodeTankIndex, paramOrValues, value=None)[source]
Assigns a value to one or multiple reaction parameters for a given tank within the pipe network.
- Example 1:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) x=d.getMSXParametersTanksValue() print(x[35]) d.setMSXParametersTanksValue(36,[5,6]) x=d.getMSXParametersTanksValue() print(x[35])
- Example 2:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) x = d.getMSXParametersTanksValue() print(x[35]) d.setMSXParametersTanksValue(36, 2,20) x = d.getMSXParametersTanksValue() print(x[35])
- See also getMSXParametersTanksValue, setMSXParametersPipesValue,
getMSXParametersPipesValue, getMSXParametersCount, getMSXParametersIndex.
- setMSXParametersPipesValue(pipeIndex, paramOrValues, value=None)[source]
Assigns a value to one or multiple reaction parameters for a given pipe within the pipe network. Example 1:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); x = d.getMSXParametersPipesValue() print(x[0]) d.setMSXParametersPipesValue(1, [1.5, 2]) x = d.getMSXParametersPipesValue() print(x[0])
- Example 2:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); x = d.getMSXParametersPipesValue() print(x[0]) d.setMSXParametersPipesValue(1, 2,5) x = d.getMSXParametersPipesValue() print(x[0])
- See also getMSXParametersPipesValue, setMSXParametersTanksValue,
getMSXParametersTanksValue, getMSXParametersCount, getMSXParametersIndex.
- setMSXConstantsValue(value)[source]
Sets the values of constants.
- Example:
d = epanet(‘net3-bio.inp’) d.loadMSXFile(‘net3-bio.msx’) d.getMSXConstantsValue() d.setMSXConstantsValue([1, 2, 3]) Set the values of the first three constants. d.getMSXConstantsValue()
- See also getMSXConstantsCount, getMSXConstantsIndex,
getMSXConstantsNameID.
- addMSXPattern(*args)[source]
Adds new time pattern
Example: d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’); print(d.getMSXPatternsNameID()) mult = [0.5, 0.8, 1.2, 1.0, 0.7, 0.3] d.addMSXPattern(‘Pattern1’, mult) print(d.getMSXPattern()) print(d.getMSXPatternsNameID())
See also getMSXPattern, setMSXPattern.
- getMSXComputedQualitySpecie(species=None, nodes=1, links=1)[source]
Returns the node/link quality for specific specie.
- Example :
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) MSX_comp = d.getMSXComputedQualitySpecie([‘CL2’]) MSX_comp.NodeQuality row: time, col: node index MSX_comp.LinkQuality row: time, col: link index MSX_comp.Time
See also getMSXComputedQualityNode, getMSXComputedQualityLink.
- getMSXComputedNodeQualitySpecie(node_indices, species_id)[source]
Returns the node quality for specific specie.
- Example :
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) node_indices = [1,2,3] MSX_comp = d.getMSXComputedNodeQualitySpecie(node_indices, ‘CL2’) MSX_comp.NodeQuality row: time, col: node index MSX_comp.Time
- Example wtih 2 species:
msx=d.getMSXComputedNodeQualitySpecie(x,[‘CL2’,”H”]) print(msx[“CL2”].NodeQuality)
See also getMSXComputedQualitySpecie, getMSXComputedLinkQualitySpecie.
- getMSXComputedLinkQualitySpecie(node_indices, species_id)[source]
Returns the link quality for specific specie.
- Example :
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) node_indices = [1,2,3,4] MSX_comp = d.getMSXComputedLinkQualitySpecie(node_indices, ‘CL2’) MSX_comp.LinkQuality row: time, col: node index MSX_comp.Time
- Example wtih 2 species:
msx=d.getMSXComputedLinkQualitySpecie(x,[‘CL2’,”H”]) print(msx.LinkQuality)
See also getMSXComputedQualitySpecie, getMSXComputedNodeQualitySpecie.
- getMSXComputedQualityNode(*args)[source]
Returns the computed quality for nodes. Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’)
MSX_comp = d.getMSXComputedQualityNode() x = MSX_comp.Quality y = MSX_comp.Time
- getMSXComputedQualityLink(*args)[source]
Returns the computed quality for links. Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’)
MSX_comp = d.getMSXComputedQualityLink() x = MSX_comp.Quality y = MSX_comp.Time
- setMSXLinkInitqualValue(value)[source]
” Sets all links initial quality value.
- Example:
linkIndex=0 speciesIndex=0 values = [[0] * linkIndex for _ in range(speciesIndex)] values=d.getMSXLinkInitqualValue() values[linkIndex][speciesIndex]=1500 d.setMSXLinkInitqualValue(values) x=d.getMSXLinkInitqualValue()
See also getMSXLinkInitqualValue, setMSXNodeInitqualValue.
- setMSXSources(nodeID, speciesID, sourcetype, concentration, patID)[source]
Sets the attributes of an external source of a particular chemical species to a specific node of the pipe network.
- Example:
d = epanet(‘net2-cl2.inp’); d.loadMSXFile(‘net2-cl2.msx’) srcs = d.getMSXSources() d.addMSXPattern(‘PatAsIII’,[2, .3, .4, 6, 5, 2, 4]) d.setMSXSources(d.NodeNameID{2}, d.MSXSpeciesNameID{1}, Setpoint’, 0.5, ‘PatAsIII’) % Sets the second node as setpoint. d.setMSXSources(d.getNodeNameID(2), d.getMSXSpeciesNameID([1]),’FLOWPACED’, 0.5, ‘PatAsIII’) srcs = d.getMSXSources()
- See also getMSXSources, getMSXSourceNodeNameID, getMSXSourceType
getMSXSourceLevel, getMSXSourcePatternIndex.
- setMSXNodeInitqualValue(value)[source]
Sets all nodes initial quality value.
- Example:
linkIndex=0 speciesIndex=0 values = [[0] * linkIndex for _ in range(speciesIndex)] values=d.getMSXNodeInitqualValue() values[linkIndex][speciesIndex]=1500 d.setMSXNodeInitqualValue(values) x=d.getMSXNodeInitqualValue()
See also getMSXNodeInitqualValue, setMSXLinkInitqualValue.
- writeMSXFile(msx)[source]
- Write a new MSX file
- Example for wirteMSXFile:
msx = d.initializeMSXWrite()
msx.FILENAME=”cl34.msx” msx.TITLE = “CL2 Full msx” msx.AREA_UNITS = ‘FT2’ msx.RATE_UNITS = ‘DAY’ msx.SOLVER = ‘EUL’ msx.COUPLING = ‘NONE’ msx.COMPILER = ‘NONE’ msx.TIMESTEP = 300 msx.ATOL = 0.001 msx.RTOL = 0.001
msx.SPECIES={‘BULK CL2 MG 0.01 0.001’} msx.COEFFICIENTS = {‘PARAMETER Kb 0.3’, ‘PARAMETER Kw 1’} msx.TERMS = {‘Kf 1.5826e-4 * RE^0.88 / D’} msx.PIPES = {‘RATE CL2 -Kb*CL2-(4/D)*Kw*Kf/(Kw+Kf)*CL2’} msx.TANKS = {‘RATE CL2 -Kb*CL2’} msx.SOURCES = {‘CONC 1 CL2 0.8 ‘} msx.GLOBAL = {‘Global CL2 0.5’} msx.QUALITY = {‘NODE 26 CL2 0.1’} msx.PARAMETERS = {‘’} msx.PATERNS = {‘’} d.writeMSXFile(msx) d.unloadMSX() d.loadMSXFile(msx.FILENAME) d.unloadMSX() d.unload()
- setMSXPatternMatrix(pattern_matrix)[source]
Sets the multiplier factors for all patterns.
- Example:
inpname = os.path.join(os.getcwd(), ‘epyt’, ‘networks’,’msx-examples’, ‘net2-cl2.inp’) msxname = os.path.join(os.getcwd(), ‘epyt’, ‘networks’,’msx-examples’, ‘net2-cl2.msx’) d = epanet(inpname) d.loadMSXFile(msxname) d.addMSXPattern(‘1’,[]) d.setMSXPatternMatrix([.1,.2,.5,.2,1,.9]) print(d.getMSXPattern())
- getAllAttributes(obj)[source]
Get all attributes of a given Python object
- Example:
filename = ‘Net1.inp’ #you can also try ‘net2-cl2.inp’, ‘Net3.inp’, etc. d = epanet(filename) Q = d.getComputedQualityTimeSeries() attr = d.getAllAttributes(Q) print(attr) #Will print Time, LinkQuality , NodeQuality and MassFlowRate
- getMethods()[source]
Returns all methods of epanet
- Example:
filename = ‘L-TOWN.inp’ d=epanet(filename) methods = G.getmethods() print(methods)
- plotMSXSpeciesNodeConcentration(*args)[source]
Plots concentration of species for nodes over time.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.plotMSXSpeciesNodeConcentration([1],[1]) # Plots first node’s concentration of the first specie over time.
- Example 2:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) x = [1,2,3,4,5] d.plotMSXSpeciesNodeConcentration(x,1) # Plots concentration of nodes 1 to 5 for the first specie over time.
See also plotMSXSpeciesLinkConcentration.
- plotMSXSpeciesLinkConcentration(*args)[source]
% Plots concentration of species for links over time.
- Example:
d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) d.plotMSXSpeciesLinkConcentration(5, 2) Plots node index 5 concentration of the second specie over time. d.plotMSXSpeciesLinkConcentration(1, 1) Plots first node’s concentration of the first specie over time.
Example 2: d = epanet(‘net2-cl2.inp’) d.loadMSXFile(‘net2-cl2.msx’) x = [1,2,3,4,5] d.plotMSXSpeciesLinkConcentration(x,1) # Plots concentration of links 1 to 5 for the first specie over time.
% See also plotMSXSpeciesNodeConcentration.
- setCurveType(index, type)[source]
- Purpose:
Sets the type of a specified curve in the EPANET model.
- Parameters:
index (int): The index of the curve to modify. (curve)type (int): The desired type of the curve, based on the following categories:
0: Volume
1: Pump
2: Efficiency
3: Headloss
4: General
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveType(1, 0) curve_type = d.getCurveType(1) if errcode == 0:
print(“Curve type set successfully.”)
- else:
print(f”Error setting curve type. Error code: {d.getError(errcode)}”)
- setCurveTypeVolume(index)[source]
- Purpose:
Sets the type of a curve to Volume in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypeVolume(1) curve_type = d.getCurveType(1)
- setCurveTypePump(index)[source]
- Purpose:
Sets the type of a curve to Pump in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypePump(1) curve_type = d.getCurveType(1)
- setCurveTypeEfficiency(index)[source]
- Purpose:
Sets the type of curve to Efficiency in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypeEfficiency(1) curve_type = d.getCurveType(1)
- setCurveTypeHeadloss(index)[source]
- Purpose:
Sets the type of a curve to Headloss in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypeHeadloss(1) curve_type = d.getCurveType(1)
- setCurveTypeGeneral(index)[source]
- Purpose:
Sets the type of a curve to general in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypeGeneral(1) curve_type = d.getCurveType(1)
- setCurveTypeValveCurve(index)[source]
- Purpose:
Sets the type of a curve to Valve in the EPANET model.
- Parameters:
index (int): The index of the curve to modify.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inp_filename = “Net1.inp”
d = epanet(inp_filename) errcode = d.setCurveTypeValveCurve(1) curve_type = d.getCurveType(1)
- setVertex(index, vertex, x, y)[source]
- Purpose:
Sets the coordinates of a vertex point in a link within the EPANET model.
- Parameters:
index (int): The index of the link for which the vertex coordinates are to be set. vertex (int): The index of the specific vertex point within the link. x (float): The X-coordinate of the vertex point. y (float): The Y-coordinate of the vertex point.
- Returns:
int: An error code indicating success or failure of the operation.
- Example Usage:
inpname = “Net1.inp”
# Initialize EPANET model with the input file d = epanet(inpname)
linkID = ‘10’ x = [ 22,24, 28] y = [ 30,68, 69] d.setLinkVertices(linkID, x, y) x = d.getLinkVertices() d.setVertex(1,1,1,1) x = d.getLinkVertices() print(x)
- getControlState(index=None)[source]
- Purpose:
Retrieves the enabled state of a specified control in the EPANET model.
- Parameters:
index (int): The index of the control to check, starting from 1.
- Returns:
- int: The state of the control:
0: Control is disabled (False)
1: Control is enabled (True)
- Example Usage:
inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve and print the state of the control at index 1 x = d.getControlState(1) print(f”Control state: {x}”)
- Example Usage with all items:
inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve and print the state of the control at index 1 x = d.getControlState() print(f”Control state: {x}”)
- setControlEnabled(index, enabled)[source]
- Purpose:
Sets the control state to either enable or disable in the EPANET model.
- Parameters:
index (int): The index of the control to be modified, starting from 1.
- Example Usage:
inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve the current state of the control at index 1 x = d.getControlState(1) print(f”Control state before: {x}”)
# Disable the control at index 1 d.setControlEnabled(1, 0)
# Check the state of the control again x = d.getControlState(1) print(f”Control state after: {x}”)
- getRuleEnabled(index=None)[source]
- Purpose:
Retrieves the enabled state of a specific rule in the EPANET model.
- Parameters:
index (int): The index of the rule to check, starting from 1.
- Returns:
- int: The state of the rule:
0: Rule is disabled (False)
1: Rule is enabled (True)
- Example Usage:
inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve and print the current state of the rule at index 1 x = d.getRuleEnabled(1) print(f”Rule state: {x}”)
Example Usage with all items: inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve and print the current state of the rule at index 1 x = d.getRuleEnabled() print(f”Rule state: {x}”)
- setRuleEnabled(index, enabled)[source]
- Purpose:
Enables a specific rule in the EPANET model.
- Parameters:
index (int): The index of the rule to be modified, starting from 1.
- Example Usage:
inpfile = “Net1.inp” d = epanet(inpfile)
# Retrieve and print the current state of the rule at index 1 x = d.getRuleEnabled(1) print(f”Rule state before: {x}”)
# Enable the rule at index 1 d.setRuleEnabled(1,1)
# Retrieve and print the state of the rule again to confirm the change x = d.getRuleEnabled(1) print(f”Rule state after: {x}”)
- loadPatternFile(filename, id)[source]
/—————————————————————- * Input: filename = name of the file containing pattern data ** id = ID for the new pattern ** Purpose: loads time patterns from a file into a project under a specific pattern ID **—————————————————————-
- getLinkValues(property)[source]
- Purpose:
Retrieves property values for all links within the EPANET model during a hydraulic analysis.
- Example Usage:
from epyt import epanet
inpfile = “Net1.inp” d = epanet(inpfile)
d.openHydraulicAnalysis() d.initializeHydraulicAnalysis()
tstep = 1 P, T_H, D, H, F, S = [], [], [], [], [], []
- while tstep > 0:
t = d.runHydraulicAnalysis() S.append(d.getLinkValues(d.ToolkitConstants.EN_FLOW)) F.append(d.getLinkFlows()) T_H.append(t)
print(F) print(S) print(T_H)
tstep = d.nextHydraulicAnalysisStep()
d.closeHydraulicAnalysis()
- getLinkValveCurveGPV(*argv)[source]
Retrieves the valve curve for a specified pressure control valve (GPV).
- Returns:
int: 1 if the link is a GPV, 0 if it is not.
- Example for one Valve:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValveGPV(linkid, condition) d.setLinkValveCurveGPV(index,1) x = d.getLinkValveCurveGPV(index) print(x)
- Example for all Valves:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValveGPV(linkid, condition) d.setLinkValveCurveGPV(index,1) x = d.getLinkValveCurveGPV() print(x)
- getLinkValveCurvePCV(*argv)[source]
Retrieves the valve curve for a specified pressure control valve (PCV).
- Returns:
int: 1 if the link is a PCV, 0 if it is not.
- Example for one Valve:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValvePCV(linkid, condition) d.setLinkValveCurvePCV(index,1) x = d.getLinkValveCurvePCV(index) print(x)
- Example for all Valves:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValvePCV(linkid, condition) d.setLinkValveCurvePCV(index,1) x = d.getLinkValveCurvePCV() print(x)
- setLinkValveCurveGPV(index, value)[source]
Sets the valve curve for a specified pressure control valve (GPV).
- Parameters:
index (int): The index of the GPV to be set. (starting from 1) value (float): The value to set for the valve curve. (1 for valve to be GPV 0 for not)
- Example:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValveGPV(linkid, condition)
- setLinkValveCurvePCV(index, value)[source]
Sets the valve curve for a specified pressure control valve (PCV).
- Parameters:
index (int): The index of the PCV to be set. (starting from 1) value (float): The value to set for the valve curve. (1 for valve to be GPV 0 for not)
- Example:
inpfile = “Net1.inp” d = epanet(inpfile)
linkid = d.getLinkPipeNameID(1) condition = 1 index = d.setLinkTypeValvePCV(linkid, condition)
- getOptionsDemandPattern()[source]
Retrieves the default Demand pattern.
- Example:
inpfile = “Richmond_standard.inp” d = epanet(inpfile) d.printv(d.getOptionsDemandPattern())
- setOptionsDemandPattern(value)[source]
Retrieves the default Demand pattern.
- Example:
inpfile = “Richmond_standard.inp” d = epanet(inpfile) d.setOptionsDemandPattern(3) d.printv(d.getOptionsDemandPattern())
- getOptionsEmitterBackFlow()[source]
Retrieves the current setting for allowing reverse flow through emitters.
- Example:
inpfile = “Richmond_standard.inp” d = epanet(inpfile) d.printv(d.getOptionsEmitBackFlow())
- Returns:
int: 1 if reverse flow is allowed (default), 0 if not.
- setOptionsEmitterBackFlowAllowed()[source]
Sets the option to allow reverse flow through emitters.
- Example:
inpfile = “Richmond_standard.inp” d = epanet(inpfile) d.setOptionsEmitBackFlowAllowed() d.printv(d.getOptionsEmitBackFlow())
- setOptionsEmitterBackFlowDisallowed()[source]
Sets the option prevent reverse flow through emitters.
- Example:
inpfile = “Richmond_standard.inp” d = epanet(inpfile) d.setOptionsEmitBackFlow(0) d.printv(d.getOptionsEmitBackFlow())
- getLinkLeakArea(*argv)[source]
Function to retrieve the leak area for a specified link (pipe).
Returns: float: The current leak area value for the specified link.
- Example 1 Retrieving all Links:
inpfile = “Net1.inp” d = epanet(inpfile) d.setLinkLeakArea(2,10.5) x = d.getLinkLeakArea() print(x)
- Example 2 Retrieving one link:
inpfile = “Net1.inp” d = epanet(inpfile) d.setLinkLeakArea(2,10.5) x = d.getLinkLeakArea(2) print(x)
See also: setLinkLeakArea
- getLinkExpansionProperties(*argv)[source]
Function to retrieve the expansion properties for a specified link (pipe).
Returns: float: The current expansion property value for the specified link.
- Example 1 Retrieving all link expansion properties:
inpfile = “Net1.inp” d = epanet(inpfile) d.setLinkExpansionProperties(5,2) x = d.getLinkExpansionProperties() print(x)
- Example 2 Retrieving one link expansion property:
inpfile = “Net1.inp” d = epanet(inpfile) d.setLinkExpansionProperties(5,2) x = d.getLinkExpansionProperties(5) print(x)
See also : setLinkExpansionProperties()
- setLinkLeakArea(index, value)[source]
Function to set the leak area for a specified link (pipe).
- input:
index(int) : The index of the link(pipe) for which to set the leak area (starting from 1) value (float) : the value to assign as the leak area to the specified link
- Example:
inpfile = “Net1.inp” d = epanet(inpfile)
d.setLinkLeakArea(2,10.5) x = d.getLinkLeakArea() print(x)
See also: getLinkLeakArea
- setLinkExpansionProperties(index, value)[source]
Function to set the expansion properties for a specified link (pipe).
Input: index (int): The index of the link (pipe) for which to set the expansion properties. (starting from 1) value (float): The value to assign as the expansion property for the specified link.
- Example:
inpfile = “Net1.inp” d = epanet(inpfile)
d.setLinkExpansionProperties(5,2) x = d.getLinkExpansionProperties() print(x)
- See also:
getLinkExpansionProperties
- getLinkLeakageRate(*argv)[source]
Retrieves the leakage rate of a specific pipe (link) at a given point in time.
- Returns:
float: The leakage rate of the specified pipe at the requested time point
- getConsumerDemandRequested(index)[source]
Retrieves the requested consumer demand for a specific node.
- Args:
index (int): The index of the node for which the consumer demand is to be retrieved.
- Returns:
float: The full demand requested by the consumer at the specified node
- getConsumerDemandDelivered(index)[source]
Retrieves the delivered consumer demand for a specific node.
- Args:
index (int): The index of the node for which the delivered consumer demand is to be retrieved.
- Returns:
float: The amount of demand delivered to the consumer at the specified node
- getNodeLeakageFlow(index)[source]
Retrieves the leakage flow for a specific node.
- Args:
index (int): The index of the node for which the leakage flow is to be retrieved.
- Returns:
float: The amount of leakage flow at the specified node
- getTimetoNextEvent()[source]
Determines the type of event that will cause the end of the current time step, along with the duration until the event occurs and its index.
- Returns:
x (str): The type of the next event (e.g., REPORT, HYD, WQ, TANK, CONTROL). y (float): The duration of time until the next event occurs. z (int): The index of the event.
- Event Types:
0: REPORT - A report generation event. 1: HYD - A hydraulic event. 2: WQ - A water quality event. 3: TANK - A tank level event. 4: CONTROL - A control rule event.
- getLinkInControl(*args)[source]
Function to determine wether a link apperas in any simple or rule based control
Return: (int) 1 if the link has control, 0 otherwise
- Example 1 Retrieving one Link:
inpfile = “Net1.inp”
d = epanet(inpfile) linkcontrolid = d.getControls(1).LinkID linkcontrolindex = d.getLinkIndex(linkcontrolid) x = d.getLinkInControl(linkcontrolindex) print(x) # it will return 1
- Example 2 Retrieving all Links:
inpfile = “Net1.inp”
d = epanet(inpfile) x = d.getLinkInControl() print(x)
- Example 3 Retrieving more than one link:
inpfile = “Net1.inp”
d = epanet(inpfile) x = d.getLinkInControl(1,2,3,13) #Link with index 13 is the one with control in Net1 print(x)
- Example 4 Retrieving more than one link using list:
inpfile = “Net1.inp”
d = epanet(inpfile) x = d.getLinkInControl([1,2,3,13]) print(x)
- getNodeInControl(*args)[source]
Function to determine wether a node apperas in any simple or rule based control
Return: (int) 1 if the Node has control, 0 otherwise
- Example 1 Retrieving one Node:
inpfile = “Net1.inp”
d = epanet(inpfile) nodecontrolid = d.getControls(1).NodeID nodecontrolindex = d.getNodeIndex(nodecontrolid) x = d.getNodeInControl(nodecontrolindex) print(x) # it will return 1
- Example 2 Retrieving all Nodes:
inpfile = “Net1.inp” d = epanet(inpfile)
x = d.getNodeInControl() print(x)
- Example 3 Retrieving more than one Node:
inpfile = “Net1.inp” d = epanet(inpfile)
x = d.getNodeInControl(1, 2, 3, 9) #Node with index 9 is the one with control in Net1 print(x)
- Example 4 Retrieving more than one link using list:
inpfile = “Net1.inp” d = epanet(inpfile)
x = d.getNodeInControl([1, 2, 3, 9]) print(x)
- exportMSXts(results, output_file='computedtoexcel.xlsx', selected_nodes=None, selected_species=None, header=True)[source]
Exports multi-species water-quality time-series results (from an EPANET-MSX
simulation) to an Excel workbook—one sheet per species.
Parameters:
- resultsobj
A results object returned by getMSXComputedQualityNode. It must expose
Time(1-D array-like) andQuality- output_filestr, default
"computedtoexcel.xlsx" Name (or path) for the Excel file to create. “.xlsx” is appended automatically when omitted.
- selected_nodeslist[str | int] | None, default
None Node IDs or zero-based node indices to include. •
None→ export all nodes. • Strings → treated as node IDs. • Integers → treated as node indices.- selected_specieslist[str | int] | None, default
None Species names or zero-based species indices to include. Same ID / index rules as selected_nodes.
- headerbool, default
True Write column headers (“NODE INDEX”, “NODE ID”, time steps …). If
False, headers are suppressed and the first data row is removed—useful for appending to an existing sheet.- Simple Example with all nodes and species:
G = epanet(“net2-cl2.inp”) G.loadMSXFile(“net2-cl2.msx”) MSX_comp = G.getMSXComputedQualityNode() G.exportMSXts(MSX_comp, “net2”) G.exportMSXstatistics(“net2”,”summarynet2”)
- Advanced Examples:
G = epanet(“net2-cl2.inp”) G.loadMSXFile(“net2-cl2.msx”)
# Run MSX simulation and grab node-quality results msx_results = G.getMSXComputedQualityNode()
# 1) Export every species for every node (default behaviour) G.exportMSXts(msx_results, “net2_full.xlsx”)
# 2) Export only chlorine for two specific nodes, keep headers G.exportMSXts(
MSX_comp, output_file=”chlorine_subset.xlsx”, selected_nodes=[“10”, “15”], #select nodes by their id selected_species=[“CL2”]
)
- G.exportMSXts(
MSX_comp, output_file=”chlorine_subset1.xlsx”, selected_nodes=[9, 14], #select node by their index selected_species=[“CL2”]
)
# 3) Export species index 0 for nodes 0-4, omit headers G.exportMSXts(
msx_results, “first_species_nodes0to4.xlsx”, selected_nodes=list(range(5)), selected_species=[0], #select specie by its index header=False
- exportMSXstatistics(input_path, output_path='summary_output.xlsx', nodeids=True, nodeindex=True)[source]
Summarizes min, max, and average values for each node in an Excel file with a specific structure.
- Parameters:
input_path (str): Path to the input Excel file. output_path (str): Path to save the output summary Excel file. nodeids (bool): Include node IDs (from column 1) in the summary. nodeindex (bool): Include node index (from column 0) in the summary.
- Simple Example with all nodes and species:
G = epanet(“net2-cl2.inp”) G.loadMSXFile(“net2-cl2.msx”) MSX_comp = G.getMSXComputedQualityNode() G.exportMSXts(MSX_comp, “net2”) G.exportMSXstatistics(“net2”,”summarynet2”)
# Example usage: exportMSXstatistics(“outexcel3.xlsx”,”summary_output1.xlsx”, nodeids=True, nodeindex=False) # Only node IDs exportMSXstatistics(“outexcel3.xlsx”, “summary_output2.xlsx”,nodeids=False, nodeindex=True) # Only node indices exportMSXstatistics(“outexcel3.xlsx”,”summary_output3.xlsx”, nodeids=True, nodeindex=True) # Both