add still and sorb heaters to dil5

This commit is contained in:
2022-06-21 15:32:15 +02:00
parent 8a995aafed
commit 86767e2fa1
2 changed files with 38 additions and 31 deletions

View File

@ -19,11 +19,23 @@ output_module = htr_mix
io = triton io = triton
[htr_mix] [htr_mix]
class = secop_psi.triton.HeaterOutput class = secop_psi.triton.HeaterOutputWithRange
description = mix. chamber heater description = mix. chamber heater
slot = H1,T5 slot = H1,T5
io = triton io = triton
[htr_sorb]
class = secop_psi.triton.HeaterOutput
description = sorb heater
slot = H2
io = triton
[htr_still]
class = secop_psi.triton.HeaterOutput
description = still heater
slot = H3
io = triton
[T_sorb] [T_sorb]
class = secop_psi.triton.TemperatureSensor class = secop_psi.triton.TemperatureSensor
description = sorb temperature description = sorb temperature

View File

@ -75,25 +75,14 @@ class Valve(MercuryChannel, Drivable):
self.read_status() self.read_status()
def read_value(self): def read_value(self):
pos = self.query('VALV:SIG:STATE', open_close) return self.query('VALV:SIG:STATE', open_close)
if pos == self.target:
self.status = IDLE, ''
self._try_count = 0
self.setFastPoll(False)
elif self._try_count <= 7: # odd number: last try is previous position
# toggle new/previous position until success or too many tries
self.change('VALV:SIG:STATE', pos if self._try_count % 2 else self.target, open_close)
self._try_count += 1
self.status = BUSY, 'opening' if self.target else 'closing'
else:
self.status = ERROR, 'can not %s valve' % self.target.name
return pos
def read_status(self): def read_status(self):
pos = self.read_value() pos = self.read_value()
if self._try_count is None: if self._try_count is None: # not switching
return IDLE, '' return IDLE, ''
if pos == self.target: if pos == self.target:
# success
if self._try_count: if self._try_count:
# make sure last sent command was not opposite # make sure last sent command was not opposite
self.change('VALV:SIG:STATE', self.target, open_close) self.change('VALV:SIG:STATE', self.target, open_close)
@ -102,7 +91,7 @@ class Valve(MercuryChannel, Drivable):
return IDLE, '' return IDLE, ''
self._try_count += 1 self._try_count += 1
if self._try_count % 4 == 0: if self._try_count % 4 == 0:
# send opposite position in order to unblock # send to opposite position in order to unblock
self.change('VALV:SIG:STATE', pos, open_close) self.change('VALV:SIG:STATE', pos, open_close)
return BUSY, 'unblock' return BUSY, 'unblock'
if self._try_count > 9: if self._try_count > 9:
@ -110,7 +99,6 @@ class Valve(MercuryChannel, Drivable):
self.change('VALV:SIG:STATE', pos, open_close) self.change('VALV:SIG:STATE', pos, open_close)
return ERROR, 'can not %s valve' % self.target.name return ERROR, 'can not %s valve' % self.target.name
self.change('VALV:SIG:STATE', self.target, open_close) self.change('VALV:SIG:STATE', self.target, open_close)
self._try_count += 1
return BUSY, 'waiting' return BUSY, 'waiting'
def write_target(self, value): def write_target(self, value):
@ -269,17 +257,35 @@ class TemperatureLoop(ScannerChannel, mercury.TemperatureLoop):
return super().write_control_active(value) return super().write_control_active(value)
class HeaterOutput(HasInput, MercuryChannel, Readable): class HeaterOutput(HasInput, MercuryChannel, Writable):
"""heater output""" """heater output"""
channel_type = 'HTR,TEMP' channel_type = 'HTR'
value = Parameter('heater output', FloatRange(unit='W')) value = Parameter('heater output', FloatRange(unit='W'))
target = Parameter('heater output', FloatRange(0, unit='$'), readonly=False) target = Parameter('heater output', FloatRange(0, unit='$'), readonly=False)
limit = Parameter('max. heater power', FloatRange(unit='W'), readonly=False)
resistivity = Parameter('heater resistivity', FloatRange(unit='Ohm')) resistivity = Parameter('heater resistivity', FloatRange(unit='Ohm'))
def read_resistivity(self): def read_resistivity(self):
return self.query('HTR:RES') return self.query('HTR:RES')
def read_value(self):
return self.query('HTR:SIG:POWR') * 1e-6
def read_target(self):
if self.controlled_by != 0:
return Done
return self.value
def write_target(self, value):
self.write_controlled_by(SELF)
return self.change('HTR:SIG:POWR', value * 1e6)
class HeaterOutputWithRange(HeaterOutput):
"""heater output with heater range"""
channel_type = 'HTR,TEMP'
limit = Parameter('max. heater power', FloatRange(unit='W'), readonly=False)
def read_limit(self): def read_limit(self):
maxcur = self.query('TEMP:LOOP:RANGE') * 0.001 # mA -> A maxcur = self.query('TEMP:LOOP:RANGE') * 0.001 # mA -> A
return self.read_resistivity() * maxcur ** 2 return self.read_resistivity() * maxcur ** 2
@ -292,14 +298,3 @@ class HeaterOutput(HasInput, MercuryChannel, Readable):
self.change('TEMP:LOOP:RANGE', maxcur * 1000) self.change('TEMP:LOOP:RANGE', maxcur * 1000)
return self.read_limit() return self.read_limit()
def read_value(self):
return self.query('HTR:SIG:POWR') * 1e-6
def read_target(self):
if self.controlled_by != 0:
return Done
return self.value
def write_target(self, value):
self.write_controlled_by(SELF)
return self.change('HTR:SIG:POWR', value * 1e6)