Updated the ACM1219 driver

This commit is contained in:
Paul Neves
2024-07-02 15:54:25 +02:00
committed by Markus Zolliker
parent c3b1ce4b8c
commit bb6cf9caa1
2 changed files with 57 additions and 2 deletions

View File

@ -23,7 +23,7 @@ from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Proper
class ACM1219IO(StringIO):
"""communication with ACM1219"""
end_of_line = '\n'
end_of_line = ('\r\n', '\r') # ('\n', '\r') ('\r\n', '\r')
wait_before = 0.05
identification = [('*IDN?', r'.*')]
@ -150,6 +150,43 @@ class Force(Readable):
force = alpha / (cap - self.Cp) - self.f0 - f0_T
return force
class Stress(Readable):
# attached classes for displacement
force = Attached()
# modifying a property of inherited parameters (unit is propagated to the FloatRange datatype)
value = Parameter('stress', FloatRange(None, None, unit='GPa'), readonly=True)
area = Parameter('cross sectional area of sample in mm^2', FloatRange(None, None, unit='mm^2'), readonly=False)
def read_value(self):
return self.force.value / self.area / 1000
class Strain(Readable):
# attached classes for displacement
displacement = Attached()
# modifying a property of inherited parameters (unit is propagated to the FloatRange datatype)
value = Parameter('strain', FloatRange(None, None, unit='m/m'), readonly=True)
L = Parameter('length of sample in mm', FloatRange(None, None, unit='mm'), readonly=False)
def read_value(self):
return self.displacement.value / (1000*self.L)
class YoungsModulus(Readable):
# attached classes for displacement
stress = Attached()
strain = Attached()
# modifying a property of inherited parameters (unit is propagated to the FloatRange datatype)
value = Parameter('Young\'s modulus', FloatRange(None, None, unit='GPa'), readonly=True)
def read_value(self):
return self.stress.value / self.strain.value