Pullback from Pelican 2015-02-19

This commit is contained in:
Douglas Clowes
2015-02-19 11:24:44 +11:00
parent 16ad9ed8e2
commit 40d2a1e2f4
5 changed files with 291 additions and 146 deletions

View File

@ -10,9 +10,12 @@ proc ::scobj::lakeshore_218::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 fd [open "../log/lakeshore_218_[basename ${tc_root}].log" "a"]
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
puts ${fd} "${line}"
set now [clock seconds]
set ts [clock format ${now} -format "%Y%m%d"]
set log_file_name "../log/lakeshore_218_[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 ]
@ -62,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
@ -133,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 {
@ -157,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 {
@ -170,149 +206,219 @@ 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"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/krdg 1
hsetprop ${scobj_hpath}/krdg simulated false
} else {
::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218"
hsetprop ${scobj_hpath}/krdg simulated true
}
hsetprop ${scobj_hpath} data "false"
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/krdg 1
} else {
::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218"
hfactory ${scobj_hpath}/sensor plain spy none
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 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 plain spy none
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 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
}
}
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 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
}
}
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 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
}
}
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 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
}
}
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 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
}
}
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 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
}
}
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 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"
hsetprop ${scobj_hpath}/sensor type "part"
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"
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"
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"
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"
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"
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"
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"
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/ch1 1
${sct_controller} poll ${scobj_hpath}/sensor/ch2 1
${sct_controller} poll ${scobj_hpath}/sensor/ch3 1
${sct_controller} poll ${scobj_hpath}/sensor/ch4 1
${sct_controller} poll ${scobj_hpath}/sensor/ch5 1
${sct_controller} poll ${scobj_hpath}/sensor/ch6 1
${sct_controller} poll ${scobj_hpath}/sensor/ch7 1
${sct_controller} poll ${scobj_hpath}/sensor/ch8 1
} else {
::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for lakeshore_218"
}
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
@ -323,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}"
@ -333,10 +439,12 @@ proc ::scobj::lakeshore_218::add_driver {name device_class simulation_flag ip_ad
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::lakeshore_218::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for lakeshore_218"
::scobj::lakeshore_218::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for lakeshore_218"
::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}
}
@ -351,7 +459,7 @@ namespace eval ::scobj::lakeshore_218 {
proc add_lakeshore_218 {name ip_address tcp_port} {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::lakeshore_218::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
::scobj::lakeshore_218::add_driver ${name} "NXdetector" ${simulation_flag} ${ip_address} ${tcp_port}
}
clientput "file evaluation of sct_lakeshore_218.tcl"
@ -390,20 +498,31 @@ proc ::scobj::lakeshore_218::read_config {} {
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 "terminator"] } {
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"]"
}
}
@ -414,12 +533,28 @@ proc ::scobj::lakeshore_218::read_config {} {
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
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
}
}
}

View File

@ -50,7 +50,7 @@ namespace eval ::scobj::[set vendor]_[set device] {
proc debug_log {debug_level arg_string} {
# write a timestamped string message to a log file for debugging
set debug_threshold 0
set debug_threshold 5
if {$debug_level >= $debug_threshold} {
set fd [open "[set [namespace current]::log_file]" "a"]
set line "[clock format [clock seconds] -format "%T"] $arg_string"

View File

@ -58,7 +58,7 @@ namespace eval ::scobj::[set vendor]_[set device] {
proc debug_log {debug_level arg_string} {
# write a timestamped string message to a log file for debugging
set debug_threshold 0
set debug_threshold 5
if {$debug_level >= $debug_threshold} {
set fd [open "[set [namespace current]::log_file]" "a"]
set line "[clock format [clock seconds] -format "%T"] $arg_string"

View File

@ -910,7 +910,7 @@ proc get_vei {} {
proc set_vwi {wavelength} {
set dd 3.35416
set theta [expr (180.0 / 3.141592654) * asin($wavelength / (2.0 * $dd))]
set result [format "moma=%f,momb=%f,momc=%f,mtth=%f" $theta $theta $theta [expr 2.0 * $theta]]
set result [format "moma=%f,momb=%f,momc=%f,mtth=%f" -$theta -$theta -$theta [expr 2.0 * $theta]]
return $result
}
@ -930,10 +930,15 @@ vwi drivescript set_vwi
sicslist setatt vwi units Angstrom
sicslist setatt vwi klass crystal
sicslist setatt vwi long_name wavelength
sicslist setatt vwi hdbchain mtth
MakeConfigurableMotor vei
vei readscript get_vei
vei drivescript set_vei
sicslist setatt vei units mEv
sicslist setatt vei klass crystal
sicslist setatt vei long_name energy
sicslist setatt vei hdbchain mtth
publish get_vwi user
publish set_vwi user

View File

@ -117,3 +117,8 @@ server_init
# WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly.
# You can add extra-configuration code in ../extraconfig.tcl
# Update chopper speed and phase if a stop or idle command is issued.
sicspoll add /instrument/fermi_chopper/mchs hdb 5
sicspoll add /instrument/fermi_chopper/mchp hdb 5
sicspoll add /instrument/fermi_chopper/schs hdb 5
sicspoll add /instrument/fermi_chopper/schp hdb 5