Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRubenDrauz authored Oct 28, 2024
2 parents dbda747 + 8b80ffd commit db54904
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pandapipes/component_models/component_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def init_results_element(net, element, output, all_float):
"""
res_element = "res_" + element
if all_float:
net[res_element] = pd.DataFrame(np.NAN, columns=output, index=net[element].index,
net[res_element] = pd.DataFrame(np.nan, columns=output, index=net[element].index,
dtype=np.float64)
else:
net[res_element] = pd.DataFrame(np.zeros(0, dtype=output), index=[])
Expand Down
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
4 changes: 2 additions & 2 deletions src/pandapipes/pf/result_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ def extract_results_active_pit(net, mode="hydraulics"):

amb = get_net_option(net, 'ambient_temperature')

net["_pit"]["node"][~nodes_connected, result_node_col] = np.NaN if mode == "hydraulics" else amb
net["_pit"]["node"][~nodes_connected, result_node_col] = np.nan if mode == "hydraulics" else amb
net["_pit"]["node"][rows_nodes[:, np.newaxis], copied_node_cols[np.newaxis, :]] = \
net["_active_pit"]["node"][:, copied_node_cols]
net["_pit"]["branch"][~branches_connected, result_branch_col] = np.NaN if mode == "hydraulics" else \
net["_pit"]["branch"][~branches_connected, result_branch_col] = np.nan if mode == "hydraulics" else \
net["_pit"]["branch"][~branches_connected, TEXT]
net["_pit"]["branch"][rows_branches[:, np.newaxis], copied_branch_cols[np.newaxis, :]] = \
net["_active_pit"]["branch"][:, copied_branch_cols]
Expand Down

0 comments on commit db54904

Please sign in to comment.