epyt.src package
Submodules
epyt.src.epanetapi module
- class epyt.src.epanetapi.epanetapi(version=2.3, ph=False, loadlib=True, customlib=None)[source]
Bases:
objectEPANET Toolkit functions - API
- EN_MAXID = 32
- __init__(version=2.3, ph=False, loadlib=True, customlib=None)[source]
Load the EPANET library.
- Parameters:
version EPANET version to use (currently 2.2)
- errcode
- inpfile
- rptfile
- binfile
- solve
- LibEPANET
- LibEPANETpath
- property lib
- ENepanet(inpfile='', rptfile='', binfile='')[source]
Runs a complete EPANET simulation Parameters: inpfile Input file to use rptfile Output file to report to binfile Results file to generate
- ENaddcontrol(conttype, lindex, setting, nindex, level)[source]
Adds a new simple control to a project.
ENaddcontrol(ctype, lindex, setting, nindex, level)
Parameters: conttype the type of control to add (see ControlTypes). lindex the index of a link to control (starting from 1). setting control setting applied to the link. nindex 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.
Returns: cindex index of the new control.
- ENaddcurve(cid)[source]
Adds a new data curve to a project.
ENaddcurve(cid)
Parameters: cid The ID name of the curve to be added.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___curves.html
- ENadddemand(nodeIndex, baseDemand, demandPattern, demandName)[source]
Appends a new demand to a junction node demands list.
ENadddemand(nodeIndex, baseDemand, demandPattern, demandName)
Parameters: nodeIndex the index of a node (starting from 1). baseDemand the demand’s base value. demandPattern the name of a time pattern used by the demand. demandName the name of the demand’s category.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENaddlink(linkid, linktype, fromnode, tonode)[source]
Adds a new link to a project.
ENaddlink(linkid, linktype, fromnode, tonode)
Parameters: linkid The ID name of the link to be added. linktype The type of link being added (see EN_LinkType, self.LinkType). fromnode The ID name of the link’s starting node. tonode The ID name of the link’s ending node.
Returns: index the index of the newly added link. OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENaddnode(nodeid, nodetype)[source]
Adds a new node to a project.
ENaddnode(nodeid, nodetype)
Parameters: nodeid the ID name of the node to be added. nodetype the type of node being added (see EN_NodeType).
Returns: index the index of the newly added node. See also EN_NodeProperty, NodeType
- ENaddpattern(patid)[source]
Adds a new time pattern to a project.
ENaddpattern(patid)
Parameters: patid the ID name of the pattern to add.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___patterns.html
- ENaddrule(rule)[source]
Adds a new rule-based control to a project.
ENaddrule(rule)
Parameters: rule text of the rule following the format used in an EPANET input file.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___rules.html
- ENcloseH()[source]
Closes the hydraulic solver freeing all of its allocated memory.
ENcloseH()
See also ENinitH, ENrunH, ENnextH
- ENcloseQ()[source]
Closes the water quality solver, freeing all of its allocated memory.
ENcloseQ()
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___quality.html
- ENcopyreport(filename)[source]
Copies the current contents of a project’s report file to another file.
ENcopyreport(filename)
Parameters: filename the full path name of the destination file
- ENcreateproject()[source]
Copies the current contents of a project’s report file to another file. * ENcreateproject must be called before any other API functions are used. * ENcreateproject()
Parameters: ph an EPANET project handle that is passed into all other API functions.
- ENdeletecontrol(index)[source]
Deletes an existing simple control.
ENdeletecontrol(index)
Parameters: index the index of the control to delete (starting from 1).
- ENdeletecurve(indexCurve)[source]
Deletes a data curve from a project.
ENdeletecurve(indexCurve)
Parameters: indexCurve The ID name of the curve to be added.
- ENdeletedemand(nodeIndex, demandIndex)[source]
Deletes a demand from a junction node.
ENdeletedemand(nodeIndex, demandInde)
Parameters: nodeIndex the index of a node (starting from 1). demandIndex the position of the demand in the node’s demands list (starting from 1).
- ENdeletelink(indexLink, condition)[source]
Deletes a link from the project.
ENdeletelink(indexLink, condition)
Parameters: indexLink the index of the link to be deleted. condition The action taken if any control contains the link.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENdeletenode(indexNode, condition)[source]
Deletes a node from a project.
ENdeletenode(indexNode, condition)
Parameters: indexNode the index of the node to be deleted. condition the action taken if any control contains the node and its links.
See also EN_NodeProperty, NodeType OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENdeletepattern(indexPat)[source]
Deletes a time pattern from a project.
ENdeletepattern(indexPat)
Parameters: indexPat the time pattern’s index (starting from 1).
- ENdeleteproject()[source]
Deletes an EPANET project. * EN_deleteproject should be called after all network analysis has been completed. * ENdeleteproject()
Parameters: ph an EPANET project handle which is returned as NULL.
- ENdeleterule(index)[source]
Deletes an existing rule-based control.
ENdeleterule(index)
Parameters: index the index of the rule to be deleted (starting from 1).
- ENgetaveragepatternvalue(index)[source]
Retrieves the average of all pattern factors in a time pattern.
ENgetaveragepatternvalue(index)
Parameters: index a time pattern index (starting from 1).
Returns: value The average of all of the time pattern’s factors.
- ENgetbasedemand(index, numdemands)[source]
Gets the base demand for one of a node’s demand categories. EPANET 20100
ENgetbasedemand(index, numdemands)
Parameters: index a node’s index (starting from 1). numdemands the index of a demand category for the node (starting from 1).
Returns: value the category’s base demand.
- ENgetcomment(object_, index)[source]
Retrieves the comment of a specific index of a type object.
ENgetcomment(object, index, comment)
Parameters: object_ a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE)
e.g, self.ToolkitConstants.EN_NODE
index object’s index (starting from 1).
Returns: out_comment the comment string assigned to the object.
- ENgetcontrol(cindex)[source]
Retrieves the properties of a simple control.
ENgetcontrol(cindex)
Parameters: cindex the control’s index (starting from 1).
Returns: ctype the type of control (see ControlTypes). lindex the index of the link being controlled. setting the control setting applied to the link. nindex the index of the node used to trigger the control (0 for EN_TIMER and EN_TIMEOFDAY controls). level the action level (tank level, junction pressure, or time in seconds) that triggers the control.
- ENgetcoord(index)[source]
Gets the (x,y) coordinates of a node.
ENgetcoord(index)
Parameters: index a node index (starting from 1).
Returns: x the node’s X-coordinate value. y the node’s Y-coordinate value.
- ENgetcount(countcode)[source]
Retrieves the number of objects of a given type in a project.
ENgetcount(countcode)
Parameters: countcode number of objects of the specified type
Returns: count number of objects of the specified type
- ENgetcurve(index)[source]
Retrieves all of a curve’s data.
ENgetcurve(index)
Parameters: index a curve’s index (starting from 1).
out_id the curve’s ID name nPoints the number of data points on the curve. xValues the curve’s x-values. yValues the curve’s y-values.
See also ENgetcurvevalue
- ENgetcurveid(index)[source]
Retrieves the ID name of a curve given its index.
ENgetcurveid(index)
Parameters: index a curve’s index (starting from 1).
Returns: Id the curve’s ID name
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___curves.html
- ENgetcurveindex(Id)[source]
Retrieves the index of a curve given its ID name.
ENgetcurveindex(Id)
Parameters: Id the ID name of a curve.
Returns: index The curve’s index (starting from 1).
- ENgetcurvelen(index)[source]
Retrieves the number of points in a curve.
ENgetcurvelen(index)
Parameters: index a curve’s index (starting from 1).
Returns: len The number of data points assigned to the curve.
- ENgetcurvetype(index)[source]
Retrieves a curve’s type.
ENgetcurvetype(index)
Parameters: index a curve’s index (starting from 1).
Returns: type_ The curve’s type (see EN_CurveType).
- ENsetcurvetype(index, type)[source]
Allow API clients to set a curve’s type (e.g., EN_PUMP_CURVE, EN_VOLUME_CURVE, etc.). Input: index = data curve index
type = type of data curve (see EN_CurveType) Returns: error code Purpose: sets the type assigned to a data curve
- ENsetvertex(index, vertex, x, y)[source]
- Input: index = link index
vertex = index of a link vertex point x = vertex point’s X-coordinate y = vertex point’s Y-coordinate
Returns: error code Purpose: sets the coordinates of a vertex point in a link
- ENtimetonextevent()[source]
get the time to next event, and give a reason for the time step truncation
- ENopenX(inpFile, rptFile, binFile)[source]
- Input: inpFile = name of input file
rptFile = name of report file binFile = name of binary output file
Output: none Returns: error code Purpose: reads an EPANET input file with errors allowed.
- ENgetlinkvalues(property)[source]
Input: property = link property code (see EN_LinkProperty) Output: values = array of link property values Returns: error code Purpose: retrieves property values for all links
- ENloadpatternfile(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
- ENgetcurvevalue(index, period)[source]
Retrieves the value of a single data point for a curve.
ENgetcurvevalue(index, period)
Parameters: index a curve’s index (starting from 1). period the index of a point on the curve (starting from 1).
Returns: x the point’s x-value. y the point’s y-value.
- ENgetdemandindex(nodeindex, demandName)[source]
Retrieves the index of a node’s named demand category.
ENgetdemandindex(nodeindex, demandName)
Parameters: nodeindex the index of a node (starting from 1). demandName the name of a demand category for the node.
Returns: demandIndex the index of the demand being sought.
- ENgetdemandmodel()[source]
Retrieves the type of demand model in use and its parameters.
ENgetdemandmodel()
Returns: Type Type of demand model (see EN_DemandModel). pmin Pressure below which there is no demand. preq Pressure required to deliver full demand. pexp Pressure exponent in demand function.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENgetdemandname(node_index, demand_index)[source]
Retrieves the name of a node’s demand category.
ENgetdemandname(node_index, demand_index)
Parameters: node_index a node’s index (starting from 1). demand_index the index of one of the node’s demand categories (starting from 1).
Returns: demand_name The name of the selected category.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENgetdemandpattern(index, numdemands)[source]
Retrieves the index of a time pattern assigned to one of a node’s demand categories. EPANET 20100 ENgetdemandpattern(index, numdemands)
Parameters: index the node’s index (starting from 1). numdemands the index of a demand category for the node (starting from 1).
Returns: value the index of the category’s time pattern.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENgetelseaction(ruleIndex, actionIndex)[source]
Gets the properties of an ELSE action in a rule-based control.
ENgetelseaction(ruleIndex, actionIndex)
Parameters: ruleIndex the rule’s index (starting from 1). actionIndex the index of the ELSE action to retrieve (starting from 1).
Returns: linkIndex the index of the link sin the action. status the status assigned to the link (see RULESTATUS). setting the value assigned to the link’s setting.
- ENgeterror(errcode=0)[source]
Returns the text of an error message generated by an error code, as warning.
ENgeterror()
- ENgetflowunits()[source]
Retrieves a project’s flow units.
ENgetflowunits()
Returns: flowunitsindex a flow units code.
- ENgetheadcurveindex(pumpindex)[source]
Retrieves the curve assigned to a pump’s head curve.
ENgetheadcurveindex(pumpindex)
Parameters: pumpindex the index of a pump link (starting from 1).
Returns: value the index of the curve assigned to the pump’s head curve.
- ENgetlinkid(index)[source]
Gets the ID name of a link given its index.
ENgetlinkid(index)
Parameters: index a link’s index (starting from 1).
Returns: id The link’s ID name.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENgetlinkindex(Id)[source]
Gets the index of a link given its ID name.
ENgetlinkindex(Id)
Parameters: Id a link’s ID name.
Returns: index the link’s index (starting from 1).
- ENgetlinknodes(index)[source]
Gets the indexes of a link’s start- and end-nodes.
ENgetlinknodes(index)
Parameters: index a link’s index (starting from 1).
Returns: from the index of the link’s start node (starting from 1). to the index of the link’s end node (starting from 1).
- ENgetlinktype(index)[source]
Retrieves a link’s type.
ENgetlinktype(index)
Parameters: index a link’s index (starting from 1).
Returns: typecode the link’s type (see LinkType).
- ENgetlinkvalue(index, paramcode)[source]
Retrieves a property value for a link.
ENgetlinkvalue(index, paramcode)
Parameters: index a link’s index (starting from 1). paramcode the property to retrieve (see EN_LinkProperty).
Returns: value the current value of the property.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENgetnodeid(index)[source]
Gets the ID name of a node given its index
ENgetnodeid(index)
Parameters: index nodes index
Returns: nameID nodes id
- ENgetnodeindex(Id)[source]
Gets the index of a node given its ID name.
ENgetnodeindex(Id)
Parameters: Id a node ID name.
Returns: index the node’s index (starting from 1).
- ENgetnodetype(index)[source]
Retrieves a node’s type given its index.
ENgetnodetype(index)
Parameters: index a node’s index (starting from 1).
Returns: type the node’s type (see NodeType).
- ENgetnodevalue(index, code_p)[source]
Retrieves a property value for a node.
ENgetnodevalue(index, paramcode)
Parameters: index a node’s index. paramcode the property to retrieve (see EN_NodeProperty, self.getToolkitConstants).
Returns: value the current value of the property.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENgetnodevalues(property)[source]
Input: property = node property code (see EN_NodeProperty) Output: values = array of node property values Returns: error code Purpose: retrieves property values for all nodes
- ENgetnumdemands(index)[source]
Retrieves the number of demand categories for a junction node. EPANET 20100
ENgetnumdemands(index)
Parameters: index the index of a node (starting from 1).
Returns: value the number of demand categories assigned to the node.
- ENgetoption(optioncode)[source]
Retrieves the value of an analysis option.
ENgetoption(optioncode)
Parameters: optioncode a type of analysis option (see EN_Option).
Returns: value the current value of the option.
- ENgetpatternid(index)[source]
Retrieves the ID name of a time pattern given its index.
ENgetpatternid(index)
Parameters: index a time pattern index (starting from 1).
Returns: id the time pattern’s ID name.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___patterns.html
- ENgetpatternindex(Id)[source]
Retrieves the index of a time pattern given its ID name.
ENgetpatternindex(id)
Parameters: id the ID name of a time pattern.
Returns: index the time pattern’s index (starting from 1).
- ENgetpatternlen(index)[source]
Retrieves the number of time periods in a time pattern.
ENgetpatternlen(index)
Parameters: index a time pattern index (starting from 1).
Returns: leng the number of time periods in the pattern.
- ENgetpatternvalue(index, period)[source]
Retrieves a time pattern’s factor for a given time period.
ENgetpatternvalue(index, period)
Parameters: index a time pattern index (starting from 1). period a time period in the pattern (starting from 1).
Returns: value the pattern factor for the given time period.
- ENgetpremise(ruleIndex, premiseIndex)[source]
Gets the properties of a premise in a rule-based control.
ENgetpremise(ruleIndex, premiseIndex)
Parameters: ruleIndex the rule’s index (starting from 1). premiseIndex the position of the premise in the rule’s list of premises (starting from 1).
Returns: logop the premise’s logical operator ( IF = 1, AND = 2, OR = 3 ). object_ the status assigned to the link (see RULEOBJECT). objIndex the index of the object (e.g. the index of a tank). variable the object’s variable being compared (see RULEVARIABLE). relop the premise’s comparison operator (see RULEOPERATOR). status the status that the object’s status is compared to (see RULESTATUS). value the value that the object’s variable is compared to.
- ENgetpumptype(index)[source]
Retrieves the type of head curve used by a pump.
ENgetpumptype(pumpindex)
Parameters: pumpindex the index of a pump link (starting from 1).
Returns: value the type of head curve used by the pump (see EN_PumpType).
- ENgetqualinfo()[source]
Gets information about the type of water quality analysis requested.
ENgetqualinfo()
Returns: qualType type of analysis to run (see self.QualityType). chemname name of chemical constituent. chemunits concentration units of the constituent. tracenode index of the node being traced (if applicable).
- ENgetqualtype()[source]
Retrieves the type of water quality analysis to be run.
ENgetqualtype()
Returns: qualcode type of analysis to run (see self.QualityType). tracenode index of the node being traced (if applicable).
- ENgetresultindex(objecttype, index)[source]
Retrieves the order in which a node or link appears in an output file.
ENgetresultindex(objecttype, index)
Parameters: objecttype a type of element (either EN_NODE or EN_LINK). index the element’s current index (starting from 1).
Returns: value the order in which the element’s results were written to file.
- ENgetrule(index)[source]
Retrieves summary information about a rule-based control.
ENgetrule(index):
Parameters: index the rule’s index (starting from 1).
Returns: nPremises number of premises in the rule’s IF section. nThenActions number of actions in the rule’s THEN section. nElseActions number of actions in the rule’s ELSE section. priority the rule’s priority value.
- ENgetruleID(index)[source]
Gets the ID name of a rule-based control given its index.
ENgetruleID(index)
Parameters: index the rule’s index (starting from 1).
Returns: id the rule’s ID name.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___rules.html
- ENgetstatistic(code)[source]
Retrieves a particular simulation statistic. EPANET 20100
ENgetstatistic(code)
Parameters: code the type of statistic to retrieve (see EN_AnalysisStatistic).
Returns: value the value of the statistic.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___reporting.html
- ENgetthenaction(ruleIndex, actionIndex)[source]
Gets the properties of a THEN action in a rule-based control.
ENgetthenaction(ruleIndex, actionIndex)
Parameters: ruleIndex the rule’s index (starting from 1). actionIndex the index of the THEN action to retrieve (starting from 1).
Returns: linkIndex the index of the link in the action (starting from 1). status the status assigned to the link (see RULESTATUS). setting the value assigned to the link’s setting.
- ENgettimeparam(paramcode)[source]
Retrieves the value of a time parameter.
ENgettimeparam(paramcode)
Parameters: paramcode a time parameter code (see EN_TimeParameter).
Returns: timevalue the current value of the time parameter (in seconds).
- ENgettitle()[source]
Retrieves the title lines of the project.
ENgettitle()
Returns: line1 first title line line2 second title line line3 third title line
- ENgetversion()[source]
Retrieves the toolkit API version number.
ENgetversion()
Returns: LibEPANET the version of the OWA-EPANET toolkit.
- ENgetvertex(index, vertex)[source]
Retrieves the coordinate’s of a vertex point assigned to a link.
ENgetvertex(index, vertex)
Parameters: index a link’s index (starting from 1). vertex a vertex point index (starting from 1).
Returns: x the vertex’s X-coordinate value. y the vertex’s Y-coordinate value.
- ENgetvertexcount(index)[source]
Retrieves the number of internal vertex points assigned to a link.
ENgetvertexcount(index)
Parameters: index a link’s index (starting from 1).
Returns: count the number of vertex points that describe the link’s shape.
- ENinit(unitsType, headLossType)[source]
Initializes an EPANET project.
ENinit(unitsType, headLossType)
Parameters: unitsType the choice of flow units (see EN_FlowUnits). headLossType the choice of head loss formula (see EN_HeadLossType).
- ENinitH(flag)[source]
Initializes a network prior to running a hydraulic analysis.
ENinitH(flag)
Parameters: flag a 2-digit initialization flag (see EN_InitHydOption).
See also ENinitH, ENrunH, ENnextH, ENreport, ENsavehydfile OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENinitQ(saveflag)[source]
Initializes a network prior to running a water quality analysis.
ENinitQ(saveflag)
Parameters: saveflag set to EN_SAVE (1) if results are to be saved to the project’s
binary output file, or to EN_NOSAVE (0) if not.
See also ENinitQ, ENrunQ, ENnextQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___quality.html
- ENnextH()[source]
Determines the length of time until the next hydraulic event occurs in an extended period simulation.
ENnextH()
Returns: tstep the time (in seconds) until the next hydraulic event or 0 if at the end of the full simulation duration.
See also ENrunH OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENnextQ()[source]
Advances a water quality simulation over the time until the next hydraulic event.
ENnextQ()
Returns: tstep time (in seconds) until the next hydraulic event or 0 if at the end of the full simulation duration.
See also ENstepQ, ENrunQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___quality.html
- ENopen(inpname=None, repname=None, binname=None)[source]
Opens an EPANET input file & reads in network data.
ENopen(inpname, repname, binname)
Parameters: inpname the name of an existing EPANET-formatted input file. repname the name of a report file to be created (or “” if not needed). binname the name of a binary output file to be created (or “” if not needed).
See also ENclose
- ENopenH()[source]
Opens a project’s hydraulic solver.
ENopenH()
See also ENinitH, ENrunH, ENnextH, ENcloseH OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENopenQ()[source]
Opens a project’s water quality solver.
ENopenQ()
See also ENopenQ, ENinitQ, ENrunQ, ENnextQ, ENstepQ, ENcloseQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___quality.html
- ENreport()[source]
Writes simulation results in a tabular format to a project’s report file.
ENreport()
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___reporting.html
- ENresetreport()[source]
Resets a project’s report options to their default values.
ENresetreport()
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___reporting.html
- ENrunH()[source]
Computes a hydraulic solution for the current point in time.
ENrunH()
Returns: t the current simulation time in seconds.
See also ENinitH, ENrunH, ENnextH, ENcloseH OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENrunQ()[source]
Makes hydraulic and water quality results at the start of the current time period available to a project’s water quality solver.
ENrunQ()
Returns: t current simulation time in seconds. See also ENopenQ, ENinitQ, ENrunQ, ENnextQ, ENstepQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___quality.html
- ENsaveH()[source]
Transfers a project’s hydraulics results from its temporary hydraulics file to its binary output file, where results are only reported at uniform reporting intervals.
ENsaveH()
- ENsavehydfile(fname)[source]
Saves a project’s temporary hydraulics file to disk.
ENsaveHydfile(fname)
- ENsaveinpfile(inpname)[source]
Saves a project’s data to an EPANET-formatted text file.
ENsaveinpfile(inpname)
- ENsetbasedemand(index, demandIdx, value)[source]
Sets the base demand for one of a node’s demand categories.
ENsetbasedemand(index, demandIdx, value)
Parameters: index a node’s index (starting from 1). demandIdx the index of a demand category for the node (starting from 1). value the new base demand for the category.
- ENsetcomment(object_, index, comment)[source]
Sets a comment to a specific index
ENsetcomment(object, index, comment)
Parameters: object_ a type of object (either EN_NODE, EN_LINK, EN_TIMEPAT or EN_CURVE)
e.g, obj.ToolkitConstants.EN_NODE
index objects index (starting from 1). comment comment to be added.
- ENsetcontrol(cindex, ctype, lindex, setting, nindex, level)[source]
Sets the properties of an existing simple control.
ENsetcontrol(cindex, ctype, lindex, setting, nindex, level)
Parameters: cindex the control’s index (starting from 1). ctype the type of control (see ControlTypes). lindex the index of the link being controlled. setting the control setting applied to the link. nindex the index of the node used to trigger the control (0 for EN_TIMER and EN_TIMEOFDAY controls). level the action level (tank level, junction pressure, or time in seconds) that triggers the control.
- ENsetcoord(index, x, y)[source]
Sets the (x,y) coordinates of a node.
ENsetcoord(index, x, y)
Parameters: index a node’s index. x the node’s X-coordinate value. y the node’s Y-coordinate value.
- ENsetcurve(index, x, y, nfactors)[source]
Assigns a set of data points to a curve.
ENsetcurve(index, x, y, nfactors)
Parameters: index a curve’s index (starting from 1). x an array of new x-values for the curve. y an array of new y-values for the curve. nfactors the new number of data points for the curve.
See also ENsetcurvevalue OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___curves.html
- ENsetcurveid(index, Id)[source]
Changes the ID name of a data curve given its index.
ENsetcurveid(index, Id)
Parameters: index a curve’s index (starting from 1). Id an array of new x-values for the curve.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___curves.html
- ENsetcurvevalue(index, pnt, x, y)[source]
Sets the value of a single data point for a curve.
ENsetcurvevalue(index, pnt, x, y)
Parameters: index a curve’s index (starting from 1). pnt the index of a point on the curve (starting from 1). x the point’s new x-value. y the point’s new y-value.
- ENsetdemandmodel(Type, pmin, preq, pexp)[source]
Sets the Type of demand model to use and its parameters.
ENsetdemandmodel(index, demandIdx, value)
Parameters: Type Type of demand model (see DEMANDMODEL). pmin Pressure below which there is no demand. preq Pressure required to deliver full demand. pexp Pressure exponent in demand function.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENsetdemandname(node_index, demand_index, demand_name)[source]
Assigns a name to a node’s demand category.
ENsetdemandname(node_index, demand_index, demand_name) Parameters: node_index a node’s index (starting from 1). demand_index the index of one of the node’s demand categories (starting from 1). demand_name the new name assigned to the category.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENsetdemandpattern(index, demandIdx, patInd)[source]
Sets the index of a time pattern used for one of a node’s demand categories.
ENsetdemandpattern(index, demandIdx, patInd)
Parameters: index a node’s index (starting from 1). demandIdx the index of one of the node’s demand categories (starting from 1). patInd the index of the time pattern assigned to the category.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___demands.html
- ENsetelseaction(ruleIndex, actionIndex, linkIndex, status, setting)[source]
Sets the properties of an ELSE action in a rule-based control.
ENsetelseaction(ruleIndex, actionIndex, linkIndex, status, setting)
Parameters: ruleIndex the rule’s index (starting from 1). actionIndex the index of the ELSE action being modified (starting from 1). linkIndex the index of the link in the action (starting from 1). status the new status assigned to the link (see RULESTATUS). setting the new value assigned to the link’s setting.
- ENsetflowunits(code)[source]
Sets a project’s flow units.
ENsetflowunits(code)
Parameters: code a flow units code (see EN_FlowUnits)
- ENsetheadcurveindex(pumpindex, curveindex)[source]
Assigns a curve to a pump’s head curve.
ENsetheadcurveindex(pumpindex, curveindex)
Parameters: pumpindex the index of a pump link (starting from 1). curveindex the index of a curve to be assigned as the pump’s head curve.
- ENsetjuncdata(index, elev, dmnd, dmndpat)[source]
Sets a group of properties for a junction node.
ENsetjuncdata(index, elev, dmnd, dmndpat)
Parameters: index a junction node’s index (starting from 1). elev the value of the junction’s elevation. dmnd the value of the junction’s primary base demand. dmndpat the ID name of the demand’s time pattern (”” for no pattern).
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENsetlinkid(index, newid)[source]
Changes the ID name of a link.
ENsetlinkid(index, newid)
Parameters: index a link’s index (starting from 1). newid the new ID name for the link.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENsetlinknodes(index, startnode, endnode)[source]
Sets the indexes of a link’s start- and end-nodes.
ENsetlinknodes(index, startnode, endnode)
Parameters: index a link’s index (starting from 1). startnode The index of the link’s start node (starting from 1). endnode The index of the link’s end node (starting from 1).
- ENsetlinktype(indexLink, paramcode, actionCode)[source]
Changes a link’s type.
ENsetlinktype(id, paramcode, actionCode)
Parameters: indexLink a link’s index (starting from 1). paramcode the new type to change the link to (see self.LinkType). actionCode the action taken if any controls contain the link.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENsetlinkvalue(index, paramcode, value)[source]
Sets a property value for a link.
ENsetlinkvalue(index, paramcode, value)
Parameters: index a link’s index. paramcode the property to set (see EN_LinkProperty). value the new value for the property.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENsetnodeid(index, newid)[source]
Changes the ID name of a node.
ENsetnodeid(index, newid)
Parameters: index a node’s index (starting from 1). newid the new ID name for the node.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENsetnodevalue(index, paramcode, value)[source]
Sets a property value for a node.
ENsetnodevalue(index, paramcode, value)
Parameters: index a node’s index (starting from 1). paramcode the property to set (see EN_NodeProperty, self.getToolkitConstants). value the new value for the property.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENsetoption(optioncode, value)[source]
Sets the value for an anlysis option.
ENsetoption(optioncode, value)
Parameters: optioncode a type of analysis option (see EN_Option). value the new value assigned to the option.
- ENsetpattern(index, factors, nfactors)[source]
Sets the pattern factors for a given time pattern.
ENsetpattern(index, factors, nfactors)
Parameters: index a time pattern index (starting from 1). factors an array of new pattern factor values. nfactors the number of factor values supplied.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___patterns.html
- ENsetpatternid(index, Id)[source]
Changes the ID name of a time pattern given its index.
ENsetpatternid(index, id)
Parameters: index a time pattern index (starting from 1). id the time pattern’s new ID name.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___patterns.html
- ENsetpatternvalue(index, period, value)[source]
Sets a time pattern’s factor for a given time period.
ENsetpatternvalue(index, period, value)
Parameters: index a time pattern index (starting from 1). period a time period in the pattern (starting from 1). value the new value of the pattern factor for the given time period.
- ENsetpipedata(index, length, diam, rough, mloss)[source]
Sets a group of properties for a pipe link.
ENsetpipedata(index, length, diam, rough, mloss)
Parameters: index the index of a pipe link (starting from 1). length the pipe’s length. diam the pipe’s diameter. rough the pipe’s roughness coefficient. mloss the pipe’s minor loss coefficient.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___links.html
- ENsetpremise(ruleIndex, premiseIndex, logop, object_, objIndex, variable, relop, status, value)[source]
Sets the properties of a premise in a rule-based control.
ENsetpremise(ruleIndex, premiseIndex, logop, object, objIndex, variable, relop, status, value)
Parameters: ruleIndex the rule’s index (starting from 1). premiseIndex the position of the premise in the rule’s list of premises. logop the premise’s logical operator ( IF = 1, AND = 2, OR = 3 ). object_ the type of object the premise refers to (see RULEOBJECT). objIndex the index of the object (e.g. the index of a tank). variable the object’s variable being compared (see RULEVARIABLE). relop the premise’s comparison operator (see RULEOPERATOR). status the status that the object’s status is compared to (see RULESTATUS). value the value that the object’s variable is compared to.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___rules.html
- ENsetpremiseindex(ruleIndex, premiseIndex, objIndex)[source]
Sets the index of an object in a premise of a rule-based control.
ENsetpremiseindex(ruleIndex, premiseIndex, objIndex)
Parameters: ruleIndex the rule’s index (starting from 1). premiseIndex the premise’s index (starting from 1). objIndex the index of the object (e.g. the index of a tank).
- ENsetpremisestatus(ruleIndex, premiseIndex, status)[source]
Sets the status being compared to in a premise of a rule-based control.
ENsetpremisestatus(ruleIndex, premiseIndex, status)
Parameters: ruleIndex the rule’s index (starting from 1). premiseIndex the premise’s index (starting from 1). status the status that the premise’s object status is compared to (see RULESTATUS).
- ENsetpremisevalue(ruleIndex, premiseIndex, value)[source]
Sets the value in a premise of a rule-based control.
ENsetpremisevalue(ruleIndex, premiseIndex, value)
Parameters: ruleIndex the rule’s index (starting from 1). premiseIndex the premise’s index (starting from 1). value The value that the premise’s variable is compared to.
- ENsetqualtype(qualcode, chemname, chemunits, tracenode)[source]
Sets the type of water quality analysis to run.
ENsetqualtype(qualcode, chemname, chemunits, tracenode)
Parameters: qualcode the type of analysis to run (see EN_QualityType, self.QualityType). chemname the name of the quality constituent. chemunits the concentration units of the constituent. tracenode a type of analysis option (see ENOption).
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___options.html
- ENsetreport(command)[source]
Processes a reporting format command.
ENsetreport(command)
Parameters: command a report formatting command.
See also ENreport
- ENsetrulepriority(ruleIndex, priority)[source]
Sets the priority of a rule-based control.
ENsetrulepriority(ruleIndex, priority)
Parameters: ruleIndex the rule’s index (starting from 1). priority the priority value assigned to the rule.
- ENsetstatusreport(statuslevel)[source]
Sets the level of hydraulic status reporting.
ENsetstatusreport(statuslevel)
Parameters: statuslevel a status reporting level code (see EN_StatusReport).
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___reporting.html
- ENsettankdata(index, elev, initlvl, minlvl, maxlvl, diam, minvol, volcurve)[source]
Sets a group of properties for a tank node.
ENsettankdata(index, elev, initlvl, minlvl, maxlvl, diam, minvol, volcurve)
Parameters: index a tank node’s index (starting from 1). elev the tank’s bottom elevation. initlvl the initial water level in the tank. minlvl the minimum water level for the tank. maxlvl the maximum water level for the tank. diam the tank’s diameter (0 if a volume curve is supplied). minvol the new value for the property. volcurve the volume of the tank at its minimum water level.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___nodes.html
- ENsetthenaction(ruleIndex, actionIndex, linkIndex, status, setting)[source]
Sets the properties of a THEN action in a rule-based control.
ENsetthenaction(ruleIndex, actionIndex, linkIndex, status, setting)
Parameters: ruleIndex the rule’s index (starting from 1). actionIndex the index of the THEN action to retrieve (starting from 1). linkIndex the index of the link in the action. status the new status assigned to the link (see EN_RuleStatus).. setting the new value assigned to the link’s setting.
- ENsettimeparam(paramcode, timevalue)[source]
Sets the value of a time parameter.
ENsettimeparam(paramcode, timevalue)
Parameters: paramcode a time parameter code (see EN_TimeParameter). timevalue the new value of the time parameter (in seconds).
- ENsettitle(line1, line2, line3)[source]
Sets the title lines of the project.
ENsettitle(line1, line2, line3)
Parameters: line1 first title line line2 second title line line3 third title line
- ENsetvertices(index, x, y, vertex)[source]
Assigns a set of internal vertex points to a link.
ENsetvertices(index, x, y, vertex)
Parameters: index a link’s index (starting from 1). x an array of X-coordinates for the vertex points. y an array of Y-coordinates for the vertex points. vertex the number of vertex points being assigned.
- ENsolveH()[source]
Runs a complete hydraulic simulation with results for all time periods written to a temporary hydraulics file.
ENsolveH()
See also ENopenH, ENinitH, ENrunH, ENnextH, ENcloseH OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENsolveQ()[source]
Runs a complete water quality simulation with results at uniform reporting intervals written to the project’s binary output file.
ENsolveQ()
See also ENopenQ, ENinitQ, ENrunQ, ENnextQ, ENcloseQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENstepQ()[source]
Advances a water quality simulation by a single water quality time step.
ENstepQ()
Returns: tleft time left (in seconds) to the overall simulation duration.
See also ENrunQ, ENnextQ OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
- ENusehydfile(hydfname)[source]
Uses a previously saved binary hydraulics file to supply a project’s hydraulics.
ENusehydfile(hydfname)
Parameters: hydfname the name of the binary file containing hydraulic results.
OWA-EPANET Toolkit: http://wateranalytics.org/EPANET/group___hydraulics.html
epyt.src.epanetconstants module
- class epyt.src.epanetconstants.EpanetConstants[source]
Bases:
object- EN_MAXID = 32
- EN_MAXMSG = 255
- EN_ELEVATION = 0
- EN_BASEDEMAND = 1
- EN_PATTERN = 2
- EN_EMITTER = 3
- EN_INITQUAL = 4
- EN_SOURCEQUAL = 5
- EN_SOURCEPAT = 6
- EN_SOURCETYPE = 7
- EN_TANKLEVEL = 8
- EN_DEMAND = 9
- EN_HEAD = 10
- EN_PRESSURE = 11
- EN_QUALITY = 12
- EN_SOURCEMASS = 13
- EN_INITVOLUME = 14
- EN_MIXMODEL = 15
- EN_MIXZONEVOL = 16
- EN_TANKDIAM = 17
- EN_MINVOLUME = 18
- EN_VOLCURVE = 19
- EN_MINLEVEL = 20
- EN_MAXLEVEL = 21
- EN_MIXFRACTION = 22
- EN_TANK_KBULK = 23
- EN_TANKVOLUME = 24
- EN_MAXVOLUME = 25
- EN_CANOVERFLOW = 26
- EN_DEMANDDEFICIT = 27
- EN_NODE_INCONTROL = 28
- EN_EMITTERFLOW = 29
- EN_LEAKAGEFLOW = 30
- EN_DEMANDFLOW = 31
- EN_FULLDEMAND = 32
- EN_DIAMETER = 0
- EN_LENGTH = 1
- EN_ROUGHNESS = 2
- EN_MINORLOSS = 3
- EN_INITSTATUS = 4
- EN_INITSETTING = 5
- EN_KBULK = 6
- EN_KWALL = 7
- EN_FLOW = 8
- EN_VELOCITY = 9
- EN_HEADLOSS = 10
- EN_STATUS = 11
- EN_SETTING = 12
- EN_ENERGY = 13
- EN_LINKQUAL = 14
- EN_LINKPATTERN = 15
- EN_PUMP_STATE = 16
- EN_PUMP_EFFIC = 17
- EN_PUMP_POWER = 18
- EN_PUMP_HCURVE = 19
- EN_PUMP_ECURVE = 20
- EN_PUMP_ECOST = 21
- EN_PUMP_EPAT = 22
- EN_LINK_INCONTROL = 23
- EN_GPV_CURVE = 24
- EN_PCV_CURVE = 25
- EN_LEAK_AREA = 26
- EN_LEAK_EXPAN = 27
- EN_LINK_LEAKAGE = 28
- EN_DURATION = 0
- EN_HYDSTEP = 1
- EN_QUALSTEP = 2
- EN_PATTERNSTEP = 3
- EN_PATTERNSTART = 4
- EN_REPORTSTEP = 5
- EN_REPORTSTART = 6
- EN_RULESTEP = 7
- EN_STATISTIC = 8
- EN_PERIODS = 9
- EN_STARTTIME = 10
- EN_HTIME = 11
- EN_QTIME = 12
- EN_HALTFLAG = 13
- EN_NEXTEVENT = 14
- EN_NEXTEVENTTANK = 15
- EN_NODECOUNT = 0
- EN_TANKCOUNT = 1
- EN_LINKCOUNT = 2
- EN_PATCOUNT = 3
- EN_CURVECOUNT = 4
- EN_CONTROLCOUNT = 5
- EN_RULECOUNT = 6
- EN_JUNCTION = 0
- EN_RESERVOIR = 1
- EN_TANK = 2
- EN_CVPIPE = 0
- EN_PIPE = 1
- EN_PUMP = 2
- EN_PRV = 3
- EN_PSV = 4
- EN_PBV = 5
- EN_FCV = 6
- EN_TCV = 7
- EN_GPV = 8
- EN_PCV = 9
- EN_NONE = 0
- EN_CHEM = 1
- EN_AGE = 2
- EN_TRACE = 3
- EN_CONCEN = 0
- EN_MASS = 1
- EN_SETPOINT = 2
- EN_FLOWPACED = 3
- EN_CFS = 0
- EN_GPM = 1
- EN_MGD = 2
- EN_IMGD = 3
- EN_AFD = 4
- EN_LPS = 5
- EN_LPM = 6
- EN_MLD = 7
- EN_CMH = 8
- EN_CMD = 9
- EN_CMS = 10
- EN_PSI = 0
- EN_KPA = 1
- EN_METERS = 2
- EN_DDA = 0
- EN_PDA = 1
- EN_TRIALS = 0
- EN_ACCURACY = 1
- EN_TOLERANCE = 2
- EN_EMITEXPON = 3
- EN_DEMANDMULT = 4
- EN_HEADERROR = 5
- EN_FLOWCHANGE = 6
- EN_HEADLOSSFORM = 7
- EN_GLOBALEFFIC = 8
- EN_GLOBALPRICE = 9
- EN_GLOBALPATTERN = 10
- EN_DEMANDCHARGE = 11
- EN_SP_GRAVITY = 12
- EN_SP_VISCOS = 13
- EN_UNBALANCED = 14
- EN_CHECKFREQ = 15
- EN_MAXCHECK = 16
- EN_DAMPLIMIT = 17
- EN_SP_DIFFUS = 18
- EN_BULKORDER = 19
- EN_WALLORDER = 20
- EN_TANKORDER = 21
- EN_CONCENLIMIT = 22
- EN_DEMANDPATTERN = 23
- EN_EMITBACKFLOW = 24
- EN_PRESS_UNITS = 25
- EN_STATUS_REPORT = 26
- EN_LOWLEVEL = 0
- EN_HILEVEL = 1
- EN_TIMER = 2
- EN_TIMEOFDAY = 3
- EN_AVERAGE = 1
- EN_MINIMUM = 2
- EN_MAXIMUM = 3
- EN_RANGE = 4
- EN_MIX1 = 0
- EN_MIX2 = 1
- EN_FIFO = 2
- EN_LIFO = 3
- EN_NOSAVE = 0
- EN_SAVE = 1
- EN_INITFLOW = 10
- EN_SAVE_AND_INIT = 11
- EN_CONST_HP = 0
- EN_POWER_FUNC = 1
- EN_CUSTOM = 2
- EN_NOCURVE = 3
- EN_VOLUME_CURVE = 0
- EN_PUMP_CURVE = 1
- EN_EFFIC_CURVE = 2
- EN_HLOSS_CURVE = 3
- EN_GENERIC_CURVE = 4
- EN_VALVE_CURVE = 5
- EN_UNCONDITIONAL = 0
- EN_CONDITIONAL = 1
- EN_NO_REPORT = 0
- EN_NORMAL_REPORT = 1
- EN_FULL_REPORT = 2
- EN_NODE = 0
- EN_LINK = 1
- EN_TIMEPAT = 2
- EN_CURVE = 3
- EN_CONTROL = 4
- EN_RULE = 5
- EN_HW = 0
- EN_DW = 1
- EN_CM = 2
- EN_R_NODE = 6
- EN_R_LINK = 7
- EN_R_SYSTEM = 8
- EN_R_DEMAND = 0
- EN_R_HEAD = 1
- EN_R_GRADE = 2
- EN_R_LEVEL = 3
- EN_R_PRESSURE = 4
- EN_R_FLOW = 5
- EN_R_STATUS = 6
- EN_R_SETTING = 7
- EN_R_POWER = 8
- EN_R_TIME = 9
- EN_R_CLOCKTIME = 10
- EN_R_FILLTIME = 11
- EN_R_DRAINTIME = 12
- EN_ITERATIONS = 0
- EN_RELATIVEERROR = 1
- EN_MAXHEADERROR = 2
- EN_MAXFLOWCHANGE = 3
- EN_MASSBALANCE = 4
- EN_DEFICIENTNODES = 5
- EN_DEMANDREDUCTION = 6
- EN_LEAKAGELOSS = 7
- EN_R_IS_OPEN = 1
- EN_R_IS_CLOSED = 2
- EN_R_IS_ACTIVE = 3
- EN_STEP_REPORT = 0
- EN_STEP_HYD = 1
- EN_STEP_WQ = 2
- EN_STEP_TANKEVENT = 3
- EN_STEP_CONTROLEVENT = 4
- EN_MISSING = -10000000000.0
- EN_SET_CLOSED = -10000000000.0
- EN_SET_OPEN = 10000000000.0
- MSX_NODE = 0
- MSX_LINK = 1
- MSX_TANK = 2
- MSX_SPECIES = 3
- MSX_TERM = 4
- MSX_PARAMETER = 5
- MSX_CONSTANT = 6
- MSX_PATTERN = 7
- MSX_BULK = 0
- MSX_WALL = 1
- MSX_NOSOURCE = -1
- MSX_CONCEN = 0
- MSX_MASS = 1
- MSX_SETPOINT = 2
- MSX_FLOWPACED = 3
epyt.src.epanetmsxapi module
- class epyt.src.epanetmsxapi.epanetmsxapi(msxfile='', loadlib=True, ignore_msxfile=False, customMSXlib=None, display_msg=True, msxrealfile='')[source]
Bases:
objectexample msx = epanetmsxapi()
- __init__(msxfile='', loadlib=True, ignore_msxfile=False, customMSXlib=None, display_msg=True, msxrealfile='')[source]
- MSXopen(msxfile, msxrealfile=None, ignore_error=True)[source]
Open MSX file filename - Arsenite.msx or use full path
- Example:
msx.MSXopen(filename) msx.MSXopen(Arsenite.msx)
- MSXgetindex(obj_type, obj_id)[source]
Retrieves the number of objects of a specific type MSXgetcount(obj_type, obj_id)
- Parameters:
obj_type: code type of object being sought and must be one of the following pre-defined constants: MSX_SPECIES (for a chemical species) the number 3 MSX_CONSTANT (for a reaction constant) the number 6 MSX_PARAMETER (for a reaction parameter) the number 5 MSX_PATTERN (for a time pattern) the number 7
obj_id: string containing the object’s ID name
- Returns:
The index number (starting from 1) of object of that type with that specific name.
- MSXgetID(obj_type, index, id_len=80)[source]
Retrieves the ID name of an object given its internal index number msx.MSXgetID(obj_type, index, id_len) print(msx.MSXgetID(3,1,8))
- Parameters:
obj_type: type of object being sought and must be on of the following pre-defined constants: MSX_SPECIES (for chemical species) MSX_CONSTANT(for reaction constant) MSX_PARAMETER(for a reaction parameter) MSX_PATTERN (for a time pattern)
index: the sequence number of the object (starting from 1 as listed in the MSX input file)
id_len: the maximum number of characters that id can hold
- Returns:
id object’s ID name
- MSXgetIDlen(obj_type, index)[source]
Retrieves the number of characters in the ID name of an MSX object given its internal index number msx.MSXgetIDlen(obj_type, index) print(msx.MSXgetIDlen(3,3)) Parameters:
- obj_type: type of object being sought and must be on of the
following pre-defined constants: MSX_SPECIES (for chemical species) MSX_CONSTANT(for reaction constant) MSX_PARAMETER(for a reaction parameter) MSX_PATTERN (for a time pattern)
- index: the sequence number of the object (starting from 1
as listed in the MSX input file)
Returns : the number of characters in the ID name of MSX object
- MSXgetspecies(index)[source]
Retrieves the attributes of a chemical species given its internal index number msx.MSXgetspecies(index) msx.MSXgetspecies(1) Parameters:
index : integer -> sequence number of the species
- Returns:
- typeis returned with one of the following pre-defined constants:
MSX_BULK (defined as 0) for a bulk water species , or MSX_WALL (defined as 1) for a pipe wall surface species
units: mass units that were defined for the species in question atol : the absolute concentration tolerance defined for the species. rtol : the relative concentration tolerance defined for the species.
- MSXgetcount(code)[source]
Retrieves the number of objects of a specific type MSXgetcount(code)
- Parameters:
code type of object being sought and must be one of the following pre-defined constants: MSX_SPECIES (for a chemical species) the number 3 MSX_CONSTANT (for a reaction constant) the number 6 MSX_PARAMETER (for a reaction parameter) the number 5 MSX_PATTERN (for a time pattern) the number 7
- Returns:
The count number of object of that type.
- MSXgetparameter(obj_type, index, param)[source]
Retrieves the value of a particular reaction parameter for a given pipe msx.MSXgetparameter(obj_type, index, param) msx.MSXgetparameter(1,1,1) Parameters:
- obj_type: is type of object being queried and must be either:
MSX_NODE (defined as 0) for a node or MSX_LINK(defined as 1) for alink
- index: is the internal sequence number (starting from 1)
assigned to the node or link
- param: the sequence number of the parameter (starting from 1
as listed in the MSX input file)
- Returns:
- valuethe value assigned to the parameter for the node or link
of interest.
- MSXgetpatternlen(pattern_index)[source]
Retrieves the number of time periods within a source time pattern
MSXgetpatternlen(pattern_index)
- Parameters:
- pattern_index: the internal sequence number (starting from 1)
of the pattern as it appears in the MSX input file.
- Returns:
- len: the number of time periods (and therefore number of multipliers)
that appear in the pattern.
- MSXgetpatternvalue(pattern_index, period)[source]
- Retrieves the multiplier at a specific time period for a
given source time pattern
msx.MSXgetpatternvalue(pattern_index, period) msx.MSXgetpatternvalue(1,1)
- Parameters:
pattern_index: the internal sequence number(starting from 1) of the pattern as it appears in the MSX input file
period: the index of the time period (starting from 1) whose multiplier is being sought
- MSXgetinitqual(obj_type, index, species)[source]
- Retrieves the intial concetration of a particular chemical species
assigned to a specific node or link of the pipe network
msx.MSXgetinitqual(obj_type, index) msx.MSXgetinitqual(1,1,1)
Parameters:
- typetype of object being queeried and must be either:
MSX_NODE (defined as 0) for a node or , MSX_LINK (defined as 1) for a link
- indexthe internal sequence number (starting from 1) assigned
to the node or link
species: the sequence number of the species (starting from 1)
- Returns:
- value: the initial concetration of the species at the node or
link of interest.
- MSXgetsource(node_index, species_index)[source]
Retrieves information on any external source of a particular chemical species assigned to a specific node or link of the pipe network. msx.MSXgetsource(node_index, species_index) msx.MSXgetsource(1,1)
- Parameters:
node_index: the internal sequence number (starting from 1) assigned to the node of interest.
species_index: the sequence number of the species of interest (starting from 1 as listed in MSX input file)
Returns:
- type: the type of external source to be utilized and will be one of
the following predefined constants:
MSX_NOSOURCE (defined as -1) for no source MSX_CONCEN (defined as 0) for a concetration sourc MSX_MASS (defined as 1) for a mass booster source MSX_SETPOINT (defined as 2) for a setpoint source MSX_FLOWPACE (defined as 3) for a flow paced source
level: the baseline concentration ( or mass flow rate) of the source)
- patthe index of the time pattern used to add variability to the
the source’s baseline level (and will be 0 if no pattern was defined for the source)
- MSXsaveoutfile(filename)[source]
Saves water quality results computed for each node, link and reporting time period to a named binary file. msx.MSXsaveoutfile(filename) msx.MSXsaveoufile(Arsenite.msx)
- Parameters:
filename: name of the permanent output results file
- MSXsavemsxfile(filename)[source]
Saves the data associated with the current MSX project into a new MSX input file msx.MSXsavemsxfile(filename) msx.MSXsavemsxfile(Arsenite.msx)
- Parameters:
filename: name of the file to which data are saved
- MSXsetconstant(index, value)[source]
Assigns a new value to a specific reaction constant msx.MSXsetconstant(index, value) msx.MSXsetconstant(1,10)
- MSXsetparameter(obj_type, index, param, value)[source]
Assigns a value to a particular reaction parameter for a given pipe or tank within the pipe network msx.MSXsetparameter(obj_type, index, param, value) msx.MSXsetparameter(1,1,1,15) Parameters:
- obj_type: is type of object being queried and must be either:
MSX_NODE (defined as 0) for a node or MSX_LINK (defined as 1) for a link
- index: is the internal sequence number (starting from 1)
assigned to the node or link
- param: the sequence number of the parameter (starting from 1
as listed in the MSX input file)
- value: the value to be assigned to the parameter for the node or
link of interest.
- MSXsetinitqual(obj_type, index, species, value)[source]
Assigns an initial concetration of a particular chemical species node or link of the pipe network msx.MSXsetinitqual(obj_type, index, species, value) msx.MSXsetinitqual(1,1,1,15) Parameters:
- type: type of object being queried and must be either :
MSX_NODE(defined as 0) for a node or MSX_LINK(defined as 1) for a link
- index: integer -> the internal sequence number (starting from 1)
assigned to the node or link
species: the sequence number of the species (starting from 1 as listed in MASx input file)
- value: float -> the initial concetration of the species to be applied at the node or link
of interest.
- MSXsetpattern(index, factors, nfactors)[source]
Assigns a new set of multipliers to a given MSX source time pattern MSXsetpattern(index,factors,nfactors)
- Parameters:
- index: the internal sequence number (starting from 1)
of the pattern as it appers in the MSX input file
- factors: an array of multiplier values to replace those previously used by
the pattern
nfactors: the number of entries in the multiplier array/ vector factors
- MSXsetpatternvalue(pattern, period, value)[source]
- Assigns a new value to the multiplier for a specific time period
in a given MSX source time pattern.
msx.MSXsetpatternvalue(pattern, period, value) msx.MSXsetpatternvalue(1,1,10)
- Parameters:
pattern: the internal sequence number (starting from 1) of the pattern as it appears in the MSX input file.
period: the time period (starting from 1) in the pattern to be replaced value: the new multiplier value to use for that time period.
- MSXsolveQ()[source]
Solves for water quality over the entire simulation period and saves the results to an internal scratch file msx.MSXsolveQ()
- MSXsolveH()[source]
Solves for system hydraulics over the entire simulation period saving results to an internal scratch file msx.MSXsolveH()
- MSXaddpattern(pattern_id)[source]
- Adds a newm empty MSX source time pattern to an MSX project
MSXaddpattern(pattern_id)
- Parameters:
pattern_id: the name of the new pattern
- MSXstep()[source]
Advances the water quality solution through a single water quality time step when performing a step-wise simulation
t, tleft = MSXstep() Returns:
t : current simulation time at the end of the step(in secconds) tleft: time left in the simulation (in secconds)
- MSXinit(flag)[source]
Initialize the MSX system before solving for water quality results in the step-wise fashion
MSXinit(flag)
- Parameters:
- flag: Set the flag to 1 if the water quality results should be saved
to a scratch binary file, or 0 if not
- MSXreport()[source]
Writes water quality simulations results as instructed by MSX input file to a text file. msx.MSXreport()
- MSXgetqual(type, index, species)[source]
Retrieves a chemical species concentration at a given node or the average concentration along a link at the current sumulation time step.
MSXgetqual(type, index, species)
- Parameters:
- type: type of object being queried and must be either:
MSX_NODE ( defined as 0) for a node, MSX_LINK (defined as 1) for a link
- index: then internal sequence number (starting from 1)
assigned to the node or link.
species is the sequence number of the species (starting from 1 as listed in the MSX input file)
- Returns:
The value of the computed concentration of the species at the current time period.
- MSXsetsource(node, species, type, level, pat)[source]
“Sets the attributes of an external source of particular chemical species to specific node of the pipe network msx.setsource(node, species, type, level, pat) msx.MSXsetsource(1,1,3,10.565,1) Parameters:
- node: the internal sequence number (starting from1) assigned
to the node of interest.
- species: the sequence number of the species of interest (starting
from 1 as listed in the MSX input file)
- type: the type of external source to be utilized and will be one of
the following predefined constants: MSX_NOSOURCE (defined as -1) for no source MSX_CONCEN (defined as 0) for a concetration source MSX_MASS (defined as 1) for a mass booster source MSX_SETPOINT (defined as 2) for a setpoint source MSX_FLOWPACE (defined as 3) for a flow paced source
level: the baseline concetration (or mass flow rate) of the source
- pat: the index of the time pattern used to add variability to the
source’s baseline level ( use 0 if the source has a constant strength)
- MSXgeterror(err)[source]
Returns the text for an error message given its error code. msx.MSXgeterror(err) msx.MSXgeterror(516) Parameters:
err: the code number of an error condition generated by EPANET-MSX
- Returns:
errmsg: the text of the error message corresponding to the error code
- MSXgetoptions()[source]
Retrieves all the options. # AREA_UNITS FT2/M2/CM2 # RATE_UNITS SEC/MIN/HR/DAY # SOLVER EUL/RK5/ROS2 # COUPLING FULL/NONE # TIMESTEP seconds # ATOL value # RTOL value # COMPILER NONE/VC/GC # SEGMENTS value # PECLET value
- class suppress(*exceptions)
Bases:
AbstractContextManagerContext manager to suppress specified exceptions
After the exception is suppressed, execution proceeds with the next statement following the with statement.
- with suppress(FileNotFoundError):
os.remove(somefile)
# Execution still resumes here if the file was already removed
- __init__(*exceptions)
- os = <module 'os' (frozen)>
- warnings = <module 'warnings' from '/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/warnings.py'>
- copy2(dst, *, follow_symlinks=True)
Copy data and metadata. Return the file’s destination.
Metadata is copied with copystat(). Please see the copystat function for more information.
The destination may be a directory.
If follow_symlinks is false, symlinks won’t be followed. This resembles GNU’s “cp -P src dst”.