Skip to content

Commit

Permalink
Merge pull request #35 from e2nIEE/develop
Browse files Browse the repository at this point in the history
added badges for pypi and versions
  • Loading branch information
jkisse authored Apr 6, 2020
2 parents d98cf8f + d2387fb commit 4f75fb7
Show file tree
Hide file tree
Showing 28 changed files with 137 additions and 163 deletions.
4 changes: 2 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Lead Developers:
- Dennis Cronbach
- Daniel Lohmeier
- Simon Ruben Drauz
- Jolando Marius Kisse

Main Contributors:
- Tabea Trummel
- Michel Diesing
- Vanessa Kiesewetter
- Jolando Marius Kisse

Further Contributions by:
- Christian Spalthoff
- Daniel Then
- Marius Schenk

Coordination:
- Martin Braun
- Tanja Manuela Kneiske
- Martin Braun
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log
=============

[0.0.1] - 2020-03-18
[0.1.1] - 2020-04-03
-------------------------------
- [ADDED] badges for pypi and versions
- [CHANGED] result table initialization now in most cases only contains one DF creation call #42
- [CHANGED] from pandapower tempdir to pytest tmp_path in test
- [CHANGED] default orientation of sink and source collections to avoid overlapping
- [FIXED] missing images and typos in documentation

[0.1.0] - 2020-03-18
-------------------------------
- first release of pandapipes
7 changes: 5 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Contribute from your develop branch
#. Put in a Pull request to the main repository: https://help.github.com/articles/creating-a-pull-request-from-a-fork/

#. For each Pull request, some checks will start automatically. It is required that the travis-ci
check passes (i. e. all pandapipes tests pass) to enable merging into the develop branch.

#. If you want to amend the pull request (for example because tests are failing, or because the community/maintainers have asked for modifications), simply push more commits to the branch: ::

git add --all
Expand Down Expand Up @@ -125,10 +128,10 @@ Contribute from a feature branch
this pushes the new branch to your fork and also sets up the remote tracking.
#. Put in a Pull request to the official repository (see https://help.github.com/articles/creating-a-pull-request-from-a-fork/)
#. Put in a Pull request to the official repository (see https://help.github.com/articles/creating-a-pull-request-from-a-fork/).

#. For each Pull request, some checks will start automatically. It is required that the travis-ci
check passes (i. e. all pandapipes tests pass) to enable merging into the develop branch.
check passes (i. e. all pandapipes tests pass) to enable merging into the develop branch.

#. If you want to amend the pull request (for example because tests are failing, or because the community/maintainers have asked for modifications), simply push more commits to the branch. Since the remote tracking branch has been set up, this is as easy as: ::

Expand Down
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
:target: https://www.pandapipes.org
:alt: logo

.. .. image:: https://badge.fury.io/py/pandapipes.svg
:target: https://pypi.python.org/pypi/pandapipes
.. image:: https://badge.fury.io/py/pandapipes.svg
:target: https://badge.fury.io/py/pandapipes
:alt: PyPI

.. .. image:: https://img.shields.io/pypi/pyversions/pandapipes.svg
.. image:: https://img.shields.io/pypi/pyversions/pandapipes.svg
:target: https://pypi.python.org/pypi/pandapipes
:alt: versions

Expand Down Expand Up @@ -36,6 +36,7 @@
.. image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/e2nIEE/pandapipes/develop
:alt: binder


A pipeflow calculation tool that complements `pandapower <https://www.pandapower.org>`_ in the
Expand Down
14 changes: 8 additions & 6 deletions doc/source/components/pipe/pipe_component.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ The pressure loss for incompressible media is calculated according to the follow
:nowrap:
\begin{align*}
p_{loss} &= \rho \cdot g \cdot \Delta h - \frac{\rho \lambda(v) \cdot l v^2}{ 2 d} - \zeta \frac{\rho v^2}{2} \\
p_\text{loss} &= \rho \cdot g \cdot \Delta h - \frac{\rho \lambda(v) \cdot l v^2}{ 2 d} - \zeta
\frac{\rho v^2}{2} \\
\end{align*}


Expand Down Expand Up @@ -102,9 +103,13 @@ pressure drop for compressible media:
:nowrap:
\begin{align*}
dp_{loss} &= -\lambda(v) \frac{dl}{d} \cdot \frac{\rho_N v_N^2}{2}\cdot \frac{p_N}{p} \cdot \frac{T}{T_N} \cdot K \\
\text{d}p_\text{loss} &= -\lambda(v) \frac{\rho_N v_N^2}{2 d}\cdot \frac{p_N}{p} \cdot
\frac{T}{T_N} \cdot K \text{d}l \\
\end{align*}

The equation for pressure drop also introduces a variable K. This is the compressibility factor, which is used to
account for real gas behaviour.

After calculating the gas network, the pressure losses and velocities for the reference state are
known. During post processing, the reference velocities are recalculated according to

Expand All @@ -121,9 +126,6 @@ Because the velocity of a compressible fluid changes along the pipe axis, it is
several sections, increasing the internal resolution. The parameter *sections* is used to increase the amount of internal
pipe sections.

The equation for pressure drop also introduces a variable K. This is the compressibility factor, which is used to
account for real gas behaviour.



Friction models
Expand Down Expand Up @@ -185,7 +187,7 @@ The heat losses are described by
:nowrap:
\begin{align*}
Q_{loss} &= \alpha \cdot (T - T_{ext})\\
Q_\text{loss} &= \alpha \cdot (T - T_\text{ext})\\
\end{align*}
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# The short X.Y version.
version = "0.1"
# The full version, including alpha/beta/rc tags.
release = "0.1.0"
release = "0.1.1"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/fluid_properties/create_fluids.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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.
possible to work with the default fluids high or low caloric natural
gas (hgas or lgas), water and air. One of these default fluids can be created and added to an
existing network by calling the following function.

.. autofunction:: pandapipes.create_fluid_from_lib

Expand Down
10 changes: 5 additions & 5 deletions doc/source/fluid_properties/fluids.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ 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 water, air and
natural gas are implemented with default properties.
are defined by certain properties. In the fluid library currently high or low caloric natural
gas (hgas and lgas), water and air are implemented with default properties.


The Fluid Class
Expand All @@ -30,14 +30,14 @@ Properties
===========

The idea behind the properties is a functional correlation between physical
quantities, e.g. a linear correlation between pressure and temperature based on
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 IO
chapter).
JSONSerializableClass, as they shall also be saved and reloaded savely (see also the chapter Save
and Load Networks).


Property Base Class
Expand Down
File renamed without changes
12 changes: 6 additions & 6 deletions pandapipes/component_models/abstract_models/circulation_pump.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def get_connected_junction(cls, net):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
return [("mdot_kg_per_s", "f8"),
("deltap_bar", "f8")]
return ["mdot_kg_per_s", "deltap_bar"], True
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def extract_results(cls, net, options, node_name):
:type options:
:return: No Output.
"""
output = cls.get_result_table(net)
init_results_element(net, cls.table_name(), output)
output, all_float = cls.get_result_table(net)
init_results_element(net, cls.table_name(), output, all_float)
res_table = net["res_" + cls.table_name()]
return res_table

Expand Down
12 changes: 6 additions & 6 deletions pandapipes/component_models/abstract_models/const_flow_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def get_component_input(cls):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
output = [("mdot_kg_per_s", "f8")]
return output
return ["mdot_kg_per_s"], True
14 changes: 10 additions & 4 deletions pandapipes/component_models/auxiliaries/component_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def vrange(starts, lengths):
return cat_range


def init_results_element(net, element, output):
def init_results_element(net, element, output, all_float):
"""
:param net: The pandapipes network
Expand All @@ -72,12 +72,16 @@ def init_results_element(net, element, output):
:type element:
:param output:
:type output:
:param all_float:
:type all_float:
:return: No Output.
"""
res_element = "res_" + element
net.update({res_element: output})
if isinstance(net[res_element], list):
net[res_element] = pd.DataFrame(np.zeros(0, dtype=net[res_element]), index=[])
if all_float:
net[res_element] = pd.DataFrame(np.NAN, columns=output, index=net[element].index,
dtype=np.float64)
else:
net[res_element] = pd.DataFrame(np.zeros(0, dtype=output), index=[])
net[res_element] = pd.DataFrame(np.NaN, index=net[element].index,
columns=net[res_element].columns)

Expand Down Expand Up @@ -110,6 +114,8 @@ def add_new_component(net, component, overwrite=False):
net.update({name: comp_input})
if isinstance(net[name], list):
net[name] = pd.DataFrame(np.zeros(0, dtype=net[name]), index=[])
# init_empty_results_table(net, name, component.get_result_table(net))

if geodata is not None:
net.update({name + '_geodata': geodata})
if isinstance(net[name + '_geodata'], list):
Expand Down
11 changes: 6 additions & 5 deletions pandapipes/component_models/ext_grid_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ def get_component_input(cls):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
return [("mdot_kg_per_s", "f8")]
return ["mdot_kg_per_s"], True
42 changes: 13 additions & 29 deletions pandapipes/component_models/heat_exchanger_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,35 +193,19 @@ def get_component_input(cls):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
if get_fluid(net).is_gas:
output = [("v_from_m_per_s", "f8"),
("v_to_m_per_s", "f8"),
("v_mean_m_per_s", "f8"),
("p_from_bar", "f8"),
("p_to_bar", "f8"),
("t_from_k", "f8"),
("t_to_k", "f8"),
("mdot_from_kg_per_s", "f8"),
("mdot_to_kg_per_s", "f8"),
("vdot_norm_m3_per_s", "f8"),
("reynolds", "f8"),
("lambda", "f8"),
("normfactor_from", "f8"),
("normfactor_to", "f8")]
output = ["v_from_m_per_s", "v_to_m_per_s", "v_mean_m_per_s", "p_from_bar", "p_to_bar",
"t_from_k", "t_to_k", "mdot_from_kg_per_s", "mdot_to_kg_per_s",
"vdot_norm_m3_per_s", "reynolds", "lambda", "normfactor_from",
"normfactor_to"]
else:
output = [("v_mean_m_per_s", "f8"),
("p_from_bar", "f8"),
("p_to_bar", "f8"),
("t_from_k", "f8"),
("t_to_k", "f8"),
("mdot_from_kg_per_s", "f8"),
("mdot_to_kg_per_s", "f8"),
("vdot_norm_m3_per_s", "f8"),
("reynolds", "f8"),
("lambda", "f8")]
return output
output = ["v_mean_m_per_s", "p_from_bar", "p_to_bar", "t_from_k", "t_to_k",
"mdot_from_kg_per_s", "mdot_to_kg_per_s", "vdot_norm_m3_per_s", "reynolds",
"lambda"]
return output, True
12 changes: 6 additions & 6 deletions pandapipes/component_models/junction_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ def geodata(cls):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
return [("p_bar", "f8"),
("t_k", "f8")]
return ["p_bar", "t_k"], True
42 changes: 13 additions & 29 deletions pandapipes/component_models/pipe_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,38 +364,22 @@ def geodata(cls):
def get_result_table(cls, net):
"""
:param net:
:type net:
:return:
:rtype:
:param net: The pandapipes network
:type net: pandapipesNet
:return: (columns, all_float) - the column names and whether they are all float type. Only
if False, returns columns as tuples also specifying the dtypes
:rtype: (list, bool)
"""
if get_fluid(net).is_gas:
output = [("v_from_m_per_s", "f8"),
("v_to_m_per_s", "f8"),
("v_mean_m_per_s", "f8"),
("p_from_bar", "f8"),
("p_to_bar", "f8"),
("t_from_k", "f8"),
("t_to_k", "f8"),
("mdot_from_kg_per_s", "f8"),
("mdot_to_kg_per_s", "f8"),
("vdot_norm_m3_per_s", "f8"),
("reynolds", "f8"),
("lambda", "f8"),
("normfactor_from", "f8"),
("normfactor_to", "f8")]
output = ["v_from_m_per_s", "v_to_m_per_s", "v_mean_m_per_s", "p_from_bar", "p_to_bar",
"t_from_k", "t_to_k", "mdot_from_kg_per_s", "mdot_to_kg_per_s",
"vdot_norm_m3_per_s", "reynolds", "lambda", "normfactor_from",
"normfactor_to"]
else:
output = [("v_mean_m_per_s", "f8"),
("p_from_bar", "f8"),
("p_to_bar", "f8"),
("t_from_k", "f8"),
("t_to_k", "f8"),
("mdot_from_kg_per_s", "f8"),
("mdot_to_kg_per_s", "f8"),
("vdot_norm_m3_per_s", "f8"),
("reynolds", "f8"),
("lambda", "f8")]
return output
output = ["v_mean_m_per_s", "p_from_bar", "p_to_bar", "t_from_k", "t_to_k",
"mdot_from_kg_per_s", "mdot_to_kg_per_s", "vdot_norm_m3_per_s", "reynolds",
"lambda"]
return output, True

@classmethod
def plot_pipe(cls, net, pipe, pipe_results):
Expand Down
Loading

0 comments on commit 4f75fb7

Please sign in to comment.