diff --git a/frappy_psi/ccu4.py b/frappy_psi/ccu4.py index 196a74c6..056f3486 100644 --- a/frappy_psi/ccu4.py +++ b/frappy_psi/ccu4.py @@ -124,7 +124,7 @@ class HeLevel(Base, Readable): return self.command(hfu=value) -class Valve(Base, Writable): +class ValveBase(Base, Writable): value = Parameter('relay state', BoolType()) target = Parameter('relay target', BoolType()) ioClass = IO @@ -138,6 +138,7 @@ class Valve(Base, Writable): _open_command = None _close_command = None _query_state = None + _set_time = 0 def write_target(self, target): self._set_time = time.time() @@ -151,29 +152,30 @@ class Valve(Base, Writable): state = int(self.command(**self._query_state)) value, status = self.STATE_MAP[state] if time.time() > self._set_time + 2: - self.value = value + self.value = self.target = value return status -class HeFillValve(Valve): +class HeFillValve(ValveBase): _open_command = {'hcd': 1, 'hf': 1} _close_command = {'hcd': 0, 'hf': 0} _query_state = {'hv': int} -class N2FillValve(Valve): +class N2FillValve(ValveBase): _open_command = {'nc': 1} _close_command = {'nc': 0} _query_state = {'nv': int} -class AuxValve(Valve): +class Valve(ValveBase): channel = Property('valve number', IntRange(1, 12)) def initModule(self): self._open_command = {f'vc{self.channel}': 1} self._close_command = {f'vc{self.channel}': 0} self._query_state = {f'v{self.channel}': int} + super().initModule() class N2TempSensor(Readable): @@ -815,8 +817,8 @@ class MotorValve(Base, Drivable): '5': (ERROR, 'no motor'), } - value = Parameter('value', datatyp=BoolType()) - target = Parameter('target', datatyp=BoolType(), readonly=False) + value = Parameter('value', datatype=BoolType()) + target = Parameter('target', datatype=BoolType(), readonly=False) def write_target(self, target): cmd = 1 diff --git a/frappy_psi/dtmpressure.py b/frappy_psi/dtmpressure.py index a235bc60..93e38b21 100644 --- a/frappy_psi/dtmpressure.py +++ b/frappy_psi/dtmpressure.py @@ -34,4 +34,4 @@ class Pressure(HasIO, Readable): scale = Property('global scale factor', datatype=FloatRange(), default=1) def read_value(self): - return self.communicate('PRES?') / self.scale # any other reply? + return float(self.communicate('PRES?')) / self.scale # any other reply? diff --git a/frappy_psi/epc8210.py b/frappy_psi/epc8210.py index cf52b30b..cc68ed91 100644 --- a/frappy_psi/epc8210.py +++ b/frappy_psi/epc8210.py @@ -47,7 +47,7 @@ class IO(BytesIO): match = self.PAT.match(reply) if match: self.switch_status = match.groups() - self.log.info('%r', self.switch_status) + self.log.debug('%r', self.switch_status) else: # avoid recursive issue if no match is made self.switch_status = ['OFF'] * 8 diff --git a/frappy_psi/jtccr.py b/frappy_psi/jtccr.py index e003aded..05ded912 100644 --- a/frappy_psi/jtccr.py +++ b/frappy_psi/jtccr.py @@ -48,23 +48,23 @@ class JTCCR(Writable): plow = Property('pressure below 5K', datatype=FloatRange(unit='mbar'), default=4.0) valves_high_pressure = { - 'close': 'V3 V4 V5 V6 V7 V8 V10', - 'open': 'V1 V2 V9 Vm', + 'close': 'v3 v4 v5 v6 v7 v8 v10', + 'open': 'v1 v2 v9 vm', } valves_circulating = { - 'close': 'V3 V4 V5 V6 V7 V9 V10', - 'open': 'V1 V2 V8 Vm', + 'close': 'v3 v4 v5 v6 v7 v9 v10', + 'open': 'v1 v2 v8 vm', } valves_warmup = { - 'close': 'V6 V7 V8 V9 V10', - 'open': 'V1 V2 V3 V4 V5 Vm', + 'close': 'v6 v7 v8 v9 v10', + 'open': 'v1 v2 v3 v4 v5 vm', } valves_security= { 'open': '', - 'close': 'V1 V9' + 'close': 'v1 v9' } valves_overpressure = { - 'open': 'V10', + 'open': 'v10', 'close': '' } @@ -100,9 +100,9 @@ class JTCCR(Writable): # TODO: do we need to wait for motor valve? def doPoll(self): - p1 = self.secNode.module['P1'].read_value() - p2 = self.secNode.module['P2'].read_value() - p3 = self.secNode.module['P3'].read_value() + p1 = self.secNode.modules['p1'].read_value() + p2 = self.secNode.modules['p2'].read_value() + p3 = self.secNode.modules['p3'].read_value() compressor_state = self.compressor.read_value() if self.value == 'manual': return self.set_mode('manual') @@ -132,7 +132,7 @@ class JTCCR(Writable): if (p3 - p2) >= self.pdifmax + 0.1: self.handle_valves(**self.valves_overpressure) self.status = BUSY, 'release to recovery' - elif self.secNode.modules['V10'].read_value(): - self.secNode.modules['V10'].write_target(False) + elif self.secNode.modules['v10'].read_value(): + self.secNode.modules['v10'].write_target(False) self.status = IDLE, 'release finished' self.status = IDLE, ''