sea: fix parameter name mapping

- rel_path = ['tm', '.', 'set'] should mean:

'tm': tm parameters first, with /<obj?/tm as main value
'.': then all parameters directly at top level, except 'set'
'set': all parameters  below 'set'
driving happens at object level

- better name mangling (the 1st appearance of the same shortname
  is kept short)
This commit is contained in:
l_samenv 2024-11-28 18:06:14 +01:00 committed by Markus Zolliker
parent bc66a314c4
commit 8dcf6ca658
27 changed files with 172 additions and 102 deletions

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('pauto', Mod('pauto',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -22,7 +22,7 @@ Mod('tm',
'frappy_psi.sea.SeaDrivable', '', 'frappy_psi.sea.SeaDrivable', '',
io='sea_main', io='sea_main',
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set'] rel_paths=['tm', '.', 'set']
) )
Mod('ts', Mod('ts',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -12,7 +12,7 @@ Mod('tt',
io = 'sea_main', io = 'sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object = 'tt', sea_object = 'tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',
'frappy_psi.sea.SeaReadable', '', 'frappy_psi.sea.SeaReadable', '',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('th', Mod('th',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl', 'voltage'], rel_paths=['tm', '.', 'set', 'dblctrl', 'voltage'],
extra_modules=['manualpower'], extra_modules=['manualpower'],
) )

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('th', Mod('th',

View File

@ -19,7 +19,7 @@ Mod('tt',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
io='sea_main', io='sea_main',
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('th', Mod('th',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io = 'sea_main', io = 'sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object = 'tt', sea_object = 'tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -14,7 +14,7 @@ Mod('tt',
io='sea_main', io='sea_main',
meaning=['temperature_regulation', 20], meaning=['temperature_regulation', 20],
sea_object='tt', sea_object='tt',
rel_paths=['tm', 'set', 'dblctrl'], rel_paths=['tm', '.', 'set', 'dblctrl'],
) )
Mod('cc', Mod('cc',

View File

@ -269,7 +269,7 @@
{"path": "custompar", "type": "float", "readonly": false, "cmd": "hemot custompar"}]}, {"path": "custompar", "type": "float", "readonly": false, "cmd": "hemot custompar"}]},
"mf": {"base": "/mf", "params": [ "mf": {"base": "/mf", "params": [
{"path": "", "type": "float", "kids": 26}, {"path": "", "type": "float", "cmd": "run mf", "kids": 26},
{"path": "persmode", "type": "int", "readonly": false, "cmd": "mf persmode"}, {"path": "persmode", "type": "int", "readonly": false, "cmd": "mf persmode"},
{"path": "perswitch", "type": "int"}, {"path": "perswitch", "type": "int"},
{"path": "nowait", "type": "int", "readonly": false, "cmd": "mf nowait"}, {"path": "nowait", "type": "int", "readonly": false, "cmd": "mf nowait"},

View File

@ -1,4 +1,5 @@
{"tt": {"base": "/tt", "params": [{"path": "", "type": "float", "readonly": false, "cmd": "run tt", "description": "tt", "kids": 18}, {"tt": {"base": "/tt", "params": [
{"path": "", "type": "float", "readonly": false, "cmd": "run tt", "description": "tt", "kids": 18},
{"path": "send", "type": "text", "readonly": false, "cmd": "tt send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "tt send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "is_running", "type": "int", "readonly": false, "cmd": "tt is_running", "visibility": 3}, {"path": "is_running", "type": "int", "readonly": false, "cmd": "tt is_running", "visibility": 3},
@ -85,7 +86,10 @@
{"path": "setsamp/integ", "type": "float", "readonly": false, "cmd": "tt setsamp/integ", "description": "bigger means faster"}, {"path": "setsamp/integ", "type": "float", "readonly": false, "cmd": "tt setsamp/integ", "description": "bigger means faster"},
{"path": "setsamp/deriv", "type": "float", "readonly": false, "cmd": "tt setsamp/deriv"}, {"path": "setsamp/deriv", "type": "float", "readonly": false, "cmd": "tt setsamp/deriv"},
{"path": "display", "type": "text", "readonly": false, "cmd": "tt display"}, {"path": "display", "type": "text", "readonly": false, "cmd": "tt display"},
{"path": "remote", "type": "bool"}]}, "cc": {"base": "/cc", "params": [{"path": "", "type": "bool", "kids": 96}, {"path": "remote", "type": "bool"}]},
"cc": {"base": "/cc", "params": [
{"path": "", "type": "bool", "kids": 96},
{"path": "send", "type": "text", "readonly": false, "cmd": "cc send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "cc send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "autodevice", "type": "bool", "readonly": false, "cmd": "cc autodevice"}, {"path": "autodevice", "type": "bool", "readonly": false, "cmd": "cc autodevice"},
@ -181,7 +185,10 @@
{"path": "tm", "type": "float", "visibility": 3}, {"path": "tm", "type": "float", "visibility": 3},
{"path": "tv", "type": "float", "visibility": 3}, {"path": "tv", "type": "float", "visibility": 3},
{"path": "tq", "type": "float", "visibility": 3}, {"path": "tq", "type": "float", "visibility": 3},
{"path": "bdl", "type": "float", "readonly": false, "cmd": "cc bdl"}]}, "nv": {"base": "/nv", "params": [{"path": "", "type": "enum", "enum": {"fixed": 0, "controlled": 1, "automatic": 2, "close": 3, "open": 4}, "readonly": false, "cmd": "nv", "kids": 11}, {"path": "bdl", "type": "float", "readonly": false, "cmd": "cc bdl"}]},
"nv": {"base": "/nv", "params": [
{"path": "", "type": "enum", "enum": {"fixed": 0, "controlled": 1, "automatic": 2, "close": 3, "open": 4}, "readonly": false, "cmd": "nv", "kids": 11},
{"path": "send", "type": "text", "readonly": false, "cmd": "nv send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "nv send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "motstat", "type": "enum", "enum": {"idle": 0, "opening": 1, "closing": 2, "opened": 3, "closed": 4, "no_motor": 5}}, {"path": "motstat", "type": "enum", "enum": {"idle": 0, "opening": 1, "closing": 2, "opened": 3, "closed": 4, "no_motor": 5}},
@ -231,7 +238,11 @@
{"path": "autoflow/flowtarget", "type": "float"}, {"path": "autoflow/flowtarget", "type": "float"},
{"path": "calib", "type": "none", "kids": 2}, {"path": "calib", "type": "none", "kids": 2},
{"path": "calib/ln_per_min_per_mbar", "type": "float", "readonly": false, "cmd": "nv calib/ln_per_min_per_mbar"}, {"path": "calib/ln_per_min_per_mbar", "type": "float", "readonly": false, "cmd": "nv calib/ln_per_min_per_mbar"},
{"path": "calib/mbar_offset", "type": "float", "readonly": false, "cmd": "nv calib/mbar_offset"}]}, "hepump": {"base": "/hepump", "params": [{"path": "", "type": "enum", "enum": {"neodry": 8, "xds35_auto": 0, "xds35_manual": 1, "sv65": 2, "other": 3, "no": -1}, "readonly": false, "cmd": "hepump", "description": "xds35: scroll pump, sv65: leybold", "kids": 9}, {"path": "calib/mbar_offset", "type": "float", "readonly": false, "cmd": "nv calib/mbar_offset"}]},
"hepump": {"base": "/hepump", "params": [
{"path": "", "type": "enum", "enum": {"neodry": 8, "xds35_auto": 0, "xds35_manual": 1, "sv65": 2, "other": 3, "no": -1}, "readonly": false, "cmd": "hepump", "description": "xds35: scroll pump, sv65: leybold", "kids": 9},
{"path": "send", "type": "text", "readonly": false, "cmd": "hepump send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "hepump send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "running", "type": "bool", "readonly": false, "cmd": "hepump running"}, {"path": "running", "type": "bool", "readonly": false, "cmd": "hepump running"},
@ -239,7 +250,10 @@
{"path": "auto", "type": "bool", "readonly": false, "cmd": "hepump auto"}, {"path": "auto", "type": "bool", "readonly": false, "cmd": "hepump auto"},
{"path": "valve", "type": "enum", "enum": {"closed": 0, "closing": 1, "opening": 2, "opened": 3, "undefined": 4}, "readonly": false, "cmd": "hepump valve"}, {"path": "valve", "type": "enum", "enum": {"closed": 0, "closing": 1, "opening": 2, "opened": 3, "undefined": 4}, "readonly": false, "cmd": "hepump valve"},
{"path": "eco_t_lim", "type": "float", "readonly": false, "cmd": "hepump eco_t_lim", "description": "switch off eco mode when T_set < eco_t_lim and T < eco_t_lim * 2"}, {"path": "eco_t_lim", "type": "float", "readonly": false, "cmd": "hepump eco_t_lim", "description": "switch off eco mode when T_set < eco_t_lim and T < eco_t_lim * 2"},
{"path": "calib", "type": "float", "readonly": false, "cmd": "hepump calib", "visibility": 3}]}, "hemot": {"base": "/hepump/hemot", "params": [{"path": "", "type": "float", "readonly": false, "cmd": "run hemot", "kids": 30}, {"path": "calib", "type": "float", "readonly": false, "cmd": "hepump calib", "visibility": 3}]},
"hemot": {"base": "/hepump/hemot", "params": [
{"path": "", "type": "float", "readonly": false, "cmd": "run hemot", "kids": 30},
{"path": "send", "type": "text", "readonly": false, "cmd": "hemot send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "hemot send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "is_running", "type": "int", "readonly": false, "cmd": "hemot is_running", "visibility": 3}, {"path": "is_running", "type": "int", "readonly": false, "cmd": "hemot is_running", "visibility": 3},
@ -270,7 +284,8 @@
{"path": "eeprom", "type": "enum", "enum": {"ok": 0, "dirty": 1, "save": 2, "load": 3}, "readonly": false, "cmd": "hemot eeprom"}, {"path": "eeprom", "type": "enum", "enum": {"ok": 0, "dirty": 1, "save": 2, "load": 3}, "readonly": false, "cmd": "hemot eeprom"},
{"path": "customadr", "type": "text", "readonly": false, "cmd": "hemot customadr"}, {"path": "customadr", "type": "text", "readonly": false, "cmd": "hemot customadr"},
{"path": "custompar", "type": "float", "readonly": false, "cmd": "hemot custompar"}]}, {"path": "custompar", "type": "float", "readonly": false, "cmd": "hemot custompar"}]},
"ln2fill": {"base": "/ln2fill", "params": [ "
ln2fill": {"base": "/ln2fill", "params": [
{"path": "", "type": "enum", "enum": {"watching": 0, "fill": 1, "inactive": 2}, "readonly": false, "cmd": "ln2fill", "kids": 14}, {"path": "", "type": "enum", "enum": {"watching": 0, "fill": 1, "inactive": 2}, "readonly": false, "cmd": "ln2fill", "kids": 14},
{"path": "send", "type": "text", "readonly": false, "cmd": "ln2fill send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "ln2fill send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
@ -285,7 +300,10 @@
{"path": "maxholdhours", "type": "float", "readonly": false, "cmd": "ln2fill maxholdhours"}, {"path": "maxholdhours", "type": "float", "readonly": false, "cmd": "ln2fill maxholdhours"},
{"path": "tolerance", "type": "float", "readonly": false, "cmd": "ln2fill tolerance"}, {"path": "tolerance", "type": "float", "readonly": false, "cmd": "ln2fill tolerance"},
{"path": "badreadingminutes", "type": "float", "readonly": false, "cmd": "ln2fill badreadingminutes"}, {"path": "badreadingminutes", "type": "float", "readonly": false, "cmd": "ln2fill badreadingminutes"},
{"path": "tubecoolingminutes", "type": "float", "readonly": false, "cmd": "ln2fill tubecoolingminutes"}]}, "hefill": {"base": "/hefill", "params": [{"path": "", "type": "enum", "enum": {"watching": 0, "fill": 1, "inactive": 2}, "readonly": false, "cmd": "hefill", "kids": 16}, {"path": "tubecoolingminutes", "type": "float", "readonly": false, "cmd": "ln2fill tubecoolingminutes"}]},
"hefill": {"base": "/hefill", "params": [
{"path": "", "type": "enum", "enum": {"watching": 0, "fill": 1, "inactive": 2}, "readonly": false, "cmd": "hefill", "kids": 16},
{"path": "send", "type": "text", "readonly": false, "cmd": "hefill send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "hefill send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "state", "type": "text"}, {"path": "state", "type": "text"},
@ -301,11 +319,17 @@
{"path": "badreadingminutes", "type": "float", "readonly": false, "cmd": "hefill badreadingminutes"}, {"path": "badreadingminutes", "type": "float", "readonly": false, "cmd": "hefill badreadingminutes"},
{"path": "tubecoolingminutes", "type": "float", "readonly": false, "cmd": "hefill tubecoolingminutes"}, {"path": "tubecoolingminutes", "type": "float", "readonly": false, "cmd": "hefill tubecoolingminutes"},
{"path": "vessellimit", "type": "float", "readonly": false, "cmd": "hefill vessellimit"}, {"path": "vessellimit", "type": "float", "readonly": false, "cmd": "hefill vessellimit"},
{"path": "vext", "type": "float"}]}, "lev": {"base": "/lev", "params": [{"path": "", "type": "float", "kids": 4}, {"path": "vext", "type": "float"}]},
"lev": {"base": "/lev", "params": [
{"path": "", "type": "float", "kids": 4},
{"path": "send", "type": "text", "readonly": false, "cmd": "lev send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "lev send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "mode", "type": "enum", "enum": {"slow": 0, "fast (switches to slow automatically after filling)": 1}, "readonly": false, "cmd": "lev mode"}, {"path": "mode", "type": "enum", "enum": {"slow": 0, "fast (switches to slow automatically after filling)": 1}, "readonly": false, "cmd": "lev mode"},
{"path": "n2", "type": "float"}]}, "mf": {"base": "/mf", "params": [{"path": "", "type": "float", "kids": 26}, {"path": "n2", "type": "float"}]},
"mf": {"base": "/mf", "params": [
{"path": "", "type": "float", "cmd": "run mf", "kids": 26},
{"path": "persmode", "type": "int", "readonly": false, "cmd": "mf persmode"}, {"path": "persmode", "type": "int", "readonly": false, "cmd": "mf persmode"},
{"path": "perswitch", "type": "int"}, {"path": "perswitch", "type": "int"},
{"path": "nowait", "type": "int", "readonly": false, "cmd": "mf nowait"}, {"path": "nowait", "type": "int", "readonly": false, "cmd": "mf nowait"},
@ -330,7 +354,10 @@
{"path": "driver", "type": "text", "visibility": 3}, {"path": "driver", "type": "text", "visibility": 3},
{"path": "creationCmd", "type": "text", "visibility": 3}, {"path": "creationCmd", "type": "text", "visibility": 3},
{"path": "targetValue", "type": "float"}, {"path": "targetValue", "type": "float"},
{"path": "status", "type": "text", "readonly": false, "cmd": "mf status", "visibility": 3}]}, "tcoil": {"base": "/tcoil", "params": [{"path": "", "type": "float", "kids": 11}, {"path": "status", "type": "text", "readonly": false, "cmd": "mf status", "visibility": 3}]},
"tcoil": {"base": "/tcoil", "params": [
{"path": "", "type": "float", "kids": 11},
{"path": "send", "type": "text", "readonly": false, "cmd": "tcoil send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "tcoil send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "excitation", "type": "float", "readonly": false, "cmd": "tcoil excitation", "visibility": 3}, {"path": "excitation", "type": "float", "readonly": false, "cmd": "tcoil excitation", "visibility": 3},
@ -371,7 +398,10 @@
{"path": "ref/curve/cpoints", "type": "floatvarar", "readonly": false, "cmd": "tcoil ref/curve/cpoints"}, {"path": "ref/curve/cpoints", "type": "floatvarar", "readonly": false, "cmd": "tcoil ref/curve/cpoints"},
{"path": "ext", "type": "float", "visibility": 3}, {"path": "ext", "type": "float", "visibility": 3},
{"path": "com", "type": "float", "visibility": 3}, {"path": "com", "type": "float", "visibility": 3},
{"path": "gnd", "type": "float", "visibility": 3}]}, "table": {"base": "/table", "params": [{"path": "", "type": "none", "kids": 17}, {"path": "gnd", "type": "float", "visibility": 3}]},
"table": {"base": "/table", "params": [
{"path": "", "type": "none", "kids": 17},
{"path": "send", "type": "text", "readonly": false, "cmd": "table send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "table send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "fix_tt_set_prop", "type": "bool", "readonly": false, "cmd": "table fix_tt_set_prop"}, {"path": "fix_tt_set_prop", "type": "bool", "readonly": false, "cmd": "table fix_tt_set_prop"},
@ -388,8 +418,14 @@
{"path": "tbl_tt_dblctrl_prop_up", "type": "text", "readonly": false, "cmd": "table tbl_tt_dblctrl_prop_up", "description": "enter value pair separated with colon T1:par1 T2:par2 ..."}, {"path": "tbl_tt_dblctrl_prop_up", "type": "text", "readonly": false, "cmd": "table tbl_tt_dblctrl_prop_up", "description": "enter value pair separated with colon T1:par1 T2:par2 ..."},
{"path": "fix_tt_dblctrl_prop_lo", "type": "bool", "readonly": false, "cmd": "table fix_tt_dblctrl_prop_lo"}, {"path": "fix_tt_dblctrl_prop_lo", "type": "bool", "readonly": false, "cmd": "table fix_tt_dblctrl_prop_lo"},
{"path": "val_tt_dblctrl_prop_lo", "type": "float"}, {"path": "val_tt_dblctrl_prop_lo", "type": "float"},
{"path": "tbl_tt_dblctrl_prop_lo", "type": "text", "readonly": false, "cmd": "table tbl_tt_dblctrl_prop_lo", "description": "enter value pair separated with colon T1:par1 T2:par2 ..."}]}, "ccu2": {"base": "/sics/ccu2", "params": [{"path": "", "type": "text", "readonly": false, "cmd": "ccu2", "kids": 23}, {"path": "tbl_tt_dblctrl_prop_lo", "type": "text", "readonly": false, "cmd": "table tbl_tt_dblctrl_prop_lo", "description": "enter value pair separated with colon T1:par1 T2:par2 ..."}]},
{"path": "tasks", "type": "none", "visibility": 3}]}, "lnv": {"base": "/lnv", "params": [{"path": "", "type": "enum", "enum": {"off": 5, "fixed": 0, "controlling": 1, "close": 3, "open": 4}, "readonly": false, "cmd": "lnv", "kids": 12},
"ccu2": {"base": "/sics/ccu2", "params": [
{"path": "", "type": "text", "readonly": false, "cmd": "ccu2", "kids": 23},
{"path": "tasks", "type": "none", "visibility": 3}]},
"lnv": {"base": "/lnv", "params": [
{"path": "", "type": "enum", "enum": {"off": 5, "fixed": 0, "controlling": 1, "close": 3, "open": 4}, "readonly": false, "cmd": "lnv", "kids": 12},
{"path": "send", "type": "text", "readonly": false, "cmd": "lnv send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "lnv send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "set", "type": "float", "readonly": false, "cmd": "lnv set"}, {"path": "set", "type": "float", "readonly": false, "cmd": "lnv set"},
@ -427,7 +463,10 @@
{"path": "autoflow/difmax", "type": "float"}, {"path": "autoflow/difmax", "type": "float"},
{"path": "autoflow/setmin", "type": "float"}, {"path": "autoflow/setmin", "type": "float"},
{"path": "autoflow/setmax", "type": "float"}, {"path": "autoflow/setmax", "type": "float"},
{"path": "autoflow/flowtarget", "type": "float"}]}, "lpr": {"base": "/lpr", "params": [{"path": "", "type": "float", "readonly": false, "cmd": "run lpr", "description": "lpr", "kids": 28}, {"path": "autoflow/flowtarget", "type": "float"}]},
"lpr": {"base": "/lpr", "params": [
{"path": "", "type": "float", "readonly": false, "cmd": "run lpr", "description": "lpr", "kids": 28},
{"path": "send", "type": "text", "readonly": false, "cmd": "lpr send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "lpr send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "is_running", "type": "int", "readonly": false, "cmd": "lpr is_running", "visibility": 3}, {"path": "is_running", "type": "int", "readonly": false, "cmd": "lpr is_running", "visibility": 3},
@ -455,12 +494,13 @@
{"path": "running", "type": "int"}, {"path": "running", "type": "int"},
{"path": "tolerance", "type": "float", "readonly": false, "cmd": "lpr tolerance"}, {"path": "tolerance", "type": "float", "readonly": false, "cmd": "lpr tolerance"},
{"path": "maxwait", "type": "float", "readonly": false, "cmd": "lpr maxwait"}, {"path": "maxwait", "type": "float", "readonly": false, "cmd": "lpr maxwait"},
{"path": "settle", "type": "float", "readonly": false, "cmd": "lpr settle"}]}, "lambdawatch": {"base": "/lambdawatch", "params": [{"path": "", "type": "float", "kids": 6}, {"path": "settle", "type": "float", "readonly": false, "cmd": "lpr settle"}]},
"lambdawatch": {"base": "/lambdawatch", "params": [
{"path": "", "type": "float", "kids": 6},
{"path": "send", "type": "text", "readonly": false, "cmd": "lambdawatch send", "visibility": 3}, {"path": "send", "type": "text", "readonly": false, "cmd": "lambdawatch send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}, {"path": "status", "type": "text", "visibility": 3},
{"path": "safefield", "type": "float", "readonly": false, "cmd": "lambdawatch safefield"}, {"path": "safefield", "type": "float", "readonly": false, "cmd": "lambdawatch safefield"},
{"path": "maxfield", "type": "float", "readonly": false, "cmd": "lambdawatch maxfield"}, {"path": "maxfield", "type": "float", "readonly": false, "cmd": "lambdawatch maxfield"},
{"path": "safetemp", "type": "float", "readonly": false, "cmd": "lambdawatch safetemp"}, {"path": "safetemp", "type": "float", "readonly": false, "cmd": "lambdawatch safetemp"},
{"path": "coiltemp", "type": "text", "readonly": false, "cmd": "lambdawatch coiltemp"}]}, "prep0": {"base": "/prep0", "params": [{"path": "", "type": "text", "readonly": false, "cmd": "prep0", "kids": 2}, {"path": "coiltemp", "type": "text", "readonly": false, "cmd": "lambdawatch coiltemp"}]}}
{"path": "send", "type": "text", "readonly": false, "cmd": "prep0 send", "visibility": 3},
{"path": "status", "type": "text", "visibility": 3}]}}

View File

@ -40,7 +40,8 @@ from frappy.client import ProxyClient
from frappy.datatypes import ArrayOf, BoolType, \ from frappy.datatypes import ArrayOf, BoolType, \
EnumType, FloatRange, IntRange, StringType, StatusType EnumType, FloatRange, IntRange, StringType, StatusType
from frappy.core import IDLE, BUSY, WARN, ERROR, DISABLED from frappy.core import IDLE, BUSY, WARN, ERROR, DISABLED
from frappy.errors import ConfigError, HardwareError, ReadFailedError, CommunicationFailedError from frappy.errors import ConfigError, HardwareError, ReadFailedError, \
CommunicationFailedError, ProgrammingError
from frappy.lib import generalConfig, mkthread, lazy_property from frappy.lib import generalConfig, mkthread, lazy_property
from frappy.lib.asynconn import AsynConn, ConnectionClosed from frappy.lib.asynconn import AsynConn, ConnectionClosed
from frappy.modulebase import Done from frappy.modulebase import Done
@ -473,81 +474,105 @@ class SeaModule(Module):
json_file = cfgdict.pop('json_file', None) or SeaClient.default_json_file[cfgdict['io']] json_file = cfgdict.pop('json_file', None) or SeaClient.default_json_file[cfgdict['io']]
visibility_level = cfgdict.pop('visibility_level', 2) visibility_level = cfgdict.pop('visibility_level', 2)
drive_cmd = None
single_module = cfgdict.pop('single_module', None) single_module = cfgdict.pop('single_module', None)
if single_module: if single_module:
sea_object, base, paramdesc = extra_modules[single_module] sea_object, base, paramdesc = extra_modules[single_module]
params = [paramdesc] params = [paramdesc]
paramdesc['key'] = 'value' paramdesc['key'] = 'value'
if issubclass(cls, SeaWritable): if issubclass(cls, SeaWritable): # and not SeaDrivable!
if paramdesc.get('readonly', True): if paramdesc.get('readonly', True):
raise ConfigError(f"{sea_object}/{paramdesc['path']} is not writable") raise ConfigError(f"{sea_object}/{paramdesc['path']} is not writable")
params.insert(0, paramdesc.copy()) # copy value params.insert(0, paramdesc.copy()) # copy value
paramdesc['key'] = 'target' paramdesc['key'] = 'target'
paramdesc['readonly'] = False paramdesc['readonly'] = False
extra_module_set = () extra_module_set = ()
if 'description' not in cfgdict: if not cfgdict.get('description'):
cfgdict['description'] = f'{single_module}@{json_file}' cfgdict['description'] = f'{single_module}@{json_file}'
else: else:
sea_object = cfgdict.pop('sea_object') sea_object = cfgdict.pop('sea_object')
rel_paths = cfgdict.pop('rel_paths', '.') rel_paths = cfgdict.pop('rel_paths', None)
if 'description' not in cfgdict: # rel_paths:
# a list of sub nodes to look for parameters
# '.' denotes the main path
# Readable: the main value is taken from the first subpath
# Writable/Drivable:
# - read the target value: <sicsobj> target
# - writing the target value: cmd from base path
if not cfgdict.get('description'):
cfgdict['description'] = '%s@%s%s' % ( cfgdict['description'] = '%s@%s%s' % (
name, json_file, '' if rel_paths == '.' else f' (rel_paths={rel_paths})') name, json_file, '' if rel_paths is None else f' (rel_paths={rel_paths})')
with (seaconfig.dir / json_file).open(encoding='utf-8') as fp: with (seaconfig.dir / json_file).open(encoding='utf-8') as fp:
content = json.load(fp) content = json.load(fp)
descr = content[sea_object] descr = content[sea_object]
if rel_paths == '*' or not rel_paths: if True:
# take all
main = descr['params'][0]
if issubclass(cls, Readable):
# assert main['path'] == '' # TODO: check cases where this fails
main['key'] = 'value'
else:
descr['params'].pop(0)
else:
# filter by relative paths # filter by relative paths
result = [] if rel_paths:
is_running = None result = {k: [] for k in rel_paths}
for rpath in rel_paths:
include = True
for paramdesc in descr['params']:
path = paramdesc['path']
if path.endswith('is_running') and issubclass(cls, Drivable):
# take this independent of visibility
is_running = paramdesc
continue
if paramdesc.get('visibility', 1) > visibility_level:
continue
sub = path.split('/', 1)
if rpath == '.': # take all except subpaths with readonly node at top
if len(sub) == 1:
include = paramdesc.get('kids', 0) == 0 or not paramdesc.get('readonly', True)
if include or path == '':
result.append(paramdesc)
elif sub[0] == rpath:
result.append(paramdesc)
if is_running: # take this at end
result.append(is_running)
descr['params'] = result
rel0 = '' if rel_paths[0] == '.' else rel_paths[0]
if result[0]['path'] == rel0:
if issubclass(cls, Readable):
result[0]['key'] = 'value'
else:
result.pop(0)
else: else:
logger.error('%s: no value found', name) params = []
is_running = None
target_param = None
for paramdesc in descr['params']:
path = paramdesc['path']
pathlist = path.split('/')
if pathlist[-1] == 'is_running' and issubclass(cls, Drivable):
# take this independent of visibility
is_running = paramdesc
continue
if pathlist[-1] in ('target', 'targetValue') and issubclass(cls, Writable) and not target_param:
paramdesc['key'] = 'target'
paramdesc['readonly'] = False
target_param = paramdesc
if path == '':
drive_cmd = paramdesc.get('cmd')
elif paramdesc.get('visibility', 1) > visibility_level:
continue
if rel_paths:
sub = path.split('/', 1)
sublist = result.get(sub[0])
if sublist is None:
sublist = result.get('.')
# take all else except subpaths with readonly node at top
if sublist is not None and (
path == '' or len(sub) == 1 and (
paramdesc.get('kids', 0) == 0
or not paramdesc.get('readonly', True))):
sublist.append(paramdesc)
else:
sublist.append(paramdesc)
else:
params.append(paramdesc)
if rel_paths:
params = sum(result.values(), [])
if is_running: # take this at end
params.append(is_running)
descr['params'] = params
main_value = params[0]
if issubclass(cls, Readable):
if 'key' in main_value:
raise ProgrammingError(f'main_value {main_value!r}')
main_value['key'] = 'value'
else:
params.pop(0)
base = descr['base'] base = descr['base']
params = descr['params'] if issubclass(cls, SeaWritable): # and not SeaDrivable!
if issubclass(cls, SeaWritable):
paramdesc = params[0] paramdesc = params[0]
assert paramdesc['key'] == 'value' if paramdesc.get('key') != 'value':
raise ProgrammingError(f"key of first parameter of {name} must be 'value'")
params.append(paramdesc.copy()) # copy value? params.append(paramdesc.copy()) # copy value?
if paramdesc.get('readonly', True): if paramdesc.get('readonly', True):
raise ConfigError(f"{sea_object}/{paramdesc['path']} is not writable") raise ConfigError(f"{sea_object}/{paramdesc['path']} is not writable")
paramdesc['key'] = 'target' paramdesc['key'] = 'target'
paramdesc['readonly'] = False paramdesc['readonly'] = False
elif issubclass(cls, Drivable):
if target_param:
if not drive_cmd:
drive_cmd = f'run {name}'
logger.warning('missing cmd in %s, use "run %s"', base, name)
target_param['cmd'] = drive_cmd
extra_module_set = set(cfgdict.pop('extra_modules', ())) extra_module_set = set(cfgdict.pop('extra_modules', ()))
path2param = {} path2param = {}
attributes = {'sea_object': sea_object, 'path2param': path2param} attributes = {'sea_object': sea_object, 'path2param': path2param}
@ -559,14 +584,14 @@ class SeaModule(Module):
attributes['visibility'] = 2 attributes['visibility'] = 2
# check for ambiguous names. candidates are either the last item # check for ambiguous names. candidates are either the last item
# of the path or the full path (underscore separated) # of the path or the full path (underscore separated)
simple_names = {k: 1 for k in cls.accessibles} duplicates = {k: [k] for k in cls.accessibles}
for paramdesc in params: for paramdesc in params:
path = paramdesc['path'] path = paramdesc['path']
if path: if path:
pathlist = path.split('/') pathlist = path.split('/')
if 'key' not in paramdesc: if 'key' not in paramdesc:
pname = pathlist[-1] pname = pathlist[-1]
simple_names[pname] = simple_names.get(pname, 0) + 1 duplicates.setdefault(pname, pathlist)
for paramdesc in params: for paramdesc in params:
path = paramdesc['path'] path = paramdesc['path']
readonly = paramdesc.get('readonly', True) readonly = paramdesc.get('readonly', True)
@ -583,11 +608,11 @@ class SeaModule(Module):
if len(pathlist) > 0: if len(pathlist) > 0:
if len(pathlist) == 1: if len(pathlist) == 1:
if issubclass(cls, Readable): if issubclass(cls, Readable):
kwds['group'] = 'more' kwds['group'] = 'more_'
else: else:
kwds['group'] = pathlist[-2] kwds['group'] = pathlist[-2] + '_'
# take short name if unique # take short name if unique
if simple_names[pathlist[-1]] == 1: if duplicates[pathlist[-1]] == pathlist:
key = pathlist[-1] key = pathlist[-1]
else: else:
key = '_'.join(pathlist) key = '_'.join(pathlist)
@ -612,14 +637,15 @@ class SeaModule(Module):
datatype = pobj.datatype datatype = pobj.datatype
if issubclass(cls, SeaWritable) and key == 'target': if issubclass(cls, SeaWritable) and key == 'target':
kwds['readonly'] = False kwds['readonly'] = False
attributes['value'] = Parameter(**kwds) attributes['target'] = Parameter(**kwds)
hdbpath = '/'.join([base] + pathlist) hdbpath = '/'.join([base] + pathlist)
if key in extra_module_set: if key in extra_module_set:
extra_modules[name + '.' + key] = sea_object, base, paramdesc extra_modules[name + '.' + key] = sea_object, base, paramdesc
continue # skip this parameter continue # skip this parameter
path2param.setdefault(hdbpath, []).append((name, key)) if key is not None:
attributes[key] = pobj path2param.setdefault(hdbpath, []).append((name, key))
attributes[key] = pobj
def rfunc(self, cmd=f'hval {base}/{path}'): def rfunc(self, cmd=f'hval {base}/{path}'):
reply = self.io.query(cmd, True) reply = self.io.query(cmd, True)
@ -631,7 +657,7 @@ class SeaModule(Module):
return reply return reply
rfunc.poll = False rfunc.poll = False
if key != 'status': if key != 'status' and key is not None:
attributes['read_' + key] = rfunc attributes['read_' + key] = rfunc
if not readonly: if not readonly:
@ -645,7 +671,7 @@ class SeaModule(Module):
self.io.query(cmd) self.io.query(cmd)
return Done return Done
attributes['write_' + key] = wfunc attributes['write_' + (key or 'target')] = wfunc
# create standard parameters like value and status, if not yet there # create standard parameters like value and status, if not yet there
for pname, pobj in cls.accessibles.items(): for pname, pobj in cls.accessibles.items():
@ -659,7 +685,11 @@ class SeaModule(Module):
pobj.__set_name__(cls, pname) pobj.__set_name__(cls, pname)
classname = f'{cls.__name__}_{name}' classname = f'{cls.__name__}_{name}'
newcls = type(classname, (cls,), attributes) try:
newcls = type(classname, (cls,), attributes)
except Exception as e:
raise
# newcls = type(classname, (cls,), attributes)
result = Module.__new__(newcls) result = Module.__new__(newcls)
return result return result