Pullback from Quokka 2015-02-18

This commit is contained in:
Douglas Clowes
2015-02-18 14:14:11 +11:00
parent 042119898d
commit 4619a57eff
12 changed files with 187 additions and 101 deletions

View File

@ -1366,88 +1366,5 @@ proc add_bruker_bec1 {name IP port {_tol 0.1} {CID 1} {CTYPE B} } {
handle_exception $catch_status $message "In subroutine add_bruker_bec1()."
}
namespace eval ::scobj::bruker_bec1 {
set debug_threshold 5
}
proc ::scobj::bruker_bec1::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::bruker_bec1::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::bruker_bec1::${debug_string}"
}
} catch_message ]
}
clientput "file evaluation of sct_bruker_bec1.tcl"
::scobj::bruker_bec1::sics_log 9 "file evaluation of sct_bruker_bec1.tcl"
proc ::scobj::bruker_bec1::read_config {} {
set catch_status [ catch {
set ns "::scobj::bruker_bec1"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "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"] "bruker_bec1"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "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"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
foreach arg {tol id type} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
}
add_bruker_bec1 ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::bruker_bec1::read_config
} else {
::scobj::bruker_bec1::sics_log 5 "No config dict"
}
namespace import ::scobj::bruker_BEC1::*

View File

@ -289,7 +289,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl
hsetprop ${scobj_hpath}/setpoint mutable true
hsetprop ${scobj_hpath}/setpoint nxsave true
hsetprop ${scobj_hpath}/setpoint lowerlimit 0
hsetprop ${scobj_hpath}/setpoint upperlimit 500.0
hsetprop ${scobj_hpath}/setpoint upperlimit 15000.0
hsetprop ${scobj_hpath}/setpoint tolerance 10
hsetprop ${scobj_hpath}/setpoint permlink data_set "B[format "%02d" ${id}]SP01"
hsetprop ${scobj_hpath}/setpoint @description "B[format "%02d" ${id}]SP01"
@ -429,7 +429,7 @@ proc ::scobj::tsi_smc::mkDriver { sct_controller name device_class simulation_fl
hsetprop ${scobj_hpath}/b/Lower mutable true
hsetprop ${scobj_hpath}/b/Lower nxsave true
hsetprop ${scobj_hpath}/b/Lower lowerlimit 0
hsetprop ${scobj_hpath}/b/Lower upperlimit 2
hsetprop ${scobj_hpath}/b/Lower upperlimit 60
hsetprop ${scobj_hpath}/b/Lower oldval 0.0
hsetprop ${scobj_hpath}/b/Lower klass "parameter"
hsetprop ${scobj_hpath}/b/Lower sdsinfo "::nexus::scobj::sdsinfo"

View File

@ -176,6 +176,35 @@ proc ::scobj::hiden_xcs::fetch_flow {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::hiden_xcs::getTarget {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "getTarget tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# getTarget hook code starts
if { [hpropexists [sct] target] } {
sct result [sct target]
} else {
sct result [hval [sct]]
}
set cmd "@@NOSEND@@"
# getTarget hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
debug_log ${tc_root} 1 "getTarget 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 request the read of a parameter on a device
proc ::scobj::hiden_xcs::getValue {tc_root nextState cmd_str} {
set catch_status [ catch {
@ -254,16 +283,20 @@ proc ::scobj::hiden_xcs::pid_flow {tc_root sp pv} {
set p_value [expr {[sct pid_pvalue] * [sct pid_error]}]
set d_value [expr {[sct pid_dvalue] * (${pv} - [sct oldval])}]
sct pid_deriv [sct pid_error]
sct pid_integ [expr {[sct pid_integ] + [sct pid_error]}]
sct pid_integ [expr {[sct pid_integ] + [sct pid_error] * [sct pid_ivalue]}]
if { [sct pid_integ] > [sct pid_imax] } {
sct pid_integ [sct pid_imax]
}
if { [sct pid_integ] < -[sct pid_imax] } {
sct pid_integ -[sct pid_imax]
}
set i_value [expr {[sct pid_ivalue] * [sct pid_integ]}]
set i_value [sct pid_integ]
set pid [expr {${p_value} + ${i_value} + ${d_value}}]
# pid_flow hook code starts
if { ![hval ${tc_root}/auto] } {
set pid 0.0
sct pid_integ 0.0
}
foreach node [list ${tc_root}/analog/sp1 ${tc_root}/analog/sp2] {
if { !([hpropexists ${node} bias_flow] && [hgetpropval ${node} bias_flow] == ${pid}) } {
hsetprop ${node} bias_flow ${pid}
@ -289,16 +322,20 @@ proc ::scobj::hiden_xcs::pid_humidity {tc_root sp pv} {
set p_value [expr {[sct pid_pvalue] * [sct pid_error]}]
set d_value [expr {[sct pid_dvalue] * (${pv} - [sct oldval])}]
sct pid_deriv [sct pid_error]
sct pid_integ [expr {[sct pid_integ] + [sct pid_error]}]
sct pid_integ [expr {[sct pid_integ] + [sct pid_error] * [sct pid_ivalue]}]
if { [sct pid_integ] > [sct pid_imax] } {
sct pid_integ [sct pid_imax]
}
if { [sct pid_integ] < -[sct pid_imax] } {
sct pid_integ -[sct pid_imax]
}
set i_value [expr {[sct pid_ivalue] * [sct pid_integ]}]
set i_value [sct pid_integ]
set pid [expr {${p_value} + ${i_value} + ${d_value}}]
# pid_humidity hook code starts
if { ![hval ${tc_root}/auto] } {
set pid 0.0
sct pid_integ 0.0
}
set sign 1
foreach node [list ${tc_root}/analog/sp1 ${tc_root}/analog/sp2] {
set sign [expr -${sign}]
@ -757,6 +794,19 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/auto plain user int
hsetprop ${scobj_hpath}/auto control true
hsetprop ${scobj_hpath}/auto data true
hsetprop ${scobj_hpath}/auto mutable true
hsetprop ${scobj_hpath}/auto nxsave true
hsetprop ${scobj_hpath}/auto values 0,1
hsetprop ${scobj_hpath}/auto oldval 0
hset ${scobj_hpath}/auto 0
hsetprop ${scobj_hpath}/auto klass "environment"
hsetprop ${scobj_hpath}/auto sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/auto type "part"
hsetprop ${scobj_hpath}/auto nxalias "${name}_auto"
hfactory ${scobj_hpath}/enabled plain user int
hsetprop ${scobj_hpath}/enabled read ${ns}::getValue ${scobj_hpath} read_digital {?DOUT,2}
hsetprop ${scobj_hpath}/enabled read_digital ${ns}::read_digital ${scobj_hpath}
@ -1021,15 +1071,17 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/flow/sensor pid_deriv "0"
hsetprop ${scobj_hpath}/flow/sensor pid_dvalue "0.0"
hsetprop ${scobj_hpath}/flow/sensor pid_error "0"
hsetprop ${scobj_hpath}/flow/sensor pid_imax "30"
hsetprop ${scobj_hpath}/flow/sensor pid_imax "50"
hsetprop ${scobj_hpath}/flow/sensor pid_integ "0"
hsetprop ${scobj_hpath}/flow/sensor pid_ivalue "0.1"
hsetprop ${scobj_hpath}/flow/sensor pid_pvalue "0.2"
hsetprop ${scobj_hpath}/flow/sensor pid_pvalue "0.1"
hsetprop ${scobj_hpath}/flow/sensor sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/flow/sensor type "part"
hsetprop ${scobj_hpath}/flow/sensor nxalias "${name}_flow_sensor"
hfactory ${scobj_hpath}/flow/setpoint plain user float
hsetprop ${scobj_hpath}/flow/setpoint read ${ns}::getTarget ${scobj_hpath} rdValue {@}
hsetprop ${scobj_hpath}/flow/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/flow/setpoint write ${ns}::write_flow ${scobj_hpath} noResponse {}
hsetprop ${scobj_hpath}/flow/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/flow/setpoint check ${ns}::checkrange ${scobj_hpath}
@ -1056,6 +1108,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/flow/sensor 1
${sct_controller} poll ${scobj_hpath}/flow/setpoint 1
${sct_controller} write ${scobj_hpath}/flow/setpoint
} else {
::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"
@ -1081,15 +1134,17 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/humidity/sensor pid_deriv "0"
hsetprop ${scobj_hpath}/humidity/sensor pid_dvalue "0.0"
hsetprop ${scobj_hpath}/humidity/sensor pid_error "0"
hsetprop ${scobj_hpath}/humidity/sensor pid_imax "30"
hsetprop ${scobj_hpath}/humidity/sensor pid_imax "20"
hsetprop ${scobj_hpath}/humidity/sensor pid_integ "0"
hsetprop ${scobj_hpath}/humidity/sensor pid_ivalue "0.1"
hsetprop ${scobj_hpath}/humidity/sensor pid_pvalue "0.2"
hsetprop ${scobj_hpath}/humidity/sensor pid_pvalue "1.0"
hsetprop ${scobj_hpath}/humidity/sensor sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/humidity/sensor type "part"
hsetprop ${scobj_hpath}/humidity/sensor nxalias "${name}_humidity_sensor"
hfactory ${scobj_hpath}/humidity/setpoint plain user float
hsetprop ${scobj_hpath}/humidity/setpoint read ${ns}::getTarget ${scobj_hpath} rdValue {@}
hsetprop ${scobj_hpath}/humidity/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity/setpoint write ${ns}::write_humidity ${scobj_hpath} noResponse {}
hsetprop ${scobj_hpath}/humidity/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/humidity/setpoint check ${ns}::chkrange_function ${scobj_hpath}
@ -1102,8 +1157,8 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
hsetprop ${scobj_hpath}/humidity/setpoint data true
hsetprop ${scobj_hpath}/humidity/setpoint mutable true
hsetprop ${scobj_hpath}/humidity/setpoint nxsave true
hsetprop ${scobj_hpath}/humidity/setpoint lowerlimit 10
hsetprop ${scobj_hpath}/humidity/setpoint upperlimit 90
hsetprop ${scobj_hpath}/humidity/setpoint lowerlimit 0
hsetprop ${scobj_hpath}/humidity/setpoint upperlimit 100
hsetprop ${scobj_hpath}/humidity/setpoint tolerance 1
hsetprop ${scobj_hpath}/humidity/setpoint permlink data_set "G[format "%02d" ${id}]SP02"
hsetprop ${scobj_hpath}/humidity/setpoint @description "G[format "%02d" ${id}]SP02"
@ -1116,6 +1171,7 @@ proc ::scobj::hiden_xcs::mkDriver { sct_controller name device_class simulation_
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/humidity/sensor 1
${sct_controller} poll ${scobj_hpath}/humidity/setpoint 1
${sct_controller} write ${scobj_hpath}/humidity/setpoint
} else {
::scobj::hiden_xcs::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for hiden_xcs"

View File

@ -439,3 +439,88 @@ proc add_julabo_lh45 { name IP port {sensor "bath"} {_tol 5.0} {CID 1} {CTYPE T}
}
makesctemon $name /sics/$name/emon/monmode /sics/$name/emon/isintol /sics/$name/emon/errhandler
}
namespace eval ::scobj::julabo_lh45 {
set debug_threshold 5
}
proc ::scobj::julabo_lh45::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::julabo_lh45::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::julabo_lh45::${debug_string}"
}
} catch_message ]
}
clientput "file evaluation of sct_julabo_lh45.tcl"
::scobj::julabo_lh45::sics_log 9 "file evaluation of sct_julabo_lh45.tcl"
proc ::scobj::julabo_lh45::read_config {} {
set catch_status [ catch {
set ns "::scobj::julabo_lh45"
dict for {k v} $::config_dict {
if { [dict exists $v "implementation"] } {
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
continue
}
set name [dict get $v name]
set enabled [string tolower [dict get $v "enabled"]]
set implementation [dict get $v "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"] "julabo_lh45"] } {
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "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"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set IP [dict get $v ip]
set PORT [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
}
set arg_list [list]
foreach arg {ctrl_sensor tol id type} {
if {[dict exists $v $arg]} {
lappend arg_list "[dict get $v $arg]"
} else {
${ns}::sics_log 9 "Missing configuration value $arg"
error "Missing configuration value $arg"
}
}
add_julabo_lh45 ${name} "aqadapter" ${asyncqueue} {*}$arg_list
}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::julabo_lh45::read_config
} else {
::scobj::julabo_lh45::sics_log 5 "No config dict"
}

View File

@ -452,7 +452,7 @@ proc ::scobj::julabo_lh45_gen::mkDriver { sct_controller name device_class simul
hsetprop ${scobj_hpath}/setpoint data true
hsetprop ${scobj_hpath}/setpoint mutable true
hsetprop ${scobj_hpath}/setpoint nxsave true
hsetprop ${scobj_hpath}/setpoint lowerlimit 10
hsetprop ${scobj_hpath}/setpoint lowerlimit -20
hsetprop ${scobj_hpath}/setpoint upperlimit 90
hsetprop ${scobj_hpath}/setpoint tolerance ${tol}
hsetprop ${scobj_hpath}/setpoint permlink data_set "T[format "%02d" ${id}]SP01"

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

@ -1471,6 +1471,26 @@ sicslist setatt ::histogram_memory::ratemap_xy_total klass detector
sicslist setatt ::histogram_memory::ratemap_xy_total long_name total_maprate
sicslist setatt ::histogram_memory::ratemap_xy_total mutable true
# Returns 0 If all trips acknowledged, -n if n trips unacknowledged, +n if too many acks?
::utility::macro::getset float ::histogram_memory::reset_trip {args} {
set num_trips [ SplitReply [hmm configure detector_protect_num_trip] ]
set num_acks [ SplitReply [hmm configure detector_protect_num_trip_ack] ]
set trip_cnt_diff [expr {$num_acks - $num_trips}]
if {$args == ""} {
return "reset_trip = $trip_cnt_diff"
} else {
if {$trip_cnt_diff != 0} {
hmm configure fat_detector_protect_num_trip_ack $num_trips
hmm astop
wait 2
hmm init
}
}
}
sicslist setatt ::histogram_memory::reset_trip klass detector
sicslist setatt ::histogram_memory::reset_trip long_name reset_trip
sicslist setatt ::histogram_memory::reset_trip data false
##
# @brief Update the beam monitors when the histmem has finished counting.
proc ::histogram_memory::countend_event {} {

View File

@ -33,8 +33,12 @@ proc ::scobj::antonparr_MCR500::mkDriver { speed_name torque_name tol settle } {
set catch_status [ catch {
# mkDriver hook code starts
if [::utility::obj_exists $speed_name] {
add_rheo $speed_name $tol $settle
}
if [::utility::obj_exists $torque_name] {
add_rheo $torque_name $tol $settle
}
# mkDriver hook code ends
} catch_message ]
handle_exception ${catch_status} ${catch_message}

View File

@ -100,4 +100,5 @@ proc add_rheo {rhControl tol settle} {
hfactory /sics/$rhControl/settletime plain user float
hset /sics/$rhControl/settletime $settle
hsetprop /sics/$rhControl timecheck 0
hsetprop /sics/$rhControl callBack "rhCallBack /sics/$rhControl"
}

View File

@ -718,7 +718,7 @@ Motor apx $motor_driver_type [params \
axis E\
units mm\
hardlowerlim -260\
hardupperlim 5\
hardupperlim 45\
maxSpeed 5\
maxAccel 5\
maxDecel 5\
@ -730,7 +730,7 @@ apx part collimator
apx long_name apx
apx home 0
apx softlowerlim -255
apx softupperlim 5
apx softupperlim 45
apx speed 5
# Sample aperture y

View File

@ -61,12 +61,15 @@ fileeval $cfPath(hmm)/detector.tcl
fileeval $cfPath(scan)/scan.tcl
fileeval $cfPath(commands)/commands.tcl
fileeval $cfPath(anticollider)/anticollider.tcl
fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl
fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl
fileeval $cfPath(environment)/temperature/sct_qlink.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_oxford12tlv.tcl
fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl
fileeval $cfPath(environment)/magneticField/sct_bruker.tcl
fileeval $cfPath(beamline)/sct_he3_polanal.tcl
fileeval $cfPath(environment)/environment.tcl
fileeval $cfPath(environment)/sct_rheometer.tcl
fileeval $cfPath(environment)/sct_antonparr_MCR500.tcl