aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-22 16:11:51 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-22 16:11:51 -0500
commit51f6aeeb05fcea4142c5a9753ad0d4efbf2894cd (patch)
treef16b1110cd8b2d789a831d9f9d476b1319500a0a /qolab
parentfdf0d60a6b2f3bc1d6ec5852dc6e30cbf48aa3c2 (diff)
downloadpyExpControl-51f6aeeb05fcea4142c5a9753ad0d4efbf2894cd.tar.gz
pyExpControl-51f6aeeb05fcea4142c5a9753ad0d4efbf2894cd.zip
pid has enable status
Diffstat (limited to 'qolab')
-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