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

View File

@@ -20,7 +20,7 @@
"""interlocks for furnace"""
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.ctrlby import WrapControlledBy
from frappy_psi.picontrol import PImixin
@@ -53,19 +53,20 @@ class Interlocks(Writable):
default = 530, readonly = False)
extra_T_limit = Parameter('maximum extra temperature', FloatRange(0, unit='degC'),
default = 530, readonly = False)
disabled_checks = Parameter('checks to disable', StringType(),
value = '', readonly = False)
_off_reason = None # reason triggering interlock
_conditions = '' # summary of reasons why locked now
_sensor_checks = ()
def initModule(self):
super().initModule()
self._sensor_checks = [
(self.wall_T, 'wall_limit'),
(self.main_T, 'main_T_limit'),
(self.extra_T, 'extra_T_limit'),
(self.htr_T, 'htr_T_limit'),
(self.vacuum, 'vacuum_limit'),
]
SENSOR_MAP = {
'wall_T': 'wall_limit',
'main_T': 'main_T_limit',
'extra_T': 'extra_T_limit',
'htr_T': 'htr_T_limit',
'vacuum': 'vacuum_limit',
}
def write_target(self, 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.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):
conditions = []
if self.flowswitch and self.flowswitch.value == 0:
conditions.append('no cooling water')
for sensor, limitname in self._sensor_checks:
if sensor is None:
continue
if sensor.value > getattr(self, limitname):
conditions.append(f'above {sensor.name} limit')
if sensor.status[0] >= ERROR:
@@ -155,3 +164,15 @@ class PI2(PI):
if not self.control_active:
self.output_module.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')