fixes on small furnace

This commit is contained in:
2025-04-08 17:12:00 +02:00
committed by Markus Zolliker
parent eefe271cba
commit 09dce1aabd
6 changed files with 293 additions and 22 deletions

View File

@@ -27,25 +27,51 @@ from frappy_psi.picontrol import PImixin
class Interlocks(Module):
input = Attached(Readable, 'the input module')
vacuum = Attached (Readable, 'the vacuum pressure')
wall_T = Attached (Readable, 'the wall temperature')
vacuum = Attached(Readable, 'the vacuum pressure')
wall_T = Attached(Readable, 'the wall temperature')
htr_T = Attached(Readable, 'the heater temperature')
main_T = Attached(Readable, 'the main temperature')
extra_T = Attached(Readable, 'the extra temperature')
control = Attached(Module, 'the control module')
relais = Attached(Writable, 'the interlock relais')
wall_limit = Parameter('maximum wall temperature', FloatRange(0, unit='degC'),
default = 50, readonly = False)
vacuum_limit = Parameter('maximum vacuum pressure', FloatRange(0, unit='mbar'),
default = 0.1, readonly = False)
htr_T_limit = Parameter('maximum htr temperature', FloatRange(0, unit='degC'),
default = 530, readonly = False)
main_T_limit = Parameter('maximum main temperature', FloatRange(0, unit='degC'),
default = 530, readonly = False)
extra_T_limit = Parameter('maximum extra temperature', FloatRange(0, unit='degC'),
default = 530, readonly = False)
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'),
]
def doPoll(self):
# TODO: check channels are valid
super().doPoll()
newstatus = None
if self.input.status[0] >= ERROR:
self.control.status = self.input.status
elif self.vacuum.value > self.vacuum_limit:
self.control.status = ERROR, 'bad vacuum'
elif self.wall_T.value > self.wall_limit:
self.control.status = ERROR, 'wall overheat'
newstatus = self.input.status
else:
for sensor, limitname in self._sensor_checks:
if sensor.value > getattr(self, limitname):
newstatus = f'above {sensor.name} limit'
break
if sensor.status[0] >= ERROR:
newstatus = f'error at {sensor.name}: {sensor.status[1]}'
return
self.control.status = newstatus
if self.control.control_active:
self.log.error('switch control off %r', self.control.status)
self.control.write_control_active(False)
self.relais.write_target(False)