Implements a protocol handler for the protek 608 multimeters which just allows us to read the display. It reports all elements of the display including the bar graph, it does not provide remote control of the multimeter. The protocol handler broadcasts a warning to all clients if the auto-off function is enabled. sct_rfamp.c This is a protocol handler for the Mirrortron 35V 7A AC Generator (ANSFR-83B). sinqhttpprot.c Copied the PSI script context http protocol handler. sct_orhvpsprot.c Ordela high voltage power supply protocol handler now catches unknown commands. sct_eurotherm_2000.tcl Eurotherm controller for the kowari load frame by Douglas Clowes. sct_lakeshore_3xx.tcl Latest update from Arndt. The two control loops are now independent, settletime and tolerance now work properly. common_instrument_dictionary.tcl Make instrument/status saveable. sct_orhvps_common.tcl Provides voltage ramping and implements the dhv1 command for the Ordela HVPS via the sct_orhpsprot.c protocol handler. hmm_configuration_common_1.tcl Adds new "histmem clockscale" subcommand to get and set the clock scale from the fat_clock_scale FAT parameter. You can now upload the FAT FRAME_BUFFER and FRAME_DUTYCYCLE parameters to the histogram memory. The veto commands are now "histmem veto on" and "histmem veto off". hmm_object.tcl The axis order for the histmem object has been restore to t,y,x sct_positmotor_common.tcl Code has been simplified. nxscripts_common_1.tcl Removed obsolete ::nexus::data function. TOF axis now correctly report time_of_flight instead of "time". plc_common_1.tcl Make PLC info saveable. scan_common_1.tcl SICS-385 The scan command should check the final scan variable value against he soft upper and lower limits, not against the hard limits. Make sure that the scan variable axis is saved. platypus, kowari, quokka hmm_configuration.tcl Use the HOR and VER entries in the new histmem_axes hash to select the horizontal and vertical axes for the histmem. kowari motor_configuration.tcl secondary_slit_configuration.tcl Flatten slits motor structure to match old layout in data files. quokka commands.tcl SICS-380 EApPosYmm -> EApPosY quokka detector.tcl Use new script context controller for Ordela HVPS quokka hmm_configuration.tcl Set detector height to 5.08*192 the same as the width quokka motor_configuration.tcl Code cleanup quokka positmotor_configuration.tcl Use new positmotor code. quokka aperture_configuration.tcl Added attenuation factor column to AttRotLookupTable quokka parameters.tcl SICS-380 Refactor nexus, remove redundant parameters. site_ansto.c Added the following protocols, Httpl, Protek608, aand RFAmp. scriptcontext.c SICS-386 SctActionHandler: set "send" string to NULL when a chain of scripts completes with state=idle. It turns out that if none of the scripts in the "read chain" call [sct send] each time the chain is executed, then SICS will hammer the device with calls to AsconWrite(). This can be avoided if SctActionHandler sets the 'send' string to NULL before "goto finish" in the idle state. This will be safer and still let you have chains with multiple [sct send] and read scripts. asyncprotocol.c Fix platypus memory leak. devser.c SICS-387 Started adding code to pass signals on to script context drivers. ascon.c AsconTask(): Make sure we return to the AsconIdle state when sending a command which expect no response, also only reconnect if there is a Timeout when there has been an error. r2888 | ffr | 2010-04-19 14:04:41 +1000 (Mon, 19 Apr 2010) | 90 lines
217 lines
6.0 KiB
Tcl
217 lines
6.0 KiB
Tcl
source $cfPath(commands)/commands_common.tcl
|
|
|
|
namespace eval motor {
|
|
# is_homing_list = comma separated list of motors which are safe to send "home"
|
|
variable is_homing_list ""
|
|
}
|
|
|
|
#namespace eval sample {
|
|
# command select {int=0:8 sampid} {
|
|
# SampleNum $sampid
|
|
# }
|
|
#}
|
|
|
|
##
|
|
# @brief Beamstop select command
|
|
# @param bs beamstop, 1,2,3,4,5 or 6
|
|
# @param bx beam position in detector coordinates
|
|
# @param bz beam position in detector coordinates
|
|
# Given
|
|
# (Xbf,Zbf) = beam pos in frame coords
|
|
# (Xbd,Zbd) = beam pos in detector coords
|
|
# (Xbbs, Zbbs) = beam pos in beamstop coords
|
|
# (Xdf,Zdf) = detector pos in frame coords
|
|
# (Xbsf,Zbsf) = beamstop pos in frame coords
|
|
#
|
|
# (Xbf,Zbf) = (Xdf+Xbd, Zdf+Zbd) = (Xbsf+Xbbs, Zbsf+Zbbs)
|
|
# Origin of detector coords = frame origin
|
|
#
|
|
# Detector and beamstop motor readings with beamstop disk centers
|
|
# overlapping over detector center mark.
|
|
# Xdf = 264.542 (7283813) Zdf = 0
|
|
# Xbbs = 296.291 (8054270)
|
|
# Zbbs = 259.641 (13488244)
|
|
# Xbd = dethw, Zbd = (dethh)
|
|
#
|
|
# 264.542+dethw = Xbsf+296.291
|
|
# 0+dethh = Zbsf+259.641
|
|
#
|
|
# Xbsf = -31.749 + dethw, Zbsf = -259.641 + dethh
|
|
proc selbs {bs {bx "UNDEF"} {bz "UNDEF"}} {
|
|
set bsdriving false
|
|
set dethw [expr {[SplitReply [detector_active_height_mm]]/2.0}]
|
|
set dethh [expr {[SplitReply [detector_active_width_mm]]/2.0}]
|
|
set Xbsf [expr -31.749 + $dethw]
|
|
set Zbsf [expr -259.641 + $dethh]
|
|
array set bsl [subst {
|
|
1 [SplitReply [bs1 softlowerlim]]
|
|
2 [SplitReply [bs2 softlowerlim]]
|
|
3 [SplitReply [bs3 softlowerlim]]
|
|
4 [SplitReply [bs4 softlowerlim]]
|
|
5 [SplitReply [bs5 softlowerlim]]
|
|
6 [SplitReply [bs6 softlowerlim]]
|
|
}]
|
|
if [ catch {
|
|
switch $bs {
|
|
"1" {
|
|
set bsmot "bs1"
|
|
set bs_target 93.20
|
|
set bs_diameter 110
|
|
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
|
}
|
|
"2" {
|
|
set bsmot "bs2"
|
|
set bs_target 86.84
|
|
set bs_diameter 88
|
|
set bsdownCmd "drive bs1 $bsl(1) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
|
}
|
|
"3" {
|
|
set bsmot "bs3"
|
|
set bs_target 93.35
|
|
set bs_diameter 66
|
|
set bsdownCmd "drive bs2 $bsl(2) bs1 $bsl(1) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
|
}
|
|
"4" {
|
|
set bsmot "bs4"
|
|
set bs_target 86.85
|
|
set bs_diameter 44
|
|
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs1 $bsl(1) bs5 $bsl(5) bs6 $bsl(6)"
|
|
}
|
|
"5" {
|
|
set bsmot "bs5"
|
|
set bs_target 93.27
|
|
set bs_diameter 22
|
|
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs1 $bsl(1) bs6 $bsl(6)"
|
|
}
|
|
"6" {
|
|
set bsmot "bs6"
|
|
set bs_target 86.98
|
|
set bs_diameter 11
|
|
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs1 $bsl(1)"
|
|
}
|
|
default {
|
|
error "beamstop selection must be an integer from 1 to 6"
|
|
}
|
|
}
|
|
|
|
set detoff_val [SplitReply [detoff]]
|
|
|
|
if {$bx == "UNDEF" || $bz == "UNDEF"} {
|
|
statemon start selbs
|
|
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
|
|
set bsdriving true
|
|
BeamStop -1
|
|
BSdiam -1
|
|
drive $bsmot $bs_target
|
|
eval $bsdownCmd
|
|
BeamStop $bs
|
|
BSdiam $bs_diameter
|
|
set bsdriving false
|
|
statemon stop selbs
|
|
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
|
} else {
|
|
if { [string is double $bx] == false } {
|
|
if { [string is double $bz] == false } {
|
|
error "beam coordinates must be floats"
|
|
}
|
|
}
|
|
set bsx_target [expr {$bx-$Xbsf+$detoff_val}]
|
|
set bsz_target [expr {$bz-$Zbsf}]
|
|
|
|
statemon start selbs
|
|
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
|
|
set bsdriving true
|
|
BeamStop -1
|
|
BSdiam -1
|
|
drive $bsmot $bs_target bsx $bsx_target bsz $bsz_target
|
|
eval $bsdownCmd
|
|
BeamStop $bs
|
|
BSdiam $bs_diameter
|
|
set bsdriving false
|
|
statemon stop selbs
|
|
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
|
}
|
|
} msg ] {
|
|
if {$bsdriving} {
|
|
statemon stop selbs
|
|
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
|
}
|
|
return -code error $msg
|
|
}
|
|
}
|
|
publish selbs user
|
|
namespace eval beamstops {
|
|
command selbsn {int=1,2,3,4,5,6 bs} {
|
|
selbs $bs "UNDEF" "UNDEF"
|
|
}
|
|
command selbsxz {int=1,2,3,4,5,6 bs float bx float bz} {
|
|
selbs $bs $bx $bz
|
|
}
|
|
}
|
|
|
|
namespace eval optics {
|
|
VarMake ::optics::select::section text user
|
|
VarMake ::optics::polarizer::in text user
|
|
VarMake ::optics::lens::selection text user
|
|
|
|
command rotary_attenuator {int=0,15,45,90,180 angle} {
|
|
drive att $angle
|
|
}
|
|
|
|
command entrance_aperture {
|
|
int=0,45,90,135,180,270 angle
|
|
} {
|
|
drive srce $angle
|
|
}
|
|
|
|
# TODO Do we need this
|
|
# command sample_aperture {
|
|
# int=25,50 size
|
|
# text=circ,squ,open,rect shape
|
|
# } {
|
|
# SApXmm $size
|
|
# SApZmm $size
|
|
# SApShape $shape
|
|
# }
|
|
|
|
##############################
|
|
##
|
|
# @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
|
|
# guide ga
|
|
command guide "
|
|
text=[join [array names ::optics::guide_configuration] , ] configuration
|
|
" {
|
|
|
|
variable guide_configuration
|
|
variable guide_configuration_columns
|
|
|
|
if [ catch {
|
|
|
|
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"]
|
|
EApPosY $position
|
|
}
|
|
GuideConfig $configuration
|
|
} message ] {
|
|
::optics::guide -set feedback status IDLE
|
|
if {$::errorCode=="NONE"} {return $message}
|
|
return -code error $message
|
|
}
|
|
::optics::guide -set feedback status IDLE
|
|
}
|
|
::optics::guide -addfb text status
|
|
::optics::guide -set feedback status IDLE
|
|
}
|
|
|
|
proc ::commands::isc_initialize {} {
|
|
::commands::ic_initialize
|
|
}
|