diff --git a/cfg/ppms_proxy_test_cfg.py b/cfg/ppms_proxy_test_cfg.py index 0f077b8..7df35c2 100644 --- a/cfg/ppms_proxy_test_cfg.py +++ b/cfg/ppms_proxy_test_cfg.py @@ -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), ) diff --git a/cfg/softcal_cfg.py b/cfg/softcal_cfg.py index 32e2c26..6d0fdf0 100644 --- a/cfg/softcal_cfg.py +++ b/cfg/softcal_cfg.py @@ -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', ) diff --git a/frappy/proxy.py b/frappy/proxy.py index cabb656..72640f2 100644 --- a/frappy/proxy.py +++ b/frappy/proxy.py @@ -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) diff --git a/frappy_psi/ppms.py b/frappy_psi/ppms.py index ba3ea72..e0a3063 100644 --- a/frappy_psi/ppms.py +++ b/frappy_psi/ppms.py @@ -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