SICS-294 anstohttp.c

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
This commit is contained in:
Ferdi Franceschini
2009-03-31 10:16:54 +11:00
committed by Douglas Clowes
parent eec824f98a
commit d2f57e4615
39 changed files with 2026 additions and 557 deletions

View File

@@ -12,3 +12,5 @@ config/scan/scan_common_1.tcl
config/nexus/nxscripts_common_1.tcl
config/commands/commands_common.tcl
config/motors/sct_positmotor_common.tcl
config/environment/temperature/sct_julabo_lh45.tcl
config/environment/temperature/config/lakeshore340_common.tcl

View File

@@ -39,11 +39,11 @@ namespace eval optics {
##############################
##
# @brief set_guide uses a lookup table to setup the collimation system
# @brief The "guide" command uses a lookup table to setup the collimation system
# @param row, selects a row from the guide configuration table
#
# eg\n
# set_guide HIRES
# guide ga
command guide "
text=[join [array names ::optics::guide_configuration] , ] configuration
" {
@@ -51,22 +51,16 @@ namespace eval optics {
variable guide_configuration
variable guide_configuration_columns
if [ catch {
array set c1_map {G 1 MT 2 P 3}
array set c2_map {MT 1 G 2 A 3}
array set c3_map {MT 1 G 2 A 3}
array set c4_map {MT 1 G 2 A 3}
array set c5_map {MT 1 G 2 A 3}
array set c6_map {MT 1 G 2 A 3}
array set c7_map {MT 1 G 2 A 3}
array set c8_map {MT 1 G 2 A 3}
array set c9_map {LP 1 MT 2 G 3 A 4 L 5}
foreach el $guide_configuration($configuration) guide $guide_configuration_columns {
lappend to_config $guide
lappend to_config [set ${guide}_map($el)]
foreach {compselection position} $guide_configuration($configuration) {
foreach el $compselection guide $guide_configuration_columns {
lappend to_config $guide
lappend to_config [set ::optics::${guide}_map($el)]
}
::optics::guide -set feedback status BUSY
set msg [eval "drive $to_config"]
EApPosYmm $position
}
::optics::guide -set feedback status BUSY
eval "drive $to_config"
} message ] {
::optics::guide -set feedback status IDLE
if {$::errorCode=="NONE"} {return $message}

View File

@@ -38,7 +38,9 @@ proc ::histogram_memory::isc_initialize {} {
::histogram_memory::ic_initialize
detector_active_height_mm 980
detector_active_width_mm 980
detector_active_width_mm [expr 5.08 * 192]
detector_active_height_mm lock
detector_active_width_mm lock
# hmm configure FAT_SIMULATED_EVENT_Y0 $y_bb0
# hmm configure FAT_SIMULATED_EVENT_Y1 $ybbmax
@@ -47,8 +49,8 @@ proc ::histogram_memory::isc_initialize {} {
::histogram_memory::init_OAT_TABLE
::histogram_memory::upload_config Filler_defaults
::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_bin
::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::x_bin
::nexus::data alias ::histogram_memory::vertical_axis ::histogram_memory::y_pixel_offset
::nexus::data alias ::histogram_memory::horizontal_axis ::histogram_memory::x_pixel_offset
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message

View File

@@ -1,5 +1,5 @@
# $Revision: 1.26 $
# $Date: 2008-11-03 08:59:56 $
# $Revision: 1.27 $
# $Date: 2009-03-30 23:16:53 $
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Last revision by: $Author: ffr $
@@ -47,16 +47,16 @@ set bs45_gear 110.0
set bs123_gear 160.0
#set bs45_gear 160.0
#set bs123_gear 110.0
set bs124sign -1
set bs35sign 1
set bs125sign -1
set bs34sign 1
#Measured absolute encoder reading at home position
set samchi_Home 7808328
set samphi_Home 7675008
set samx_Home 7414223
set samx_Home 7420441
set samy_Home 7101486
set samz_Home 9944901
set samthet_Home 22997883
set samthet_Home 23004075
set det_Home 7055209
set detoff_Home 6932100
@@ -67,7 +67,7 @@ set pent_Home 8123563
#set srce_Home 7826986
#set srce_Home 7518434
set srce_Home 7518652
set apx_Home 7500000
set apx_Home 12965422
set apz_Home 7500000
set att_Home 24782942
@@ -374,8 +374,8 @@ Motor det $motor_driver_type [params \
action MC1\
axis G\
units mm\
hardlowerlim 350\
hardupperlim 19000\
hardlowerlim 320\
hardupperlim 19345\
maxSpeed 40\
maxAccel 5\
maxDecel 10\
@@ -386,8 +386,8 @@ Motor det $motor_driver_type [params \
det part detector
det long_name detector_y
det precision 1
det softlowerlim 400
det softupperlim 18900
det softlowerlim 350
det softupperlim 19330
det home 350.5
det speed 20
det Blockage_Fail 0
@@ -401,7 +401,7 @@ Motor detoff $motor_driver_type [params \
axis H\
units mm\
hardlowerlim -50\
hardupperlim 450\
hardupperlim 420\
maxSpeed 10\
maxAccel 1\
maxDecel 10\
@@ -412,7 +412,7 @@ Motor detoff $motor_driver_type [params \
detoff part detector
detoff long_name detector_x
detoff softlowerlim -50
detoff softupperlim 450
detoff softupperlim 410
detoff home 0
############################
@@ -754,19 +754,21 @@ Motor apx $motor_driver_type [params \
port pmc3-quokka\
axis E\
units mm\
hardlowerlim -10\
hardupperlim 360\
maxSpeed 1\
maxAccel 1\
maxDecel 1\
stepsPerX 25000\
hardlowerlim -260\
hardupperlim 5\
maxSpeed 5\
maxAccel 5\
maxDecel 5\
stepsPerX 2500\
absEnc 1\
absEncHome $apx_Home\
cntsPerX -8192]
cntsPerX -819.2]
apx part collimator
apx long_name apx
setHomeandRange -motor apx -home 0 -lowrange -10 -uprange 360
apx speed 1
apx home 0
apx softlowerlim -255
apx softupperlim 5
apx speed 5
# Sample aperture y
Motor apz $motor_driver_type [params \
@@ -848,7 +850,7 @@ Motor bsz $motor_driver_type [params \
axis B\
units mm\
hardlowerlim -240\
hardupperlim 100\
hardupperlim 85\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
@@ -859,118 +861,18 @@ Motor bsz $motor_driver_type [params \
bsz part detector
bsz long_name bsz
bsz softlowerlim -240
bsz softupperlim 100
bsz softupperlim 80
bsz home 0
if {1} {
# largest to smallest
# MakeActionObject obj aQ JG-speed upsw downsw axis
MakeActionObject bs1 mc4 [expr $bs124sign*$bs_steps_per_rev*$bs1gear/360.0] 8 4 C
MakeActionObject bs2 mc4 [expr $bs124sign*$bs_steps_per_rev*$bs2gear/360.0] 8 4 D
MakeActionObject bs3 mc4 [expr $bs35sign*$bs_steps_per_rev*$bs3gear/360.0] 4 8 E
MakeActionObject bs4 mc4 [expr $bs124sign*$bs_steps_per_rev*$bs4gear/360.0] 8 4 F
MakeActionObject bs5 mc4 [expr $bs35sign*$bs_steps_per_rev*$bs5gear/360.0] 4 8 G
MakeActionObject bs1 mc4 [expr $bs125sign*$bs_steps_per_rev*$bs1gear/360.0] 8 4 C
MakeActionObject bs2 mc4 [expr $bs125sign*$bs_steps_per_rev*$bs2gear/360.0] 8 4 D
MakeActionObject bs3 mc4 [expr $bs34sign*$bs_steps_per_rev*$bs3gear/360.0] 4 8 E
MakeActionObject bs4 mc4 [expr $bs34sign*$bs_steps_per_rev*$bs4gear/360.0] 4 8 F
MakeActionObject bs5 mc4 [expr $bs125sign*$bs_steps_per_rev*$bs5gear/360.0] 8 4 G
} else {
# beam stop disk 5 (smallest)
Motor bs5 $motor_driver_type [params \
asyncqueue mc4\
host mc4-quokka\
port pmc4-quokka\
axis G\
units mm\
hardlowerlim 0\
hardupperlim 90\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
stepsPerX [expr $bs35sign*$bs_steps_per_rev*$bs5gear/360.0]\
motorHome $bs5_Home]
bs5 part detector
bs5 long_name bs5
bs5 softlowerlim 0
bs5 softupperlim 90
bs5 home 0
# beam stop disk 4
Motor bs4 $motor_driver_type [params \
asyncqueue mc4\
host mc4-quokka\
port pmc4-quokka\
axis F\
units mm\
hardlowerlim 0\
hardupperlim 90\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
stepsPerX [expr $bs124sign*$bs_steps_per_rev*$bs4gear/360.0]\
motorHome $bs4_Home]
bs4 part detector
bs4 long_name bs4
bs4 softlowerlim 0
bs4 softupperlim 90
bs4 home 0
# beam stop disk 3
Motor bs3 $motor_driver_type [params \
asyncqueue mc4\
host mc4-quokka\
port pmc4-quokka\
axis E\
units mm\
hardlowerlim 0\
hardupperlim 90\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
stepsPerX [expr $bs35sign*$bs_steps_per_rev*$bs3gear/360.0]\
motorHome $bs3_Home]
bs3 part detector
bs3 long_name bs3
bs3 softlowerlim 0
bs3 softupperlim 90
bs3 home 0
# beam stop disk 2
Motor bs2 $motor_driver_type [params \
asyncqueue mc4\
host mc4-quokka\
port pmc4-quokka\
axis D\
units mm\
hardlowerlim 0\
hardupperlim 90\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
stepsPerX [expr $bs124sign*$bs_steps_per_rev*$bs2gear/360.0]\
motorHome $bs2_Home]
bs2 part detector
bs2 long_name bs2
bs2 softlowerlim 0
bs2 softupperlim 90
bs2 home 0
# beam stop disk 1 (largest)
Motor bs1 $motor_driver_type [params \
asyncqueue mc4\
host mc4-quokka\
port pmc4-quokka\
axis C\
units mm\
hardlowerlim 0\
hardupperlim 90\
maxSpeed 1\
maxAccel 1\
maxDecel 5\
stepsPerX [expr $bs124sign*$bs_steps_per_rev*$bs1gear/360.0]\
motorHome $bs1_Home]
bs1 part detector
bs1 long_name bs1
bs1 softlowerlim 0
bs1 softupperlim 90
bs1 home 0
}
# Polarizer Rotation

View File

@@ -11,41 +11,43 @@ makesctcontroller sct_mc4 std mc4:$port4
# label pos
set 20sample_table {
1 453.7
2 411.7
3 369.7
4 327.7
5 285.7
6 203.7
7 161.7
8 119.7
9 77.7
10 35.7
11 -46.3
12 -88.3
13 -130.3
14 -172.3
15 -214.3
16 -296.3
17 -338.3
18 -380.3
19 -422.3
20 -464.3
index position
1 453.7
2 411.7
3 369.7
4 327.7
5 285.7
6 203.7
7 161.7
8 119.7
9 77.7
10 35.7
11 -46.3
12 -88.3
13 -130.3
14 -172.3
15 -214.3
16 -296.3
17 -338.3
18 -380.3
19 -422.3
20 -464.3
}
mk_sct_positmotor sct_mc1 samx changer_position samplenum 20SAMPLES $20sample_table
mk_sct_positmotor sct_mc1 parameter samx changer_position samplenum 20SAMPLES $20sample_table
set auto_ap_table {
2.5 0
5.0 23
7.5 47
10.0 72
12.5 98
15.0 125
17.5 153
20.0 183
25.0 215
30.0 250
thickness_mm position
2.5 0
5.0 -23
7.5 -47
10.0 -72
12.5 -98
15.0 -125
17.5 -153
20.0 -183
25.0 -215
30.0 -250
}
mk_sct_positmotor sct_mc3 apx autoSampleAp aperture auto_ap $auto_ap_table
mk_sct_positmotor sct_mc3 parameter apx autoSampleAp aperture auto_ap $auto_ap_table

View File

@@ -1 +1,11 @@
source $cfPath(nexus)/nxscripts_common_1.tcl
proc ::nexus::isc_initialize {} {
variable histmem_filetype_spec
foreach spec [array names histmem_filetype_spec] {
lappend histmem_filetype_spec($spec) link {aux_data 3 LambdaA}
lappend histmem_filetype_spec($spec) link {aux_data 4 Transmission}
lappend histmem_filetype_spec($spec) link {aux_data 5 ::histogram_memory::x_bin}
lappend histmem_filetype_spec($spec) link {aux_data 6 ::histogram_memory::y_bin}
}
::nexus::ic_initialize
}

View File

@@ -6,40 +6,56 @@
# commands to setup the instrument.
namespace eval optics {
# A configuration table is made up of a set of named rows which provide
# configuration parameters
# Rows can be of mixed type
##
# @brief These arrays map the component identifiers (G, MT, etc) to the
# position index for each guide motor (c1, c2 ... c9)
array set c1_map {G 1 MT 2 P 3}
array set c2_map {MT 1 G 2 A 3}
array set c3_map {MT 1 G 2 A 3}
array set c4_map {MT 1 G 2 A 3}
array set c5_map {MT 1 G 2 A 3}
array set c6_map {MT 1 G 2 A 3}
array set c7_map {MT 1 G 2 A 3}
array set c8_map {MT 1 G 2 A 3}
array set c9_map {L 1 MT 2 G 3 A 4 LP 5}
# The guide configuration table is indexed by a configuration
# identifier (ga, mt, lp, etc). Each row has two elements,
# 1. A list of components selected for each guide (MT A ... etc)
# 2. The entrance aperature position in mm
# Eg $guide_configuration(p2) returns the following list
# {{P G A A A A A A A } 6934}
array set guide_configuration {
ga {MT A A A A A A A A }
mt {MT MT MT MT MT MT MT MT MT }
lp {MT MT MT MT MT MT MT MT LP }
lens {MT MT MT MT MT MT MT MT L }
p1 {P A MT MT MT MT MT MT MT }
p1lp {P A MT MT MT MT MT MT LP }
p1lens {P A MT MT MT MT MT MT L }
g1 {G A A A A A A A A }
p2 {P G A A A A A A A }
g2 {G G A A A A A A A }
p3 {P G G A A A A A A }
g3 {G G G A A A A A A }
p4 {P G G G A A A A A }
g4 {G G G G A A A A A }
p5 {P G G G G A A A A }
g5 {G G G G G A A A A }
p6 {P G G G G G A A A }
g6 {G G G G G G A A A }
p7 {P G G G G G G A A }
g7 {G G G G G G G A A }
p8 {P G G G G G G G A }
g8 {G G G G G G G G A }
p9 {P G G G G G G G G }
g9 {G G G G G G G G G }
ga {{MT A A A A A A A A } 675}
mt {{MT MT MT MT MT MT MT MT MT} 675}
lp {{MT MT MT MT MT MT MT MT LP} 675}
lens {{MT MT MT MT MT MT MT MT L } 675}
p1 {{P A MT MT MT MT MT MT MT} 675}
p1lp {{P A MT MT MT MT MT MT LP} 675}
p1lens {{P A MT MT MT MT MT MT L } 675}
g1 {{G A A A A A A A A } 4929}
p2 {{P G A A A A A A A } 6934}
g2 {{G G A A A A A A A } 6934}
p3 {{P G G A A A A A A } 8949}
g3 {{G G G A A A A A A } 8949}
p4 {{P G G G A A A A A } 10955}
g4 {{G G G G A A A A A } 10955}
p5 {{P G G G G A A A A } 12943}
g5 {{G G G G G A A A A } 12943}
p6 {{P G G G G G A A A } 14970}
g6 {{G G G G G G A A A } 14970}
p7 {{P G G G G G G A A } 16971}
g7 {{G G G G G G G A A } 16971}
p8 {{P G G G G G G G A } 18937}
g8 {{G G G G G G G G A } 18937}
p9 {{P G G G G G G G G } 19925}
g9 {{G G G G G G G G G } 19925}
}
# This list maps the motor names to columns of the
# guide_configuration table.
set guide_configuration_columns {
c1 c2 c3 c4 c5 c6 c7 c8 c9
c1 c2 c3 c4 c5 c6 c7 c8 c9
}
}
@@ -47,5 +63,4 @@ set guide_configuration_columns {
namespace eval optics {
variable guide_configuration
variable guide_configuration_columns
namespace export set_guide
}

View File

@@ -18,11 +18,16 @@ foreach {var lname nxname} {
##
# @brief User privilege text variables
#
foreach {var lname nxname priv klass} {
SApShape SApShape shape user parameter
BSShape BSShape shape user parameter
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 text $priv $lname true $klass true true
::utility::mkVar $var $type $priv $lname true $klass true true
if {$units != "none"} {
sicslist setatt $var units $units
}
}
##
@@ -46,7 +51,7 @@ foreach {var lname nxname units klass} {
##
# @brief Parameter SicsVariables
foreach {var lname nxname units priv } {
LambdaA LambdaA wavelength nm user
LambdaA LambdaA wavelength Ao user
LambdaResFWHM_percent LambdaResFWHM_percent wavelength_spread 1 user
VSdeg VSdeg twist degrees user
VSrpm VSrpm rotation_speed rpm user
@@ -58,7 +63,7 @@ foreach {var lname nxname units priv } {
SApPosYmm SApPosYmm y mm user
SApPosZmm SApPosZmm z mm user
SamplePosXmm SamplePosXmm x mm user
SamplePosYmm SamplePosYmm y mm user
SamYOffsetmm SamYOffsetmm y mm user
SamplePosZmm SamplePosZmm z mm user
DetPosYOffsetmm DetPosYOffsetmm detposyoffset mm user
BSXmm BSXmm x mm user
@@ -91,11 +96,21 @@ foreach {var type lname units depends} {
}
}
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 sapy [SplitReply [SApPosYmm]]
set samposy [SplitReply [SamplePosYmm]]
set eapy [SplitReply [EApPosYmm]]
return [sicsmsgfmt [expr {$efpy + $sapy - $eapy}]]
return [sicsmsgfmt [expr {$efpy + $samposy - $eapy}]]
}
sicslist setatt L1mm long_name L1mm
sicslist setatt L1mm klass derived_parameter
@@ -210,12 +225,12 @@ foreach {pname motor units} {
##
# @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::MakeVelocity_Selector velocity_selector {
# wavelength LambdaA
# wavelength_spread LambdaResFWHM_percent
# coordinate_scheme VelSelCoordScheme
# position {VelSelPosXmm VelSelPosYmm VelSelPosZmm}
#}
::hdb::MakeAperture sample_aperture {
shape SApShape
@@ -340,7 +355,6 @@ namespace eval parameters {
SampleNum
SamplePosXmm
SamplePosYmm
SamplePosYmm
SamplePosZmm
SampleRotDeg
SampleTiltXDeg
@@ -348,7 +362,6 @@ namespace eval parameters {
SampleTitle
SApPosXmm
SApPosYmm
SApPosYmm
SApPosZmm
SApShape
SApXmm
@@ -385,3 +398,18 @@ proc check {args} {
}
}
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
}

View File

@@ -0,0 +1,191 @@
##
# @file
# The velocity selector control is split into two objects,
# 1. velsel_poller: This object polls the velocity selector to get its
# current state.
# 2. velsel: This object provides manages a set of status nodes which
# correspond to the state parameters read by the velsel_poller object.
# It also provides commands to set the speed and angle for the velocity
# selector.
# Test by adding the following to barebones.tcl
# InstallHdb
# source config/velsel/sct_velsel.tcl
# hfactory /velsel link velsel
# The velocity selector doesn't close client connections
# if the connection is broken. It only closes the connection
# when a client logs off with "#SES#bye", NOTE bye must be lowercase.
makesctcontroller sct_velsel astvelsel 137.157.202.73:10000 "" 10
sct_velsel transact "NVS"
sct_velsel transact "NVS"
namespace eval ::scobj::velsel {
variable paramindex
variable paramtype
variable pollrate
set pollrate 7
array set paramindex {
state 0
rspeed 1
aspeed 2
sspeed 3
aveto 4
ploss 5
splos 6
ttang 7
rtemp 8
wflow 9
winlt 10
woutt 11
vacum 12
wvalv 13
vvalv 14
vibrt 15
bcuun 16
}
array set paramtype {
state text
rspeed float
aspeed float
sspeed float
aveto text
ploss float
splos float
ttang float
rtemp float
wflow float
winlt float
woutt float
vacum float
wvalv text
vvalv text
vibrt float
bcuun float
}
MakeSICSObj velsel_poller SCT_OBJECT
MakeSICSObj velsel SCT_OBJECT
sicslist setatt velsel klass NXvelocity_selector
sicslist setatt velsel long_name velsel
##
# @brief Request a state report from the velocity selector
proc getStatus {} {
sct send "#SOS#STATE "
return rdStatus
}
##
# @brief Read the current state report from the velocity selector.
proc rdStatus {} {
set data [sct result]
if {$data != [sct oldval]} {
sct oldval $data
set status [lrange [split $data "#"] 3 end-1]
sct update $status
sct utime readtime
}
return idle
}
##
# @brief This dummy read command forces a transition to a state which
# will update a parameter from the current status.
proc getpar {nextstate} {
return $nextstate
}
proc noResponse {} {
sct result
return idle
}
##
# @brief Looks up a parameter in the current status and updates the
# parameter node.
# @param statuspath, path to the poller object's status node.
# @param parindex, index of the required parameter
proc updatepar {statuspath parindex} {
set data [lindex [hval $statuspath] $parindex end]
if {$data != [sct oldval]} {
sct oldval $data
sct update $data
sct utime readtime
}
return idle
}
proc setSpeed {nextState} {
set speed [format "%5d" [sct target]]
sct send "#SOS#SPEED $speed"
return $nextState
}
proc setState {nextState} {
set state [string tolower [sct target]]
switch $state {
"idle" {
sct send "#SOS#IDLE "
}
"brake" {
sct send "#SOS#BRAKE "
}
default {
return idle
}
}
return $nextState
}
hfactory /sics/velsel_poller/status plain internal text
hsetprop /sics/velsel_poller/status read ::scobj::velsel::getStatus
hsetprop /sics/velsel_poller/status rdStatus ::scobj::velsel::rdStatus
hsetprop /sics/velsel_poller/status oldval UNKNOWN
sct_velsel poll /sics/velsel_poller/status $pollrate halt read
hfactory /sics/velsel/LambdaA plain user float
hfactory /sics/velsel/LambdaResFWHM_percent plain user float
foreach par [lsort [array names paramindex]] {
hfactory /sics/velsel/$par plain spy $paramtype($par)
hsetprop /sics/velsel/$par read ::scobj::velsel::getpar rdpar
hsetprop /sics/velsel/$par rdpar ::scobj::velsel::updatepar /sics/velsel_poller/status $paramindex($par)
hsetprop /sics/velsel/$par oldval UNKNOWN
sct_velsel poll /sics/velsel/$par $pollrate
}
hfactory /sics/velsel/setspeed plain spy $paramtype($par)
hsetprop /sics/velsel/setspeed write ::scobj::velsel::setSpeed ignore
hsetprop /sics/velsel/setspeed ignore ::scobj::velsel::noResponse
sct_velsel write /sics/velsel/setspeed
hfactory /sics/velsel/setstate plain spy $paramtype($par)
hsetprop /sics/velsel/setstate write ::scobj::velsel::setState ignore
hsetprop /sics/velsel/setstate ignore ::scobj::velsel::noResponse
sct_velsel write /sics/velsel/setstate
::scobj::hinitprops velsel
hsetprop /sics/velsel klass NXvelocity_selector
hsetprop /sics/velsel privilege spy
hsetprop /sics/velsel type part
::scobj::set_required_props /sics/velsel
foreach {hpath klass priv alias} {
LambdaA parameter user velsel_lambdaa
LambdaResFWHM_percent parameter user velsel_lambdaresfwhm_percent
rspeed parameter user velsel_rspeed
aspeed parameter user velsel_aspeed
ttang parameter user velsel_ttang
} {
hsetprop /sics/velsel/$hpath nxalias $alias
hsetprop /sics/velsel/$hpath klass $klass
hsetprop /sics/velsel/$hpath privilege $priv
hsetprop /sics/velsel/$hpath control true
hsetprop /sics/velsel/$hpath data true
hsetprop /sics/velsel/$hpath nxsave true
hsetprop /sics/velsel/$hpath mutable true
hsetprop /sics/velsel/$hpath sdsinfo ::nexus::scobj::sdsinfo
}
}