aboutsummaryrefslogtreecommitdiff
path: root/qolab/feedback/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/feedback/__init__.py')
-rw-r--r--qolab/feedback/__init__.py14
1 files 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