diff --git a/PyDSS/pyControllers/Controllers/MotorStallSimple.py b/PyDSS/pyControllers/Controllers/MotorStallSimple.py index 7e6813b4..e84d5ece 100644 --- a/PyDSS/pyControllers/Controllers/MotorStallSimple.py +++ b/PyDSS/pyControllers/Controllers/MotorStallSimple.py @@ -8,6 +8,7 @@ import random import math import os +import pdb class MotorStallSimple(ControllerAbstract): """The controller locks a regulator in the event of reverse power flow. Subclass of the :class:`PyDSS.pyControllers. @@ -61,11 +62,11 @@ def debugInfo(self): def Update(self, Priority, Time, UpdateResults): assert Priority in [0, 1, 2], "Valid control priorities can range from 0-2." + Ve_mags = 1.0 if Priority == 0: Vbase = self._ControlledElm.sBus[0].GetVariable('kVBase') * 1000 Ve_mags = max(self._ControlledElm.GetVariable('VoltagesMagAng')[::2])/ Vbase - - if Ve_mags < self.__Settings['Vstall'] and not self.stall: + if Ve_mags < self.__Settings['Vstall'] and not self.stall and not self.disconnected: self._ControlledElm.SetParameter('kw', self.kw * self.__Settings['Pfault'] ) self._ControlledElm.SetParameter('kvar', self.kvar * self.__Settings['Qfault'] ) self._ControlledElm.SetParameter('model', 2) @@ -75,6 +76,7 @@ def Update(self, Priority, Time, UpdateResults): return 0 if Priority == 1: if self.stall: + self.stall_time = self.__dssSolver.GetTotalSeconds() - self.stall_time_start if self.stall_time > self.__Settings['Tprotection']: self.stall = False @@ -87,7 +89,7 @@ def Update(self, Priority, Time, UpdateResults): if Priority == 2: if self.disconnected: time = self.__dssSolver.GetTotalSeconds() - self.Tdisconnect_start - if time > self.__Settings['Treconnect']: + if time > self.__Settings['Treconnect'] and Ve_mags > self.__Settings['Vstall']: self.disconnected = False self._ControlledElm.SetParameter('kw', self.kw) self._ControlledElm.SetParameter('kvar', self.kvar)