Files
sics/site_ansto/instrument/sans/config/optics/guide_configuration.tcl
Ferdi Franceschini 34c0c59594 eval the "drive" command to make sure that the parameters aren't interpreted as a single list value.
r2210 | ffr | 2007-10-31 17:09:45 +1100 (Wed, 31 Oct 2007) | 2 lines
2012-11-15 13:27:44 +11:00

81 lines
2.5 KiB
Tcl

##
# @file
# A guide configuration table where each line describes the setup
# for a mode of operation.
# The table will have a corresponding interpretation list which provides
# commands to setup the instrument.
namespace eval optics {
# A configuration table is made up of a set of named rows which provide
# configuration parameters
# Rows can be of mixed type
array set guide_configuration {
GA {MT A A A A A A A A }
MT {MT MT MT MT MT MT MT MT MT }
LP {MT MT MT MT MT MT MT MT LP }
LENS {MT MT MT MT MT MT MT MT L }
P1 {P A MT MT MT MT MT MT MT }
P1LP {P A MT MT MT MT MT MT LP }
P1LENS {P A MT MT MT MT MT MT L }
G1 {G A MT MT MT MT MT MT MT }
P2 {P G A MT MT MT MT MT MT }
G2 {G G A MT MT MT MT MT MT }
P3 {P G G A MT MT MT MT MT }
G3 {G G G A MT MT MT MT MT }
P4 {P G G G A MT MT MT MT }
G4 {G G G G A MT MT MT MT }
P5 {P G G G G A MT MT MT }
G5 {G G G G G A MT MT MT }
P6 {P G G G G G A MT MT }
G6 {G G G G G G A MT MT }
P7 {P G G G G G G A MT }
G7 {G G G G G G G A MT }
P8 {P G G G G G G G A }
G8 {G G G G G G G G A }
P9 {P G G G G G G G G }
G9 {G G G G G G G G G }
}
# This list maps the motor names to columns of the
# guide_configuration table.
set guide_configuration_columns {
c1 c2 c3 c4 c5 c6 c7 c8 c9
}
}
namespace eval optics {
variable guide_configuration
variable guide_configuration_columns
namespace export set_guide
}
##
# @brief set_guide uses a lookup table to setup the collimation system
# @param row, selects a row from the guide configuration table
#
# eg\n
# set_guide HIRES
proc ::optics::set_guide {row} {
variable guide_configuration
variable guide_configuration_columns
array set c1_map {G 1 MT 2 P 3}
array set c2_map {MT 1 G 2 A 3}
array set c3_map {MT 1 G 2 A 3}
array set c4_map {MT 1 G 2 A 3}
array set c5_map {MT 1 G 2 A 3}
array set c6_map {MT 1 G 2 A 3}
array set c7_map {MT 1 G 2 A 3}
array set c8_map {MT 1 G 2 A 3}
array set c9_map {LP 1 MT 2 G 3 A 4 L 5}
foreach el $guide_configuration($row) guide $guide_configuration_columns {
lappend to_config $guide
lappend to_config [set ${guide}_map($el)]
}
eval "drive $to_config"
}
namespace import ::optics::set_guide
publish set_guide user