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

Small correction in heat consumer for mode MF_TR #652

Merged
merged 1 commit into from
Oct 21, 2024
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
7 changes: 5 additions & 2 deletions src/pandapipes/component_models/heat_consumer_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def create_component_array(cls, net, component_pits):
tbl = net[cls.table_name()]
consumer_array = np.zeros(shape=(len(tbl), cls.internal_cols), dtype=np.float64)
consumer_array[:, cls.DELTAT] = tbl.deltat_k.values
consumer_array[:, cls.TRETURN] = tbl.treturn_k.values
consumer_array[:, cls.QEXT] = tbl.qext_w.values
consumer_array[:, cls.MASS] = tbl.controlled_mdot_kg_per_s.values
mf = tbl.controlled_mdot_kg_per_s.values
tr = tbl.treturn_k.values
dt = tbl.deltat_k.values
Expand Down Expand Up @@ -177,7 +180,7 @@ def adaption_before_derivatives_thermal(cls, net, branch_pit, node_pit, idx_look
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]
t_out = consumer_array[mask, cls.TRETURN]
q_ext = cp[mask] * hc_pit[mask, MDOTINIT] * (t_in - t_out)
hc_pit[mask, QEXT] = q_ext

Expand All @@ -188,7 +191,7 @@ def adaption_after_derivatives_thermal(cls, net, branch_pit, node_pit, idx_looku
consumer_array = get_component_array(net, cls.table_name(), mode='heat_transfer')

# Any MODE where TRETURN is given
mask = np.isin(consumer_array[:, cls.MODE], [cls.MF_TR, cls.QE_TR])
mask = consumer_array[:, cls.MODE] == cls.QE_TR
if np.any(mask):
hc_pit[mask, LOAD_VEC_BRANCHES_T] = 0
hc_pit[mask, JAC_DERIV_DTOUT] = 1
Expand Down
Loading