Updated the ACM1219 driver

This commit is contained in:
Paul Neves 2024-07-02 15:54:25 +02:00
parent 92c53ad3ba
commit 0a5de1ebc2
3 changed files with 61 additions and 3 deletions

View File

@ -33,7 +33,7 @@ Mod('V2',
Mod('io2',
'frappy_psi.ACM1219.ACM1219IO',
'communication',
uri='serial:///dev/tty.usbserial-A700fmAI?baudrate=9600+bytesize=8+parity=none+stopbits=1')
uri='serial:///dev/tty.usbserial-A904TGR7?baudrate=9600+bytesize=8+parity=none+stopbits=1')
Mod('C1C2',
'frappy_psi.ACM1219.BothChannels',
'Capacitance channels 1 and 2',
@ -58,6 +58,24 @@ Mod('F',
Cp=0.0755,
f0_curve={'a':38.9,'b':-0.0147,'c':-0.000346,'d':8.96e-7,'e':-1.58e-9},
temp='T')
Mod('stress',
'frappy_psi.ACM1219.Stress',
'Sample stress from force',
force='F',
area=0.1,
)
Mod('strain',
'frappy_psi.ACM1219.Strain',
'Sample strain from force',
displacement='d',
L=3,
)
Mod('YM',
'frappy_psi.ACM1219.YoungsModulus',
'Sample youngs modulus from stress and strain',
stress='stress',
strain='strain',
)
Mod('T',
'frappy_psi.dummy.Temp',

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

View File

@ -28,4 +28,7 @@ class Temp(Writable):
readonly=False)
def write_target(self, target):
self.value = target
self.value = target
def read_value(self):
return 0