Source

Create Function

For creating a single source:

create_source(net, junction, mdot_kg_per_s, scaling=1.0, name=None, index=None, in_service=True, type='source', **kwargs)

Adds one source in table net[“source”].

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

  • junction (int) – The index of the junction to which the source is connected

  • mdot_kg_per_s (float, default None) – The required mass flow

  • scaling (float, default 1) – An optional scaling factor to be set customly

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

  • 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.

  • in_service (bool, default True) – True for in service, False for out of service

  • type (str, default None) – Type variable to classify the source

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

Returns

index - The unique ID of the created element

Return type

int

Example
>>> create_source(net,junction=2,mdot_kg_per_s=0.1)

For creating multiple sources at once:

create_sources(net, junctions, mdot_kg_per_s, scaling=1.0, name=None, index=None, in_service=True, type='source', **kwargs)

Convenience function for creating many sources at once. Parameter ‘junctions’ must be an array of the desired length. Other parameters may be either arrays of the same length or single values.

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

  • junctions (Iterabl(int)) – The index of the junctions to which the sources are connected

  • mdot_kg_per_s (Iterable or float, default None) – The required mass flow

  • scaling (Iterable or float, default 1) – An optional scaling factor to be set customly

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

  • 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.

  • in_service (Iterable or bool, default True) – True for in service, False for out of service

  • type (Iterable or str, default None) – Type variable to classify the sources

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

Returns

index - The unique IDs of the created elements

Return type

array(int)

Example
>>> new_source_ids = create_sources(net, junctions=[1, 5, 10],                                            mdot_kg_per_s=[0.1, 0.05, 0.2])

Component Table Data

net.source

Parameter

Datatype

Value Range

Explanation

name

string

Name of the source

junction

integer

Index of connected junction

mdot_kg_per_s

float

\(\geq\) 0

The mass flow injected by the source [kg/s]

scaling

float

\(\geq\) 0

Scaling factor for the injected mass flow

in_service

boolean

True / False

Specifies if the source is in service.

type

string

Type variable to classify sources

Physical Model

A source component injects a specified mass flow into the system. The source is connected to a specified node.

Sources are typically used to model producing units in hydraulic systems. Please note that sources cannot be used to model heat sources for the pandapipes heat mode. In this case, to model a heat flow entering the system, the heat exchanger component can be used.

Result Table Data

net.res_source

Parameter

Datatype

Explanation

mdot_kg_per_s

float

Mass flow injection [kg/s]