aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-06 10:46:25 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-06 10:46:25 -0500
commit26a42772628be38d69b7a508f6cd693fa11ffd10 (patch)
tree4d3f22b070568deca827fd21362f719012edfd98 /qolab
parent70b4f1c2ad6c2c6dc41d96b8b53e838d350daa56 (diff)
downloadpyExpControl-26a42772628be38d69b7a508f6cd693fa11ffd10.tar.gz
pyExpControl-26a42772628be38d69b7a508f6cd693fa11ffd10.zip
communication with i800 temperature controller is cached
Diffstat (limited to 'qolab')
-rw-r--r--qolab/hardware/i_server/i800.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/qolab/hardware/i_server/i800.py b/qolab/hardware/i_server/i800.py
index 0e83444..318be11 100644
--- a/qolab/hardware/i_server/i800.py
+++ b/qolab/hardware/i_server/i800.py
@@ -7,9 +7,14 @@ Querying of this controller is slo-o-o-w at least 0.2 second and can be longer.
"""
from qolab.hardware.basic import BasicInstrument
+from cachetools import cached, TTLCache
import socket
class I800(BasicInstrument):
+ """ Newport i800 series controller, should work with similar Omega controllers """
+ TTL_MEASURED = 30 # Time To Live for device measured things, i.e. Temperature
+ TTL_SEATABLES = 600 # Time To Live for user seatables, i.e. SetPoints, Gains, etc
+
def __init__(self, *args, host='192.168.1.200', port=1000, **kwds):
"""
host - default hostname or IP of the controller unit (192.168.1.200) is factory default
@@ -38,6 +43,7 @@ class I800(BasicInstrument):
return reply[5:-1] # last symbol is '\r'
@BasicInstrument.tsdb_append
+ @cached(cache=TTLCache(maxsize=1, ttl=TTL_MEASURED))
def getTemperature(self):
command='X01'; # give decimal representation (X) of the temperature (01 address)
return float(self.query(command))
@@ -65,12 +71,14 @@ class I800(BasicInstrument):
return(sign*val/scale)
@BasicInstrument.tsdb_append
+ @cached(cache=TTLCache(maxsize=1, ttl=TTL_SEATABLES))
def getSetPoint1(self):
command='R01'
reply=self.query(command)
return (self.setPoinStr2value(reply))
@BasicInstrument.tsdb_append
+ @cached(cache=TTLCache(maxsize=1, ttl=TTL_SEATABLES))
def getSetPoint2(self):
command='R02'
reply=self.query(command)