Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/vdot_extraction_imcompressible_rea…
Browse files Browse the repository at this point in the history
…l_density
  • Loading branch information
dlohmeier authored Aug 28, 2024
2 parents aeb1705 + 257c99f commit a0d4d05
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pandapipes.component_models.abstract_models.branch_models import BranchComponent
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_branch import ACTIVE, FROM_NODE, TO_NODE, 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
Expand Down Expand Up @@ -207,9 +207,7 @@ 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]
return branch_w_internals_pit, internal_pipe_number

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, FROM_NODE_T, TO_NODE, TO_NODE_T, TOUTINIT, ELEMENT_IDX, 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 @@ -80,9 +80,7 @@ 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]
branch_wo_internals_pit[:, ACTIVE] = net[cls.table_name()][cls.active_identifier()].values
return branch_wo_internals_pit
Expand Down
24 changes: 13 additions & 11 deletions src/pandapipes/component_models/heat_consumer_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
from pandapipes.component_models import (get_fluid, BranchWZeroLengthComponent, get_component_array,
standard_branch_wo_internals_result_lookup)
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import (D, AREA, MDOTINIT, QEXT, JAC_DERIV_DP1, FROM_NODE_T, JAC_DERIV_DM, JAC_DERIV_DP,
LOAD_VEC_BRANCHES, TOUTINIT, JAC_DERIV_DT, JAC_DERIV_DTOUT, LOAD_VEC_BRANCHES_T)
from pandapipes.idx_branch import (D, AREA, 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)
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
Expand Down Expand Up @@ -112,9 +114,9 @@ def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lo

mask = consumer_array[:, cls.MODE] == cls.QE_DT
if np.any(mask):
cp = get_branch_cp(net, get_fluid(net), node_pit, hc_pit)
deltat = consumer_array[:, cls.DELTAT]
mass = hc_pit[mask, QEXT] / (cp[mask] * (deltat[mask]))
cp = get_branch_cp(get_fluid(net), node_pit, hc_pit[mask])
deltat = consumer_array[mask, cls.DELTAT]
mass = hc_pit[mask, QEXT] / (cp * deltat)
hc_pit[mask, MDOTINIT] = mass

@classmethod
Expand Down Expand Up @@ -148,8 +150,8 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo

mask = consumer_array[:, cls.MODE] == cls.QE_TR
if np.any(mask):
cp = get_branch_cp(net, get_fluid(net), node_pit, hc_pit)
from_nodes = hc_pit[:, FROM_NODE_T].astype(int)
cp = get_branch_cp(get_fluid(net), node_pit, hc_pit)
from_nodes = get_from_nodes_corrected(hc_pit)
t_in = node_pit[from_nodes, TINIT]
t_out = hc_pit[:, TOUTINIT]

Expand All @@ -166,14 +168,14 @@ def adaption_before_derivatives_thermal(cls, net, branch_pit, node_pit, idx_look
consumer_array = get_component_array(net, cls.table_name(), mode='heat_transfer')
mask = consumer_array[:, cls.MODE] == cls.MF_DT
if np.any(mask):
cp = get_branch_cp(net, get_fluid(net), node_pit, hc_pit)
cp = get_branch_cp(get_fluid(net), node_pit, hc_pit)
q_ext = cp[mask] * hc_pit[mask, MDOTINIT] * consumer_array[mask, cls.DELTAT]
hc_pit[mask, QEXT] = q_ext

mask = consumer_array[:, cls.MODE] == cls.MF_TR
if np.any(mask):
cp = get_branch_cp(net, get_fluid(net), node_pit, hc_pit)
from_nodes = hc_pit[mask, FROM_NODE_T].astype(int)
cp = get_branch_cp(get_fluid(net), node_pit, hc_pit)
from_nodes = get_from_nodes_corrected(hc_pit[mask])
t_in = node_pit[from_nodes, TINIT]
t_out = hc_pit[mask, TOUTINIT]
q_ext = cp[mask] * hc_pit[mask, MDOTINIT] * (t_in - t_out)
Expand Down Expand Up @@ -255,7 +257,7 @@ def extract_results(cls, net, options, branch_results, mode):
res_table = net["res_" + cls.table_name()]

res_table['qext_w'].values[:] = branch_pit[f:t, QEXT]
from_nodes = branch_pit[f:t, FROM_NODE_T].astype(int)
from_nodes = get_from_nodes_corrected(branch_pit[f:t])
t_from = node_pit[from_nodes, TINIT]
tout = branch_pit[f:t, TOUTINIT]
res_table['deltat_k'].values[:] = t_from - tout
18 changes: 8 additions & 10 deletions src/pandapipes/idx_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
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
MDOTINIT_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
LOAD_VEC_NODES_T = 25 # Slot for the load vector of the nodes connected to branch
FROM_NODE_T_SWITCHED = 26 # flag to indicate if the from and to node are switched in the thermal calculation
QEXT = 27 # heat input into the branch [W]
TEXT = 28 # temperature of surrounding [K]
PL = 29 # Pressure lift [bar]
TL = 30 # Temperature lift [K]
BRANCH_TYPE = 31 # branch type relevant for the pressure controller

branch_cols = 34
branch_cols = 32
22 changes: 14 additions & 8 deletions src/pandapipes/pf/build_system_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
# 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 scipy.sparse import csr_matrix

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_DTOUT, \
JAC_DERIV_DT_NODE, LOAD_VEC_NODES_T, LOAD_VEC_BRANCHES_T, FROM_NODE_T, TO_NODE_T, BRANCH_TYPE
JAC_DERIV_DT_NODE, LOAD_VEC_NODES_T, LOAD_VEC_BRANCHES_T, BRANCH_TYPE
from pandapipes.idx_node import LOAD, TINIT
from pandapipes.idx_node import P, PC, NODE_TYPE, T, NODE_TYPE_T
from pandapipes.pf.internals_toolbox import _sum_by_group_sorted, _sum_by_group
from pandapipes.pf.internals_toolbox import _sum_by_group_sorted, _sum_by_group, \
get_from_nodes_corrected, get_to_nodes_corrected
from pandapipes.pf.pipeflow_setup import get_net_option
from scipy.sparse import csr_matrix


def build_system_matrix(net, branch_pit, node_pit, heat_mode):
Expand All @@ -36,12 +38,16 @@ def build_system_matrix(net, branch_pit, node_pit, heat_mode):
len_b = len(branch_pit)
len_n = len(node_pit)
branch_matrix_indices = np.arange(len_b) + len_n
fn_col, tn_col, ntyp_col, slack_type, pc_type, num_der = \
(FROM_NODE, TO_NODE, NODE_TYPE, P, PC, 3) \
if not heat_mode else (FROM_NODE_T, TO_NODE_T, NODE_TYPE_T, T, PC, 2)
ntyp_col, slack_type, pc_type, num_der = \
(NODE_TYPE, P, PC, 3) if not heat_mode else (NODE_TYPE_T, T, PC, 2)
pc_nodes = np.where(node_pit[:, ntyp_col] == pc_type)[0]
fn = branch_pit[:, fn_col].astype(np.int32)
tn = branch_pit[:, tn_col].astype(np.int32)

if not heat_mode:
fn = branch_pit[:, FROM_NODE].astype(np.int32)
tn = branch_pit[:, TO_NODE].astype(np.int32)
else:
fn = get_from_nodes_corrected(branch_pit)
tn = get_to_nodes_corrected(branch_pit)
not_slack_fn_branch_mask = node_pit[fn, ntyp_col] != slack_type
not_slack_tn_branch_mask = node_pit[tn, ntyp_col] != slack_type
pc_branch_mask = branch_pit[:, BRANCH_TYPE] == pc_type
Expand Down
18 changes: 10 additions & 8 deletions src/pandapipes/pf/derivative_calculation.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import numpy as np

from pandapipes.constants import NORMAL_TEMPERATURE
from pandapipes.idx_branch import LENGTH, D, K, RE, LAMBDA, LOAD_VEC_BRANCHES, \
JAC_DERIV_DM, JAC_DERIV_DP, JAC_DERIV_DP1, LOAD_VEC_NODES, JAC_DERIV_DM_NODE, \
FROM_NODE, TO_NODE, FROM_NODE_T, TOUTINIT, TEXT, AREA, ALPHA, TL, QEXT, LOAD_VEC_NODES_T, \
LOAD_VEC_BRANCHES_T, JAC_DERIV_DT, JAC_DERIV_DTOUT, JAC_DERIV_DT_NODE, MDOTINIT, MDOTINIT_T
FROM_NODE, TO_NODE, TOUTINIT, TEXT, AREA, ALPHA, TL, QEXT, LOAD_VEC_NODES_T, \
LOAD_VEC_BRANCHES_T, JAC_DERIV_DT, JAC_DERIV_DTOUT, JAC_DERIV_DT_NODE, MDOTINIT
from pandapipes.idx_node import TINIT as TINIT_NODE
from pandapipes.pf.internals_toolbox import get_from_nodes_corrected
from pandapipes.properties.fluids import get_fluid
from pandapipes.constants import NORMAL_TEMPERATURE
from pandapipes.properties.properties_toolbox import get_branch_real_density, get_branch_real_eta, get_branch_cp
from pandapipes.properties.properties_toolbox import get_branch_real_density, get_branch_real_eta, \
get_branch_cp


def calculate_derivatives_hydraulic(net, branch_pit, node_pit, options):
Expand Down Expand Up @@ -79,11 +81,11 @@ def calculate_derivatives_hydraulic(net, branch_pit, node_pit, options):
branch_pit[:, JAC_DERIV_DM_NODE] = df_dm_nodes


def calculate_derivatives_thermal(net, branch_pit, node_pit, options):
def calculate_derivatives_thermal(net, branch_pit, node_pit, _):
fluid = get_fluid(net)
cp = get_branch_cp(net, fluid, node_pit, branch_pit)
m_init = branch_pit[:, MDOTINIT_T]
from_nodes = branch_pit[:, FROM_NODE_T].astype(np.int32)
cp = get_branch_cp(fluid, node_pit, branch_pit)
m_init = np.abs(branch_pit[:, MDOTINIT])
from_nodes = get_from_nodes_corrected(branch_pit)
t_init_i = node_pit[from_nodes, TINIT_NODE]
t_init_i1 = branch_pit[:, TOUTINIT]
t_amb = branch_pit[:, TEXT]
Expand Down
47 changes: 47 additions & 0 deletions src/pandapipes/pf/internals_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import numpy as np
import logging

from pandapipes.idx_branch import FROM_NODE_T_SWITCHED, TO_NODE, FROM_NODE

try:
from numba import jit
numba_installed = True
Expand Down Expand Up @@ -154,3 +157,47 @@ def _sum_values_by_index(indices, value_arr, max_ind, le, n_vals):
@jit(nopython=True)
def max_nb(arr):
return np.max(arr)


def get_from_nodes_corrected(branch_pit, switch_from_to_col=None):
"""
Function to get corrected from nodes from the branch pit.
Usually, this should be used if the velocity in a branch is negative, so that the\
flow goes from the to_node to the from_node. The parameter switch_from_to_col indicates\
whether the two columns shall be switched (for each row) or not.
:param branch_pit: The branch pit
:type branch_pit: np.ndarray
:param switch_from_to_col: Indicates for each branch, whether to use the from (True) or \
to (False) node. If None, the column FROM_NODE_T_SWITCHED is used.
:type switch_from_to_col: np.ndarray, default None
:return:
:rtype:
"""
if switch_from_to_col is None:
switch_from_to_col = branch_pit[:, FROM_NODE_T_SWITCHED]
from_node_col = switch_from_to_col.astype(np.int32) * (TO_NODE - FROM_NODE) + FROM_NODE
return branch_pit[np.arange(len(branch_pit)), from_node_col].astype(np.int32)


def get_to_nodes_corrected(branch_pit, switch_from_to_col=None):
"""
Function to get corrected to nodes from the branch pit.
Usually, this should be used if the velocity in a branch is negative, so that the\
flow goes from the to_node to the from_node. The parameter switch_from_to_col indicates\
whether the two columns shall be switched (for each row) or not.
:param branch_pit: The branch pit
:type branch_pit: np.ndarray
:param switch_from_to_col: Indicates for each branch, whether to use the from (False) or \
to (True) node. If set to None, the column FROM_NODE_T_SWITCHED is used.
:type switch_from_to_col: np.ndarray, default None
:return:
:rtype:
"""
if switch_from_to_col is None:
switch_from_to_col = branch_pit[:, FROM_NODE_T_SWITCHED]
to_node_col = switch_from_to_col.astype(np.int32) * (FROM_NODE - TO_NODE) + TO_NODE
return branch_pit[np.arange(len(branch_pit)), to_node_col].astype(np.int32)
6 changes: 2 additions & 4 deletions src/pandapipes/pf/pipeflow_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from pandapower.auxiliary import ppException
from scipy.sparse import coo_matrix, csgraph

from pandapipes.idx_branch import FROM_NODE, TO_NODE, branch_cols, \
ACTIVE as ACTIVE_BR, MDOTINIT, FROM_NODE_T, TO_NODE_T
from pandapipes.idx_branch import FROM_NODE, TO_NODE, branch_cols, MDOTINIT, \
ACTIVE as ACTIVE_BR
from pandapipes.idx_node import NODE_TYPE, P, NODE_TYPE_T, node_cols, T, ACTIVE as ACTIVE_ND, \
TABLE_IDX as TABLE_IDX_ND, ELEMENT_IDX as ELEMENT_IDX_ND
from pandapipes.pf.internals_toolbox import _sum_by_group
Expand Down Expand Up @@ -757,10 +757,8 @@ def reduce_pit(net, mode="hydraulics"):
if reduced_node_lookup is not None:
active_pit["branch"][:, FROM_NODE] = reduced_node_lookup[
branch_pit[branches_connected, FROM_NODE].astype(np.int32)]
active_pit["branch"][:, FROM_NODE_T] = active_pit["branch"][:, FROM_NODE]
active_pit["branch"][:, TO_NODE] = reduced_node_lookup[
branch_pit[branches_connected, TO_NODE].astype(np.int32)]
active_pit["branch"][:, TO_NODE_T] = active_pit["branch"][:, TO_NODE]
net["_active_pit"] = active_pit

for el, connected_els in els.items():
Expand Down
2 changes: 1 addition & 1 deletion src/pandapipes/pf/result_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pandapipes.constants import NORMAL_PRESSURE, NORMAL_TEMPERATURE
from pandapipes.idx_branch import ELEMENT_IDX, FROM_NODE, TO_NODE, MDOTINIT, RE, \
LAMBDA, FROM_NODE_T, TO_NODE_T, PL, TOUTINIT, AREA, TEXT
LAMBDA, PL, TOUTINIT, AREA, TEXT
from pandapipes.idx_node import TABLE_IDX as TABLE_IDX_NODE, PINIT, PAMB, TINIT as TINIT_NODE
from pandapipes.pf.internals_toolbox import _sum_by_group
from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup, get_net_option
Expand Down
11 changes: 2 additions & 9 deletions src/pandapipes/pipeflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from numpy import linalg
from scipy.sparse.linalg import spsolve

from pandapipes.idx_branch import (FROM_NODE, TO_NODE, FROM_NODE_T, TO_NODE_T, MDOTINIT, TOUTINIT,
MDOTINIT_T)
from pandapipes.idx_branch import MDOTINIT, TOUTINIT, FROM_NODE_T_SWITCHED
from pandapipes.idx_node import PINIT, TINIT
from pandapipes.pf.build_system_matrix import build_system_matrix
from pandapipes.pf.derivative_calculation import (calculate_derivatives_hydraulic,
Expand Down Expand Up @@ -276,13 +275,7 @@ def solve_temperature(net):

# Negative velocity values are turned to positive ones (including exchange of from_node and
# to_node for temperature calculation
branch_pit[:, MDOTINIT_T] = branch_pit[:, MDOTINIT]
branch_pit[:, FROM_NODE_T] = branch_pit[:, FROM_NODE]
branch_pit[:, TO_NODE_T] = branch_pit[:, TO_NODE]
mask = branch_pit[:, MDOTINIT] < 0
branch_pit[mask, MDOTINIT_T] = -branch_pit[mask, MDOTINIT]
branch_pit[mask, FROM_NODE_T] = branch_pit[mask, TO_NODE]
branch_pit[mask, TO_NODE_T] = branch_pit[mask, FROM_NODE]
branch_pit[:, FROM_NODE_T_SWITCHED] = branch_pit[:, MDOTINIT] < 0

for comp in net['component_list']:
comp.adaption_before_derivatives_thermal(net, branch_pit, node_pit, branch_lookups, options)
Expand Down
11 changes: 6 additions & 5 deletions src/pandapipes/properties/properties_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import numpy as np

from pandapipes.constants import NORMAL_TEMPERATURE, NORMAL_PRESSURE
from pandapipes.idx_branch import TOUTINIT, FROM_NODE_T, TO_NODE
from pandapipes.idx_branch import TOUTINIT, TO_NODE
from pandapipes.idx_node import TINIT, PINIT, PAMB
from pandapipes.pf.internals_toolbox import get_from_nodes_corrected


def calculate_mixture_viscosity(components_viscosities, components_molar_proportions,
Expand Down Expand Up @@ -149,7 +150,7 @@ def calculate_mass_fraction_from_molar_fraction(component_molar_proportions, com


def get_branch_real_density(fluid, node_pit, branch_pit):
from_nodes = branch_pit[:, FROM_NODE_T].astype(np.int32)
from_nodes = get_from_nodes_corrected(branch_pit)
t_from = node_pit[from_nodes, TINIT]
t_to = branch_pit[:, TOUTINIT]
if fluid.is_gas:
Expand All @@ -168,15 +169,15 @@ def get_branch_real_density(fluid, node_pit, branch_pit):
return rho

def get_branch_real_eta(fluid, node_pit, branch_pit):
from_nodes = branch_pit[:, FROM_NODE_T].astype(np.int32)
from_nodes = get_from_nodes_corrected(branch_pit)
t_from = node_pit[from_nodes, TINIT]
t_to = branch_pit[:, TOUTINIT]
tm = (t_from + t_to) / 2
eta = fluid.get_viscosity(tm)
return eta

def get_branch_cp(net, fluid, node_pit, branch_pit):
from_nodes = branch_pit[:, FROM_NODE_T].astype(np.int32)
def get_branch_cp(fluid, node_pit, branch_pit):
from_nodes = get_from_nodes_corrected(branch_pit)
t_from = node_pit[from_nodes, TINIT]
t_to = branch_pit[:, TOUTINIT]
tm = (t_from + t_to) / 2
Expand Down
6 changes: 3 additions & 3 deletions src/pandapipes/test/api/test_components/test_heat_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_heat_consumer_equivalence2():

pandapipes.create_heat_consumer(net2, juncs[1], juncs[4], 0.1022, controlled_mdot_kg_per_s=mdot[0], qext_w=qext[0])
pandapipes.create_heat_consumer(net2, juncs[2], juncs[3], 0.1022, treturn_k=263.4459264973806, qext_w=qext[1])
pandapipes.pipeflow(net2, mode="bidirectional", iter=25, alpha=0.5)
pandapipes.pipeflow(net2, mode="bidirectional", iter=25)

pandapipes.create_heat_consumer(net3, juncs[1], juncs[4], 0.1022, controlled_mdot_kg_per_s=mdot[0], qext_w=qext[0])
pandapipes.create_heat_consumer(net3, juncs[2], juncs[3], 0.1022, deltat_k=17.82611044059695, qext_w=qext[1])
Expand Down Expand Up @@ -184,7 +184,7 @@ def test_heat_consumer_qext_zero():
pandapipes.create_heat_consumer(net, juncs[1], juncs[4], 0.1022, treturn_k=263.4459264973806, qext_w=0)
pandapipes.create_heat_consumer(net, juncs[2], juncs[3], 0.1022, controlled_mdot_kg_per_s=1, qext_w=7500)

pandapipes.pipeflow(net, mode="bidirectional", iter=25, alpha=0.5)
pandapipes.pipeflow(net, mode="bidirectional")

assert net.res_junction.at[juncs[4], 't_k'] != 263.4459264973806

Expand All @@ -204,7 +204,7 @@ def test_heat_consumer_result_extraction():
pandapipes.create_pipe_from_parameters(net, 6, 7, k_mm=0.1, length_km=1,
diameter_m=0.1022, alpha_w_per_m2k=10, text_k=273.15)

pandapipes.pipeflow(net, mode="bidirectional", iter=25, alpha=0.5)
pandapipes.pipeflow(net, mode="bidirectional")

#hydraulics only to check for lookup heat transfer error
pandapipes.pipeflow(net)
Expand Down

0 comments on commit a0d4d05

Please sign in to comment.