SICS-354 nxscripts_common_1.tcl

Now using a nexus dictionary variable to set the entry name in data files to prevent duplicate or wrong entry names.
Make sure that the isNewFile flag is reset on the first "save" call to prevent file number being incremented multiple times

SICS-394 sans commands.tcl
Added "selbs", "selbsn", and "selbsxz" commands to select and position a beamstop in a safe manner.

SICS-394 sans motor_configuration.tcl
Added new beamstop motor drivers.

SICS-394 sans parameters.tcl
Added BeamStop parameter to record which beamstop has been selected.

r2832 | ffr | 2009-12-03 13:04:57 +1100 (Thu, 03 Dec 2009) | 13 lines
This commit is contained in:
Ferdi Franceschini
2009-12-03 13:04:57 +11:00
committed by Douglas Clowes
parent 2ec6505ef8
commit 746f495d69
5 changed files with 191 additions and 65 deletions

View File

@@ -11,6 +11,112 @@ namespace eval motor {
# }
#}
##
# @brief Beamstop select command
# @param bs beamstop, 1,2,3,4,5 or 6
# @param bx beam position in detector coordinates
# @param bz beam position in detector coordinates
# Origin of beamstop coordinate system is (bsxo, bszo) relative to frame
# Origin of detector coordinate system is (0, 0) relative to frame
# Given
# (Xb,Zb) = beam position in frame coordinates
# bx = beam x pos in detector coordinates
# bz = beam z pos in detector coordinates
# detoff = detector x pos in detector coordinates
# bsx = beamstop x pos in beamstop coordinates
# bsz = beamstop z pos in beamstop coordinates
# bszo = beamstop z origin relative to frame
# (bx+detoff, bz) = (Xb,Zb)
# (bsx, bsz+bszo) = (Xb,Zb)
proc selbs {bs {bx "UNDEF"} {bz "UNDEF"}} {
set bsdriving false
set dethw [expr {[SplitReply detector_active_height_mm]/2.0}]
set dethh [expr {[SplitReply detector_active_width_mm]/2.0}]
set bsxo -33.112 + $dethw
set bszo -329.440 + $dethh
if [ catch {
switch $bs {
"1" {
set bsmot "bs1"
set bs_target 92.79
set bsdownCmd "drive bs2 0 bs3 0 bs4 0 bs5 0 bs6 0"
}
"2" {
set bsmot "bs2"
set bs_target 86.20
set bsdownCmd "drive bs1 0 bs3 0 bs4 0 bs5 0 bs6 0"
}
"3" {
set bsmot "bs3"
set bs_target 92.54
set bsdownCmd "drive bs2 0 bs1 0 bs4 0 bs5 0 bs6 0"
}
"4" {
set bsmot "bs4"
set bs_target 86.66
set bsdownCmd "drive bs2 0 bs3 0 bs1 0 bs5 0 bs6 0"
}
"5" {
set bsmot "bs5"
set bs_target 92.50
set bsdownCmd "drive bs2 0 bs3 0 bs4 0 bs1 0 bs6 0"
}
"6" {
set bsmot "bs6"
set bs_target 85.87
set bsdownCmd "drive bs2 0 bs3 0 bs4 0 bs5 0 bs1 0"
}
default {
error "beamstop selection must be an integer from 1 to 6"
}
}
set detoff_val [SplitReply [detoff]]
if {$bx == "UNDEF" || $bz == "UNDEF"} {
statemon start selbs
set bsdriving true
drive $bsmot $bs_target
BeamStop -1
eval $bsdownCmd
BeamStop $bs
set bsdriving false
statemon stop selbs
} else {
if { [string is double $bx] == false } {
if { [string is double $bz] == false } {
error "beam coordinates must be floats"
}
}
set bsx_target [expr {$bx-$bsxo+$detoff_val}]
set bsz_target [expr {$bz-$bszo}]
statemon start selbs
set bsdriving true
drive $bsmot $bs_target bsx $bsx_target bsz $bsz_target
BeamStop -1
eval $bsdownCmd
BeamStop $bs
set bsdriving false
statemon stop selbs
}
} msg ] {
if {$bsdriving} {
statemon stop selbs
}
return -code error $msg
}
}
publish selbs user
namespace eval beamstops {
command selbsn {int=1,2,3,4,5,6 bs} {
selbs $bs "UNDEF" "UNDEF"
}
command selbsxz {int=1,2,3,4,5,6 bs float bx float bz} {
selbs $bs $bx $bz
}
}
namespace eval optics {
VarMake ::optics::select::section text user
VarMake ::optics::polarizer::in text user