SR_7270: autorange is an enum
- autorange may be off, soft or hard
This commit is contained in:
parent
82b4af4faa
commit
ad2a79c312
@ -21,7 +21,7 @@
|
||||
"""SIGNAL RECOVERY SR7270: lOCKIN AMPLIFIER FOR AC SUSCEPTIBILITY"""
|
||||
|
||||
from secop.core import Readable, Parameter, Override, Command, FloatRange, TupleOf, \
|
||||
HasIodev, StringIO, Done, Attached, IntRange, BoolType
|
||||
HasIodev, StringIO, Done, Attached, IntRange, BoolType, EnumType
|
||||
|
||||
|
||||
class SR7270(StringIO):
|
||||
@ -42,6 +42,8 @@ class XY(HasIodev, Readable):
|
||||
'freq_arg': Attached(),
|
||||
'amp_arg': Attached(),
|
||||
'tc_arg': Attached(),
|
||||
'phase_arg': Attached(),
|
||||
'dac_arg': Attached(),
|
||||
}#parameters required an initial value but initwrite write the default value for polled parameters
|
||||
parameters = {
|
||||
'value': Override('X, Y', datatype=TupleOf(FloatRange(unit='V'), FloatRange(unit='V'))),
|
||||
@ -50,21 +52,24 @@ class XY(HasIodev, Readable):
|
||||
poll=True, readonly=False, initwrite=True, default=1000),
|
||||
'amp': Parameter('exc_volt_int',
|
||||
FloatRange(0.00,5,unit='Vrms'),
|
||||
poll=True, readonly=False, initwrite=True, default=1),
|
||||
poll=True, readonly=False, initwrite=True, default=0.1),
|
||||
'range': Parameter('sensitivity value', FloatRange(0.00,1,unit='V'), poll=True, default=1),
|
||||
'irange': Parameter('sensitivity index', IntRange(0,27), poll=True, readonly=False, default=25),
|
||||
'autorange': Parameter('autorange_on', BoolType(), readonly=False, default=True),
|
||||
'autorange': Parameter('autorange_on', EnumType('autorange', off=0, soft=1, hard=2), readonly=False, default=0, initwrite=True),
|
||||
'tc': Parameter('time constant value', FloatRange(10e-6,100,unit='s'), poll=True, default=0.1),
|
||||
'itc': Parameter('time constant index', IntRange(0,30), poll=True, readonly=False, initwrite=True, default=14),
|
||||
'nm': Parameter ('noise mode',BoolType(), readonly=False, default=0),
|
||||
'phase': Parameter('Reference phase control', FloatRange(-360,360,unit='deg'), poll=True, readonly=False, initwrite=True, default=0),
|
||||
'vmode' : Parameter('Voltage input configuration', IntRange(0,3), readonly=False, default=3),
|
||||
# 'dac': Parameter ('output DAC channel value', datatype=TupleOf(IntRange(1,4), FloatRange(0.00,5000,unit='mV')), poll=True, readonly=False, initwrite=True, default=(3,0)),
|
||||
'dac': Parameter ('output DAC channel value', FloatRange(0.00,5000,unit='mV'), poll=True, readonly=False, initwrite=True, default=0),
|
||||
}
|
||||
commands = {
|
||||
'aphase': Command('auto phase'),
|
||||
}
|
||||
iodevClass = SR7270
|
||||
|
||||
|
||||
def comm(self, command):
|
||||
reply, status, overload = self.sendRecv(command).split(';')
|
||||
if overload != '0':
|
||||
@ -77,7 +82,7 @@ class XY(HasIodev, Readable):
|
||||
reply = self.comm('XY.').split(',')
|
||||
x = float(reply[0])
|
||||
y = float(reply[1])
|
||||
if self.autorange:
|
||||
if self.autorange == 1: # soft
|
||||
if max(abs(x), abs(y)) >= 0.9*self.range and self.irange < 27:
|
||||
self.write_irange(self.irange+1)
|
||||
elif max(abs(x), abs(y)) <= 0.3*self.range and self.irange > 1:
|
||||
@ -88,6 +93,8 @@ class XY(HasIodev, Readable):
|
||||
self._freq_arg.value = self.freq
|
||||
self._amp_arg.value = self.amp
|
||||
self._tc_arg.value = self.tc
|
||||
self._phase_arg.value = self.phase
|
||||
self._dac_arg.value = self.dac
|
||||
return x,y
|
||||
|
||||
def read_freq(self):
|
||||
@ -99,6 +106,22 @@ class XY(HasIodev, Readable):
|
||||
|
||||
return value
|
||||
|
||||
def write_autorange(self, value):
|
||||
if value == 2: # hard
|
||||
self.comm('AS') # put hardware autorange on
|
||||
self.comm('AUTOMATIC. 1')
|
||||
else:
|
||||
self.comm('AUTOMATIC. 0')
|
||||
return value
|
||||
|
||||
def read_autorange(self):
|
||||
reply=self.comm('AUTOMATIC')
|
||||
# determine hardware autorange
|
||||
if reply == 1: #"hardware auto range is on":
|
||||
return 2 # hard
|
||||
if self.autorange == 0: # soft
|
||||
return self.autorange() #read autorange
|
||||
return reply # off
|
||||
|
||||
#oscillator amplitude module
|
||||
def read_amp(self):
|
||||
@ -110,6 +133,19 @@ class XY(HasIodev, Readable):
|
||||
|
||||
return value
|
||||
|
||||
#external output DAC
|
||||
def read_dac(self):
|
||||
# reply = self.comm('DAC %g' % channel) # failed to add the DAC channel you want to control
|
||||
reply = self.comm('DAC 3') #stack to channel 3
|
||||
return reply
|
||||
|
||||
def write_dac(self,value):
|
||||
#self.comm('DAC %g %g' % channel % value)
|
||||
self.comm('DAC 3 %g' % value)
|
||||
|
||||
return value
|
||||
|
||||
|
||||
#sensitivity module
|
||||
def read_range(self):
|
||||
reply = self.comm('SEN.')
|
||||
|
Loading…
x
Reference in New Issue
Block a user