Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6127af6
check for pandapower 3.4.1
SimonRubenDrauz Mar 1, 2026
25545e2
Merge branch 'develop' into chore/pp-3.4.1
SimonRubenDrauz Apr 17, 2026
b194bec
adapt pandapipes version to match format version
dlohmeier Apr 22, 2026
4d04467
bugfix
SimonRubenDrauz Apr 23, 2026
ef66e3d
bugfix
SimonRubenDrauz Apr 23, 2026
6eef2d6
release for pp 3.3.3
SimonRubenDrauz Apr 24, 2026
2594d0c
Merge branch 'develop' into chore/pp-3.3.3
SimonRubenDrauz Apr 24, 2026
ee2e3ff
add water components
SimonRubenDrauz Apr 24, 2026
58e8631
small bugfix
SimonRubenDrauz Apr 29, 2026
2b2a85c
increase version number
SimonRubenDrauz May 26, 2026
5c370fe
Merge branch 'develop' into develop
SimonRubenDrauz May 26, 2026
a8349f6
Merge branch 'e2nIEE:develop' into develop
jthurner Jul 6, 2026
a1d7509
Merge remote-tracking branch 'origin/develop' into chore/architecture
SimonRubenDrauz Jul 22, 2026
c882109
implementation of new architecture not requiring build_system_matrix.py
SimonRubenDrauz Aug 10, 2026
bcf027e
restructuring
SimonRubenDrauz Aug 10, 2026
755a9c9
remove area and scale jacobi matrix
SimonRubenDrauz Aug 13, 2026
28322ee
variable fix
SimonRubenDrauz Aug 13, 2026
a8c6530
better convergence
SimonRubenDrauz Aug 13, 2026
1ba3c14
create pipeflow calculation class and introduce idx-class
SimonRubenDrauz Aug 13, 2026
5d6ab63
refactoring
SimonRubenDrauz Aug 13, 2026
548dcce
bugfixes
SimonRubenDrauz Aug 17, 2026
6442381
sign bugfix and its consequence
SimonRubenDrauz Aug 17, 2026
89b7c02
fix colebrook bug
SimonRubenDrauz Aug 17, 2026
7e3254e
further cleanup and bugfix in ext_grid/circ_pump
SimonRubenDrauz Aug 18, 2026
fc69339
add tutorial
SimonRubenDrauz Aug 18, 2026
c8deed0
remove unnecessary entries
SimonRubenDrauz Aug 20, 2026
ccc63c8
remove unnecessary entries
SimonRubenDrauz Aug 20, 2026
692aa95
cleanup colebrook
SimonRubenDrauz Aug 20, 2026
e671e9e
cleanup colebrook
SimonRubenDrauz Aug 20, 2026
a556e6f
bugfix
SimonRubenDrauz Aug 20, 2026
cbe8056
bugfix
SimonRubenDrauz Aug 20, 2026
520a0a8
der_lambda-Tests
SimonRubenDrauz Aug 20, 2026
aed8b25
pruning component list (check if each component can handle its own bu…
SimonRubenDrauz Aug 20, 2026
78a1f63
fix sphinx failure
SimonRubenDrauz Aug 20, 2026
a71b4eb
fix sphinx failure
SimonRubenDrauz Aug 20, 2026
97a5ece
- reduce duplicated code
SimonRubenDrauz Aug 21, 2026
010d8ad
style bugfixes
SimonRubenDrauz Aug 21, 2026
5fbb6e7
ignore D213
SimonRubenDrauz Aug 21, 2026
dc51a54
style adaptions
SimonRubenDrauz Aug 22, 2026
03bfc50
further style fixes
SimonRubenDrauz Aug 22, 2026
9a3c81f
further required adaptions due to style
SimonRubenDrauz Aug 22, 2026
c868d9b
further style adaptions
SimonRubenDrauz Aug 22, 2026
864f6e6
further style adaptions
SimonRubenDrauz Aug 22, 2026
d3d820d
remove not required create_lookups call
SimonRubenDrauz Aug 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pydocstyle:
disable:
- D213

pylint:
options:
# This codebase assembles Jacobian/PIT entries in single functions that naturally handle many
# physical quantities (pressures, densities, derivatives, ...) as separate local variables and
# parameters - pylint's stock thresholds (15 locals / 5 args) are far below what that pattern
# needs. Bundling them into dicts/dataclasses purely to satisfy this metric would obscure the
# actual math rather than clarify it, so the limits are raised to comfortably cover the
# largest legitimate cases already in the codebase (39 locals, 13 positional args) instead.
max-locals: 45
max-args: 15
max-positional-arguments: 15
disable:
# `if not len(x):` shows up throughout as `x` is almost always a numpy array or pandas
# DataFrame, not a plain sequence - `if not x:` raises `ValueError: The truth value of an
# array/DataFrame with more than one element is ambiguous` for anything but a 0/1-length
# array. Pylint's suggested rewrite is only valid for plain Python sequences, so applying it
# here would introduce a real crash rather than fix a style nit.
- use-implicit-booleaness-not-len
11 changes: 7 additions & 4 deletions doc/source/pipeflow/internal_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ in the pipeflow setup and were not yet described:
.. _create_internal_results:
.. autofunction:: pandapipes.create_internal_results

.. _extract_all_results:
.. _create_lookups:
.. autofunction:: pandapipes.create_lookups

.. _create_junction:
.. _extract_all_results:
.. autofunction:: pandapipes.extract_all_results

.. _extract_results_active_pit:
.. autofunction:: pandapipes.extract_results_active_pit
.. _extract_results_active_pit_hydraulics:
.. autofunction:: pandapipes.pf.result_extraction.extract_results_active_pit_hydraulics

.. _extract_results_active_pit_heat_transfer:
.. autofunction:: pandapipes.pf.result_extraction.extract_results_active_pit_heat_transfer

.. _get_lookup:
.. autofunction:: pandapipes.get_lookup
Expand Down
8 changes: 5 additions & 3 deletions doc/source/pipeflow/pipeflow_procedure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ the help of the `scipy csgraph functionalities
connectivity check disconnected network areas can be set out of service automatically, reducing the
error-proneness of the calculation process.

.. autofunction:: pandapipes.pf.pipeflow_setup.check_connectivity
.. autofunction:: pandapipes.pf.pipeflow_setup.identify_active_nodes_branches


.. _internal_matrix:
Expand All @@ -98,7 +98,9 @@ The functions used to create the internal pit and extract results back from it a

.. autofunction:: pandapipes.pf.pipeflow_setup.reduce_pit

.. autofunction:: pandapipes.pf.result_extraction.extract_results_active_pit
Results are written back from the internal pit via
:func:`~pandapipes.pf.result_extraction.extract_results_active_pit_hydraulics` and
:func:`~pandapipes.pf.result_extraction.extract_results_active_pit_heat_transfer`.


.. _jacobian:
Expand Down Expand Up @@ -186,6 +188,6 @@ is the load vector.
expressed as a sparse matrix. More information can also be found in :cite:`Ferziger2002`.


.. autofunction:: pandapipes.pf.build_system_matrix.build_system_matrix
.. autofunction:: pandapipes.pf.calculation.solve_hydraulics


154 changes: 55 additions & 99 deletions src/pandapipes/component_models/abstract_models/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,99 +18,19 @@ class Component:
def table_name(cls):
raise NotImplementedError()

@classmethod
def init_results(cls, net):
"""
Function that intializes the result table for the component.

:param net: The pandapipes network
:type net: pandapipesNet
:return: No 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

@classmethod
def extract_results(cls, net, options, branch_results, mode):
"""
Function that extracts certain results.

:param net: The pandapipes network
:type net: pandapipesNet
:param options:
:type options:
:param branch_results:
:type branch_results:
:param mode:
:type mode:
:return: No Output.
"""
raise NotImplementedError

@classmethod
def get_component_input(cls):
"""

:return:
:rtype:
"""
raise NotImplementedError
"""Get component input.

@classmethod
def get_result_table(cls, net):
"""
Get result table.

:param net: a pandapipes net
:type net: pandapipes.pandapipesNet
:return:
:rtype:
"""
raise NotImplementedError

@classmethod
def adaption_before_derivatives_hydraulic(cls, net,
branch_pit, node_pit,
branch_pit_old, node_pit_old,
idx_lookups, options):
pass

@classmethod
def adaption_after_derivatives_hydraulic(cls, net,
branch_pit, node_pit,
branch_pit_old, node_pit_old,
idx_lookups, options):
pass

@classmethod
def adaption_before_derivatives_thermal(cls, net,
branch_pit, node_pit,
branch_pit_old, node_pit_old,
idx_lookups, options):
pass

@classmethod
def adaption_after_derivatives_thermal(cls, net,
branch_pit, node_pit,
branch_pit_old, node_pit_old,
idx_lookups, options):
pass

@classmethod
def rerun_hydraulics(cls, net, branch_pit, node_pit, idx_lookups, options):
return False

@classmethod
def rerun_thermal(cls, net, branch_pit, node_pit, idx_lookups, options):
return False

@classmethod
def create_node_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current_start,
current_table, internals):
"""
Function which creates node lookups.
"""Function which creates node lookups.

:param net: The pandapipes network
:type net: pandapipesNet
Expand All @@ -134,8 +54,7 @@ def create_node_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current
@classmethod
def create_branch_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current_start,
current_table, internals):
"""
Function which creates branch lookups.
"""Function which creates branch lookups.

:param net: The pandapipes network
:type net: pandapipesNet
Expand All @@ -156,11 +75,19 @@ def create_branch_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, curre
"""
return current_start, current_table

@classmethod
def register_pit_node_entries(cls, net, node_pit, registry) -> None:
pass

@classmethod
def register_pit_branch_entries(cls, net, branch_pit, node_pit, registry) -> None:
pass

@classmethod
def create_component_array(cls, net, component_pits):
"""
Function which creates an internal array of the component in analogy to the pit, but with
component specific entries, that are not needed in the pit.
"""Create an internal array of the component in analogy to the pit.

Holds component-specific entries that are not needed in the pit.

:param net: The pandapipes network
:type net: pandapipesNet
Expand All @@ -172,28 +99,57 @@ def create_component_array(cls, net, component_pits):
pass

@classmethod
def create_pit_node_entries(cls, net, node_pit):
"""
Function which creates pit branch entries.
def register_hydraulic_equations(cls, net, branch_pit, node_pit, sys_idx, registry):

@dlohmeier dlohmeier Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we could make this approach a little broader and ask the component to register the required equations (or rerun the simulation, see below) with a keyword desceibing the current simulation mode. Then implement the allowed simulation modes for each component. This way it would be possible to add simulation modes

  • in a subclass, the superclass call could be used and additional modes implemented in a simple way
  • external code could use this component model without having to rewrite too much code

The mode could be based on a string or a Literal.

pass

@classmethod
def register_thermal_equations(cls, net, branch_pit, node_pit, sys_idx, registry):
pass

@classmethod
def rerun_hydraulics(cls, net, branch_pit, node_pit, idx_lookups, options): # pylint: disable=unused-argument
return False

@classmethod
def rerun_thermal(cls, net, branch_pit, node_pit, idx_lookups, options): # pylint: disable=unused-argument
return False

@classmethod
def init_results(cls, net):
"""Function that intializes the result table for the component.

:param net: The pandapipes network
:type net: pandapipesNet
:param node_pit:
:type node_pit:
:return: No Output.
"""
pass
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

@classmethod
def create_pit_branch_entries(cls, net, branch_pit):
def get_result_table(cls, net):
"""Get result table.

:param net: a pandapipes net
:type net: pandapipes.pandapipesNet
:return:
:rtype:
"""
Function which creates pit branch entries.
raise NotImplementedError

@classmethod
def extract_results(cls, net, options, branch_results, mode):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in my above comment, calculation modes would make sense, here we already implemented this approach. We could adapt it once a concept is found for the above methods.

"""Function that extracts certain results.

:param net: The pandapipes network
:type net: pandapipesNet
:param branch_pit:
:type branch_pit:
:param options:
:type options:
:param branch_results:
:type branch_results:
:param mode:
:type mode:
:return: No Output.
"""
pass

raise NotImplementedError
59 changes: 22 additions & 37 deletions src/pandapipes/component_models/abstract_models/branch_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@
import numpy as np

from pandapipes.component_models.abstract_models.base_component import Component
from pandapipes.idx_branch import (
MDOTINIT,
branch_cols,
TEXT,
FLOW_RETURN_CONNECT,
)
from pandapipes.pf.pipeflow_setup import get_net_option
from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup
from pandapipes.idx_branch import IdxBranch
from pandapipes.component_models.component_toolbox import build_pit_entries
from pandapipes.pf.pipeflow_setup import get_net_option, get_table_number, get_lookup
from pandapipes.pf.system_index import PitEntries

try:
import pandaplan.core.pplog as logging
Expand All @@ -29,30 +25,25 @@ def table_name(cls):
raise NotImplementedError

@classmethod
def get_component_input(cls):
raise NotImplementedError
def active_identifier(cls):
raise NotImplementedError()

@classmethod
def get_result_table(cls, net):
def get_connected_node_type(cls):
raise NotImplementedError

@classmethod
def from_to_node_cols(cls):
raise NotImplementedError

@classmethod
def active_identifier(cls):
raise NotImplementedError()

@classmethod
def get_connected_node_type(cls):
def get_component_input(cls):
raise NotImplementedError

@classmethod
def create_branch_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current_start,
current_table, internals):
"""
Function which creates branch lookups.
"""Function which creates branch lookups.

:param net: The pandapipes network
:type net: pandapipesNet
Expand All @@ -74,30 +65,24 @@ def create_branch_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, curre
raise NotImplementedError

@classmethod
def create_pit_branch_entries(cls, net, branch_pit):
"""
Function which creates pit branch entries.

:param net: The pandapipes network
:type net: pandapipesNet
:param branch_pit:
:type branch_pit:
:return: No Output.
"""
node_pit = net["_pit"]["node"]
def register_pit_branch_entries(cls, net, branch_pit, node_pit, registry) -> None:
f, t = get_lookup(net, "branch", "from_to")[cls.table_name()]
branch_table_nr = get_table_number(get_lookup(net, "branch", "table"), cls.table_name())
branch_component_pit = branch_pit[f:t, :]
if not len(net[cls.table_name()]):
return branch_component_pit, node_pit
return

rows = np.arange(f, t, dtype=np.int32)

if not get_net_option(net, "transient") or get_net_option(net, "simulation_time_step") == 0:
branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (branch_cols - 1))
branch_component_pit[:, TEXT] = get_net_option(net, 'ambient_temperature')
branch_component_pit[:, FLOW_RETURN_CONNECT] = False
branch_table_nr = get_table_number(get_lookup(net, "branch", "table"), cls.table_name())
registry.add(PitEntries(*build_pit_entries(
rows,
[IdxBranch.TABLE_IDX],
[float(branch_table_nr)],
)))

branch_component_pit[:, MDOTINIT] = 0.1
return branch_component_pit, node_pit
@classmethod
def get_result_table(cls, net):
raise NotImplementedError

@classmethod
def extract_results(cls, net, options, branch_results, mode):
Expand Down
Loading
Loading