Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props norm #597

Merged
merged 46 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9427b6a
moved test data
SimonRubenDrauz Feb 23, 2024
603efc0
- working with mass
SimonRubenDrauz Feb 23, 2024
2402b20
bug in convert format
SimonRubenDrauz Feb 23, 2024
1466dac
changes in checking compatibility between different versions
SimonRubenDrauz Feb 23, 2024
797fcb6
changes in data path
SimonRubenDrauz Feb 23, 2024
070d683
result changes due to norm state
SimonRubenDrauz Feb 23, 2024
dff95f7
result changes due to norm state
SimonRubenDrauz Feb 23, 2024
7ea93b4
imporve readability and consider changes from v to m
SimonRubenDrauz Feb 23, 2024
56b6e5e
required for single values
SimonRubenDrauz Feb 23, 2024
0057c45
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
d3f2fc9
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
b5e3740
import error
SimonRubenDrauz Feb 23, 2024
3fb9cc0
increase number of iterations
SimonRubenDrauz Feb 23, 2024
faa7b49
still required todo
SimonRubenDrauz Feb 23, 2024
3db61c1
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
aa8501c
small adaptions for cleaner coding
SimonRubenDrauz Mar 4, 2024
3a9986d
handle also small masses
SimonRubenDrauz Mar 4, 2024
a9f038d
make sure to find tutorials folder
SimonRubenDrauz Mar 4, 2024
58fd7b5
nbmake bug due to pytest 8.1.0 upgrade
SimonRubenDrauz Mar 4, 2024
fa8e21b
bugfix
SimonRubenDrauz Mar 4, 2024
4cb50a7
remove unnecessary fluid call
SimonRubenDrauz Mar 4, 2024
f26a51a
scientific writing, improve readibility
SimonRubenDrauz Mar 4, 2024
7a16a7a
use correct density for volume flow
SimonRubenDrauz Mar 4, 2024
940bc79
removed unused import
SimonRubenDrauz Mar 4, 2024
e3ca2e3
use enumerate
SimonRubenDrauz Mar 4, 2024
357f5aa
renamed MINIT into MDOTINIT
SimonRubenDrauz Mar 4, 2024
ac54e41
solve WARNINGs
SimonRubenDrauz Mar 4, 2024
63b0877
remove TOUTINIT from heat_exchanger as not required
SimonRubenDrauz Mar 27, 2024
2cf7c1e
- adding max_iter_hyd and max_iter_therm instead of iter
SimonRubenDrauz Mar 27, 2024
3605844
- consider the max iter number correctly
SimonRubenDrauz Mar 27, 2024
5e0b8f4
max_iter_hydr in stanet comparison instead of iter
SimonRubenDrauz Mar 27, 2024
4988eb0
type np.int32 instead of int
SimonRubenDrauz Mar 27, 2024
09d12ba
take correct density in norm volume
SimonRubenDrauz Mar 27, 2024
0c60e92
replace iter by max_iter_hyd
SimonRubenDrauz Mar 27, 2024
f92fe68
correct derivations in the derivative toolbox, consideration of the n…
SimonRubenDrauz Apr 3, 2024
35c56e0
bugfix
SimonRubenDrauz Apr 3, 2024
77c83e5
- removed todo
SimonRubenDrauz Apr 4, 2024
dc106eb
- remove todo as obsolete
SimonRubenDrauz Apr 4, 2024
2968c25
use FROM_NODE_T and TO_NODE_T for density, eta and cp calculation dur…
SimonRubenDrauz Apr 8, 2024
155e9fe
Merge remote-tracking branch 'origin/develop' into props_norm
SimonRubenDrauz Apr 8, 2024
22f80a0
considering - for delta x and not in build_system_matrix.py in regard…
SimonRubenDrauz Apr 9, 2024
17735d2
differentiating between max_iter_hyd and max_iter_therm and iter. ite…
SimonRubenDrauz Apr 9, 2024
912137b
Merge remote-tracking branch 'origin/develop' into props_norm
SimonRubenDrauz Apr 9, 2024
3a9c5a2
in heat consumer considering change from vinit to minit
SimonRubenDrauz Apr 9, 2024
8ea8504
bugfix in tutorials
SimonRubenDrauz Apr 9, 2024
5b5547c
bugfix in tutorials
SimonRubenDrauz Apr 9, 2024
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
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 MINIT, 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[:, MINIT] = 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 @@ -6,10 +6,9 @@

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_branch import ACTIVE, FROM_NODE, TO_NODE, TOUTINIT, ELEMENT_IDX
from pandapipes.idx_node import L, node_cols, TINIT as TINIT_NODE
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 @@ -197,11 +196,6 @@ def create_pit_branch_entries(cls, net, branch_pit):
branch_w_internals_pit[:, FROM_NODE] = from_nodes
branch_w_internals_pit[:, TO_NODE] = 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,7 +4,7 @@

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, TO_NODE, TOUTINIT, ELEMENT_IDX, ACTIVE
from pandapipes.idx_node import TINIT as TINIT_NODE

from pandapipes.pf.pipeflow_setup import add_table_lookup
Expand Down Expand Up @@ -83,11 +83,6 @@ def create_pit_branch_entries(cls, net, branch_pit):
branch_wo_internals_pit[:, FROM_NODE] = from_nodes
branch_wo_internals_pit[:, TO_NODE] = 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
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 MINIT, 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[:, MINIT]
pl_abs[m_mps < 0] = 0 # force pressure lift = 0 for reverse flow

compressor_branch_pit[:, PL] = pl_abs

Expand Down
8 changes: 3 additions & 5 deletions src/pandapipes/component_models/flow_control_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
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, MINIT, LOAD_VEC_BRANCHES
from pandapipes.pf.result_extraction import extract_branch_results_without_internals


Expand Down Expand Up @@ -51,8 +50,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[:, MINIT] = 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 +81,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
4 changes: 1 addition & 3 deletions src/pandapipes/component_models/junction_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from numpy import dtype
from pandapipes.component_models.abstract_models.node_models import NodeComponent
from pandapipes.component_models.component_toolbox import p_correction_height_air
from pandapipes.idx_node import L, ELEMENT_IDX, RHO, PINIT, node_cols, HEIGHT, TINIT, PAMB, \
from pandapipes.idx_node import L, ELEMENT_IDX, PINIT, node_cols, HEIGHT, TINIT, PAMB, \
ACTIVE as ACTIVE_ND
from pandapipes.pf.pipeflow_setup import add_table_lookup, get_table_number, \
get_lookup
from pandapipes.properties.fluids import get_fluid


class Junction(NodeComponent):
Expand Down Expand Up @@ -83,7 +82,6 @@ def create_pit_node_entries(cls, net, node_pit):
junction_pit[:, HEIGHT] = junctions.height_m.values
junction_pit[:, PINIT] = junctions.pn_bar.values
junction_pit[:, TINIT] = junctions.tfluid_k.values
junction_pit[:, RHO] = get_fluid(net).get_density(junction_pit[:, TINIT])
junction_pit[:, PAMB] = p_correction_height_air(junction_pit[:, HEIGHT])
junction_pit[:, ACTIVE_ND] = junctions.in_service.values

Expand Down
17 changes: 8 additions & 9 deletions src/pandapipes/component_models/pipe_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from pandapipes.component_models.junction_component import Junction
from pandapipes.constants import NORMAL_TEMPERATURE, NORMAL_PRESSURE
from pandapipes.idx_branch import FROM_NODE, TO_NODE, LENGTH, D, AREA, K, \
VINIT, ALPHA, QEXT, TEXT, LOSS_COEFFICIENT as LC
from pandapipes.idx_node import PINIT, HEIGHT, TINIT as TINIT_NODE, \
RHO as RHO_NODES, PAMB, ACTIVE as ACTIVE_ND
MINIT, ALPHA, QEXT, TEXT, LOSS_COEFFICIENT as LC
from pandapipes.idx_node import PINIT, HEIGHT, TINIT as TINIT_NODE, PAMB, ACTIVE as ACTIVE_ND
from pandapipes.pf.pipeflow_setup import get_fluid, get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_with_internals, \
extract_branch_results_without_internals
Expand Down Expand Up @@ -115,7 +114,6 @@ def create_pit_node_entries(cls, net, node_pit):
junction_pit[tj_nodes, TINIT_NODE],
int_node_number)
int_node_pit[:, PAMB] = p_correction_height_air(int_node_pit[:, HEIGHT])
int_node_pit[:, RHO_NODES] = get_fluid(net).get_density(int_node_pit[:, TINIT_NODE])
int_node_pit[:, ACTIVE_ND] = \
np.repeat(net[cls.table_name()][cls.active_identifier()].values, int_node_number)

Expand Down Expand Up @@ -152,6 +150,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
pipe_pit, LC, net[tbl].loss_coefficient.values, internal_pipe_number, has_internals)

pipe_pit[:, AREA] = pipe_pit[:, D] ** 2 * np.pi / 4
pipe_pit[:, MINIT] *= pipe_pit[:, AREA] * get_fluid(net).get_density(NORMAL_TEMPERATURE)

@classmethod
def extract_results(cls, net, options, branch_results, mode):
Expand Down Expand Up @@ -226,22 +225,22 @@ def get_internal_results(cls, net, pipe):
selected_indices_v_final = np.logical_or.reduce(selected_indices_v[:])

p_nodes = int_p_lookup[:, 1][selected_indices_p_final]
v_nodes = int_v_lookup[:, 1][selected_indices_v_final]
m_nodes = int_v_lookup[:, 1][selected_indices_v_final]

v_pipe_data = pipe_pit[v_nodes, VINIT]
v_pipe_data = pipe_pit[m_nodes, MINIT] / fluid.get_density(NORMAL_TEMPERATURE) / pipe_pit[m_nodes, AREA]
p_node_data = node_pit[p_nodes, PINIT]
t_node_data = node_pit[p_nodes, TINIT_NODE]

gas_mode = fluid.is_gas

if gas_mode:
from_nodes = pipe_pit[v_nodes, FROM_NODE].astype(np.int32)
to_nodes = pipe_pit[v_nodes, TO_NODE].astype(np.int32)
from_nodes = pipe_pit[m_nodes, FROM_NODE].astype(np.int32)
to_nodes = pipe_pit[m_nodes, TO_NODE].astype(np.int32)
p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT]
p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
p_mean = np.where(p_from == p_to, p_from,
2 / 3 * (p_from ** 3 - p_to ** 3) / (p_from ** 2 - p_to ** 2))
numerator = NORMAL_PRESSURE * node_pit[v_nodes, TINIT_NODE]
numerator = NORMAL_PRESSURE * node_pit[m_nodes, TINIT_NODE]
normfactor_mean = numerator * fluid.get_property("compressibility", p_mean) \
/ (p_mean * NORMAL_TEMPERATURE)
normfactor_from = numerator * fluid.get_property("compressibility", p_from) \
Expand Down
4 changes: 2 additions & 2 deletions src/pandapipes/component_models/pressure_control_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
BranchWZeroLengthComponent
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import D, AREA, \
JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DV, BRANCH_TYPE, LOSS_COEFFICIENT as LC
JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, BRANCH_TYPE, LOSS_COEFFICIENT as LC
from pandapipes.idx_node import PINIT, NODE_TYPE, PC
from pandapipes.pf.pipeflow_setup import get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_without_internals
Expand Down Expand Up @@ -77,7 +77,7 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
pc_branch = press_pit[:, BRANCH_TYPE] == PC
press_pit[pc_branch, JAC_DERIV_DP] = 0
press_pit[pc_branch, JAC_DERIV_DP1] = 0
press_pit[pc_branch, JAC_DERIV_DV] = 0
press_pit[pc_branch, JAC_DERIV_DM] = 0

@classmethod
def extract_results(cls, net, options, branch_results, mode):
Expand Down
4 changes: 2 additions & 2 deletions src/pandapipes/component_models/pump_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pandapipes.component_models.component_toolbox import get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.constants import NORMAL_TEMPERATURE, NORMAL_PRESSURE, R_UNIVERSAL, P_CONVERSION
from pandapipes.idx_branch import VINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_branch import MINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_node import PINIT, PAMB, TINIT as TINIT_NODE
from pandapipes.pf.pipeflow_setup import get_fluid, get_net_option, get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_without_internals
Expand Down Expand Up @@ -104,7 +104,7 @@ def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lo
# p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
t_from = node_pit[from_nodes, TINIT_NODE]
numerator_from = NORMAL_PRESSURE * t_from
v_mps = pump_branch_pit[:, VINIT]
v_mps = pump_branch_pit[:, MINIT] / pump_branch_pit[:, AREA] / fluid.get_density(NORMAL_TEMPERATURE)
if fluid.is_gas:
# consider volume flow at inlet
normfactor_from = numerator_from * fluid.get_property("compressibility", p_from) \
Expand Down
57 changes: 27 additions & 30 deletions src/pandapipes/idx_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,31 @@
LENGTH = 5 # Pipe length in [m]
D = 6 # Diameter in [m]
AREA = 7 # Area in [m²]
RHO = 8 # Density in [kg/m^3
ETA = 9 # Dynamic viscosity in [Pas]
K = 10 # Pipe roughness in [m]
VINIT = 11 # velocity in [m/s]
RE = 12 # Reynolds number
LAMBDA = 13 # Lambda
JAC_DERIV_DV = 14 # Slot for the derivative by velocity
JAC_DERIV_DP = 15 # Slot for the derivative by pressure from_node
JAC_DERIV_DP1 = 16 # Slot for the derivative by pressure to_node
LOAD_VEC_BRANCHES = 17 # Slot for the load vector for the branches
JAC_DERIV_DV_NODE = 18 # Slot for the derivative by velocity for the nodes connected to branch
LOAD_VEC_NODES = 19 # Slot for the load vector of the nodes connected to branch
LOSS_COEFFICIENT = 20
CP = 21 # Slot for fluid heat capacity values
ALPHA = 22 # Slot for heat transfer coefficient
JAC_DERIV_DT = 23
JAC_DERIV_DT1 = 24
LOAD_VEC_BRANCHES_T = 25
TOUTINIT = 26 # Internal slot for outlet pipe temperature
JAC_DERIV_DT_NODE = 27 # Slot for the derivative fpr T for the nodes connected to branch
LOAD_VEC_NODES_T = 28
VINIT_T = 29
FROM_NODE_T = 30
TO_NODE_T = 31
QEXT = 32 # heat input in [W]
TEXT = 33
PL = 34
TL = 35 # Temperature lift [K]
BRANCH_TYPE = 36 # branch type relevant for the pressure controller
K = 8 # Pipe roughness in [m]
MINIT = 9 # mass in [m/s]
RE = 10 # Reynolds number
LAMBDA = 11 # Lambda
JAC_DERIV_DM = 12 # Slot for the derivative by mass
JAC_DERIV_DP = 13 # Slot for the derivative by pressure from_node
JAC_DERIV_DP1 = 14 # Slot for the derivative by pressure to_node
LOAD_VEC_BRANCHES = 15 # Slot for the load vector for the branches
JAC_DERIV_DM_NODE = 16 # Slot for the derivative by mass for the nodes connected to branch
LOAD_VEC_NODES = 17 # Slot for the load vector of the nodes connected to branch
LOSS_COEFFICIENT = 18
ALPHA = 19 # Slot for heat transfer coefficient
JAC_DERIV_DT = 20
JAC_DERIV_DT1 = 21
LOAD_VEC_BRANCHES_T = 22
TOUTINIT = 23 # Internal slot for outlet pipe temperature
JAC_DERIV_DT_NODE = 24 # Slot for the derivative fpr T for the nodes connected to branch
LOAD_VEC_NODES_T = 25
MINIT_T = 26
FROM_NODE_T = 27
TO_NODE_T = 28
QEXT = 29 # heat input in [W]
TEXT = 30
PL = 31
TL = 32 # Temperature lift [K]
BRANCH_TYPE = 33 # branch type relevant for the pressure controller

branch_cols = 37
branch_cols = 34
21 changes: 10 additions & 11 deletions src/pandapipes/idx_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
ELEMENT_IDX = 1 # index of the element that this node belongs to (within the given table)
NODE_TYPE = 2 # junction type
ACTIVE = 3
RHO = 4 # Density in [kg/m^3]
PINIT = 5
LOAD = 6
HEIGHT = 7
TINIT = 8
PAMB = 9 # Ambient pressure in [bar]
LOAD_T = 10 # Heat power drawn in [W]
NODE_TYPE_T = 11
EXT_GRID_OCCURENCE = 12
EXT_GRID_OCCURENCE_T = 13
PINIT = 4
LOAD = 5
HEIGHT = 6
TINIT = 7
PAMB = 8 # Ambient pressure in [bar]
LOAD_T = 9 # Heat power drawn in [W]
NODE_TYPE_T = 10
EXT_GRID_OCCURENCE = 11
EXT_GRID_OCCURENCE_T = 12

node_cols = 14
node_cols = 13
2 changes: 1 addition & 1 deletion src/pandapipes/io/convert_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _rename_columns(net):
for comp in [CirculationPumpMass, CirculationPumpPressure]:
cp_tbl = comp.table_name()
if cp_tbl in net:
old_cols = ["to_junction", "from_junction", "mdot_kg_per_s", "p_bar", "t_k"]
old_cols = ["from_junction", "to_junction", "mdot_kg_per_s", "p_bar", "t_k"]
new_cols = list(comp.from_to_node_cols()) + ["mdot_flow_kg_per_s", "p_flow_bar",
"t_flow_k"]
for old_col, new_col in list(zip(old_cols, new_cols)):
Expand Down
10 changes: 5 additions & 5 deletions src/pandapipes/pf/build_system_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

import numpy as np
from pandapipes.idx_branch import FROM_NODE, TO_NODE, JAC_DERIV_DV, JAC_DERIV_DP, JAC_DERIV_DP1, \
JAC_DERIV_DV_NODE, LOAD_VEC_NODES, LOAD_VEC_BRANCHES, JAC_DERIV_DT, JAC_DERIV_DT1, \
from pandapipes.idx_branch import FROM_NODE, TO_NODE, JAC_DERIV_DM, JAC_DERIV_DP, JAC_DERIV_DP1, \
JAC_DERIV_DM_NODE, LOAD_VEC_NODES, LOAD_VEC_BRANCHES, JAC_DERIV_DT, JAC_DERIV_DT1, \
JAC_DERIV_DT_NODE, LOAD_VEC_NODES_T, LOAD_VEC_BRANCHES_T, FROM_NODE_T, TO_NODE_T, BRANCH_TYPE
from pandapipes.idx_node import LOAD, TINIT
from pandapipes.idx_node import P, PC, NODE_TYPE, T, NODE_TYPE_T
Expand Down Expand Up @@ -67,16 +67,16 @@ def build_system_matrix(net, branch_pit, node_pit, heat_mode):

if not heat_mode:
# pdF_dv
system_data[:len_b] = branch_pit[:, JAC_DERIV_DV]
system_data[:len_b] = branch_pit[:, JAC_DERIV_DM]
# pdF_dpi
system_data[len_b:2 * len_b] = branch_pit[:, JAC_DERIV_DP]
# pdF_dpi1
system_data[2 * len_b:3 * len_b] = branch_pit[:, JAC_DERIV_DP1]
# jdF_dv_from_nodes
system_data[3 * len_b:len_fn1] = branch_pit[not_slack_fn_branch_mask, JAC_DERIV_DV_NODE]
system_data[3 * len_b:len_fn1] = branch_pit[not_slack_fn_branch_mask, JAC_DERIV_DM_NODE]
# jdF_dv_to_nodes
system_data[len_fn1:len_tn1] = branch_pit[not_slack_tn_branch_mask,
JAC_DERIV_DV_NODE] * (-1)
JAC_DERIV_DM_NODE] * (-1)
# pc_nodes and p_nodes
system_data[len_tn1:] = 1
else:
Expand Down
Loading
Loading