From 5458911b6720dfece743af767258b2d2b73434fd Mon Sep 17 00:00:00 2001 From: Enrico Faulhaber Date: Wed, 30 Oct 2019 17:24:03 +0100 Subject: [PATCH] Adapt sim_* cfg's to current syntax + make 'limit' usable as type in cfg files + minor fixes Change-Id: Ib94b2645c7a0d978d64d4c86c4415d4b5b0d485f Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21485 Tested-by: Enrico Faulhaber Tested-by: JenkinsCodeReview Reviewed-by: Enrico Faulhaber --- cfg/cryo.cfg | 5 +- cfg/sim.cfg | 2 +- cfg/sim_mlz_amagnet.cfg | 44 +++++----------- cfg/sim_mlz_cci3he1.cfg | 44 ++++++++-------- cfg/sim_mlz_ccidu1.cfg | 47 +++++++++++------ cfg/sim_mlz_ccr12.cfg | 88 ++++++++++++++++++------------- cfg/sim_mlz_ccr12_v2.cfg | 95 ++++++++++++++++++---------------- cfg/sim_mlz_htf02.cfg | 13 +++-- cfg/sim_mlz_stressihtf2.cfg | 35 ++++++------- cfg/sim_mlz_stressihtf2_v2.cfg | 41 +++++++-------- secop/client/baseclient.py | 1 + secop/datatypes.py | 13 ++--- secop/lib/sequence.py | 2 +- secop/metaclass.py | 11 ++-- secop/modules.py | 2 + secop/simulation.py | 10 +++- secop_demo/cryo.py | 3 +- secop_demo/modules.py | 4 +- secop_mlz/amagnet.py | 8 +-- secop_mlz/entangle.py | 4 +- 20 files changed, 246 insertions(+), 226 deletions(-) diff --git a/cfg/cryo.cfg b/cfg/cryo.cfg index 5fb44eb..fc8daab 100644 --- a/cfg/cryo.cfg +++ b/cfg/cryo.cfg @@ -1,7 +1,7 @@ [node cryo_7] # set SEC-node properties description = short description - . + . This is a very long description providing all the glory details in all the glory details about the stuff we are describing @@ -10,11 +10,10 @@ type=tcp bindto=0.0.0.0 bindport=10769 - [module cryo] # some (non-defaut) module properties .group=very important/stuff -.description=A simulated cc cryostat with heat-load, specific heat for the sample +.description=A simulated cc cryostat with heat-load, specific heat for the sample and a temperature dependend heat-link between sample and regulation. # class of module: diff --git a/cfg/sim.cfg b/cfg/sim.cfg index 098459a..4247b11 100644 --- a/cfg/sim.cfg +++ b/cfg/sim.cfg @@ -13,7 +13,7 @@ bindport=10767 class=secop.simulation.SimDrivable .description=simulation stuff .extra_params=param3,param4,jitter,ramp -param3.datatype=['bool'] +param3.datatype={"type":"bool"} param3.default=True param3.readonly=False jitter.default=1 diff --git a/cfg/sim_mlz_amagnet.cfg b/cfg/sim_mlz_amagnet.cfg index 1dc516f..b65775e 100644 --- a/cfg/sim_mlz_amagnet.cfg +++ b/cfg/sim_mlz_amagnet.cfg @@ -20,60 +20,54 @@ bindport=10767 [module enable] class=secop.simulation.SimWritable -value.datatype=["enum", {'On':1,'Off':0}] -target.datatype=["enum", {'On':1,'Off':0}] +value.datatype={"type":"enum", "members":{'On':1,'Off':0}} +target.datatype={"type":"enum", "members":{'On':1,'Off':0}} .description='Enables to Output of the Powersupply' .visibility='advanced' [module polarity] class=secop.simulation.SimWritable -value.datatype=["enum", {'+1':1,'0':0,'-1':-1}] -target.datatype=["enum", {'+1':1,'0':0,'-1':-1}] +value.datatype={"type":"enum", "members":{'+1':1,'0':0,'-1':-1}} +target.datatype={"type":"enum", "members":{'+1':1,'0':0,'-1':-1}} .description=polarity (+/-) switch . there is an interlock in the plc: if there is current, switching polarity is forbidden if polarity is short, powersupply is disabled .visibility=advanced -#comtries = 50 [module symmetry] class=secop.simulation.SimWritable -value.datatype=["enum",{'symmetric':1,'short':0, 'asymmetric':-1}] -target.datatype=["enum",{'symmetric':1,'short':0, 'asymmetric':-1}] +value.datatype={"type":"enum", "members":{'symmetric':1,'short':0, 'asymmetric':-1}} +target.datatype={"type":"enum", "members":{'symmetric':1,'short':0, 'asymmetric':-1}} .description=par/ser switch selecting (a)symmetric mode . note: on the front panel symmetric is ser, asymmetric is par .visibility=advanced value.default = 'symmetric' -value.value = 'symmetric' [module T1] class=secop.simulation.SimReadable .description=Temperature1 of the coils system -#warnlimits=(0, 50) value.unit='degC' value.default = 23.45 [module T2] class=secop.simulation.SimReadable .description=Temperature2 of the coils system -#warnlimits=(0, 50) value.unit='degC' value.default = 23.45 [module T3] class=secop.simulation.SimReadable .description=Temperature3 of the coils system -#warnlimits=(0, 50) value.unit='degC' value.default = 23.45 [module T4] class=secop.simulation.SimReadable .description=Temperature4 of the coils system -#warnlimits=(0, 50) value.unit='degC' value.default = 23.45 @@ -86,31 +80,22 @@ ramp=60 precision=0.02 current=0 voltage=10 -#unit=A .visibility=advanced .extra_params = abslimits, speed, ramp, precision, current, voltage, window -abslimits.datatype = ["tuple", [["double"], ["double"]]] -abslimits.value = (0, 200) +abslimits.datatype = {"type":"limit", "members":{"type":"double", "min":0, "max":200, "unit":"A"}} abslimits.default = (0, 200) -abslimits.unit = 'A' -speed.datatype = ["double", 0, 10] +speed.datatype = {"type":"double", "min":0, "max":10, "unit":"A/s"} speed.default = 10 -speed.unit = 'A/s' -ramp.datatype = ["double", 0, 600] +ramp.datatype = {"type":"double", "min":0, "max":600, "unit":"A/min"} ramp.default = 600 -ramp.unit = 'A/min' -precision.datatype = ["double"] +precision.datatype = {"type":"double", "unit":"A"} precision.default = 0.1 -precision.unit = 'A' -current.datatype = ["double", 0, 200] +current.datatype = {"type":"double", "min":0, "max":200, "unit":"A"} current.default = 0 -current.unit = 'A' -voltage.datatype = ["double", 0, 10] +voltage.datatype = {"type":"double", "min":0, "max":10, "unit":"V"} voltage.default = 0 -voltage.unit = 'V' -window.datatype = ["double", 0, 120] +window.datatype = {"type":"double", "min":0, "max":120, "unit":"s"} window.default = 10 -window.unit = 's' [module mf] class=secop_mlz.amagnet.GarfieldMagnet @@ -125,8 +110,7 @@ userlimits=(-0.35, 0.35) calibrationtable={'symmetric':[0.00186517, 0.0431937, -0.185956, 0.0599757, 0.194042], 'short': [0.0, 0.0, 0.0, 0.0, 0.0], 'asymmetric':[0.00136154, 0.027454, -0.120951, 0.0495289, 0.110689]} -.meaning=The magnetic field -.priority=100 +.meaning=["magneticfield", 20] .visibility=user abslimits.default=-0.4,0.4 diff --git a/cfg/sim_mlz_cci3he1.cfg b/cfg/sim_mlz_cci3he1.cfg index 811f0cd..d04d9d9 100644 --- a/cfg/sim_mlz_cci3he1.cfg +++ b/cfg/sim_mlz_cci3he1.cfg @@ -4,7 +4,6 @@ description = [sim] cci3he box of MLZ Sample environment group Controls an 3He insert with an ls370 and an PLC controlling the compressor and the valves of the gas handling. -.meaning={'T_regulation':{'T_cci3he1':300}, 'T_sample':{'T_cci3he1_A':300, 'T_cci3he1_B':280}} [interface tcp] type=tcp @@ -16,78 +15,79 @@ class=secop.simulation.SimDrivable .description=Main temperature control node of cci3he1. . Controls the regulation loop of the ls370. -value.unit='K' +value.datatype={"type":"double","unit":"K"} value.default=300 -target.datatype=["double", 0, 300] +target.datatype={"type":"double", "min":0, "max":300, "unit":"K"} target.default=300 -target.unit='K' .extra_params=ramp -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double","min":0,"max":600,"unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min +.meaning=["temperature_regulation",40] [module T_cci3he1_A] class=secop.simulation.SimReadable .description=3He pot temperature sensor. Also used for the regulation. .visibility=expert value.default=300 -value.unit='K' +value.datatype={"type":"double","unit":"K"} +.meaning=["temperature",38] [module T_cci3he1_B] class=secop.simulation.SimReadable .description=(optional) sample temperature sensor close to sample. -.visibility=expert +.visibility=user value.default=300 -value.unit='K' +value.datatype={"type":"double","unit":"K"} +.meaning=["temperature",39] [module cci3he1_p1] class=secop.simulation.SimReadable .description=Pressure at turbo pump inlet. .visibility=expert -value.default=999 -value.unit=mbar +value.default=2e-3 +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_p2] class=secop.simulation.SimReadable .description=Pressure at turbo pump outlet. .visibility=expert -value.default=999 -value.unit=mbar +value.default=9.87 +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_p3] class=secop.simulation.SimReadable .description=Pressure at compressor inlet. .visibility=expert -value.default=999 -value.unit=mbar +value.default=19.99 +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_p4] class=secop.simulation.SimReadable .description=Pressure at compressor outlet. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_p5] class=secop.simulation.SimReadable .description=Pressure in dump tank. .visibility=expert -value.default=999 -value.unit=mbar +value.default=567 +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_p6] class=secop.simulation.SimReadable .description=Pressure in the vacuum dewar (ivc). .visibility=expert -value.default=999 -value.unit=mbar +value.default=1e-3 +value.datatype={"type":"double","unit":"mbar"} [module cci3he1_flow] class=secop.simulation.SimReadable .description=Gas Flow (condensing line). .visibility=expert -value.default=999 -value.unit=mln/min +value.default=12.34 +value.datatype={"type":"double","unit":"mln/min"} # note: all valves and switches are missing: use VNC to control them diff --git a/cfg/sim_mlz_ccidu1.cfg b/cfg/sim_mlz_ccidu1.cfg index 7b2173d..a6cea34 100644 --- a/cfg/sim_mlz_ccidu1.cfg +++ b/cfg/sim_mlz_ccidu1.cfg @@ -1,10 +1,9 @@ [node ccidu1] description = [sim] ccidu box of MLZ Sample environment group . - Controls an 3He/4He dilution insert with an ls370 and an PLC controlling + Controls an 3He/4He dilution insert with an ls372 and an PLC controlling the compressor and the valves of the gas handling. -.meaning={'T_regulation':{'T_ccidu1':300}, 'T_sample':{'T_ccidu1_A':300, 'T_ccidu1_B':280}} [interface tcp] type=tcp @@ -15,80 +14,94 @@ bindport=10767 class=secop.simulation.SimDrivable .description=Main temperature control node of ccidu1. . - Controls the regulation loop of the ls370. + Controls the regulation loop of the ls372. value.unit='K' value.default=300 -target.datatype=["double", 0, 300] +target.datatype={"type":"double", "min":0, "max":300, "unit":"K"} target.default=300 -target.unit='K' .extra_params=ramp -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0, "max":600, "unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min +.meaning=["temperature_regulation",40] [module T_ccidu1_A] class=secop.simulation.SimReadable .description=mixing chamber temperature sensor. Also used for the regulation. .visibility=expert value.default=300 -value.unit='K' +value.datatype={"type":"double", "unit":"K"} +.meaning=["temperature",38] [module T_ccidu1_B] class=secop.simulation.SimReadable .description=(optional) sample temperature sensor close to sample. -.visibility=expert +.visibility=user value.default=300 -value.unit='K' +value.datatype={"type":"double", "unit":"K"} +.meaning=["temperature",39] [module ccidu1_pstill] class=secop.simulation.SimReadable .description=Pressure at the still/turbo pump inlet. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_pinlet] class=secop.simulation.SimReadable .description=Pressure at forepump inlet/turbo pump outlet. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_poutlet] class=secop.simulation.SimReadable .description=Pressure at forepump outlet/compressor inlet. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_pkond] class=secop.simulation.SimReadable .description=Pressure at condensing line/compressor outlet. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_ptank] class=secop.simulation.SimReadable .description=Pressure in dump tank. .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_pvac] class=secop.simulation.SimReadable .description=Pressure in the vacuum dewar (ivc). .visibility=expert value.default=999 -value.unit=mbar +value.datatype={"type":"double", "unit":"mbar"} [module ccidu1_flow] class=secop.simulation.SimReadable .description=Gas Flow (condensing line). .visibility=expert value.default=999 -value.unit=mln/min +value.datatype={"type":"double", "unit":"mbar"} # note: all valves and switches are missing: use VNC to control them +[module ccidu1_V6] +class=secop.simulation.SimDrivable +.description=Needle valve +.visibility=expert +value.default=99 +value.datatype={"type":"double", "min":0, "max":100, "unit":"%%"} +[module ccidu1_V3] +class=secop.simulation.SimWritable +.description=Dump Valve +.visibility=expert +value.default="OFF" +value.datatype={"type":"enum", "members":{"on": 1, "OFF":0}} +target.datatype={"type":"enum", "members":{"on": 1, "OFF":0}} diff --git a/cfg/sim_mlz_ccr12.cfg b/cfg/sim_mlz_ccr12.cfg index ba7d6ac..b924dce 100644 --- a/cfg/sim_mlz_ccr12.cfg +++ b/cfg/sim_mlz_ccr12.cfg @@ -6,8 +6,6 @@ description = [sim] CCR12 box of MLZ Sample environment group . This is how we use it now. -.meaning={'T_regulation':{'T_ccr12':200, 'T_ccr12_stick':150, 'T_ccr12_tube':100}, 'T_sample':{'T_ccr12_B':100, 'T_ccr12_A':90, 'T_ccr12_D':20, 'T_ccr12_C':10}} - [interface tcp] type=tcp bindto=0.0.0.0 @@ -19,60 +17,69 @@ class=secop.simulation.SimDrivable . Switches between regulation on stick and regulation on tube depending on temperature requested. May also pump gas for higher temperatures, if configured. + . + Note: in nicos this is handled by its own class which manages T_ccr12_stick and T_ccr12_tube. + in this simulation this module is isolated. .extra_params=ramp -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0,"max":60, "unit":"K/min"} ramp.default=60 -value.unit='K' +value.datatype={"type":"double", "min":0,"max":600, "unit":"K"} value.default=300 -target.datatype=["double", 0, 600] +target.datatype={"type":"double", "min":0,"max":600, "unit":"K"} target.default=300 -target.unit='K' +.meaning=["temperature_regulation", 20] [module T_ccr12_stick] class=secop.simulation.SimDrivable .description=Temperature regulation for the sample stick in ccr12. .extra_params=ramp -target.datatype=["double", 0, 600] -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0,"max":60, "unit":"K/min"} ramp.default=60 -value.unit='K' +value.datatype={"type":"double", "min":0,"max":600, "unit":"K"} value.default=300 +target.datatype={"type":"double", "min":0,"max":600, "unit":"K"} target.default=300 +.meaning=["temperature_regulation", 15] [module T_ccr12_tube] class=secop.simulation.SimDrivable .description=Temperature regulation for the tube of ccr12. .extra_params=ramp -target.datatype=["double", 0, 300] -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0,"max":60, "unit":"K/min"} ramp.default=60 -value.unit='K' +value.datatype={"type":"double", "min":0,"max":600, "unit":"K"} value.default=300 +target.datatype={"type":"double", "min":0,"max":600, "unit":"K"} target.default=300 +.meaning=["temperature_regulation", 10] [module T_ccr12_A] class=secop.simulation.SimReadable .description=(optional) Sample temperature sensor. +value.datatype={"type":"double", "unit":"K"} value.default=300 -value.unit='K' +.meaning=["temperature", 9] [module T_ccr12_B] class=secop.simulation.SimReadable .description=(regulation) temperature sensor on stick. +value.datatype={"type":"double", "unit":"K"} value.default=300 -value.unit='K' +.meaning=["temperature", 10] [module T_ccr12_C] class=secop.simulation.SimReadable .description=Temperature at the coldhead. +value.datatype={"type":"double", "unit":"K"} value.default=70 -value.unit='K' +.meaning=["temperature", 1] [module T_ccr12_D] class=secop.simulation.SimReadable .description=(regulation) temperature at coupling to stick. +value.datatype={"type":"double", "unit":"K"} value.default=80 -value.unit='K' +.meaning=["temperature", 2] @@ -80,71 +87,78 @@ value.unit='K' class=secop.simulation.SimWritable .description=Selects on which Sensor the pressure regulation works, or switches it off. .visibility=expert +value.datatype={"type":"enum", "members":{'off':0,'p1':1,'p2':2}} value.default='off' -value.datatype=["enum", {'off':0,'p1':1,'p2':2}] -target.datatype=["enum", {'off':0,'p1':1,'p2':2}] +target.datatype={"type":"enum", "members":{'off':0,'p1':1,'p2':2}} +target.default='off' [module ccr12_compressor] class=secop.simulation.SimDrivable .description=Switches the compressor for the cooling stage on or off. . Note: This should always be on, except for fast heatup for sample change. -value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +value.default='on' +target.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.default='on' [module ccr12_gas_switch] class=secop.simulation.SimWritable .description=Switches the gas inlet on or off. + . + note: in reality this switches itself off after 15min. + note: in reality this is interlocked with ccr12_vacuum_switch, only one can be on! + note: in this simulation this module is isolated. +value.datatype={"type":"enum", "members":{'off':0,'on':1}} value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +target.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.default='off' [module ccr12_vacuum_switch] class=secop.simulation.SimWritable .description=Switches the vacuum pumping valve on or off. + . + note: in reality this is interlocked with ccr12_gas_switch, only one can be on! + note: in this simulation this module is isolated. +value.datatype={"type":"enum", "members":{'off':0,'on':1}} value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +target.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.default='off' [module ccr12_p1] class=secop.simulation.SimReadable .description=Default pressure Sensor, linear scale 0..1000mbar +value.datatype={"type":"double", "unit":"mbar"} value.default=999 -value.unit=mbar [module ccr12_p2] class=secop.simulation.SimReadable .description=Auxillary pressure Sensor. +value.datatype={"type":"double", "unit":"mbar"} value.default=1e-6 -value.unit=mbar [module ccr12_curve_p2] class=secop.simulation.SimWritable .description=Curve for Aux pressure Sensor p2 .visibility=expert value.default='TTR100' -value.datatype=["enum", {'10V':0,'default':1,'9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}] -target.datatype=["enum", {'10V':0,'default':1,'9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}] +value.datatype={"type":"enum", "members":{'0..10V':0,'default':1,'0..9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}} +target.datatype={"type":"enum", "members":{'0..10V':0,'default':1,'0..9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}} [module ccr12_p1_limits] class=secop.simulation.SimWritable .description=Limits for pressure regulation in P1. .visibility=expert -value.datatype=["tuple",[["double"],["double"]]] +value.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} value.default=[0,10] -value.unit=mbar -target.datatype=["tuple",[["double"],["double"]]] +target.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} target.default=[0,10] -target.unit=mbar [module ccr12_p2_limits] class=secop.simulation.SimWritable .description=Limits for pressure regulation in P2. .visibility=expert -value.datatype=["tuple",[["double"],["double"]]] +value.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} value.default=[1e-5,1e-3] -value.unit=mbar -target.datatype=["tuple",[["double"],["double"]]] +target.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} target.default=[1e-5,1e-3] -target.unit=mbar diff --git a/cfg/sim_mlz_ccr12_v2.cfg b/cfg/sim_mlz_ccr12_v2.cfg index a9c5fba..3d54447 100644 --- a/cfg/sim_mlz_ccr12_v2.cfg +++ b/cfg/sim_mlz_ccr12_v2.cfg @@ -6,8 +6,6 @@ description = [sim] CCR12 box of MLZ Sample environment group . This is an improved version, how we think it should be. -.meaning={'T_regulation':{'T_ccr12':200, 'T_ccr12_stick':150, 'T_ccr12_tube':100}, 'T_sample':{'T_ccr12_B':100, 'T_ccr12_A':90, 'T_ccr12_D':20, 'T_ccr12_C':10}} - [interface tcp] type=tcp bindto=0.0.0.0 @@ -20,75 +18,77 @@ class=secop.simulation.SimDrivable Switches between regulation on stick and regulation on tube depending on temperature requested. May also pump gas for higher temperatures, if configured. Manual switching of the regulation node is supported via the regulationmode parameter. -value.unit='K' +value.datatype={"type":"double", "min":0, "max":600, "unit":"K"} value.default=300 -target.datatype=["double", 0, 600] +target.datatype={"type":"double", "min":0, "max":600, "unit":"K"} target.default=300 -target.unit='K' .extra_params=ramp,regulationmode,abslimits,userlimits -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0, "max":60, "unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min -regulationmode.datatype=["enum",{'stick':1,'tube':2,'both':3}] +ramp.readonly=False +regulationmode.datatype={"type":"enum","members":{"stick":1,"tube":2,"both":3}} regulationmode.default='both' regulationmode.description=regulate only stick, tube or select based upon the target value. -regulationmode.unit='' -abslimits.datatype=["tuple",[["double"],["double"]]] +regulationmode.readonly=False +abslimits.datatype={"type":"limit","members":{"type":"double", "min":0,"max":600, "unit":"K"}} abslimits.default=[0,600] abslimits.description=currently active absolute limits for the setpoint. depend on the regulationmode parameter (both/stick->0..600, tube->0..300K). -abslimits.unit='K' -abslimits.readonly=True -userlimits.datatype=["tuple",[["double"],["double"]]] +userlimits.datatype={"type":"limit","members":{"type":"double", "min":0,"max":600, "unit":"K"}} userlimits.default=[0,300] userlimits.description=current user set limits for the setpoint. must be inside abslimits. -userlimits.unit='K' +userlimits.readonly=False +.meaning=["temperature_regulation", 20] [module T_ccr12_A] class=secop.simulation.SimReadable .description=(optional) Sample temperature sensor. .visibility=expert +value.datatype={"type":"double", "min":0, "unit":"K"} value.default=300 -value.unit='K' +.meaning=["temperature", 9] [module T_ccr12_B] class=secop.simulation.SimReadable .description=(regulation) temperature sensor on stick. .visibility=expert +value.datatype={"type":"double", "min":0, "unit":"K"} value.default=300 -value.unit='K' +.meaning=["temperature", 10] [module T_ccr12_C] class=secop.simulation.SimReadable .description=Temperature at the coldhead. .visibility=expert +value.datatype={"type":"double", "min":0, "unit":"K"} value.default=70 -value.unit='K' +.meaning=["temperature", 1] [module T_ccr12_D] class=secop.simulation.SimReadable .description=(regulation) temperature at coupling to stick. .visibility=expert +value.datatype={"type":"double", "min":0, "unit":"K"} value.default=80 -value.unit='K' +.meaning=["temperature", 2] [module ccr12_pressure_regulation] -class=secop.simulation.SimDrivable +class=secop.simulation.SimReadable .description=Simple two-point presssure regulation. the mode parameter selects the readout on which to regulate, or 'none' for no regulation. .visibility=user .extra_params=switchpoints, mode -mode.datatype=["enum", {'off':0,'p1':1,'p2':2}] +mode.datatype={"type":"enum", "members":{"none":0,"p1":1,"p2":2}} mode.description=Select pressure sensor to regulate on, or 'none' to disable regulation. -mode.default='off' -mode.unit='' -mode.readonly=False -switchpoints.datatype=["struct", {'lower':["double"],'upper':["double"]}] +mode.default='none' +# struct is more explicit, but ugly to read.... +switchpoints.datatype={"type":"struct", "members":{"lower":{"type":"double", "unit":"mbar"},"upper":{"type":"double", "unit":"mbar"}}, "optional":["upper","lower"]} switchpoints.description=Switching points for regulation. If the selected pressure is below 'lower' value, the gas valve is opened, above 'upper' the value vacuum valve is openend, else both are closed. values for switchpoints are taken from the selected pressure sensors userlimits. switchpoints.default={'lower':1e-6,'upper':1e-3} -switchpoints.unit='' switchpoints.readonly=True +value.datatype={"type":"double", "min":0, "max":1000, "unit":"mbar"} +value.default = 1e-5 [module ccr12_compressor] class=secop.simulation.SimDrivable @@ -96,41 +96,48 @@ class=secop.simulation.SimDrivable . Note: This should always be on, except for fast heatup for sample change. .visibility=user +value.datatype={"type":"enum", "members":{'off':0,'on':1}} value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +target.datatype={"type":"enum", "members":{'off':0,'on':1}} [module ccr12_gas_switch] class=secop.simulation.SimWritable .description=Switches the gas inlet on or off. -.visibility=expert + . + note: in reality this switches itself off after 15min. + note: in reality this is interlocked with ccr12_vacuum_switch, only one can be on! + note: in this simulation this module is isolated. +value.datatype={"type":"enum", "members":{'off':0,'on':1}} value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +target.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.default='off' [module ccr12_vacuum_switch] class=secop.simulation.SimWritable .description=Switches the vacuum pumping valve on or off. -.visibility=expert + . + note: in reality this is interlocked with ccr12_gas_switch, only one can be on! + note: in this simulation this module is isolated. +value.datatype={"type":"enum", "members":{'off':0,'on':1}} value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +target.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.default='off' [module ccr12_p1] class=secop.simulation.SimReadable -.description=Default pressure Sensor, linear scale 0..1000mbar +.description=Default pressure Sensor, linear scale 0..1000 mbar + . + Good candidate for a 'Sensor' Interface class! value.default=999 value.unit=mbar .extra_params=curve, userlimits -curve.datatype=["enum", {'10V':0,'default':1,'9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}] +curve.datatype={"type":"enum", "members":{'0..10V':0,'default':1,'0..9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}} curve.description=Calibration curve for pressure sensor curve.default='TTR100' -curve.unit='' -curve.readonly=True -userlimits.datatype=["tuple",[["double"],["double"]]] +userlimits.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} userlimits.default=[1, 100] userlimits.description=current user set limits for the pressure regulation. -userlimits.unit='mbar' +userlimits.readonly=False [module ccr12_p2] class=secop.simulation.SimReadable @@ -138,11 +145,11 @@ class=secop.simulation.SimReadable value.default=1e-6 value.unit=mbar .extra_params=curve,userlimits -curve.datatype=["enum", {'10V':0,'default':1,'9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}] +curve.datatype={"type":"enum", "members":{'0..10V':0,'default':1,'0..9V':2,'DI200':3,'DI2000':4,'TTR100':7,'PTR90':8,'PTR225/PTR237':9,'ITR90':10,'ITR100 curve D':11, 'ITR100 curve 2':12, 'ITR100 curve 3':13,'ITR100 curve 4':14,'ITR100 curve 5':15, 'ITR100 curve 6':16, 'ITR100 curve 7':17, 'ITR100 curve 8':18, 'ITR100 curve 9':19, 'ITR100 curve A':20,'CMR361':21, 'CMR362':22, 'CMR363':23, 'CMR364':24, 'CMR365':25}} curve.description=Calibration curve for pressure sensor -curve.default='TTR100' -curve.unit='' -userlimits.datatype=["tuple",[["double"],["double"]]] +curve.default='PTR90' +userlimits.datatype={"type":"limit","members":{"type":"double", "min":0,"max":1000, "unit":"mbar"}} userlimits.default=[1e-6, 1e-3] userlimits.description=current user set limits for the pressure regulation. -userlimits.unit='mbar' +userlimits.readonly=False +pollinterval.visibility='expert' diff --git a/cfg/sim_mlz_htf02.cfg b/cfg/sim_mlz_htf02.cfg index 89c671a..9b88eb1 100644 --- a/cfg/sim_mlz_htf02.cfg +++ b/cfg/sim_mlz_htf02.cfg @@ -3,7 +3,6 @@ description = [sim] htf02 box of MLZ Sample environment group . Controls an High Temperature Furnace with an eurotherm controller and an PLC checking the cooing water. -.meaning={'T_regulation':{'T_htf02':100}, 'T_sample':{'T_htf02':100}} [interface tcp] type=tcp @@ -15,20 +14,20 @@ class=secop.simulation.SimDrivable .description=Main temperature control node of htf02. . Controls the regulation loop of the Eurotherm. -value.unit='degC' +value.datatype={"type":"double", "min":0, "unit":"degC"} value.default=300 -target.datatype=["double", 0, 2000] +target.datatype={"type":"double", "min":0, "max": 2000, "unit":"degC"} target.default=300 -target.unit='degC' .extra_params=ramp -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0, "max": 600, "unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min +ramp.readonly=False +.meaning=["temperature", 10] [module htf02_p] class=secop.simulation.SimReadable .description=Pressure Sensor at sample space (ivc). +value.datatype={"type":"double", "min":0, "unit":"mbar"} value.default=989 -value.unit='mbar' diff --git a/cfg/sim_mlz_stressihtf2.cfg b/cfg/sim_mlz_stressihtf2.cfg index 045c9c1..8379214 100644 --- a/cfg/sim_mlz_stressihtf2.cfg +++ b/cfg/sim_mlz_stressihtf2.cfg @@ -3,7 +3,6 @@ description = [sim] Stressihtf2 box of MLZ Sample environment group . Controls an High Temperature Furnace with an Eurotherm and an PLC controlling some valves and checking cooling water. -.meaning={'T_regulation':{'T_stressihtf2':100}, 'T_sample':{'T_stressihtf2':100}} [interface tcp] type=tcp @@ -13,40 +12,38 @@ bindport=10767 [module T_stressihtf2] class=secop.simulation.SimDrivable .description=Main temperature control node of Stressihtf2. -value.unit='degC' +value.datatype={"type":"double", "min":0, "unit":"degC"} value.default=20 -target.datatype=["double", 0, 2000] +target.datatype={"type":"double", "min":0, "max":2000, "unit":"degC"} target.default=20 -target.unit='degC' .extra_params=ramp,regulationmode,abslimits,userlimits -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0, "max":600, "unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min -abslimits.datatype=["tuple",[["double"],["double"]]] +abslimits.datatype={"type":"limit", "members":{"type":"double", "min":0, "max":2000, "unit":"degC"}} abslimits.default=[0,2000] abslimits.description=currently active absolute limits for the setpoint. depend on the regulationmode parameter (both/stick->0..600, tube->0..300K). -abslimits.unit='degC' -abslimits.readonly=True -userlimits.datatype=["tuple",[["double"],["double"]]] +userlimits.datatype={"type":"limit", "members":{"type":"double", "min":0, "max":2000, "unit":"degC"}} userlimits.default=[0,300] userlimits.description=current user set limits for the setpoint. must be inside abslimits. -userlimits.unit='degC' +userlimits.readonly=False +.meaning=['temperature_regulation', 10] [module T_stressihtf2_sample] class=secop.simulation.SimReadable .description=(optional) Sample temperature sensor. .visibility=expert value.default=300 -value.unit='degC' +value.datatype={"type":"double", "min":0, "unit":"degC"} +.meaning=["temperature", 9] [module stressihtf2_n2] class=secop.simulation.SimWritable .description=Switches the N2 gas inlet on or off. .visibility=expert value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='off' [module stressihtf2_he] @@ -54,8 +51,8 @@ class=secop.simulation.SimWritable .description=Switches the He gas inlet on or off. .visibility=expert value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='off' [module stressihtf2_lamps] @@ -63,8 +60,8 @@ class=secop.simulation.SimWritable .description=Switches the heating lamps on or off. .visibility=expert value.default='on' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='on' [module stressihtf2_water_ok] @@ -72,5 +69,5 @@ class=secop.simulation.SimReadable .description=Readout of the cooling water state. .visibility=expert value.default='ok' -value.datatype=["enum", {'failed':0,'ok':1}] +value.datatype={"type":"enum", "members":{'failed':0,'ok':1}} diff --git a/cfg/sim_mlz_stressihtf2_v2.cfg b/cfg/sim_mlz_stressihtf2_v2.cfg index 2f708a2..81a8d85 100644 --- a/cfg/sim_mlz_stressihtf2_v2.cfg +++ b/cfg/sim_mlz_stressihtf2_v2.cfg @@ -1,9 +1,8 @@ -[node stressihtf2] +[node stressihtf2_v2] description = [sim] Stressihtf2 box of MLZ Sample environment group . Controls an High Temperature Furnace with an Eurotherm and an PLC controlling some valves and checking cooling water. -meaning={'T_regulation':{'T':100}, 'T_sample':{'T_sample':100}} [interface tcp] type=tcp @@ -13,40 +12,38 @@ bindport=10767 [module T] class=secop.simulation.SimDrivable .description=Main temperature control node of Stressihtf2. -value.unit='degC' +value.datatype={"type":"double", "min":0, "unit":"degC"} value.default=20 -target.datatype=["double", 0, 2000] +target.datatype={"type":"double", "min":0, "max":2000, "unit":"degC"} target.default=20 -target.unit='degC' .extra_params=ramp,regulationmode,abslimits,userlimits -ramp.datatype=["double",0,600] +ramp.datatype={"type":"double", "min":0, "max":600, "unit":"K/min"} ramp.description=target ramping speed in K/min. ramp.default=60 -ramp.unit=K/min -abslimits.datatype=["tuple",[["double"],["double"]]] +abslimits.datatype={"type":"limit", "members":{"type":"double", "min":0, "max":2000, "unit":"degC"}} abslimits.default=[0,2000] -abslimits.description=currently active absolute limits for the setpoint. -abslimits.unit='degC' -abslimits.readonly=True -userlimits.datatype=["tuple",[["double"],["double"]]] +abslimits.description=currently active absolute limits for the setpoint. depend on the regulationmode parameter (both/stick->0..600, tube->0..300K). +userlimits.datatype={"type":"limit", "members":{"type":"double", "min":0, "max":2000, "unit":"degC"}} userlimits.default=[0,300] -userlimits.description=current user set limits for the setpoint. must be inside or coincide with abslimits. -userlimits.unit='degC' +userlimits.description=current user set limits for the setpoint. must be inside abslimits. +userlimits.readonly=False +.meaning=['temperature_regulation', 10] [module T_sample] class=secop.simulation.SimReadable .description=(optional) Sample temperature sensor. .visibility=expert value.default=300 -value.unit='degC' +value.datatype={"type":"double", "min":0, "unit":"degC"} +.meaning=["temperature", 9] [module N2] class=secop.simulation.SimWritable .description=Switches the N2 gas inlet on or off. .visibility=expert value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='off' [module He] @@ -54,8 +51,8 @@ class=secop.simulation.SimWritable .description=Switches the He gas inlet on or off. .visibility=expert value.default='off' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='off' [module lamps] @@ -63,8 +60,8 @@ class=secop.simulation.SimWritable .description=Switches the heating lamps on or off. .visibility=expert value.default='on' -value.datatype=["enum", {'off':0,'on':1}] -target.datatype=["enum", {'off':0,'on':1}] +value.datatype={"type":"enum", "members":{'off':0,'on':1}} +target.datatype={"type":"enum", "members":{'off':0,'on':1}} target.default='on' [module water_ok] @@ -72,5 +69,5 @@ class=secop.simulation.SimReadable .description=Readout of the cooling water state. .visibility=expert value.default='ok' -value.datatype=["enum", {'failed':0,'ok':1}] +value.datatype={"type":"enum", "members":{'failed':0,'ok':1}} diff --git a/secop/client/baseclient.py b/secop/client/baseclient.py index a6485d6..e46b81c 100644 --- a/secop/client/baseclient.py +++ b/secop/client/baseclient.py @@ -286,6 +286,7 @@ class Client: entry[0].set() return self.log.error("got an unexpected %s %r" % (msgtype,data[0:1])) + self.log.error(repr(data)) return if msgtype == DESCRIPTIONREPLY: entry = self.expected_replies.get((msgtype, ''), None) diff --git a/secop/datatypes.py b/secop/datatypes.py index 248da37..769b875 100644 --- a/secop/datatypes.py +++ b/secop/datatypes.py @@ -945,14 +945,14 @@ UInt64 = IntRange(0, (1 << 64) - 1) # Goodie: Convenience Datatypes for Programming -class LimitsType(StructOf): - def __init__(self, _min=None, _max=None): - StructOf.__init__(self, min=FloatRange(_min,_max), max=FloatRange(_min, _max)) +class LimitsType(TupleOf): + def __init__(self, members): + TupleOf.__init__(self, members, members) def __call__(self, value): - limits = StructOf.__call__(self, value) - if limits['max'] < limits['min']: - raise BadValueError('Maximum Value %s must be greater than minimum value %s!' % (limits['max'], limits['min'])) + limits = TupleOf.__call__(self, value) + if limits[1] < limits[0]: + raise BadValueError('Maximum Value %s must be greater than minimum value %s!' % (limits[1], limits[0])) return limits @@ -983,6 +983,7 @@ DATATYPES = dict( struct =lambda members, optional=None: StructOf(optional, **dict((n, get_datatype(t)) for n, t in list(members.items()))), command = lambda argument=None, result=None: CommandType(get_datatype(argument), get_datatype(result)), + limit = lambda members: LimitsType(get_datatype(members)), ) diff --git a/secop/lib/sequence.py b/secop/lib/sequence.py index 0ea5426..f03244b 100644 --- a/secop/lib/sequence.py +++ b/secop/lib/sequence.py @@ -153,7 +153,7 @@ class SequencerMixin: self._seq_error = str(e) finally: self._seq_thread = None - self.poll(0) + self.pollParams(0) def _seq_thread_inner(self, seq, store_init): store = Namespace() diff --git a/secop/metaclass.py b/secop/metaclass.py index 7424d53..8d42862 100644 --- a/secop/metaclass.py +++ b/secop/metaclass.py @@ -68,12 +68,11 @@ class ModuleMeta(PropertyMeta): for accessibles_dict in accessibles_list: for key, obj in accessibles_dict.items(): if isinstance(obj, Override): - try: - obj = obj.apply(accessibles[key]) - accessibles[key] = obj - except KeyError: - raise ProgrammingError("module %s: %s does not exist" - % (name, key)) + if key not in accessibles: + raise ProgrammingError("module %s: can not apply Override on %s: no such accessible!" + % (name, key)) + obj = obj.apply(accessibles[key]) + accessibles[key] = obj else: if key in accessibles: # for now, accept redefinitions: diff --git a/secop/modules.py b/secop/modules.py index da04d10..6ca772f 100644 --- a/secop/modules.py +++ b/secop/modules.py @@ -324,6 +324,7 @@ class Readable(Module): try: rfunc() # pylint: disable = not-callable except Exception: # really all! + # XXX: Error-handling: send error_update ! pass return False @@ -385,6 +386,7 @@ class Drivable(Writable): try: rfunc() # pylint: disable = not-callable except Exception: # really all! + # XXX: Error-handling: send error_update ! pass return fastpoll diff --git a/secop/simulation.py b/secop/simulation.py index 8a7d66c..272965c 100644 --- a/secop/simulation.py +++ b/secop/simulation.py @@ -56,7 +56,7 @@ class SimBase: return newval setattr(self, 'write_' + k, writer) - def init_module(self): + def initModule(self): self._sim_thread = mkthread(self._sim) def _sim(self): @@ -120,6 +120,10 @@ class SimDrivable(SimBase, Drivable): if speed == 0: self._value = self.target speed *= 0.3 + try: + self.pollParams(0) + except Exception: + pass while self._value != self.target: if self._value < self.target - speed: @@ -129,6 +133,10 @@ class SimDrivable(SimBase, Drivable): else: self._value = self.target sleep(0.3) + try: + self.pollParams(0) + except Exception: + pass self.status = self.Status.IDLE, '' def _hw_wait(self): diff --git a/secop_demo/cryo.py b/secop_demo/cryo.py index 3ba74c2..7efc466 100644 --- a/secop_demo/cryo.py +++ b/secop_demo/cryo.py @@ -134,8 +134,7 @@ class Cryostat(CryoBase): ) commands = dict( stop=Override( - "Stop ramping the setpoint\n\nby setting the current setpoint as new target", - special='content of special property'), + "Stop ramping the setpoint\n\nby setting the current setpoint as new target"), ) def initModule(self): diff --git a/secop_demo/modules.py b/secop_demo/modules.py index 895c3d3..61de9ef 100644 --- a/secop_demo/modules.py +++ b/secop_demo/modules.py @@ -293,7 +293,7 @@ class Label(Readable): dev_ts = self.DISPATCHER.get_module(self.subdev_ts) if dev_ts: strings.append('at %.3f %s' % - (dev_ts.read_value(), dev_ts.parameters['value'].unit)) + (dev_ts.read_value(), dev_ts.parameters['value'].datatype.unit)) else: strings.append('No connection to sample temp!') @@ -302,7 +302,7 @@ class Label(Readable): mf_stat = dev_mf.read_status() mf_mode = dev_mf.mode mf_val = dev_mf.value - mf_unit = dev_mf.parameters['value'].unit + mf_unit = dev_mf.parameters['value'].datatype.unit if mf_stat[0] == self.Status.IDLE: state = 'Persistent' if mf_mode else 'Non-persistent' else: diff --git a/secop_mlz/amagnet.py b/secop_mlz/amagnet.py index b21550f..95a1658 100644 --- a/secop_mlz/amagnet.py +++ b/secop_mlz/amagnet.py @@ -53,18 +53,18 @@ class GarfieldMagnet(SequencerMixin, Drivable): 'subdev_polswitch': Parameter('Switch to set for polarity', datatype=StringType(), readonly=True, export=False), 'subdev_symmetry': Parameter('Switch to read for symmetry', datatype=StringType(), readonly=True, export=False), 'userlimits': Parameter('User defined limits of device value', - unit='main', datatype=TupleOf(FloatRange(), FloatRange()), + datatype=TupleOf(FloatRange(unit='$'), FloatRange(unit='$')), default=(float('-Inf'), float('+Inf')), readonly=False, poll=10), 'abslimits': Parameter('Absolute limits of device value', - unit='main', datatype=TupleOf(FloatRange(), FloatRange()), + datatype=TupleOf(FloatRange(unit='$'), FloatRange(unit='$')), default=(-0.5, 0.5), poll=True, ), 'precision': Parameter('Precision of the device value (allowed deviation ' 'of stable values from target)', - unit='main', datatype=FloatRange(0.001), default=0.001, readonly=False, + datatype=FloatRange(0.001, unit='$'), default=0.001, readonly=False, ), 'ramp': Parameter('Target rate of field change per minute', readonly=False, - unit='main/min', datatype=FloatRange(), default=1.0), + datatype=FloatRange(unit='$/min'), default=1.0), 'calibration': Parameter('Coefficients for calibration ' 'function: [c0, c1, c2, c3, c4] calculates ' 'B(I) = c0*I + c1*erf(c2*I) + c3*atan(c4*I)' diff --git a/secop_mlz/entangle.py b/secop_mlz/entangle.py index 983186b..c720fa3 100644 --- a/secop_mlz/entangle.py +++ b/secop_mlz/entangle.py @@ -386,7 +386,7 @@ class AnalogInput(PyTangoDevice, Readable): # prefer configured unit if nothing is set on the Tango device, else # update if attrInfo.unit != 'No unit': - self.accessibles['value'].unit = attrInfo.unit + self.accessibles['value'].datatype.setProperty('unit', attrInfo.unit) def read_value(self): return self._dev.value @@ -469,7 +469,7 @@ class AnalogOutput(PyTangoDevice, Drivable): # prefer configured unit if nothing is set on the Tango device, else # update if attrInfo.unit != 'No unit': - self.accessibles['value'].unit = attrInfo.unit + self.accessibles['value'].datatype.setProperty('unit', attrInfo.unit) def pollParams(self, nr=0): super(AnalogOutput, self).pollParams(nr)