[wip] next version of FG

This commit is contained in:
local SE user 2020-11-10 11:55:09 +01:00
parent 2fb05b37f8
commit cab2bb85ba

View File

@ -24,42 +24,17 @@ from secop.core import Readable, Parameter, Override, Command, FloatRange, Tuple
HasIodev, StringIO, Done, Attached, IntRange, BoolType, EnumType,StringType
#class SR7270(StringIO):
# end_of_line = b'\x00'
class StringIO(secop.stringio.StringIO):
identification = [('*IDN?', 'WST,WaveStation 3000,.*')]
wait_before = 0.05
# to update....
# def do_communicate(self, command): #remove dash from terminator
# reply = StringIO.do_communicate(self, command)
# status = self._conn.readbytes(2, 0.1) # get the 2 status bytes
# print('comm=',command,'reply=',reply,'status=',status)
# return reply + ';%d;%d' % tuple(status)
class channels(HasIodev, Readable):
class Channel(HasIodev, Writable):
properties = {
'out1_arg': Attached(),
'freq1_arg': Attached(),
'amp1_arg': Attached(),
'off1_arg': Attached(),
'out2_arg': Attached(),
'freq2_arg': Attached(),
'amp2_arg': Attached(),
'off2_arg': Attached(),
'channel':Property('choose channel to manipulate',IntRange(1,2)),
}
parameters = {
'value': Parameter('channel status',StringType, poll=False,initwrite=False),
'channel':Parameter('choose channel to manipulate',IntRange(1,2), poll=True,initwrite=False,default=1),
'freq': Parameter('exc_freq_int',
'value': Override('exc_freq_int',
FloatRange(unit='Hz'),
poll=True, default=1000),
'target': Override('frequency set',
FloatRange(1e-6,20e6,unit='Hz'),
poll=True, readonly=False, initwrite=True, default=1000),
poll=True, initwrite=True, default=1000),
'amp': Parameter('exc_volt_int',
FloatRange(0.00,5,unit='Vrms'),
poll=True, readonly=False, initwrite=True, default=0.1),
@ -73,19 +48,10 @@ class channels(HasIodev, Readable):
}
pollerClass = Poller
ioidevClass = StringIO
# def comm(self, command):
# reply, status, overload = self.sendRecv(command).split(';')
# if overload != '0':
# self.status = self.Status.WARN, 'overload %s' % overload
# else:
# self.status = self.Status.IDLE, ''
# return reply
#update instruments values
"""
def read_value(self):
#response type: self._freq1_arg.value = self.freq(1) C1:BSWV TYPE', 'SINE', 'FRQ', '1000', 'AMP', '3', 'OFST', '3
# channel 1 status
@ -102,7 +68,17 @@ class channels(HasIodev, Readable):
self._off2_arg.value = reply[7]
self._out2_arg.value = out2.split('')[1]
return reply, out, reply2, out2
"""
def read_value(self):
reply = self.sendRecv('C%d:BSWV FRQ?' % self.channel)
return reply
def write_target(self,value):
self.sendRecv('C%d:BSWV FRQ, %g' % (self.channel, str(value)+'Hz'))
#signal channel parameter
def read_channel(self):
@ -129,6 +105,7 @@ class channels(HasIodev, Readable):
return reply
"""
#signal freq parameter
def read_freq(self):
ch=str(self.channel)
@ -141,7 +118,8 @@ class channels(HasIodev, Readable):
self.sendRecv('C'+ch+':BSWV FRQ, %g' % str(value)+'Hz')
return value
"""
#signal amplitude parameter
def read_amp(self):
ch=str(self.channel)
@ -219,4 +197,4 @@ class arg2(Readable):
pollerClass = None
parameters = {
'value': Override(datatype=BoolType(unit='')),
}
}