Merged changes made in-situ

r2768 | ffr | 2009-03-31 17:25:20 +1100 (Tue, 31 Mar 2009) | 2 lines
This commit is contained in:
Ferdi Franceschini
2009-03-31 17:25:20 +11:00
committed by Douglas Clowes
parent d2f57e4615
commit 8e5b7842e3
17 changed files with 471 additions and 229 deletions

View File

@@ -9,13 +9,13 @@ namespace eval beam {
command attenuator {text=in,out,osc pos} {
switch $pos {
"in" {
bat send POS=0
bat send oscd=0
}
"out" {
bat send POS=-1
bat send oscd=-1
}
"osc" {
bat send POS=1
bat send oscd=1
}
default {
return -code error "ERROR: valid values are in, out, osc"
@@ -95,7 +95,7 @@ proc ::exp_mode::set_omega { arg } {
}
if {$arg<0} {
return -code error "omega must be greater than 1"
return -code error "omega must be greater than 0"
}
if {[catch {::exp_mode::set_guide_element $expmode} errMsg]} {
@@ -104,8 +104,8 @@ proc ::exp_mode::set_omega { arg } {
set argrad [deg2rad $arg] ;#position in radians
switch $expmode {
SB {
if {[catch {::exp_mode::checkMotionAndDrive m1ro [expr $arg/2.]} errMsg]} {return -code error $errMsg}
SB { ;#checked ARJN on 081231
if {[catch {::exp_mode::checkMotionAndDrive m1ro [expr -1.*$arg/2.]} errMsg]} {return -code error $errMsg}
set d1 [expr [SplitReply [slit3_distance]] - [SplitReply [guide1_distance]]]
set d2 [expr [SplitReply [sample_distance]] - [SplitReply [guide1_distance]]]
@@ -113,26 +113,37 @@ proc ::exp_mode::set_omega { arg } {
set h2 [expr -1. * $d2 * tan($argrad)]
if {[catch {checkMotionAndDrive st3vt $h1} errMsg]} {return -code error $errMsg}
if {[catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
if {[catch {isszst4vtsafe sz $h2} errMsg]} {return -code error $errMsg}
if {[catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
}
DB {
return -code error "ERROR: set_omega not yet defined for DB"
DB { ;#checked ARJN on 081231
set temp [deg2rad 2.4]
set offset [expr 600*sin($temp)]
;#offset is the vertical drop from the beam centre onto the middle of the second compound mirror
;# each compound mirror is 600mm long
;# therefore the distance between the place where the beam hits the centre of both mirrors is
;# 2 * 300 * cos(1.2) = 599.868
;# guide2_distance is therefore the distance from the midpoint of the second compound mirror to chopper disc 1.
;# i.e. sample-> midpoint of compound mirror2 = 1546 + 300*cos3.6 = 1845.4
set offset [expr 599.868*sin($temp)]
set arg 4.8 ;#fixed angle
set d1 [expr [SplitReply [slit3_distance]] - [SplitReply [guide2_distance]]]
set d2 [expr [SplitReply [sample_distance]] - [SplitReply [guide2_distance]]]
set h1 [expr -1. * $d1 * tan($argrad) - $offset]
set h2 [expr -1. * $d1 * tan($argrad) - $offset]
set h2 [expr -1. * $d2 * tan($argrad) - $offset]
if { [catch {checkMotionAndDrive st3vt $h1} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
if { [catch {isszst4vtsafe sz $h2} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
}
FOC {
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
if {[catch {checkMotionAndDrive st3vt 0} errMsg]} {return -code error $errMsg}
}
MT {
if {[catch {checkMotionAndDrive st3vt 0} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
}
default {
@@ -159,18 +170,18 @@ proc ::exp_mode::set_two_theta { arg } {
return -code error "two_theta is less than 0"
}
set argrad [deg2rad $arg] ;#position in radians
set argrad [deg2rad $arg] ;#2theta position in radians
set omegarad [deg2rad $expomega]
Clientput $expmode
switch $expmode {
SB {
SB { ;#checked ARJN 081231
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)]
set h1 [expr -1. * $d2 * tan($omegarad)] ;#distance if 2theta is zero, i.e. the direct beam
set b [expr $d1 / cos($omegarad)]
set c [expr $d1 / cos($argrad-$omegarad)]
set h2 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
set h2 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))] ;#cosine rule
set d3 [expr [SplitReply [dy]]]
set d4 [expr [SplitReply [dy]] + [SplitReply [sample_distance]] - [SplitReply [guide1_distance]]]
@@ -178,13 +189,14 @@ proc ::exp_mode::set_two_theta { arg } {
set b [expr $d3 / cos($omegarad)]
set c [expr $d3 / cos($argrad-$omegarad)]
set h4 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
if { [catch {isszst4vtsafe st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive dz [expr $h3 + $h4]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
}
DB {
return -code error "ERROR: set_omega not yet defined for DB"
DB { ;#checked ARJN 081231
set temp [deg2rad 2.4]
set offset [expr 600*sin($temp)]
set offset [expr 599.868*sin($temp)]
set expomega 4.8
set omegarad [deg2rad $expomega]
@@ -201,25 +213,27 @@ proc ::exp_mode::set_two_theta { arg } {
set b [expr $d3 / cos($omegarad)]
set c [expr $d3 / cos($argrad-$omegarad)]
set h4 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
if { [catch {isszst4vtsafe st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive dz [expr $h3 + $h4]} errMsg]} {return -code error $errMsg}
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
}
FOC {
set d1 [SplitReply [dy]]
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set h1 [expr $d1 * tan($argrad)]
set h2 [expr $d2 * tan($argrad)]
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set h1 [expr $d1 * tan($argrad)]
set h2 [expr $d2 * tan($argrad)]
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}
}
MT {
set d1 [SplitReply [dy]]
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set h1 [expr $d1 * tan($argrad)]
set h2 [expr $d2 * tan($argrad)]
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
set h1 [expr $d1 * tan($argrad)]
set h2 [expr $d2 * tan($argrad)]
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}
}
default {
return -code error "two_theta not defined for that mode: $expmode"
@@ -236,9 +250,14 @@ proc ::exp_mode::checkMotion { scan_variable target } {
if {[lsearch $motor_list $scan_variable]==-1} {
return -code error "you tried to drive a motor that doesn't exist"
}
set softzero [SplitReply [$scan_variable softzero]]
set absoluteTarget [expr $softzero+$target]
if { [catch {isszst4vtsafe $scan_variable $target} errMsg]} {return -code error $errMsg}
if {[catch {
::scan::check_limit $scan_variable hardlowerlim $target
::scan::check_limit $scan_variable hardupperlim $target
::scan::check_limit $scan_variable hardlowerlim $absoluteTarget
::scan::check_limit $scan_variable hardupperlim $absoluteTarget
::scan::check_limit $scan_variable softlowerlim $target
::scan::check_limit $scan_variable softupperlim $target
}]} {
@@ -272,6 +291,34 @@ proc ::exp_mode::checkMotionAndDrive { scan_variable target } {
}
publish ::exp_mode::checkMotionAndDrive user
proc ::exp_mode::isszst4vtsafe { scan_variable target } {
set szsoftzero [SplitReply [sz softzero]]
set st4vtsoftzero [SplitReply [st4vt softzero]]
set szPosition [expr [SplitReply [sz]] + $szsoftzero]
set st4vtPosition [expr [SplitReply [st4vt]] + $st4vtsoftzero]
set szHardUpperLim [SplitReply [sz hardupperlim]]
if { [string equal $scan_variable "sz"] || [string equal $scan_variable "st4vt"]} {
switch $scan_variable {
sz {
set szPosition [expr $target + $szsoftzero]
}
st4vt {
set st4vtPosition [expr $target + $st4vtsoftzero]
}
}
set distance [expr $szHardUpperLim - $szPosition + $st4vtPosition ]
if { $distance < 98. } {
return -code error "You would have a collision between st4vt and sz if you tried to move $scan_variable to $target"
}
}
return -code ok
}
publish ::exp_mode::isszst4vtsafe user
proc ::exp_mode::deg2rad { arg } {
set pi 3.1415926535897931
return [expr $pi * $arg / 180.]

View File

@@ -37,8 +37,9 @@ set bz_home 8142000
set c1ht_home 8265000
set m1ro_home 134658
set bat_home 8308518
set st3vt_home 8742250
set st4vt_home 8806900
set st3vt_home 5250496
#set st3vt_home 8742250 - victim of the encoder rearrangement
set st4vt_home 5806721
set sth_home 23541737
#set sphi_home 7548440 - victim of the NaN
set sphi_home 7450470
@@ -46,7 +47,7 @@ set sx_home 8574000
set sy_home 7500000
set sz_home 8927484
set dy_home 8838649
set dz_home 7805000
set dz_home 7788617
#Measured or computed step rate for sz (Sample Raise)
# Motor:25000/turn, gear:1/25, screw:5mm/turn
@@ -331,7 +332,7 @@ Motor st3vt $motor_driver_type [params \
stepsPerX 25000\
absEnc 1\
absEncHome $st3vt_home\
cntsPerX -8192]
cntsPerX 8192]
st3vt part slits.$slit3VGroup
st3vt long_name st3vt
st3vt softlowerlim 0
@@ -355,7 +356,7 @@ Motor st4vt $motor_driver_type [params \
stepsPerX 25000\
absEnc 1\
absEncHome $st4vt_home\
cntsPerX -8192]
cntsPerX 8192]
st4vt part slits.$slit4VGroup
st4vt long_name st4vt
st4vt softlowerlim 0
@@ -527,7 +528,7 @@ Motor dz $motor_driver_type [params \
cntsPerX [expr -8192.0/5.0]]
dz part detector
dz long_name vertical_translation
dz softlowerlim 0
dz softlowerlim 1
dz softupperlim 1351
dz home 0
dz speed 2

View File

@@ -53,9 +53,9 @@ sample_distance 5129
sample_base 50
slit3_distance 4808
slit3_base 20
guide1_distance 2979
guide1_distance 2900.4 ;# distance measured to axis of rotation
guide1_base
guide2_distance 3279
guide2_distance 3200 ;# distance measured to midpoint of the 2nd compound mirror (i.e. closest to the sample)
guide2_base
slit2_distance 1895
slit2_base 20