Skip to content

Commit ced307e

Browse files
committed
fixed a logic bug, either _impedance_bb_switches is True or False but not 0.
1 parent b0a54a3 commit ced307e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pandapower/build_branch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,8 @@ def _calc_switch_parameter(net, ppc):
13291329
Numpy array. with the following order:
13301330
0:bus_a; 1:bus_b; 2:r_pu; 3:x_pu; 4:b_pu
13311331
"""
1332+
if "_impedance_bb_switches" not in net or not (net._impedance_bb_switches).any():
1333+
return
13321334
rx_ratio = net["_options"]["switch_rx_ratio"]
13331335
rz_ratio = rx_ratio / np.sqrt(1 + rx_ratio ** 2)
13341336
xz_ratio = 1 / np.sqrt(1 + rx_ratio ** 2)

pandapower/build_bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def create_bus_lookup(net, bus_index, bus_is_idx, numba):
274274
if switches_with_pos_z_ohm.any():
275275
net._impedance_bb_switches = closed_bb_switch_mask & switches_with_pos_z_ohm
276276
else:
277-
net._impedance_bb_switches = np.zeros(switches_with_pos_z_ohm.shape)
277+
net._impedance_bb_switches = np.zeros(switches_with_pos_z_ohm.shape).astype(bool)
278278

279279
if numba:
280280
bus_lookup, merged_bus = create_bus_lookup_numba(net, bus_index, bus_is_idx)

0 commit comments

Comments
 (0)