Creating Fluids

Fluid from Library

In the fluid library some default fluids are already implemented. Currently it is possible to work with the default fluids water, air and natural_gas. One of these default fluids can be created and added to an existing network by calling the following function.

create_fluid_from_lib(net, name, overwrite=True)

Creates a fluid from library (if there is an entry) and sets net[“fluid”] to this value. Currently existing fluids in the library are: “water”, “natural_gas”, “air”.

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

  • name (str) – The name of the fluid that shall be extracted from the fluid lib

  • overwrite (bool, default True) – Flag if a possibly existing fluid in the net shall be overwritten.

Returns

No output.

EXAMPLE:

pp.create_fluid_from_lib(net, name=”water”)

If only the fluid shall be retrieved without adding it to a specific network, the following function can be used.

call_lib(fluid)

Creates a fluid with default fluid properties. Currently implemented: Water, air and natural gas.

Parameters

fluid (str) – Fluid which should be used

Returns

Fluid - Chosen fluid with default fluid properties

Return type

Fluid

Fluid from Parameters

Apart from the default fluids in the fluid library, there is the possibility to create a specific fluid from certain parameters, if they are all just constants.

Note

This functionality is currently not well implemented and probably buggy!

create_constant_fluid(name=None, fluid_type=None, **kwargs)

Creates a constant fluid.

Parameters
  • name (str) – Name of the fluid

  • fluid_type (str) – Type of the fluid

  • kwargs – Additional information

Returns

Fluid

Return type

Fluid

Otherwise, it is also possible to add a number of properties (constant and linear) to an existing fluid in the net with the help of auxiliary functions:

create_constant_property(net, property_name, value, overwrite=True, warn_on_duplicates=True)

Creates a property with a constant value.

Parameters
  • net (pandapipesNet) – Name of the network to which the property is added

  • property_name (str) – Name of the new property

  • value (float) – Constant value of the property

  • overwrite (basestring) – True if existing property with the same name shall be overwritten

  • warn_on_duplicates (basestring) – True, if a warning of properties with the same name should be returned

create_linear_property(net, property_name, slope, offset, overwrite=True, warn_on_duplicates=True)

Creates a property with a linear correlation.

Parameters
  • net (pandapipesNet) – Name of the network to which the property is added

  • property_name (str) – Name of the new property

  • slope (float) – Slope of the linear correlation

  • offset (float) – Offset of the linear function

  • overwrite (basestring) – True if existing property with the same name shall be overwritten

  • warn_on_duplicates (basestring) – True, if a warning of properties with the same name should be returned

Example
>>> prop1 = pandapipes.create_constant_property(net, "density", 1000)
>>> prop2 = pandapipes.create_linear_property(net, "compressibility", -0.01, 1)