proc select_environment_controller {envtemp args} { if [ catch { puts "selecting $envtemp for environment control" switch [string tolower $envtemp] { "lh45" { add_lh45 tc1 ca4-quokka 4003 $args 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] } } } "brukerjulabo" { add_bruker_BEC1 ma1 137.157.202.80 4444 0.1 add_lh45 tc1 ca4-quokka 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 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 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" { puts "Configuring 11TMagnet" 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 # 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 } hfactory /sics/tc2/sensor/start_sensorValueA plain user float hfactory /sics/tc2/sensor/end_sensorValueA plain user float # ::scobj::hinitprops tc2 sensor/start_sensorValueA sensor/end_sensorValueA hsetprop /sics/tc2/sensor/start_sensorValueA nxalias start_sensorValueA hsetprop /sics/tc2/sensor/end_sensorValueA nxalias start_sensorValueB foreach {prop propval} { control true data true nxsave true mutable true klass parameter sdsinfo ::nexus::scobj::sdsinfo long_name tc2 } { hsetprop /sics/tc2/sensor/start_sensorValueA $prop $propval hsetprop /sics/tc2/sensor/end_sensorValueA $prop $propval } proc ::histogram_memory::pre_count {} { catch { set fPath "magnetic" hset /sics/$fPath/start_magnetic [hval /sics/$fPath/magneticField] hset /sics/$fPath/start_temperature_s1 [hval /sics/$fPath/Temp_s1] hset /sics/$fPath/start_temperature_s2 [hval /sics/$fPath/Temp_s2] hset /sics/$fPath/start_temperature_s3 [hval /sics/$fPath/Temp_s3] # Set lakeshore temperatures at start of acquisition hset /sample/tc2/sensor/start_sensorValueA [hval /sample/tc2/sensor/sensorValueA] hset /sample/tc2/sensor/end_sensorValueA [hval /sample/tc2/sensor/sensorValueA] } } proc ::histogram_memory::post_count {} { catch { set fPath "magnetic" hset /sics/$fPath/end_magnetic [hval /sics/$fPath/magneticField] hset /sics/$fPath/end_temperature_s1 [hval /sics/$fPath/Temp_s1] hset /sics/$fPath/end_temperature_s2 [hval /sics/$fPath/Temp_s2] hset /sics/$fPath/end_temperature_s3 [hval /sics/$fPath/Temp_s3] # Set lakeshore temperature at end of acquisition hset /sample/tc2/sensor/end_sensorValueA [hval /sample/tc2/sensor/sensorValueA] } } } "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" } } } msg ] { puts "Failed to configure $envtemp: $msg" } }