Fluid Properties in pandapipes¶
The pipelines in the pandapipes network are run with a certain fluid. This can be chosen individually for the net from the fluid library or by own creation. The fluids are defined by certain properties. In the fluid library currently high and low calorific natural gas (hgas and lgas), hydrogen, methane, water and air are implemented with default properties.
The Fluid Class¶
Inside this class, different properties with their values are implemented. These properties can be called by different functions. There exists a general function, which returns the values of the requested property. Furthermore, there are different specified functions to return directly the value of the density, viscosity and heat capacity.
In addition to the already existing properties there is a function, which allows to add new properties. It also warns if there is already a property with the same name and can overwrite an existing property with a new value.
- class Fluid(name, fluid_type, **kwargs)¶
- add_property(property_name, prop, overwrite=True, warn_on_duplicates=True)¶
This function adds a new property.
- Parameters
property_name (str) – Name of the new property
prop (pandapipes.FluidProperty) – Values for the property, for example a curve or just a constant value
overwrite (bool) – True if existing property with the same name shall be overwritten
warn_on_duplicates (bool) – True, if a warning of properties with the same name should be returned
- Example
>>> fluid.add_property('water_density', pandapipes.FluidPropertyConstant(998.2061), overwrite=True, warn_on_duplicates=False)
- get_compressibility(p_bar)¶
This function returns the compressibility at a certain pressure.
- Parameters
p_bar (float or array of floats) – pressure at which the compressibility is queried
- Returns
compressibility at the required pressure
- get_density(temperature)¶
This function returns the density at a certain temperature.
- Parameters
temperature (float) – Temperature at which the density is queried
- Returns
Density at the required temperature
- get_der_compressibility()¶
This function returns the derivative of the compressibility with respect to pressure.
- Returns
derivative of the compressibility
- get_heat_capacity(temperature)¶
This function returns the heat capacity at a certain temperature.
- Parameters
temperature (float) – Temperature at which the heat capacity is queried
- Returns
Heat capacity at the required temperature
- get_molar_mass()¶
This function returns the molar mass.
- Returns
molar mass
- get_property(property_name, *at_values)¶
This function returns the value of the requested property.
- Parameters
property_name (str) – Name of the searched property
at_values – Value for which the property should be returned
- Returns
Returns property at the certain value
- Return type
- get_viscosity(temperature)¶
This function returns the viscosity at a certain temperature.
- Parameters
temperature (float) – Temperature at which the viscosity is queried
- Returns
Viscosity at the required temperature
Properties¶
The idea behind the properties is a functional correlation between physical quantities, e. g. a linear correlation between pressure and temperature based on the ideal gas law. This way the pandapipes components can ask for a specific fluid property, such as the density, at a given operation point. Some classes for different functional correlations have already been implemented. All properties have to inherit from the Property base class in order to be used in a fluid. These classes shall be introduced in the following. They all inherit from the pandapower JSONSerializableClass, as they shall also be saved and reloaded savely (see also the chapter Save and Load Networks).
Property Base Class¶
- class FluidProperty¶
Property Base Class
Property With Constant Value¶
- class FluidPropertyConstant(value, warn_dependent_variables=False)¶
Creates Property with a constant value.
- classmethod from_path(path)¶
Reads a text file with temperature values in the first column and property values in second column.
- Parameters
path –
- Returns
- Return type
- get_at_integral_value(upper_limit_arg, lower_limit_arg)¶
- Parameters
upper_limit_arg (float or list-like objects) – one or more values of upper limit values for which the function of the property should calculate the integral for
lower_limit_arg (float or list-like objects) – one or more values of lower limit values for which the function of the property should calculate the integral for
- Returns
integral between the limits
- Return type
float, array
- Example
>>> comp_fact = get_fluid(net).all_properties["heat_capacity"].get_at_integral_value( t_upper_k, t_lower_k)
- get_at_value(*args)¶
- Parameters
args (str) – Name of the property
- Returns
Value of the property
- Return type
float
- Example
>>> heat_capacity = get_fluid(net).all_properties["heat_capacity"].get_at_value(293.15)
Property With Linear Correlation¶
- class FluidPropertyLinear(slope, offset)¶
Creates Property with a linear course.
- classmethod from_path(path)¶
Reads a text file with temperature values in the first column and property values in second column.
- Parameters
path –
- Returns
- Return type
- get_at_integral_value(upper_limit_arg, lower_limit_arg)¶
- Parameters
upper_limit_arg (float or list-like objects) – one or more values of upper limit values for which the function of the property should calculate the integral for
lower_limit_arg (float or list-like objects) – one or more values of lower limit values for which the function of the property should calculate the integral for
- Returns
integral between the limits
- Return type
float, array
- Example
>>> comp_fact = get_fluid(net).all_properties["heat_capacity"].get_at_integral_value( t_upper_k, t_lower_k)
- get_at_value(arg)¶
- Parameters
arg (str, float or array) – Name of the property and one or more values (x-values) for which the function of the property should be calculated
- Returns
y-value or function values
- Return type
float, array
- Example
>>> comp_fact = get_fluid(net).all_properties["compressibility"].get_at_value(p_bar)
Property With Interpolated Measure Points¶
- class FluidPropertyInterExtra(x_values, y_values, method='interpolate_extrapolate')¶
Creates Property with interpolated or extrapolated values.
- classmethod from_path(path, method='interpolate_extrapolate')¶
Reads a text file with temperature values in the first column and property values in second column.
- Parameters
path (str) – Target path of the txt file
method (str) – Method with which the values are to be interpolated
- Returns
interpolated values
- Return type
- get_at_integral_value(upper_limit_arg, lower_limit_arg)¶
- Parameters
upper_limit_arg (float or list-like objects) – one or more values of upper limit values for which the function of the property should calculate the integral for
lower_limit_arg (float or list-like objects) – one or more values of lower limit values for which the function of the property should calculate the integral for
- Returns
integral between the limits
- Return type
float, array
- Example
>>> comp_fact = get_fluid(net).all_properties["heat_capacity"].get_at_integral_value( t_upper_k, t_lower_k)
- get_at_value(arg)¶
- Parameters
arg (str, float or array) – Name of the property and one or more values (x-values) for which the y-values of the property are to be displayed
- Returns
y-value/s
- Return type
float, array