From a3423f74e9bb6e983e3a8a51c86082eb749350ec Mon Sep 17 00:00:00 2001 From: srdm Date: Tue, 26 Nov 2024 15:54:07 +0100 Subject: [PATCH] change name of VLRLCONNECT and change position in idx_branch --- .../abstract_models/branch_models.py | 4 +-- .../flow_control_component.py | 5 +-- .../heat_consumer_component.py | 4 +-- src/pandapipes/idx_branch.py | 31 +++++++++---------- src/pandapipes/pf/pipeflow_setup.py | 4 +-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/pandapipes/component_models/abstract_models/branch_models.py b/src/pandapipes/component_models/abstract_models/branch_models.py index 9a902986..5a6e3440 100644 --- a/src/pandapipes/component_models/abstract_models/branch_models.py +++ b/src/pandapipes/component_models/abstract_models/branch_models.py @@ -5,7 +5,7 @@ import numpy as np from pandapipes.component_models.abstract_models.base_component import Component -from pandapipes.idx_branch import MDOTINIT, branch_cols, TEXT, VLRLCONNECT +from pandapipes.idx_branch import MDOTINIT, branch_cols, TEXT, FLOW_RETURN_CONNECT from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup, get_net_option try: @@ -90,7 +90,7 @@ def create_pit_branch_entries(cls, net, branch_pit): branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (branch_cols - 1)) branch_component_pit[:, MDOTINIT] = 0.1 branch_component_pit[:, TEXT] = get_net_option(net, 'ambient_temperature') - branch_component_pit[:, VLRLCONNECT] = False + branch_component_pit[:, FLOW_RETURN_CONNECT] = False return branch_component_pit, node_pit, from_nodes, to_nodes @classmethod diff --git a/src/pandapipes/component_models/flow_control_component.py b/src/pandapipes/component_models/flow_control_component.py index 9224694a..38c6390c 100644 --- a/src/pandapipes/component_models/flow_control_component.py +++ b/src/pandapipes/component_models/flow_control_component.py @@ -10,7 +10,8 @@ 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 JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, MDOTINIT, LOAD_VEC_BRANCHES, VLRLCONNECT +from pandapipes.idx_branch import (JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, MDOTINIT, LOAD_VEC_BRANCHES, + FLOW_RETURN_CONNECT) from pandapipes.pf.result_extraction import extract_branch_results_without_internals @@ -50,7 +51,7 @@ def create_pit_branch_entries(cls, net, branch_pit): """ fc_branch_pit = super().create_pit_branch_entries(net, branch_pit) fc_branch_pit[:, MDOTINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values - fc_branch_pit[net[cls.table_name()].control_active, VLRLCONNECT] = True + fc_branch_pit[net[cls.table_name()].control_active, FLOW_RETURN_CONNECT] = True @classmethod def create_component_array(cls, net, component_pits): diff --git a/src/pandapipes/component_models/heat_consumer_component.py b/src/pandapipes/component_models/heat_consumer_component.py index 666241b7..a47c6c50 100644 --- a/src/pandapipes/component_models/heat_consumer_component.py +++ b/src/pandapipes/component_models/heat_consumer_component.py @@ -10,7 +10,7 @@ from pandapipes.component_models.junction_component import Junction from pandapipes.idx_branch import (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, ACTIVE, VLRLCONNECT) + JAC_DERIV_DTOUT, LOAD_VEC_BRANCHES_T, ACTIVE, FLOW_RETURN_CONNECT) from pandapipes.idx_node import TINIT from pandapipes.pf.internals_toolbox import get_from_nodes_corrected from pandapipes.pf.pipeflow_setup import get_lookup @@ -77,7 +77,7 @@ def create_pit_branch_entries(cls, net, branch_pit): hc_pit[~np.isnan(mdot), MDOTINIT] = mdot[~np.isnan(mdot)] treturn = net[cls.table_name()].treturn_k.values hc_pit[~np.isnan(treturn), TOUTINIT] = treturn[~np.isnan(treturn)] - hc_pit[:, VLRLCONNECT] = True + hc_pit[:, FLOW_RETURN_CONNECT] = True mask_q0 = qext == 0 & np.isnan(mdot) if np.any(mask_q0): hc_pit[mask_q0, ACTIVE] = False diff --git a/src/pandapipes/idx_branch.py b/src/pandapipes/idx_branch.py index 151b1fc4..32fb297e 100644 --- a/src/pandapipes/idx_branch.py +++ b/src/pandapipes/idx_branch.py @@ -30,23 +30,22 @@ MDOTINIT_T = 19 FROM_NODE_T_SWITCHED = 20 # flag to indicate if the from and to node are switched in the thermal calculation TOUTINIT = 21 # Internal slot for outlet pipe temperature +FLOW_RETURN_CONNECT = 22 # Make sure that return and flow side are connected to the central pump, respectively -JAC_DERIV_DM = 22 # Slot for the derivative by mass -JAC_DERIV_DP = 23 # Slot for the derivative by pressure from_node -JAC_DERIV_DP1 = 24 # Slot for the derivative by pressure to_node -JAC_DERIV_DM_NODE = 25 # Slot for the derivative by mass for the nodes connected to branch -LOAD_VEC_BRANCHES = 26 # Slot for the load vector for the branches -LOAD_VEC_NODES_FROM = 27 # Slot for the load vector of the from nodes connected to branch -LOAD_VEC_NODES_TO = 28 # Slot for the load vector of the to nodes connected to branch +JAC_DERIV_DM = 23 # Slot for the derivative by mass +JAC_DERIV_DP = 24 # Slot for the derivative by pressure from_node +JAC_DERIV_DP1 = 25 # Slot for the derivative by pressure to_node +JAC_DERIV_DM_NODE = 26 # Slot for the derivative by mass for the nodes connected to branch +LOAD_VEC_BRANCHES = 27 # Slot for the load vector for the branches +LOAD_VEC_NODES_FROM = 28 # Slot for the load vector of the from nodes connected to branch +LOAD_VEC_NODES_TO = 29 # Slot for the load vector of the to nodes connected to branch -JAC_DERIV_DT = 29 -JAC_DERIV_DTOUT = 30 -JAC_DERIV_DT_NODE = 31 # Slot for the node equation derivative of T for the nodes branch is connected to -JAC_DERIV_DTOUT_NODE = 32 # Slot for the node equation derivative of T for the corresponding branch -LOAD_VEC_BRANCHES_T = 33 -LOAD_VEC_NODES_FROM_T = 34 # Slot for the load vector of the from nodes connected to branch -LOAD_VEC_NODES_TO_T = 35 # Slot for the load vector of the to nodes connected to branch - -VLRLCONNECT = 36 +JAC_DERIV_DT = 30 +JAC_DERIV_DTOUT = 31 +JAC_DERIV_DT_NODE = 32 # Slot for the node equation derivative of T for the nodes branch is connected to +JAC_DERIV_DTOUT_NODE = 33 # Slot for the node equation derivative of T for the corresponding branch +LOAD_VEC_BRANCHES_T = 34 +LOAD_VEC_NODES_FROM_T = 35 # Slot for the load vector of the from nodes connected to branch +LOAD_VEC_NODES_TO_T = 36 # Slot for the load vector of the to nodes connected to branch branch_cols = 37 diff --git a/src/pandapipes/pf/pipeflow_setup.py b/src/pandapipes/pf/pipeflow_setup.py index 30a6f7be..a905fba5 100644 --- a/src/pandapipes/pf/pipeflow_setup.py +++ b/src/pandapipes/pf/pipeflow_setup.py @@ -10,7 +10,7 @@ from scipy.sparse import coo_matrix, csgraph from pandapipes.idx_branch import FROM_NODE, TO_NODE, branch_cols, MDOTINIT, \ - ACTIVE as ACTIVE_BR, VLRLCONNECT, ACTIVE, BRANCH_TYPE, CIRC + ACTIVE as ACTIVE_BR, FLOW_RETURN_CONNECT, ACTIVE, BRANCH_TYPE, CIRC 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, INFEED from pandapipes.pf.internals_toolbox import _sum_by_group @@ -619,7 +619,7 @@ def check_connectivity(net, branch_pit, node_pit, mode="hydraulics"): def perform_connectivity_search(net, node_pit, branch_pit, slack_nodes, active_node_lookup, active_branch_lookup, mode="hydraulics"): - connect = branch_pit[:, VLRLCONNECT].astype(bool) + connect = branch_pit[:, FLOW_RETURN_CONNECT].astype(bool) circ = branch_pit[:, BRANCH_TYPE] == CIRC if np.any(circ) and mode == 'hydraulics': active_branch_lookup = active_branch_lookup & ~connect