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 } } }