Tank#
module wntr.network.elements
- class Tank[source]#
Bases:
Node
Tank class, inherited from Node.
Tank volume can be defined using a constant diameter or a volume curve. If the tank has a volume curve, the diameter has no effect on hydraulic simulations.
Constructor
This class is intended to be instantiated through the
add_tank()
method. Direct creation through the constructor is highly discouraged.- Parameters:
name (string) – Name of the tank.
wn (
WaterNetworkModel
) – WaterNetworkModel object the tank will belong to
Attributes
The name of the node (read only)
returns
"Tank"
(read-only) the current simulation head at the node (total head)
(read-only) the current simulation demand at the node (actual demand)
elevation to the bottom of the tank.
The initial tank level at the start of simulation
minimum level for the tank to be able to drain
maximum level before tank begins to overflow (if permitted)
diameter of the tank as a cylinder
minimum volume to be able to drain (when using a tank curve)
Name of the volume curve to use, or None
The volume curve, if defined (read only)
Is this tank allowed to overflow
The mixing model to be used by EPANET.
for water quality simulations only, the compartment size for 2-compartment mixing
bulk reaction coefficient for this tank only; leave None to use global value
The node coordinates, (x,y)
The initial quality (concentration) at the node
A tag or label for the node
Read-only simulation results
(read-only) the current simulation head at the node (total head)
(read-only) the current simulation tank level (= head - elevation)
(read-only) the current simulation pressure (head - elevation)
(read-only) the current simulation quality at the node
(read-only) the current simulation leak demand at the node
(read-only) the current simulation leak status at the node
(read-only) the current simulation leak area at the node
(read-only) the current simulation leak discharge coefficient
- add_leak(wn, area, discharge_coeff=0.75, start_time=None, end_time=None)[source]#
Add a leak to a tank.
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 bottom of the tank, P_g/(rho*g); Note that this is not the hydraulic head (P_g + elevation)
Note that WNTR assumes the leak is at the bottom of the tank.
- Parameters:
wn (
WaterNetworkModel
) – The WaterNetworkModel object containing the tank 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_leak(wn)[source]#
Remove a leak from a tank
- Parameters:
wn (
WaterNetworkModel
) – Water network model
- to_dict()#
Dictionary representation of the node
- to_ref()#
- property bulk_coeff#
bulk reaction coefficient for this tank only; leave None to use global value
- Type:
- property init_level#
The initial tank level at the start of simulation
- property leak_discharge_coeff#
(read-only) the current simulation leak discharge coefficient
- Type:
- property mixing_fraction#
for water quality simulations only, the compartment size for 2-compartment mixing
- Type:
- property mixing_model#
The mixing model to be used by EPANET. This only affects water quality simulations and has no impact on the WNTRSimulator. Uses the MixType enum object, or it will convert string values from MIXED, 2COMP, FIFO and LIFO. By default, this is set to None, and will produce no output in the EPANET INP file and EPANET will assume complete and instantaneous mixing (MIXED).
- property node_type#
returns
"Tank"
- property vol_curve#
The volume curve, if defined (read only)
Set this using the vol_curve_name.
- property vol_curve_name#
Name of the volume curve to use, or None