Valve

Create Function

For creating a single valve:

create_valve(net, from_junction, to_junction, diameter_m, opened=True, loss_coefficient=0, name=None, index=None, type='valve', **kwargs)

Creates a valve element in net[“valve”] from valve parameters.

Parameters:
  • net (pandapipesNet) – The net for which this valve should be created

  • from_junction (int) – ID of the junction on one side which the valve will be connected with

  • to_junction (int) – ID of the junction on the other side which the valve will be connected with

  • diameter_m (float) – The valve diameter in [m]

  • opened (bool, default True) – Flag to show if the valve is opened and allows for fluid flow or if it is closed to block the fluid flow.

  • loss_coefficient (float, default 0) – The pressure loss coefficient introduced by the valve shape

  • name (str, default None) – A name tag for this valve

  • index (int, default None) – Force a specified ID if it is available. If None, the index one higher than the highest already existing index is selected.

  • type (str, default None) – An identifier for special types of valves

  • kwargs – Additional keyword arguments will be added as further columns to the net[“valve”] table

Returns:

index - The unique ID of the created element

Return type:

int

Example:
>>> create_valve(net, 0, 1, diameter_m=4e-3, name="valve1")

For creating multiple valves at once:

create_valves(net, from_junctions, to_junctions, diameter_m, opened=True, loss_coefficient=0, name=None, index=None, type='valve', **kwargs)

Convenience function for creating many valves at once. Parameters ‘from_junctions’ and ‘to_junctions’ must be arrays of equal length. Other parameters may be either arrays of the same length or single values.

Parameters:
  • net (pandapipesNet) – The net for which these valves should be created

  • from_junctions (Iterable(int)) – IDs of the junctions on one side which the valves will be connected to

  • to_junctions (Iterable(int)) – IDs of the junctions on the other side to which the valves will be connected to

  • diameter_m (Iterable or float) – The valve diameters in [m]

  • opened (Iterable or bool, default True) – Flag to show if the valves are opened and allow for fluid flow or if they are closed to block the fluid flow.

  • loss_coefficient (Iterable or float, default 0) – The pressure loss coefficients introduced by the valve shapes

  • name (Iterable or str, default None) – Name tags for the valves

  • index (Iterable(int), default None) – Force specified IDs if they are available. If None, the index one higher than the highest already existing index is selected and counted onwards.

  • type (Iterable or str, default "valve") – Identifiers for special types of valves (e.g. below or above ground)

  • kwargs – Additional keyword arguments will be added as further columns to the net[“valve”] table

Returns:

index - The unique IDs of the created elements

Return type:

array(int)

Example:
>>> create_valves(net, from_junctions=[0, 1, 4], to_junctions=[1, 5, 6],
>>>               opened=[True, False, True], diameter_m=4e-3,
>>>               name=["valve_%d" for d in range(3)])

Component Table Data

net.valve

Parameter

Datatype

Value Range

Explanation

name

string

Name of the valve

from_junction

integer

\(>\) 0

Index of junction at which the valve starts

to_junction

integer

\(>\) 0

Index of junction at which the valve ends

diameter_m

float

\(\gt\) 0

Inner diameter of the pipe [m]

opened

boolean

True / False

Indicates if the valve is opened

loss_coefficient

float

\(\geq\) 0

An additional pressure loss coefficient

type

string

Type variable to classify junctions

Physical Model

A valve is an edge component which can be used to connect or disconnect network sections. The valve can be modelled as ideal component, which is either fully open or closed causing no losses. However, a pressure loss coefficient can be imposed as well. This property considers a specific loss caused by the component when opened and models internal pressure losses. There are no losses when the component is closed.

The valve is considered as branch element with no length and is modelled accordingly.

Result Table Data

For incompressible media:

net.res_valve

Parameter

Datatype

Explanation

v_mean_m_per_s

float

The mean valve velocity [m/s]

p_from_bar

float

Pressure at “from”-junction [bar]

p_to_bar

float

Pressure at “to”-junction [bar]

t_from_k

float

Temperature at “from”-junction [K]

t_to_k

float

Temperature at “to”-junction [K]

mdot_from_kg_per_s

float

Mass flow into valve [kg/s]

mdot_to_kg_per_s

float

Mass flow out of valve [kg/s]

vdot_norm_m3_per_s

float

Norm volume flow [m^3/s]

For compressible media:

net.res_valve

Parameter

Datatype

Explanation

v_from_m_per_s

float

The velocity at the valve entry [m/s]

v_to_m_per_s

float

The velocity at the valve exit [m/s]

v_mean_m_per_s

float

The mean valve velocity [m/s]

p_from_bar

float

Pressure at “from”-junction [bar]

p_to_bar

float

Pressure at “to”-junction [bar]

t_from_k

float

Temperature at “from”-junction [K]

t_to_k

float

Temperature at “to”-junction [K]

mdot_from_kg_per_s

float

Mass flow into valve [kg/s]

mdot_to_kg_per_s

float

Mass flow out of valve [kg/s]

vdot_norm_m3_per_s

float

Norm volume flow [m^3/s]

reynolds

float

Average Reynolds number

lambda

float

Average valve friction factor

normfactor_from

float

Normfactor to calculate real gas velocity at “from”-junction (only for gas flows)

normfactor_to

float

Normfactor to calculate real gas velocity at “to”-junction (only for gas flows)