Histmem now only calls TaskYield after SICS has finished initalising, this stops the statusfile task from being called early and overwriting the status file. Created ANSTO_MakeHistMemory command to install ANSTO_HistAction Added veto functions. Mapped the HistDriver interface Pause() and Continue() commands to AnstoHttpVeto and AnstoHttpNoVeto. Implemented an ANSTO_Histaction to call AnstoHttpPause when sent a "pause" subcommand. hmcontrol_ansto.c Call AnstoHttpPause() directly when Pause_HM_After_Count is set to preserver current behaviour. counterdriv.c Now sends the correct "SICS RESUME" command to resume a paused count. ansto_sctdriveadapter.c NEW This lets you create driveable objects from script-context controllers which have one node for setting a parameter and another node for reading the parameter (eg temperature controllers, choppers, velocity selectors) sctemonadapter.c NEW This generates an environment monitor interface for script-context controllers so that the emon object in SICS will be able to pause counters if the controller goes out of tolerance. sct_usbtmcprot.c, usbtmc.h NEW First attempt at a protocol handler for USB Test and Measurement Class devices sct_julabo_lh45.tcl NEW Implements script-context controller for the Julabo LH45 temperature controller. Makefile Added ansto_sctdriveadapter and sctemonadapter hardsup/makefile Added velocity selector and usbtmc protocol handlers hardsup/sct_velselprot.c Simplified, don't worry about trying to implement a login handler for now, just implement a "Reading" handler. site_ansto.c Add the velocity selector and USBTMC protocol handlers. Added the ANSTO_MakeHM command instrument/config/hipadaba/common_instrument_dictionary.tcl Added support for auxiliary data, ie extra meta-data entries in the "data" group of the nexus file. Add new NXvelocity_selector object under /instrument. instrument/config/hipadaba/hipadaba_configuration_common.tcl Add the new "sct_object" script-context controller objects to the hdb tree. instrument/config/hipadaba/instdict_specification.tcl Define the new sct_object controllers. instrument/config/hmm/hmm_configuration_common_1.tcl Use the new ANSTO_MakeHM command to create histmem drivers which support veto. Define allowed attributes and elements for the BAT_TABLE and FAT_TABLE Stop between counts instead of pausing because setting pause now sends a veto. instrument/config/motors/sct_jogmotor_common.tcl You now need to specify klass when creating a jogmotor. instrument/config/motors/sct_positmotor_common.tcl You can now specify an optional function which calculates the instrument parameter (eg attenuation) from a posit table entry when defining a posit motor. instrument/config/nexus/nxscripts_common_1.tcl Report file status info in the /experiment section of the hdb tree. Add auxiliary data to data file. Handle saving data from script-context controller objects. instrument/util/script_context_util.tcl Added procedure to set required properties for saving script-context object data. instrument/util/utility.tcl Added set_sct_object_attributes proc to automatically set required attributes on SCT_OBJECTs Fixed hlistplainprop to deal with empty property fields on hdb nodes. instrument/server_config.tcl Call the new nexus initialisation command and set attributes on sct objects. hrpd/config/motors/motor_configuration.tcl New absenc home readings for mchi and mphi. New absenc home and range for mf1 hipd/config/commands/commands.tcl Exported and published the new ajscmds so that they can be used in batch files. hipd/config/motors/motor_configuration.tcl New mchi absenc home rsd/config/hmm/hmm_configuration.tcl Provide support for saving corrected hmm data rsd/config/motors/motor_configuration.tcl Use simple names for motors. SICS-329 sans/config/INSTCFCOMMON.TXT Added julabo and lakeshore configuration files to list. sans/config/optics/guide_configuration.tcl Added entrance aperture positions to the configuration table and the cn_maps which map the index to the component ID. sans/commands/commands.tcl The "guide" command now set EApPosYmm after driving the guides in place. The indexed position to component maps (cn_map) have been moved to the guide_configuration.tcl file. sans/motors/motor_configuration.tcl Set samy home to 56.1mm sans/config/velsel/sct_velsel.tc NEW Implements script-context controller object for the NVS40 velocity selector. TODO tilt-angle control, driveable interface. sans/config/hmm/hmm_configuration.tcl Set 5.08mm spacing on detector width. Use pixel-offset for vertical and horizontal detector axes. sans/config/motors/motor_configuration.tcl Swap directions of beamstops 4 and 5 (the two smallest) New config parameters for samx, samthet, apx, det, detoff, bsz, sans/config/motors/positmotor_configuration.tcl Added descriptive headers to positmotor configuration tables and new synstax for the make positmotor command. sans/config/nexus/nxscripts.tcl Implemented initialisation command. sans/config/parameters/parameters.tcl Added SampleThickness and TransmissionFlag. Calculate SamplePosYmm from samy and SamyOffsetmm. Added beamstops to hdb tree. reflectometer/config/nexus/nxscripts.tcl Implement the initialisation procedure. r2767 | ffr | 2009-03-31 10:16:54 +1100 (Tue, 31 Mar 2009) | 123 lines
416 lines
13 KiB
Tcl
416 lines
13 KiB
Tcl
##
|
|
# @brief We can't change the coordinate scheme at runtime because this would require
|
|
# restructuring the hdb tree, but we should save it.
|
|
foreach {var lname nxname} {
|
|
VelSelCoordScheme VelSelCoordScheme coordinate_scheme
|
|
SApCoordScheme SApCoordScheme coordinate_scheme
|
|
EApCoordScheme EApCoordScheme coordinate_scheme
|
|
SampleCoordScheme SampleCoordScheme coordinate_scheme
|
|
DetCoordScheme DetCoordScheme coordinate_scheme
|
|
BeamstopCoordScheme BeamstopCoordScheme coordinate_scheme
|
|
CollCoordScheme CollCoordScheme coordinate_scheme
|
|
} {
|
|
::utility::mkVar $var text readonly $lname true @none false true
|
|
$var Cartesian
|
|
$var lock
|
|
}
|
|
|
|
##
|
|
# @brief User privilege text variables
|
|
#
|
|
foreach {var lname type nxname priv units klass} {
|
|
SApShape SApShape text shape user none parameter
|
|
BSShape BSShape text shape user none parameter
|
|
SampleThickness thickness float thickness user mm sample
|
|
TransmissionFlag transmission_flag int transmission user none sample
|
|
} {
|
|
::utility::mkVar $var $type $priv $lname true $klass true true
|
|
if {$units != "none"} {
|
|
sicslist setatt $var units $units
|
|
}
|
|
}
|
|
|
|
##
|
|
# @brief The velocity selector position is used as the reference for other instrument
|
|
# component positions. For simplicity we set it as the origin x=y=z=0.
|
|
foreach {var lname nxname units klass} {
|
|
VelSelPosXmm VelSelPosXmm x mm @none
|
|
VelSelPosYmm VelSelPosYmm y mm @none
|
|
VelSelPosZmm VelSelPosZmm z mm @none
|
|
EndFacePosYmm EndFacePosYmm y mm parameter
|
|
RotApPosYmm RotApPosYmm y mm @none
|
|
} {
|
|
::utility::mkVar $var float readonly $lname true $klass true true
|
|
if {$units != 1} {
|
|
sicslist setatt $var units $units
|
|
}
|
|
}
|
|
|
|
# ::utility::mkVar SampleNum int readonly changer_position true parameter true true
|
|
|
|
##
|
|
# @brief Parameter SicsVariables
|
|
foreach {var lname nxname units priv } {
|
|
LambdaA LambdaA wavelength Ao user
|
|
LambdaResFWHM_percent LambdaResFWHM_percent wavelength_spread 1 user
|
|
VSdeg VSdeg twist degrees user
|
|
VSrpm VSrpm rotation_speed rpm user
|
|
EApYmm EApYmm y mm user
|
|
EApPosYmm EApPosYmm y mm user
|
|
SApXmm SApXmm x mm user
|
|
SApZmm SApZmm z mm user
|
|
SApPosXmm SApPosXmm x mm user
|
|
SApPosYmm SApPosYmm y mm user
|
|
SApPosZmm SApPosZmm z mm user
|
|
SamplePosXmm SamplePosXmm x mm user
|
|
SamYOffsetmm SamYOffsetmm y mm user
|
|
SamplePosZmm SamplePosZmm z mm user
|
|
DetPosYOffsetmm DetPosYOffsetmm detposyoffset mm user
|
|
BSXmm BSXmm x mm user
|
|
BSZmm BSZmm z mm user
|
|
Transmission Transmission Transmission 1 user
|
|
BeamCenterX BeamCenterX BeamCenterX mm user
|
|
BeamCenterZ BeamCenterZ BeamCenterZ mm user
|
|
} {
|
|
::utility::mkVar $var float $priv $lname true parameter true true
|
|
if {$units != 1} {
|
|
sicslist setatt $var units $units
|
|
}
|
|
}
|
|
|
|
# Derived Parameter SicsVariables
|
|
foreach {var type lname units depends} {
|
|
AttFactor float AttFactor 1 AttRotDeg,LambdaA,LambdaResFWHM_percent
|
|
PleXmm float PleXmm mm AttRotDeg
|
|
EApXmm float EApXmm mm RotApDeg
|
|
EApZmm float EApZmm mm RotApDeg
|
|
RotApXmm float RotApXmm mm RotApDeg
|
|
RotApZmm float RotApZmm mm RotApDeg
|
|
EApShape text EApShape 1 RotApDeg
|
|
RotApShape text RotApShape 1 RotApDeg
|
|
} {
|
|
::utility::mkVar $var $type user $lname true derived_parameter true true
|
|
sicslist setatt $var depends $depends
|
|
if {$units != 1} {
|
|
sicslist setatt $var units $units
|
|
}
|
|
}
|
|
proc sicsmsgfmt {args} {return "[info level -1] = $args"}
|
|
::utility::macro::getset float SamplePosYmm {} {
|
|
set sy [SplitReply [samy]]
|
|
set syo [SplitReply [SamYOffsetmm]]
|
|
return [sicsmsgfmt [expr {$sy+$syo}]]
|
|
}
|
|
sicslist setatt SamplePosYmm long_name SamplePosYmm
|
|
sicslist setatt SamplePosYmm klass derived_parameter
|
|
sicslist setatt SamplePosYmm units mm
|
|
sicslist setatt SamplePosYmm depends samy,SamYOffsetmm
|
|
|
|
::utility::macro::getset float L1mm {} {
|
|
set efpy [SplitReply [EndFacePosYmm]]
|
|
set samposy [SplitReply [SamplePosYmm]]
|
|
set eapy [SplitReply [EApPosYmm]]
|
|
return [sicsmsgfmt [expr {$efpy + $samposy - $eapy}]]
|
|
}
|
|
sicslist setatt L1mm long_name L1mm
|
|
sicslist setatt L1mm klass derived_parameter
|
|
sicslist setatt L1mm units mm
|
|
sicslist setatt L1mm depends EndFacePosYmm,SApPosYmm,EApPosYmm
|
|
|
|
::utility::macro::getset float L2mm {} {
|
|
set detpy [SplitReply [DetPosYmm]]
|
|
set detpyos [SplitReply [DetPosYOffsetmm]]
|
|
set sapy [SplitReply [SamplePosYmm]]
|
|
return [sicsmsgfmt [expr {$detpy + $detpyos - $sapy}]]
|
|
}
|
|
sicslist setatt L2mm long_name L2mm
|
|
sicslist setatt L2mm klass derived_parameter
|
|
sicslist setatt L2mm units mm
|
|
sicslist setatt L2mm depends DetPosYmm,DetPosYOffsetmm,SamplePosYmm
|
|
|
|
# Derive motor parameters
|
|
foreach {pname motor units} {
|
|
DetPosXmm detoff mm
|
|
DetPosYmm det mm
|
|
BSPosXmm bsx mm
|
|
BSPosZmm bsz mm
|
|
SampleTiltXDeg samphi degrees
|
|
SampleTiltYDeg samchi degrees
|
|
SampleRotDeg samthet degrees
|
|
} {
|
|
::utility::macro::getset float $pname {} [subst -nocommands {
|
|
return [sicsmsgfmt [SplitReply [$motor]]]
|
|
}]
|
|
sicslist setatt $pname units $units
|
|
sicslist setatt $pname long_name $pname
|
|
sicslist setatt $pname klass derived_parameter
|
|
# sicslist setatt $pname depends $motor
|
|
}
|
|
|
|
foreach {pname motor units} {
|
|
AttRotDeg att degrees
|
|
} {
|
|
::utility::macro::getset float $pname {args} [subst -nocommands {
|
|
# TODO AttFactor
|
|
if {[set args] == ""} {
|
|
return [sicsmsgfmt [SplitReply [$motor]]]
|
|
} else {
|
|
set target [lindex [set args] 0]
|
|
Plexmm -1
|
|
${pname}_status "BUSY"
|
|
drive $motor \$target
|
|
set motpos [SplitReply [$motor]]
|
|
set tolerance [SplitReply [$motor precision] ]
|
|
if {[expr abs(\$motpos - \$target)] > \$tolerance} {
|
|
${pname}_status "IDLE"
|
|
error "ERROR: failed to set $pname target \$target"
|
|
} else {
|
|
Plexmm [::optics::AttRotLookup \$target]
|
|
}
|
|
${pname}_status "IDLE"
|
|
}
|
|
}]
|
|
sicslist setatt $pname units $units
|
|
sicslist setatt $pname long_name $pname
|
|
sicslist setatt $pname klass derived_parameter
|
|
# sicslist setatt $pname depends $motor
|
|
# TODO SICS-198 add feedback support to getset macro generator
|
|
VarMake ${pname}_status text user
|
|
${pname}_status "IDLE"
|
|
}
|
|
|
|
foreach {pname motor units} {
|
|
RotApDeg srce degrees
|
|
} {
|
|
::utility::macro::getset float $pname {args} [subst -nocommands {
|
|
if {[set args] == ""} {
|
|
return [sicsmsgfmt [SplitReply [$motor]]]
|
|
} else {
|
|
set target [lindex [set args] 0]
|
|
RotApXmm 0
|
|
RotApZmm 0
|
|
RotApShape "UNKNOWN"
|
|
EApXmm 0
|
|
EApZmm 0
|
|
EApShape "UNKNOWN"
|
|
${pname}_status "BUSY"
|
|
drive $motor \$target
|
|
set motpos [SplitReply [$motor]]
|
|
set tolerance [SplitReply [$motor precision] ]
|
|
if {[expr abs(\$motpos - \$target)] > \$tolerance} {
|
|
${pname}_status "IDLE"
|
|
error "ERROR: failed to set $pname target \$target"
|
|
} else {
|
|
set size [::optics::EApLookUp \$target "size"]
|
|
set shape [::optics::EApLookUp \$target "shape"]
|
|
RotApXmm \$size
|
|
RotApZmm \$size
|
|
RotApShape \$shape
|
|
EApXmm \$size
|
|
EApZmm \$size
|
|
EApShape \$shape
|
|
}
|
|
${pname}_status "IDLE"
|
|
}
|
|
}]
|
|
sicslist setatt $pname units $units
|
|
sicslist setatt $pname long_name $pname
|
|
sicslist setatt $pname klass derived_parameter
|
|
# sicslist setatt $pname depends $motor
|
|
# TODO SICS-198 add feedback support to getset macro generator
|
|
VarMake ${pname}_status text user
|
|
${pname}_status "IDLE"
|
|
}
|
|
################################################################################
|
|
##
|
|
# @brief This is the position of the velocity selector bunker face. It is used
|
|
# as the reference for other positions. x=y=z=0.
|
|
#::hdb::MakeVelocity_Selector velocity_selector {
|
|
# wavelength LambdaA
|
|
# wavelength_spread LambdaResFWHM_percent
|
|
# coordinate_scheme VelSelCoordScheme
|
|
# position {VelSelPosXmm VelSelPosYmm VelSelPosZmm}
|
|
#}
|
|
|
|
::hdb::MakeAperture sample_aperture {
|
|
shape SApShape
|
|
size {SApXmm SApZmm}
|
|
coordinate_scheme SApCoordScheme
|
|
position {SApPosXmm SApPosYmm SApPosZmm}
|
|
refpos {VelSelPosXmm EndFacePosYmm VelSelPosZmm}
|
|
}
|
|
|
|
::hdb::MakeAperture entrance_aperture {
|
|
shape EApShape
|
|
size {EApXmm EApYmm EApZmm}
|
|
coordinate_scheme EApCoordScheme
|
|
position EApPosYmm
|
|
refpos VelSelPosYmm
|
|
}
|
|
|
|
::hdb::MakeAperture rotary_aperture {
|
|
shape RotApShape
|
|
size {RotApXmm RotApZmm}
|
|
position RotApPosYmm
|
|
orientation RotApDeg
|
|
refpos VelSelPosYmm
|
|
}
|
|
|
|
#::hdb::MakeGeometry sample_geometry sample {
|
|
# coordinate_scheme SampleCoordScheme
|
|
# position {SamplePosXmm SamplePosYmm SamplePosZmm}
|
|
# orientation {SampleTiltXDeg SampleTiltYDeg SampleRotDeg}
|
|
# refpos {VelSelPosXmm EndFacePosYmm VelSelPosZmm}
|
|
#}
|
|
|
|
::hdb::MakeGeometry detector_geometry detector {
|
|
coordinate_scheme DetCoordScheme
|
|
position {DetPosXmm DetPosYmm}
|
|
offset DetPosYOffsetmm
|
|
refpos {VelSelPosXmm EndFacePosYmm}
|
|
}
|
|
|
|
::hdb::MakeGeometry collimator_geometry collimator {
|
|
coordinate_scheme CollCoordScheme
|
|
position EndFacePosYmm
|
|
refpos VelSelPosYmm
|
|
}
|
|
|
|
::hdb::MakeGeometry beamstop_geometry beam_stop {
|
|
shape BSShape
|
|
position {BSPosXmm BSPosZmm}
|
|
size {BSXmm BSZmm}
|
|
}
|
|
|
|
# INITIALISE PARAMETERS
|
|
# The collimation system aperture positions
|
|
# Reference position is outer wall of velocity selector bunker, ie VelSelPosYmm
|
|
array set collapposmm {
|
|
inputguide 633
|
|
apwheel 675
|
|
ap1 4929
|
|
ap2 6934
|
|
ap3 8949
|
|
ap4 10955
|
|
ap5 12943
|
|
ap6 14970
|
|
ap7 16971
|
|
ap9 19925
|
|
}
|
|
|
|
VelSelPosXmm 0.0
|
|
VelSelPosYmm 0.0
|
|
VelSelPosZmm 0.0
|
|
EndFacePosYmm 20095
|
|
RotApPosYmm 675
|
|
|
|
################################################################################
|
|
# Check Config
|
|
namespace eval parameters {
|
|
set paramlist {
|
|
AttFactor
|
|
AttRotDeg
|
|
BS1
|
|
BS2
|
|
BS3
|
|
BS4
|
|
BS5
|
|
BSPosXmm
|
|
BSPosZmm
|
|
BSShape
|
|
BSXmm
|
|
BSZmm
|
|
C1
|
|
C2
|
|
C3
|
|
C4
|
|
C5
|
|
C6
|
|
C7
|
|
C8
|
|
C9
|
|
DetPosXmm
|
|
DetPosYmm
|
|
DetPosYOffsetmm
|
|
EApPosYmm
|
|
EApShape
|
|
EApShape
|
|
EApXmm
|
|
EApYmm
|
|
EApZmm
|
|
EndFacePosYmm
|
|
L1mm
|
|
L2mm
|
|
LambdaA
|
|
LambdaResFWHM_percent
|
|
Pent
|
|
Plexmm
|
|
RotApDeg
|
|
RotApShape
|
|
RotApXmm
|
|
RotApZmm
|
|
SampleAttributes
|
|
SampleComments
|
|
SampleName
|
|
SampleNum
|
|
SamplePosXmm
|
|
SamplePosYmm
|
|
SamplePosZmm
|
|
SampleRotDeg
|
|
SampleTiltXDeg
|
|
SampleTiltYDeg
|
|
SampleTitle
|
|
SApPosXmm
|
|
SApPosYmm
|
|
SApPosZmm
|
|
SApShape
|
|
SApXmm
|
|
SApZmm
|
|
VSdeg
|
|
VSrpm
|
|
}
|
|
}
|
|
##
|
|
# @brief List undefined parameters
|
|
proc ::parameters::missingparams {} {
|
|
variable paramlist
|
|
set num 0
|
|
foreach param $paramlist {
|
|
if {[sicslist match $param] == " "} {
|
|
clientput $param
|
|
incr num
|
|
}
|
|
}
|
|
if {$num > 0} {
|
|
clientput "There are $num missing parameters"
|
|
} else {
|
|
clientput "OK"
|
|
}
|
|
}
|
|
|
|
##
|
|
# @brief Check list
|
|
proc check {args} {
|
|
switch $args {
|
|
"missing" {
|
|
::parameters::missingparams
|
|
}
|
|
}
|
|
}
|
|
publish check user
|
|
|
|
foreach {pname bsname} {
|
|
beamstop110 bs1
|
|
beamstop88 bs2
|
|
beamstop66 bs3
|
|
beamstop44 bs4
|
|
beamstop22 bs5
|
|
} {
|
|
::utility::macro::getset text $pname {} [subst -nocommands {
|
|
return [$bsname status]
|
|
}]
|
|
sicslist setatt $pname long_name $pname
|
|
sicslist setatt $pname mutable false
|
|
sicslist setatt $pname klass derived_parameter
|
|
}
|