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:
hgas
andlgas
(high and low calorific natural gas),hydrogen
,methane
,water
,biomethane_pure
andbiomathane_treated
(see here for the compositions),air
.
The values are loaded from txt-files in the ‘pandapipes/properties/[fluid name]’ folder. 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: “hgas”, “lgas”, “hydrogen”, “methane”, “water”,”biomethane_pure”, “biomethane_treated”, “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:
>>> create_fluid_from_lib(net, name="water")
For fuel gases, the higher and lower heating value are loaded from the library as well. These heating values are not required for the pipe flow calculation but are helpful to calculate energy conversion, e.g. in coupled networks.
If only the fluid shall be retrieved without adding it to a specific network, the following function can be used.
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:
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)