diff --git a/pandapower/topology/create_graph.py b/pandapower/topology/create_graph.py index cc6b06f69..a8b6ade2f 100644 --- a/pandapower/topology/create_graph.py +++ b/pandapower/topology/create_graph.py @@ -140,7 +140,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped line = get_edge_table(net, "line", include_lines) if line is not None: - indices, parameter, in_service = init_par(line, calc_branch_impedances) + indices, parameter, in_service = init_par(line, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = line.from_bus.values indices[:, T_BUS] = line.to_bus.values @@ -166,7 +166,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped impedance = get_edge_table(net, "impedance", include_impedances) if impedance is not None: - indices, parameter, in_service = init_par(impedance, calc_branch_impedances) + indices, parameter, in_service = init_par(impedance, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = impedance.from_bus.values indices[:, T_BUS] = impedance.to_bus.values @@ -182,7 +182,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped tcsc = get_edge_table(net, "tcsc", include_tcsc) if tcsc is not None: - indices, parameter, in_service = init_par(tcsc, calc_branch_impedances) + indices, parameter, in_service = init_par(tcsc, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = tcsc.from_bus.values indices[:, T_BUS] = tcsc.to_bus.values @@ -197,7 +197,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped dclines = get_edge_table(net, "dcline", include_dclines) if dclines is not None: - indices, parameter, in_service = init_par(dclines, calc_branch_impedances) + indices, parameter, in_service = init_par(dclines, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = dclines.from_bus.values indices[:, T_BUS] = dclines.to_bus.values @@ -210,7 +210,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped trafo = get_edge_table(net, "trafo", include_trafos) if trafo is not None: - indices, parameter, in_service = init_par(trafo, calc_branch_impedances) + indices, parameter, in_service = init_par(trafo, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = trafo.hv_bus.values indices[:, T_BUS] = trafo.lv_bus.values @@ -255,7 +255,7 @@ def create_nxgraph(net, respect_switches=True, include_lines=True, include_imped open_trafo3w_buses = net.switch.bus.values[mask] open_trafo3w = (open_trafo3w_index + open_trafo3w_buses * 1j).flatten() for f, t in combinations(sides, 2): - indices, parameter, in_service = init_par(trafo3w, calc_branch_impedances) + indices, parameter, in_service = init_par(trafo3w, calc_branch_impedances, include_out_of_service) indices[:, F_BUS] = trafo3w["%s_bus" % f].values indices[:, T_BUS] = trafo3w["%s_bus" % t].values @@ -372,7 +372,7 @@ def get_baseR(net, ppc, buses): return np.square(base_kv) / net.sn_mva -def init_par(tab, calc_branch_impedances=False): +def init_par(tab, calc_branch_impedances=False, include_out_of_service=False): n = tab.shape[0] indices = np.zeros((n, 3), dtype=np.int64) indices[:, INDEX] = tab.index @@ -382,7 +382,7 @@ def init_par(tab, calc_branch_impedances=False): parameters = np.zeros((n, 1), dtype=float) if "in_service" in tab: - return indices, parameters, tab.in_service.values.copy() + return indices, parameters, np.ones(n, dtype=bool) if include_out_of_service else tab.in_service.values.copy() else: return indices, parameters