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

bugfix qzero problem #684

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions src/pandapipes/component_models/heat_consumer_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def create_pit_branch_entries(cls, net, branch_pit):
hc_pit[:, FLOW_RETURN_CONNECT] = True
mask_q0 = qext == 0 & np.isnan(mdot)
if np.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[cls.table_name()].index[mask_q0])
Expand Down Expand Up @@ -170,10 +169,12 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
t_out = hc_pit[:, TOUTINIT]

df_dm = - cp * (t_out - t_in)
hc_pit[mask, LOAD_VEC_BRANCHES] = - hc_pit[mask, QEXT] + df_dm[mask] * hc_pit[mask, MDOTINIT]
mask_equal = t_out == t_in
hc_pit[mask & mask_equal, MDOTINIT] = 0
hc_pit[mask & ~mask_equal, JAC_DERIV_DM] = df_dm[mask & ~mask_equal]
mask_zero = hc_pit[:, QEXT] == 0
mask_ign = mask_equal | mask_zero
hc_pit[mask & mask_ign, MDOTINIT] = 0
dlohmeier marked this conversation as resolved.
Show resolved Hide resolved
hc_pit[mask & ~mask_ign, JAC_DERIV_DM] = df_dm[mask & ~mask_ign]
hc_pit[mask, LOAD_VEC_BRANCHES] = - hc_pit[mask, QEXT] + df_dm[mask] * hc_pit[mask, MDOTINIT]

@classmethod
def adaption_before_derivatives_thermal(cls, net, branch_pit, node_pit, idx_lookups, options):
Expand Down Expand Up @@ -201,9 +202,10 @@ def adaption_after_derivatives_thermal(cls, net, branch_pit, node_pit, idx_looku
hc_pit = branch_pit[f:t, :]
consumer_array = get_component_array(net, cls.table_name(), mode='heat_transfer')

# Any MODE where TRETURN is given
mask = consumer_array[:, cls.MODE] == cls.QE_TR
mask= consumer_array[:, cls.MODE] == cls.QE_TR
if np.any(mask):
mask_ign = hc_pit[:, QEXT] == 0
mask = mask & ~mask_ign
dlohmeier marked this conversation as resolved.
Show resolved Hide resolved
hc_pit[mask, LOAD_VEC_BRANCHES_T] = 0
hc_pit[mask, JAC_DERIV_DTOUT] = 1
hc_pit[mask, JAC_DERIV_DT] = 0
Expand Down
Loading