From 6009f273c8195ff7fcd67c84e8827ef566d1708f Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 14 Apr 2008 13:53:18 +1000 Subject: [PATCH] Add two theta virtual motor r2452 | dcl | 2008-04-14 13:53:18 +1000 (Mon, 14 Apr 2008) | 2 lines --- .../config/motors/motor_configuration.tcl | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl b/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl index 4960cbc3..d387163b 100644 --- a/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl @@ -1,5 +1,5 @@ -# $Revision: 1.25 $ -# $Date: 2008-02-04 01:30:44 $ +# $Revision: 1.26 $ +# $Date: 2008-04-14 03:53:18 $ # Author: Ferdi Franceschini (ffr@ansto.gov.au) # Last revision by: $Author: dcl $ @@ -901,6 +901,30 @@ make_gap_motors ss3hg gap ss3ho offset ss3r ss3l mm $slit3HGroup make_gap_motors ss4vg gap ss4vo offset ss4u ss4d mm $slit4VGroup make_gap_motors ss4hg gap ss4ho offset ss4r ss4l mm $slit4HGroup +proc set_two_theta { arg } { + set rad [expr ($arg/180.0)*3.1415926535897932384626433832795] + set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]] + set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]] + set h1 [expr [SplitReply [detector_base]] + $d1 * tan($rad)] + set h2 [expr [SplitReply [slit4_base]] + $d2 * tan($rad)] + return "dz=$h1,st4vt=$h2" +} +publish set_two_theta user + +proc get_two_theta {} { + set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]] + set h1 [expr [SplitReply [dz]] - [SplitReply [detector_base]]] + return [expr (180.0*atan2($h1, $d1))/3.1415926535897932384626433832795] +} +publish get_two_theta user + +MakeConfigurableMotor two_theta +two_theta readscript get_two_theta +two_theta drivescript set_two_theta +sicslist setatt two_theta klass sample +sicslist setatt two_theta long_name two_theta +sicslist setatt two_theta units degrees + proc motor_set_sobj_attributes {} { } # END MOTOR CONFIGURATION