From 8c4eed9bfe25fd0e1e38abd7936d5e5ff4fa7607 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Thu, 19 Feb 2015 09:40:49 +1100 Subject: [PATCH] Merged changes from Quokka as at 2015-02-18 --- .../temperature/sct_julabo_lh45.tcl | 85 +++++++++++++++++++ .../temperature/sct_lakeshore_370.tcl | 2 +- .../config/hmm/hmm_configuration_common_1.tcl | 20 +++++ .../environment/sct_antonparr_MCR500.tcl | 4 + .../sans/config/environment/sct_rheometer.tcl | 1 + .../config/motors/motor_configuration.tcl | 4 +- 6 files changed, 113 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl index 9dfb08ca..5c21a3e6 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_julabo_lh45.tcl @@ -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" +} + + diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl index 74233b4a..6fe63945 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_370.tcl @@ -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" diff --git a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl index 24d0b707..af8c09f3 100644 --- a/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl +++ b/site_ansto/instrument/config/hmm/hmm_configuration_common_1.tcl @@ -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 {} { diff --git a/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl b/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl index bd93bd8c..3dae5815 100644 --- a/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl +++ b/site_ansto/instrument/sans/config/environment/sct_antonparr_MCR500.tcl @@ -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} diff --git a/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl b/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl index 7c2f49e7..463214f7 100644 --- a/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl +++ b/site_ansto/instrument/sans/config/environment/sct_rheometer.tcl @@ -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" } diff --git a/site_ansto/instrument/sans/config/motors/motor_configuration.tcl b/site_ansto/instrument/sans/config/motors/motor_configuration.tcl index 846db865..e765bdff 100644 --- a/site_ansto/instrument/sans/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/sans/config/motors/motor_configuration.tcl @@ -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