fix ppms with proxy

- proxy: remote parameter status should overddide datatype from
  ProxyModule.status
- ppms: create PpmsDrivable instead of importing from
  (PpmsBase, Drivable). Order matters for status parameter!
- update cfg files

Change-Id: If8fc263cffb903d8b3c1a93a089dcac3597d13a0
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30512
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2023-02-21 10:23:34 +01:00
parent b5205d7c7a
commit 0acb80380a
4 changed files with 31 additions and 18 deletions

View File

@ -1,6 +1,6 @@
Node('filtered.PPMS.psi.ch',
'filtered PPMS at PSI',
'localhost:5002',
'tcp://5002',
)
@ -16,6 +16,6 @@ Mod('mf',
remote_class = 'frappy_psi.ppms.Field',
io = 'secnode',
value = Param(min = -0.1, max = 0.1),
target = Param(min = -8, max = 8),
value = Param(),
target = Param(min=-0.1, max=0.1),
)

View File

@ -1,16 +1,20 @@
Node('r3',
'temp sensor on 3He system',
'tcp://pc12694:5000',
cls = 'frappy.core.Proxy',
remote_class = 'frappy_mlz.amagnet.GarfieldMagnet',
#remote_class = 'frappy.core.Readable',
Node('softcal.demo.example',
'convert r2 from PPMS to a temperature',
'tcp://5001',
)
Mod('r2',
'frappy.core.Proxy',
'convert r2 from PPMS to a temperature',
remote_class = 'frappy.core.Readable',
uri = 'tcp://localhost:5000',
export = False,
)
Mod('t3',
Mod('T2',
'frappy_psi.softcal.Sensor',
'',
value = Param(unit = 'K'),
rawsensor = 'r3',
rawsensor = 'r2',
calib = 'X131346',
)

View File

@ -72,7 +72,8 @@ class ProxyModule(HasIO, Module):
pname, pobj = params.popitem()
props = remoteparams.get(pname, None)
if props is None:
self.log.warning('remote parameter %s:%s does not exist' % (self.module, pname))
if pobj.export:
self.log.warning('remote parameter %s:%s does not exist' % (self.module, pname))
continue
dt = props['datatype']
try:
@ -185,6 +186,10 @@ def proxy_class(remote_class, name=None):
for aname, aobj in rcls.accessibles.items():
if isinstance(aobj, Parameter):
pobj = aobj.copy()
# we have to set own properties of pobj to the inherited ones
# this matters for the ProxyModule.status datatype, which should be
# overidden by the remote class status datatype
pobj.ownProperties = pobj.propertyValues
pobj.merge({'needscfg': False})
attrs[aname] = pobj
@ -217,7 +222,7 @@ def proxy_class(remote_class, name=None):
else:
raise ConfigError('do not now about %r in %s.accessibles' % (aobj, remote_class))
return type(name, (proxycls,), attrs)
return type(name+"_", (proxycls,), attrs)
def Proxy(name, logger, cfgdict, srv):
@ -232,6 +237,6 @@ def Proxy(name, logger, cfgdict, srv):
if 'description' not in cfgdict:
cfgdict['description'] = 'remote module %s on %s' % (
cfgdict.get('module', name),
cfgdict.get('io', {'value:': '?'})['value'])
cfgdict.get('io', {'value:': '?'})['value'])
return proxy_class(remote_class)(name, logger, cfgdict, srv)

View File

@ -155,6 +155,10 @@ class PpmsBase(HasIO, Readable):
raise HardwareError('bad reply %r to command %r' % (reply, command))
class PpmsDrivable(Drivable, PpmsBase):
pass
class Channel(PpmsBase):
"""channel base class"""
@ -283,7 +287,7 @@ class Level(PpmsBase):
return literal_eval(self.communicate('LEVEL?'))[0]
class Chamber(PpmsBase, Drivable):
class Chamber(PpmsDrivable):
"""sample chamber handling
value is an Enum, which is redundant with the status text
@ -334,7 +338,7 @@ class Chamber(PpmsBase, Drivable):
return self.read_target()
class Temp(PpmsBase, Drivable):
class Temp(PpmsDrivable):
"""temperature"""
Status = Enum(
@ -501,7 +505,7 @@ class Temp(PpmsBase, Drivable):
self._stopped = True
class Field(PpmsBase, Drivable):
class Field(PpmsDrivable):
"""magnetic field"""
Status = Enum(
@ -639,7 +643,7 @@ class Field(PpmsBase, Drivable):
self._stopped = True
class Position(PpmsBase, Drivable):
class Position(PpmsDrivable):
"""rotator position"""
Status = Drivable.Status