oopnet.elements package

This section describes the various classes that OOPNET provides for hydraulic models. The figure below shows the classes and their relationships:

_images/Class_Structure.png

Class structure of OOPNET

Submodules

oopnet.elements.base module

This module contains all the base classes of OOPNET

class oopnet.elements.base.NetworkComponent(id=<property object>, comment=None, tag=None)

Bases: ABC

This is OOPNET’s base class for all objects having a name (id) in EPANET Input files

id

A unique label used to identify the Network Component. It can consist of a combination of up to 15 numerals or characters. It cannot be the same as the ID for any other node if it is a node, the same counts for links.

comment

Property containing a comment on the attribute if it is necessary. The comment is automatically read in from EPANET input files by parsing everything behind a semicolon (;), if a semicolon is not the first character in a line

tag

Associates category labels (tags) with specific nodes and links. An optional text string (with no spaces) used to assign e.g. the node to a category, such as a pressure zone.

comment: Optional[str] = None
abstract property id: str
tag: Optional[str] = None

oopnet.elements.component_registry module

exception oopnet.elements.component_registry.ComponentNotExistingError(id, message=None)

Bases: Exception

Raised when a no component with the ID exists in the network.

class oopnet.elements.component_registry.ComponentRegistry(super_registry=None)

Bases: dict

Class for storing NetworkComponents in a Network object or a SuperComponentRegistry.

Based on built-in dict but prevents overwriting an existing key and raises a ComponentNotExistingError error, when trying to look up a not exiting Component (instead of default KeyErrors).

exception oopnet.elements.component_registry.IdenticalIDError(id, message=None)

Bases: Exception

Raised when a component with the same ID already exists in the network.

class oopnet.elements.component_registry.LinkRegistry(*args, **kwargs)

Bases: object

SuperComponentRegistry factory for Link components.

class oopnet.elements.component_registry.NodeRegistry(*args, **kwargs)

Bases: object

SuperComponentRegistry factory for Node components.

class oopnet.elements.component_registry.SuperComponentRegistry(classes)

Bases: dict

Registry for Link and Node components.

Components are stored in ComponentRegistries for the individual subclasses (junctions, pipes, tanks, …).

check_id_exists(id)

Checks if a component with the specified ID already exists in one of the ComponentRegistries.

Parameters:

id – ID to check

Return type:

bool

Returns:

True, if the ID exists, False otherwise.

get_by_id(id)

Returns a component with a specified ID from the ComponentRegistries.

Args:

id: NetworkComponent ID

Raises:

ComponentNotExistingError if no NetworkComponent with the specified ID is found.

Return type:

NetworkComponent

Returns:

Requested NetworkComponent

oopnet.elements.network module

class oopnet.elements.network.Network(title=None, labels=<factory>, backdrop=None, reactions=<factory>, options=<factory>, times=<factory>, report=<factory>, reportparameter=<factory>, reportprecision=<factory>, energies=<factory>, controls=<factory>, _nodes=<factory>, _links=<factory>, _curves=<factory>, _patterns=<factory>, _rules=<factory>)

Bases: object

EPANET hydraulic model representation.

An OOPNET Network object contains all the information stored in an EPANET input file. This ranges from physical components like Junctions, Tanks or Pipes to non-physical components like Patterns, Curves or Controls. Furthermore, model settings and report parameter settings/precision settings are incorporated as well.

title

Network name

labels

List of all Labels in the network

backdrop

Contains the Backdrop object of the network

energies

List of all Energy curves in the network

controls

List of all Control objects in the network

_rules

List of all Rule objects in the network

reactions

List of all Reaction objects in the network

options

Option object representing model options

times

Time object representing time settings

report

SimulationReport object representing model report settings

reportparameter

Reportparameter object representing model report parameter settings

reportprecision

Reportprecision object representing model report parameter precision settings

_nodes

SuperComponentRegistry for all Node objects in the network

SuperComponentRegistry for all Link objects in the network

_curves

ComponentRegistry of for Curve objects belonging to the network

_patterns

ComponentRegistry of for Pattern objects belonging to the network

animate(fignum=None, nodes=None, node_label=None, links=None, link_label=None, linkwidth=None, colorbar=True, colormap='viridis', ax=None, markersize=8.0, robust=False, nodes_vlim=None, links_vlim=None, truncate_nodes=None, interval=500, repeat=False)

Animates the Network with simulation results as a network plot with Matplotlib.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars in the middle, Pumps are plotted as lines with pentagons

Parameters:
  • fignum (Optional[int]) – figure number, where to plot the network

  • nodes (Optional[pd.Series]) – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Pressure(rpt)). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • links (Optional[pd.Series]) – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)). If links is None or specific links do not have values, then the links are drawn as black lines

  • link_width – Values describing the link width as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)).

  • colorbar (Union[bool, dict]) – If True a colorbar is created, if False there is no colorbar in the plot. If one wants to set this setting for nodes and links seperatly, make use of a dictionary with key ‘node’ for nodes respectively key ‘query_link’ for links (e.g. colorbar = {‘node’:True, ‘query_link’:False} plots a colorbar for nodes but not for links)

  • colormap (Union[str, dict]) – Colormap defining which colors are used for the simulation results (default is matplotlib’s colormap viridis). colormap can either be a string for matplotlib colormaps, a matplotlib.colors.LinearSegmentedColormap object or a matplotlib.colors.ListedColormap object. If one wants to use different colormaps for nodes and links, then make use of a dictionary with key ‘node’ for nodes respectively key ‘query_link’ for links (e.g. colormaps = {‘node’:’jet’, ‘query_link’:’cool’} plots nodes with colormap jet and links using colormap cool)

  • ax (Optional[Axes]) – Matplotlib Axes object

  • markersize (float) – size of markers

  • nodes_vlim (Optional[tuple[float, float]]) – todo: add description

  • links_vlim (Optional[tuple[float, float]]) –

  • robust (bool) – If True, 2nd and 98th percentiles are used as limits for the colorbar, else the minima and maxima are used.

  • truncate_nodes – If True, only junctions for which a value was submitted using the nodes parameter are plotted. If the nodes parameters isn’t being used, all junctions are plotted. If not set True, junctions for which no value was submitted using the nodes parameters are plotted in black. This only applies to junctions and not to tanks and reservoirs, which are always plotted.

Return type:

FuncAnimation

Returns:

Matplotlib’s figure handle

backdrop: Optional[Backdrop] = None
bokehplot(tools=None, links=None, nodes=None, colormap='jet')

Plots the Network with simulation results as a network plot with Bokehplot.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars standing on their top in the middle, Pumps are plotted as lines with triangulars standing on an edge

Parameters:
  • tools – tools used for the Bokeh plot (panning, zooming, …)

  • nodes – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Pressure(rpt)). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • links – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)). f links is None or specific links do not have values, then the links are drawn as black lines

  • colormap – Colormap defining which colors are used for the simulation results (default is matplotlib’s colormap jet). colormap can either be a string for matplotlib colormaps, a matplotlib.colors.LinearSegmentedColormap object or a matplotlib.colors.ListedColormap object. If one wants to use different colormaps for nodes and links, then make use of a dictionary with key ‘node’ for nodes respectively key ‘query_link’ for links (e.g. colormaps = {‘node’:’jet’, ‘query_link’:’cool’} plots nodes with colormap jet and links using colormap cool)

Return type:

BokehFigure

Returns:

Bokehplot’s figure handle

controls: list[Control]
energies: list[Energy]
labels: dict[str, Label]
options: Options
plot(fignum=None, nodes=None, links=None, linkwidth=None, colorbar=True, colormap='viridis', ax=None, markersize=8.0, robust=False, nodes_vlim=None, links_vlim=None, truncate_nodes=None)

Plots the Network with simulation results as a network plot with Matplotlib.

Symbols for Nodes: Junctions are plotted as circles, Reservoirs as diamonds, Tanks as squares.

Symbols for Links: Pipes are plotted as lines with no markers, Valves are plotted as lines with triangulars in the middle, Pumps are plotted as lines with pentagons

Parameters:
  • fignum (Optional[int]) – figure number, where to plot the network

  • nodes (Optional[pd.Series]) – Values related to the nodes as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Pressure(rpt)). If nodes is None or specific nodes do not have values, then the nodes are drawn as black circles

  • links (Optional[pd.Series]) – Values related to the links as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)). If links is None or specific links do not have values, then the links are drawn as black lines

  • linkwidth (Optional[pd.Series]) – Values describing the link width as Pandas Series generated e.g. by one of OOPNET’s SimulationReport functions (e.g. Flow(rpt)).

  • colorbar (Union[bool, dict]) – If True a colorbar is created, if False there is no colorbar in the plot. If one wants to set this setting for nodes and links seperatly, make use of a dictionary with key ‘node’ for nodes respectively key ‘query_link’ for links (e.g. colorbar = {‘node’:True, ‘query_link’:False} plots a colorbar for nodes but not for links)

  • colormap (Union[str, dict]) – Colormap defining which colors are used for the simulation results (default is matplotlib’s colormap viridis). colormap can either be a string for matplotlib colormaps, a matplotlib.colors.LinearSegmentedColormap object or a matplotlib.colors.ListedColormap object. If one wants to use different colormaps for nodes and links, then make use of a dictionary with key ‘node’ for nodes respectively key ‘query_link’ for links (e.g. colormaps = {‘node’:’jet’, ‘query_link’:’cool’} plots nodes with colormap jet and links using colormap cool)

  • ax (Optional[Axes]) – Matplotlib Axes object

  • markersize (float) – size of markers

  • nodes_vlim – todo: add description

  • links_vlim

  • robust (bool) – If True, 2nd and 98th percentiles are used as limits for the colorbar, else the minima and maxima are used.

  • truncate_nodes – If True, only junctions for which a value was submitted using the nodes parameter are plotted. If the nodes parameters isn’t being used, all junctions are plotted. If not set True, junctions for which no value was submitted using the nodes parameters are plotted in black. This only applies to junctions and not to tanks and reservoirs, which are always plotted.

Return type:

PyPlotFigure

Returns:

Matplotlib’s figure handle

reactions: Reaction
classmethod read(filename=typing.Optional[str], content=typing.Optional[str])

Reads an EPANET input file.

Parameters:
  • filename – filename of the EPANET input file

  • content – EPANET input file content as string

report: Report
reportparameter: Reportparameter
reportprecision: Reportprecision
run(filename=None, delete=True, path=None, startdatetime=None, output=False)

Runs an EPANET simulation by calling command line EPANET

filename

if thing is an OOPNET network, filename is an option to perform command line EPANET simulations with a specific filename. If filename is a Python None object then a file with a random UUID (universally unique identifier) is generated

delete

if delete is True the EPANET Input and SimulationReport file is deleted, if False then the simulation results won’t be deleted and are stored in a folder named path

path

Path were to perform the simulations. If path is a Python None object then a tmp-folder is generated

output

If True, stdout and strerr will be printed to console and logged.

Return type:

SimulationReport

Returns:

OOPNET report object

times: Times
title: Optional[str] = None
write(filename)

Converts the Network to an EPANET input file and saves it with the desired filename.

Parameters:

filename – desired filename/path were the user wants to store the file

Returns:

0 if successful

oopnet.elements.network_components module

class oopnet.elements.network_components.FCV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, maximum_flow=0.0)

Bases: Valve

Flow Control Valve.

maximum_flow

maximum allow flow

maximum_flow: float = 0.0
property setting
class oopnet.elements.network_components.GPV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, headloss_curve=None)

Bases: Valve

General Purpose Valve.

headloss_curve

Curve representing flow-head loss relationship

headloss_curve: Curve = None
property setting
class oopnet.elements.network_components.Junction(id=<property object>, comment=None, tag=None, xcoordinate=0.0, ycoordinate=0.0, elevation=0.0, initialquality=0.0, sourcequality=0.0, sourcetype=None, strength=0.0, sourcepattern=None, emittercoefficient=0.0, demandpattern=None, demand=0.0)

Bases: Node

Junction node.

emittercoefficient

Discharge coefficient for emitter (sprinkler or nozzle) placed at junction. The coefficient represents the flow (in current flow units) that occurs at a pressure drop of 1 meter. Leave blank if no emitter is present. See the Emitters topic in the ‘EPANET Manual Section 3.1 <https://epanet22.readthedocs.io/en/latest/3_network_model.html#physical-components>’ for more details.

demandpattern

Pattern object used to characterize time variation in demand for the main category of consumer at the junction. The pattern provides multipliers that are applied to the Base Demand to determine actual demand in a given time period.

demand

The average or nominal demand for water by the main category of consumer at the junction, as measured in the current flow units. A negative value is used to indicate an external source of flow into the junction.

demand: Union[float, list[float]] = 0.0
demandpattern: Union[Pattern, list[Pattern], None] = None
emittercoefficient: float = 0.0
property id: str

Bases: NetworkComponent

Base class for all Link like objects in OOPNET (Pipe, Pump, Valve).

startnode

Node-object at the start of the Link

endnode

Node-object at the end of the Link

status

Current status of the Link (OPEN, CLOSED, CV or ACTIVE)

property center

Returns the Link’s center based on its start and end nodes as well as its vertices.

property coordinates: ndarray

Property returning start and end node coordinates

property coordinates_2d: ndarray

Property returning start and end node coordinates with the vertices in between them

endnode: Optional[Node] = None
revert()

Switches the link’s start and end nodes and it’s vertices.

startnode: Optional[Node] = None
status: str = 'OPEN'
vertices: list[Vertex]
class oopnet.elements.network_components.Node(id=<property object>, comment=None, tag=None, xcoordinate=0.0, ycoordinate=0.0, elevation=0.0, initialquality=0.0, sourcequality=0.0, sourcetype=None, strength=0.0, sourcepattern=None)

Bases: NetworkComponent

Base class for all Node like objects in OOPNET (Junction, Reservoir, Tank).

xcoordinate

The horizontal location of the junction on the map, measured in the map’s distance units. If left blank, the node object will not appear on the network map.

ycoordinate

The vertical location of the junction on the map, measured in the map’s distance units. If left blank, the node object will not appear on the network map.

elevation

The elevation in meters above some common reference of the node. This is a required property. Elevation is used only to compute pressure at the node. For tanks it is a required property and means Elevation above a common datum in meters of the bottom shell of the tank.

initialquality

Water quality level at the node at the start of the simulation period. Can be left blank if no water quality analysis is being made or if the level is zero.

sourcequality

Quality of any water entering the network at this location.

sourcetype

Source type (CONCEN, MASS, FLOWPACED, or SETPOINT)

strength

Baseline source strength

sourcepattern

Time Pattern object of source

property coordinates: ndarray

Property returning node coordinates.

Returns:

x- and y-coordinate, and elevation

elevation: float = 0.0
initialquality: float = 0.0
sourcepattern: Optional[list[Pattern]] = None
sourcequality: float = 0.0
sourcetype: Optional[str] = None
strength: float = 0.0
xcoordinate: float = 0.0
ycoordinate: float = 0.0
class oopnet.elements.network_components.PBV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, pressure_drop=0.0)

Bases: Valve

Pressure Breaker Valve.

pressure_drop

pressure drop

pressure_drop: float = 0.0
property setting
class oopnet.elements.network_components.PRV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, maximum_pressure=0.0)

Bases: Valve

Pressure Reducing Valve.

maximum_pressure

pressure limit

maximum_pressure: float = 0.0
property setting
class oopnet.elements.network_components.PSV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, pressure_limit=0.0)

Bases: Valve

Pressure Sustaining Valve.

setting

pressure limit at upstream setting

pressure_limit: float = 0.0
property setting
class oopnet.elements.network_components.Pipe(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, length=1000.0, diameter=12.0, roughness=100.0, minorloss=0.0, reactionbulk=None, reactionwall=None)

Bases: Link

Pipe link.

length

The actual length of the pipe in meters.

diameter

The pipe diameter in mm.

roughness

The roughness coefficient of the pipe. It is unitless for Hazen-Williams or Chezy-Manning roughness and has units of mm for Darcy-Weisbach roughness.

minorloss

Unitless minor loss coefficient associated with bends, fittings, etc. Assumed 0 if left blank.

reactionbulk

The bulk reaction coefficient for the pipe. Time units are 1/days. Use a positive value for growth and a negative value for decay. Leave blank if the Global Bulk reaction coefficient from the project’s Reaction Options will apply. See Water Quality Reactions in the ‘EPANET manual Section 3.4<https://epanet22.readthedocs.io/en/latest/3_network_model.html#water-quality-simulation-model>’ for moreinformation.

reactionwall

The wall reaction coefficient for the pipe. Time units are 1/days. Use a positive value for growth and a negative value for decay. Leave blank if the Global Wall reaction coefficient from the project’s Reactions Options will apply. See Water Quality Reactions in the ‘EPANET manual Section 3.4<https://epanet22.readthedocs.io/en/latest/3_network_model.html#water-quality-simulation-model>’ for moreinformation.

diameter: float = 12.0
property id: str
length: float = 1000.0
minorloss: float = 0.0
reactionbulk: Optional[float] = None
reactionwall: Optional[float] = None
roughness: float = 100.0
split(junction_id=None, pipe_id=None, split_ratio=0.5)

Splits the pipe into two parts with respective lengths based on the passed split_ratio.

Creates a new Junction with the ID junction_id and a new Pipe with identical Pipe attributes except for xcoordinate, ycoordinate and elevation. These are defined by the split_ratio argument (measured from start to end node). If junction_id or pipe_id is not specified, the new Junction’s/Pipe’s ID will be derived from the old Junction and Pipe IDs.

Warning

This will remove all vertices from the Pipe object.

Parameters:
  • junction_id (Optional[str]) – ID of newly created Junction

  • pipe_id (Optional[str]) – ID of newly creation Pipe

  • split_ratio (float) – ratio from start to end node along the Pipe

Return type:

tuple[Junction, Pipe]

Returns:

new Junction and Pipe objects

class oopnet.elements.network_components.Pump(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, power=None, head=None, speed=1.0, pattern=None, setting=None)

Bases: Link

Pump link.

todo: implement multiple keyword and value combinations .. attribute:: keyword

Can either be POWER (power value for constant energy pump, hp (kW)), HEAD (ID of curve that describeshead versus flow for the pump), SPEED (relative speed setting (normal speed is 1.0, 0 means pump is off)),PATTERN(ID of time pattern that describes how speed setting varies with time). Either POWER or HEAD must be supplied for each pump. The other keywords are optional.

value

Value according to the keyword attribute

status
head: Optional[Curve] = None
property id: str
pattern: Optional[Pattern] = None
power: Optional[float] = None
setting: Optional[float] = None
speed: float = 1.0
class oopnet.elements.network_components.Reservoir(id=<property object>, comment=None, tag=None, xcoordinate=0.0, ycoordinate=0.0, elevation=0.0, initialquality=0.0, sourcequality=0.0, sourcetype=None, strength=0.0, sourcepattern=None, head=0.0, headpattern=None)

Bases: Node

Reservoir nodes.

head

The hydraulic head (elevation + pressure head) of water in the reservoir in meters. This is a required property.

headpattern

Pattern object used to model time variation in the reservoir’s head. Leave blank if none applies. This property is useful if the reservoir represents a tie-in to another system whose pressure varies with time.

mixingmodel

The type of water quality mixing that occurs within the tank. The choices include MIXED (fully mixed), 2COMP (two-compartment mixing), FIFO (first-in-first-out plug flow) and LIFO (last-in-first-out plug flow).

head: Union[float, list[float]] = 0.0
headpattern: Union[None, Pattern, list[Pattern]] = None
property id: str
class oopnet.elements.network_components.TCV(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0, headloss_coefficient=0.0)

Bases: Valve

Throttle Control Valve.

headloss_coefficient

head loss coefficient

headloss_coefficient: float = 0.0
property setting
class oopnet.elements.network_components.Tank(id=<property object>, comment=None, tag=None, xcoordinate=0.0, ycoordinate=0.0, elevation=0.0, initialquality=0.0, sourcequality=0.0, sourcetype=None, strength=0.0, sourcepattern=None, initlevel=10.0, minlevel=0.0, maxlevel=20.0, diameter=50.0, minvolume=0.0, volumecurve=None, compartmentvolume=None, reactiontank=None, mixingmodel='MIXED')

Bases: Node

Tank node.

initlevel

Height in meters of the water surface above the bottom elevation of the tank at the start of the simulation.

minlevel

Minimum height in meters of the water surface above the bottom elevation that will be maintained. The water level in the tank will not be allowed to drop below this level.

maxlevel

Maximum height in meters of the water surface above the bottom elevation that will be maintained. The water level in the tank will not be allowed to rise above this level.

diameter

The diameter of the tank in meters. For cylindrical tanks this is the actual diameter. For square or rectangular tanks it can be an equivalent diameter equal to 1.128 times the square root of the cross-sectional area. For tanks whose geometry will be described by a curve (see below) it can be set to any value.

minvolume

The volume of water in the tank when it is at its minimum level, in cubic meter. This is an optional property, useful mainly for describing the bottom geometry of non-cylindrical tanks where a full volume versus depth curve will not be supplied (see below).

volumecurve

Curve object used to describe the relation between tank volume and water level. If no value is supplied then the tank is assumed to be cylindrical.

compartmentvolume

The fraction of the tank’s total volume that comprises the inlet-outlet compartment of the two-compartment (2COMP) mixing model. Can be left blank if another type of mixing model is employed.

reactiontank

The bulk reaction coefficient for chemical reactions in the tank. Time units are 1/days. Use a positive value for growth reactions and a negative value for decay. Leave blank if the Global Bulk reaction coefficient specified in the project’s Reactions Options will apply. See Water Quality Reactions in the ‘EPANETmanual Section 3.4 <https://epanet22.readthedocs.io/en/latest/3_network_model.html#water-quality-simulation-model>’ for moreinformation.

mixingmodel

The type of water quality mixing that occurs within the tank. The choices include MIXED (fully mixed), 2COMP (two-compartment mixing), FIFO (first-in-first-out plug flow) and LIFO (last-in-first-out plug flow).

compartmentvolume: Optional[float] = None
diameter: float = 50.0
property id: str
initlevel: float = 10.0
maxlevel: float = 20.0
minlevel: float = 0.0
minvolume: float = 0.0
mixingmodel: str = 'MIXED'
reactiontank: Optional[float] = None
volumecurve: Optional[Curve] = None
class oopnet.elements.network_components.Valve(id=<property object>, comment=None, tag=None, startnode=None, endnode=None, status='OPEN', vertices=<factory>, diameter=12.0, minorloss=0.0)

Bases: Link

Valve link.

diameter

The valve diameter in mm.

minorloss

Unitless minor loss coefficient that applies when the valve is completely opened. Assumed 0 if left blank.

diameter: float = 12.0
property id: str
minorloss: float = 0.0

oopnet.elements.network_map_tags module

class oopnet.elements.network_map_tags.Backdrop(dimensions, units, file, offset)

Bases: object

Identifies a backdrop image and dimensions for the network map.

dimensions: list[float]
file: str
offset: list[float]
units: str
class oopnet.elements.network_map_tags.Label(xcoordinate, ycoordinate, label, anchor)

Bases: object

Assigns coordinates to map labels.

anchor: Node
label: str
xcoordinate: float
ycoordinate: float
class oopnet.elements.network_map_tags.Tag(id, comment, object, tag)

Bases: object

Associates category labels (tags) with specific nodes and links.

comment: str
id: str
object: NetworkComponent
tag: str
class oopnet.elements.network_map_tags.Vertex(xcoordinate, ycoordinate)

Bases: object

Vertex class.

xcoordinate

Vertex xcoordinate

ycoordinate

Vertex ycoordinate

property coordinates

Vertex x- and y-coordinate.

xcoordinate: float
ycoordinate: float

oopnet.elements.options_and_reporting module

class oopnet.elements.options_and_reporting.Options(units='LPS', headloss='H-W', hydraulics=None, quality='NONE', viscosity=1.0, diffusivity=1.0, specificgravity=1.0, trials=200, accuracy=0.001, unbalanced='STOP', pattern=1.0, tolerance=0.01, map=None, demandmultiplier=1.0, emitterexponent=0.5, demandmodel='DDA', minimumpressure=0.0, requiredpressure=0.1, pressureexponent=0.5)

Bases: object

Defines various simulation options.

accuracy: float = 0.001
demandmodel: str = 'DDA'
demandmultiplier: float = 1.0
diffusivity: float = 1.0
emitterexponent: float = 0.5
headloss: str = 'H-W'
hydraulics: Optional[tuple[str, str]] = None
map: Optional[str] = None
minimumpressure: float = 0.0
pattern: Union[int, Pattern, None] = 1.0
pressureexponent: float = 0.5
quality: Union[str, tuple[str, str], tuple[str, str, str]] = 'NONE'
requiredpressure: float = 0.1
specificgravity: Optional[float] = 1.0
tolerance: float = 0.01
trials: int = 200
unbalanced: Union[str, tuple[str, int]] = 'STOP'
units: str = 'LPS'
viscosity: float = 1.0
class oopnet.elements.options_and_reporting.Report(pagesize=0, file=None, status='NO', summary='YES', energy='NO', nodes='ALL', links='ALL', parameter=None, value=None)

Bases: object

Describes the contents of the output report produced from a simulation.

energy: str = 'NO'
file: Optional[str] = None
nodes: Union[str, Node, list[Node]] = 'ALL'
pagesize: int = 0
parameter: Union[str, tuple[str, float]] = None
status: str = 'NO'
summary: str = 'YES'
value: Optional[float] = None
class oopnet.elements.options_and_reporting.Reportparameter(elevation='NO', demand='YES', head='YES', pressure='YES', quality='YES', length='NO', diameter='NO', flow='YES', velocity='YES', headloss='YES', setting='NO', reaction='NO', ffactor='NO')

Bases: object

The parameter reporting option is used to identify which quantities are reported on, how many decimal places are displayed, and what kind of filtering should be used to limit the output reporting.

Attributes:

demand: Union[str, tuple[str, float]] = 'YES'
diameter: Union[str, tuple[str, float]] = 'NO'
elevation: Union[str, tuple[str, float]] = 'NO'
ffactor: Union[str, tuple[str, float]] = 'NO'
flow: Union[str, tuple[str, float]] = 'YES'
head: Union[str, tuple[str, float]] = 'YES'
headloss: Union[str, tuple[str, float]] = 'YES'
length: Union[str, tuple[str, float]] = 'NO'
pressure: Union[str, tuple[str, float]] = 'YES'
quality: Union[str, tuple[str, float]] = 'YES'
reaction: Union[str, tuple[str, float]] = 'NO'
setting: Union[str, tuple[str, float]] = 'NO'
velocity: Union[str, tuple[str, float]] = 'YES'
class oopnet.elements.options_and_reporting.Reportprecision(elevation=2, demand=2, head=2, pressure=2, quality=2, length=2, diameter=2, flow=2, velocity=2, headloss=2, setting=2, reaction=2, ffactor=2)

Bases: object

Describes the precision per report parameter.

demand: int = 2
diameter: int = 2
elevation: int = 2
ffactor: int = 2
flow: int = 2
head: int = 2
headloss: int = 2
length: int = 2
pressure: int = 2
quality: int = 2
reaction: int = 2
setting: int = 2
velocity: int = 2
class oopnet.elements.options_and_reporting.Times(duration=datetime.timedelta(0), hydraulictimestep=datetime.timedelta(seconds=3600), qualitytimestep=None, ruletimestep=None, patterntimestep=None, patternstart=datetime.timedelta(0), reporttimestep=datetime.timedelta(seconds=3600), reportstart=datetime.timedelta(0), startclocktime=datetime.timedelta(0), statistic='NONE')

Bases: object

Defines various time step parameters used in the simulation.

duration: timedelta = datetime.timedelta(0)
hydraulictimestep: timedelta = datetime.timedelta(seconds=3600)
patternstart: timedelta = datetime.timedelta(0)
patterntimestep: Optional[timedelta] = None
qualitytimestep: Optional[timedelta] = None
reportstart: timedelta = datetime.timedelta(0)
reporttimestep: timedelta = datetime.timedelta(seconds=3600)
ruletimestep: Optional[timedelta] = None
startclocktime: timedelta = datetime.timedelta(0)
statistic: str = 'NONE'

oopnet.elements.system_operation module

class oopnet.elements.system_operation.Action(object=None, value=None)

Bases: object

An action clause in a rule-based control

object: Union[Node, Link, str] = None
value: Union[float, str] = None
class oopnet.elements.system_operation.Condition(object=None, logical=None, attribute=None, relation=None, value=None)

Bases: object

A condition clause in a rule-based control

attribute: str = None
logical: Optional[str] = None
object: Union[Link, Node] = None
relation: str = None
value: Union[float, str, datetime, timedelta] = None
class oopnet.elements.system_operation.Control(action=None, condition=None)

Bases: object

Defines simple controls that modifiy links based on a single condition.

action: Action = None
condition: Controlcondition = None
class oopnet.elements.system_operation.Controlcondition(object=None, relation=None, value=None, time=None, clocktime=None)

Bases: object

clocktime: Optional[datetime] = None
object: Optional[NetworkComponent] = None
relation: Optional[str] = None
time: Union[None, float, timedelta] = None
value: Optional[float] = None
class oopnet.elements.system_operation.Curve(id=<property object>, comment=None, tag=None, xvalues=<factory>, yvalues=<factory>)

Bases: NetworkComponent

Defines data curves and their X,Y points.

property id: str
xvalues: list[float]
yvalues: list[float]
class oopnet.elements.system_operation.Energy(keyword=None, pumpid=None, parameter=None, value=None)

Bases: object

Defines parameters used to compute pumping energy and cost.

keyword: Optional[str] = None
parameter: Optional[str] = None
pumpid: Optional[str] = None
value: Union[float, Pattern, Curve] = None
class oopnet.elements.system_operation.Pattern(id=<property object>, comment=None, tag=None, multipliers=<factory>)

Bases: NetworkComponent

Defines time patterns.

property id: str
multipliers: list[float]
class oopnet.elements.system_operation.Rule(id, condition=<factory>, priority=None)

Bases: object

Defines rule-based controls that modify links based on a combination of conditions.

condition: list[Condition]
id: str
priority: float = None

oopnet.elements.water_quality module

class oopnet.elements.water_quality.Reaction(orderbulk=1.0, orderwall=1.0, ordertank=1.0, globalbulk=0.0, globalwall=0.0, bulk=None, wall=None, tank=None, limitingpotential=None, roughnesscorrelation=None)

Bases: object

Defines parameters related to chemical reactions occurring in the network.

bulk: Optional[list[Pipe]] = None
globalbulk: float = 0.0
globalwall: float = 0.0
limitingpotential: Optional[float] = None
orderbulk: float = 1.0
ordertank: float = 1.0
orderwall: float = 1.0
roughnesscorrelation: Optional[float] = None
tank: Optional[list[Pipe]] = None
wall: Optional[list[Pipe]] = None

Module contents