##################################
SICS-226 util/utility.tcl Added set_chopper_attributes to set hdb metadata on chopperadapters server_config.tcl Set hdb metadata on chopperadapters hipadaba_configuration_common.tcl :hdb::sobjadd can now add chopperadapters to the hdb tree ::hdb::cmd_par now preserves case when adding command parameters. instdict_specification.tcl Added chopperadapter sicstype and disk_chopper class nxscripts_common_1.tcl Added chopperadapter save and sdsinfo commands. reflectometer/config/chopper/chopper.tcl Set units on chopperadapters. ################################## hipd,hrpd,rsd, /config/commands.tcl Add instrument specific initialisation procedure for commands reflectometer/config/commands.tcl Created omega_2theta and set_mode commands from Andrew Nelson's procs in extraconfig.tcl reflectometer/.../motor_configuration.tcl Added ds and rs prefix to the two_theta drive and read scripts to prevent name collision with the two_theta procs in commans.tcl SICS-108 reflectometer/../parameters.tcl Added parameters for guide, slit and chopper distances and elements. SICS-108 common_instrument_dictionary.tcl Make parameters saveable r2678 | ffr | 2008-08-18 13:01:29 +1000 (Mon, 18 Aug 2008) | 40 lines
This commit is contained in:
committed by
Douglas Clowes
parent
348bd3aed1
commit
8090104407
@@ -36,13 +36,13 @@ set instrument_dictionary [subst {
|
|||||||
privilege spy
|
privilege spy
|
||||||
sobj {@any parameter}
|
sobj {@any parameter}
|
||||||
datatype @none
|
datatype @none
|
||||||
property {data false control true nxsave false klass @none type part}
|
property {data true control true nxsave true klass NXparameter type part}
|
||||||
}
|
}
|
||||||
instrument/parameters/derived_parameters {
|
instrument/parameters/derived_parameters {
|
||||||
privilege spy
|
privilege spy
|
||||||
sobj {@any derived_parameter}
|
sobj {@any derived_parameter}
|
||||||
datatype @none
|
datatype @none
|
||||||
property {data false control true nxsave false klass @none type part}
|
property {data true control true nxsave true klass NXderived_parameter type part}
|
||||||
}
|
}
|
||||||
instrument/aperture {
|
instrument/aperture {
|
||||||
privilege spy
|
privilege spy
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ proc ::hdb::add_hpath {basePath path {priv spy} {dtype none} {dlen ""}} {
|
|||||||
# @see command
|
# @see command
|
||||||
proc ::hdb::add_cmd_par {hpath sobj name} {
|
proc ::hdb::add_cmd_par {hpath sobj name} {
|
||||||
hattach $hpath $sobj $name
|
hattach $hpath $sobj $name
|
||||||
foreach {prop pval} [attlist $sobj] {
|
foreach {prop pval} [::utility::normalattlist $sobj] {
|
||||||
hsetprop $hpath/$name $prop $pval
|
hsetprop $hpath/$name $prop $pval
|
||||||
}
|
}
|
||||||
hsetprop $hpath/$name data false
|
hsetprop $hpath/$name data false
|
||||||
@@ -756,6 +756,23 @@ proc ::hdb::sobjadd {hpath sobj args} {
|
|||||||
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
|
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chopperadapter {
|
||||||
|
if {[info exists sobjatt(group)]} {
|
||||||
|
set hpath [add_hpath $hpath $sobjatt(group)]
|
||||||
|
hsetprop $hpath type part
|
||||||
|
}
|
||||||
|
if {[lsearch [hlist $hpath] $sobjatt(long_name)] == -1} {
|
||||||
|
set node_path [add_node $hpath node $sobj long_name [normalgetatt $sobj long_name] kind $sobjatt(kind)]
|
||||||
|
hsetprop $node_path sicsdev $sobj
|
||||||
|
hsetprop $node_path nxalias $sobj
|
||||||
|
hsetprop $node_path savecmd $sobjatt(savecmd)
|
||||||
|
hsetprop $node_path sdsinfo $sobjatt(sdsinfo)
|
||||||
|
hsetprop $node_path mutable $sobjatt(mutable)
|
||||||
|
hsetprop $node_path privilege $sobjatt(privilege)
|
||||||
|
} else {
|
||||||
|
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
|
||||||
|
}
|
||||||
|
}
|
||||||
nxscript {
|
nxscript {
|
||||||
# TODO
|
# TODO
|
||||||
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
||||||
@@ -771,6 +788,9 @@ proc ::hdb::sobjadd {hpath sobj args} {
|
|||||||
environment_controller {
|
environment_controller {
|
||||||
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
||||||
}
|
}
|
||||||
|
default {
|
||||||
|
error "ERROR: Unknown sics object type $sobjatt(type)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} message ] {
|
} message ] {
|
||||||
if {$::errorCode=="NONE"} {return $message}
|
if {$::errorCode=="NONE"} {return $message}
|
||||||
|
|||||||
@@ -11,18 +11,18 @@ set boolean {true false}
|
|||||||
#}
|
#}
|
||||||
|
|
||||||
# SICS OBJECTS MUST PROVIDE THE FOLLOWING INFORMATION
|
# SICS OBJECTS MUST PROVIDE THE FOLLOWING INFORMATION
|
||||||
set sobj_klass_list {@none aperture attenuator collimator command crystal data detector entry environment experiment graphics instrument monitor monochromator parameter derived_parameter plc sample scan sensor user}
|
set sobj_klass_list {@none aperture attenuator collimator command crystal data detector disk_chopper entry environment experiment graphics instrument monitor monochromator parameter derived_parameter plc sample scan sensor source user}
|
||||||
set sobj_sicstype_list {environment_controller sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject}
|
set sobj_sicstype_list {chopperadapter environment_controller sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject}
|
||||||
# Different kinds of things are added to the hdb in different ways.
|
# Different kinds of things are added to the hdb in different ways.
|
||||||
# command: This is something a client can run with hset /a/b/c start, it may have parameters and feedback.
|
# command: This is something a client can run with hset /a/b/c start, it may have parameters and feedback.
|
||||||
# Parameters and feedback should be made available in 'ilists' named after the command.
|
# Parameters and feedback should be made available in 'ilists' named after the command.
|
||||||
# script: Supplies an rscript and a wscript to attach to a node for hgets and hsets.
|
# script: Supplies an rscript and a wscript to attach to a node for hgets and hsets.
|
||||||
# hobj: Something that can be hattached to a node. {motor sicsvariable histmem}.
|
# hobj: Something that can be hattached to a node. {motor sicsvariable histmem}.
|
||||||
# hdb_subtree: Is a macro which returns a keyed list that describes a hdb subtree.
|
# hdb_subtree: Is a macro which returns a keyed list that describes a hdb subtree.
|
||||||
set sobj_kind_list {command hobj script hdb_subtree}
|
set sobj_kind_list {command hobj script getset hdb_subtree}
|
||||||
set sobj_interfacelist [subst {drivable {$boolean} countable {$boolean} callback {$boolean} environment {$boolean} }]
|
set sobj_interfacelist [subst {drivable {$boolean} countable {$boolean} callback {$boolean} environment {$boolean} }]
|
||||||
|
|
||||||
set privilege_list {spy user manager read_only internal}
|
set privilege_list {spy user manager readonly internal}
|
||||||
set sobj_privilege [subst {privilege {$privilege_list}}]
|
set sobj_privilege [subst {privilege {$privilege_list}}]
|
||||||
|
|
||||||
# This is a subset of the list of attributes which the
|
# This is a subset of the list of attributes which the
|
||||||
@@ -93,6 +93,13 @@ set sicsdata_attlist [subst {
|
|||||||
mutable [subst {{$boolean}}]
|
mutable [subst {{$boolean}}]
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
set chopperadapter_attlist [subst {
|
||||||
|
$sobj_attlist
|
||||||
|
savecmd {print}
|
||||||
|
sdsinfo {print}
|
||||||
|
nxalias {text}
|
||||||
|
mutable [subst {{$boolean}}]
|
||||||
|
}]
|
||||||
# INSTRUMENT DICTIONARIES MUST PROVIDE THE FOLLOWING INFORMATION
|
# INSTRUMENT DICTIONARIES MUST PROVIDE THE FOLLOWING INFORMATION
|
||||||
if 1 {
|
if 1 {
|
||||||
set nexus_classes { NXaperture NXattenuator NXbeam_stop NXbeam NXbending_magnet NXcharacterizations NXcollimator NXcrystal NXdata NXdetector NXdisk_chopper NXentry NXenvironment NXevent_data NXfermi_chopper NXfilter NXflipper NXgeometry NXguide NXinsertion_device NXinstrument NXlog NXmirror NXmoderator NXmonitor NXnote NXorientation NXpositioner NXprocess NXroot NXsample NXsensor NXshape NXsource NXtranslation NXuser NXvelocity_selector}
|
set nexus_classes { NXaperture NXattenuator NXbeam_stop NXbeam NXbending_magnet NXcharacterizations NXcollimator NXcrystal NXdata NXdetector NXdisk_chopper NXentry NXenvironment NXevent_data NXfermi_chopper NXfilter NXflipper NXgeometry NXguide NXinsertion_device NXinstrument NXlog NXmirror NXmoderator NXmonitor NXnote NXorientation NXpositioner NXprocess NXroot NXsample NXsensor NXshape NXsource NXtranslation NXuser NXvelocity_selector}
|
||||||
|
|||||||
@@ -744,6 +744,10 @@ proc ::nexus::gen_nxdict {nexusdic} {
|
|||||||
sicslist setatt $sobj savecmd ::nexus::environment_controller::save
|
sicslist setatt $sobj savecmd ::nexus::environment_controller::save
|
||||||
sicslist setatt $sobj sdsinfo ::nexus::environment_controller::sdsinfo
|
sicslist setatt $sobj sdsinfo ::nexus::environment_controller::sdsinfo
|
||||||
}
|
}
|
||||||
|
foreach sobj [sicslist type chopperadapter] {
|
||||||
|
sicslist setatt $sobj savecmd ::nexus::chopperadapter::save
|
||||||
|
sicslist setatt $sobj sdsinfo ::nexus::chopperadapter::sdsinfo
|
||||||
|
}
|
||||||
foreach sobj [sicslist kind script] {
|
foreach sobj [sicslist kind script] {
|
||||||
sicslist setatt $sobj savecmd ::nexus::script::save
|
sicslist setatt $sobj savecmd ::nexus::script::save
|
||||||
sicslist setatt $sobj sdsinfo ::nexus::script::sdsinfo
|
sicslist setatt $sobj sdsinfo ::nexus::script::sdsinfo
|
||||||
@@ -975,6 +979,41 @@ proc ::nexus::sicsvariable::sdsinfo {svar data_type args} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace eval ::nexus::chopperadapter { }
|
||||||
|
proc ::nexus::chopperadapter::save {sobj nxalias data_type args} {
|
||||||
|
array set attribute [attlist $sobj]
|
||||||
|
set val [SplitReply [$sobj]]
|
||||||
|
if {[lindex $args 0] == "point"} {
|
||||||
|
set index [lindex $args 1]
|
||||||
|
nxscript_data clear
|
||||||
|
switch $data_type {
|
||||||
|
int {nxscript_data putint 0 $val}
|
||||||
|
float {nxscript_data putfloat 0 $val}
|
||||||
|
default {error "ERROR: [info level -1]->::nexus::chopperadapter::save, unknown type $data_type"}
|
||||||
|
}
|
||||||
|
nxscript putslab $nxalias [list $index] [list 1] nxscript_data
|
||||||
|
} else {
|
||||||
|
switch $data_type {
|
||||||
|
int {nxscript putint $nxalias $val}
|
||||||
|
float {nxscript putfloat $nxalias $val}
|
||||||
|
text {nxscript puttext $nxalias $val}
|
||||||
|
default {error "ERROR: [info level -1]->::nexus::chopperadapter::save, unknown type $data_type"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {[info exists attribute(units)]} {
|
||||||
|
nxscript putattribute $nxalias units $attribute(units)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc ::nexus::chopperadapter::sdsinfo {sobj data_type args} {
|
||||||
|
array set param $args
|
||||||
|
set dtype [::nexus::hdb2nx_type $data_type]
|
||||||
|
if {$param(mutable) == true} {
|
||||||
|
return " -type $dtype -rank 1 -dim {-1}"
|
||||||
|
} else {
|
||||||
|
return " -type $dtype"
|
||||||
|
}
|
||||||
|
}
|
||||||
proc ::nexus::singlecounter::save {counter nxalias data_type args} {
|
proc ::nexus::singlecounter::save {counter nxalias data_type args} {
|
||||||
todo_msg "Save counter: $counter"
|
todo_msg "Save counter: $counter"
|
||||||
}
|
}
|
||||||
@@ -1060,7 +1099,7 @@ foreach expt $::nexus::exports {
|
|||||||
|
|
||||||
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
|
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
|
||||||
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
set tmpstr [string map {"$" ""} {$Revision: 1.41 $}]
|
set tmpstr [string map {"$" ""} {$Revision: 1.42 $}]
|
||||||
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
|
|
||||||
#namespace eval data {
|
#namespace eval data {
|
||||||
|
|||||||
@@ -4,3 +4,7 @@ namespace eval motor {
|
|||||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||||
variable is_homing_list ""
|
variable is_homing_list ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc ::commands::isc_initialize {} {
|
||||||
|
::commands::ic_initialize
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,3 +4,7 @@ namespace eval motor {
|
|||||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||||
variable is_homing_list ""
|
variable is_homing_list ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc ::commands::isc_initialize {} {
|
||||||
|
::commands::ic_initialize
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ if {$sim_mode == "true"} {
|
|||||||
ChopperAdapter ch3phase chopperController phase_3 0 180
|
ChopperAdapter ch3phase chopperController phase_3 0 180
|
||||||
ChopperAdapter ch4phase chopperController phase_4 0 180
|
ChopperAdapter ch4phase chopperController phase_4 0 180
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# @brief Return TCL_ERROR if chopper is in a state which disallows data acquisition.
|
# @brief Return TCL_ERROR if chopper is in a state which disallows data acquisition.
|
||||||
# This is useful for aborting scans or batch files.
|
# This is useful for aborting scans or batch files.
|
||||||
@@ -61,3 +62,8 @@ if {$sim_mode == "true"} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sicslist setatt chspeed units "rpm"
|
||||||
|
sicslist setatt ch2phase units "degrees"
|
||||||
|
sicslist setatt ch3phase units "degrees"
|
||||||
|
sicslist setatt ch4phase units "degrees"
|
||||||
|
|||||||
@@ -4,3 +4,266 @@ namespace eval motor {
|
|||||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||||
variable is_homing_list ""
|
variable is_homing_list ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace eval exp_mode {
|
||||||
|
variable valid_modes
|
||||||
|
variable guide_for_mode ;#guide element for a specific mode
|
||||||
|
variable c1ht_pos
|
||||||
|
#0=polarisation
|
||||||
|
#1=mt
|
||||||
|
#2=focussing
|
||||||
|
#3=DB
|
||||||
|
#4=Single
|
||||||
|
variable c1ht_pos
|
||||||
|
set valid_modes [list SB DB FOC MT POL]
|
||||||
|
set c1ht_pos [list 1057 806.7 557.1 200 200]
|
||||||
|
|
||||||
|
command set_mode "text=[join $valid_modes ,] arg " { ;#need to change all softzero's
|
||||||
|
global ::exp_mode::valid_modes
|
||||||
|
if {[lsearch $::exp_mode::valid_modes $arg] == -1} {
|
||||||
|
Clientput "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
|
||||||
|
return -code error "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
|
||||||
|
} else {
|
||||||
|
if { [catch {::exp_mode::set_guide_element $arg} errMsg] } {
|
||||||
|
Clientput $errMsg
|
||||||
|
return -code error $errMsg
|
||||||
|
}
|
||||||
|
mode $arg
|
||||||
|
}
|
||||||
|
omega -1
|
||||||
|
twotheta -1
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
command omega_2theta { float arg1 float arg2 } {
|
||||||
|
#need to set omega first. This is because
|
||||||
|
#for Single bounce the twotheta positions depend on the angle of incidence
|
||||||
|
if {[catch {::exp_mode::set_omega $arg1} errMsg]} {return -code error $errMsg}
|
||||||
|
if {[catch {::exp_mode::set_two_theta $arg2} errMsg]} {return -code error $errMsg}
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Drive c1ht and set guide_element parameter
|
||||||
|
#
|
||||||
|
# @param arg is the user mode
|
||||||
|
proc ::exp_mode::set_guide_element { arg } {
|
||||||
|
global ::exp_mode::c1ht_pos
|
||||||
|
global ::exp_mode::valid_modes
|
||||||
|
|
||||||
|
if {[lsearch $::exp_mode::valid_modes $arg] == -1} {
|
||||||
|
Clientput "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
|
||||||
|
return -code error "Mode is: $::exp_mode::valid_modes - (polarisation,mt,focussing,DB,single)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if {[catch {::exp_mode::checkMotionAndDrive c1ht [lindex $c1ht_pos [lsearch $::exp_mode::valid_modes $arg]]} errMsg]} {
|
||||||
|
return -code error $errMsg
|
||||||
|
} else {
|
||||||
|
guide_element $arg
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc ::exp_mode::set_omega { arg } {
|
||||||
|
set expmode [SplitReply [mode]]
|
||||||
|
if {[lsearch $::exp_mode::valid_modes $expmode] == -1} {
|
||||||
|
Clientput "Please set the mode first"
|
||||||
|
return -code error "Please set the mode first"
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$arg<0} {
|
||||||
|
return -code error "omega must be greater than 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if {[catch {::exp_mode::set_guide_element $expmode} errMsg]} {
|
||||||
|
return -code error $errMsg ;#make sure the guide element is moved.
|
||||||
|
}
|
||||||
|
set argrad [deg2rad $arg] ;#position in radians
|
||||||
|
|
||||||
|
switch $expmode {
|
||||||
|
SB {
|
||||||
|
if {[catch {::exp_mode::checkMotionAndDrive m1ro [expr $arg/2.]} errMsg]} {return -code error $errMsg}
|
||||||
|
|
||||||
|
set d1 [expr [SplitReply [slit3_distance]] - [SplitReply [guide1_distance]]]
|
||||||
|
set d2 [expr [SplitReply [sample_distance]] - [SplitReply [guide1_distance]]]
|
||||||
|
set h1 [expr -1. * $d1 * tan($argrad)]
|
||||||
|
set h2 [expr -1. * $d2 * tan($argrad)]
|
||||||
|
|
||||||
|
if {[catch {checkMotionAndDrive st3vt $h1} errMsg]} {return -code error $errMsg}
|
||||||
|
if {[catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
DB {
|
||||||
|
return -code error "ERROR: set_omega not yet defined for DB"
|
||||||
|
set temp [deg2rad 2.4]
|
||||||
|
set offset [expr 600*sin($temp)]
|
||||||
|
set arg 4.8 ;#fixed angle
|
||||||
|
|
||||||
|
set d1 [expr [SplitReply [slit3_distance]] - [SplitReply [guide2_distance]]]
|
||||||
|
set d2 [expr [SplitReply [sample_distance]] - [SplitReply [guide2_distance]]]
|
||||||
|
set h1 [expr -1. * $d1 * tan($argrad) - $offset]
|
||||||
|
set h2 [expr -1. * $d1 * tan($argrad) - $offset]
|
||||||
|
|
||||||
|
if { [catch {checkMotionAndDrive st3vt $h1} errMsg]} {return -code error $errMsg}
|
||||||
|
if { [catch {checkMotionAndDrive sz $h2} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
FOC {
|
||||||
|
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
MT {
|
||||||
|
if { [catch {checkMotionAndDrive sth $arg} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
return -code error "omega driving not specified for that mode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
omega $arg
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
publish ::exp_mode::set_omega user
|
||||||
|
|
||||||
|
proc ::exp_mode::set_two_theta { arg } {
|
||||||
|
set expmode [SplitReply [mode]]
|
||||||
|
set expomega [SplitReply [omega]]
|
||||||
|
|
||||||
|
if {[lsearch $::exp_mode::valid_modes $expmode] == -1} {
|
||||||
|
return -code error "please set the mode and omega first"
|
||||||
|
}
|
||||||
|
if {$expomega == "NaN"} {
|
||||||
|
return -code error "please set omega first"
|
||||||
|
}
|
||||||
|
if {$arg<0} {
|
||||||
|
return -code error "two_theta is less than 0"
|
||||||
|
}
|
||||||
|
|
||||||
|
set argrad [deg2rad $arg] ;#position in radians
|
||||||
|
set omegarad [deg2rad $expomega]
|
||||||
|
|
||||||
|
Clientput $expmode
|
||||||
|
switch $expmode {
|
||||||
|
SB {
|
||||||
|
set d1 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
||||||
|
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [guide1_distance]]]
|
||||||
|
set h1 [expr -1. * $d2 * tan($omegarad)]
|
||||||
|
set b [expr $d1 / cos($omegarad)]
|
||||||
|
set c [expr $d1 / cos($argrad-$omegarad)]
|
||||||
|
set h2 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
|
||||||
|
|
||||||
|
set d3 [expr [SplitReply [dy]]]
|
||||||
|
set d4 [expr [SplitReply [dy]] + [SplitReply [sample_distance]] - [SplitReply [guide1_distance]]]
|
||||||
|
set h3 [expr -1. * $d4 * tan($omegarad)]
|
||||||
|
set b [expr $d3 / cos($omegarad)]
|
||||||
|
set c [expr $d3 / cos($argrad-$omegarad)]
|
||||||
|
set h4 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
|
||||||
|
if { [catch {checkMotionAndDrive dz [expr $h3 + $h4]} errMsg]} {return -code error $errMsg}
|
||||||
|
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
DB {
|
||||||
|
return -code error "ERROR: set_omega not yet defined for DB"
|
||||||
|
set temp [deg2rad 2.4]
|
||||||
|
set offset [expr 600*sin($temp)]
|
||||||
|
set expomega 4.8
|
||||||
|
set omegarad [deg2rad $expomega]
|
||||||
|
|
||||||
|
set d1 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
||||||
|
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [guide2_distance]]]
|
||||||
|
set h1 [expr -1. * $d2 * tan($omegarad) - $offset]
|
||||||
|
set b [expr $d1 / cos($omegarad)]
|
||||||
|
set c [expr $d1 / cos($argrad-$omegarad)]
|
||||||
|
set h2 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
|
||||||
|
|
||||||
|
set d3 [expr [SplitReply [dy]]]
|
||||||
|
set d4 [expr [SplitReply [dy]] + [SplitReply [sample_distance]] - [SplitReply [guide2_distance]]]
|
||||||
|
set h3 [expr -1. * $d4 * tan($omegarad) - $offset]
|
||||||
|
set b [expr $d3 / cos($omegarad)]
|
||||||
|
set c [expr $d3 / cos($argrad-$omegarad)]
|
||||||
|
set h4 [expr sqrt(pow($b,2) + pow($c,2) - 2*$b*$c*cos($argrad))]
|
||||||
|
if { [catch {checkMotionAndDrive dz [expr $h3 + $h4]} errMsg]} {return -code error $errMsg}
|
||||||
|
if { [catch {checkMotionAndDrive st4vt [expr $h2 + $h1]} errMsg]} {return -code error $errMsg}
|
||||||
|
|
||||||
|
}
|
||||||
|
FOC {
|
||||||
|
set d1 [SplitReply [dy]]
|
||||||
|
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
||||||
|
set h1 [expr $d1 * tan($argrad)]
|
||||||
|
set h2 [expr $d2 * tan($argrad)]
|
||||||
|
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
|
||||||
|
if { [catch {checkMotionAndDrive st4vt $h2} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
MT {
|
||||||
|
set d1 [SplitReply [dy]]
|
||||||
|
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
||||||
|
set h1 [expr $d1 * tan($argrad)]
|
||||||
|
set h2 [expr $d2 * tan($argrad)]
|
||||||
|
if { [catch {checkMotionAndDrive dz $h1} errMsg]} {return -code error $errMsg}
|
||||||
|
if { [catch {checkMotionAndDrive st4vt $h2} errMsg]} {return -code error $errMsg}
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
return -code error "two_theta not defined for that mode: $expmode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
twotheta $arg
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
publish ::exp_mode::set_two_theta user
|
||||||
|
|
||||||
|
proc ::exp_mode::checkMotion { scan_variable target } {
|
||||||
|
set motor_list [sicslist type motor]
|
||||||
|
|
||||||
|
if {[lsearch $motor_list $scan_variable]==-1} {
|
||||||
|
return -code error "you tried to drive a motor that doesn't exist"
|
||||||
|
}
|
||||||
|
if {[catch {
|
||||||
|
::scan::check_limit $scan_variable hardlowerlim $target
|
||||||
|
::scan::check_limit $scan_variable hardupperlim $target
|
||||||
|
::scan::check_limit $scan_variable softlowerlim $target
|
||||||
|
::scan::check_limit $scan_variable softupperlim $target
|
||||||
|
}]} {
|
||||||
|
return -code error $::errorInfo
|
||||||
|
}
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
publish ::exp_mode::checkMotion user
|
||||||
|
|
||||||
|
proc ::exp_mode::checkMotionAndDrive { scan_variable target } {
|
||||||
|
set motor_list [sicslist type motor]
|
||||||
|
#lappend motorlist [sicslist type configurablevirtualmotor]
|
||||||
|
|
||||||
|
set precision [SplitReply [$scan_variable precision]]
|
||||||
|
|
||||||
|
if {[catch {
|
||||||
|
::exp_mode::checkMotion $scan_variable $target
|
||||||
|
}]} {
|
||||||
|
return -code error $::errorInfo
|
||||||
|
} else {
|
||||||
|
drive $scan_variable $target
|
||||||
|
set position [SplitReply [$scan_variable]]
|
||||||
|
if {[expr [expr $position-$target] > abs($precision)]} {
|
||||||
|
return -code error "move of: $scan_variable did not reach required precision"
|
||||||
|
} else {
|
||||||
|
Clientput "New $scan_variable Position: $position"
|
||||||
|
Clientput "Driving finished successfully"
|
||||||
|
}
|
||||||
|
return -code ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publish ::exp_mode::checkMotionAndDrive user
|
||||||
|
|
||||||
|
proc ::exp_mode::deg2rad { arg } {
|
||||||
|
set pi 3.1415926535897931
|
||||||
|
return [expr $pi * $arg / 180.]
|
||||||
|
}
|
||||||
|
|
||||||
|
proc ::exp_mode::rad2deg { arg } {
|
||||||
|
set pi 3.1415926535897931
|
||||||
|
return [expr 180. * $arg / $pi]
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Commands initialisation procedure
|
||||||
|
proc ::commands::isc_initialize {} {
|
||||||
|
::commands::ic_initialize
|
||||||
|
}
|
||||||
|
|||||||
@@ -901,7 +901,7 @@ 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 ss4vg gap ss4vo offset ss4u ss4d mm $slit4VGroup
|
||||||
make_gap_motors ss4hg gap ss4ho offset ss4r ss4l mm $slit4HGroup
|
make_gap_motors ss4hg gap ss4ho offset ss4r ss4l mm $slit4HGroup
|
||||||
|
|
||||||
proc set_two_theta { arg } {
|
proc ds_set_two_theta { arg } {
|
||||||
set rad [expr ($arg/180.0)*3.1415926535897932384626433832795]
|
set rad [expr ($arg/180.0)*3.1415926535897932384626433832795]
|
||||||
set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]]
|
set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]]
|
||||||
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
set d2 [expr [SplitReply [slit4_distance]] - [SplitReply [sample_distance]]]
|
||||||
@@ -909,18 +909,18 @@ proc set_two_theta { arg } {
|
|||||||
set h2 [expr [SplitReply [slit4_base]] + $d2 * tan($rad)]
|
set h2 [expr [SplitReply [slit4_base]] + $d2 * tan($rad)]
|
||||||
return "dz=$h1,st4vt=$h2"
|
return "dz=$h1,st4vt=$h2"
|
||||||
}
|
}
|
||||||
publish set_two_theta user
|
publish ds_set_two_theta user
|
||||||
|
|
||||||
proc get_two_theta {} {
|
proc rs_get_two_theta {} {
|
||||||
set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]]
|
set d1 [expr [SplitReply [detector_distance]] - [SplitReply [sample_distance]]]
|
||||||
set h1 [expr [SplitReply [dz]] - [SplitReply [detector_base]]]
|
set h1 [expr [SplitReply [dz]] - [SplitReply [detector_base]]]
|
||||||
return [expr (180.0*atan2($h1, $d1))/3.1415926535897932384626433832795]
|
return [expr (180.0*atan2($h1, $d1))/3.1415926535897932384626433832795]
|
||||||
}
|
}
|
||||||
publish get_two_theta user
|
publish rs_get_two_theta user
|
||||||
|
|
||||||
MakeConfigurableMotor two_theta
|
MakeConfigurableMotor two_theta
|
||||||
two_theta readscript get_two_theta
|
two_theta readscript rs_get_two_theta
|
||||||
two_theta drivescript set_two_theta
|
two_theta drivescript ds_set_two_theta
|
||||||
sicslist setatt two_theta klass sample
|
sicslist setatt two_theta klass sample
|
||||||
sicslist setatt two_theta long_name two_theta
|
sicslist setatt two_theta long_name two_theta
|
||||||
sicslist setatt two_theta units degrees
|
sicslist setatt two_theta units degrees
|
||||||
|
|||||||
@@ -11,17 +11,61 @@ foreach vn {
|
|||||||
sample_base
|
sample_base
|
||||||
slit3_distance
|
slit3_distance
|
||||||
slit3_base
|
slit3_base
|
||||||
|
guide1_distance
|
||||||
|
guide1_base
|
||||||
|
guide2_distance
|
||||||
|
guide2_base
|
||||||
|
slit2_distance
|
||||||
|
slit2_base
|
||||||
|
chopper4_distance
|
||||||
|
chopper4_base
|
||||||
|
chopper3_distance
|
||||||
|
chopper3_base
|
||||||
|
chopper2_distance
|
||||||
|
chopper2_base
|
||||||
|
chopper1_distance
|
||||||
|
chopper1_base
|
||||||
|
slit1_distance
|
||||||
|
slit1_base
|
||||||
|
omega
|
||||||
|
twotheta
|
||||||
} {
|
} {
|
||||||
::utility::mkVar $vn float manager $vn true parameter true true
|
::utility::mkVar $vn float manager $vn true parameter true true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach vn {
|
||||||
|
mode
|
||||||
|
guide_element
|
||||||
|
} {
|
||||||
|
::utility::mkVar $vn Text manager $vn true parameter true true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
detector_distance 10000
|
detector_distance 10000
|
||||||
detector_base 300
|
detector_base 300
|
||||||
slit4_distance 6000
|
slit4_distance 5527
|
||||||
slit4_base 20
|
slit4_base 20
|
||||||
sample_distance 5800
|
sample_distance 5129
|
||||||
sample_base 50
|
sample_base 50
|
||||||
slit3_distance 5600
|
slit3_distance 4808
|
||||||
slit3_base 20
|
slit3_base 20
|
||||||
|
guide1_distance 2979
|
||||||
|
guide1_base
|
||||||
|
guide2_distance 3279
|
||||||
|
guide2_base
|
||||||
|
slit2_distance 1895
|
||||||
|
slit2_base 20
|
||||||
|
chopper4_distance 823
|
||||||
|
chopper4_base 20
|
||||||
|
chopper3_distance 370
|
||||||
|
chopper3_base 20
|
||||||
|
chopper2_distance 102
|
||||||
|
chopper2_base 20
|
||||||
|
chopper1_distance 0
|
||||||
|
chopper1_base 20
|
||||||
|
slit1_distance -244
|
||||||
|
slit1_base 20
|
||||||
|
mode NONE
|
||||||
|
omega -1
|
||||||
|
twotheta -1
|
||||||
|
guide_element NONE
|
||||||
|
|||||||
@@ -4,3 +4,7 @@ namespace eval motor {
|
|||||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||||
variable is_homing_list ""
|
variable is_homing_list ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc ::commands::isc_initialize {} {
|
||||||
|
::commands::ic_initialize
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# SICS common configuration
|
# SICS common configuration
|
||||||
|
|
||||||
# $Revision: 1.39 $
|
# $Revision: 1.40 $
|
||||||
# $Date: 2008-08-14 05:00:18 $
|
# $Date: 2008-08-18 03:01:29 $
|
||||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
# Last revision by $Author: ffr $
|
# Last revision by $Author: ffr $
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
|||||||
sics_release lock
|
sics_release lock
|
||||||
|
|
||||||
::utility::mkVar sics_revision_num Text internal
|
::utility::mkVar sics_revision_num Text internal
|
||||||
set tmpstr [string map {"$" ""} {$Revision: 1.39 $}]
|
set tmpstr [string map {"$" ""} {$Revision: 1.40 $}]
|
||||||
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||||
sics_revision_num lock
|
sics_revision_num lock
|
||||||
|
|
||||||
@@ -172,6 +172,7 @@ proc server_set_sobj_attributes {} {
|
|||||||
::counter::set_sobj_attributes
|
::counter::set_sobj_attributes
|
||||||
::nexus::set_sobj_attributes
|
::nexus::set_sobj_attributes
|
||||||
::histogram_memory::set_sobj_attributes
|
::histogram_memory::set_sobj_attributes
|
||||||
|
::utility::set_chopper_attributes
|
||||||
## TODO move the following to the new ansto gumxml.tcl
|
## TODO move the following to the new ansto gumxml.tcl
|
||||||
sicslist setatt getgumtreexml privilege internal
|
sicslist setatt getgumtreexml privilege internal
|
||||||
clientput "serverport [get_portnum $::serverport]"
|
clientput "serverport [get_portnum $::serverport]"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Some useful functions for SICS configuration.
|
# Some useful functions for SICS configuration.
|
||||||
|
|
||||||
# $Revision: 1.14 $
|
# $Revision: 1.15 $
|
||||||
# $Date: 2008-07-11 01:09:57 $
|
# $Date: 2008-08-18 03:01:29 $
|
||||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||||
# Last revision by $Author: ffr $
|
# Last revision by $Author: ffr $
|
||||||
|
|
||||||
@@ -484,6 +484,19 @@ proc ::utility::set_motor_attributes {} {
|
|||||||
sicslist setatt $m mutable true
|
sicslist setatt $m mutable true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
proc ::utility::set_chopper_attributes {} {
|
||||||
|
foreach ch [lrange [sicslist type chopperadapter] 1 end] {
|
||||||
|
sicslist setatt $ch kind hobj
|
||||||
|
sicslist setatt $ch data true
|
||||||
|
sicslist setatt $ch control true
|
||||||
|
sicslist setatt $ch nxsave true
|
||||||
|
sicslist setatt $ch privilege user
|
||||||
|
sicslist setatt $ch nxalias $ch
|
||||||
|
sicslist setatt $ch long_name $ch
|
||||||
|
sicslist setatt $ch mutable true
|
||||||
|
sicslist setatt $ch klass disk_chopper
|
||||||
|
}
|
||||||
|
}
|
||||||
proc ::utility::set_envcontrol_attributes {} {
|
proc ::utility::set_envcontrol_attributes {} {
|
||||||
if [ catch {
|
if [ catch {
|
||||||
foreach ec [sicslist type environment_controller] {
|
foreach ec [sicslist type environment_controller] {
|
||||||
|
|||||||
Reference in New Issue
Block a user