reflectometer commands.tcl motor_configuration.tcl parameters.tcl and platypus_configuration.tcl

Merged in-situ changes from ics1-platypus

r2835 | ffr | 2009-12-09 18:16:26 +1100 (Wed, 09 Dec 2009) | 3 lines
This commit is contained in:
Ferdi Franceschini
2009-12-09 18:16:26 +11:00
committed by Douglas Clowes
parent c73c4c85c8
commit 4380176000
4 changed files with 92 additions and 47 deletions

View File

@@ -36,12 +36,12 @@ namespace eval exp_mode {
#4=Single
variable c1ht_pos
set valid_modes [list SB DB FOC MT POL]
set c1ht_pos [list 1057 806.7 557.1 200 200]
set c1ht_pos [list 1057 806.7 557.1 200 0.1]
command set_mode "text=[join $valid_modes ,] arg " { ;#need to change all softzero's
global ::exp_mode::valid_modes
if {[lsearch $::exp_mode::valid_modes $arg] == -1} {
Clientput "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
Clientput "Mode is: $::exp_mode::valid_modes - (POL, MT, FOC, DB, SB)"
return -code error "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
} else {
if { [catch {::exp_mode::set_guide_element $arg} errMsg] } {
@@ -59,6 +59,11 @@ namespace eval exp_mode {
command omega_2theta { float arg1 float arg2 } {
#need to set omega first. This is because
#for Single bounce the twotheta positions depend on the angle of incidence
# whenever omega_2theta is called, or the mode is changed, the slits should close
# this is to save the detector from being overloaded.
# the following line does the job. However, it is duplicated when the mode is set in
# set_omega, so it is commented out for now.
# drive ss1u 0 ss1d 0 ss2u 0 ss2d 0 ss3u 0 ss3d 0 ss4u 0 ss4d 0
if {[catch {::exp_mode::set_omega $arg1} errMsg]} {return -code error $errMsg}
if {[catch {::exp_mode::set_two_theta $arg2} errMsg]} {return -code error $errMsg}
return -code ok
@@ -74,6 +79,7 @@ proc ::exp_mode::set_guide_element { arg } {
global ::exp_mode::c1ht_pos
global ::exp_mode::valid_modes
drive ss1u 0 ss1d 0 ss2u 0 ss2d 0 ss3u 0 ss3d 0 ss4u 0 ss4d 0
if {[lsearch $::exp_mode::valid_modes $arg] == -1} {
Clientput "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
return -code error "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
@@ -97,6 +103,9 @@ proc ::exp_mode::set_omega { arg } {
if {$arg<0} {
return -code error "omega must be greater than 0"
}
#the modes is set to ensure that the right guide element is in place
#someone may have changed it by hand. DO NOT REMOVE THIS FUNCTIONALITY
#as it also has the effect of closing all the ssXvg gaps for safety.
if {[catch {::exp_mode::set_guide_element $expmode} errMsg]} {
return -code error $errMsg ;#make sure the guide element is moved.
@@ -146,6 +155,10 @@ proc ::exp_mode::set_omega { arg } {
if {[catch {checkMotionAndDrive st3vt 0} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
}
POL {
if {[catch {checkMotionAndDrive st3vt 0} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
}
default {
return -code error "omega driving not specified for that mode"
}
@@ -158,11 +171,11 @@ publish ::exp_mode::set_omega user
proc ::exp_mode::set_two_theta { arg } {
set expmode [SplitReply [mode]]
set expomega [SplitReply [omega]]
set expomega [SplitReply [omega]]
if {[lsearch $::exp_mode::valid_modes $expmode] == -1} {
return -code error "please set the mode and omega first"
}
if {[lsearch $::exp_mode::valid_modes $expmode] == -1} {
return -code error "please set the mode and omega first"
}
if {$expomega == "NaN"} {
return -code error "please set omega first"
}
@@ -176,7 +189,7 @@ proc ::exp_mode::set_two_theta { arg } {
Clientput $expmode
switch $expmode {
SB { ;#checked ARJN 081231
set d1 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set d1 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [guide1_distance]]]
set h1 [expr -1. * $d2 * tan($omegarad)] ;#distance if 2theta is zero, i.e. the direct beam
set b [expr $d1 / cos($omegarad)]
@@ -235,6 +248,21 @@ proc ::exp_mode::set_two_theta { arg } {
if { [catch {checkMotionAndDrive st4vt $h2} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
}
POL {
set d1 [SplitReply [dy]]
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set d3 [expr [SplitReply [anal_distance]] - [SplitReply [sample_distance]]]
set h1 [expr $d1 * tan($argrad)]
set h2 [expr $d2 * tan($argrad)]
set h3 [expr $d3 * tan($argrad)]
set ang1 [expr $arg + 0.8]
if { [catch {isszst4vtsafe st4vt $h2} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive st4vt $h2} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive analz $h3} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive analtilt $ang1} errMsg]} {return -code error $errMsg}
}
default {
return -code error "two_theta not defined for that mode: $expmode"
}