Skip to content

Commit

Permalink
correction to make oos trafos in controllers work for vectorized form
Browse files Browse the repository at this point in the history
  • Loading branch information
dlohmeier committed Dec 7, 2023
1 parent a30254d commit 8c8e94c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions pandapower/control/controller/trafo/ContinuousTapControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def is_converged(self, net):

vm_pu = read_from_net(net, "res_bus", self.controlled_bus, "vm_pu", self._read_write_flag)
# this is possible in case the trafo is set out of service by the connectivity check
if np.isnan(vm_pu):
return True
is_nan = np.isnan(vm_pu)
self.tap_pos = read_from_net(net, self.trafotable, self.controlled_tid, "tap_pos", self._read_write_flag)
difference = 1 - self.vm_set_pu / vm_pu

Expand All @@ -114,4 +113,4 @@ def is_converged(self, net):
else:
converged = np.abs(difference) < self.tol

return np.all(converged)
return np.all(np.logical_or(converged, is_nan))
6 changes: 2 additions & 4 deletions pandapower/control/controller/trafo/DiscreteTapControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def is_converged(self, net):

vm_pu = read_from_net(net, "res_bus", self.controlled_bus, "vm_pu", self._read_write_flag)
# this is possible in case the trafo is set out of service by the connectivity check
if np.isnan(vm_pu):
return True
is_nan = np.isnan(vm_pu)
self.tap_pos = read_from_net(net, self.trafotable, self.controlled_tid, "tap_pos", self._read_write_flag)

reached_limit = np.where(self.tap_side_coeff * self.tap_sign == 1,
Expand All @@ -130,5 +129,4 @@ def is_converged(self, net):

converged = np.logical_or(reached_limit, np.logical_and(self.vm_lower_pu < vm_pu, vm_pu < self.vm_upper_pu))

return np.all(converged)

return np.all(np.logical_or(converged, is_nan))

0 comments on commit 8c8e94c

Please sign in to comment.