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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user