Skip to content

Commit

Permalink
Merge pull request #607 from e2nIEE/develop
Browse files Browse the repository at this point in the history
release 0.10.0
  • Loading branch information
EPrade authored Apr 9, 2024
2 parents 0e74750 + 68bcf16 commit 7cca969
Show file tree
Hide file tree
Showing 112 changed files with 3,343 additions and 890 deletions.
6 changes: 3 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ exclude_lines =
pragma: no cover

omit =
pandapipes/test/*
pandapipes/plotting/geo.py
pandapipes/converter/stanet/data_cleaning.py
src/pandapipes/test/*
src/pandapipes/plotting/geo.py
src/pandapipes/converter/stanet/data_cleaning.py
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest nbmake pytest-xdist pytest-split igraph
python -m pip install pytest==8.0.2 nbmake pytest-xdist pytest-split igraph
if [${{ matrix.python-version != '3.11' }}]; then python -m pip install numba; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install git+https://github.com/e2nIEE/pandapower@develop#egg=pandapower
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest nbmake pytest-xdist pytest-split igraph
python -m pip install pytest==8.0.2 nbmake pytest-xdist pytest-split igraph
if [${{ matrix.python-version != '3.11' }}]; then python -m pip install numba; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install git+https://github.com/e2nIEE/pandapower@master#egg=pandapower
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
Change Log
=============

[0.10.0] - 2024-04-09
-------------------------------

- [ADDED] function for plotting pressure profile
- [ADDED] function for calculating distance to junctions
- [ADDED] topology function for returning unsupplied junctions
- [ADDED] topology function for returning elements on path
- [ADDED] function for getting all branch-component table names
- [ADDED] function for getting all branch-component models
- [ADDED] component 'heat_consumer' that combines the two components heat_exchanger and flow_control
- [CHANGED] moving generalizing pit entries up from specific components to the abstract class
- [CHANGED] 'JAC_DERIV_DT1' to 'JAC_DERIV_DTOUT'
- [CHANGED] solving for minit instead of vinit
- [CHANGED] distinct max. iteration settings for hydraulic and thermal calculation
- [CHANGED] default tolerances from 1e-4 to 1e-5
- [FIXED] results of old grid are wrong, pipeflow needs to be conducted again
- [FIXED] taking norm density instead of real density in Darcy-Weisbach equation
- [FIXED] in circulation pumps only junctions in-service are considered

[0.9.0] - 2023-12-22
-------------------------------

Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
# built documents.
#
# The short X.Y version.
version = "0.9"
version = "0.10"
# The full version, including alpha/beta/rc tags.
release = "0.9.0"
release = "0.10.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[metadata]
description-file = installation.rst
description_file = installation.rst
license_file = LICENSE
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

setup(
name='pandapipes',
version='0.9.0',
version='0.10.0',
author='Simon Ruben Drauz-Mauel, Daniel Lohmeier, Jolando Marius Kisse',
author_email='[email protected], [email protected], '
'[email protected]',
Expand All @@ -44,7 +44,7 @@
long_description_content_type='text/x-rst',
url='http://www.pandapipes.org',
license='BSD',
install_requires=["pandapower>=2.13.1", "matplotlib", "shapely"],
install_requires=["pandapower>=2.14.6", "matplotlib", "shapely"],
extras_require={"docs": ["numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex"],
"plotting": ["plotly", "igraph"],
"test": ["pytest", "pytest-xdist", "nbmake"],
Expand Down
4 changes: 2 additions & 2 deletions src/pandapipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

__version__ = '0.9.0'
__format_version__ = '0.8.0'
__version__ = '0.10.0'
__format_version__ = '0.10.0'

import pandas as pd
import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

from pandapipes.component_models.abstract_models.base_component import Component
from pandapipes.idx_branch import VINIT, branch_cols
from pandapipes.idx_branch import MDOTINIT, branch_cols
from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup

try:
Expand Down Expand Up @@ -88,7 +88,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
from_nodes = junction_idx_lookup[net[cls.table_name()][fn_col].values]
to_nodes = junction_idx_lookup[net[cls.table_name()][tn_col].values]
branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (branch_cols - 1))
branch_component_pit[:, VINIT] = 0.1
branch_component_pit[:, MDOTINIT] = 0.1
return branch_component_pit, node_pit, from_nodes, to_nodes

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import numpy as np

from pandapipes.component_models.abstract_models.branch_models import BranchComponent
from pandapipes.component_models.component_toolbox import set_entry_check_repeat
from pandapipes.idx_branch import ACTIVE, FROM_NODE, TO_NODE, RHO, ETA, CP, ELEMENT_IDX, TOUTINIT
from pandapipes.idx_node import L, node_cols, TINIT as TINIT_NODE
from pandapipes.component_models.component_toolbox import set_entry_check_repeat, vinterp, \
p_correction_height_air
from pandapipes.idx_branch import ACTIVE, FROM_NODE, FROM_NODE_T, TO_NODE, TO_NODE_T, TOUTINIT, ELEMENT_IDX, TOUTINIT
from pandapipes.idx_node import (L, node_cols, TINIT as TINIT_NODE, HEIGHT, PINIT, PAMB,
ACTIVE as ACTIVE_ND)
from pandapipes.pf.pipeflow_setup import add_table_lookup, get_lookup, get_table_number
from pandapipes.properties.fluids import get_fluid

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -158,6 +159,17 @@ def create_pit_node_entries(cls, net, node_pit):
junction_indices = get_lookup(net, "node", "index")[junction_table_name]
fj_nodes = junction_indices[from_junctions]
tj_nodes = junction_indices[to_junctions]

int_node_pit[:, HEIGHT] = vinterp(junction_pit[fj_nodes, HEIGHT],
junction_pit[tj_nodes, HEIGHT], int_node_number)
int_node_pit[:, PINIT] = vinterp(junction_pit[fj_nodes, PINIT],
junction_pit[tj_nodes, PINIT], int_node_number)
int_node_pit[:, TINIT_NODE] = vinterp(junction_pit[fj_nodes, TINIT_NODE],
junction_pit[tj_nodes, TINIT_NODE],
int_node_number)
int_node_pit[:, PAMB] = p_correction_height_air(int_node_pit[:, HEIGHT])
int_node_pit[:, ACTIVE_ND] = \
np.repeat(net[cls.table_name()][cls.active_identifier()].values, int_node_number)
return table_nr, int_node_number, int_node_pit, junction_pit, fj_nodes, tj_nodes

@classmethod
Expand Down Expand Up @@ -195,13 +207,10 @@ def create_pit_branch_entries(cls, net, branch_pit):
branch_w_internals_pit, ACTIVE, net[cls.table_name()][cls.active_identifier()].values,
internal_pipe_number, has_internals)
branch_w_internals_pit[:, FROM_NODE] = from_nodes
branch_w_internals_pit[:, FROM_NODE_T] = from_nodes
branch_w_internals_pit[:, TO_NODE] = to_nodes
branch_w_internals_pit[:, TO_NODE_T] = to_nodes
branch_w_internals_pit[:, TOUTINIT] = node_pit[to_nodes, TINIT_NODE]
tm = (node_pit[from_nodes, TINIT_NODE] + branch_w_internals_pit[:, TOUTINIT]) / 2
fluid = get_fluid(net)
branch_w_internals_pit[:, RHO] = fluid.get_density(tm)
branch_w_internals_pit[:, ETA] = fluid.get_viscosity(tm)
branch_w_internals_pit[:, CP] = fluid.get_heat_capacity(tm)
return branch_w_internals_pit, internal_pipe_number

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

from pandapipes.component_models.abstract_models.branch_models import BranchComponent

from pandapipes.idx_branch import FROM_NODE, TO_NODE, TOUTINIT, ELEMENT_IDX, RHO, ETA, CP, ACTIVE
from pandapipes.idx_branch import FROM_NODE, FROM_NODE_T, TO_NODE, TO_NODE_T, TOUTINIT, ELEMENT_IDX, ACTIVE
from pandapipes.idx_node import TINIT as TINIT_NODE

from pandapipes.pf.pipeflow_setup import add_table_lookup
from pandapipes.properties.fluids import get_fluid

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -81,13 +80,10 @@ def create_pit_branch_entries(cls, net, branch_pit):
= super().create_pit_branch_entries(net, branch_pit)
branch_wo_internals_pit[:, ELEMENT_IDX] = net[cls.table_name()].index.values
branch_wo_internals_pit[:, FROM_NODE] = from_nodes
branch_wo_internals_pit[:, FROM_NODE_T] = from_nodes
branch_wo_internals_pit[:, TO_NODE] = to_nodes
branch_wo_internals_pit[:, TO_NODE_T] = to_nodes
branch_wo_internals_pit[:, TOUTINIT] = node_pit[to_nodes, TINIT_NODE]
tm = (node_pit[from_nodes, TINIT_NODE] + branch_wo_internals_pit[:, TOUTINIT]) / 2
fluid = get_fluid(net)
branch_wo_internals_pit[:, RHO] = fluid.get_density(tm)
branch_wo_internals_pit[:, ETA] = fluid.get_viscosity(tm)
branch_wo_internals_pit[:, CP] = fluid.get_heat_capacity(tm)
branch_wo_internals_pit[:, ACTIVE] = net[cls.table_name()][cls.active_identifier()].values
return branch_wo_internals_pit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pandapipes.component_models.abstract_models.branch_wo_internals_models import \
BranchWOInternalsComponent
from pandapipes.idx_branch import LENGTH, K
from pandapipes.idx_branch import LENGTH, K, TEXT, ALPHA

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -58,6 +58,8 @@ def create_pit_branch_entries(cls, net, branch_pit):
super().create_pit_branch_entries(net, branch_pit)
branch_wzerolength_pit[:, LENGTH] = 0
branch_wzerolength_pit[:, K] = 1000
branch_wzerolength_pit[:, TEXT] = 293.15
branch_wzerolength_pit[:, ALPHA] = 0
return branch_wzerolength_pit

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def create_pit_node_entries(cls, net, node_pit):
"""
circ_pump_tbl = net[cls.table_name()][net[cls.table_name()][cls.active_identifier()].values]

junction = net[cls.table_name()][cls.from_to_node_cols()[1]].values
junction = circ_pump_tbl[cls.from_to_node_cols()[1]].values

# TODO: there should be a warning, if any p_bar value is not given or any of the types does
# not contain "p", as this should not be allowed for this component
Expand Down
6 changes: 3 additions & 3 deletions src/pandapipes/component_models/compressor_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pandapipes.component_models.component_toolbox import get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.component_models.pump_component import Pump
from pandapipes.idx_branch import VINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_branch import MDOTINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_node import PINIT, PAMB


Expand Down Expand Up @@ -76,8 +76,8 @@ def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lo
p_to_calc = p_from * compressor_array[:, cls.PRESSURE_RATIO]
pl_abs = p_to_calc - p_from

v_mps = compressor_branch_pit[:, VINIT]
pl_abs[v_mps < 0] = 0 # force pressure lift = 0 for reverse flow
m_mps = compressor_branch_pit[:, MDOTINIT]
pl_abs[m_mps < 0] = 0 # force pressure lift = 0 for reverse flow

compressor_branch_pit[:, PL] = pl_abs

Expand Down
11 changes: 5 additions & 6 deletions src/pandapipes/component_models/flow_control_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import numpy as np
from numpy import dtype

from pandapipes.component_models.abstract_models import BranchWZeroLengthComponent, get_fluid
from pandapipes.component_models.abstract_models import BranchWZeroLengthComponent
from pandapipes.properties import get_fluid
from pandapipes.component_models.component_toolbox import \
standard_branch_wo_internals_result_lookup, get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import D, AREA, JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DV, VINIT, \
RHO, LOAD_VEC_BRANCHES
from pandapipes.idx_branch import D, AREA, JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, MDOTINIT, LOAD_VEC_BRANCHES
from pandapipes.pf.result_extraction import extract_branch_results_without_internals


Expand Down Expand Up @@ -51,8 +51,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
fc_branch_pit = super().create_pit_branch_entries(net, branch_pit)
fc_branch_pit[:, D] = net[cls.table_name()].diameter_m.values
fc_branch_pit[:, AREA] = fc_branch_pit[:, D] ** 2 * np.pi / 4
fc_branch_pit[:, VINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values / \
(fc_branch_pit[:, AREA] * fc_branch_pit[:, RHO])
fc_branch_pit[:, MDOTINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values

@classmethod
def create_component_array(cls, net, component_pits):
Expand Down Expand Up @@ -83,7 +82,7 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
active = fc_array[:, cls.CONTROL_ACTIVE].astype(np.bool_)
fc_branch_pit[active, JAC_DERIV_DP] = 0
fc_branch_pit[active, JAC_DERIV_DP1] = 0
fc_branch_pit[active, JAC_DERIV_DV] = 1
fc_branch_pit[active, JAC_DERIV_DM] = 1
fc_branch_pit[active, LOAD_VEC_BRANCHES] = 0

@classmethod
Expand Down
Loading

0 comments on commit 7cca969

Please sign in to comment.