frappy_psi/ls372: add changing pid
Change-Id: I8768b1e6609a42553b8e98866540fe33d1b5cd89
This commit is contained in:
parent
fa37b43be2
commit
4da6aa95d7
@ -31,6 +31,7 @@ import frappy.io
|
||||
from frappy.datatypes import BoolType, EnumType, FloatRange, IntRange
|
||||
from frappy.lib import formatStatusBits
|
||||
from frappy.core import Command, Drivable, Parameter, Property, CommonReadHandler, CommonWriteHandler
|
||||
from frappy.extparams import StructParam
|
||||
from frappy_psi.convergence import HasConvergence
|
||||
from frappy_psi.channelswitcher import Channel, ChannelSwitcher
|
||||
|
||||
@ -215,7 +216,7 @@ class ResChannel(Channel):
|
||||
def change(self, command, *args):
|
||||
cmd, _, qarg = command.partition(' ')
|
||||
args = ','.join([qarg] + [f'{a:g}' for a in args])
|
||||
return parse(self.switcher.communicate(f'{command}?{qarg};{command} {args}'))
|
||||
return parse(self.switcher.communicate(f'{cmd} {args};{cmd}?{qarg}'))
|
||||
|
||||
def read_status(self):
|
||||
if not self.enabled:
|
||||
@ -360,7 +361,6 @@ class ResChannel(Channel):
|
||||
return settle
|
||||
|
||||
|
||||
|
||||
class TemperatureChannel(ResChannel):
|
||||
raw = Parameter('raw reistance value', FloatRange(unit='Ohm'))
|
||||
value = Parameter('temperature sensor', FloatRange(0, unit='K'))
|
||||
@ -384,6 +384,12 @@ class TemperatureLoop(HasConvergence, TemperatureChannel, Drivable):
|
||||
minheater = Parameter('minimal heater current', FloatRange(0, 0.01, unit='A'), readonly=False, default=0)
|
||||
HTRRNG = {n: i for i, n in enumerate(['off', '30uA', '100uA', '300uA', '1mA', '3mA', '10mA', '30mA', '100mA'])}
|
||||
htrrng = Parameter('', EnumType(HTRRNG), readonly=False)
|
||||
ctrlpars = StructParam('control parameters struct', {
|
||||
'p': Parameter('proportional heat parameter', FloatRange()),
|
||||
'i': Parameter('integral heat parameter', FloatRange()),
|
||||
'd': Parameter('derivative heat parameter', FloatRange()),
|
||||
}, readonly=False)
|
||||
|
||||
_control_active = False
|
||||
|
||||
def doPoll(self):
|
||||
@ -440,10 +446,10 @@ class TemperatureLoop(HasConvergence, TemperatureChannel, Drivable):
|
||||
self.communicate(f'SETP {self.loop},{target};*OPC?')
|
||||
return target
|
||||
|
||||
#def write_ctrlpars(self, ctrlpars):
|
||||
# p, i, d = self.change(f'PID {self.loop}', ctrlpars['p'], ctrlpars['i'], ctrlpars['d'])
|
||||
# return {'p': p, 'i': i, 'd': d}
|
||||
def write_ctrlpars(self, ctrlpars):
|
||||
p, i, d = self.change(f'PID {self.loop}', ctrlpars['p'], ctrlpars['i'], ctrlpars['d'])
|
||||
return {'p': p, 'i': i, 'd': d}
|
||||
|
||||
#def read_ctrlpars(self):
|
||||
# p, i, d = self.query(f'PID? {self.loop}')
|
||||
# return {'p': p, 'i': i, 'd': d}
|
||||
def read_ctrlpars(self):
|
||||
p, i, d = self.query(f'PID?{self.loop}')
|
||||
return {'p': p, 'i': i, 'd': d}
|
||||
|
Loading…
x
Reference in New Issue
Block a user