fs: make 'sensor broken' message active

- for this use frappy_psi.PRtransmitter instead
  of ionopimax.CurrentInput
- add disabled_checks parameter
This commit is contained in:
2025-06-30 18:09:07 +02:00
parent a5a4212691
commit 83f40f0c33
2 changed files with 39 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ Mod('T',
'frappy_psi.furnace.PI2', 'frappy_psi.furnace.PI2',
'controlled Temperature on sample (2nd loop)', 'controlled Temperature on sample (2nd loop)',
value = Param(unit='degC'), value = Param(unit='degC'),
meaning = ['temperature', 30],
input_module = 'T_sam', input_module = 'T_sam',
output_module = 'T_reg', output_module = 'T_reg',
relais = 'relais', relais = 'relais',
@@ -38,7 +39,7 @@ Mod('T_reg',
# ) # )
Mod('T_htr', Mod('T_htr',
'frappy_psi.ionopimax.CurrentInput', 'frappy_psi.furnace.PRtransmitter',
'heater temperature', 'heater temperature',
addr = 'ai4', addr = 'ai4',
valuerange = (0, 1372), valuerange = (0, 1372),
@@ -47,7 +48,7 @@ Mod('T_htr',
Mod('T_sam', Mod('T_sam',
'frappy_psi.ionopimax.CurrentInput', 'frappy_psi.furnace.PRtransmitter',
'sample temperature', 'sample temperature',
addr = 'ai3', addr = 'ai3',
valuerange = (0, 1372), valuerange = (0, 1372),
@@ -56,7 +57,7 @@ Mod('T_sam',
) )
Mod('T_extra', Mod('T_extra',
'frappy_psi.ionopimax.CurrentInput', 'frappy_psi.furnace.PRtransmitter',
'extra temperature', 'extra temperature',
addr = 'ai2', addr = 'ai2',
valuerange = (0, 1372), valuerange = (0, 1372),
@@ -113,10 +114,11 @@ Mod('interlocks',
control = 'T', control = 'T',
wall_limit = 60, wall_limit = 60,
vacuum_limit = 0.001, vacuum_limit = 0.001,
disabled_checks = 'T_extra',
) )
Mod('p', Mod('p',
'frappy_psi.ionopimax.LogVoltageInput', 'frappy_psi.furnace.PKRgauge',
'pressure reading', 'pressure reading',
addr = 'av1', addr = 'av1',
rawrange = (1.82, 8.6), rawrange = (1.82, 8.6),

View File

@@ -20,7 +20,7 @@
"""interlocks for furnace""" """interlocks for furnace"""
from frappy.core import Module, Writable, Attached, Parameter, FloatRange, Readable,\ from frappy.core import Module, Writable, Attached, Parameter, FloatRange, Readable,\
BoolType, ERROR, IDLE, Command BoolType, ERROR, IDLE, Command, StringType
from frappy.errors import ImpossibleError from frappy.errors import ImpossibleError
from frappy.ctrlby import WrapControlledBy from frappy.ctrlby import WrapControlledBy
from frappy_psi.picontrol import PImixin from frappy_psi.picontrol import PImixin
@@ -53,19 +53,20 @@ class Interlocks(Writable):
default = 530, readonly = False) default = 530, readonly = False)
extra_T_limit = Parameter('maximum extra temperature', FloatRange(0, unit='degC'), extra_T_limit = Parameter('maximum extra temperature', FloatRange(0, unit='degC'),
default = 530, readonly = False) default = 530, readonly = False)
disabled_checks = Parameter('checks to disable', StringType(),
value = '', readonly = False)
_off_reason = None # reason triggering interlock _off_reason = None # reason triggering interlock
_conditions = '' # summary of reasons why locked now _conditions = '' # summary of reasons why locked now
_sensor_checks = ()
def initModule(self): SENSOR_MAP = {
super().initModule() 'wall_T': 'wall_limit',
self._sensor_checks = [ 'main_T': 'main_T_limit',
(self.wall_T, 'wall_limit'), 'extra_T': 'extra_T_limit',
(self.main_T, 'main_T_limit'), 'htr_T': 'htr_T_limit',
(self.extra_T, 'extra_T_limit'), 'vacuum': 'vacuum_limit',
(self.htr_T, 'htr_T_limit'), }
(self.vacuum, 'vacuum_limit'),
]
def write_target(self, value): def write_target(self, value):
if value: if value:
@@ -93,13 +94,21 @@ class Interlocks(Writable):
self.log.warning('switch off relais %r %r', self.relais.value, self.relais.target) self.log.warning('switch off relais %r %r', self.relais.value, self.relais.target)
self.relais.write_target(False) self.relais.write_target(False)
def write_disabled_checks(self, value):
disabled = set(value.split())
self._sensor_checks = []
for att, limitname in self.SENSOR_MAP.items():
obj = getattr(self, att)
if obj and obj.name not in disabled:
self.log.info('info %r %r %r', att, obj.name, disabled)
self._sensor_checks.append((obj, limitname))
def read_status(self): def read_status(self):
conditions = [] conditions = []
if self.flowswitch and self.flowswitch.value == 0: if self.flowswitch and self.flowswitch.value == 0:
conditions.append('no cooling water') conditions.append('no cooling water')
for sensor, limitname in self._sensor_checks: for sensor, limitname in self._sensor_checks:
if sensor is None:
continue
if sensor.value > getattr(self, limitname): if sensor.value > getattr(self, limitname):
conditions.append(f'above {sensor.name} limit') conditions.append(f'above {sensor.name} limit')
if sensor.status[0] >= ERROR: if sensor.status[0] >= ERROR:
@@ -155,3 +164,15 @@ class PI2(PI):
if not self.control_active: if not self.control_active:
self.output_module.write_target(target) self.output_module.write_target(target)
super().write_target(target) super().write_target(target)
class PRtransmitter(CurrentInput):
rawrange = (0.004, 0.02)
extendedrange = (0.0036, 0.021)
class PKRgauge(LogVoltageInput):
rawrange = (1.82, 8.6)
valuerange = (5e-9, 1000)
extendedrange = (0.5, 9.5)
value = Parameter(unit='mbar')