Like pandapower, also pandapipes provides different standard libraries to simplify the workflow. In comparison with pandapower, pandapipes does not only provide a component library, but also a fluid library. After the pandapipes installation, this library already contains several fluids. Of course, it is also possible to define new fluids and add them to the library.
This tutorial demonstrates the usage with the libraries and shows, how components and fluids can be loaded and saved. We start with a tutorial on the component library. This library contains pipes and pumps.
With the function "get_data", which is defined in the module std_type_toolbox, all entries in the library can be displayed. Necessary parameters include the path to the library file and the type of the component. In the following section, the pipe entries are plotted.
from pandapipes.std_types.std_type_toolbox import get_data print(get_data(r'../pandapipes/std_types/library/Pipe.csv', 'pipe'))
std_type 80_GGG 100_GGG 125_GGG 150_GGG 200_GGG 250_GGG \ nominal_width_mm 80 100 125 150 200 250 outer_diameter_mm 98 118 144 170 222 274 inner_diameter_mm 86 105.8 131.6 157 208 259 standard_dimension_ratio 16.33 19.34 23.23 26.15 31.71 36.53 material GGG GGG GGG GGG GGG GGG std_type 300_GGG 350_GGG 400_GGG 500_GGG ... 600_ST<16 \ nominal_width_mm 300 350 400 500 ... 600 outer_diameter_mm 326 378 429 532 ... 610 inner_diameter_mm 310 361 411 512 ... 597.4 standard_dimension_ratio 40.75 44.47 47.67 53.2 ... 96.83 material GGG GGG GGG GGG ... ST std_type 700_ST<16 800_ST<16 900_ST<16 1000_ST<16 1200_ST<16 \ nominal_width_mm 700 800 900 1000 1200 outer_diameter_mm 711 813 914 1016 1220 inner_diameter_mm 696.8 797 894 996 1198 standard_dimension_ratio 100.14 101.62 91.4 101.6 110.91 material ST ST ST ST ST std_type 1400_ST<16 1600_ST<16 1800_ST<16 2000_ST<16 nominal_width_mm 1400 1600 1800 2000 outer_diameter_mm 1420 1620 1820 2020 inner_diameter_mm 1398 1588 1785 1980 standard_dimension_ratio 129.09 101.25 104 101 material ST ST ST ST [5 rows x 220 columns]
The csv files can be extended. We will now create an example network using components from the library.
import pandapipes as pp net = pp.create_empty_network(fluid="water") junction1 = pp.create_junction(net, pn_bar=1.0, tfluid_k=293.15, name="Connection to External Grid") junction2 = pp.create_junction(net, pn_bar=1.0, tfluid_k=293.15, name="Junction") junction3 = pp.create_junction(net, pn_bar=1.0, tfluid_k=293.15, name="Junction to sink") medium_pressure_grid = pp.create_ext_grid(net, junction=junction1, p_bar=1, t_k=293.15, name="Grid Connection") sink = pp.create_sink(net, junction=junction3, mdot_kg_per_s=23.05, name="Sink")
In the code above, a pipe connection is missing between junction1 and junction2. We load the pipe type "300_GGG" from the library using the function "create_pipe". Compared to the function "create_pipe_from_parameters" a parameter with a library reference can be specified.
pipe1 = pp.create_pipe(net, from_junction=junction2, to_junction=junction3, length_km=1, std_type="300_GGG", name="Pipe 1")
Between the external grid and the pipe, there is also a connection missing. This one will be defined using a pump component. The pressure difference is defined based on the underlying pump curve.
P1 = pp.create_pump(net, from_junction=junction1, to_junction=junction2, std_type="P1")
The network can be computed as usual.
The pump raises the pressure to 4 bar. We can check this by having a look at the pump curve.
We notice that the pressure rais of 4 bar corresponds to a volume flow of 83 m^3/h. This volume flow is also defined at the sink.
In the introductory example, the fluid is added via a parameter of the create_empty_network function. Internally, pandapipes fetches the corresponding fluid properties, which are saved for the specified fluid. Some of the predefined fluids are
For the calculation of pressure and flow velocity the density and viscosity has to be known. In case of gas calculations, these fluid properties can be dependend on temperature. If the temperature is calculated, further material properties may be needed, for example the heat capacity of the fluid.
An overview of defined fluid properties is given in the directory pandapipes\properties. In the directory of each fluid, you can find the fluid properties. Each property is described by a text file. This file contains data points. During the calculation, pandapipes interpolates between these points.
If you want to know which properties are defined in the current net container, you can use the function get_property().
The second parameter is the temperature, at which the density is displayed.
New fluids can be created or existing fluids modified. The mentioned fluids so far were dependent on temperature. We will now create an incompressible fluid with constant material properties and add it to the net.
In a first step, the material properties are created. These properties are then added to a fluid container. The data structures used to describe properties and fluids are pythin classes.
import pandapipes.properties.fluids as fl density_const = fl.FluidPropertyConstant(900) viscosity_const = fl.FluidPropertyConstant(0.002) heat_capacity_const = fl.FluidPropertyConstant(4000)
The three properties density, viscosity and heat capacity have to be defined. For every property, an object of the class FluidPropertyConstant is created and the constant property value is used in the object constructor. All properties have to be entered using SI units.
Although constant properties are added here, pandapipes also provides classes for inter- and extrapolating properties.
Afterwards, a fluid container is created and the properties are added.
water_const = fl.Fluid("water_const","liquid") water_const.add_property(property_name="density",prop=density_const) water_const.add_property(property_name="viscosity",prop=viscosity_const) water_const.add_property(property_name="heat_capacity",prop= heat_capacity_const)
The fluid can now be used to calculate incompressible media. With the command ...:
... the fluid is added to the net container. By plotting again the fluid properties, we see that the old fluid has been replaced.