For the installation of pandapipes it is necessary to install pandapower first. For the installation please follow the detailed instructions which can be found on the pandapower website.
The easiest way to install pandapipes is through pip:
Open a command prompt (e.g. start –> cmd on windows systems)
Install pandapipes by running:
pip install pandapipes
If you don’t have internet access on your system or don’t want to use pip for some other reason, pandapipes can also be installed without using pip:
- Download and unzip the current pandapipes distribution from PyPi under “Download files”.
Open a command prompt (e.g. start –> cmd on windows systems) and navigate to the folder that contains the setup.py file with the command cd <folder> :
Install pandapipes by running :
python setup.py install
To install the latest development version of pandapipes from github, simply follow these steps:
Download and install git.
Open a git shell and navigate to the directory where you want to keep your pandapipes files.
Run the following git command:
git clone https://github.com/e2nIEE/pandapipes.git
Navigate inside the repository and check out the develop branch:
cd pandapipes git checkout develop
Open a command prompt (cmd or anaconda command prompt) and navigate to the folder where the pandapipes files are located. Run:
pip install -e .
This registers your local pandapipes installation with pip.
A first basic way to test your installation is to import all pandapower submodules to see if all dependencies are available:
import pandapipes import pandapipes.plotting import pandapipes.timeseries import pandapipes.networks import pandapipes.io import pandapipes.control import pandapipes.component_models
If you want to be really sure that everything works fine, run the pandapower test suite:
Install pytest if it is not yet installed on your system:
pip install pytest
Run the pandapower test suite:
import pandapipes.test pandapipes.test.run_tests()
If everything is installed correctly, all tests should pass or xfail (expected to fail).
A network in pandapipes is represented in a pandapipesNet object, which is a collection of pandas Dataframes. Each dataframe in a pandapipesNet contains the information about one pandapipes element, such as pipe, junction, sink, etc.
We consider the following simple example network as a minimal example:
Creating a network
The above network can be created in pandapipes as follows:
import pandapipes as pp #create empty net net = pp.create_empty_network(fluid="lgas") #create junctions j1 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 1") j2 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 2") j3 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 3") #create junction elements ext_grid = pp.create_ext_grid(net, junction=j1, p_bar=1.1, t_k=293.15, name="Grid Connection") sink = pp.create_sink(net, junction=j3, mdot_kg_per_s=0.045, name="Sink") #create branch elements pipe = pp.create_pipe_from_parameters(net, from_junction=j1, to_junction=j2, length_km=0.1, diameter_m=0.05, name="Pipe") valve = pp.create_valve(net, from_junction=j2, to_junction=j3, diameter_m=0.05, opened=True, name="Valve")
The pandapipes representation now looks like this:
Running a Pipe Flow
A pipeflow can be carried out with the pipeflow function:
When a pipeflow is run, pandapipes combines the information of all element tables and calculates the current state of the network. Afterwards, results are written into the result tables.
This minimal example is also available as a jupyter notebook.
There are jupyter notebook tutorials on different functionalities of pandapipes. They can be viewed as static tutorials on github or as interactive tutorials via Binder. Interactive tutorials take a moment to load.
- Minimal example hydraulic calculation (static / interactive)
- Creating a simple gas or water network (static / interactive)
- Minimal example temperature calculation (static / interactive)
- Creating a simple heating network (static / interactive)
- Introduction to Plotting (static / interactive)
More tutorials will be added soon.