Skip to content

Commit

Permalink
Merge branch 'develop' into custom_components
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranz13 authored Nov 8, 2024
2 parents 42775e4 + 464fb63 commit 78594f1
Show file tree
Hide file tree
Showing 10 changed files with 1,044 additions and 10 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
Change Log
=============

- [FIXED] some imports from pandapower
[0.11.0] - 2024-11-07
-------------------------------
- [ADDED] heat_consumer plotting
- [ADDED] variable "u_w_per_m2k" to std_type pipe
- [ADDED] standard district heating pipe types
- [ADDED] support for Python 3.12
- [ADDED] t_outlet_k to result tables of branch components
- [ADDED] relying tests, to check the ability to work with pandapower develop
- [ADDED] bidirectional calculation mode for heat calculations
- [CHANGED] heat_consumer to enable temperature control
- [CHANGED] switched from setup.py to pyproject.toml
- [CHANGED] variable "alpha_w_per_m2k" to "u_w_per_m2k"
- [CHANGED] option "all" for pipeflow heat calculations to "sequential", the new option is "bidirectional"
- [CHANGED] volume flow in result tables instead of normalized volume flow for non gas fluids
- [CHANGED] introduction of slack mass flow into nodes as solved variable
- [CHANGED] circulation pumps are now branches and thus cannot generate or consume mass
- [FIXED] Pressure plot not working for circ pump
- [FIXED] volume flow rate for incompressible fluids based on real density, thus in this case results are renamed from "vdot_norm_m3_per_s" to "vdot_m3_per_s"
- [FIXED] some imports from pandapower
- [FIXED] NAN to nan because of numpy changes
- [FIXED] if velocity in a branch is negative to get corrected nodes from the branch pit
- [FIXED] plot pressure profile not working for circulation pump sources
- [FIXED] Infeed switches are considered correctly
- [FIXED] Heat consumers with qext_w = 0 and temperature control ignore temperature set points
- [FIXED] alpha also applied to mdot
- [REMOVED] support for Python 3.8 due to EOL


Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"

[project]
name = "pandapipes"
version = "0.10.0" # File format version '__format_version__' is tracked in __init__.py
version = "0.11.0" # File format version '__format_version__' is tracked in __init__.py
authors=[
{ name = "Simon Ruben Drauz-Mauel", email = "[email protected]" },
{ name = "Daniel Lohmeier", email = "[email protected]" },
{ name = "Jolando Marius Kisse", email = "[email protected]" }
]
description = "A pipeflow calculation tool that complements pandapower in the simulation of multi energy grids"
readme = "README.md"
readme = "README.rst"
license = { file = "LICENSE" }
requires-python = ">=3.9"
classifiers = [
Expand All @@ -32,7 +32,7 @@ classifiers = [
"Programming Language :: Python :: 3.12"
]
dependencies = [
"pandapower ~= 2.14.6",
"pandapower ~= 2.14.11",
"matplotlib",
"shapely",
]
Expand Down
2 changes: 1 addition & 1 deletion src/pandapipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import importlib.metadata

__version__ = importlib.metadata.version("pandapipes")
__format_version__ = '0.10.1'
__format_version__ = '0.11.0'

import pandas as pd
import os
Expand Down
14 changes: 13 additions & 1 deletion src/pandapipes/component_models/heat_consumer_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
standard_branch_wo_internals_result_lookup)
from pandapipes.idx_branch import (MDOTINIT, QEXT, JAC_DERIV_DP1, JAC_DERIV_DM,
JAC_DERIV_DP, LOAD_VEC_BRANCHES, TOUTINIT, JAC_DERIV_DT,
JAC_DERIV_DTOUT, LOAD_VEC_BRANCHES_T)
JAC_DERIV_DTOUT, LOAD_VEC_BRANCHES_T, ACTIVE)
from pandapipes.idx_node import TINIT
from pandapipes.pf.internals_toolbox import get_from_nodes_corrected
from pandapipes.pf.pipeflow_setup import get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_without_internals
from pandapipes.properties.properties_toolbox import get_branch_cp

try:
import pandaplan.core.pplog as logging
except ImportError:
import logging

logger = logging.getLogger(__name__)

class HeatConsumer(BranchElementComponent):
"""
Expand Down Expand Up @@ -56,6 +62,12 @@ def create_pit_branch_entries(self, net, branch_pit):
hc_pit[~isnan(mdot), MDOTINIT] = mdot[~isnan(mdot)]
treturn = net[self.table_name].treturn_k.values
hc_pit[~isnan(treturn), TOUTINIT] = treturn[~isnan(treturn)]
mask_q0 = qext == 0 & isnan(mdot)
if any_(mask_q0):
hc_pit[mask_q0, ACTIVE] = False
logger.warning(r'qext_w is equals to zero for heat consumers with index %s. '
r'Therefore, the defined temperature control cannot be maintained.' \
%net[self.table_name].index[mask_q0])
return hc_pit

def create_component_array(self, net, component_pits):
Expand Down
1 change: 1 addition & 0 deletions src/pandapipes/pf/derivative_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def calculate_derivatives_hydraulic(net, branch_pit, node_pit, options):


def calculate_derivatives_thermal(net, branch_pit, node_pit, _):
node_pit[:, INFEED] = False
fluid = get_fluid(net)
cp = get_branch_cp(fluid, node_pit, branch_pit)
m_init_i = np.abs(branch_pit[:, MDOTINIT])
Expand Down
4 changes: 3 additions & 1 deletion src/pandapipes/pf/pipeflow_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,10 @@ def reduce_pit(net, mode="hydraulics"):

def check_infeed_number(node_pit):
slack_nodes = node_pit[:, NODE_TYPE_T] == T
if len(node_pit) == 1:
node_pit[slack_nodes, INFEED] = True
infeed_nodes = node_pit[:, INFEED]
if sum(infeed_nodes) != sum(slack_nodes):
if np.sum(infeed_nodes) != np.sum(slack_nodes):
raise PipeflowNotConverged(r'The number of infeeding nodes and slacks do not match')


Expand Down
2 changes: 1 addition & 1 deletion src/pandapipes/pipeflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def solve_hydraulics(net):

x = spsolve(jacobian, epsilon)

branch_pit[:, MDOTINIT] -= x[len(node_pit):len(node_pit) + len(branch_pit)]
branch_pit[:, MDOTINIT] -= x[len(node_pit):len(node_pit) + len(branch_pit)] * options["alpha"]
node_pit[:, PINIT] -= x[:len(node_pit)] * options["alpha"]
node_pit[slack_nodes, MDOTSLACKINIT] -= x[len(node_pit) + len(branch_pit):]

Expand Down
460 changes: 460 additions & 0 deletions src/pandapipes/test/api/old_versions/example_0.11.0_gas.json

Large diffs are not rendered by default.

Loading

0 comments on commit 78594f1

Please sign in to comment.