diff --git a/pandapower/control/controller/trafo/ContinuousTapControl.py b/pandapower/control/controller/trafo/ContinuousTapControl.py index b1bb7c5d5..7c77e2714 100644 --- a/pandapower/control/controller/trafo/ContinuousTapControl.py +++ b/pandapower/control/controller/trafo/ContinuousTapControl.py @@ -4,6 +4,7 @@ # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np + from pandapower.auxiliary import read_from_net, write_to_net from pandapower.control.controller.trafo_control import TrafoController @@ -97,6 +98,8 @@ def is_converged(self, net): return True 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 + 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 @@ -110,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)) diff --git a/pandapower/control/controller/trafo/DiscreteTapControl.py b/pandapower/control/controller/trafo/DiscreteTapControl.py index 48ef2bb07..cf4aa2353 100644 --- a/pandapower/control/controller/trafo/DiscreteTapControl.py +++ b/pandapower/control/controller/trafo/DiscreteTapControl.py @@ -3,9 +3,11 @@ # Copyright (c) 2016-2023 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np + from pandapower.auxiliary import read_from_net, write_to_net from pandapower.control.controller.trafo_control import TrafoController + class DiscreteTapControl(TrafoController): """ Trafo Controller with local tap changer voltage control. @@ -115,6 +117,8 @@ def is_converged(self, net): return True 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 + 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, @@ -125,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))