From 464dbfdf64060b5a95e8e1b185ec53be18d850b3 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Sun, 12 Feb 2012 19:03:15 +1100 Subject: [PATCH] Moved the pre_count and post_count procs from the oxford labview driver to here and added the lakeshore temperature readings. r3365 | ffr | 2012-02-12 19:03:15 +1100 (Sun, 12 Feb 2012) | 3 lines --- .../sans/config/environment/environment.tcl | 75 ++++++++++++++++--- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/site_ansto/instrument/sans/config/environment/environment.tcl b/site_ansto/instrument/sans/config/environment/environment.tcl index 0c08093b..23c5c4d4 100644 --- a/site_ansto/instrument/sans/config/environment/environment.tcl +++ b/site_ansto/instrument/sans/config/environment/environment.tcl @@ -1,49 +1,106 @@ proc select_environment_controller {envtemp} { if [ catch { puts "selecting $envtemp for environment control" -switch $envtemp { +switch [string tolower $envtemp] { "lh45" { - add_lh45 tc1 ca5-quokka 4003 1 + add_lh45 tc1 137.157.202.78 4003 0.5 proc ::histogram_memory::pre_count {} { + catch { hset /sample/tc1/sensor/start_temperature [hval /sample/tc1/sensor/value] hset /sample/tc1/sensor/end_temperature [hval /sample/tc1/sensor/value] + } } proc ::histogram_memory::post_count {} { + catch { hset /sample/tc1/sensor/end_temperature [hval /sample/tc1/sensor/value] + } } } "rhqc" { puts "Configuring RHQC" # 9600 8 1 None None Enable - add_sct_ls340 tc1 ca5-[instname] 4001 "\r" 0.5 5.0 + add_sct_ls340 tc1 137.157.202.78 4001 "\r" 0.5 5.0 # TODO Set controlsensor # if { [SplitReply [environment_simulation]] == "false"} { # tc1 controlsensor sensorB # } # puts "Added tc1 with [tc1 controlsensor]" # 9600 8 1 None None Enable - add_sct_ls340 tc2 ca5-[instname] 4002 "\r" 0.5 5.0 + add_sct_ls340 tc2 137.157.202.78 4002 "\r" 0.5 5.0 # TODO Set controlsensor # if { [SplitReply [environment_simulation]] == "false"} { # tc2 controlsensor sensorD # } # puts "Added tc2 with [tc2 controlsensor]" } - "11TMagnet" { + "11tmagnet" { puts "Configuring 11TMagnet" - add_sct_ls340 tc2 ca5-[instname] 4001 "\r" 0.5 5.0 + add_sct_ls340 tc2 137.157.202.78 4001 "\r" 0.5 5.0 if { [SplitReply [environment_simulation]] == "false"} { ::utility::macro::getset float temperature {} { - return [sicsmsgfmt [hval /sample/tc2/sensor/sensorValueA]] + return [sicsmsgfmt [hval /sample/tc2/sensor/ctrlLp1_value]] } sicslist setatt temperature long_name temperature sicslist setatt temperature klass sample sicslist setatt temperature units K # TODO Set controlsensor # tc1 controlsensor sensorA -# } - add_ips120 ips120 ca5-quokka 4004 0.001 + } + #add_ips120 ips120 137.157.202.78 4004 0.001 + # make sure to lodge "fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl" before calling below + ::scobj::magnetic::mkMagnetic { + name "magnetic" + IP 137.157.202.80 + PORT 22 + tuning 0 + interval 10 + } + } + "11tmagnetvti" { + puts "Configuring 11TMagnet with VTI" + add_sct_ls340 tc2 137.157.202.78 4001 "\r" 0.5 5.0 + if { [SplitReply [environment_simulation]] == "false"} { + ::utility::macro::getset float temperature {} { + return [sicsmsgfmt [hval /sample/tc2/sensor/ctrlLp1_value]] + } + sicslist setatt temperature long_name temperature + sicslist setatt temperature klass sample + sicslist setatt temperature units K +# TODO Set controlsensor +# tc1 controlsensor sensorA + } + add_ips120 ips120 137.157.202.78 4004 0.001 + add_itc500 itc500 137.157.202.78 4003 5 + proc VTIMagnet11TLog "{date [clock format [clock seconds] -format %G-%m-%dT%T]}" { + set fd [open "/usr/local/sics/log/11TMagnetVTI_$date.log" a] + puts $fd "[clock format [clock seconds] -format %T]: Btarget=[hval /sample/ips120/setpoint] Bval=[hval /sample/ips120/sensor/value] T2=[hval /sample/itc500/sensor2/value] T3=[hval /sample/itc500/sensor3/value] Tlakeshore=[hval /sample/tc2/sensor/ctrlLp1_value]" + close $fd + } + sicspoll add VTIMagnet11TLog script 60 VTIMagnet11TLog + foreach {path val} {ips120/sensor magfield itc500/sensor2 temperature itc500/sensor3 temperature tc2/sensor temperature} { + hfactory /sics/$path/start_$val plain user float + hfactory /sics/$path/end_$val plain user float +# ::scobj::hinitprops /sics/$path/start_$val /sics/$path/end_$val + hsetprop /sics/$path/start_$val mutable false + hsetprop /sics/$path/end_$val mutable false + } + + proc ::histogram_memory::pre_count {} { + catch { + foreach {path name val} {ips120/sensor magfield value itc500/sensor2 temperature value itc500/sensor3 temperature value tc2/sensor temperature ctrlLp1_value} { + hset /sample/$path/start_$name [hval /sample/$path/$val] + hset /sample/$path/end_$name [hval /sample/$path/$val] + } + } + } + proc ::histogram_memory::post_count {} { + catch { + foreach {path name val} {ips120/sensor magfield value itc500/sensor2 temperature value itc500/sensor3 temperature value tc2/sensor temperature ctrlLp1_value} { + hset /sample/$path/end_$name [hval /sample/$path/$val] + } + } + } } default { clientput "Unknown environment controller $envtemp"