From 9a7f4608b75cb0d13e515084cb1f6d87f02658bf Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 3 Sep 2014 12:20:00 +1000 Subject: [PATCH] SICS-771 Add sample_aperture size macro. Make sure that positions are saved as -9999 if the guides are misaligned. --- .../config/motors/motor_configuration.tcl | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/site_ansto/instrument/bilby/config/motors/motor_configuration.tcl b/site_ansto/instrument/bilby/config/motors/motor_configuration.tcl index a026c437..0388b024 100644 --- a/site_ansto/instrument/bilby/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/bilby/config/motors/motor_configuration.tcl @@ -57,9 +57,14 @@ foreach pos {27 55 84 114 146 179 213 248 288 333} { } 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 -make_vmot sap sapmot count sapmot precision 0.001 +# TODO implement target +::utility::macro::getset text sample_aperture { {target "NONE"} } { + return "sample_aperture = [posname sapmot]" +} +sicslist setatt sample_aperture klass sample +sicslist setatt sample_aperture long_name sample_aperture + ################################################################################ ##################### Time of flight calculations ############################## @@ -82,7 +87,7 @@ proc filter_non_numeric {retval} { if [string is double $val] { return $retval } else { - return [lindex $retval 0] = -9999 + return "[lindex $retval 0] = -9999" } } @@ -140,7 +145,7 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} { set catch_status [ catch { set FINDFIRST 1 set COUNT 2 - set CheckDrive 0 + set CheckDrive false set ap_names { D10 D20 D40 S40 R100 } array set EMSG { invalidarg "Invalid arguments" @@ -235,7 +240,7 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} { incr ng set state $COUNT } else { - clientput "$EMSG(misaligned)" + return "$EMSG(misaligned)" break } } @@ -244,7 +249,7 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} { incr ng } else { # ERROR There shouldn't be any gaps in the selection - clientput "$EMSG(gaps)" + return "$EMSG(gaps)" break } } @@ -255,7 +260,7 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} { set drive_ok true if {$ng != $num} { set drive_ok false - clientput "$EMSG(drivefailed): Failed to selected guides" + clientput "$EMSG(drivefailed): Failed to select guides" } foreach {ap_mot ap_name} $ap_target_list { set pos [SplitReply [$ap_mot]] @@ -272,8 +277,8 @@ proc nguide { {num "REPORTNUM"} {sel_ap_name "NONE"} {aprest_name "NONE"}} { } else { clientput "nguide finished with errors" } + return "[lindex [info level 0] 0] = $ng $ap_posname_list" } - return "[lindex [info level 0] 0] = $ng $ap_posname_list" } message ] handle_exception $catch_status $message } @@ -366,7 +371,7 @@ proc L2_curtainr {} { return "[lindex [info level 0] 0] = $retval" } publish L2_curtainr user -::utility::macro::getset float L2_curtainr {} { +::utility::macro::getset float gs_L2_curtainr {} { filter_non_numeric [ L2_curtainr ] } sicslist setatt gs_L2_curtainr klass instrument