some more merges from gerrit

- removed files
- modified drivers
- fixed READE.md

Change-Id: I47ae486df4dde3d60cc5e0e328194718dd396d87
This commit is contained in:
2022-03-08 08:52:29 +01:00
parent 57e0a2cc72
commit 10018b8cad
5 changed files with 21 additions and 329 deletions

View File

@ -20,7 +20,7 @@
# *****************************************************************************
"""Andeen Hagerling capacitance bridge"""
from secop.core import Done, FloatRange, HasIodev, Parameter, Readable, StringIO
from secop.core import Done, FloatRange, HasIO, Parameter, Readable, StringIO, nopoll
class Ah2700IO(StringIO):
@ -28,19 +28,19 @@ class Ah2700IO(StringIO):
timeout = 5
class Capacitance(HasIodev, Readable):
class Capacitance(HasIO, Readable):
value = Parameter('capacitance', FloatRange(unit='pF'), poll=True)
value = Parameter('capacitance', FloatRange(unit='pF'))
freq = Parameter('frequency', FloatRange(unit='Hz'), readonly=False, default=0)
voltage = Parameter('voltage', FloatRange(unit='V'), readonly=False, default=0)
loss = Parameter('loss', FloatRange(unit='deg'), default=0)
iodevClass = Ah2700IO
ioClass = Ah2700IO
def parse_reply(self, reply):
if reply.startswith('SI'): # this is an echo
self.sendRecv('SERIAL ECHO OFF')
reply = self.sendRecv('SI')
self.communicate('SERIAL ECHO OFF')
reply = self.communicate('SI')
if not reply.startswith('F='): # this is probably an error message like "LOSS TOO HIGH"
self.status = [self.Status.ERROR, reply]
return
@ -59,32 +59,35 @@ class Capacitance(HasIodev, Readable):
if lossunit == 'DS':
self.loss = loss
else: # the unit was wrong, we want DS = tan(delta), not NS = nanoSiemens
reply = self.sendRecv('UN DS').split() # UN DS returns a reply similar to SI
reply = self.communicate('UN DS').split() # UN DS returns a reply similar to SI
try:
self.loss = reply[7]
except IndexError:
pass # don't worry, loss will be updated next time
def read_value(self):
self.parse_reply(self.sendRecv('SI')) # SI = single trigger
self.parse_reply(self.communicate('SI')) # SI = single trigger
return Done
@nopoll
def read_freq(self):
self.read_value()
return Done
@nopoll
def read_loss(self):
self.read_value()
return Done
def read_volt(self):
@nopoll
def read_voltage(self):
self.read_value()
return Done
def write_freq(self, value):
self.parse_reply(self.sendRecv('FR %g;SI' % value))
self.parse_reply(self.communicate('FR %g;SI' % value))
return Done
def write_volt(self, value):
self.parse_reply(self.sendRecv('V %g;SI' % value))
def write_voltage(self, value):
self.parse_reply(self.communicate('V %g;SI' % value))
return Done

View File

@ -23,7 +23,7 @@
"""drivers for CCU4, the cryostat control unit at SINQ"""
# the most common Frappy classes can be imported from secop.core
from secop.core import EnumType, FloatRange, \
HasIodev, Parameter, Readable, StringIO
HasIO, Parameter, Readable, StringIO
class CCU4IO(StringIO):
@ -34,14 +34,13 @@ class CCU4IO(StringIO):
identification = [('cid', r'CCU4.*')]
# inheriting the HasIodev mixin creates us a private attribute *_iodev*
# for talking with the hardware
# inheriting HasIO allows us to use the communicate method for talking with the hardware
# Readable as a base class defines the value and status parameters
class HeLevel(HasIodev, Readable):
class HeLevel(HasIO, Readable):
"""He Level channel of CCU4"""
# define the communication class to create the IO module
iodevClass = CCU4IO
ioClass = CCU4IO
# define or alter the parameters
# as Readable.value exists already, we give only the modified property 'unit'
@ -71,7 +70,7 @@ class HeLevel(HasIodev, Readable):
for changing a parameter
:returns: the (new) value of the parameter
"""
name, txtvalue = self._iodev.communicate(cmd).split('=')
name, txtvalue = self.communicate(cmd).split('=')
assert name == cmd.split('=')[0] # check that we got a reply to our command
return txtvalue # Frappy will automatically convert the string to the needed data type