add reading of slave currents and voltages

with fast polling
This commit is contained in:
l_samenv 2022-09-14 10:59:55 +02:00
parent 12cb0cdade
commit c3f55435da

View File

@ -22,7 +22,7 @@
from secop.core import Parameter, EnumType, FloatRange, BoolType
from secop.lib.enum import Enum
from secop.errors import BadValueError
from secop.errors import BadValueError, HardwareError
from secop_psi.magfield import Magfield
from secop_psi.mercury import MercuryChannel, off_on, Mapped
@ -37,6 +37,12 @@ class Field(MercuryChannel, Magfield):
setpoint = Parameter('field setpoint', FloatRange(unit='T'), default=0)
voltage = Parameter('leads voltage', FloatRange(unit='V'), default=0)
atob = Parameter('field to amp', FloatRange(0, unit='A/T'), default=0)
I1 = Parameter('master current', FloatRange(unit='A'), default=0)
I2 = Parameter('slave 2 current', FloatRange(unit='A'), default=0)
I3 = Parameter('slave 3 current', FloatRange(unit='A'), default=0)
V1 = Parameter('master voltage', FloatRange(unit='V'), default=0)
V2 = Parameter('slave 2 voltage', FloatRange(unit='V'), default=0)
V3 = Parameter('slave 3 voltage', FloatRange(unit='V'), default=0)
forced_persistent_field = Parameter(
'manual indication that persistent field is bad', BoolType(), readonly=False, default=False)
@ -46,6 +52,10 @@ class Field(MercuryChannel, Magfield):
slave_currents = None
__init = True
def doPoll(self):
super().doPoll()
self.read_current()
def read_value(self):
self.current = self.query('PSU:SIG:FLD')
pf = self.query('PSU:SIG:PFLD')
@ -104,7 +114,11 @@ class Field(MercuryChannel, Magfield):
current = self.query('PSU:SIG:CURR')
for i in range(self.nslaves + 1):
if i:
self.slave_currents[i].append(self.query('DEV:PSU.M%d:PSU:SIG:CURR' % i))
curri = self.query('DEV:PSU.M%d:PSU:SIG:CURR' % i)
volti = self.query('DEV:PSU.M%d:PSU:SIG:VOLT' % i)
setattr(self, 'I%d' % i, curri)
setattr(self, 'V%d' % i, volti)
self.slave_currents[i].append(curri)
else:
self.slave_currents[i].append(current)
min_i = min(self.slave_currents[i])