From c443411764c6da0467703785e72592bfa1149947 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:14:04 +1100 Subject: [PATCH 01/11] Realign SCT drivers with R3.2 --- .../bilby/config/chopper/astrium_chopper.sct | 24 ++++++++++++---- .../config/beamline/he3_polanal.sct | 28 ++++--------------- .../config/environment/isotech_ps.sct | 2 +- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/site_ansto/instrument/bilby/config/chopper/astrium_chopper.sct b/site_ansto/instrument/bilby/config/chopper/astrium_chopper.sct index a25a2902..64e4bd47 100644 --- a/site_ansto/instrument/bilby/config/chopper/astrium_chopper.sct +++ b/site_ansto/instrument/bilby/config/chopper/astrium_chopper.sct @@ -2,7 +2,7 @@ driver astrium_chopper = { vendor = astrium; device = chopper; protocol = std; class = NXdisk_chopper; simulation_group = chopper_simulation; - group blade_1 = { + group disk_1 = { var state = { type = text; mutable = true; priv = user; readable = 1; read_command = '1'; fetch_function = fetchState; read_function = readState; @@ -13,9 +13,10 @@ driver astrium_chopper = { var aspeed = { type = float; mutable = true; } var rphase = { type = float; } var aphase = { type = float; mutable = true; } + var frequency = { type = float; mutable = true; } } - group blade_2 = { + group disk_2 = { var state = { type = text; mutable = true; priv = user; readable = 1; read_command = '2'; fetch_function = fetchState; read_function = readState; @@ -26,9 +27,10 @@ driver astrium_chopper = { var aspeed = { type = float; mutable = true; } var rphase = { type = float; } var aphase = { type = float; mutable = true; } + var frequency = { type = float; mutable = true; } } - group blade_3 = { + group disk_3 = { var state = { type = text; mutable = true; priv = user; readable = 1; read_command = '3'; fetch_function = fetchState; read_function = readState; @@ -39,9 +41,10 @@ driver astrium_chopper = { var aspeed = { type = float; mutable = true; } var rphase = { type = float; } var aphase = { type = float; mutable = true; } + var frequency = { type = float; mutable = true; } } - group blade_4 = { + group disk_4 = { var state = { type = text; mutable = true; priv = user; readable = 1; read_command = '4'; fetch_function = fetchState; read_function = readState; @@ -52,6 +55,7 @@ driver astrium_chopper = { var aspeed = { type = float; mutable = true; } var rphase = { type = float; } var aphase = { type = float; mutable = true; } + var frequency = { type = float; mutable = true; } } code fetch_function fetchState = {%% @@ -87,8 +91,16 @@ driver astrium_chopper = { set rhs "[string trim [lindex ${lst} 1]]" sct "attr_${lhs}" "${rhs}" set base [pathname [sct]] - foreach node [list ASPEED RSPEED APHASE RPHASE MASTER] { - if { [string equal -nocase "${lhs}" "${node}"] } { + switch [string toupper ${lhs}] { + "ASPEED" { + if [string is double "${rhs}"] { + set freq [expr "${rhs}" / 60.0] + if { "[hval ${base}/frequency]" != "${freq}" } { + hset ${base}/frequency ${freq} + } + } + } + "RSPEED" - "APHASE" - "RPHASE" - "MASTER" { if { "[hval ${base}/${node}]" != "${rhs}" } { hset ${base}/${node} "${rhs}" } diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index 68ba2a24..b0f784c0 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -16,14 +16,14 @@ driver he3_polanal = { writeable = 1; write_command = 'polariser'; check_function = chkWrite; - allowed = "+,-,Refresh" + allowed = "-1,0,+1" } var amplitude = { } var freq = { units = 'Hertz'; } var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } - var timestamp = { } + var timestamp = { type = int; } } group polariser_start = { conditional = '[string equal -nocase ${has_pol} "true"]'; @@ -34,7 +34,7 @@ driver he3_polanal = { var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } - var timestamp = { } + var timestamp = { type = int; } } group analyser = { @@ -54,7 +54,7 @@ driver he3_polanal = { var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } - var timestamp = { } + var timestamp = { type = int; } } group analyser_start = { conditional = '[string equal -nocase ${has_anal} "true"]'; @@ -65,7 +65,7 @@ driver he3_polanal = { var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } - var timestamp = { } + var timestamp = { type = int; } } code chkWrite = {%% @@ -103,27 +103,9 @@ driver he3_polanal = { code setValue = {%% set cmd "${cmd_str}" - if {[string equal -nocase [sct target] "refresh"]} { - set cmd "${cmd_str}" - } - if {[string equal -nocase [sct target] "minus"]} { - set cmd "${cmd_str} -" - } - if {[string equal -nocase [sct target] "dn"]} { - set cmd "${cmd_str} -" - } - if {[string equal -nocase [sct target] "down"]} { - set cmd "${cmd_str} -" - } if {[sct target] == "-" || [sct target] == -1} { set cmd "${cmd_str} -" } - if {[string equal -nocase [sct target] "plus"]} { - set cmd "${cmd_str} +" - } - if {[string equal -nocase [sct target] "up"]} { - set cmd "${cmd_str} +" - } if {[sct target] == "+" || [sct target] == 1} { set cmd "${cmd_str} +" } diff --git a/site_ansto/instrument/config/environment/isotech_ps.sct b/site_ansto/instrument/config/environment/isotech_ps.sct index b50e60e7..ea3672f4 100644 --- a/site_ansto/instrument/config/environment/isotech_ps.sct +++ b/site_ansto/instrument/config/environment/isotech_ps.sct @@ -5,7 +5,7 @@ driver isotech_ps = { vendor = isotech; device = ps; protocol = std; class = environment; simulation_group = environment_simulation; - protocol_args = '{terminator "\r"}'; + protocol_args = '{terminator \r}'; group = { readable = 5 mutable = true From 8f977bb98ff5c5e052e394b18f5d5e7d95a75526 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:18:45 +1100 Subject: [PATCH 02/11] Realign SCT drivers with R3.2 --- .../config/environment/temperature/julabo_lh45.sct | 2 +- .../instrument/config/environment/temperature/ls340.sct | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct index 06661609..6d490b51 100644 --- a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct +++ b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct @@ -8,7 +8,7 @@ driver julabo_lh45_gen = { simulation_group = environment_simulation add_args = '{id 1} {ctrl_sensor "bath"} {tol 5.0}'; make_args = 'id ctrl_sensor tol'; - protocol_args = '{terminator "\r"}'; + protocol_args = '{terminator \r}'; # # Unnamed group has variables at device level # diff --git a/site_ansto/instrument/config/environment/temperature/ls340.sct b/site_ansto/instrument/config/environment/temperature/ls340.sct index 6ac3fcdf..bd7e4de2 100644 --- a/site_ansto/instrument/config/environment/temperature/ls340.sct +++ b/site_ansto/instrument/config/environment/temperature/ls340.sct @@ -1,10 +1,11 @@ # vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent driver ls340 = { - protocol = std + protocol = std; class = environment simulation_group = environment_simulation add_args = 'id datype {tol1 1.0} {tol2 1.0}' - make_args = 'id datype tol1 tol2' + make_args = 'id datype {tol1 1.0} {tol2 1.0}' + protocol_args = '{terminator \r\n}' code mkDriver = {%% ::scobj::ls340::mk_sct_lakeshore_340 $sct_controller environment $name $id $datype $tol1 $tol2 0 %%} From ee4cd27f0ec846e8e3a0fd9849d697fc17c836ff Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:20:52 +1100 Subject: [PATCH 03/11] Regenerate SCT drivers --- .../config/chopper/sct_astrium_chopper.tcl | 616 ++++++++++-------- .../config/beamline/sct_he3_polanal.tcl | 36 +- .../config/environment/sct_isotech_ps.tcl | 6 +- .../temperature/sct_julabo_lh45_gen.tcl | 6 +- .../environment/temperature/sct_ls340.tcl | 31 +- 5 files changed, 376 insertions(+), 319 deletions(-) diff --git a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl index 4a45f219..34de087d 100644 --- a/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl +++ b/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl @@ -177,8 +177,16 @@ proc ::scobj::astrium_chopper::readState {tc_root} { set rhs "[string trim [lindex ${lst} 1]]" sct "attr_${lhs}" "${rhs}" set base [pathname [sct]] - foreach node [list ASPEED RSPEED APHASE RPHASE MASTER] { - if { [string equal -nocase "${lhs}" "${node}"] } { + switch [string toupper ${lhs}] { + "ASPEED" { + if [string is double "${rhs}"] { + set freq [expr "${rhs}" / 60.0] + if { "[hval ${base}/frequency]" != "${freq}" } { + hset ${base}/frequency ${freq} + } + } + } + "RSPEED" - "APHASE" - "RPHASE" - "MASTER" { if { "[hval ${base}/${node}]" != "${rhs}" } { hset ${base}/${node} "${rhs}" } @@ -245,333 +253,377 @@ proc ::scobj::astrium_chopper::mkDriver { sct_controller name device_class simul set scobj_hpath /sics/${name} - hfactory ${scobj_hpath}/blade_1 plain spy none + hfactory ${scobj_hpath}/disk_1 plain spy none - hfactory ${scobj_hpath}/blade_1/aphase plain user float - hsetprop ${scobj_hpath}/blade_1/aphase control true - hsetprop ${scobj_hpath}/blade_1/aphase data true - hsetprop ${scobj_hpath}/blade_1/aphase mutable true - hsetprop ${scobj_hpath}/blade_1/aphase nxsave true - hsetprop ${scobj_hpath}/blade_1/aphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_1/aphase klass "parameter" - hsetprop ${scobj_hpath}/blade_1/aphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/aphase type "part" - hsetprop ${scobj_hpath}/blade_1/aphase nxalias "${name}_blade_1_aphase" + hfactory ${scobj_hpath}/disk_1/aphase plain user float + hsetprop ${scobj_hpath}/disk_1/aphase control true + hsetprop ${scobj_hpath}/disk_1/aphase data true + hsetprop ${scobj_hpath}/disk_1/aphase mutable true + hsetprop ${scobj_hpath}/disk_1/aphase nxsave true + hsetprop ${scobj_hpath}/disk_1/aphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_1/aphase klass "parameter" + hsetprop ${scobj_hpath}/disk_1/aphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/aphase type "part" + hsetprop ${scobj_hpath}/disk_1/aphase nxalias "${name}_disk_1_aphase" - hfactory ${scobj_hpath}/blade_1/aspeed plain user float - hsetprop ${scobj_hpath}/blade_1/aspeed control true - hsetprop ${scobj_hpath}/blade_1/aspeed data true - hsetprop ${scobj_hpath}/blade_1/aspeed mutable true - hsetprop ${scobj_hpath}/blade_1/aspeed nxsave true - hsetprop ${scobj_hpath}/blade_1/aspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_1/aspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_1/aspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/aspeed type "part" - hsetprop ${scobj_hpath}/blade_1/aspeed nxalias "${name}_blade_1_aspeed" + hfactory ${scobj_hpath}/disk_1/aspeed plain user float + hsetprop ${scobj_hpath}/disk_1/aspeed control true + hsetprop ${scobj_hpath}/disk_1/aspeed data true + hsetprop ${scobj_hpath}/disk_1/aspeed mutable true + hsetprop ${scobj_hpath}/disk_1/aspeed nxsave true + hsetprop ${scobj_hpath}/disk_1/aspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_1/aspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_1/aspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/aspeed type "part" + hsetprop ${scobj_hpath}/disk_1/aspeed nxalias "${name}_disk_1_aspeed" - hfactory ${scobj_hpath}/blade_1/master plain user text - hsetprop ${scobj_hpath}/blade_1/master control true - hsetprop ${scobj_hpath}/blade_1/master data true - hsetprop ${scobj_hpath}/blade_1/master mutable true - hsetprop ${scobj_hpath}/blade_1/master nxsave true - hsetprop ${scobj_hpath}/blade_1/master oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_1/master klass "parameter" - hsetprop ${scobj_hpath}/blade_1/master sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/master type "part" - hsetprop ${scobj_hpath}/blade_1/master nxalias "${name}_blade_1_master" + hfactory ${scobj_hpath}/disk_1/frequency plain user float + hsetprop ${scobj_hpath}/disk_1/frequency control true + hsetprop ${scobj_hpath}/disk_1/frequency data true + hsetprop ${scobj_hpath}/disk_1/frequency mutable true + hsetprop ${scobj_hpath}/disk_1/frequency nxsave true + hsetprop ${scobj_hpath}/disk_1/frequency oldval 0.0 + hsetprop ${scobj_hpath}/disk_1/frequency klass "parameter" + hsetprop ${scobj_hpath}/disk_1/frequency sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/frequency type "part" + hsetprop ${scobj_hpath}/disk_1/frequency nxalias "${name}_disk_1_frequency" - hfactory ${scobj_hpath}/blade_1/rphase plain user float - hsetprop ${scobj_hpath}/blade_1/rphase control true - hsetprop ${scobj_hpath}/blade_1/rphase data true - hsetprop ${scobj_hpath}/blade_1/rphase mutable true - hsetprop ${scobj_hpath}/blade_1/rphase nxsave true - hsetprop ${scobj_hpath}/blade_1/rphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_1/rphase klass "parameter" - hsetprop ${scobj_hpath}/blade_1/rphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/rphase type "part" - hsetprop ${scobj_hpath}/blade_1/rphase nxalias "${name}_blade_1_rphase" + hfactory ${scobj_hpath}/disk_1/master plain user text + hsetprop ${scobj_hpath}/disk_1/master control true + hsetprop ${scobj_hpath}/disk_1/master data true + hsetprop ${scobj_hpath}/disk_1/master mutable true + hsetprop ${scobj_hpath}/disk_1/master nxsave true + hsetprop ${scobj_hpath}/disk_1/master oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_1/master klass "parameter" + hsetprop ${scobj_hpath}/disk_1/master sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/master type "part" + hsetprop ${scobj_hpath}/disk_1/master nxalias "${name}_disk_1_master" - hfactory ${scobj_hpath}/blade_1/rspeed plain user float - hsetprop ${scobj_hpath}/blade_1/rspeed control true - hsetprop ${scobj_hpath}/blade_1/rspeed data true - hsetprop ${scobj_hpath}/blade_1/rspeed mutable true - hsetprop ${scobj_hpath}/blade_1/rspeed nxsave true - hsetprop ${scobj_hpath}/blade_1/rspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_1/rspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_1/rspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/rspeed type "part" - hsetprop ${scobj_hpath}/blade_1/rspeed nxalias "${name}_blade_1_rspeed" + hfactory ${scobj_hpath}/disk_1/rphase plain user float + hsetprop ${scobj_hpath}/disk_1/rphase control true + hsetprop ${scobj_hpath}/disk_1/rphase data true + hsetprop ${scobj_hpath}/disk_1/rphase mutable true + hsetprop ${scobj_hpath}/disk_1/rphase nxsave true + hsetprop ${scobj_hpath}/disk_1/rphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_1/rphase klass "parameter" + hsetprop ${scobj_hpath}/disk_1/rphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/rphase type "part" + hsetprop ${scobj_hpath}/disk_1/rphase nxalias "${name}_disk_1_rphase" - hfactory ${scobj_hpath}/blade_1/state plain user text - hsetprop ${scobj_hpath}/blade_1/state read ${ns}::fetchState ${scobj_hpath} readState {1} - hsetprop ${scobj_hpath}/blade_1/state readState ${ns}::readState ${scobj_hpath} - hsetprop ${scobj_hpath}/blade_1/state control true - hsetprop ${scobj_hpath}/blade_1/state data true - hsetprop ${scobj_hpath}/blade_1/state mutable true - hsetprop ${scobj_hpath}/blade_1/state nxsave true - hsetprop ${scobj_hpath}/blade_1/state oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_1/state klass "parameter" - hsetprop ${scobj_hpath}/blade_1/state my_state "idle" - hsetprop ${scobj_hpath}/blade_1/state sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_1/state type "part" - hsetprop ${scobj_hpath}/blade_1/state nxalias "${name}_blade_1_state" + hfactory ${scobj_hpath}/disk_1/rspeed plain user float + hsetprop ${scobj_hpath}/disk_1/rspeed control true + hsetprop ${scobj_hpath}/disk_1/rspeed data true + hsetprop ${scobj_hpath}/disk_1/rspeed mutable true + hsetprop ${scobj_hpath}/disk_1/rspeed nxsave true + hsetprop ${scobj_hpath}/disk_1/rspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_1/rspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_1/rspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/rspeed type "part" + hsetprop ${scobj_hpath}/disk_1/rspeed nxalias "${name}_disk_1_rspeed" + + hfactory ${scobj_hpath}/disk_1/state plain user text + hsetprop ${scobj_hpath}/disk_1/state read ${ns}::fetchState ${scobj_hpath} readState {1} + hsetprop ${scobj_hpath}/disk_1/state readState ${ns}::readState ${scobj_hpath} + hsetprop ${scobj_hpath}/disk_1/state control true + hsetprop ${scobj_hpath}/disk_1/state data true + hsetprop ${scobj_hpath}/disk_1/state mutable true + hsetprop ${scobj_hpath}/disk_1/state nxsave true + hsetprop ${scobj_hpath}/disk_1/state oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_1/state klass "parameter" + hsetprop ${scobj_hpath}/disk_1/state my_state "idle" + hsetprop ${scobj_hpath}/disk_1/state sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_1/state type "part" + hsetprop ${scobj_hpath}/disk_1/state nxalias "${name}_disk_1_state" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/blade_1/state 1 - hsetprop ${scobj_hpath}/blade_1/state simulated false + ${sct_controller} poll ${scobj_hpath}/disk_1/state 1 + hsetprop ${scobj_hpath}/disk_1/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" - hsetprop ${scobj_hpath}/blade_1/state simulated true + hsetprop ${scobj_hpath}/disk_1/state simulated true } - hsetprop ${scobj_hpath}/blade_1 data "true" - hsetprop ${scobj_hpath}/blade_1 klass "@none" - hsetprop ${scobj_hpath}/blade_1 type "part" + hsetprop ${scobj_hpath}/disk_1 data "true" + hsetprop ${scobj_hpath}/disk_1 klass "@none" + hsetprop ${scobj_hpath}/disk_1 type "part" - hfactory ${scobj_hpath}/blade_2 plain spy none + hfactory ${scobj_hpath}/disk_2 plain spy none - hfactory ${scobj_hpath}/blade_2/aphase plain user float - hsetprop ${scobj_hpath}/blade_2/aphase control true - hsetprop ${scobj_hpath}/blade_2/aphase data true - hsetprop ${scobj_hpath}/blade_2/aphase mutable true - hsetprop ${scobj_hpath}/blade_2/aphase nxsave true - hsetprop ${scobj_hpath}/blade_2/aphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_2/aphase klass "parameter" - hsetprop ${scobj_hpath}/blade_2/aphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/aphase type "part" - hsetprop ${scobj_hpath}/blade_2/aphase nxalias "${name}_blade_2_aphase" + hfactory ${scobj_hpath}/disk_2/aphase plain user float + hsetprop ${scobj_hpath}/disk_2/aphase control true + hsetprop ${scobj_hpath}/disk_2/aphase data true + hsetprop ${scobj_hpath}/disk_2/aphase mutable true + hsetprop ${scobj_hpath}/disk_2/aphase nxsave true + hsetprop ${scobj_hpath}/disk_2/aphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_2/aphase klass "parameter" + hsetprop ${scobj_hpath}/disk_2/aphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/aphase type "part" + hsetprop ${scobj_hpath}/disk_2/aphase nxalias "${name}_disk_2_aphase" - hfactory ${scobj_hpath}/blade_2/aspeed plain user float - hsetprop ${scobj_hpath}/blade_2/aspeed control true - hsetprop ${scobj_hpath}/blade_2/aspeed data true - hsetprop ${scobj_hpath}/blade_2/aspeed mutable true - hsetprop ${scobj_hpath}/blade_2/aspeed nxsave true - hsetprop ${scobj_hpath}/blade_2/aspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_2/aspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_2/aspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/aspeed type "part" - hsetprop ${scobj_hpath}/blade_2/aspeed nxalias "${name}_blade_2_aspeed" + hfactory ${scobj_hpath}/disk_2/aspeed plain user float + hsetprop ${scobj_hpath}/disk_2/aspeed control true + hsetprop ${scobj_hpath}/disk_2/aspeed data true + hsetprop ${scobj_hpath}/disk_2/aspeed mutable true + hsetprop ${scobj_hpath}/disk_2/aspeed nxsave true + hsetprop ${scobj_hpath}/disk_2/aspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_2/aspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_2/aspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/aspeed type "part" + hsetprop ${scobj_hpath}/disk_2/aspeed nxalias "${name}_disk_2_aspeed" - hfactory ${scobj_hpath}/blade_2/master plain user text - hsetprop ${scobj_hpath}/blade_2/master control true - hsetprop ${scobj_hpath}/blade_2/master data true - hsetprop ${scobj_hpath}/blade_2/master mutable true - hsetprop ${scobj_hpath}/blade_2/master nxsave true - hsetprop ${scobj_hpath}/blade_2/master oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_2/master klass "parameter" - hsetprop ${scobj_hpath}/blade_2/master sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/master type "part" - hsetprop ${scobj_hpath}/blade_2/master nxalias "${name}_blade_2_master" + hfactory ${scobj_hpath}/disk_2/frequency plain user float + hsetprop ${scobj_hpath}/disk_2/frequency control true + hsetprop ${scobj_hpath}/disk_2/frequency data true + hsetprop ${scobj_hpath}/disk_2/frequency mutable true + hsetprop ${scobj_hpath}/disk_2/frequency nxsave true + hsetprop ${scobj_hpath}/disk_2/frequency oldval 0.0 + hsetprop ${scobj_hpath}/disk_2/frequency klass "parameter" + hsetprop ${scobj_hpath}/disk_2/frequency sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/frequency type "part" + hsetprop ${scobj_hpath}/disk_2/frequency nxalias "${name}_disk_2_frequency" - hfactory ${scobj_hpath}/blade_2/rphase plain user float - hsetprop ${scobj_hpath}/blade_2/rphase control true - hsetprop ${scobj_hpath}/blade_2/rphase data true - hsetprop ${scobj_hpath}/blade_2/rphase mutable true - hsetprop ${scobj_hpath}/blade_2/rphase nxsave true - hsetprop ${scobj_hpath}/blade_2/rphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_2/rphase klass "parameter" - hsetprop ${scobj_hpath}/blade_2/rphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/rphase type "part" - hsetprop ${scobj_hpath}/blade_2/rphase nxalias "${name}_blade_2_rphase" + hfactory ${scobj_hpath}/disk_2/master plain user text + hsetprop ${scobj_hpath}/disk_2/master control true + hsetprop ${scobj_hpath}/disk_2/master data true + hsetprop ${scobj_hpath}/disk_2/master mutable true + hsetprop ${scobj_hpath}/disk_2/master nxsave true + hsetprop ${scobj_hpath}/disk_2/master oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_2/master klass "parameter" + hsetprop ${scobj_hpath}/disk_2/master sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/master type "part" + hsetprop ${scobj_hpath}/disk_2/master nxalias "${name}_disk_2_master" - hfactory ${scobj_hpath}/blade_2/rspeed plain user float - hsetprop ${scobj_hpath}/blade_2/rspeed control true - hsetprop ${scobj_hpath}/blade_2/rspeed data true - hsetprop ${scobj_hpath}/blade_2/rspeed mutable true - hsetprop ${scobj_hpath}/blade_2/rspeed nxsave true - hsetprop ${scobj_hpath}/blade_2/rspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_2/rspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_2/rspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/rspeed type "part" - hsetprop ${scobj_hpath}/blade_2/rspeed nxalias "${name}_blade_2_rspeed" + hfactory ${scobj_hpath}/disk_2/rphase plain user float + hsetprop ${scobj_hpath}/disk_2/rphase control true + hsetprop ${scobj_hpath}/disk_2/rphase data true + hsetprop ${scobj_hpath}/disk_2/rphase mutable true + hsetprop ${scobj_hpath}/disk_2/rphase nxsave true + hsetprop ${scobj_hpath}/disk_2/rphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_2/rphase klass "parameter" + hsetprop ${scobj_hpath}/disk_2/rphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/rphase type "part" + hsetprop ${scobj_hpath}/disk_2/rphase nxalias "${name}_disk_2_rphase" - hfactory ${scobj_hpath}/blade_2/state plain user text - hsetprop ${scobj_hpath}/blade_2/state read ${ns}::fetchState ${scobj_hpath} readState {2} - hsetprop ${scobj_hpath}/blade_2/state readState ${ns}::readState ${scobj_hpath} - hsetprop ${scobj_hpath}/blade_2/state control true - hsetprop ${scobj_hpath}/blade_2/state data true - hsetprop ${scobj_hpath}/blade_2/state mutable true - hsetprop ${scobj_hpath}/blade_2/state nxsave true - hsetprop ${scobj_hpath}/blade_2/state oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_2/state klass "parameter" - hsetprop ${scobj_hpath}/blade_2/state my_state "idle" - hsetprop ${scobj_hpath}/blade_2/state sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_2/state type "part" - hsetprop ${scobj_hpath}/blade_2/state nxalias "${name}_blade_2_state" + hfactory ${scobj_hpath}/disk_2/rspeed plain user float + hsetprop ${scobj_hpath}/disk_2/rspeed control true + hsetprop ${scobj_hpath}/disk_2/rspeed data true + hsetprop ${scobj_hpath}/disk_2/rspeed mutable true + hsetprop ${scobj_hpath}/disk_2/rspeed nxsave true + hsetprop ${scobj_hpath}/disk_2/rspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_2/rspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_2/rspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/rspeed type "part" + hsetprop ${scobj_hpath}/disk_2/rspeed nxalias "${name}_disk_2_rspeed" + + hfactory ${scobj_hpath}/disk_2/state plain user text + hsetprop ${scobj_hpath}/disk_2/state read ${ns}::fetchState ${scobj_hpath} readState {2} + hsetprop ${scobj_hpath}/disk_2/state readState ${ns}::readState ${scobj_hpath} + hsetprop ${scobj_hpath}/disk_2/state control true + hsetprop ${scobj_hpath}/disk_2/state data true + hsetprop ${scobj_hpath}/disk_2/state mutable true + hsetprop ${scobj_hpath}/disk_2/state nxsave true + hsetprop ${scobj_hpath}/disk_2/state oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_2/state klass "parameter" + hsetprop ${scobj_hpath}/disk_2/state my_state "idle" + hsetprop ${scobj_hpath}/disk_2/state sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_2/state type "part" + hsetprop ${scobj_hpath}/disk_2/state nxalias "${name}_disk_2_state" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/blade_2/state 1 - hsetprop ${scobj_hpath}/blade_2/state simulated false + ${sct_controller} poll ${scobj_hpath}/disk_2/state 1 + hsetprop ${scobj_hpath}/disk_2/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" - hsetprop ${scobj_hpath}/blade_2/state simulated true + hsetprop ${scobj_hpath}/disk_2/state simulated true } - hsetprop ${scobj_hpath}/blade_2 data "true" - hsetprop ${scobj_hpath}/blade_2 klass "@none" - hsetprop ${scobj_hpath}/blade_2 type "part" + hsetprop ${scobj_hpath}/disk_2 data "true" + hsetprop ${scobj_hpath}/disk_2 klass "@none" + hsetprop ${scobj_hpath}/disk_2 type "part" - hfactory ${scobj_hpath}/blade_3 plain spy none + hfactory ${scobj_hpath}/disk_3 plain spy none - hfactory ${scobj_hpath}/blade_3/aphase plain user float - hsetprop ${scobj_hpath}/blade_3/aphase control true - hsetprop ${scobj_hpath}/blade_3/aphase data true - hsetprop ${scobj_hpath}/blade_3/aphase mutable true - hsetprop ${scobj_hpath}/blade_3/aphase nxsave true - hsetprop ${scobj_hpath}/blade_3/aphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_3/aphase klass "parameter" - hsetprop ${scobj_hpath}/blade_3/aphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/aphase type "part" - hsetprop ${scobj_hpath}/blade_3/aphase nxalias "${name}_blade_3_aphase" + hfactory ${scobj_hpath}/disk_3/aphase plain user float + hsetprop ${scobj_hpath}/disk_3/aphase control true + hsetprop ${scobj_hpath}/disk_3/aphase data true + hsetprop ${scobj_hpath}/disk_3/aphase mutable true + hsetprop ${scobj_hpath}/disk_3/aphase nxsave true + hsetprop ${scobj_hpath}/disk_3/aphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_3/aphase klass "parameter" + hsetprop ${scobj_hpath}/disk_3/aphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/aphase type "part" + hsetprop ${scobj_hpath}/disk_3/aphase nxalias "${name}_disk_3_aphase" - hfactory ${scobj_hpath}/blade_3/aspeed plain user float - hsetprop ${scobj_hpath}/blade_3/aspeed control true - hsetprop ${scobj_hpath}/blade_3/aspeed data true - hsetprop ${scobj_hpath}/blade_3/aspeed mutable true - hsetprop ${scobj_hpath}/blade_3/aspeed nxsave true - hsetprop ${scobj_hpath}/blade_3/aspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_3/aspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_3/aspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/aspeed type "part" - hsetprop ${scobj_hpath}/blade_3/aspeed nxalias "${name}_blade_3_aspeed" + hfactory ${scobj_hpath}/disk_3/aspeed plain user float + hsetprop ${scobj_hpath}/disk_3/aspeed control true + hsetprop ${scobj_hpath}/disk_3/aspeed data true + hsetprop ${scobj_hpath}/disk_3/aspeed mutable true + hsetprop ${scobj_hpath}/disk_3/aspeed nxsave true + hsetprop ${scobj_hpath}/disk_3/aspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_3/aspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_3/aspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/aspeed type "part" + hsetprop ${scobj_hpath}/disk_3/aspeed nxalias "${name}_disk_3_aspeed" - hfactory ${scobj_hpath}/blade_3/master plain user text - hsetprop ${scobj_hpath}/blade_3/master control true - hsetprop ${scobj_hpath}/blade_3/master data true - hsetprop ${scobj_hpath}/blade_3/master mutable true - hsetprop ${scobj_hpath}/blade_3/master nxsave true - hsetprop ${scobj_hpath}/blade_3/master oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_3/master klass "parameter" - hsetprop ${scobj_hpath}/blade_3/master sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/master type "part" - hsetprop ${scobj_hpath}/blade_3/master nxalias "${name}_blade_3_master" + hfactory ${scobj_hpath}/disk_3/frequency plain user float + hsetprop ${scobj_hpath}/disk_3/frequency control true + hsetprop ${scobj_hpath}/disk_3/frequency data true + hsetprop ${scobj_hpath}/disk_3/frequency mutable true + hsetprop ${scobj_hpath}/disk_3/frequency nxsave true + hsetprop ${scobj_hpath}/disk_3/frequency oldval 0.0 + hsetprop ${scobj_hpath}/disk_3/frequency klass "parameter" + hsetprop ${scobj_hpath}/disk_3/frequency sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/frequency type "part" + hsetprop ${scobj_hpath}/disk_3/frequency nxalias "${name}_disk_3_frequency" - hfactory ${scobj_hpath}/blade_3/rphase plain user float - hsetprop ${scobj_hpath}/blade_3/rphase control true - hsetprop ${scobj_hpath}/blade_3/rphase data true - hsetprop ${scobj_hpath}/blade_3/rphase mutable true - hsetprop ${scobj_hpath}/blade_3/rphase nxsave true - hsetprop ${scobj_hpath}/blade_3/rphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_3/rphase klass "parameter" - hsetprop ${scobj_hpath}/blade_3/rphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/rphase type "part" - hsetprop ${scobj_hpath}/blade_3/rphase nxalias "${name}_blade_3_rphase" + hfactory ${scobj_hpath}/disk_3/master plain user text + hsetprop ${scobj_hpath}/disk_3/master control true + hsetprop ${scobj_hpath}/disk_3/master data true + hsetprop ${scobj_hpath}/disk_3/master mutable true + hsetprop ${scobj_hpath}/disk_3/master nxsave true + hsetprop ${scobj_hpath}/disk_3/master oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_3/master klass "parameter" + hsetprop ${scobj_hpath}/disk_3/master sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/master type "part" + hsetprop ${scobj_hpath}/disk_3/master nxalias "${name}_disk_3_master" - hfactory ${scobj_hpath}/blade_3/rspeed plain user float - hsetprop ${scobj_hpath}/blade_3/rspeed control true - hsetprop ${scobj_hpath}/blade_3/rspeed data true - hsetprop ${scobj_hpath}/blade_3/rspeed mutable true - hsetprop ${scobj_hpath}/blade_3/rspeed nxsave true - hsetprop ${scobj_hpath}/blade_3/rspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_3/rspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_3/rspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/rspeed type "part" - hsetprop ${scobj_hpath}/blade_3/rspeed nxalias "${name}_blade_3_rspeed" + hfactory ${scobj_hpath}/disk_3/rphase plain user float + hsetprop ${scobj_hpath}/disk_3/rphase control true + hsetprop ${scobj_hpath}/disk_3/rphase data true + hsetprop ${scobj_hpath}/disk_3/rphase mutable true + hsetprop ${scobj_hpath}/disk_3/rphase nxsave true + hsetprop ${scobj_hpath}/disk_3/rphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_3/rphase klass "parameter" + hsetprop ${scobj_hpath}/disk_3/rphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/rphase type "part" + hsetprop ${scobj_hpath}/disk_3/rphase nxalias "${name}_disk_3_rphase" - hfactory ${scobj_hpath}/blade_3/state plain user text - hsetprop ${scobj_hpath}/blade_3/state read ${ns}::fetchState ${scobj_hpath} readState {3} - hsetprop ${scobj_hpath}/blade_3/state readState ${ns}::readState ${scobj_hpath} - hsetprop ${scobj_hpath}/blade_3/state control true - hsetprop ${scobj_hpath}/blade_3/state data true - hsetprop ${scobj_hpath}/blade_3/state mutable true - hsetprop ${scobj_hpath}/blade_3/state nxsave true - hsetprop ${scobj_hpath}/blade_3/state oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_3/state klass "parameter" - hsetprop ${scobj_hpath}/blade_3/state my_state "idle" - hsetprop ${scobj_hpath}/blade_3/state sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_3/state type "part" - hsetprop ${scobj_hpath}/blade_3/state nxalias "${name}_blade_3_state" + hfactory ${scobj_hpath}/disk_3/rspeed plain user float + hsetprop ${scobj_hpath}/disk_3/rspeed control true + hsetprop ${scobj_hpath}/disk_3/rspeed data true + hsetprop ${scobj_hpath}/disk_3/rspeed mutable true + hsetprop ${scobj_hpath}/disk_3/rspeed nxsave true + hsetprop ${scobj_hpath}/disk_3/rspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_3/rspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_3/rspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/rspeed type "part" + hsetprop ${scobj_hpath}/disk_3/rspeed nxalias "${name}_disk_3_rspeed" + + hfactory ${scobj_hpath}/disk_3/state plain user text + hsetprop ${scobj_hpath}/disk_3/state read ${ns}::fetchState ${scobj_hpath} readState {3} + hsetprop ${scobj_hpath}/disk_3/state readState ${ns}::readState ${scobj_hpath} + hsetprop ${scobj_hpath}/disk_3/state control true + hsetprop ${scobj_hpath}/disk_3/state data true + hsetprop ${scobj_hpath}/disk_3/state mutable true + hsetprop ${scobj_hpath}/disk_3/state nxsave true + hsetprop ${scobj_hpath}/disk_3/state oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_3/state klass "parameter" + hsetprop ${scobj_hpath}/disk_3/state my_state "idle" + hsetprop ${scobj_hpath}/disk_3/state sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_3/state type "part" + hsetprop ${scobj_hpath}/disk_3/state nxalias "${name}_disk_3_state" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/blade_3/state 1 - hsetprop ${scobj_hpath}/blade_3/state simulated false + ${sct_controller} poll ${scobj_hpath}/disk_3/state 1 + hsetprop ${scobj_hpath}/disk_3/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" - hsetprop ${scobj_hpath}/blade_3/state simulated true + hsetprop ${scobj_hpath}/disk_3/state simulated true } - hsetprop ${scobj_hpath}/blade_3 data "true" - hsetprop ${scobj_hpath}/blade_3 klass "@none" - hsetprop ${scobj_hpath}/blade_3 type "part" + hsetprop ${scobj_hpath}/disk_3 data "true" + hsetprop ${scobj_hpath}/disk_3 klass "@none" + hsetprop ${scobj_hpath}/disk_3 type "part" - hfactory ${scobj_hpath}/blade_4 plain spy none + hfactory ${scobj_hpath}/disk_4 plain spy none - hfactory ${scobj_hpath}/blade_4/aphase plain user float - hsetprop ${scobj_hpath}/blade_4/aphase control true - hsetprop ${scobj_hpath}/blade_4/aphase data true - hsetprop ${scobj_hpath}/blade_4/aphase mutable true - hsetprop ${scobj_hpath}/blade_4/aphase nxsave true - hsetprop ${scobj_hpath}/blade_4/aphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_4/aphase klass "parameter" - hsetprop ${scobj_hpath}/blade_4/aphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/aphase type "part" - hsetprop ${scobj_hpath}/blade_4/aphase nxalias "${name}_blade_4_aphase" + hfactory ${scobj_hpath}/disk_4/aphase plain user float + hsetprop ${scobj_hpath}/disk_4/aphase control true + hsetprop ${scobj_hpath}/disk_4/aphase data true + hsetprop ${scobj_hpath}/disk_4/aphase mutable true + hsetprop ${scobj_hpath}/disk_4/aphase nxsave true + hsetprop ${scobj_hpath}/disk_4/aphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_4/aphase klass "parameter" + hsetprop ${scobj_hpath}/disk_4/aphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/aphase type "part" + hsetprop ${scobj_hpath}/disk_4/aphase nxalias "${name}_disk_4_aphase" - hfactory ${scobj_hpath}/blade_4/aspeed plain user float - hsetprop ${scobj_hpath}/blade_4/aspeed control true - hsetprop ${scobj_hpath}/blade_4/aspeed data true - hsetprop ${scobj_hpath}/blade_4/aspeed mutable true - hsetprop ${scobj_hpath}/blade_4/aspeed nxsave true - hsetprop ${scobj_hpath}/blade_4/aspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_4/aspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_4/aspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/aspeed type "part" - hsetprop ${scobj_hpath}/blade_4/aspeed nxalias "${name}_blade_4_aspeed" + hfactory ${scobj_hpath}/disk_4/aspeed plain user float + hsetprop ${scobj_hpath}/disk_4/aspeed control true + hsetprop ${scobj_hpath}/disk_4/aspeed data true + hsetprop ${scobj_hpath}/disk_4/aspeed mutable true + hsetprop ${scobj_hpath}/disk_4/aspeed nxsave true + hsetprop ${scobj_hpath}/disk_4/aspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_4/aspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_4/aspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/aspeed type "part" + hsetprop ${scobj_hpath}/disk_4/aspeed nxalias "${name}_disk_4_aspeed" - hfactory ${scobj_hpath}/blade_4/master plain user text - hsetprop ${scobj_hpath}/blade_4/master control true - hsetprop ${scobj_hpath}/blade_4/master data true - hsetprop ${scobj_hpath}/blade_4/master mutable true - hsetprop ${scobj_hpath}/blade_4/master nxsave true - hsetprop ${scobj_hpath}/blade_4/master oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_4/master klass "parameter" - hsetprop ${scobj_hpath}/blade_4/master sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/master type "part" - hsetprop ${scobj_hpath}/blade_4/master nxalias "${name}_blade_4_master" + hfactory ${scobj_hpath}/disk_4/frequency plain user float + hsetprop ${scobj_hpath}/disk_4/frequency control true + hsetprop ${scobj_hpath}/disk_4/frequency data true + hsetprop ${scobj_hpath}/disk_4/frequency mutable true + hsetprop ${scobj_hpath}/disk_4/frequency nxsave true + hsetprop ${scobj_hpath}/disk_4/frequency oldval 0.0 + hsetprop ${scobj_hpath}/disk_4/frequency klass "parameter" + hsetprop ${scobj_hpath}/disk_4/frequency sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/frequency type "part" + hsetprop ${scobj_hpath}/disk_4/frequency nxalias "${name}_disk_4_frequency" - hfactory ${scobj_hpath}/blade_4/rphase plain user float - hsetprop ${scobj_hpath}/blade_4/rphase control true - hsetprop ${scobj_hpath}/blade_4/rphase data true - hsetprop ${scobj_hpath}/blade_4/rphase mutable true - hsetprop ${scobj_hpath}/blade_4/rphase nxsave true - hsetprop ${scobj_hpath}/blade_4/rphase oldval 0.0 - hsetprop ${scobj_hpath}/blade_4/rphase klass "parameter" - hsetprop ${scobj_hpath}/blade_4/rphase sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/rphase type "part" - hsetprop ${scobj_hpath}/blade_4/rphase nxalias "${name}_blade_4_rphase" + hfactory ${scobj_hpath}/disk_4/master plain user text + hsetprop ${scobj_hpath}/disk_4/master control true + hsetprop ${scobj_hpath}/disk_4/master data true + hsetprop ${scobj_hpath}/disk_4/master mutable true + hsetprop ${scobj_hpath}/disk_4/master nxsave true + hsetprop ${scobj_hpath}/disk_4/master oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_4/master klass "parameter" + hsetprop ${scobj_hpath}/disk_4/master sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/master type "part" + hsetprop ${scobj_hpath}/disk_4/master nxalias "${name}_disk_4_master" - hfactory ${scobj_hpath}/blade_4/rspeed plain user float - hsetprop ${scobj_hpath}/blade_4/rspeed control true - hsetprop ${scobj_hpath}/blade_4/rspeed data true - hsetprop ${scobj_hpath}/blade_4/rspeed mutable true - hsetprop ${scobj_hpath}/blade_4/rspeed nxsave true - hsetprop ${scobj_hpath}/blade_4/rspeed oldval 0.0 - hsetprop ${scobj_hpath}/blade_4/rspeed klass "parameter" - hsetprop ${scobj_hpath}/blade_4/rspeed sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/rspeed type "part" - hsetprop ${scobj_hpath}/blade_4/rspeed nxalias "${name}_blade_4_rspeed" + hfactory ${scobj_hpath}/disk_4/rphase plain user float + hsetprop ${scobj_hpath}/disk_4/rphase control true + hsetprop ${scobj_hpath}/disk_4/rphase data true + hsetprop ${scobj_hpath}/disk_4/rphase mutable true + hsetprop ${scobj_hpath}/disk_4/rphase nxsave true + hsetprop ${scobj_hpath}/disk_4/rphase oldval 0.0 + hsetprop ${scobj_hpath}/disk_4/rphase klass "parameter" + hsetprop ${scobj_hpath}/disk_4/rphase sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/rphase type "part" + hsetprop ${scobj_hpath}/disk_4/rphase nxalias "${name}_disk_4_rphase" - hfactory ${scobj_hpath}/blade_4/state plain user text - hsetprop ${scobj_hpath}/blade_4/state read ${ns}::fetchState ${scobj_hpath} readState {4} - hsetprop ${scobj_hpath}/blade_4/state readState ${ns}::readState ${scobj_hpath} - hsetprop ${scobj_hpath}/blade_4/state control true - hsetprop ${scobj_hpath}/blade_4/state data true - hsetprop ${scobj_hpath}/blade_4/state mutable true - hsetprop ${scobj_hpath}/blade_4/state nxsave true - hsetprop ${scobj_hpath}/blade_4/state oldval UNKNOWN - hsetprop ${scobj_hpath}/blade_4/state klass "parameter" - hsetprop ${scobj_hpath}/blade_4/state my_state "idle" - hsetprop ${scobj_hpath}/blade_4/state sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/blade_4/state type "part" - hsetprop ${scobj_hpath}/blade_4/state nxalias "${name}_blade_4_state" + hfactory ${scobj_hpath}/disk_4/rspeed plain user float + hsetprop ${scobj_hpath}/disk_4/rspeed control true + hsetprop ${scobj_hpath}/disk_4/rspeed data true + hsetprop ${scobj_hpath}/disk_4/rspeed mutable true + hsetprop ${scobj_hpath}/disk_4/rspeed nxsave true + hsetprop ${scobj_hpath}/disk_4/rspeed oldval 0.0 + hsetprop ${scobj_hpath}/disk_4/rspeed klass "parameter" + hsetprop ${scobj_hpath}/disk_4/rspeed sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/rspeed type "part" + hsetprop ${scobj_hpath}/disk_4/rspeed nxalias "${name}_disk_4_rspeed" + + hfactory ${scobj_hpath}/disk_4/state plain user text + hsetprop ${scobj_hpath}/disk_4/state read ${ns}::fetchState ${scobj_hpath} readState {4} + hsetprop ${scobj_hpath}/disk_4/state readState ${ns}::readState ${scobj_hpath} + hsetprop ${scobj_hpath}/disk_4/state control true + hsetprop ${scobj_hpath}/disk_4/state data true + hsetprop ${scobj_hpath}/disk_4/state mutable true + hsetprop ${scobj_hpath}/disk_4/state nxsave true + hsetprop ${scobj_hpath}/disk_4/state oldval UNKNOWN + hsetprop ${scobj_hpath}/disk_4/state klass "parameter" + hsetprop ${scobj_hpath}/disk_4/state my_state "idle" + hsetprop ${scobj_hpath}/disk_4/state sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/disk_4/state type "part" + hsetprop ${scobj_hpath}/disk_4/state nxalias "${name}_disk_4_state" if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/blade_4/state 1 - hsetprop ${scobj_hpath}/blade_4/state simulated false + ${sct_controller} poll ${scobj_hpath}/disk_4/state 1 + hsetprop ${scobj_hpath}/disk_4/state simulated false } else { ::scobj::astrium_chopper::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for astrium_chopper" - hsetprop ${scobj_hpath}/blade_4/state simulated true + hsetprop ${scobj_hpath}/disk_4/state simulated true } - hsetprop ${scobj_hpath}/blade_4 data "true" - hsetprop ${scobj_hpath}/blade_4 klass "@none" - hsetprop ${scobj_hpath}/blade_4 type "part" + hsetprop ${scobj_hpath}/disk_4 data "true" + hsetprop ${scobj_hpath}/disk_4 klass "@none" + hsetprop ${scobj_hpath}/disk_4 type "part" hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 654db951..6aa7809f 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -175,27 +175,9 @@ proc ::scobj::he3_polanal::setValue {tc_root nextState cmd_str} { set cmd "${cmd_str}${par}" # setValue hook code starts set cmd "${cmd_str}" - if {[string equal -nocase [sct target] "refresh"]} { - set cmd "${cmd_str}" - } - if {[string equal -nocase [sct target] "minus"]} { - set cmd "${cmd_str} -" - } - if {[string equal -nocase [sct target] "dn"]} { - set cmd "${cmd_str} -" - } - if {[string equal -nocase [sct target] "down"]} { - set cmd "${cmd_str} -" - } if {[sct target] == "-" || [sct target] == -1} { set cmd "${cmd_str} -" } - if {[string equal -nocase [sct target] "plus"]} { - set cmd "${cmd_str} +" - } - if {[string equal -nocase [sct target] "up"]} { - set cmd "${cmd_str} +" - } if {[sct target] == "+" || [sct target] == 1} { set cmd "${cmd_str} +" } @@ -318,12 +300,12 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser/time2 type "part" hsetprop ${scobj_hpath}/analyser/time2 nxalias "${name}_analyser_time2" - hfactory ${scobj_hpath}/analyser/timestamp plain user float + hfactory ${scobj_hpath}/analyser/timestamp plain user int hsetprop ${scobj_hpath}/analyser/timestamp control true hsetprop ${scobj_hpath}/analyser/timestamp data true hsetprop ${scobj_hpath}/analyser/timestamp mutable true hsetprop ${scobj_hpath}/analyser/timestamp nxsave true - hsetprop ${scobj_hpath}/analyser/timestamp oldval 0.0 + hsetprop ${scobj_hpath}/analyser/timestamp oldval 0 hsetprop ${scobj_hpath}/analyser/timestamp klass "parameter" hsetprop ${scobj_hpath}/analyser/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser/timestamp type "part" @@ -406,12 +388,12 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser_start/time2 type "part" hsetprop ${scobj_hpath}/analyser_start/time2 nxalias "${name}_analyser_start_time2" - hfactory ${scobj_hpath}/analyser_start/timestamp plain user float + hfactory ${scobj_hpath}/analyser_start/timestamp plain user int hsetprop ${scobj_hpath}/analyser_start/timestamp control true hsetprop ${scobj_hpath}/analyser_start/timestamp data true hsetprop ${scobj_hpath}/analyser_start/timestamp mutable true hsetprop ${scobj_hpath}/analyser_start/timestamp nxsave true - hsetprop ${scobj_hpath}/analyser_start/timestamp oldval 0.0 + hsetprop ${scobj_hpath}/analyser_start/timestamp oldval 0 hsetprop ${scobj_hpath}/analyser_start/timestamp klass "parameter" hsetprop ${scobj_hpath}/analyser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/analyser_start/timestamp type "part" @@ -481,7 +463,7 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser/spin data true hsetprop ${scobj_hpath}/polariser/spin mutable true hsetprop ${scobj_hpath}/polariser/spin nxsave true - hsetprop ${scobj_hpath}/polariser/spin values +,-,Refresh + hsetprop ${scobj_hpath}/polariser/spin values -1,0,+1 hsetprop ${scobj_hpath}/polariser/spin oldval 0.0 hsetprop ${scobj_hpath}/polariser/spin klass "parameter" hsetprop ${scobj_hpath}/polariser/spin sdsinfo "::nexus::scobj::sdsinfo" @@ -509,12 +491,12 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser/time2 type "part" hsetprop ${scobj_hpath}/polariser/time2 nxalias "${name}_polariser_time2" - hfactory ${scobj_hpath}/polariser/timestamp plain user float + hfactory ${scobj_hpath}/polariser/timestamp plain user int hsetprop ${scobj_hpath}/polariser/timestamp control true hsetprop ${scobj_hpath}/polariser/timestamp data true hsetprop ${scobj_hpath}/polariser/timestamp mutable true hsetprop ${scobj_hpath}/polariser/timestamp nxsave true - hsetprop ${scobj_hpath}/polariser/timestamp oldval 0.0 + hsetprop ${scobj_hpath}/polariser/timestamp oldval 0 hsetprop ${scobj_hpath}/polariser/timestamp klass "parameter" hsetprop ${scobj_hpath}/polariser/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser/timestamp type "part" @@ -597,12 +579,12 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser_start/time2 type "part" hsetprop ${scobj_hpath}/polariser_start/time2 nxalias "${name}_polariser_start_time2" - hfactory ${scobj_hpath}/polariser_start/timestamp plain user float + hfactory ${scobj_hpath}/polariser_start/timestamp plain user int hsetprop ${scobj_hpath}/polariser_start/timestamp control true hsetprop ${scobj_hpath}/polariser_start/timestamp data true hsetprop ${scobj_hpath}/polariser_start/timestamp mutable true hsetprop ${scobj_hpath}/polariser_start/timestamp nxsave true - hsetprop ${scobj_hpath}/polariser_start/timestamp oldval 0.0 + hsetprop ${scobj_hpath}/polariser_start/timestamp oldval 0 hsetprop ${scobj_hpath}/polariser_start/timestamp klass "parameter" hsetprop ${scobj_hpath}/polariser_start/timestamp sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/polariser_start/timestamp type "part" diff --git a/site_ansto/instrument/config/environment/sct_isotech_ps.tcl b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl index 5c6ac839..05ddd1e8 100644 --- a/site_ansto/instrument/config/environment/sct_isotech_ps.tcl +++ b/site_ansto/instrument/config/environment/sct_isotech_ps.tcl @@ -347,8 +347,8 @@ proc ::scobj::isotech_ps::add_driver {name device_class simulation_flag ip_addre ::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" makesctcontroller sct_${name} aqadapter ${tcp_port} } else { - ::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \"\\r\"" - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r" + ::scobj::isotech_ps::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \\r" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \r } } else { ::scobj::isotech_ps::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for isotech_ps" @@ -420,7 +420,7 @@ proc ::scobj::isotech_ps::read_config {} { set arg_list [list] set missing_list [list] array unset default_map - array set default_map [list terminator "\r"] + array set default_map [list terminator \r] foreach arg {terminator} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" diff --git a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl index 1e41640b..c098ad67 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45_gen.tcl @@ -697,8 +697,8 @@ proc ::scobj::julabo_lh45_gen::add_driver {name device_class simulation_flag ip_ ::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" makesctcontroller sct_${name} aqadapter ${tcp_port} } else { - ::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \"\\r\"" - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} "\r" + ::scobj::julabo_lh45_gen::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \\r" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \r } } else { ::scobj::julabo_lh45_gen::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for julabo_lh45_gen" @@ -770,7 +770,7 @@ proc ::scobj::julabo_lh45_gen::read_config {} { set arg_list [list] set missing_list [list] array unset default_map - array set default_map [list terminator "\r"] + array set default_map [list terminator \r] foreach arg {terminator} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" diff --git a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl index 0dc417e8..fd49c355 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_ls340.tcl @@ -30,7 +30,7 @@ proc ::scobj::ls340::sics_log {debug_level debug_string} { } catch_message ] } -proc ::scobj::ls340::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype tol1 tol2 } { +proc ::scobj::ls340::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype {tol1 1.0} {tol2 1.0} } { ::scobj::ls340::sics_log 9 "::scobj::ls340::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol1} ${tol2}" set ns "[namespace current]" set catch_status [ catch { @@ -59,8 +59,8 @@ proc ::scobj::ls340::add_driver {name device_class simulation_flag ip_address tc ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" makesctcontroller sct_${name} aqadapter ${tcp_port} } else { - ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + ::scobj::ls340::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \\r\\n" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} \r\n } } else { ::scobj::ls340::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for ls340" @@ -129,7 +129,26 @@ proc ::scobj::ls340::read_config {} { if { [string equal -nocase ${asyncqueue} "sct"] } { set ip_address [dict get $v ip] set tcp_port [dict get $v port] - makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list terminator \r\n] + foreach arg {terminator} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} {*}$arg_list } else { makesctcontroller sct_${name} aqadapter ${asyncqueue} } @@ -161,11 +180,15 @@ proc ::scobj::ls340::read_config {} { } set arg_list [list] set missing_list [list] + array unset default_map + array set default_map [list tol1 1.0 tol2 1.0] foreach arg {id datype tol1 tol2} { if {[dict exists $u $arg]} { lappend arg_list "[dict get $u $arg]" } elseif {[dict exists $v $arg]} { lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) } else { ${ns}::sics_log 9 "Missing configuration value $arg" lappend missing_list $arg From b35c470c797c4c66c2a2f4e45b58c681f683023c Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:39:26 +1100 Subject: [PATCH 04/11] Remove debug_threshold from debugging test --- site_ansto/instrument/config/beamline/he3_polanal.sct | 1 - site_ansto/instrument/config/environment/knauer_pump.sct | 1 - 2 files changed, 2 deletions(-) diff --git a/site_ansto/instrument/config/beamline/he3_polanal.sct b/site_ansto/instrument/config/beamline/he3_polanal.sct index b0f784c0..5352068d 100644 --- a/site_ansto/instrument/config/beamline/he3_polanal.sct +++ b/site_ansto/instrument/config/beamline/he3_polanal.sct @@ -1,6 +1,5 @@ # vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent driver he3_polanal = { - debug_threshold = 0; protocol = std; class = instrument; simulation_group = rfgen_simulation; diff --git a/site_ansto/instrument/config/environment/knauer_pump.sct b/site_ansto/instrument/config/environment/knauer_pump.sct index 881caa4c..cd5b0baf 100644 --- a/site_ansto/instrument/config/environment/knauer_pump.sct +++ b/site_ansto/instrument/config/environment/knauer_pump.sct @@ -3,7 +3,6 @@ # vim: ft=tcl ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent # driver knauer_pump = { - debug_threshold = 0; vendor = knauer; device = pump40p; protocol = knauer_ap; class = environment; simulation_group = environment_simulation; From b84efe47cf573b553a4ef0b734e4c2f6faf37dae Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:53:48 +1100 Subject: [PATCH 05/11] Regenerate SCT drivers --- site_ansto/instrument/config/beamline/sct_he3_polanal.tcl | 4 ++-- site_ansto/instrument/config/environment/sct_knauer_pump.tcl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index 6aa7809f..c16a6a23 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -3,7 +3,7 @@ # namespace eval ::scobj::he3_polanal { - set debug_threshold 0 + set debug_threshold 5 # preamble hook code starts proc do_update { node dlist idx } { if {[llength ${dlist}] > ${idx}} { @@ -595,7 +595,7 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio } hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true - hsetprop ${scobj_hpath} debug_threshold 0 + hsetprop ${scobj_hpath} debug_threshold 5 # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} diff --git a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl index 47d7d8a5..96debf7b 100644 --- a/site_ansto/instrument/config/environment/sct_knauer_pump.tcl +++ b/site_ansto/instrument/config/environment/sct_knauer_pump.tcl @@ -3,7 +3,7 @@ # namespace eval ::scobj::knauer_pump { - set debug_threshold 0 + set debug_threshold 5 } proc ::scobj::knauer_pump::debug_log {tc_root debug_level debug_string} { @@ -1176,7 +1176,7 @@ proc ::scobj::knauer_pump::mkDriver { sct_controller name device_class simulatio ansto_makesctdrive ${name}_pump_volume_setp ${scobj_hpath}/pump/volume/setp ${scobj_hpath}/pump/volume/pval ${sct_controller} hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true - hsetprop ${scobj_hpath} debug_threshold 0 + hsetprop ${scobj_hpath} debug_threshold 5 # mkDriver hook code starts #hset ${scobj_hpath}/pump/remote 1 # mkDriver hook code ends From 89b23eda07c2985c4fb52d1381496723ae1145a6 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:54:25 +1100 Subject: [PATCH 06/11] Make the Lakeshore 218 driver less noisy and have less channels --- .../environment/temperature/lakeshore_218.sct | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/lakeshore_218.sct b/site_ansto/instrument/config/environment/temperature/lakeshore_218.sct index 64a87296..d16b9647 100644 --- a/site_ansto/instrument/config/environment/temperature/lakeshore_218.sct +++ b/site_ansto/instrument/config/environment/temperature/lakeshore_218.sct @@ -1,6 +1,11 @@ +# +# Template driver for the Lakeshore 218 Temperature Monitor +# vim: ft=tcl ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent +# driver lakeshore_218 = { vendor = lakeshore; device = ls218; protocol = std; class = NXdetector; simulation_group = detector_simulation; + make_args = '{num_chans 8}'; group = { data = false; @@ -11,28 +16,34 @@ driver lakeshore_218 = { var krdg = { type = text; read_command = "KRDG? 0"; - value = "0,0,0,0,0,0,0,0"; + read_function = read_krdg; + value = '"Hidden in real_data property"'; + property real_data = '0,0,0,0,0,0,0,0'; } } group sensor = { priv = user; mutable = true; type = float; - readable = 1; + readable = 15; fetch_function = getTemp; - var ch1 = { read_command = '0'; } - var ch2 = { read_command = '1'; } - var ch3 = { read_command = '2'; } - var ch4 = { read_command = '3'; } - var ch5 = { read_command = '4'; } - var ch6 = { read_command = '5'; } - var ch7 = { read_command = '6'; } - var ch8 = { read_command = '7'; } + var ch1 = { read_command = '0'; conditional = '${num_chans} > 0'; } + var ch2 = { read_command = '1'; conditional = '${num_chans} > 1'; } + var ch3 = { read_command = '2'; conditional = '${num_chans} > 2'; } + var ch4 = { read_command = '3'; conditional = '${num_chans} > 3'; } + var ch5 = { read_command = '4'; conditional = '${num_chans} > 4'; } + var ch6 = { read_command = '5'; conditional = '${num_chans} > 5'; } + var ch7 = { read_command = '6'; conditional = '${num_chans} > 6'; } + var ch8 = { read_command = '7'; conditional = '${num_chans} > 7'; } } code fetch_function getTemp = {%% - set temps [split "[hval ${tc_root}/krdg]" ","] + set temps [split "[hgetpropval ${tc_root}/krdg real_data]" ","] sct result [lindex ${temps} ${cmd_str}] set cmd "@@NOSEND@@" %%} + code read_krdg = {%% + sct real_data "${data}" + set data "Hidden in real_data property" + %%} } From 225c4c5ee7cef0a9118120a8f86549f5df39e741 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 13 Nov 2014 14:54:36 +1100 Subject: [PATCH 07/11] Regenerate SCT drivers --- .../temperature/sct_lakeshore_218.tcl | 379 +++++++++++------- 1 file changed, 224 insertions(+), 155 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl index ad9cfe8e..2b13d4cb 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_218.tcl @@ -65,7 +65,7 @@ proc ::scobj::lakeshore_218::getTemp {tc_root nextState cmd_str} { } set cmd "${cmd_str}" # getTemp hook code starts - set temps [split "[hval ${tc_root}/krdg]" ","] + set temps [split "[hgetpropval ${tc_root}/krdg real_data]" ","] sct result [lindex ${temps} ${cmd_str}] set cmd "@@NOSEND@@" # getTemp hook code ends @@ -136,6 +136,39 @@ proc ::scobj::lakeshore_218::rdValue {tc_root} { handle_exception ${catch_status} ${catch_message} } +# function to parse the read of a parameter on a device +proc ::scobj::lakeshore_218::read_krdg {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "read_krdg tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# read_krdg hook code starts + sct real_data "${data}" + set data "Hidden in real_data property" +# read_krdg hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + # function to write a parameter value on a device proc ::scobj::lakeshore_218::setValue {tc_root nextState cmd_str} { set catch_status [ catch { @@ -160,8 +193,8 @@ proc ::scobj::lakeshore_218::setValue {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } { - ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" +proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port {num_chans 8} } { + ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" set ns "[namespace current]" set catch_status [ catch { @@ -173,14 +206,15 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/krdg plain user text - hsetprop ${scobj_hpath}/krdg read ${ns}::getValue ${scobj_hpath} rdValue {KRDG? 0} - hsetprop ${scobj_hpath}/krdg rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/krdg read ${ns}::getValue ${scobj_hpath} read_krdg {KRDG? 0} + hsetprop ${scobj_hpath}/krdg read_krdg ${ns}::read_krdg ${scobj_hpath} hsetprop ${scobj_hpath}/krdg control false hsetprop ${scobj_hpath}/krdg data false hsetprop ${scobj_hpath}/krdg mutable true hsetprop ${scobj_hpath}/krdg nxsave false - hsetprop ${scobj_hpath}/krdg oldval 0,0,0,0,0,0,0,0 - hset ${scobj_hpath}/krdg 0,0,0,0,0,0,0,0 + hsetprop ${scobj_hpath}/krdg oldval "Hidden in real_data property" + hset ${scobj_hpath}/krdg "Hidden in real_data property" + hsetprop ${scobj_hpath}/krdg real_data "0,0,0,0,0,0,0,0" hsetprop ${scobj_hpath}/krdg sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/krdg type "part" hsetprop ${scobj_hpath}/krdg nxalias "${name}_krdg" @@ -199,172 +233,188 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat hfactory ${scobj_hpath}/sensor plain spy none - hfactory ${scobj_hpath}/sensor/ch1 plain user float - hsetprop ${scobj_hpath}/sensor/ch1 read ${ns}::getTemp ${scobj_hpath} rdValue {0} - hsetprop ${scobj_hpath}/sensor/ch1 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch1 control true - hsetprop ${scobj_hpath}/sensor/ch1 data true - hsetprop ${scobj_hpath}/sensor/ch1 mutable true - hsetprop ${scobj_hpath}/sensor/ch1 nxsave true - hsetprop ${scobj_hpath}/sensor/ch1 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch1 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch1 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch1 type "part" - hsetprop ${scobj_hpath}/sensor/ch1 nxalias "${name}_sensor_ch1" + if {${num_chans} > 0} { + hfactory ${scobj_hpath}/sensor/ch1 plain user float + hsetprop ${scobj_hpath}/sensor/ch1 read ${ns}::getTemp ${scobj_hpath} rdValue {0} + hsetprop ${scobj_hpath}/sensor/ch1 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch1 control true + hsetprop ${scobj_hpath}/sensor/ch1 data true + hsetprop ${scobj_hpath}/sensor/ch1 mutable true + hsetprop ${scobj_hpath}/sensor/ch1 nxsave true + hsetprop ${scobj_hpath}/sensor/ch1 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch1 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch1 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch1 type "part" + hsetprop ${scobj_hpath}/sensor/ch1 nxalias "${name}_sensor_ch1" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch1 1 - hsetprop ${scobj_hpath}/sensor/ch1 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch1 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch1 15 + hsetprop ${scobj_hpath}/sensor/ch1 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch1 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch2 plain user float - hsetprop ${scobj_hpath}/sensor/ch2 read ${ns}::getTemp ${scobj_hpath} rdValue {1} - hsetprop ${scobj_hpath}/sensor/ch2 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch2 control true - hsetprop ${scobj_hpath}/sensor/ch2 data true - hsetprop ${scobj_hpath}/sensor/ch2 mutable true - hsetprop ${scobj_hpath}/sensor/ch2 nxsave true - hsetprop ${scobj_hpath}/sensor/ch2 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch2 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch2 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch2 type "part" - hsetprop ${scobj_hpath}/sensor/ch2 nxalias "${name}_sensor_ch2" + if {${num_chans} > 1} { + hfactory ${scobj_hpath}/sensor/ch2 plain user float + hsetprop ${scobj_hpath}/sensor/ch2 read ${ns}::getTemp ${scobj_hpath} rdValue {1} + hsetprop ${scobj_hpath}/sensor/ch2 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch2 control true + hsetprop ${scobj_hpath}/sensor/ch2 data true + hsetprop ${scobj_hpath}/sensor/ch2 mutable true + hsetprop ${scobj_hpath}/sensor/ch2 nxsave true + hsetprop ${scobj_hpath}/sensor/ch2 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch2 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch2 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch2 type "part" + hsetprop ${scobj_hpath}/sensor/ch2 nxalias "${name}_sensor_ch2" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch2 1 - hsetprop ${scobj_hpath}/sensor/ch2 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch2 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch2 15 + hsetprop ${scobj_hpath}/sensor/ch2 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch2 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch3 plain user float - hsetprop ${scobj_hpath}/sensor/ch3 read ${ns}::getTemp ${scobj_hpath} rdValue {2} - hsetprop ${scobj_hpath}/sensor/ch3 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch3 control true - hsetprop ${scobj_hpath}/sensor/ch3 data true - hsetprop ${scobj_hpath}/sensor/ch3 mutable true - hsetprop ${scobj_hpath}/sensor/ch3 nxsave true - hsetprop ${scobj_hpath}/sensor/ch3 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch3 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch3 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch3 type "part" - hsetprop ${scobj_hpath}/sensor/ch3 nxalias "${name}_sensor_ch3" + if {${num_chans} > 2} { + hfactory ${scobj_hpath}/sensor/ch3 plain user float + hsetprop ${scobj_hpath}/sensor/ch3 read ${ns}::getTemp ${scobj_hpath} rdValue {2} + hsetprop ${scobj_hpath}/sensor/ch3 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch3 control true + hsetprop ${scobj_hpath}/sensor/ch3 data true + hsetprop ${scobj_hpath}/sensor/ch3 mutable true + hsetprop ${scobj_hpath}/sensor/ch3 nxsave true + hsetprop ${scobj_hpath}/sensor/ch3 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch3 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch3 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch3 type "part" + hsetprop ${scobj_hpath}/sensor/ch3 nxalias "${name}_sensor_ch3" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch3 1 - hsetprop ${scobj_hpath}/sensor/ch3 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch3 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch3 15 + hsetprop ${scobj_hpath}/sensor/ch3 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch3 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch4 plain user float - hsetprop ${scobj_hpath}/sensor/ch4 read ${ns}::getTemp ${scobj_hpath} rdValue {3} - hsetprop ${scobj_hpath}/sensor/ch4 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch4 control true - hsetprop ${scobj_hpath}/sensor/ch4 data true - hsetprop ${scobj_hpath}/sensor/ch4 mutable true - hsetprop ${scobj_hpath}/sensor/ch4 nxsave true - hsetprop ${scobj_hpath}/sensor/ch4 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch4 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch4 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch4 type "part" - hsetprop ${scobj_hpath}/sensor/ch4 nxalias "${name}_sensor_ch4" + if {${num_chans} > 3} { + hfactory ${scobj_hpath}/sensor/ch4 plain user float + hsetprop ${scobj_hpath}/sensor/ch4 read ${ns}::getTemp ${scobj_hpath} rdValue {3} + hsetprop ${scobj_hpath}/sensor/ch4 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch4 control true + hsetprop ${scobj_hpath}/sensor/ch4 data true + hsetprop ${scobj_hpath}/sensor/ch4 mutable true + hsetprop ${scobj_hpath}/sensor/ch4 nxsave true + hsetprop ${scobj_hpath}/sensor/ch4 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch4 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch4 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch4 type "part" + hsetprop ${scobj_hpath}/sensor/ch4 nxalias "${name}_sensor_ch4" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch4 1 - hsetprop ${scobj_hpath}/sensor/ch4 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch4 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch4 15 + hsetprop ${scobj_hpath}/sensor/ch4 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch4 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch5 plain user float - hsetprop ${scobj_hpath}/sensor/ch5 read ${ns}::getTemp ${scobj_hpath} rdValue {4} - hsetprop ${scobj_hpath}/sensor/ch5 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch5 control true - hsetprop ${scobj_hpath}/sensor/ch5 data true - hsetprop ${scobj_hpath}/sensor/ch5 mutable true - hsetprop ${scobj_hpath}/sensor/ch5 nxsave true - hsetprop ${scobj_hpath}/sensor/ch5 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch5 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch5 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch5 type "part" - hsetprop ${scobj_hpath}/sensor/ch5 nxalias "${name}_sensor_ch5" + if {${num_chans} > 4} { + hfactory ${scobj_hpath}/sensor/ch5 plain user float + hsetprop ${scobj_hpath}/sensor/ch5 read ${ns}::getTemp ${scobj_hpath} rdValue {4} + hsetprop ${scobj_hpath}/sensor/ch5 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch5 control true + hsetprop ${scobj_hpath}/sensor/ch5 data true + hsetprop ${scobj_hpath}/sensor/ch5 mutable true + hsetprop ${scobj_hpath}/sensor/ch5 nxsave true + hsetprop ${scobj_hpath}/sensor/ch5 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch5 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch5 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch5 type "part" + hsetprop ${scobj_hpath}/sensor/ch5 nxalias "${name}_sensor_ch5" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch5 1 - hsetprop ${scobj_hpath}/sensor/ch5 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch5 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch5 15 + hsetprop ${scobj_hpath}/sensor/ch5 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch5 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch6 plain user float - hsetprop ${scobj_hpath}/sensor/ch6 read ${ns}::getTemp ${scobj_hpath} rdValue {5} - hsetprop ${scobj_hpath}/sensor/ch6 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch6 control true - hsetprop ${scobj_hpath}/sensor/ch6 data true - hsetprop ${scobj_hpath}/sensor/ch6 mutable true - hsetprop ${scobj_hpath}/sensor/ch6 nxsave true - hsetprop ${scobj_hpath}/sensor/ch6 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch6 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch6 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch6 type "part" - hsetprop ${scobj_hpath}/sensor/ch6 nxalias "${name}_sensor_ch6" + if {${num_chans} > 5} { + hfactory ${scobj_hpath}/sensor/ch6 plain user float + hsetprop ${scobj_hpath}/sensor/ch6 read ${ns}::getTemp ${scobj_hpath} rdValue {5} + hsetprop ${scobj_hpath}/sensor/ch6 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch6 control true + hsetprop ${scobj_hpath}/sensor/ch6 data true + hsetprop ${scobj_hpath}/sensor/ch6 mutable true + hsetprop ${scobj_hpath}/sensor/ch6 nxsave true + hsetprop ${scobj_hpath}/sensor/ch6 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch6 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch6 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch6 type "part" + hsetprop ${scobj_hpath}/sensor/ch6 nxalias "${name}_sensor_ch6" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch6 1 - hsetprop ${scobj_hpath}/sensor/ch6 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch6 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch6 15 + hsetprop ${scobj_hpath}/sensor/ch6 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch6 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch7 plain user float - hsetprop ${scobj_hpath}/sensor/ch7 read ${ns}::getTemp ${scobj_hpath} rdValue {6} - hsetprop ${scobj_hpath}/sensor/ch7 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch7 control true - hsetprop ${scobj_hpath}/sensor/ch7 data true - hsetprop ${scobj_hpath}/sensor/ch7 mutable true - hsetprop ${scobj_hpath}/sensor/ch7 nxsave true - hsetprop ${scobj_hpath}/sensor/ch7 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch7 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch7 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch7 type "part" - hsetprop ${scobj_hpath}/sensor/ch7 nxalias "${name}_sensor_ch7" + if {${num_chans} > 6} { + hfactory ${scobj_hpath}/sensor/ch7 plain user float + hsetprop ${scobj_hpath}/sensor/ch7 read ${ns}::getTemp ${scobj_hpath} rdValue {6} + hsetprop ${scobj_hpath}/sensor/ch7 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch7 control true + hsetprop ${scobj_hpath}/sensor/ch7 data true + hsetprop ${scobj_hpath}/sensor/ch7 mutable true + hsetprop ${scobj_hpath}/sensor/ch7 nxsave true + hsetprop ${scobj_hpath}/sensor/ch7 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch7 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch7 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch7 type "part" + hsetprop ${scobj_hpath}/sensor/ch7 nxalias "${name}_sensor_ch7" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch7 1 - hsetprop ${scobj_hpath}/sensor/ch7 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch7 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch7 15 + hsetprop ${scobj_hpath}/sensor/ch7 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch7 simulated true + } } - hfactory ${scobj_hpath}/sensor/ch8 plain user float - hsetprop ${scobj_hpath}/sensor/ch8 read ${ns}::getTemp ${scobj_hpath} rdValue {7} - hsetprop ${scobj_hpath}/sensor/ch8 rdValue ${ns}::rdValue ${scobj_hpath} - hsetprop ${scobj_hpath}/sensor/ch8 control true - hsetprop ${scobj_hpath}/sensor/ch8 data true - hsetprop ${scobj_hpath}/sensor/ch8 mutable true - hsetprop ${scobj_hpath}/sensor/ch8 nxsave true - hsetprop ${scobj_hpath}/sensor/ch8 oldval 0.0 - hsetprop ${scobj_hpath}/sensor/ch8 klass "parameter" - hsetprop ${scobj_hpath}/sensor/ch8 sdsinfo "::nexus::scobj::sdsinfo" - hsetprop ${scobj_hpath}/sensor/ch8 type "part" - hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8" + if {${num_chans} > 7} { + hfactory ${scobj_hpath}/sensor/ch8 plain user float + hsetprop ${scobj_hpath}/sensor/ch8 read ${ns}::getTemp ${scobj_hpath} rdValue {7} + hsetprop ${scobj_hpath}/sensor/ch8 rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/sensor/ch8 control true + hsetprop ${scobj_hpath}/sensor/ch8 data true + hsetprop ${scobj_hpath}/sensor/ch8 mutable true + hsetprop ${scobj_hpath}/sensor/ch8 nxsave true + hsetprop ${scobj_hpath}/sensor/ch8 oldval 0.0 + hsetprop ${scobj_hpath}/sensor/ch8 klass "parameter" + hsetprop ${scobj_hpath}/sensor/ch8 sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/sensor/ch8 type "part" + hsetprop ${scobj_hpath}/sensor/ch8 nxalias "${name}_sensor_ch8" - if {[string equal -nocase "${simulation_flag}" "false"]} { - ${sct_controller} poll ${scobj_hpath}/sensor/ch8 1 - hsetprop ${scobj_hpath}/sensor/ch8 simulated false - } else { - ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" - hsetprop ${scobj_hpath}/sensor/ch8 simulated true + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/sensor/ch8 15 + hsetprop ${scobj_hpath}/sensor/ch8 simulated false + } else { + ::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218" + hsetprop ${scobj_hpath}/sensor/ch8 simulated true + } } hsetprop ${scobj_hpath}/sensor data "true" hsetprop ${scobj_hpath}/sensor klass "@none" @@ -379,7 +429,7 @@ proc ::scobj::lakeshore_218::mkDriver { sct_controller name device_class simulat proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_address tcp_port} { set catch_status [ catch { - ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" + ::scobj::lakeshore_218::sics_log 9 "::scobj::lakeshore_218::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" @@ -393,8 +443,8 @@ proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_ad ::scobj::lakeshore_218::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" makesctcontroller sct_${name} aqadapter NULL } - ::scobj::lakeshore_218::sics_log 1 "::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" - ::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} + ::scobj::lakeshore_218::sics_log 1 "::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans}" + ::scobj::lakeshore_218::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${num_chans} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -485,7 +535,26 @@ proc ::scobj::lakeshore_218::read_config {} { } makesctcontroller sct_${name} aqadapter ${asyncqueue} } - ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list num_chans 8] + foreach arg {num_chans} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list } } } From c838e4ffe27c26e52cd34718bd0da495eaa564d8 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 20 Nov 2014 12:49:43 +1100 Subject: [PATCH 08/11] Pretty-up the spacing around the conditional code in gen_sct.py --- site_ansto/instrument/util/gen_sct.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 229cf991..3bc03b8d 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1586,7 +1586,10 @@ def put_group(MyDriver, MyGroup): for idx, line in enumerate(txt): if len(line) > 0: txt[idx] = ' ' + line + if len(txt[0]) == 0: + txt.pop(0) txt.insert(0, ' if {%s} {' % MyGroup['conditional']) + txt.insert(0, '') txt.append(' }') return txt From 01c0bf1f3c899ac3c950944abc980fcc7b396f57 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 20 Nov 2014 14:44:43 +1100 Subject: [PATCH 09/11] Add a new (configurable) fake Oxford Mercury --- .../TEST_SICS/fakeMercury/SIM_MERCURY.py | 322 ++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100755 site_ansto/instrument/TEST_SICS/fakeMercury/SIM_MERCURY.py diff --git a/site_ansto/instrument/TEST_SICS/fakeMercury/SIM_MERCURY.py b/site_ansto/instrument/TEST_SICS/fakeMercury/SIM_MERCURY.py new file mode 100755 index 00000000..f35afbf5 --- /dev/null +++ b/site_ansto/instrument/TEST_SICS/fakeMercury/SIM_MERCURY.py @@ -0,0 +1,322 @@ +#!/usr/bin/python +# vim: ft=python ts=8 sts=4 sw=4 et autoindent smartindent nocindent +# author: Douglas Clowes (douglas.clowes@ansto.gov.au) 2014 +# +from twisted.internet import reactor, protocol +from twisted.protocols.basic import LineReceiver +from twisted.python import log +from twisted.internet.task import LoopingCall + +import os +import sys +import curses +sys.path.insert(0, os.path.realpath(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../../util")))) +from displayscreen import Screen + +import argparse + +devices = [] + +class Card(object): + def __init__(self): + self.uid = None + self.type = "NONE" + self.nick = "None" + def iterate(self): + pass + def doRead(self, parts): + return self.write("STAT:DEV:N/A") + def doWrite(self, parts): + return self.write("STAT:DEV:N/A") + def write(self, data): + return data + +class Heater(Card): + def __init__(self): + super(Heater, self).__init__() + self.type = "HTR" + self.nick = "Heater" + self.power = 50 + + def doRead(self, parts): + if len(parts)>5 and parts[3] == "HTR" and parts[4] == "SIG" and parts[5] == "POWR": + return self.write("STAT:DEV:"+self.uid+":HTR:SIG:POWR:%.4fW" % self.power) + return self.write("STAT:DEV:"+self.uid+":HTR:INVALID") + +class Level(Card): + def __init__(self): + super(Level, self).__init__() + self.type = "LVL" + self.nick = "Level" + self.hlev = 50 + self.nlev = 60 + + def doRead(self, parts): + if len(parts)>4 and parts[3] == "LVL" and parts[4] == "NICK": + return self.write("STAT:DEV:"+self.uid+":LVL:NICK:%s" % self.nick) + if len(parts)>6 and parts[3] == "LVL" and parts[4] == "SIG" and parts[5] == "HEL" and parts[6] == "LEV": + return self.write("STAT:DEV:"+self.uid+":LVL:SIG:HEL:LEV:%7.4f%%" % self.hlev) + if len(parts)>6 and parts[3] == "LVL" and parts[4] == "SIG" and parts[5] == "NIT" and parts[6] == "LEV": + return self.write("STAT:DEV:"+self.uid+":LVL:SIG:NIT:LEV:%7.4f%%" % self.nlev) + return self.write("STAT:DEV:"+self.uid+":LVL:INVALID") + +class Valve(Card): + def __init__(self): + super(Valve, self).__init__() + self.type = "AUX" + self.nick = "Valve" + self.valve_open = 50 + + def doRead(self, parts): + if len(parts)>4 and parts[3] == "AUX" and parts[4] == "NICK": + return self.write("STAT:DEV:"+self.uid+":AUX:NICK:%s" % self.nick) + if len(parts)>5 and parts[3] == "AUX" and parts[4] == "SIG" and parts[5] == "OPEN": + return self.write("STAT:DEV:"+self.uid+":AUX:SIG:OPEN:%7.4f%%" % self.valve_open) + return self.write("STAT:DEV:"+self.uid+":AUX:INVALID") + +class Temperature(Card): + def __init__(self): + super(Temperature, self).__init__() + self.type = "TEMP" + self.nick = "Temp" + self.sp = 280 + self.pv = 280 + + def iterate(self): + if abs(self.sp - self.pv) > 0.1: + self.pv += 0.1 * (self.sp - self.pv) + else: + self.pv = self.sp + + def doRead(self, parts): + if len(parts)>4 and parts[3] == "TEMP" and parts[4] == "NICK": + return self.write("STAT:DEV:"+self.uid+":TEMP:NICK:%s" % self.nick) + if len(parts)>5 and parts[3] == "TEMP" and parts[4] == "LOOP" and parts[5] == "TSET": + return self.write("STAT:DEV:"+self.uid+":TEMP:SIG:LOOP:TSET:%g" % self.sp) + if len(parts)>5 and parts[3] == "TEMP" and parts[4] == "SIG" and parts[5] == "TEMP": + return self.write("STAT:DEV:"+self.uid+":TEMP:SIG:TEMP:%7.4fK" % self.pv) + return self.write("STAT:DEV:"+self.uid+":LVL:INVALID") + + def doWrite(self, parts): + if len(parts)>6 and parts[3] == "TEMP" and parts[4] == "LOOP" and parts[5] == "TSET": + self.sp = parts[6] + return self.write("STAT:DEV:"+self.uid+":TEMP:SIG:LOOP:TSET:VALID") + return self.write("STAT:DEV:"+self.uid+":TEMP:INVALID") + +class Pressure(Card): + def __init__(self): + super(Pressure, self).__init__() + self.type = "PRES" + self.nick = "Pres" + self.sp = 280 + self.pv = 280 + + def iterate(self): + if abs(self.sp - self.pv) > 0.1: + self.pv += 0.1 * (self.sp - self.pv) + else: + self.pv = self.sp + + def doRead(self, parts): + if len(parts)>4 and parts[3] == "PRES" and parts[4] == "NICK": + return self.write("STAT:DEV:"+self.uid+":PRES:NICK:%s" % self.nick) + if len(parts)>5 and parts[3] == "PRES" and parts[4] == "LOOP" and parts[5] == "TSET": + return self.write("STAT:DEV:"+self.uid+":PRES:SIG:LOOP:TSET:%g" % self.sp) + if len(parts)>5 and parts[3] == "PRES" and parts[4] == "SIG" and parts[5] == "PRES": + return self.write("STAT:DEV:"+self.uid+":PRES:SIG:PRES:%7.4f" % self.pv) + return self.write("STAT:DEV:"+self.uid+":PRES:INVALID") + + def doWrite(self, parts): + if len(parts)>6 and parts[3] == "PRES" and parts[4] == "LOOP" and parts[5] == "TSET": + self.sp = parts[6] + return self.write("STAT:DEV:"+self.uid+":PRES:SIG:LOOP:TSET:VALID") + return self.write("STAT:DEV:"+self.uid+":PRES:INVALID") + +class Mercury(LineReceiver): + def __init__(self): + self.delimiter = '\r\n' + self.setRawMode() + self.line = "" + self.config = args.config + self.cards = [] + self.mb0 = Heater() + self.mb0.uid = 'MB0.H1' + self.mb0.nick = 'Mobo0.Heater' + self.mb1 = Temperature() + self.mb1.uid = 'MB1.T1' + self.mb1.nick = 'Mobo1.Temp' + for char in self.config: + if char.upper() == 'N': + self.cards.append(Card()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "N") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "None") + if char.upper() == 'H': + self.cards.append(Heater()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "H") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "Heater") + if char.upper() == 'L': + self.cards.append(Level()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "L") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "Level") + if char.upper() == 'V': + self.cards.append(Valve()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "G") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "Valve") + if char.upper() == 'P': + self.cards.append(Pressure()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "P") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "Pres") + if char.upper() == 'T': + self.cards.append(Temperature()) + self.cards[-1].uid = "DB%d.%s1" % (len(self.cards), "T") + self.cards[-1].nick = "Slot%d.%s" % (len(self.cards), "Temp") + for idx, card in enumerate([self.mb0, self.mb1] + self.cards): + print idx, card.type, card.uid, card.nick + + def iterate(self): + self.mb0.iterate() + self.mb1.iterate() + for card in self.cards: + card.iterate + + def write(self, data): + sent = data + print "transmitted:", repr(sent) + self.transport.write(sent) + self.transport.write(self.delimiter) + + def read_sys_cat(self): + result = "STAT:SYS:CAT" + result += ":DEV:" + self.mb1.uid + ":" + self.mb1.type + for card in self.cards: + result += ":DEV:" + card.uid + ":" + card.type + result += ":DEV:" + self.mb0.uid + ":" + self.mb0.type + return result + + def doRead(self, parts): + if parts[1] == "SYS": + if parts[2] == "CAT": + return self.read_sys_cat() + elif parts[1] == "DEV": + for card in [self.mb0, self.mb1] + self.cards: + if card.uid == parts[2]: + return card.doRead(parts) + print "doRead card not found:", parts + return "STAT:DEV:"+parts[2]+":N/A" + else: + print "doRead ERROR:", parts + + def doWrite(self, parts): + if parts[1] == "SYS": + pass + elif parts[1] == "DEV": + for card in [self.mb0, self.mb1] + self.cards: + if card.uid == parts[2]: + return card.doWrite(parts) + print "doWrite card not found:", parts + return "STAT:DEV:"+parts[2]+":N/A" + else: + print "doWrite ERROR:", parts + + def lineReceived(self, data): + print "lineReceived:", data + if data == "*IDN?": + return self.write("IDN:OXFORD INSTRUMENTS:MERCURY ITC:65:2.0.0") + + parts = data.split(":") + if parts[0] == "READ": + return self.write(self.doRead(parts)) + elif parts[0] == "SET": + return self.write(self.doWrite(parts)) + print "ERROR:", data + + def rawDataReceived(self, data): + for char in data: + self.line += char + if self.line.endswith(self.delimiter): + self.line = self.line[:-len(self.delimiter)] + self.lineReceived(self.line) + self.line = "" + +class MyScreen(Screen): + def __init__(self, stdscr): + Screen.__init__(self, stdscr) + + def sendLine(self, txt): + global devices + + def write(self, txt): + try: + newLine = self.lines[-1] + " => " + txt + del self.lines[-1] + self.addLine(newLine) + except: + pass + + def connectionMade(self): + print "connectionMade" + devices.append(self) + + def connectionLost(self, reason): + print "connectionLost" + devices.remove(self) + +def device_iterator(): + global devices + for dev in devices: + dev.iterate() + +def display_iterator(): + global screen, devices + + try: + rows, cols = screen.stdscr.getmaxyx() + screen.stdscr.clear() + col = 0 + except: + raise + finally: + try: + screen.stdscr.refresh() + except: + pass + +def main(): + global args + parser = argparse.ArgumentParser(description="Fake Mercury ITC") + parser.add_argument('instrument', help='The instrument name', nargs='*') + parser.add_argument('-c', '--config',\ + help='wconfiguration string [HHHVLTTP]',\ + type=str, default="HHHVLTTP") + parser.add_argument('-p', '--port',\ + help='Port on which to listen',\ + type=int, default=7020) + parser.add_argument('-v', '--verbose',\ + help='Print lots of stuff',\ + action='store_true', default=False) + parser.add_argument('-w', '--window',\ + help='Create a display window',\ + action='store_true', default=False) + args = parser.parse_args() + log.startLogging(open(("/tmp/Fake_Mercury_%04d.log" % args.port), "w")) + if args.verbose: + print "Args:", args + Verbose = True + + if (args.window): + stdscr = curses.initscr() + screen = MyScreen(stdscr) + reactor.addReader(screen) + disp_iter = LoopingCall(display_iterator) + disp_iter.start(0.5) + + dev_iter = LoopingCall(device_iterator) + dev_iter.start(1.0) + factory = protocol.ServerFactory() + factory.protocol = Mercury + reactor.listenTCP(args.port, factory) + reactor.run() + + +if __name__ == "__main__": + main() From a7e6017fd5c24238e62c63254b74e04b1e933384 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 20 Nov 2014 14:46:24 +1100 Subject: [PATCH 10/11] New driver for the Oxford Mercury (using conditional and exec) --- .../temperature/oxford_mercury.sct | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 site_ansto/instrument/config/environment/temperature/oxford_mercury.sct diff --git a/site_ansto/instrument/config/environment/temperature/oxford_mercury.sct b/site_ansto/instrument/config/environment/temperature/oxford_mercury.sct new file mode 100644 index 00000000..5fed0357 --- /dev/null +++ b/site_ansto/instrument/config/environment/temperature/oxford_mercury.sct @@ -0,0 +1,162 @@ +# +# Oxford Mercury with all devices as conditional groups +# vim: ft=tcl ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent +# +# Douglas Clowes (Douglas.Clowes@ansto.gov.au) November 2014 +# +driver oxford_mercury = { + vendor = oxford; + device = mercury; + protocol = std; + class = environment; + simulation_group = environment_simulation; + # cards is the cards in the mercury slots 12345678 + # H=Heater(1-3), V=Valve(4), L=Level(5), T=Temp(1-8), P=Pres(5,8), N=None(1-8) + # assoc is the associated actuator (H,V) for the controller (T,P) in the slot + add_args = 'id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}'; + make_args = 'id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}'; + group = { + group_property 'cards' = '${cards}'; + group_property 'assoc' = '${assoc}'; + + group Temp0 = { + # Always the motherboard, always there + priv = user; type = float; readable = 5; + var sensor = { readable = 1; read_command = 'READ:DEV:MB1.T1:TEMP:SIG:TEMP'; permlink = 'T.S00'; } + var nick = { type=text; readable = 15; read_command = 'READ:DEV:MB1.T1:TEMP:NICK'; read_function = rdText; } + var power = { read_command = 'READ:DEV:MB0.H1:HTR:SIG:POWR'; } + var setpoint = { read_command = 'READ:DEV:MB1.T1:TEMP:LOOP:TSET'; + driveable = Temp0/sensor; lowerlimit = 0; upperlimit = 333; tolerance = '${ttol}'; property settle_time = 15; + writeable = 1; write_function = setPoint; write_command = 'SET:DEV:MB1.T1:TEMP:LOOP:TSET:'; + permlink = 'T.SP00'; + } + } + +%exec +exec_output = [] +for i in range(8): + exec_output += [""] + exec_output += [" group Temp%d = {" % (i+1)] + exec_output += [" conditional = '[string equal -nocase [string index ${cards} %d] T]';" % i] + exec_output += [" priv = user; type = float; readable = 5;"] + exec_output += [" var sensor = { readable = 1; read_command = 'READ:DEV:DB%d.T1:TEMP:SIG:TEMP'; permlink = 'T.S%02d'; }" % (i+1,i+1)] + exec_output += [" var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB%d.T1:TEMP:NICK'; read_function = rdText; }" % (i+1)] + if i > 4: + exec_output += [" var power = {"] + exec_output += [" conditional = '[string equal -nocase [string index ${cards} %d] H] && [string equal -nocase [string index ${assoc} %d] %d]';" % (i-5, i, i-4)] + exec_output += [" read_command = 'READ:DEV:DB%d.H1:HTR:SIG:POWR';" % (i - 4)] + exec_output += [" }"] + exec_output += [" var setpoint = {"] + exec_output += [" conditional = '[string equal -nocase [string index ${cards} %d] H] && [string equal -nocase [string index ${assoc} %d] %d]';" % (i-5, i, i-4)] + exec_output += [" read_command = 'READ:DEV:DB%d.T1:TEMP:LOOP:TSET';" % (i + 1)] + exec_output += [" driveable = Temp%d/sensor; lowerlimit = 0; upperlimit = 333; tolerance = '${ttol}'; property settle_time = 15;" % (i + 1)] + exec_output += [" writeable = 1; write_function = setPoint; write_command = 'SET:DEV:DB%d.T1:TEMP:LOOP:TSET:';" % (i + 1)] + exec_output += [" permlink = 'T.SP%02d';" % (i + 1)] + exec_output += [" }"] + exec_output += [" }"] +%end + + group Pres5 = { + conditional = '[string equal -nocase [string index ${cards} 4] P]'; + priv = user; type = float; readable = 5; + var sensor = { readable = 1; read_command = 'READ:DEV:DB5.P1:PRES:SIG:PRES'; permlink = 'P.PS05'; units = "mB"; } + var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB5.P1:PRES:NICK'; read_function = rdText; } + var valve = { + conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]'; + read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; + } + var setpoint = { + conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]'; + read_command = 'READ:DEV:DB5.P1:PRES:LOOP:TSET'; + driveable = Pres5/sensor; lowerlimit = 0; upperlimit = 333; tolerance = '${ptol}'; property settle_time = 15; + writeable = 1; write_function = setPoint; write_command = 'SET:DEV:DB8.P1:PRES:LOOP:TSET:'; + permlink = 'P.PSP05'; units = "mB"; + } + } + group Pres8 = { + conditional = '[string equal -nocase [string index ${cards} 7] P]'; + priv = user; type = float; readable = 5; + var sensor = { readable = 1; read_command = 'READ:DEV:DB8.P1:PRES:SIG:PRES'; permlink = 'P.PS08'; units = "mB"; } + var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB8.P1:PRES:NICK'; read_function = rdText; } + var valve = { + conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]'; + read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; + } + var setpoint = { + conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]'; + read_command = 'READ:DEV:DB8.P1:PRES:LOOP:TSET'; + driveable = Pres8/sensor; lowerlimit = 0; upperlimit = 333; tolerance = '${ptol}'; property settle_time = 15; + writeable = 1; write_function = setPoint; write_command = 'SET:DEV:DB8.P1:PRES:LOOP:TSET:'; + permlink = 'P.PSP08'; units = "mB"; + } + } + + group Valve = { + conditional = '[string equal -nocase [string index ${cards} 3] V]'; + priv = user; type = float; + var sensor = { + readable = 5; read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; + } + var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB4.G1:AUX:NICK'; read_function = rdText; } + var setpoint = { + driveable = Valve/sensor; lowerlimit = 0; upperlimit = 100; tolerance = '${vtol}'; property settle_time = 30; + writeable = 1; write_function = setValve; write_command = 'SET:DEV:DB4.G1:AUX:SIG:OPEN:'; + } + } + + group Level = { + conditional = '[string equal -nocase [string index ${cards} 4] L]'; + priv = user; type = float; readable = 15; + var Nitrogen = { read_command = 'READ:DEV:DB5.L1:LVL:SIG:NIT:LEV'; permlink = 'T.N2'; } + var Helium = { read_command = 'READ:DEV:DB5.L1:LVL:SIG:HEL:LEV'; permlink = 'T.He'; } + var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB5.L1:LVL:NICK'; read_function = rdText; } + } + +} + code read_function rdValue = { + @TCL + set value [lindex [split "${data}" ":"] end] + if {[string equal -nocase [string index ${value} end] K]} { + set value [string range ${value} 0 end-1] + } + if {[string equal -nocase ${value} NaN]} { + set value 0 + } + if {[string equal -nocase ${value} inf] || [string equal -nocase ${value} -inf]} { + set value 0 + } + if {![string is double ${value}]} { + set value 0 + } + scan ${value} "%g" data + @END + } + + code read_function rdText = { +@ scan [lindex [split "$data" ":"] end] "%s" data + } + + code Write_function setPoint = { + } + + code Write_function setValve = { + } + + code preamble = { + @TCL + proc make_config {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set result "" + set devs [regexp -inline -all {DEV:D[[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set typ [string index [lindex [split ${dev} :] end] 0] + set typ [string map {A V} ${typ}] + clientput "${dev} ${typ}" + set result "${result}${typ}" + } + clientput "Result: ${result}" + return ${result} + } + @END + } +} From 7269314220ae2388eb654ebcbcedf4c3105c40cc Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 20 Nov 2014 14:48:00 +1100 Subject: [PATCH 11/11] Regenerate SCT drivers (new spacing, new Oxford Mercury) --- .../config/beamline/sct_he3_polanal.tcl | 8 +- .../temperature/sct_oxford_mercury.tcl | 2442 +++++++++++------ 2 files changed, 1574 insertions(+), 876 deletions(-) diff --git a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl index c16a6a23..89211c28 100644 --- a/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl +++ b/site_ansto/instrument/config/beamline/sct_he3_polanal.tcl @@ -211,8 +211,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio sicslist setatt ${name} long_name ${name} set scobj_hpath /sics/${name} - if {[string equal -nocase ${has_anal} "true"]} { + if {[string equal -nocase ${has_anal} "true"]} { hfactory ${scobj_hpath}/analyser plain spy none hfactory ${scobj_hpath}/analyser/amplitude plain user float @@ -314,8 +314,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser klass "@none" hsetprop ${scobj_hpath}/analyser type "part" } - if {[string equal -nocase ${has_anal} "true"]} { + if {[string equal -nocase ${has_anal} "true"]} { hfactory ${scobj_hpath}/analyser_start plain spy none hfactory ${scobj_hpath}/analyser_start/amplitude plain user float @@ -402,8 +402,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/analyser_start klass "@none" hsetprop ${scobj_hpath}/analyser_start type "part" } - if {[string equal -nocase ${has_pol} "true"]} { + if {[string equal -nocase ${has_pol} "true"]} { hfactory ${scobj_hpath}/polariser plain spy none hfactory ${scobj_hpath}/polariser/amplitude plain user float @@ -505,8 +505,8 @@ proc ::scobj::he3_polanal::mkDriver { sct_controller name device_class simulatio hsetprop ${scobj_hpath}/polariser klass "@none" hsetprop ${scobj_hpath}/polariser type "part" } - if {[string equal -nocase ${has_pol} "true"]} { + if {[string equal -nocase ${has_pol} "true"]} { hfactory ${scobj_hpath}/polariser_start plain spy none hfactory ${scobj_hpath}/polariser_start/amplitude plain user float diff --git a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl index 22ebad6b..a693a605 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl @@ -1,891 +1,1589 @@ -# vim: ts=8 sw=2 sta sts=2 et ai si -# This is a template driver for a mercury temperaure controller from Oxford Instruments +# Generated driver for oxford_mercury +# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent # -# Author: Douglas Clowes -# Date: August 2012 -# -if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} { -# This block is to suppress spurious error/warning messages when loaded in Nagelfar - set catch_status [ catch { - puts "TCLSH" - proc environment_simulation {} { return "" } - proc SplitReply {str} { return "" } - proc makesctcontroller {args} { } - proc MakeSICSObj {args} { } - proc sicslist {args} { } - proc hfactory {args} { } - proc hdelprop {args} { } - proc hsetprop {args} { } - proc hgetprop {args} { } - proc hpropexists {args} { } - proc hlistprop {args} { } - proc hset {args} { } - proc hget {args} { } - proc hval {args} { } - proc hinfo {args} { } - proc hlist {args} { } - proc sct {args} { } - proc debug_log {args} { } - proc pathname {args} { } - proc basename {args} { } - proc channel {args} { } - proc ns {args} { } - } catch_message ] - if {$catch_status != 0} { - puts "error in main $catch_message" - return -code error "in main $catch_message" - } + +namespace eval ::scobj::oxford_mercury { + set debug_threshold 5 +# preamble hook code starts + proc make_config {sct_controller} { + set syscat [${sct_controller} transact READ:SYS:CAT] + set result "" + set devs [regexp -inline -all {DEV:D[[:alnum:]\.]*:[[:alnum:]]*} ${syscat}] + foreach dev [lsort ${devs}] { + set typ [string index [lindex [split ${dev} :] end] 0] + set typ [string map {A V} ${typ}] + clientput "${dev} ${typ}" + set result "${result}${typ}" + } + clientput "Result: ${result}" + return ${result} + } +# preamble hook code ends } -set vendor "oxford" -set device "mercury" - -namespace eval ::scobj::[set vendor]_[set device] { - proc ns {} { - return "[namespace current]" - } - # All of this takes place in a namespace based on the vendor and device - # Debug prints and vendor/device save - clientput "Namespace: [namespace current]" - clientput "Vendor:[set vendor]" - clientput "Device:[set device]" - set [namespace current]::vendor [set ::vendor] - set [namespace current]::device [set ::device] - set [namespace current]::ven_dev "[set ::vendor]_[set ::device]" - clientput "[namespace current]::vendor [set [namespace current]::vendor]" - clientput "[namespace current]::device [set [namespace current]::device]" - clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]" - - proc debug_log {debug_level arg_string} { - # write a timestamped string message to a log file for debugging - set debug_threshold 0 - if {$debug_level >= $debug_threshold} { - set fd [open "[set [namespace current]::log_file]" "a"] - set line "[clock format [clock seconds] -format "%T"] $arg_string" - puts $fd "$line" - close $fd +proc ::scobj::oxford_mercury::debug_log {tc_root debug_level debug_string} { + set catch_status [ catch { + set debug_threshold [hgetpropval ${tc_root} debug_threshold] + if {${debug_level} >= ${debug_threshold}} { + set now [clock seconds] + set ts [clock format ${now} -format "%Y%m%d"] + set log_file_name "../log/oxford_mercury_[basename ${tc_root}]_${ts}.log" + set fd [open "${log_file_name}" "a"] + set ts [clock format ${now} -format "%T"] + puts ${fd} "${ts} ${debug_string}" + close ${fd} } - } + } catch_message ] +} - proc channel {arg} { - # strip the trailing digits from the arg and return them as a string - set result 0 - for { set i 0 } { $i < [string length $arg] } { incr i } { - if { ! [string match {[0-9]} [string index $arg end-$i]] } { - break +proc ::scobj::oxford_mercury::sics_log {debug_level debug_string} { + set catch_status [ catch { + set debug_threshold ${::scobj::oxford_mercury::debug_threshold} + if {${debug_level} >= ${debug_threshold}} { + sicslog "::scobj::oxford_mercury::${debug_string}" + } + } catch_message ] +} + +# checklimits function for driveable interface +proc ::scobj::oxford_mercury::checklimits {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checklimits hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + sct driving 0 + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# check function for hset change +proc ::scobj::oxford_mercury::checkrange {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" + set setpoint [sct target] + if { [hpropexists [sct] lowerlimit] } { + set lolimit [sct lowerlimit] + } else { + # lowerlimit not set, use target + set lolimit [sct target] + } + if { [hpropexists [sct] upperlimit] } { + set hilimit [sct upperlimit] + } else { + # upperlimit not set, use target + set hilimit [sct target] + } +# checkrange hook code goes here + if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { + error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" + } + return OK + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# checkstatus function for driveable interface +proc ::scobj::oxford_mercury::checkstatus {tc_root} { + set catch_status [ catch { +# checkstatus hook code goes here + if {[sct driving]} { + set sp "[sct target]" + if {[hpropexists [sct] simulated] && [sct simulated] == "true"} { + set pv "${sp}" + hupdateif ${tc_root}/[sct driveable] ${sp} + } else { + set pv "[hval ${tc_root}/[sct driveable]]" } - set result [string range "$arg" end-$i end] + if { abs(${pv} - ${sp}) <= [sct tolerance] } { + if { [hpropexists [sct] settle_time] } { + if { [hpropexists [sct] settle_time_start] } { + if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} { + sct driving 0 + return "idle" + } + return "busy" + } else { + sct utime settle_time_start + return "busy" + } + } + sct driving 0 + return "idle" + } + if { [hpropexists [sct] settle_time_start] } { + hdelprop [sct] settle_time_start + } + return "busy" + } else { + return "idle" } - debug_log 1 "Extract channel $result from argument $arg" - return $result - } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} - proc setPoint {tc_root nextState cmd} { - # send a command to set a value - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] $cmd [sct target]" +# function to request the read of a parameter on a device +proc ::scobj::oxford_mercury::getValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set cmd "${cmd_str}" +# getValue hook code goes here + debug_log ${tc_root} 1 "getValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# halt function for driveable interface +proc ::scobj::oxford_mercury::halt {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]" + ### TODO hset [sct] [hval [sct]] +# halt hook code goes here + sct driving 0 + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to check the write parameter on a device +proc ::scobj::oxford_mercury::noResponse {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" +# noResponse hook code goes here + return "idle" + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdText {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdText tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdText hook code starts + scan [lindex [split "$data" ":"] end] "%s" data +# rdText hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to parse the read of a parameter on a device +proc ::scobj::oxford_mercury::rdValue {tc_root} { + set catch_status [ catch { + debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set data [sct result] + set nextState "idle" + if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { + # the protocol driver has reported an error + sct geterror "${data}" + error "[sct geterror]" + } +# rdValue hook code starts + set value [lindex [split "${data}" ":"] end] + if {[string equal -nocase [string index ${value} end] K]} { + set value [string range ${value} 0 end-1] + } + if {[string equal -nocase ${value} NaN]} { + set value 0 + } + if {[string equal -nocase ${value} inf] || [string equal -nocase ${value} -inf]} { + set value 0 + } + if {![string is double ${value}]} { + set value 0 + } + scan ${value} "%g" data +# rdValue hook code ends + if { [hpropexists [sct] geterror] } { + debug_log ${tc_root} 9 "[sct] error: [sct geterror]" + error "[sct geterror]" + } + if { ${data} != [sct oldval] } { + debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" + sct oldval ${data} + sct update ${data} + sct utime readtime + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setPoint {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setPoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] - set command "$cmd:$par" - - debug_log 1 "setPoint tc_root=$tc_root sct=[sct] Write $command" - sct send "$command" - sct driving 1 - sct time_check [clock seconds] - if {$par != [sct oldval]} { - sct oldval $par - sct update $par - sct utime readtime - debug_log 1 "setPoint: new data for $tc_root [sct] result=$par" - } - return $nextState - } - - proc chkWrite {tc_root} { - # process the response to the write - # - not all devices will respond to writes - set data [sct result] - debug_log 1 "chkWrite tc_root=$tc_root sct=[sct] resp=$data" - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - # the write was successful, record the data - set data [sct target] - if {$data != [sct oldval]} { - sct oldval $data - sct update $data - sct utime readtime - debug_log 1 "chkWrite new data for $tc_root [sct] result=$data" + set cmd "${cmd_str}${par}" +# setPoint hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 } } - return idle - } - - proc noResponse {tc_root} { - set data "[sct result]" - debug_log 1 "noResponse tc_root=$tc_root sct=[sct] resp=$data" - return idle - } - - proc getValue {tc_root nextState cmd} { - # send a command to request a value - debug_log 1 "getValue tc_root=$tc_root sct=[sct] $cmd" - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror + debug_log ${tc_root} 1 "setPoint sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" } - if { [string equal -nocase -length 4 "$cmd" "XXXX"] } { - set cmd "$cmd [channel [pathname [sct]]]" - } - debug_log 1 "getValue sct send $cmd" - sct send "$cmd" - return $nextState - } - - proc rdValue {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdValue tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%g" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdText {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc rdTextAll {tc_root} { - # process the received response to the read request - debug_log 1 "[ns]::rdText tc_root=$tc_root sct=[sct] result=[sct result]" - set data [sct result] - if {[string equal -nocase -length 7 $data "ASCERR:"]} { - # the protocol driver has reported an error - sct geterror "$data" - } elseif {[string equal -nocase -length 1 $data "?"]} { - # the device has reported an error - sct geterror "Error: $data" - } else { - if { [string equal -nocase [basename [sct]] "XXXX"] } { - return "idle" - } - #scan [lindex [split "$data" ":"] end] "%s" data - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - } - return "idle" - } - - proc getTemp {tc_root nextState cmd} { - debug_log 1 "getTemp tc_root=$tc_root sct=[sct] $cmd" - if { ! [hpropexists [sct] my_state] } { - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "CSET?" - } else { - set command "RDGK? [sct channel]" - } - debug_log 1 "getTemp sct send $command" - sct send "$command" - return "$nextState" - } - - proc rdTemp {tc_root} { - debug_log 1 "rdTemp tc_root=$tc_root sct=[sct] result=[sct result]" - if { [sct my_state] == 0 } { - set response "[split [sct result] ","]" - sct channel [lindex $response 0] - sct filter [lindex $response 1] - sct my_state 1 - return "read" - } else { - set data "[sct result]" - if {$data != [sct oldval]} { - debug_log 1 "[sct] changed to new:$data, from old:[sct oldval]" - sct oldval $data - sct update $data - sct utime readtime - } - sct my_state 0 - return "idle" - } - } - - proc gtLoop {tc_root nextState cmd} { - debug_log 1 "gtLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - debug_log 1 "gtLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "gtLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct my_state] == 0 } { - set command "RAMP?" - } else { - set command "SETP?" - } - debug_log 1 "gtLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - return idle - } - - proc rdLoop {tc_root} { - debug_log 1 "rdLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "rdLoop tc_root=$tc_root pathname=[pathname [sct]] basename=[basename [sct]]" - set nextState "read" - if { [sct my_state] == 0 } { - debug_log 1 "rdLoop sct=[sct] RAMP - result=[sct result]" - set nextState "read" - } else { - debug_log 1 "rdLoop sct=[sct] SETP - result=[sct result]" - set nextState "idle" - sct my_state -1 - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - proc wrLoop {tc_root nextState cmd} { - debug_log 1 "wrLoop tc_root=$tc_root sct=[sct] nextState=$nextState cmd=$cmd" - if { ! [hpropexists [sct] my_state] } { - debug_log 1 "wrLoop setting my_state to zero because it doesn't exist" - sct my_state 0 - } - if { [sct writestatus] == "start" } { - debug_log 1 "wrLoop setting my_state to zero because writestatus is [sct writestatus]" - sct my_state 0 - } - debug_log 1 "wrLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - if { [sct my_state] == 0 } { - set my_rate [hval [sct]/ramp_rate] - if { $my_rate > 0.0 } { - set command "RAMP 0,0;RAMP?" - } else { - set command "RAMP 1,$my_rate;RAMP?" - } - } else { - set command "SETP [hval [sct]/setpoint];SETP?" - } - debug_log 1 "wrLoop sct=[sct] command=$command" - sct send "$command" - return "$nextState" - } - - proc ckLoop {tc_root} { - debug_log 1 "ckLoop tc_root=$tc_root sct=[sct] result=[sct result]" - debug_log 1 "ckLoop target=[sct target] writestatus=[sct writestatus] my_state=[sct my_state]" - set nextState "write" - if { [sct my_state] == 0 } { - debug_log 1 "ckLoop sct=[sct] RAMP - result=[sct result]" - [ns]::rdValue $tc_root - set nextState "write" - } else { - debug_log 1 "ckLoop sct=[sct] SETP - result=[sct result]" - [ns]::rdValue $tc_root - sct my_state -1 - set nextState "idle" - } - sct my_state "[expr {[sct my_state] + 1}]" - return $nextState - } - - ## - # @brief getState() sends commands/requests to the device under control - # - # @param tc_root the path to the device_state node - # @param nextState the next sct state (rdState) - # @param cmd empty argument - # - # @return the next sct state (rdState) - # - proc getState {tc_root nextState cmd} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "getState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] next=$nextState" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { - set command "*IDN?" - } elseif { $my_substate == 1 } { - set command "*TST?" - } - } elseif { $my_state == "STATE_CURVE"} { - if { $my_substate == 0 } { - set my_substate 1000 - sct substate $my_substate - } - if { ($my_substate % 1000) == 0 } { - set command "CRVHDR? [expr {int($my_substate / 1000)}]" - } else { - set command "CRVPT? [expr {int($my_substate / 1000)}],[expr {($my_substate % 1000)}]" - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { - set command "*ESE?" - } elseif { $my_substate == 1 } { - set command "*ESR?" - } elseif { $my_substate == 2 } { - set command "*STB?" - } - } - debug_log 1 "getState sct send $command" - sct send $command - return "$nextState" - } - - ## - # @brief rdState() handles events from the device under control - # - # @param tc_root the path to the device_state node - # - proc rdState {tc_root} { - if { [hpropexists [sct] geterror] } { - hdelprop [sct] geterror - } - debug_log 1 "rdState $tc_root sct=[sct] state=[hval [sct]] substate=[sct substate] response=\"[sct result]\"" - set nextState "read" - set my_state [hval [sct]] - set my_substate [sct substate] - if {$my_state == "STATE_INIT"} { - if { $my_substate == 0 } { # IDN - sct identity [sct result] - incr my_substate - } elseif { $my_substate == 1 } { - sct selftest [sct result] - incr my_substate - } - if { $my_substate > 1 } { - #hset [sct] "STATE_IDLE" - hset [sct] "STATE_CURVE" - set my_substate 0 - } - } elseif { $my_state == "STATE_CURVE"} { - if { ($my_substate % 1000) == 0 } { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Header: [sct result]" - } else { - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Value: [sct result]" - set rslt [scan "[sct result]" "%f,%f" units temperature] - debug_log 1 "Curve: [expr {$my_substate / 1000}] Point: [expr {$my_substate % 1000}] Result: $rslt Units: $units Temp: $temperature" - if { $units == 0.0 && $temperature == 0.0 } { - set my_substate [expr { (($my_substate / 1000)) * 1000 + 999}] - } - } - if { ($my_substate % 1000) >= 200 } { - if { ($my_substate / 1000) >= 20 } { - hset [sct] "STATE_IDLE" - set my_substate 0 - } else { - set my_substate [expr { (($my_substate / 1000) + 1) * 1000 }] - } - } else { - set my_substate [expr { $my_substate + 1 }] - } - } elseif { $my_state == "STATE_IDLE"} { - if { $my_substate == 0 } { # ESE - sct the_ese [sct result] - incr my_substate - } elseif { $my_substate == 1 } { # ESR - sct the_esr [sct result] - incr my_substate - } elseif { $my_substate == 2 } { # STB - sct the_stb [sct result] - incr my_substate - } - if { $my_substate > 2 } { - set my_substate 0 - set nextState "idle" - } - } - sct substate $my_substate - if { $my_state != [hval [sct]] } { - debug_log 1 "device_state $my_state to [hval [sct]]" - } - return "$nextState" - } - - proc chkTarget {tc_root par} { - set target {} - if {[hpropexists [sct] values]} { - set values [split [SplitReply [sct values]] ","] - foreach value $values { - #sct print "Testing $par against $value" - set lo_hi [split $value ":"] - if {[llength $lo_hi] == 2} { - if {[lindex $lo_hi 0] <= $par && [lindex $lo_hi 1] >= $par} { - #sct print "Success $par between [lindex $lo_hi 0] and [lindex $lo_hi 1]" - set target "$par" - break - } - } else { - if {[string toupper "$par"] == [string toupper "$value"]} { - #sct print "Success $par matches $value" - set target "$par" - break - } - } - } - if {"$target" == ""} { - #sct print "Failure $par no matches in $values" - return -code error "Invalid value: \"$par\"" - } - } else { - set target "$par" - } - return $target - } - -## -# @brief Implement the checkstatus command for the drivable interface -# -# NOTE: The drive adapter initially sets the writestatus to "start" and will -# only call this when writestatus!="start" - proc drivestatus {tc_root} { - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], driving=[sct driving]" - if {[sct driving]} { - # tolerance - set temp [hval [pathname [sct]]/sensor] - set loval [expr {[hval [sct]] - [sct tolerance]}] - set hival [expr {[hval [sct]] + [sct tolerance]}] - if {$loval <= $temp && $temp <= $hival} { - # settle time - set timeout [sct settletime] - set timecheck [sct time_check] - set currtime [clock seconds] - #debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], setpoint=[hval [sct]], temp=[hval [pathname [sct]]/sensor], temp=($loval, $temp, $hival), time=($timecheck, $currtime, $timeout)" - if { ($currtime - $timecheck) >= $timeout } { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], finished driving" - sct driving 0 - } - } else { - sct time_check [clock seconds] - } - return busy - } else { - debug_log 1 "drivestatus tc_root=$tc_root, sct=[sct], now idle" - return idle - } - } - - proc halt {tc_root} { - debug_log 1 "halt $tc_root" - foreach loop {Loop1 Loop2 Loop3 Loop4} { - set catch_status [ catch { - hset $tc_root/$loop/setpoint [hval $tc_root/$loop/sensor] - hsetprop $tc_root/$loop/setpoint driving 0 - } catch_message ] - } - debug_log 1 "halt $tc_root done driving" - return idle - } - - proc check {tc_root} { - debug_log 1 "check tc_root=$tc_root, sct=[sct], target=[sct target]" - set catch_status [ catch { - set target [chkTarget $tc_root [sct target]] - if { "$target" == "" } { - error "setpoint violates limits" - } - } catch_message ] - if {$catch_status != 0} { - return -code error $catch_message - } - return OK - } - - proc wrNode {tc_root cmd level} { - set space [string repeat " " $level] - set val [hval $tc_root] - if {"$val" == ""} { - set line "$tc_root ([hinfo $tc_root])" - } else { - set line "$tc_root ([hinfo $tc_root]) = $val" - } - sct print "$space* $line" - if {"[string tolower "$cmd"]" == "-prop"} { - set props [hlistprop $tc_root] - #sct print "<<$props>>" - foreach prop $props { - #sct print "prop: $prop" - set flds [split $prop "="] - #sct print "flds: $flds" - if {[llength $flds] > 1} { - set fld0 [lindex $flds 0] - #sct print "fld0: $fld0" - if {[hpropexists $tc_root $fld0]} { - sct print "$space - [hgetprop $tc_root $fld0]" - } - } - } - } - foreach node [hlist $tc_root] { - [ns]::wrNode $tc_root/$node "$cmd" [expr {$level + 1}] - } - } - - proc wrTree {tc_root nextState cmd} { - debug_log 1 "wrTree root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" - sct print "$tc_root" - [ns]::wrNode $tc_root "[sct target]" 1 - return idle - } - - ## - # @brief createNode() creates a node for the given nodename with the properties given - # - # @param scobj_hpath string variable holding the path to the object's base node in sics (/sample/tc1) - # @param sct_controller name of the scriptcontext object (typically sct_xxx_yyy) - # @param cmdGroup subdirectory (below /sample/tc*/) in which the node is to be created - # @param varName name of the actual node typically representing one device command - # @param readable set to 1 if the node represents a query command, 0 if it is not - # @param writable set to 1 if the node represents a request for a change in settings sent to the device - # @param drivable if set to 1 it prepares the node to provide a drivable interface - # @param dataType data type of the node, must be one of none, int, float, text - # @param permission defines what user group may read/write to this node (is one of spy, user, manager) - # @param rdCmd actual device query command to be sent to the device - # @param rdFunc nextState Function to be called after the getValue function, typically rdValue() - # @param wrCmd actual device write command to be sent to the device - # @param wrFunc Function to be called to send the wrCmd to the device, typically setValue() - # @param allowedValues allowed values for the node data - does not permit other - # @param klass Nexus class name (?) - # @return OK - proc createNode {scobj_hpath sct_controller\ - cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues klass} { - - set catch_status [ catch { - set ns "[ns]" - set nodeName "$scobj_hpath/$cmdGroup/$varName" - if {1 > [string length $cmdGroup]} { - set nodeName "$scobj_hpath/$varName" - } - debug_log 1 "Creating node $nodeName" - hfactory $nodeName plain $permission $dataType - if {$readable > 0} { - # the node is readable so set it up to be polled using the rdFunc - # rdFunc is getValueFunc.rdValueFunc with both explicit functions - # or rdValueFunc where "getValue" is the implied getValueFunc - set parts [split "$rdFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name "getValue" - set next_state [lindex $parts 0] - } - hsetprop $nodeName read ${ns}::$func_name $scobj_hpath $next_state $rdCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - # set the poll rate as a period in seconds - # TODO allow directly settable value in seconds - set poll_period 5 - if { $readable >= 0 && $readable <= 300 } { - set poll_period [expr {int($readable)}] - } - debug_log 1 "Registering node $nodeName for poll at $poll_period seconds" - $sct_controller poll $nodeName $poll_period - } - if {$writable == 1} { - # the node is writable so set it up to invoke a callback when written - # rdFunc is putValueFunc.chkWriteFunc with both explicit functions - # or putValueFunc where "noResponse" is the implied chkWriteFunc - set parts [split "$wrFunc" "."] - if { [llength $parts] == 2 } { - set func_name [lindex $parts 0] - set next_state [lindex $parts 1] - } else { - set func_name [lindex $parts 0] - set next_state "noResponse" - } - hsetprop $nodeName write ${ns}::$func_name $scobj_hpath $next_state $wrCmd - hsetprop $nodeName $next_state ${ns}::$next_state $scobj_hpath - hsetprop $nodeName writestatus UNKNOWN - debug_log 1 "Registering node $nodeName for write callback" - $sct_controller write $nodeName - } - # Initialise the previous value to test against - switch -exact $dataType { - "none" { } - "int" { hsetprop $nodeName oldval -1 } - "float" { hsetprop $nodeName oldval -1.0 } - default { hsetprop $nodeName oldval UNKNOWN } - } - # Set the allowed values property - if {1 < [string length $allowedValues]} { - hsetprop $nodeName values $allowedValues - } - # Drive adapter interface - # TODO make it a separate function and pass in all this stuff - if {$drivable == 1} { - hsetprop $nodeName check ${ns}::check $scobj_hpath - hsetprop $nodeName driving 0 - hsetprop $nodeName checklimits ${ns}::check $scobj_hpath - hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath - hsetprop $nodeName halt ${ns}::halt $scobj_hpath - } else { - hsetprop $nodeName driving 0 - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::createNode $catch_message" - return -code error "in [ns]::createNode $catch_message" - } - return OK - } - - proc mk_sct_driver {sct_controller the_klass the_name tol CID CTYPE} { - debug_log 1 "mk_sct_driver $sct_controller $the_klass $the_name $tol $CID $CTYPE" - set catch_status [ catch { - - MakeSICSObj $the_name SCT_OBJECT - sicslist setatt $the_name klass $the_klass - sicslist setatt $the_name long_name $the_name - - set scobj_hpath /sics/$the_name - - hfactory $scobj_hpath/Loop1 plain spy none - hfactory $scobj_hpath/Loop2 plain spy none - hfactory $scobj_hpath/Loop3 plain spy none - hfactory $scobj_hpath/Loop4 plain spy none - hfactory $scobj_hpath/Level plain spy none - - set deviceCommand {\ - Loop1 setpoint 5 1 1 float user {READ:DEV:MB1.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:MB1.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop1 sensor 1 0 0 float user {READ:DEV:MB1.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop1 nick 5 0 0 text user {READ:DEV:MB1.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop1 temp 0 0 0 text user {READ:DEV:MB1.T1:TEMP} {rdTextAll} {} {} {}\ - Loop1 loop 0 0 0 text user {READ:DEV:MB1.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop1 heater 0 0 0 text user {READ:DEV:MB0.H1:HTR} {rdTextAll} {} {} {}\ - Loop1 power 5 0 0 float user {READ:DEV:MB0.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop2 setpoint 5 1 1 float user {READ:DEV:DB6.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB6.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop2 sensor 1 0 0 float user {READ:DEV:DB6.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop2 nick 5 0 0 text user {READ:DEV:DB6.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop2 temp 0 0 0 text user {READ:DEV:DB6.T1:TEMP} {rdTextAll} {} {} {}\ - Loop2 loop 0 0 0 text user {READ:DEV:DB6.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop2 heater 0 0 0 text user {READ:DEV:DB1.H1:HTR} {rdTextAll} {} {} {}\ - Loop2 power 5 0 0 float user {READ:DEV:DB1.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop3 setpoint 5 1 1 float user {READ:DEV:DB7.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB7.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop3 sensor 1 0 0 float user {READ:DEV:DB7.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop3 nick 5 0 0 text user {READ:DEV:DB7.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop3 temp 0 0 0 text user {READ:DEV:DB7.T1:TEMP} {rdTextAll} {} {} {}\ - Loop3 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop3 heater 0 0 0 text user {READ:DEV:DB2.H1:HTR} {rdTextAll} {} {} {}\ - Loop3 power 5 0 0 float user {READ:DEV:DB2.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Loop4 setpoint 5 1 1 float user {READ:DEV:DB8.T1:TEMP:LOOP:TSET} {rdValue} {SET:DEV:DB8.T1:TEMP:LOOP:TSET} {setPoint} {1:333}\ - Loop4 sensor 1 0 0 float user {READ:DEV:DB8.T1:TEMP:SIG:TEMP} {rdValue} {} {} {}\ - Loop4 nick 5 0 0 text user {READ:DEV:DB8.T1:TEMP:NICK} {rdText} {} {} {}\ - Loop4 temp 0 0 0 text user {READ:DEV:DB8.T1:TEMP} {rdTextAll} {} {} {}\ - Loop4 loop 0 0 0 text user {READ:DEV:DB7.T1:TEMP:LOOP} {rdTextAll} {} {} {}\ - Loop4 heater 0 0 0 text user {READ:DEV:DB3.H1:HTR} {rdTextAll} {} {} {}\ - Loop4 power 5 0 0 float user {READ:DEV:DB3.H1:HTR:SIG:POWR} {rdValue} {} {} {}\ - Level Nitrogen 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} {rdValue} {} {} {}\ - Level Helium 15 0 0 float user {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} {rdValue} {} {} {}\ - } - - foreach {cmdGroup varName\ - readable writable drivable\ - dataType permission\ - rdCmd rdFunc\ - wrCmd wrFunc\ - allowedValues} $deviceCommand { - [ns]::createNode $scobj_hpath $sct_controller\ - $cmdGroup $varName\ - $readable $writable $drivable\ - $dataType $permission\ - $rdCmd $rdFunc\ - $wrCmd $wrFunc\ - $allowedValues $the_klass - } - - foreach cmdGroup { Loop1 Loop2 Loop3 Loop4 } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - hsetprop $pathName/setpoint tolerance $tol - hsetprop $pathName/setpoint settletime 5 - foreach varName { setpoint sensor nick } { - set nodeName "$pathName/$varName" - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - foreach cmdGroup { Level } { - set pathName "$scobj_hpath/$cmdGroup" - hsetprop $pathName type part - hsetprop $pathName klass NXsensor - hsetprop $pathName privilege spy - hsetprop $pathName control true - hsetprop $pathName data true - hsetprop $pathName nxsave true - foreach varName { Nitrogen Helium } { - set nodeName "$pathName/$varName" - hsetprop $nodeName long_name $varName - hsetprop $nodeName klass sensor - hsetprop $nodeName priviledge user - hsetprop $nodeName control true - hsetprop $nodeName data true - hsetprop $nodeName nxsave true - hsetprop $nodeName nxalias ${the_name}_${cmdGroup}_${varName}_value - hsetprop $nodeName mutable true - hsetprop $nodeName sdsinfo ::nexus::scobj::sdsinfo - } - } - - hfactory $scobj_hpath/device_state plain spy none - hset $scobj_hpath/device_state "STATE_INIT" - hsetprop $scobj_hpath/device_state substate 0 - - set point 0 - set catch_status_2 [ catch { - hsetprop $scobj_hpath privilege spy - hsetprop $scobj_hpath long_name $the_name - hsetprop $scobj_hpath sicsdev $the_name - hsetprop $scobj_hpath nxalias $the_name - hsetprop $scobj_hpath control true - hsetprop $scobj_hpath data true - hsetprop $scobj_hpath nxsave true - hsetprop $scobj_hpath mutable true - hsetprop $scobj_hpath klass parameter - hsetprop $scobj_hpath sdsinfo ::nexus::scobj::sdsinfo - set point 1 -if {0} { - ::scobj::hinitprops $the_name Loop1 - set point 2 - ::scobj::hinitprops $the_name Loop2/setpoint - set point 3 - ::scobj::hinitprops $the_name Loop3/setpoint - set point 4 - ::scobj::hinitprops $the_name Loop4/setpoint - set point 5 -} - } catch_message_2 ] - if {$catch_status_2 != 0} { - debug_log 5 "error in [ns]::mk_sct_driver($point) $catch_message_2" - return -code error "in [ns]::mk_sct_driver($point) $catch_message_2" - } - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1 - hsetprop $scobj_hpath/Loop2/setpoint permlink data_set ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop2/setpoint @description ${CTYPE}${CID}SP2 - hsetprop $scobj_hpath/Loop3/setpoint permlink data_set ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop3/setpoint @description ${CTYPE}${CID}SP3 - hsetprop $scobj_hpath/Loop4/setpoint permlink data_set ${CTYPE}${CID}SP4 - hsetprop $scobj_hpath/Loop4/setpoint @description ${CTYPE}${CID}SP4 - - hsetprop $scobj_hpath/Loop1/sensor permlink data_set ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop1/sensor @description ${CTYPE}${CID}S1 - hsetprop $scobj_hpath/Loop2/sensor permlink data_set ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop2/sensor @description ${CTYPE}${CID}S2 - hsetprop $scobj_hpath/Loop3/sensor permlink data_set ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop3/sensor @description ${CTYPE}${CID}S3 - hsetprop $scobj_hpath/Loop4/sensor permlink data_set ${CTYPE}${CID}S4 - hsetprop $scobj_hpath/Loop4/sensor @description ${CTYPE}${CID}S4 - - if {[SplitReply [environment_simulation]]=="false"} { - hsetprop $scobj_hpath/Loop1/setpoint type drivable - hsetprop $scobj_hpath/Loop2/setpoint type drivable - hsetprop $scobj_hpath/Loop3/setpoint type drivable - hsetprop $scobj_hpath/Loop4/setpoint type drivable - ansto_makesctdrive ${the_name}_loop1 $scobj_hpath/Loop1/setpoint $scobj_hpath/Loop1/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop2 $scobj_hpath/Loop2/setpoint $scobj_hpath/Loop2/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop3 $scobj_hpath/Loop3/setpoint $scobj_hpath/Loop3/sensor $sct_controller - ansto_makesctdrive ${the_name}_loop4 $scobj_hpath/Loop4/setpoint $scobj_hpath/Loop4/sensor $sct_controller - } - } catch_message ] - if {$catch_status != 0} { - debug_log 5 "error in [ns]::mk_sct_driver $catch_message" - return -code error "in [ns]::mk_sct_driver $catch_message" - } - } - - proc add_[set vendor]_[set device] {the_name IP port CID CTYPE terminator {_tol 5.0}} { - set [ns]::log_file "../log/[set [ns]::ven_dev]_[set the_name].log" - set fd [open [set [ns]::log_file] "w"] - close $fd - debug_log 1 "add_[set [ns]::vendor]_[set [ns]::device] ${the_name} ${IP} ${port} ${_tol}" - clientput "Namespace: [namespace current]" - clientput "::vendor $::vendor" - clientput "::device $::device" - clientput "[namespace current]::vendor [set [namespace current]::vendor]" - clientput "[namespace current]::device [set [namespace current]::device]" - clientput "[namespace current]::ven_dev [set [namespace current]::ven_dev]" - clientput "[namespace current]::log_file [set [namespace current]::log_file]" - if {[SplitReply [environment_simulation]]=="false"} { - debug_log 1 "makesctcontroller sct_${the_name} std ${IP}:${port} $terminator" - makesctcontroller sct_${the_name} std ${IP}:${port} $terminator - } - debug_log 1 "::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE" - ::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE - } - - - namespace export add_[set vendor]_[set device] + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} } -namespace import ::scobj::[set vendor]_[set device]::* +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValue {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValue hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValue sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +# function to write a parameter value on a device +proc ::scobj::oxford_mercury::setValve {tc_root nextState cmd_str} { + set catch_status [ catch { + debug_log ${tc_root} 1 "setValve tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" + if { [hpropexists [sct] geterror] } { + hdelprop [sct] geterror + } + set par [sct target] + set cmd "${cmd_str}${par}" +# setValve hook code goes here + if { [hpropexists [sct] driving] } { + if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { + sct driving 1 + } + } + debug_log ${tc_root} 1 "setValve sct send ${cmd}" + if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { + sct send "${cmd}" + } + return ${nextState} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} +proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5} } { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + set ns "[namespace current]" + set catch_status [ catch { + + MakeSICSObj ${name} SCT_OBJECT + + sicslist setatt ${name} klass ${device_class} + sicslist setatt ${name} long_name ${name} + + set scobj_hpath /sics/${name} + + hsetprop ${scobj_hpath} assoc "${assoc}" + hsetprop ${scobj_hpath} cards "${cards}" + hsetprop ${scobj_hpath} data "true" + hsetprop ${scobj_hpath} klass "@none" + hsetprop ${scobj_hpath} type "part" + + if {[string equal -nocase [string index ${cards} 4] L]} { + hfactory ${scobj_hpath}/Level plain spy none + + hfactory ${scobj_hpath}/Level/Helium plain user float + hsetprop ${scobj_hpath}/Level/Helium read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:HEL:LEV} + hsetprop ${scobj_hpath}/Level/Helium rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Level/Helium control true + hsetprop ${scobj_hpath}/Level/Helium data true + hsetprop ${scobj_hpath}/Level/Helium mutable true + hsetprop ${scobj_hpath}/Level/Helium nxsave true + hsetprop ${scobj_hpath}/Level/Helium permlink data_set "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/Level/Helium @description "T[format "%02d" ${id}]He" + hsetprop ${scobj_hpath}/Level/Helium oldval 0.0 + hsetprop ${scobj_hpath}/Level/Helium klass "parameter" + hsetprop ${scobj_hpath}/Level/Helium sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Level/Helium type "part" + hsetprop ${scobj_hpath}/Level/Helium nxalias "${name}_Level_Helium" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Level/Helium 15 + hsetprop ${scobj_hpath}/Level/Helium simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Level/Helium simulated true + } + + hfactory ${scobj_hpath}/Level/Nitrogen plain user float + hsetprop ${scobj_hpath}/Level/Nitrogen read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.L1:LVL:SIG:NIT:LEV} + hsetprop ${scobj_hpath}/Level/Nitrogen rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Level/Nitrogen control true + hsetprop ${scobj_hpath}/Level/Nitrogen data true + hsetprop ${scobj_hpath}/Level/Nitrogen mutable true + hsetprop ${scobj_hpath}/Level/Nitrogen nxsave true + hsetprop ${scobj_hpath}/Level/Nitrogen permlink data_set "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/Level/Nitrogen @description "T[format "%02d" ${id}]N2" + hsetprop ${scobj_hpath}/Level/Nitrogen oldval 0.0 + hsetprop ${scobj_hpath}/Level/Nitrogen klass "parameter" + hsetprop ${scobj_hpath}/Level/Nitrogen sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Level/Nitrogen type "part" + hsetprop ${scobj_hpath}/Level/Nitrogen nxalias "${name}_Level_Nitrogen" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Level/Nitrogen 15 + hsetprop ${scobj_hpath}/Level/Nitrogen simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Level/Nitrogen simulated true + } + + hfactory ${scobj_hpath}/Level/nick plain user text + hsetprop ${scobj_hpath}/Level/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.L1:LVL:NICK} + hsetprop ${scobj_hpath}/Level/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Level/nick control true + hsetprop ${scobj_hpath}/Level/nick data true + hsetprop ${scobj_hpath}/Level/nick mutable true + hsetprop ${scobj_hpath}/Level/nick nxsave true + hsetprop ${scobj_hpath}/Level/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Level/nick klass "parameter" + hsetprop ${scobj_hpath}/Level/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Level/nick type "part" + hsetprop ${scobj_hpath}/Level/nick nxalias "${name}_Level_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Level/nick 15 + hsetprop ${scobj_hpath}/Level/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Level/nick simulated true + } + hsetprop ${scobj_hpath}/Level data "true" + hsetprop ${scobj_hpath}/Level klass "@none" + hsetprop ${scobj_hpath}/Level type "part" + } + + if {[string equal -nocase [string index ${cards} 4] P]} { + hfactory ${scobj_hpath}/Pres5 plain spy none + + hfactory ${scobj_hpath}/Pres5/nick plain user text + hsetprop ${scobj_hpath}/Pres5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.P1:PRES:NICK} + hsetprop ${scobj_hpath}/Pres5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/nick control true + hsetprop ${scobj_hpath}/Pres5/nick data true + hsetprop ${scobj_hpath}/Pres5/nick mutable true + hsetprop ${scobj_hpath}/Pres5/nick nxsave true + hsetprop ${scobj_hpath}/Pres5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Pres5/nick klass "parameter" + hsetprop ${scobj_hpath}/Pres5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres5/nick type "part" + hsetprop ${scobj_hpath}/Pres5/nick nxalias "${name}_Pres5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres5/nick 15 + hsetprop ${scobj_hpath}/Pres5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres5/nick simulated true + } + + hfactory ${scobj_hpath}/Pres5/sensor plain user float + hsetprop ${scobj_hpath}/Pres5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/Pres5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/sensor control true + hsetprop ${scobj_hpath}/Pres5/sensor data true + hsetprop ${scobj_hpath}/Pres5/sensor mutable true + hsetprop ${scobj_hpath}/Pres5/sensor nxsave true + hsetprop ${scobj_hpath}/Pres5/sensor units mB + hsetprop ${scobj_hpath}/Pres5/sensor permlink data_set "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/Pres5/sensor @description "P[format "%02d" ${id}]PS05" + hsetprop ${scobj_hpath}/Pres5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Pres5/sensor klass "parameter" + hsetprop ${scobj_hpath}/Pres5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres5/sensor type "part" + hsetprop ${scobj_hpath}/Pres5/sensor nxalias "${name}_Pres5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres5/sensor 1 + hsetprop ${scobj_hpath}/Pres5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres5/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/Pres5/setpoint plain user float + hsetprop ${scobj_hpath}/Pres5/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/Pres5/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/Pres5/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint driving 0 + hsetprop ${scobj_hpath}/Pres5/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/setpoint driveable Pres5/sensor + hsetprop ${scobj_hpath}/Pres5/setpoint control true + hsetprop ${scobj_hpath}/Pres5/setpoint data true + hsetprop ${scobj_hpath}/Pres5/setpoint mutable true + hsetprop ${scobj_hpath}/Pres5/setpoint nxsave true + hsetprop ${scobj_hpath}/Pres5/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Pres5/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Pres5/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/Pres5/setpoint units mB + hsetprop ${scobj_hpath}/Pres5/setpoint permlink data_set "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/Pres5/setpoint @description "P[format "%02d" ${id}]PSP05" + hsetprop ${scobj_hpath}/Pres5/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Pres5/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Pres5/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres5/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Pres5/setpoint type "drivable" + hsetprop ${scobj_hpath}/Pres5/setpoint nxalias "${name}_Pres5_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres5/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Pres5/setpoint + hsetprop ${scobj_hpath}/Pres5/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres5/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + hfactory ${scobj_hpath}/Pres5/valve plain user float + hsetprop ${scobj_hpath}/Pres5/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN} + hsetprop ${scobj_hpath}/Pres5/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres5/valve control true + hsetprop ${scobj_hpath}/Pres5/valve data true + hsetprop ${scobj_hpath}/Pres5/valve mutable true + hsetprop ${scobj_hpath}/Pres5/valve nxsave true + hsetprop ${scobj_hpath}/Pres5/valve oldval 0.0 + hsetprop ${scobj_hpath}/Pres5/valve klass "parameter" + hsetprop ${scobj_hpath}/Pres5/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres5/valve type "part" + hsetprop ${scobj_hpath}/Pres5/valve nxalias "${name}_Pres5_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres5/valve 5 + hsetprop ${scobj_hpath}/Pres5/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres5/valve simulated true + } + } + hsetprop ${scobj_hpath}/Pres5 data "true" + hsetprop ${scobj_hpath}/Pres5 klass "@none" + hsetprop ${scobj_hpath}/Pres5 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} { + ansto_makesctdrive ${name}_Pres5_setpoint ${scobj_hpath}/Pres5/setpoint ${scobj_hpath}/Pres5/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] P]} { + hfactory ${scobj_hpath}/Pres8 plain spy none + + hfactory ${scobj_hpath}/Pres8/nick plain user text + hsetprop ${scobj_hpath}/Pres8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.P1:PRES:NICK} + hsetprop ${scobj_hpath}/Pres8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/nick control true + hsetprop ${scobj_hpath}/Pres8/nick data true + hsetprop ${scobj_hpath}/Pres8/nick mutable true + hsetprop ${scobj_hpath}/Pres8/nick nxsave true + hsetprop ${scobj_hpath}/Pres8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Pres8/nick klass "parameter" + hsetprop ${scobj_hpath}/Pres8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres8/nick type "part" + hsetprop ${scobj_hpath}/Pres8/nick nxalias "${name}_Pres8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres8/nick 15 + hsetprop ${scobj_hpath}/Pres8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres8/nick simulated true + } + + hfactory ${scobj_hpath}/Pres8/sensor plain user float + hsetprop ${scobj_hpath}/Pres8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:SIG:PRES} + hsetprop ${scobj_hpath}/Pres8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/sensor control true + hsetprop ${scobj_hpath}/Pres8/sensor data true + hsetprop ${scobj_hpath}/Pres8/sensor mutable true + hsetprop ${scobj_hpath}/Pres8/sensor nxsave true + hsetprop ${scobj_hpath}/Pres8/sensor units mB + hsetprop ${scobj_hpath}/Pres8/sensor permlink data_set "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/Pres8/sensor @description "P[format "%02d" ${id}]PS08" + hsetprop ${scobj_hpath}/Pres8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Pres8/sensor klass "parameter" + hsetprop ${scobj_hpath}/Pres8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres8/sensor type "part" + hsetprop ${scobj_hpath}/Pres8/sensor nxalias "${name}_Pres8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres8/sensor 1 + hsetprop ${scobj_hpath}/Pres8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/Pres8/setpoint plain user float + hsetprop ${scobj_hpath}/Pres8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.P1:PRES:LOOP:TSET} + hsetprop ${scobj_hpath}/Pres8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.P1:PRES:LOOP:TSET:} + hsetprop ${scobj_hpath}/Pres8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint driving 0 + hsetprop ${scobj_hpath}/Pres8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/setpoint driveable Pres8/sensor + hsetprop ${scobj_hpath}/Pres8/setpoint control true + hsetprop ${scobj_hpath}/Pres8/setpoint data true + hsetprop ${scobj_hpath}/Pres8/setpoint mutable true + hsetprop ${scobj_hpath}/Pres8/setpoint nxsave true + hsetprop ${scobj_hpath}/Pres8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Pres8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Pres8/setpoint tolerance ${ptol} + hsetprop ${scobj_hpath}/Pres8/setpoint units mB + hsetprop ${scobj_hpath}/Pres8/setpoint permlink data_set "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/Pres8/setpoint @description "P[format "%02d" ${id}]PSP08" + hsetprop ${scobj_hpath}/Pres8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Pres8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Pres8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Pres8/setpoint type "drivable" + hsetprop ${scobj_hpath}/Pres8/setpoint nxalias "${name}_Pres8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Pres8/setpoint + hsetprop ${scobj_hpath}/Pres8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres8/setpoint simulated true + } + } + + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + hfactory ${scobj_hpath}/Pres8/valve plain user float + hsetprop ${scobj_hpath}/Pres8/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN} + hsetprop ${scobj_hpath}/Pres8/valve rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Pres8/valve control true + hsetprop ${scobj_hpath}/Pres8/valve data true + hsetprop ${scobj_hpath}/Pres8/valve mutable true + hsetprop ${scobj_hpath}/Pres8/valve nxsave true + hsetprop ${scobj_hpath}/Pres8/valve oldval 0.0 + hsetprop ${scobj_hpath}/Pres8/valve klass "parameter" + hsetprop ${scobj_hpath}/Pres8/valve sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Pres8/valve type "part" + hsetprop ${scobj_hpath}/Pres8/valve nxalias "${name}_Pres8_valve" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Pres8/valve 5 + hsetprop ${scobj_hpath}/Pres8/valve simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Pres8/valve simulated true + } + } + hsetprop ${scobj_hpath}/Pres8 data "true" + hsetprop ${scobj_hpath}/Pres8 klass "@none" + hsetprop ${scobj_hpath}/Pres8 type "part" + if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} { + ansto_makesctdrive ${name}_Pres8_setpoint ${scobj_hpath}/Pres8/setpoint ${scobj_hpath}/Pres8/sensor ${sct_controller} + } + } + + hfactory ${scobj_hpath}/Temp0 plain spy none + + hfactory ${scobj_hpath}/Temp0/nick plain user text + hsetprop ${scobj_hpath}/Temp0/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:MB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp0/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/nick control true + hsetprop ${scobj_hpath}/Temp0/nick data true + hsetprop ${scobj_hpath}/Temp0/nick mutable true + hsetprop ${scobj_hpath}/Temp0/nick nxsave true + hsetprop ${scobj_hpath}/Temp0/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp0/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp0/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp0/nick type "part" + hsetprop ${scobj_hpath}/Temp0/nick nxalias "${name}_Temp0_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp0/nick 15 + hsetprop ${scobj_hpath}/Temp0/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp0/nick simulated true + } + + hfactory ${scobj_hpath}/Temp0/power plain user float + hsetprop ${scobj_hpath}/Temp0/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB0.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/Temp0/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/power control true + hsetprop ${scobj_hpath}/Temp0/power data true + hsetprop ${scobj_hpath}/Temp0/power mutable true + hsetprop ${scobj_hpath}/Temp0/power nxsave true + hsetprop ${scobj_hpath}/Temp0/power oldval 0.0 + hsetprop ${scobj_hpath}/Temp0/power klass "parameter" + hsetprop ${scobj_hpath}/Temp0/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp0/power type "part" + hsetprop ${scobj_hpath}/Temp0/power nxalias "${name}_Temp0_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp0/power 5 + hsetprop ${scobj_hpath}/Temp0/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp0/power simulated true + } + + hfactory ${scobj_hpath}/Temp0/sensor plain user float + hsetprop ${scobj_hpath}/Temp0/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp0/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/sensor control true + hsetprop ${scobj_hpath}/Temp0/sensor data true + hsetprop ${scobj_hpath}/Temp0/sensor mutable true + hsetprop ${scobj_hpath}/Temp0/sensor nxsave true + hsetprop ${scobj_hpath}/Temp0/sensor permlink data_set "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/Temp0/sensor @description "T[format "%02d" ${id}]S00" + hsetprop ${scobj_hpath}/Temp0/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp0/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp0/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp0/sensor type "part" + hsetprop ${scobj_hpath}/Temp0/sensor nxalias "${name}_Temp0_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp0/sensor 1 + hsetprop ${scobj_hpath}/Temp0/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp0/sensor simulated true + } + + hfactory ${scobj_hpath}/Temp0/setpoint plain user float + hsetprop ${scobj_hpath}/Temp0/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:MB1.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/Temp0/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:MB1.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/Temp0/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint driving 0 + hsetprop ${scobj_hpath}/Temp0/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp0/setpoint driveable Temp0/sensor + hsetprop ${scobj_hpath}/Temp0/setpoint control true + hsetprop ${scobj_hpath}/Temp0/setpoint data true + hsetprop ${scobj_hpath}/Temp0/setpoint mutable true + hsetprop ${scobj_hpath}/Temp0/setpoint nxsave true + hsetprop ${scobj_hpath}/Temp0/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Temp0/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Temp0/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/Temp0/setpoint permlink data_set "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/Temp0/setpoint @description "T[format "%02d" ${id}]SP00" + hsetprop ${scobj_hpath}/Temp0/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Temp0/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Temp0/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp0/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Temp0/setpoint type "drivable" + hsetprop ${scobj_hpath}/Temp0/setpoint nxalias "${name}_Temp0_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp0/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Temp0/setpoint + hsetprop ${scobj_hpath}/Temp0/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp0/setpoint simulated true + } + hsetprop ${scobj_hpath}/Temp0 data "true" + hsetprop ${scobj_hpath}/Temp0 klass "@none" + hsetprop ${scobj_hpath}/Temp0 type "part" + ansto_makesctdrive ${name}_Temp0_setpoint ${scobj_hpath}/Temp0/setpoint ${scobj_hpath}/Temp0/sensor ${sct_controller} + + if {[string equal -nocase [string index ${cards} 0] T]} { + hfactory ${scobj_hpath}/Temp1 plain spy none + + hfactory ${scobj_hpath}/Temp1/nick plain user text + hsetprop ${scobj_hpath}/Temp1/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB1.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp1/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp1/nick control true + hsetprop ${scobj_hpath}/Temp1/nick data true + hsetprop ${scobj_hpath}/Temp1/nick mutable true + hsetprop ${scobj_hpath}/Temp1/nick nxsave true + hsetprop ${scobj_hpath}/Temp1/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp1/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp1/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp1/nick type "part" + hsetprop ${scobj_hpath}/Temp1/nick nxalias "${name}_Temp1_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp1/nick 15 + hsetprop ${scobj_hpath}/Temp1/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp1/nick simulated true + } + + hfactory ${scobj_hpath}/Temp1/sensor plain user float + hsetprop ${scobj_hpath}/Temp1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp1/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp1/sensor control true + hsetprop ${scobj_hpath}/Temp1/sensor data true + hsetprop ${scobj_hpath}/Temp1/sensor mutable true + hsetprop ${scobj_hpath}/Temp1/sensor nxsave true + hsetprop ${scobj_hpath}/Temp1/sensor permlink data_set "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/Temp1/sensor @description "T[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/Temp1/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp1/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp1/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp1/sensor type "part" + hsetprop ${scobj_hpath}/Temp1/sensor nxalias "${name}_Temp1_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp1/sensor 1 + hsetprop ${scobj_hpath}/Temp1/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp1/sensor simulated true + } + hsetprop ${scobj_hpath}/Temp1 data "true" + hsetprop ${scobj_hpath}/Temp1 klass "@none" + hsetprop ${scobj_hpath}/Temp1 type "part" + } + + if {[string equal -nocase [string index ${cards} 1] T]} { + hfactory ${scobj_hpath}/Temp2 plain spy none + + hfactory ${scobj_hpath}/Temp2/nick plain user text + hsetprop ${scobj_hpath}/Temp2/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB2.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp2/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp2/nick control true + hsetprop ${scobj_hpath}/Temp2/nick data true + hsetprop ${scobj_hpath}/Temp2/nick mutable true + hsetprop ${scobj_hpath}/Temp2/nick nxsave true + hsetprop ${scobj_hpath}/Temp2/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp2/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp2/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp2/nick type "part" + hsetprop ${scobj_hpath}/Temp2/nick nxalias "${name}_Temp2_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp2/nick 15 + hsetprop ${scobj_hpath}/Temp2/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp2/nick simulated true + } + + hfactory ${scobj_hpath}/Temp2/sensor plain user float + hsetprop ${scobj_hpath}/Temp2/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp2/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp2/sensor control true + hsetprop ${scobj_hpath}/Temp2/sensor data true + hsetprop ${scobj_hpath}/Temp2/sensor mutable true + hsetprop ${scobj_hpath}/Temp2/sensor nxsave true + hsetprop ${scobj_hpath}/Temp2/sensor permlink data_set "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/Temp2/sensor @description "T[format "%02d" ${id}]S02" + hsetprop ${scobj_hpath}/Temp2/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp2/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp2/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp2/sensor type "part" + hsetprop ${scobj_hpath}/Temp2/sensor nxalias "${name}_Temp2_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp2/sensor 1 + hsetprop ${scobj_hpath}/Temp2/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp2/sensor simulated true + } + hsetprop ${scobj_hpath}/Temp2 data "true" + hsetprop ${scobj_hpath}/Temp2 klass "@none" + hsetprop ${scobj_hpath}/Temp2 type "part" + } + + if {[string equal -nocase [string index ${cards} 2] T]} { + hfactory ${scobj_hpath}/Temp3 plain spy none + + hfactory ${scobj_hpath}/Temp3/nick plain user text + hsetprop ${scobj_hpath}/Temp3/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB3.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp3/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp3/nick control true + hsetprop ${scobj_hpath}/Temp3/nick data true + hsetprop ${scobj_hpath}/Temp3/nick mutable true + hsetprop ${scobj_hpath}/Temp3/nick nxsave true + hsetprop ${scobj_hpath}/Temp3/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp3/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp3/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp3/nick type "part" + hsetprop ${scobj_hpath}/Temp3/nick nxalias "${name}_Temp3_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp3/nick 15 + hsetprop ${scobj_hpath}/Temp3/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp3/nick simulated true + } + + hfactory ${scobj_hpath}/Temp3/sensor plain user float + hsetprop ${scobj_hpath}/Temp3/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp3/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp3/sensor control true + hsetprop ${scobj_hpath}/Temp3/sensor data true + hsetprop ${scobj_hpath}/Temp3/sensor mutable true + hsetprop ${scobj_hpath}/Temp3/sensor nxsave true + hsetprop ${scobj_hpath}/Temp3/sensor permlink data_set "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/Temp3/sensor @description "T[format "%02d" ${id}]S03" + hsetprop ${scobj_hpath}/Temp3/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp3/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp3/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp3/sensor type "part" + hsetprop ${scobj_hpath}/Temp3/sensor nxalias "${name}_Temp3_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp3/sensor 1 + hsetprop ${scobj_hpath}/Temp3/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp3/sensor simulated true + } + hsetprop ${scobj_hpath}/Temp3 data "true" + hsetprop ${scobj_hpath}/Temp3 klass "@none" + hsetprop ${scobj_hpath}/Temp3 type "part" + } + + if {[string equal -nocase [string index ${cards} 3] T]} { + hfactory ${scobj_hpath}/Temp4 plain spy none + + hfactory ${scobj_hpath}/Temp4/nick plain user text + hsetprop ${scobj_hpath}/Temp4/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp4/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp4/nick control true + hsetprop ${scobj_hpath}/Temp4/nick data true + hsetprop ${scobj_hpath}/Temp4/nick mutable true + hsetprop ${scobj_hpath}/Temp4/nick nxsave true + hsetprop ${scobj_hpath}/Temp4/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp4/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp4/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp4/nick type "part" + hsetprop ${scobj_hpath}/Temp4/nick nxalias "${name}_Temp4_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp4/nick 15 + hsetprop ${scobj_hpath}/Temp4/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp4/nick simulated true + } + + hfactory ${scobj_hpath}/Temp4/sensor plain user float + hsetprop ${scobj_hpath}/Temp4/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp4/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp4/sensor control true + hsetprop ${scobj_hpath}/Temp4/sensor data true + hsetprop ${scobj_hpath}/Temp4/sensor mutable true + hsetprop ${scobj_hpath}/Temp4/sensor nxsave true + hsetprop ${scobj_hpath}/Temp4/sensor permlink data_set "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/Temp4/sensor @description "T[format "%02d" ${id}]S04" + hsetprop ${scobj_hpath}/Temp4/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp4/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp4/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp4/sensor type "part" + hsetprop ${scobj_hpath}/Temp4/sensor nxalias "${name}_Temp4_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp4/sensor 1 + hsetprop ${scobj_hpath}/Temp4/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp4/sensor simulated true + } + hsetprop ${scobj_hpath}/Temp4 data "true" + hsetprop ${scobj_hpath}/Temp4 klass "@none" + hsetprop ${scobj_hpath}/Temp4 type "part" + } + + if {[string equal -nocase [string index ${cards} 4] T]} { + hfactory ${scobj_hpath}/Temp5 plain spy none + + hfactory ${scobj_hpath}/Temp5/nick plain user text + hsetprop ${scobj_hpath}/Temp5/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB5.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp5/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp5/nick control true + hsetprop ${scobj_hpath}/Temp5/nick data true + hsetprop ${scobj_hpath}/Temp5/nick mutable true + hsetprop ${scobj_hpath}/Temp5/nick nxsave true + hsetprop ${scobj_hpath}/Temp5/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp5/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp5/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp5/nick type "part" + hsetprop ${scobj_hpath}/Temp5/nick nxalias "${name}_Temp5_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp5/nick 15 + hsetprop ${scobj_hpath}/Temp5/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp5/nick simulated true + } + + hfactory ${scobj_hpath}/Temp5/sensor plain user float + hsetprop ${scobj_hpath}/Temp5/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB5.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp5/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp5/sensor control true + hsetprop ${scobj_hpath}/Temp5/sensor data true + hsetprop ${scobj_hpath}/Temp5/sensor mutable true + hsetprop ${scobj_hpath}/Temp5/sensor nxsave true + hsetprop ${scobj_hpath}/Temp5/sensor permlink data_set "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/Temp5/sensor @description "T[format "%02d" ${id}]S05" + hsetprop ${scobj_hpath}/Temp5/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp5/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp5/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp5/sensor type "part" + hsetprop ${scobj_hpath}/Temp5/sensor nxalias "${name}_Temp5_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp5/sensor 1 + hsetprop ${scobj_hpath}/Temp5/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp5/sensor simulated true + } + hsetprop ${scobj_hpath}/Temp5 data "true" + hsetprop ${scobj_hpath}/Temp5 klass "@none" + hsetprop ${scobj_hpath}/Temp5 type "part" + } + + if {[string equal -nocase [string index ${cards} 5] T]} { + hfactory ${scobj_hpath}/Temp6 plain spy none + + hfactory ${scobj_hpath}/Temp6/nick plain user text + hsetprop ${scobj_hpath}/Temp6/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB6.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp6/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/nick control true + hsetprop ${scobj_hpath}/Temp6/nick data true + hsetprop ${scobj_hpath}/Temp6/nick mutable true + hsetprop ${scobj_hpath}/Temp6/nick nxsave true + hsetprop ${scobj_hpath}/Temp6/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp6/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp6/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp6/nick type "part" + hsetprop ${scobj_hpath}/Temp6/nick nxalias "${name}_Temp6_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp6/nick 15 + hsetprop ${scobj_hpath}/Temp6/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp6/nick simulated true + } + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/Temp6/power plain user float + hsetprop ${scobj_hpath}/Temp6/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB1.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/Temp6/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/power control true + hsetprop ${scobj_hpath}/Temp6/power data true + hsetprop ${scobj_hpath}/Temp6/power mutable true + hsetprop ${scobj_hpath}/Temp6/power nxsave true + hsetprop ${scobj_hpath}/Temp6/power oldval 0.0 + hsetprop ${scobj_hpath}/Temp6/power klass "parameter" + hsetprop ${scobj_hpath}/Temp6/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp6/power type "part" + hsetprop ${scobj_hpath}/Temp6/power nxalias "${name}_Temp6_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp6/power 5 + hsetprop ${scobj_hpath}/Temp6/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp6/power simulated true + } + } + + hfactory ${scobj_hpath}/Temp6/sensor plain user float + hsetprop ${scobj_hpath}/Temp6/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp6/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/sensor control true + hsetprop ${scobj_hpath}/Temp6/sensor data true + hsetprop ${scobj_hpath}/Temp6/sensor mutable true + hsetprop ${scobj_hpath}/Temp6/sensor nxsave true + hsetprop ${scobj_hpath}/Temp6/sensor permlink data_set "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/Temp6/sensor @description "T[format "%02d" ${id}]S06" + hsetprop ${scobj_hpath}/Temp6/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp6/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp6/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp6/sensor type "part" + hsetprop ${scobj_hpath}/Temp6/sensor nxalias "${name}_Temp6_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp6/sensor 1 + hsetprop ${scobj_hpath}/Temp6/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp6/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + hfactory ${scobj_hpath}/Temp6/setpoint plain user float + hsetprop ${scobj_hpath}/Temp6/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB6.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/Temp6/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB6.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/Temp6/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint driving 0 + hsetprop ${scobj_hpath}/Temp6/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp6/setpoint driveable Temp6/sensor + hsetprop ${scobj_hpath}/Temp6/setpoint control true + hsetprop ${scobj_hpath}/Temp6/setpoint data true + hsetprop ${scobj_hpath}/Temp6/setpoint mutable true + hsetprop ${scobj_hpath}/Temp6/setpoint nxsave true + hsetprop ${scobj_hpath}/Temp6/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Temp6/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Temp6/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/Temp6/setpoint permlink data_set "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/Temp6/setpoint @description "T[format "%02d" ${id}]SP06" + hsetprop ${scobj_hpath}/Temp6/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Temp6/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Temp6/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp6/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Temp6/setpoint type "drivable" + hsetprop ${scobj_hpath}/Temp6/setpoint nxalias "${name}_Temp6_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp6/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Temp6/setpoint + hsetprop ${scobj_hpath}/Temp6/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp6/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/Temp6 data "true" + hsetprop ${scobj_hpath}/Temp6 klass "@none" + hsetprop ${scobj_hpath}/Temp6 type "part" + if {[string equal -nocase [string index ${cards} 0] H] && [string equal -nocase [string index ${assoc} 5] 1]} { + ansto_makesctdrive ${name}_Temp6_setpoint ${scobj_hpath}/Temp6/setpoint ${scobj_hpath}/Temp6/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 6] T]} { + hfactory ${scobj_hpath}/Temp7 plain spy none + + hfactory ${scobj_hpath}/Temp7/nick plain user text + hsetprop ${scobj_hpath}/Temp7/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB7.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp7/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/nick control true + hsetprop ${scobj_hpath}/Temp7/nick data true + hsetprop ${scobj_hpath}/Temp7/nick mutable true + hsetprop ${scobj_hpath}/Temp7/nick nxsave true + hsetprop ${scobj_hpath}/Temp7/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp7/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp7/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp7/nick type "part" + hsetprop ${scobj_hpath}/Temp7/nick nxalias "${name}_Temp7_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp7/nick 15 + hsetprop ${scobj_hpath}/Temp7/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp7/nick simulated true + } + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/Temp7/power plain user float + hsetprop ${scobj_hpath}/Temp7/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB2.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/Temp7/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/power control true + hsetprop ${scobj_hpath}/Temp7/power data true + hsetprop ${scobj_hpath}/Temp7/power mutable true + hsetprop ${scobj_hpath}/Temp7/power nxsave true + hsetprop ${scobj_hpath}/Temp7/power oldval 0.0 + hsetprop ${scobj_hpath}/Temp7/power klass "parameter" + hsetprop ${scobj_hpath}/Temp7/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp7/power type "part" + hsetprop ${scobj_hpath}/Temp7/power nxalias "${name}_Temp7_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp7/power 5 + hsetprop ${scobj_hpath}/Temp7/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp7/power simulated true + } + } + + hfactory ${scobj_hpath}/Temp7/sensor plain user float + hsetprop ${scobj_hpath}/Temp7/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp7/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/sensor control true + hsetprop ${scobj_hpath}/Temp7/sensor data true + hsetprop ${scobj_hpath}/Temp7/sensor mutable true + hsetprop ${scobj_hpath}/Temp7/sensor nxsave true + hsetprop ${scobj_hpath}/Temp7/sensor permlink data_set "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/Temp7/sensor @description "T[format "%02d" ${id}]S07" + hsetprop ${scobj_hpath}/Temp7/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp7/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp7/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp7/sensor type "part" + hsetprop ${scobj_hpath}/Temp7/sensor nxalias "${name}_Temp7_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp7/sensor 1 + hsetprop ${scobj_hpath}/Temp7/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp7/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + hfactory ${scobj_hpath}/Temp7/setpoint plain user float + hsetprop ${scobj_hpath}/Temp7/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB7.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/Temp7/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB7.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/Temp7/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint driving 0 + hsetprop ${scobj_hpath}/Temp7/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp7/setpoint driveable Temp7/sensor + hsetprop ${scobj_hpath}/Temp7/setpoint control true + hsetprop ${scobj_hpath}/Temp7/setpoint data true + hsetprop ${scobj_hpath}/Temp7/setpoint mutable true + hsetprop ${scobj_hpath}/Temp7/setpoint nxsave true + hsetprop ${scobj_hpath}/Temp7/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Temp7/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Temp7/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/Temp7/setpoint permlink data_set "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/Temp7/setpoint @description "T[format "%02d" ${id}]SP07" + hsetprop ${scobj_hpath}/Temp7/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Temp7/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Temp7/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp7/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Temp7/setpoint type "drivable" + hsetprop ${scobj_hpath}/Temp7/setpoint nxalias "${name}_Temp7_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp7/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Temp7/setpoint + hsetprop ${scobj_hpath}/Temp7/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp7/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/Temp7 data "true" + hsetprop ${scobj_hpath}/Temp7 klass "@none" + hsetprop ${scobj_hpath}/Temp7 type "part" + if {[string equal -nocase [string index ${cards} 1] H] && [string equal -nocase [string index ${assoc} 6] 2]} { + ansto_makesctdrive ${name}_Temp7_setpoint ${scobj_hpath}/Temp7/setpoint ${scobj_hpath}/Temp7/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 7] T]} { + hfactory ${scobj_hpath}/Temp8 plain spy none + + hfactory ${scobj_hpath}/Temp8/nick plain user text + hsetprop ${scobj_hpath}/Temp8/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB8.T1:TEMP:NICK} + hsetprop ${scobj_hpath}/Temp8/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/nick control true + hsetprop ${scobj_hpath}/Temp8/nick data true + hsetprop ${scobj_hpath}/Temp8/nick mutable true + hsetprop ${scobj_hpath}/Temp8/nick nxsave true + hsetprop ${scobj_hpath}/Temp8/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Temp8/nick klass "parameter" + hsetprop ${scobj_hpath}/Temp8/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp8/nick type "part" + hsetprop ${scobj_hpath}/Temp8/nick nxalias "${name}_Temp8_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp8/nick 15 + hsetprop ${scobj_hpath}/Temp8/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp8/nick simulated true + } + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/Temp8/power plain user float + hsetprop ${scobj_hpath}/Temp8/power read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB3.H1:HTR:SIG:POWR} + hsetprop ${scobj_hpath}/Temp8/power rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/power control true + hsetprop ${scobj_hpath}/Temp8/power data true + hsetprop ${scobj_hpath}/Temp8/power mutable true + hsetprop ${scobj_hpath}/Temp8/power nxsave true + hsetprop ${scobj_hpath}/Temp8/power oldval 0.0 + hsetprop ${scobj_hpath}/Temp8/power klass "parameter" + hsetprop ${scobj_hpath}/Temp8/power sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp8/power type "part" + hsetprop ${scobj_hpath}/Temp8/power nxalias "${name}_Temp8_power" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp8/power 5 + hsetprop ${scobj_hpath}/Temp8/power simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp8/power simulated true + } + } + + hfactory ${scobj_hpath}/Temp8/sensor plain user float + hsetprop ${scobj_hpath}/Temp8/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:SIG:TEMP} + hsetprop ${scobj_hpath}/Temp8/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/sensor control true + hsetprop ${scobj_hpath}/Temp8/sensor data true + hsetprop ${scobj_hpath}/Temp8/sensor mutable true + hsetprop ${scobj_hpath}/Temp8/sensor nxsave true + hsetprop ${scobj_hpath}/Temp8/sensor permlink data_set "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/Temp8/sensor @description "T[format "%02d" ${id}]S08" + hsetprop ${scobj_hpath}/Temp8/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Temp8/sensor klass "parameter" + hsetprop ${scobj_hpath}/Temp8/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp8/sensor type "part" + hsetprop ${scobj_hpath}/Temp8/sensor nxalias "${name}_Temp8_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp8/sensor 1 + hsetprop ${scobj_hpath}/Temp8/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp8/sensor simulated true + } + + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + hfactory ${scobj_hpath}/Temp8/setpoint plain user float + hsetprop ${scobj_hpath}/Temp8/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB8.T1:TEMP:LOOP:TSET} + hsetprop ${scobj_hpath}/Temp8/setpoint rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint write ${ns}::setPoint ${scobj_hpath} noResponse {SET:DEV:DB8.T1:TEMP:LOOP:TSET:} + hsetprop ${scobj_hpath}/Temp8/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint driving 0 + hsetprop ${scobj_hpath}/Temp8/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Temp8/setpoint driveable Temp8/sensor + hsetprop ${scobj_hpath}/Temp8/setpoint control true + hsetprop ${scobj_hpath}/Temp8/setpoint data true + hsetprop ${scobj_hpath}/Temp8/setpoint mutable true + hsetprop ${scobj_hpath}/Temp8/setpoint nxsave true + hsetprop ${scobj_hpath}/Temp8/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Temp8/setpoint upperlimit 333 + hsetprop ${scobj_hpath}/Temp8/setpoint tolerance ${ttol} + hsetprop ${scobj_hpath}/Temp8/setpoint permlink data_set "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/Temp8/setpoint @description "T[format "%02d" ${id}]SP08" + hsetprop ${scobj_hpath}/Temp8/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Temp8/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Temp8/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Temp8/setpoint settle_time "15" + hsetprop ${scobj_hpath}/Temp8/setpoint type "drivable" + hsetprop ${scobj_hpath}/Temp8/setpoint nxalias "${name}_Temp8_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Temp8/setpoint 5 + ${sct_controller} write ${scobj_hpath}/Temp8/setpoint + hsetprop ${scobj_hpath}/Temp8/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Temp8/setpoint simulated true + } + } + hsetprop ${scobj_hpath}/Temp8 data "true" + hsetprop ${scobj_hpath}/Temp8 klass "@none" + hsetprop ${scobj_hpath}/Temp8 type "part" + if {[string equal -nocase [string index ${cards} 2] H] && [string equal -nocase [string index ${assoc} 7] 3]} { + ansto_makesctdrive ${name}_Temp8_setpoint ${scobj_hpath}/Temp8/setpoint ${scobj_hpath}/Temp8/sensor ${sct_controller} + } + } + + if {[string equal -nocase [string index ${cards} 3] V]} { + hfactory ${scobj_hpath}/Valve plain spy none + + hfactory ${scobj_hpath}/Valve/nick plain user text + hsetprop ${scobj_hpath}/Valve/nick read ${ns}::getValue ${scobj_hpath} rdText {READ:DEV:DB4.G1:AUX:NICK} + hsetprop ${scobj_hpath}/Valve/nick rdText ${ns}::rdText ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/nick control true + hsetprop ${scobj_hpath}/Valve/nick data true + hsetprop ${scobj_hpath}/Valve/nick mutable true + hsetprop ${scobj_hpath}/Valve/nick nxsave true + hsetprop ${scobj_hpath}/Valve/nick oldval UNKNOWN + hsetprop ${scobj_hpath}/Valve/nick klass "parameter" + hsetprop ${scobj_hpath}/Valve/nick sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Valve/nick type "part" + hsetprop ${scobj_hpath}/Valve/nick nxalias "${name}_Valve_nick" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Valve/nick 15 + hsetprop ${scobj_hpath}/Valve/nick simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Valve/nick simulated true + } + + hfactory ${scobj_hpath}/Valve/sensor plain user float + hsetprop ${scobj_hpath}/Valve/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN} + hsetprop ${scobj_hpath}/Valve/sensor rdValue ${ns}::rdValue ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/sensor control true + hsetprop ${scobj_hpath}/Valve/sensor data true + hsetprop ${scobj_hpath}/Valve/sensor mutable true + hsetprop ${scobj_hpath}/Valve/sensor nxsave true + hsetprop ${scobj_hpath}/Valve/sensor oldval 0.0 + hsetprop ${scobj_hpath}/Valve/sensor klass "parameter" + hsetprop ${scobj_hpath}/Valve/sensor sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Valve/sensor type "part" + hsetprop ${scobj_hpath}/Valve/sensor nxalias "${name}_Valve_sensor" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} poll ${scobj_hpath}/Valve/sensor 5 + hsetprop ${scobj_hpath}/Valve/sensor simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Valve/sensor simulated true + } + + hfactory ${scobj_hpath}/Valve/setpoint plain user float + hsetprop ${scobj_hpath}/Valve/setpoint write ${ns}::setValve ${scobj_hpath} noResponse {SET:DEV:DB4.G1:AUX:SIG:OPEN:} + hsetprop ${scobj_hpath}/Valve/setpoint noResponse ${ns}::noResponse ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/setpoint check ${ns}::checkrange ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/setpoint driving 0 + hsetprop ${scobj_hpath}/Valve/setpoint checklimits ${ns}::checklimits ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/setpoint halt ${ns}::halt ${scobj_hpath} + hsetprop ${scobj_hpath}/Valve/setpoint driveable Valve/sensor + hsetprop ${scobj_hpath}/Valve/setpoint control true + hsetprop ${scobj_hpath}/Valve/setpoint data true + hsetprop ${scobj_hpath}/Valve/setpoint mutable true + hsetprop ${scobj_hpath}/Valve/setpoint nxsave true + hsetprop ${scobj_hpath}/Valve/setpoint lowerlimit 0 + hsetprop ${scobj_hpath}/Valve/setpoint upperlimit 100 + hsetprop ${scobj_hpath}/Valve/setpoint tolerance ${vtol} + hsetprop ${scobj_hpath}/Valve/setpoint oldval 0.0 + hsetprop ${scobj_hpath}/Valve/setpoint klass "parameter" + hsetprop ${scobj_hpath}/Valve/setpoint sdsinfo "::nexus::scobj::sdsinfo" + hsetprop ${scobj_hpath}/Valve/setpoint settle_time "30" + hsetprop ${scobj_hpath}/Valve/setpoint type "drivable" + hsetprop ${scobj_hpath}/Valve/setpoint nxalias "${name}_Valve_setpoint" + + if {[string equal -nocase "${simulation_flag}" "false"]} { + ${sct_controller} write ${scobj_hpath}/Valve/setpoint + hsetprop ${scobj_hpath}/Valve/setpoint simulated false + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for oxford_mercury" + hsetprop ${scobj_hpath}/Valve/setpoint simulated true + } + hsetprop ${scobj_hpath}/Valve data "true" + hsetprop ${scobj_hpath}/Valve klass "@none" + hsetprop ${scobj_hpath}/Valve type "part" + ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller} + } + hsetprop ${scobj_hpath} klass ${device_class} + hsetprop ${scobj_hpath} data true + hsetprop ${scobj_hpath} debug_threshold 5 +# mkDriver hook code goes here + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +proc ::scobj::oxford_mercury::add_driver {name device_class simulation_flag ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set catch_status [ catch { + ::scobj::oxford_mercury::sics_log 9 "::scobj::oxford_mercury::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + if {[string equal -nocase "${simulation_flag}" "false"]} { + if {[string equal -nocase "aqadapter" "${ip_address}"]} { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" + makesctcontroller sct_${name} aqadapter ${tcp_port} + } else { + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}" + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } + } else { + ::scobj::oxford_mercury::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for oxford_mercury" + ::scobj::oxford_mercury::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } + ::scobj::oxford_mercury::sics_log 1 "::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol}" + ::scobj::oxford_mercury::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +namespace eval ::scobj::oxford_mercury { + namespace export debug_threshold + namespace export debug_log + namespace export sics_log + namespace export mkDriver + namespace export add_driver +} + +proc add_oxford_mercury {name ip_address tcp_port id {cards NNNNNNNN} {assoc 00000000} {ttol 1} {ptol 5} {vtol 5}} { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + ::scobj::oxford_mercury::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${cards} ${assoc} ${ttol} ${ptol} ${vtol} +} + +clientput "file evaluation of sct_oxford_mercury.tcl" +::scobj::oxford_mercury::sics_log 9 "file evaluation of sct_oxford_mercury.tcl" + +proc ::scobj::oxford_mercury::read_config {} { + set catch_status [ catch { + set ns "::scobj::oxford_mercury" + dict for {k u} $::config_dict { + if { [dict exists $u "implementation"] } { + set simulation_flag "[string tolower [SplitReply [environment_simulation]]]" + set device_class "environment" + if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { + continue + } + set enabled [string tolower [dict get $u "enabled"]] + if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { + continue + } + if { [dict exists $u "simulation_group"] } { + set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] + } + if { [dict exists $u "device_class"] } { + set device_class "[dict get $u "device_class"]" + } + set name [dict get $u name] + set implementation [dict get $u "implementation"] + if { !([dict exists $::config_dict $implementation]) } { + continue + } + set v [dict get $::config_dict $implementation] + if { !([dict exists $v "driver"]) } { + continue + } + if { [string equal -nocase [dict get $v "driver"] "oxford_mercury"] } { + if { ![string equal -nocase "${simulation_flag}" "false"] } { + set asyncqueue "null" + ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" + ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" + makesctcontroller sct_${name} aqadapter NULL + } elseif { [dict exists $v "asyncqueue"] } { + set asyncqueue [dict get $v "asyncqueue"] + if { [string equal -nocase ${asyncqueue} "sct"] } { + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + makesctcontroller sct_${name} std ${ip_address}:${tcp_port} + } else { + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + } else { + if { [dict exists $v "asyncprotocol"] } { + set asyncprotocol [dict get $v "asyncprotocol"] + } else { + set asyncprotocol ${name}_protocol + MakeAsyncProtocol ${asyncprotocol} + if { [dict exists $v "sendterminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} sendterminator "[dict get $v "terminator"]" + } + if { [dict exists $v "replyterminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" + } elseif { [dict exists $v "terminator"] } { + ${asyncprotocol} replyterminator "[dict get $v "terminator"]" + } + } + set asyncqueue ${name}_queue + set ip_address [dict get $v ip] + set tcp_port [dict get $v port] + MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} + if { [dict exists $v "timeout"] } { + ${asyncqueue} timeout "[dict get $v "timeout"]" + } + makesctcontroller sct_${name} aqadapter ${asyncqueue} + } + set arg_list [list] + set missing_list [list] + array unset default_map + array set default_map [list cards NNNNNNNN assoc 00000000 ttol 1 ptol 5 vtol 5] + foreach arg {id cards assoc ttol ptol vtol} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $arg]" + } elseif {[info exists default_map($arg)]} { + lappend arg_list $default_map($arg) + } else { + ${ns}::sics_log 9 "Missing configuration value $arg" + lappend missing_list $arg + } + } + if { [llength $missing_list] > 0 } { + error "$name is missing configuration values $missing_list" + } + ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list + } + } + } + } catch_message ] + handle_exception ${catch_status} ${catch_message} +} + +if { [info exists ::config_dict] } { + ::scobj::oxford_mercury::read_config +} else { + ::scobj::oxford_mercury::sics_log 5 "No config dict" +}