Junction#

module wntr.network.elements

class Junction[source]#

Bases: Node

Junction class, inherited from Node.

Junctions are the nodes that contain demand, emitters, and water quality sources.

Constructor

This class is intended to be instantiated through the add_junction() method. Direct creation through the constructor is highly discouraged.

Parameters:
  • name (string) – Name of the junction.

  • wn (WaterNetworkModel) – WaterNetworkModel object the junction will belong to

Attributes

name

The name of the node (read only)

node_type

"Junction" (read only)

base_demand

Get the base_value of the first demand in the demand_timeseries_list.

demand_timeseries_list

list of demand patterns and base multipliers

elevation

elevation of the junction

coordinates

The node coordinates, (x,y)

emitter_coefficient

if not None, then activate an emitter with the specified coefficient

initial_quality

The initial quality (concentration) at the node

minimum_pressure

The minimum pressure attribute is used for pressure-dependent demand simulations.

required_pressure

The required pressure attribute is used for pressure-dependent demand simulations.

pressure_exponent

The pressure exponent attribute is used for pressure-dependent demand simulations.

tag

A tag or label for the node

Read-only simulation results

demand

(read-only) the current simulation demand at the node (actual demand)

head

(read-only) the current simulation head at the node (total head)

pressure

(read-only) the current simulation pressure at the node

quality

(read-only) the current simulation quality at the node

leak_demand

(read-only) the current simulation leak demand at the node

leak_status

(read-only) the current simulation leak status at the node

leak_area

(read-only) the current simulation leak area at the node

leak_discharge_coeff

(read-only) the current simulation leak discharge coefficient


__init__(name, wn)[source]#
add_demand(base, pattern_name, category=None)[source]#

Add a new demand entry to the Junction

Parameters:
  • base (float) – The base demand value for this new entry

  • pattern_name (str or None) – The name of the pattern to use or None for a constant value

  • category (str, optional) – A category name for this demand

add_fire_fighting_demand(wn, fire_flow_demand, fire_start, fire_end, pattern_name=None)[source]#

Add a new fire flow demand entry to the Junction

Parameters:
  • wn (WaterNetworkModel) – Water network model

  • fire_flow_demand (float) – Fire flow demand

  • fire_start (int) – Start time of the fire flow in seconds.

  • fire_end (int) – End time of the fire flow in seconds.

  • pattern_name (str or None) – Pattern name. If pattern name is None, the pattern name is assigned to junction name + ‘_fire’

add_leak(wn, area, discharge_coeff=0.75, start_time=None, end_time=None)[source]#

Add a leak control to the water network model

Leaks are modeled by:

Q = discharge_coeff*area*sqrt(2*g*h)

where:

Q is the volumetric flow rate of water out of the leak g is the acceleration due to gravity h is the gauge head at the junction, P_g/(rho*g); Note that this is not the hydraulic head (P_g + elevation)

Parameters:
  • wn (WaterNetworkModel) – Water network model containing the junction with the leak. This information is needed because the WaterNetworkModel object stores all controls, including when the leak starts and stops.

  • area (float) – Area of the leak in m^2.

  • discharge_coeff (float) – Leak discharge coefficient; Takes on values between 0 and 1.

  • start_time (int) – Start time of the leak in seconds. If the start_time is None, it is assumed that an external control will be used to start the leak (otherwise, the leak will not start).

  • end_time (int) – Time at which the leak is fixed in seconds. If the end_time is None, it is assumed that an external control will be used to end the leak (otherwise, the leak will not end).

remove_fire_fighting_demand(wn)[source]#

Removes a fire flow demand entry to the Junction

Parameters:

wn (WaterNetworkModel) – Water network model

remove_leak(wn)[source]#

Remove a leak control from the water network model

Parameters:

wn (WaterNetworkModel) – Water network model

to_dict()#

Dictionary representation of the node

to_ref()#
property base_demand#

Get the base_value of the first demand in the demand_timeseries_list.

This is a read-only property.

property coordinates#

The node coordinates, (x,y)

Type:

tuple

property demand#

(read-only) the current simulation demand at the node (actual demand)

Type:

float

property demand_category#

Get the category of the first demand in the demand_timeseries_list.

This is a read-only property.

property demand_pattern#

Get the pattern_name of the first demand in the demand_timeseries_list.

This is a read-only property.

property demand_timeseries_list#

list of demand patterns and base multipliers

Type:

Demands

property elevation#

elevation of the junction

Type:

float

property emitter_coefficient#

if not None, then activate an emitter with the specified coefficient

Type:

float

property head#

(read-only) the current simulation head at the node (total head)

Type:

float

property initial_quality#

The initial quality (concentration) at the node

Type:

float

property leak#

(read-only) the current simulation leak area at the node

Type:

float

property leak_area#

(read-only) the current simulation leak area at the node

Type:

float

property leak_demand#

(read-only) the current simulation leak demand at the node

Type:

float

property leak_discharge_coeff#

(read-only) the current simulation leak discharge coefficient

Type:

float

property leak_status#

(read-only) the current simulation leak status at the node

Type:

bool

property minimum_pressure#

The minimum pressure attribute is used for pressure-dependent demand simulations. Below this pressure, the junction will not receive any water. If set to None, the global value in wn.options.hydraulic.minimum_pressure is used.

Type:

float

property name#

The name of the node (read only)

Type:

str

property node_type#

"Junction" (read only)

Type:

str

property nominal_pressure#

deprecated - use required pressure

property pressure#

(read-only) the current simulation pressure at the node

Type:

float

property pressure_exponent#

The pressure exponent attribute is used for pressure-dependent demand simulations. If set to None, the global value in wn.options.hydraulic.pressure_exponent is used.

Type:

float

property quality#

(read-only) the current simulation quality at the node

Type:

float

property required_pressure#

The required pressure attribute is used for pressure-dependent demand simulations. This is the lowest pressure at which the junction receives the full requested demand. If set to None, the global value in wn.options.hydraulic.required_pressure is used.

Type:

float

property tag#

A tag or label for the node

Type:

str