From c30ce9c5a0f47ac8aa685285081818e42c926d40 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 25 Sep 2008 08:47:12 +1000 Subject: [PATCH] Added west400.tcl config to wombat config/environment/temperature util/utility.tcl The 'setpoint_script' for temperature controllers is now generated by '::utility::macro::getset' r2706 | ffr | 2008-09-25 08:47:12 +1000 (Thu, 25 Sep 2008) | 5 lines --- .../environment/temperature/west400.tcl | 53 +++++++++++++++++++ .../config/motors/motor_configuration.tcl | 6 +-- .../instrument/hipd/wombat_configuration.tcl | 5 +- site_ansto/instrument/util/utility.tcl | 50 ++++++----------- 4 files changed, 74 insertions(+), 40 deletions(-) create mode 100644 site_ansto/instrument/hipd/config/environment/temperature/west400.tcl diff --git a/site_ansto/instrument/hipd/config/environment/temperature/west400.tcl b/site_ansto/instrument/hipd/config/environment/temperature/west400.tcl new file mode 100644 index 00000000..481d6a23 --- /dev/null +++ b/site_ansto/instrument/hipd/config/environment/temperature/west400.tcl @@ -0,0 +1,53 @@ +# $Revision: 1.1 $ +# $Date: 2008-09-24 22:47:11 $ +# Author: Ferdi Franceschini (ffr@ansto.gov.au) +# Last revision by: $Author: ffr $ + +namespace eval ::environment::temperature { } + +# @brief Make a simulated temperature controller object. +# +# @param temp_sobj, name for temperature controller object. +proc ::environment::temperature::mkwest400sim {temp_sobj} { + EvFactory new $temp_sobj sim + sicslist setatt $temp_sobj numsensors 1 + sicslist setatt $temp_sobj controlsensor sensora + sicslist setatt $temp_sobj sensorlist sensora + sicslist setatt $temp_sobj units kelvin + sicslist setatt $temp_sobj klass @none +} + +#WEST4100 tempcontroller creation +proc ::environment::temperature::mkwest400 {temp_sobj} { +MakeRS232Controller sertemp 137.157.201.88 502 +sertemp timeout 300 +sertemp sendterminator 0x0 +sertemp replyterminator 0x0 +EvFactory new tc1 west4100 sertemp 1 2 + +sicslist setatt tc1 units kelvin +sicslist setatt tc1 klass @none +} + +# @brief Adds a west400 temperature controller object. +# +# This must be called when the instrument configuration is loaded and before\n +# the buildHDB function is called. Currently there is no way to add and remove\n +# environment controllers and their hdb paths at runtime. +proc ::environment::temperature::add_west400 {} { + set sim_mode [SplitReply [environment_simulation]] + if {$sim_mode == "true"} { + ::environment::temperature::mkwest400sim tc1 + } else { + ::environment::temperature::mkwest400 tc1 + tc1 Upperlimit 1500 + tc1 Lowerlimit 0 + tc1 tolerance 10 + } + + sicslist setatt tc1 environment_name tempone + sicslist setatt tc1 long_name control_sensor_reading +::environment::mkenvinfo tc1 {ramprate {priv user} powerlimit {priv manager} } +#::environment::mkenvinfo tc1 {heateron {priv user} range {priv manager} } + +} diff --git a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl index 61414ecd..77d23f9c 100644 --- a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl @@ -344,8 +344,8 @@ Motor som $motor_driver_type [params \ asyncqueue mc2\ axis E\ units degrees\ - hardlowerlim -60\ - hardupperlim 60\ + hardlowerlim -110\ + hardupperlim 110\ maxSpeed 1\ maxAccel 1\ maxDecel 1\ @@ -353,7 +353,7 @@ Motor som $motor_driver_type [params \ absEnc 1\ absEncHome $som_Home\ cntsPerX 4096] -setHomeandRange -motor som -home 0 -lowrange 60 -uprange 60 +setHomeandRange -motor som -home 0 -lowrange 80 -uprange 60 som speed 1 som precision 0.01 som part sample diff --git a/site_ansto/instrument/hipd/wombat_configuration.tcl b/site_ansto/instrument/hipd/wombat_configuration.tcl index af970183..31dee60f 100644 --- a/site_ansto/instrument/hipd/wombat_configuration.tcl +++ b/site_ansto/instrument/hipd/wombat_configuration.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.26 $ -# $Date: 2008-09-18 02:20:09 $ +# $Revision: 1.27 $ +# $Date: 2008-09-24 22:47:11 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: ffr $ @@ -45,6 +45,7 @@ catch { ::anticollider::init # ::environment::temperature::add_ls340 tc1 1 # ::environment::temperature::add_ls340 tc2 2 +# ::environment::temperature::add_west400 server_init if [file exists ../extraconfig.tcl] { diff --git a/site_ansto/instrument/util/utility.tcl b/site_ansto/instrument/util/utility.tcl index d6f47c56..0ff710ac 100644 --- a/site_ansto/instrument/util/utility.tcl +++ b/site_ansto/instrument/util/utility.tcl @@ -1,7 +1,7 @@ # Some useful functions for SICS configuration. -# $Revision: 1.16 $ -# $Date: 2008-08-29 12:14:19 $ +# $Revision: 1.17 $ +# $Date: 2008-09-24 22:47:12 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by $Author: ffr $ @@ -117,39 +117,19 @@ proc ::environment::mkenvinfo {sobj paramlist} { # } set setpoint_script ::environment::${sobj}_setpoint - proc $setpoint_script [subst {{val "@none"} {_sobj $sobj}}] { - if [catch { - if {[SplitReply [environment_simulation]]=="true"} { - if {$val=="@none"} { - return [SplitReply [${_sobj}]] - } else { - ${_sobj} $val - } - } else { - if {$val=="@none"} { - return [SplitReply [${_sobj} setpoint]] - } else { - ${_sobj} $val - } - } - } message ] { - if {$::errorCode == "NONE"} {return $message} - return -code error $message - } - } - publish $setpoint_script user - sicslist setatt $setpoint_script privilege internal - sicslist setatt $setpoint_script access rw - sicslist setatt $setpoint_script long_name setpoint - sicslist setatt $setpoint_script dtype float - sicslist setatt $setpoint_script dlen 1 - sicslist setatt $setpoint_script data false - sicslist setatt $setpoint_script nxsave false - sicslist setatt $setpoint_script mutable false - sicslist setatt $setpoint_script control true - sicslist setatt $setpoint_script units K - sicslist setatt $setpoint_script klass sensor - sicslist setatt $setpoint_script kind script + +::utility::macro::getset float $setpoint_script {args} { + if {$args == ""} { + return [tc1 setpoint] + } else { + tc1 setpoint $args + } +} +sicslist setatt $setpoint_script klass @none +sicslist setatt $setpoint_script long_name setpoint +sicslist setatt $setpoint_script mutable true + + lappend env_macrolist $setpoint_script foreach {param attlist} $paramlist {