From 86767e2fa116e71752604c9dec92fa404493b450 Mon Sep 17 00:00:00 2001 From: camea Date: Tue, 21 Jun 2022 15:32:15 +0200 Subject: [PATCH] add still and sorb heaters to dil5 --- cfg/stick/dil5.cfg | 14 +++++++++++- secop_psi/triton.py | 55 +++++++++++++++++++++------------------------ 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/cfg/stick/dil5.cfg b/cfg/stick/dil5.cfg index 24a6723..4c1cc66 100644 --- a/cfg/stick/dil5.cfg +++ b/cfg/stick/dil5.cfg @@ -19,11 +19,23 @@ output_module = htr_mix io = triton [htr_mix] -class = secop_psi.triton.HeaterOutput +class = secop_psi.triton.HeaterOutputWithRange description = mix. chamber heater slot = H1,T5 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] class = secop_psi.triton.TemperatureSensor description = sorb temperature diff --git a/secop_psi/triton.py b/secop_psi/triton.py index 998b162..f7bf713 100644 --- a/secop_psi/triton.py +++ b/secop_psi/triton.py @@ -75,25 +75,14 @@ class Valve(MercuryChannel, Drivable): self.read_status() def read_value(self): - pos = 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 + return self.query('VALV:SIG:STATE', open_close) def read_status(self): pos = self.read_value() - if self._try_count is None: + if self._try_count is None: # not switching return IDLE, '' if pos == self.target: + # success if self._try_count: # make sure last sent command was not opposite self.change('VALV:SIG:STATE', self.target, open_close) @@ -102,7 +91,7 @@ class Valve(MercuryChannel, Drivable): return IDLE, '' self._try_count += 1 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) return BUSY, 'unblock' if self._try_count > 9: @@ -110,7 +99,6 @@ class Valve(MercuryChannel, Drivable): self.change('VALV:SIG:STATE', pos, open_close) return ERROR, 'can not %s valve' % self.target.name self.change('VALV:SIG:STATE', self.target, open_close) - self._try_count += 1 return BUSY, 'waiting' def write_target(self, value): @@ -269,17 +257,35 @@ class TemperatureLoop(ScannerChannel, mercury.TemperatureLoop): return super().write_control_active(value) -class HeaterOutput(HasInput, MercuryChannel, Readable): +class HeaterOutput(HasInput, MercuryChannel, Writable): """heater output""" - channel_type = 'HTR,TEMP' + channel_type = 'HTR' value = Parameter('heater output', FloatRange(unit='W')) 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')) def read_resistivity(self): 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): maxcur = self.query('TEMP:LOOP:RANGE') * 0.001 # mA -> A return self.read_resistivity() * maxcur ** 2 @@ -292,14 +298,3 @@ class HeaterOutput(HasInput, MercuryChannel, Readable): self.change('TEMP:LOOP:RANGE', maxcur * 1000) 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)