merged changes for lakeshore and ccu4
This commit is contained in:
@ -28,7 +28,6 @@ from frappy.core import HasIO, Parameter, Command, Readable, Writable, Drivable,
|
||||
Property, StringIO, BUSY, IDLE, WARN, ERROR, DISABLED, Attached
|
||||
from frappy.datatypes import BoolType, EnumType, FloatRange, StructOf, \
|
||||
StatusType, IntRange, StringType, TupleOf
|
||||
from frappy.dynamic import Pinata
|
||||
from frappy.errors import CommunicationFailedError
|
||||
from frappy.states import HasStates, status_code, Retry
|
||||
|
||||
@ -42,7 +41,7 @@ class CCU4IO(StringIO):
|
||||
# for completeness: (not needed, as it is the default)
|
||||
end_of_line = '\n'
|
||||
# on connect, we send 'cid' and expect a reply starting with 'CCU4'
|
||||
identification = [('cid', r'CCU4.*')]
|
||||
identification = [('cid', r'cid=CCU4.*')]
|
||||
|
||||
|
||||
class CCU4Base(HasIO):
|
||||
@ -144,7 +143,7 @@ class Valve(CCU4Base, Writable):
|
||||
self.command(**self._close_command)
|
||||
|
||||
def read_status(self):
|
||||
state = self.command(self._query_state)
|
||||
state = int(self.command(**self._query_state))
|
||||
self.value, status = self.STATE_MAP[state]
|
||||
return status
|
||||
|
||||
@ -174,14 +173,14 @@ class N2TempSensor(Readable):
|
||||
value = Parameter('LN2 T sensor', FloatRange(unit='K'), default=0)
|
||||
|
||||
|
||||
class N2Level(CCU4Base, Pinata, Readable):
|
||||
class N2Level(CCU4Base, Readable):
|
||||
valve = Attached(Writable, mandatory=False)
|
||||
lower = Attached(Readable, mandatory=False)
|
||||
upper = Attached(Readable, mandatory=False)
|
||||
|
||||
value = Parameter('vessel state', EnumType(empty=0, ok=1, full=2))
|
||||
status = Parameter(datatype=StatusType(Readable, 'BUSY'))
|
||||
mode = Parameter('auto mode', EnumType(A), readonly=False)
|
||||
status = Parameter(datatype=StatusType(Readable, 'DISABLED', 'BUSY'))
|
||||
mode = Parameter('auto mode', EnumType(A), readonly=False, default=A.manual)
|
||||
|
||||
threshold = Parameter('threshold triggering start/stop filling',
|
||||
FloatRange(unit='K'), readonly=False)
|
||||
@ -206,15 +205,6 @@ class N2Level(CCU4Base, Pinata, Readable):
|
||||
5: (WARN, 'empty'),
|
||||
}
|
||||
|
||||
def scanModules(self):
|
||||
for modname, name in self.names.items():
|
||||
if name:
|
||||
sensor_name = name.replace('$', self.name)
|
||||
self.setProperty(modname, sensor_name)
|
||||
yield sensor_name, {
|
||||
'cls': N2FillValve if modname == 'valve' else N2TempSensor,
|
||||
'description': f'LN2 {modname} T sensor'}
|
||||
|
||||
def initialReads(self):
|
||||
self.command(nav=1) # tell CCU4 to activate LN2 sensor readings
|
||||
super().initialReads()
|
||||
@ -280,17 +270,19 @@ class N2Level(CCU4Base, Pinata, Readable):
|
||||
|
||||
@Command()
|
||||
def fill(self):
|
||||
"""start filling"""
|
||||
self.mode = A.auto
|
||||
self.io.write(nc=1)
|
||||
self.command(nc=1)
|
||||
|
||||
@Command()
|
||||
def stop(self):
|
||||
"""stop filling"""
|
||||
if self.mode == A.auto:
|
||||
# set to watching
|
||||
self.command(nc=3)
|
||||
else:
|
||||
# set to off
|
||||
self.io.write(nc=0)
|
||||
self.command(nc=0)
|
||||
|
||||
|
||||
class FlowPressure(CCU4Base, Readable):
|
||||
|
Reference in New Issue
Block a user