frappy_psi/dpm: implement interlock to motor when load to high

Change-Id: Ia82e5c28f8961d2ee5b89b14dc2ae4a497cc3b2f
This commit is contained in:
2026-06-09 14:21:21 +02:00
parent 91f2720f9f
commit 2b1b614962
+12 -2
View File
@@ -21,7 +21,7 @@
"""transducer DPM3 read out"""
from frappy.core import Readable, Parameter, FloatRange, StringIO,\
HasIO, IntRange, Done
HasIO, IntRange, Done, Attached, IDLE, WARN
class DPM3IO(StringIO):
@@ -52,6 +52,8 @@ class DPM3(HasIO, Readable):
'9': -1, 'A': -10, 'B': -100, 'C': -1e3, 'D': -1e4, 'E': -1e5}
ioClass = DPM3IO
# when configured, the parameter drive.interlock_reason may be set to "load above limit"
drive = Attached(mandatory=False)
value = Parameter(datatype=FloatRange(unit='N'))
digits = Parameter('number of digits for value', IntRange(0, 5), value=2, readonly=False)
@@ -60,6 +62,7 @@ class DPM3(HasIO, Readable):
# thus a maximal output of 1500. 10=150/f
offset = Parameter('', FloatRange(-1e5, 1e5), readonly=False)
scale_factor = Parameter('', FloatRange(-1e5, 1e5, unit='input_units/N'), readonly=False)
alarm_limit = Parameter('alarm limit', FloatRange(unit='N'), readonly=False, default=2000)
def query(self, adr, value=None):
if value is not None:
@@ -106,7 +109,14 @@ class DPM3(HasIO, Readable):
return int(back_value,16) - 1
def read_value(self):
return float(self.communicate('*1B1'))
value = float(self.communicate('*1B1'))
if abs(value) > self.alarm_limit:
if self.drive:
self.drive.write_interlock_reason('load above limit')
self.status = WARN, 'load above limit'
else:
self.status = IDLE, ''
return value
def read_offset(self):
reply = self.query(self.OFFSET)