server_config.tcl

server_init now calls ::counter::isc_initialize, ::histogram_memory::isc_initialize and ::scan::isc_initialize

scan.c
SICS-158  Restrict bmonscan and hmscan to only one scan variable

count_common.tcl
Create a mulicounter which uses the available monitors as channels.  The multicounter is used in bmonscans

hipadaba_configuration_common.tcl
Use _link as the suffix for the nxvgroup name when making nexus file links.

hmm_configuration_common.tcl
SICS-190 Create hdb entries for bm_counts, bm_event_rate, bm_status
SICS-164 Allow running histmem in simulated mode.

hmm_cylindrical_detector_configuration.tcl
Only refer to detector SICSVariables when necessary, otherwise we get dependency problems.

nxscripts_common_1.tcl
Separate histmem_filtype_spec from bmon_filetype_spec so that we can use the histem_filetyp_spec names to restrict the histmem scan filetypes.
Close the data file on error in proc ::nexus::save
Allow int and text types when saving macro data

scan_common_1.tcl
SICS-173  Allow users to force a scan when the instrument isn't ready
Added ic_initialize proc so we can make dependencies explicit in the init_server proc
SICS-186 Allow monitor modes for histmem scans
Allow selection of histmem file policies from runscan command

echidna, wombat, kowari, quokka and platypus component and server configurations
Added instrument specific configuration initialisation functions in the component configuration files.
Add a catch block to the top-level instrument server configuration file and printout the errorContext and callStack

r2641 | ffr | 2008-07-01 17:02:26 +1000 (Tue, 01 Jul 2008) | 34 lines
This commit is contained in:
Ferdi Franceschini
2008-07-01 17:02:26 +10:00
committed by Douglas Clowes
parent c2186b037e
commit 0f96e4f82f
31 changed files with 657 additions and 314 deletions

View File

@@ -1,5 +1,5 @@
# $Revision: 1.32 $
# $Date: 2008-06-23 02:41:12 $
# $Revision: 1.33 $
# $Date: 2008-07-01 07:02:26 $
# Author: Ferdi Franceschini
# Based on the examples in the hs_test.tcl sample configuration by Mark Lesha.
# http://gumtree.ansto.gov.au:9080/nbicms/bragg-systems/histogram-server/hs_test.tcl/view
@@ -11,96 +11,122 @@
# function with the following signature
# @code proc ::histogram_memory::initialize {}
# this function should call the generic initalisation function,
# ::histogram_memory::_initialize
# ::histogram_memory::ic_initialize
#
#@see ::histogram_memory::_initialize
set sim_mode [SplitReply [hmm_simulation]]
if {$sim_mode == "true"} {
MakeHM hmm SIM
MakeHM hmm_xy SIM
MakeHM hmm_xt SIM
MakeHM hmm_yt SIM
MakeHM hmm_x SIM
MakeHM hmm_y SIM
MakeHM hmm_t SIM
hmm configure daq Stopped
hmm configure statuscheck false
namespace eval histogram_memory {
proc hmc {_start _preset _mode _pause pauseval} {
if [ catch {
bm mode $_mode;
bm preset $_preset;
hmm countblock;
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message
#@see ::histogram_memory::ic_initialize
namespace eval histogram_memory {
# Common config variables
variable histmem_simulation
variable ic_count_methods
# Instrument Specific Config variables
set histmem_simulation [SplitReply [hmm_simulation]]
proc init_hmm_objs {} {
variable histmem_simulation
variable ic_count_methods
variable default_frame_source_when_there_is_no_frame_signal
variable default_frame_source_always_internal
if [ catch {
set ic_count_methods [concat [list time unlimited period count frame] $::counter::isc_beam_monitor_list ]
if {$histmem_simulation == "true"} {
MakeHM hmm SIM
MakeHM hmm_xy SIM
MakeHM hmm_xt SIM
MakeHM hmm_yt SIM
MakeHM hmm_x SIM
MakeHM hmm_y SIM
MakeHM hmm_t SIM
hmm configure daq Stopped
hmm configure statuscheck false
foreach bm $::counter::isc_beam_monitor_list {
set bm_num [string index $bm end]
if [string is integer $bm_num] {
hmm configure bm${bm_num}_status DISABLED
hmm configure bm${bm_num}_counts 12345
hmm configure bm${bm_num}_event_rate 50
}
}
proc hmc {_start _preset _mode _pause pauseval} {
if [ catch {
bm mode $_mode
bm preset $_preset
hmm countblock
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message
}
}
} else {
MakeHM hmm anstohttp
MakeHM hmm_xy anstohttp
MakeHM hmm_xt anstohttp
MakeHM hmm_yt anstohttp
MakeHM hmm_x anstohttp
MakeHM hmm_y anstohttp
MakeHM hmm_t anstohttp
MakeHMControl_ANSTO hmc bm hmm;
}
hmm configure rank 3
hmm_xy configure rank 2
hmm_xt configure rank 2
hmm_yt configure rank 2
hmm_x configure rank 1
hmm_y configure rank 1
hmm_t configure rank 1
# Frame source for each instrument if freq = 0, this can happen when automatically
# setting frequencies from choppers.
array set default_frame_source_when_there_is_no_frame_signal {
echidna INTERNAL
koala INTERNAL
kowari EXTERNAL
pelican INTERNAL
platypus EXTERNAL
quokka INTERNAL
taipan INTERNAL
wombat INTERNAL
}
array set default_frame_source_always_internal {
echidna "true"
koala "false"
kowari "false"
pelican "false"
platypus "false"
quokka "false"
taipan "false"
wombat "false"
}
::utility::mkVar detector_active_height_mm Float user active_height true detector true true
sicslist setatt detector_active_height_mm units mm
::utility::mkVar detector_active_width_mm Float user active_width true detector true true
sicslist setatt detector_active_width_mm units mm
::utility::mkVar hmm_user_configpath Text manager user_configpath false detector false false
hmm_user_configpath ../user_config/hmm
::utility::mkVar hmm_mode Text user mode true detector true true
::utility::mkVar _hmm_vert_axis Text user vert_axis true detector false true
::utility::mkVar _hmm_hor_axis Text user hor_axis true detector false true
::utility::mkVar _hmm_hor_axis_alias Text user hor_axis_alias true detector false true
::utility::mkVar _hmm_vert_axis_alias Text user vert_axis_alias true detector false true
::utility::mkVar _hmm_hor_channel_name Text user hor_channel_name true detector false true
_hmm_vert_axis y_pixel_offset
_hmm_vert_axis_alias dvaxis
_hmm_hor_axis polar_angle
_hmm_hor_axis_alias dtheta
_hmm_hor_channel_name horizontal_channel_number
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error $message
}
}
} else {
MakeHM hmm anstohttp;
MakeHM hmm_xy anstohttp;
MakeHM hmm_xt anstohttp;
MakeHM hmm_yt anstohttp;
MakeHM hmm_x anstohttp;
MakeHM hmm_y anstohttp;
MakeHM hmm_t anstohttp;
MakeHMControl_ANSTO hmc bm hmm;
}
hmm configure rank 3
hmm_xy configure rank 2
hmm_xt configure rank 2
hmm_yt configure rank 2
hmm_x configure rank 1
hmm_y configure rank 1
hmm_t configure rank 1
namespace eval histogram_memory {
# Frame source for each instrument if freq = 0, this can happen when automatically
# setting frequencies from choppers.
array set default_frame_source_when_there_is_no_frame_signal {
echidna INTERNAL
koala INTERNAL
kowari EXTERNAL
pelican INTERNAL
platypus EXTERNAL
quokka INTERNAL
taipan INTERNAL
wombat INTERNAL
}
array set default_frame_source_always_internal {
echidna "true"
koala "false"
kowari "false"
pelican "false"
platypus "false"
quokka "false"
taipan "false"
wombat "false"
}
::utility::mkVar detector_active_height_mm Float user active_height true detector true true
sicslist setatt detector_active_height_mm units mm
::utility::mkVar detector_active_width_mm Float user active_width true detector true true
sicslist setatt detector_active_width_mm units mm
::utility::mkVar hmm_user_configpath Text manager user_configpath false detector false false
hmm_user_configpath ../user_config/hmm
::utility::mkVar hmm_mode Text user mode true detector true true
::utility::mkVar _hmm_vert_axis Text user vert_axis true detector false true
::utility::mkVar _hmm_hor_axis Text user hor_axis true detector false true
::utility::mkVar _hmm_hor_axis_alias Text user hor_axis_alias true detector false true
::utility::mkVar _hmm_vert_axis_alias Text user vert_axis_alias true detector false true
::utility::mkVar _hmm_hor_channel_name Text user hor_channel_name true detector false true
_hmm_vert_axis y_pixel_offset
_hmm_vert_axis_alias dvaxis
_hmm_hor_axis polar_angle
_hmm_hor_axis_alias dtheta
_hmm_hor_channel_name horizontal_channel_number
##############################################
# Creating the histogram memories in SICS
##############################################
@@ -1526,12 +1552,44 @@ proc ::histogram_memory::t_max {} {
##
# @brief Sets histogram server to default configuration, initialises SICS histogram memory
# dictionary values and clears SICS OAT BAT CAT FAT ... tables
proc ::histogram_memory::_initialize {} {
proc ::histogram_memory::ic_initialize {} {
variable default_frame_source_when_there_is_no_frame_signal
variable default_frame_source_always_internal
set ::errorInfo ""
if [ catch {
# Generate beam monitor feedback macros
foreach bm $::counter::isc_beam_monitor_list {
set bm_num [string index $bm end]
if [string is integer $bm_num] {
set bm_status bm${bm_num}_status
::utility::macro::getset text $bm_status {} [subst -nocommands {
return "$bm_status = [SplitReply [hmm configure $bm_status]]"
}]
sicslist setatt $bm_status klass monitor
sicslist setatt $bm_status long_name $bm_status
sicslist setatt $bm_status mutable false
set bm_counts bm${bm_num}_counts
::utility::macro::getset int $bm_counts {} [subst -nocommands {
return "$bm_counts = [lindex [hmm configure $bm_counts] 2]"
}]
sicslist setatt $bm_counts klass monitor
sicslist setatt $bm_counts long_name $bm_counts
sicslist setatt $bm_counts mutable true
set bm_event_rate bm${bm_num}_event_rate
::utility::macro::getset float $bm_event_rate {} [subst -nocommands {
return "$bm_event_rate = [lindex [hmm configure $bm_event_rate] 2]"
}]
sicslist setatt $bm_event_rate klass monitor
sicslist setatt $bm_event_rate long_name $bm_event_rate
sicslist setatt $bm_event_rate mutable true
sicslist setatt $bm_event_rate units "count/sec"
} else {
error "ERROR: Failed to get beam monitor number"
}
}
set configuration "::histogram_memory::returnconfigfile config/hmm/anstohm_linked.xml"
::histogram_memory::y_bin -boundaries
::histogram_memory::x_bin -boundaries
@@ -1585,6 +1643,7 @@ proc ::histogram_memory::post_count {} {}
#
# @param block (optional) default="noblock"
proc ::histogram_memory::start {{blocking "noblock"}} {
variable histmem_simulation
if [ catch {
set options [list block noblock]
if {[lsearch $options $blocking] == -1} {
@@ -1594,7 +1653,7 @@ proc ::histogram_memory::post_count {} {}
hmm init
hmc start 1000000000 timer pause 1
set reply [SplitReply [hmm configure daq]]
if {$reply != "Started"} {
if {$histmem_simulation==false && $reply != "Started"} {
error "ERROR: Histogram server failed to start"
}
clientput "histmem started" value
@@ -1611,13 +1670,14 @@ proc ::histogram_memory::post_count {} {}
##
# @brief This sends the magic incantation which stops the histogram server.
proc ::histogram_memory::stop {} {
variable histmem_simulation
if [ catch {
hmm pause
hmm configure statuscheck true
hmm stop
hmm configure statuscheck false
set reply [SplitReply [hmm configure daq]]
if {$reply != "Stopped"} {
if {$histmem_simulation==false && $reply != "Stopped"} {
error "ERROR: Histogram server failed to stop"
}
} message ] {
@@ -1633,11 +1693,12 @@ proc ::histogram_memory::post_count {} {}
# @brief Allows resume if MULTIPLE_DATASETS=DISABLE, otherwise if MULTIPLE_DATASETS=ENABLE
# (the default) this acts like a stop but allows a fast restart.
proc ::histogram_memory::pause {} {
variable histmem_simulation
if [ catch {
hmm pause
::histogram_memory::post_count
set reply [SplitReply [hmm configure daq]]
if {$reply != "Paused"} {
if {$histmem_simulation==false && $reply != "Paused"} {
error "ERROR: Histogram server failed to pause"
}
} message ] {
@@ -1655,8 +1716,10 @@ proc ::histogram_memory::post_count {} {}
#
# @param method Set histmem mode or return current mode if blank
proc ::histogram_memory::count_method {{method ""}} {
variable ic_count_methods
if [ catch {
set modes [list time monitor unlimited period count frame]
set modes $ic_count_methods
if {$method==""} {
return [SplitReply [hmm_mode]]
} else {
@@ -1664,6 +1727,9 @@ proc ::histogram_memory::post_count {} {}
error "ERROR: Count mode, $method, must be one of $modes"
}
hmm configure FAT_COUNT_METHOD $method
if {[string range $method 0 [string first "R_" $method]] == "MONITOR"} {
hmm configure FAT_${method}_CONTROL ENABLE
}
hmm init
hmm_mode $method
}

View File

@@ -13,8 +13,6 @@ namespace eval histogram_memory {
set opt [lindex $args 0]
set arglist [lrange $args 1 end]
set proc_name [namespace origin [lindex [info level 0] 0]]
set det_width_mm [SplitReply [detector_active_width_mm]]
set det_radius_mm [SplitReply [detector_radius_mm]]
set deg_per_radian [SplitReply [deg_per_rad]]
switch -- $opt {
"-centres" - "-boundaries" - "-graph_type" {
@@ -22,6 +20,8 @@ namespace eval histogram_memory {
}
"-arrayname" {
set max_chan [OAT_TABLE X -getdata MAX_CHAN]
set det_width_mm [SplitReply [detector_active_width_mm]]
set det_radius_mm [SplitReply [detector_radius_mm]]
set scale_factor [expr {$deg_per_radian*($det_width_mm/$det_radius_mm) / $max_chan}]
set offset [::histogram_memory::detector_posn_degrees]
return [::histogram_memory::calc_axis $proc_name $scale_factor $offset [OAT_TABLE X -getdata BOUNDARIES] $opt $arglist]
@@ -31,6 +31,8 @@ namespace eval histogram_memory {
}
default {
set max_chan [OAT_TABLE X -getdata MAX_CHAN]
set det_width_mm [SplitReply [detector_active_width_mm]]
set det_radius_mm [SplitReply [detector_radius_mm]]
set scale_factor [expr {$deg_per_radian*($det_width_mm/$det_radius_mm) / $max_chan}]
set offset [::histogram_memory::detector_posn_degrees]
return [::histogram_memory::calc_axis $proc_name $scale_factor $offset [OAT_TABLE X -getdata BOUNDARIES] $args]