From 51f6aeeb05fcea4142c5a9753ad0d4efbf2894cd Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 22 Dec 2021 16:11:51 -0500 Subject: pid has enable status --- qolab/feedback/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qolab/feedback/__init__.py b/qolab/feedback/__init__.py index ee35f62..e92df18 100644 --- a/qolab/feedback/__init__.py +++ b/qolab/feedback/__init__.py @@ -7,11 +7,12 @@ class PID(BasicInstrument): self.config['Device model'] = 'Generic Software PID loop' self.config['Device type']='PID loop' self.config['FnamePrefix'] = 'pid' - self.deviceProperties = ['Gp', 'Gi', 'Gd', 'Sign' ]; + self.deviceProperties = ['Gp', 'Gi', 'Gd', 'Sign', 'Enable' ]; self.Gp = Gp self.Gi = Gi self.Gd = Gd self.sign = sign + self.enable = True self.reset() @@ -39,6 +40,12 @@ class PID(BasicInstrument): def setSign(self,val): self.sign=val + def getEnable(self): + return self.enable + + def setEnable(self,val): + self.enable=val + def reset(self): self.err_1dt_back = 0 @@ -61,5 +68,8 @@ class PID(BasicInstrument): A2= self.Gd/dt; u = A0*self.err_now + A1*self.err_1dt_back + A2*self.err_2dt_back; - return u*self.sign + u *= self.sign + if not self.enable: + return 0 + return u -- cgit v1.2.3