main module of LS370 is now drivable

- the main value is the channel
- it is busy when pausing during scanning
+ allow softcal to ignore the sign
This commit is contained in:
l_samenv 2020-11-10 07:57:48 +01:00
parent ad07ecdd69
commit 82b4af4faa
2 changed files with 15 additions and 6 deletions

View File

@ -21,7 +21,6 @@
"""LakeShore Model 370 resistance channel"""
import time
import json
from secop.modules import Readable, Drivable, Parameter, Override, Property, Attached
from secop.metaclass import Done
@ -85,7 +84,11 @@ class Main(HasIodev, Drivable):
self.sendRecv('INSET %d,0,0,0,0,0;INSET?%d' % (ch, ch))
def read_value(self):
channel, auto = json.loads('[%s]' % self.sendRecv('SCAN?'))
channel, auto = scan.send_command(self)
# response = self.sendRecv('SCAN?').strip().split(',')
# channel, auto = (int(s) for s in response)
if channel not in self._channels:
return channel
if not self._channels[channel].enabled:
# channel was disabled recently, but still selected
nextchannel = 0
@ -96,13 +99,12 @@ class Main(HasIodev, Drivable):
break
if nextchannel == 0:
nextchannel = ch
if not nextchannel:
if nextchannel:
self.write_target(nextchannel)
return 0
now = time.time()
if channel != self.target:
print('changed' , channel, self.target)
self._channel_changed = now
self.target = channel
self.autoscan = int(auto)
@ -113,7 +115,8 @@ class Main(HasIodev, Drivable):
return channel
def write_target(self, channel):
self.sendRecv('SCAN %d,%d;SCAN?' % (channel, self.autoscan))
scan.send_change(self, channel, self.autoscan)
# self.sendRecv('SCAN %d,%d;SCAN?' % (channel, self.autoscan))
if channel != self.value:
self.value = 0
self._channel_changed = time.time()

View File

@ -26,7 +26,7 @@ import math
import numpy as np
from scipy.interpolate import splrep, splev # pylint: disable=import-error
from secop.core import Readable, Parameter, Override, Attached, StringType
from secop.core import Readable, Parameter, Override, Attached, StringType, BoolType
def linear(x):
@ -152,6 +152,7 @@ class Sensor(Readable):
}
parameters = {
'calib': Parameter('calibration name', datatype=StringType(), readonly=False),
'abs': Parameter('True: take abs(raw) before calib', datatype=BoolType(), readonly=False, default=True),
'value': Override(unit='K'),
'pollinterval': Override(export=False),
'status': Override(default=(Readable.Status.ERROR, 'unintialized'))
@ -169,10 +170,15 @@ class Sensor(Readable):
return value
def update_value(self, value):
if self.abs:
value = abs(value)
self.value = self._calib(value)
self._value_error = None
def error_update_value(self, err):
if self.abs and str(err) == 'R_UNDER':
self._value_error = None
return None
self._value_error = repr(err)
raise err