diff --git a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl index c4f7c720..b9b05149 100644 --- a/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl +++ b/site_ansto/instrument/config/environment/magneticField/sct_tsi_smc.tcl @@ -263,8 +263,8 @@ proc ::scobj::tsi_smc::setValue {tc_root nextState cmd_str} { handle_exception ${catch_status} ${catch_message} } -proc ::scobj::tsi_smc::mkDriver { sct_controller name } { - ::scobj::tsi_smc::sics_log 9 "::scobj::tsi_smc::mkDriver for ${name}" +proc ::scobj::tsi_smc::mkDriver { sct_controller name id } { + ::scobj::tsi_smc::sics_log 9 "::scobj::tsi_smc::mkDriver ${sct_controller} ${name} ${id}" set ns "[namespace current]" set catch_status [ catch { @@ -303,6 +303,8 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name } { hsetprop ${scobj_hpath}/value data true hsetprop ${scobj_hpath}/value mutable false hsetprop ${scobj_hpath}/value nxsave true + hsetprop ${scobj_hpath}/value permlink data_set "B[format "%02d" ${id}]S01" + hsetprop ${scobj_hpath}/value @description "B[format "%02d" ${id}]S01" hsetprop ${scobj_hpath}/value oldval 0.0 hsetprop ${scobj_hpath}/value sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/value type "part" @@ -416,6 +418,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name } { hsetprop ${scobj_hpath}/b/Lower oldval 0.0 hsetprop ${scobj_hpath}/b/Lower sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/b/Lower type "part" + hsetprop ${scobj_hpath}/b/Lower units "A" hsetprop ${scobj_hpath}/b/Lower nxalias "${name}_b_Lower" hfactory ${scobj_hpath}/b/Pause plain user int @@ -488,9 +491,9 @@ namespace eval ::scobj::tsi_smc { namespace export mkDriver } -proc add_tsi_smc {name IP port} { +proc add_tsi_smc {name IP port {id 1}} { set catch_status [ catch { - ::scobj::tsi_smc::sics_log 9 "add_tsi_smc ${name} ${IP} ${port}" + ::scobj::tsi_smc::sics_log 9 "add_tsi_smc ${name} ${IP} ${port} ${id}" if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} { if {[string equal -nocase "aqadapter" "${IP}"]} { ::scobj::tsi_smc::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}" @@ -502,8 +505,8 @@ proc add_tsi_smc {name IP port} { } else { ::scobj::tsi_smc::sics_log 9 "[environment_simulation] => No sctcontroller for tsi_smc" } - ::scobj::tsi_smc::sics_log 1 "::scobj::tsi_smc::mkDriver sct_${name} ${name}" - ::scobj::tsi_smc::mkDriver sct_${name} ${name} + ::scobj::tsi_smc::sics_log 1 "::scobj::tsi_smc::mkDriver sct_${name} ${name} ${id}" + ::scobj::tsi_smc::mkDriver sct_${name} ${name} ${id} } catch_message ] handle_exception ${catch_status} ${catch_message} } @@ -561,10 +564,25 @@ proc ::scobj::tsi_smc::read_config {} { ${asyncqueue} timeout "[dict get $v "timeout"]" } } + set arg_list [list] + set missing_list [list] + foreach arg {id} { + if {[dict exists $u $arg]} { + lappend arg_list "[dict get $u $arg]" + } elseif {[dict exists $v $arg]} { + lappend arg_list "[dict get $v $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" + } if { [string equal -nocase ${asyncqueue} "sct"] } { - add_tsi_smc ${name} ${IP} ${PORT} + add_tsi_smc ${name} ${IP} ${PORT} {*}$arg_list } else { - add_tsi_smc ${name} "aqadapter" ${asyncqueue} + add_tsi_smc ${name} "aqadapter" ${asyncqueue} {*}$arg_list } } } diff --git a/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct b/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct index 7a614888..a5a76759 100644 --- a/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct +++ b/site_ansto/instrument/config/environment/magneticField/tsi_smc.sct @@ -4,6 +4,8 @@ driver tsi_smc = { device = Superconducting_Magnet_Controller; protocol = std; class = environment; simulation_group = environment_simulation; + add_args = '{id 1}'; + make_args = 'id'; group = { priv = user; @@ -13,7 +15,7 @@ driver tsi_smc = { data = true; nxsave = true; - var 'value'; + var 'value' = {permlink = 'B.S01'}; var setpoint = { writeable = 1; write_function = setGauss; diff --git a/site_ansto/instrument/sans/quokka_configuration.tcl b/site_ansto/instrument/sans/quokka_configuration.tcl index 9b69af8e..6bdce7e5 100644 --- a/site_ansto/instrument/sans/quokka_configuration.tcl +++ b/site_ansto/instrument/sans/quokka_configuration.tcl @@ -63,7 +63,7 @@ fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(anticollider)/anticollider.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl fileeval $cfPath(environment)/temperature/sct_qlink.tcl -#fileeval $cfPath(environment)/magneticField/sct_oxford_ips.tcl +fileeval $cfPath(environment)/magneticField/sct_tsi_smc.tcl fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl fileeval $cfPath(environment)/magneticField/oxford_labview.tcl fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl