nguide now selects apertures as well as guides.
This commit is contained in:
@ -11,7 +11,9 @@ add_tank tank aqadapter mc8
|
|||||||
|
|
||||||
for {set n 1} {$n <= 8} {incr n} {
|
for {set n 1} {$n <= 8} {incr n} {
|
||||||
make_coll_motor_1 c$n c$n pc$n count
|
make_coll_motor_1 c$n c$n pc$n count
|
||||||
|
pc$n position_names guide apertures
|
||||||
make_coll_motor_1 a$n a$n ap$n count
|
make_coll_motor_1 a$n a$n ap$n count
|
||||||
|
ap$n position_names D10 D20 D40 S40 R100
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a position-motor for the attenuator
|
# Make a position-motor for the attenuator
|
||||||
@ -28,6 +30,7 @@ foreach pos {27 55 84 114 146 179 213 248 288 333} {
|
|||||||
lappend poslist [expr 333 - $pos]
|
lappend poslist [expr 333 - $pos]
|
||||||
}
|
}
|
||||||
sapmot positions {*}$poslist
|
sapmot positions {*}$poslist
|
||||||
|
sapmot position_names D2.5 D5 D7.5 D10 D12.5 D15 D17.5 D20 D30 D40
|
||||||
# sap is a 10 position virtual motor for sapmot. D2.5 is at position 1
|
# sap is a 10 position virtual motor for sapmot. D2.5 is at position 1
|
||||||
make_vmot sap sapmot count
|
make_vmot sap sapmot count
|
||||||
sapmot precision 0.001
|
sapmot precision 0.001
|
||||||
@ -48,17 +51,21 @@ sapmot precision 0.001
|
|||||||
# drive the other guides to the aperture position with all the aperture arms
|
# drive the other guides to the aperture position with all the aperture arms
|
||||||
# raised.
|
# raised.
|
||||||
# \param num (optional) Number of guides to be selected.
|
# \param num (optional) Number of guides to be selected.
|
||||||
|
# \param sel_ap_name The position name for the first aperture selected after last guide.
|
||||||
|
# \param aprest_name The position name for the rest of the apertures
|
||||||
# \return The number of selected guides or an error message
|
# \return The number of selected guides or an error message
|
||||||
::utility::macro::getset float nguide { {num "REPORTNUM"} } {
|
::utility::macro::getset float nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} {
|
||||||
set catch_status [ catch {
|
set catch_status [ catch {
|
||||||
set FINDFIRST 1
|
set FINDFIRST 1
|
||||||
set COUNT 2
|
set COUNT 2
|
||||||
set CheckDrive 0
|
set CheckDrive 0
|
||||||
|
set ap_names { D10 D20 D40 S40 R100 }
|
||||||
array set EMSG {
|
array set EMSG {
|
||||||
invalidarg "Invalid argument"
|
invalidarg "Invalid arguments"
|
||||||
gaps "There are gaps in the sequence of selected guides"
|
gaps "There are gaps in the sequence of selected guides"
|
||||||
drivefailed "Drive failed."
|
drivefailed "Drive failed."
|
||||||
misaligned "Misalignment. At least one guide is not in the aperture or guide position"
|
misaligned "Misalignment. At least one guide is not in the aperture or guide position"
|
||||||
|
apfailed "Failed to set apertures"
|
||||||
}
|
}
|
||||||
set guideposit 1
|
set guideposit 1
|
||||||
set apposit 2
|
set apposit 2
|
||||||
@ -68,6 +75,13 @@ sapmot precision 0.001
|
|||||||
set apdrvlist {ap1 1 ap2 1 ap3 1 ap4 1 ap5 1 ap6 1 ap7 1 ap8 1}
|
set apdrvlist {ap1 1 ap2 1 ap3 1 ap4 1 ap5 1 ap6 1 ap7 1 ap8 1}
|
||||||
set pcdrvlist {}
|
set pcdrvlist {}
|
||||||
if {$num != "REPORTNUM"} {
|
if {$num != "REPORTNUM"} {
|
||||||
|
if { $sel_ap_name == "NONE" || $aprest_name == "NONE" } {
|
||||||
|
error "EMSG(invalidarg): You must provide two aperture arguments"
|
||||||
|
} elseif [lsearch -nocase $sel_ap_name] {
|
||||||
|
error "EMSG(invalidarg): $sel_ap_name should be one of $ap_names"
|
||||||
|
} elseif [lsearch -nocase $aprest_name] {
|
||||||
|
error "EMSG(invalidarg): $aprest_name should be one of $ap_names"
|
||||||
|
}
|
||||||
if {$num >= 0 && $num <= 8} {
|
if {$num >= 0 && $num <= 8} {
|
||||||
set CheckDrive true
|
set CheckDrive true
|
||||||
set last 8
|
set last 8
|
||||||
@ -124,6 +138,25 @@ sapmot precision 0.001
|
|||||||
if {$CheckDrive} {
|
if {$CheckDrive} {
|
||||||
if {$ng != $num} {
|
if {$ng != $num} {
|
||||||
error "$EMSG(drivefailed)"
|
error "$EMSG(drivefailed)"
|
||||||
|
} else {
|
||||||
|
for {set n [expr $last - 1]} {$n > 0} {incr n -1} {
|
||||||
|
lappend aprest_list ap$n $aprest_name
|
||||||
|
}
|
||||||
|
pdrive ap$last $sel_ap_name {*}$aprest_list
|
||||||
|
set sel_ap_pos [SplitReply [ ap$last ]]
|
||||||
|
set req_sel_ap_pos [ SplitReply [ ap$last posit2unit $sel_ap_name ] ]
|
||||||
|
set prec [ SplitReply [ap$last precision] ]
|
||||||
|
if { [expr abs($req_sel_ap_pos - $sel_ap_pos)] > $prec } {
|
||||||
|
error "$EMSG(apfailed): ap$last"
|
||||||
|
}
|
||||||
|
foreach ap_mot ap_name $aprest_list {
|
||||||
|
set sel_pos [SplitReply [ $ap_mot ]]
|
||||||
|
set req_pos [ SplitReply [ $ap_mot posit2unit $ap_name ] ]
|
||||||
|
set prec [ SplitReply [$ap_mot precision] ]
|
||||||
|
if { [expr abs($req_pos - $sel_pos)] > $prec } {
|
||||||
|
error "$EMSG(apfailed): $ap_mot"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "[lindex [info level 0] 0] = $ng"
|
return "[lindex [info level 0] 0] = $ng"
|
||||||
|
Reference in New Issue
Block a user