Merged new hdb and nexus code.
r2099 | ffr | 2007-07-22 15:23:41 +1000 (Sun, 22 Jul 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
4e407d0a73
commit
8770acc191
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.14 $
|
||||
# $Date: 2007-05-08 04:58:51 $
|
||||
# $Revision: 1.15 $
|
||||
# $Date: 2007-07-22 05:23:40 $
|
||||
# Author: Mark Lesha (mle@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
@@ -10,25 +10,27 @@
|
||||
#ffr MakeHM hmm anstohttp, move to inst specific config
|
||||
|
||||
namespace eval histogram_memory {
|
||||
VarMake hmm_dim0 Int User
|
||||
VarMake hmm_dim1 Int User
|
||||
VarMake hmm_dim2 Int User
|
||||
VarMake hmm_histmode Text User
|
||||
VarMake hmm_bank Int User
|
||||
VarMake hmm_rank Int User
|
||||
VarMake hmm_start Int User
|
||||
VarMake hmm_length Int User
|
||||
VarMake hmm_mode Text User
|
||||
VarMake _hmm_vert_axis Text User
|
||||
VarMake _hmm_hor_axis Text User
|
||||
VarMake _hmm_hor_axis_alias Text User
|
||||
VarMake _hmm_vert_axis_alias Text User
|
||||
VarMake _hmm_hor_channel_name Text User
|
||||
_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
|
||||
::utility::mkVar hmm_user_configpath Text manager user_configpath false detector true false
|
||||
hmm_user_configpath ../user_config/hmm
|
||||
::utility::mkVar hmm_dim0 Int user dim0 true detector true true
|
||||
::utility::mkVar hmm_dim1 Int user dim1 true detector true true
|
||||
::utility::mkVar hmm_dim2 Int user dim2 true detector true true
|
||||
::utility::mkVar hmm_histmode Text user histmode true detector true true
|
||||
::utility::mkVar hmm_bank Int user bank false detector true false
|
||||
::utility::mkVar hmm_rank Int user rank true detector true true
|
||||
::utility::mkVar hmm_start Int user start false detector true false
|
||||
::utility::mkVar hmm_length Int user length false detector false false
|
||||
::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
|
||||
##############################################
|
||||
@@ -41,16 +43,16 @@ _hmm_hor_channel_name horizontal_channel_number
|
||||
##############################################
|
||||
# Configuring the histogram server
|
||||
##############################################
|
||||
|
||||
|
||||
# Procedure to read a single config (or any) file, return content as a string.
|
||||
proc returnconfigfile {filename} {
|
||||
set fh [open $filename]
|
||||
set xml [read $fh]
|
||||
#set xml [list [read $fh]]
|
||||
clientput $xml value
|
||||
close $fh
|
||||
return $xml
|
||||
}
|
||||
proc returnconfigfile {filename} {
|
||||
set fh [open $filename]
|
||||
set xml [read $fh]
|
||||
#set xml [list [read $fh]]
|
||||
debug_msg $xml value
|
||||
close $fh
|
||||
return [subst $xml]
|
||||
}
|
||||
|
||||
# Initialize the histogram server.
|
||||
# This call to hmm init (with init 1 configured) causes the histogram server
|
||||
@@ -61,20 +63,20 @@ proc returnconfigfile {filename} {
|
||||
# during DAQ is not allowed. This requires init of the hmm object to level 0.
|
||||
#
|
||||
# Making sure the histogram server is stopped, so we can load configuration.
|
||||
proc hmm_initialize {} {
|
||||
hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080
|
||||
hmm configure username spy
|
||||
hmm configure password 007
|
||||
hmm configure hmDataPath ../HMData
|
||||
proc hmm_initialize {} {
|
||||
hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080
|
||||
hmm configure username spy
|
||||
hmm configure password 007
|
||||
hmm configure hmDataPath ../HMData
|
||||
|
||||
hmm configure init 0
|
||||
hmm init
|
||||
hmm stop
|
||||
hmm configure init 0
|
||||
hmm init
|
||||
hmm stop
|
||||
# Load the configuration to the histogram server.
|
||||
hmm configure init 1
|
||||
hmm init
|
||||
hmm configure init 1
|
||||
hmm init
|
||||
# Restore the init level to 0, subesquent inits will only upload specified FAT settings to histogram server.
|
||||
hmm configure init 0
|
||||
hmm configure init 0
|
||||
|
||||
##############################################
|
||||
# Configuring the histogram memories in SICS
|
||||
@@ -83,35 +85,35 @@ hmm configure init 0
|
||||
# Now issue stop to the server.
|
||||
# This not only makes sure it's stopped, but lets us see certain configuration variables
|
||||
# which get placed in the dictionary as part of the status checking done during the stop.
|
||||
hmm stop
|
||||
}
|
||||
hmm stop
|
||||
}
|
||||
# Here, define a function to let us read back the value of dictionary items from the hmm
|
||||
# such as OAT dimensions.
|
||||
proc hmmdictitemval {histomem dictitem} {
|
||||
set resp [$histomem configure $dictitem]
|
||||
set retn [lindex [split $resp " "] 2]
|
||||
return $retn
|
||||
}
|
||||
proc hmmdictitemval {histomem dictitem} {
|
||||
set resp [$histomem configure $dictitem]
|
||||
set retn [lindex [split $resp " "] 2]
|
||||
return $retn
|
||||
}
|
||||
|
||||
# Configure histogram dimensions, mode, etc. using the dictionary variables.
|
||||
# For the dimensions, set the 'effective' OAT dimensions which are the
|
||||
# histogram period dimensions. Do an init after to cause memory to be allocated.
|
||||
proc hmm_setup {mode bankNum rankNum nyc nxc ntc} {
|
||||
proc hmm_setup {mode bankNum rankNum nyc nxc ntc} {
|
||||
hmm_histmode $mode
|
||||
hmm_bank $bankNum
|
||||
hmm_rank $rankNum
|
||||
hmm configure histmode $mode
|
||||
hmm configure bank $bankNum
|
||||
hmm configure rank $rankNum
|
||||
hmm_dim0 [hmmdictitemval hmm $nyc]
|
||||
hmm_dim1 [hmmdictitemval hmm $nxc]
|
||||
hmm_length [expr {[SplitReply [hmm_dim0]] * [SplitReply [hmm_dim1]]} ]
|
||||
hmm_dim2 [hmmdictitemval hmm $ntc]
|
||||
hmm configure dim0 [SplitReply [hmm_dim0]]
|
||||
hmm configure dim1 [SplitReply [hmm_dim1]]
|
||||
hmm configure dim2 [SplitReply [hmm_dim2]]
|
||||
hmm init
|
||||
}
|
||||
hmm_bank $bankNum
|
||||
hmm_rank $rankNum
|
||||
hmm configure histmode $mode
|
||||
hmm configure bank $bankNum
|
||||
hmm configure rank $rankNum
|
||||
hmm_dim0 [hmmdictitemval hmm $nyc]
|
||||
hmm_dim1 [hmmdictitemval hmm $nxc]
|
||||
hmm_length [expr {[SplitReply [hmm_dim0]] * [SplitReply [hmm_dim1]]} ]
|
||||
hmm_dim2 [hmmdictitemval hmm $ntc]
|
||||
hmm configure dim0 [SplitReply [hmm_dim0]]
|
||||
hmm configure dim1 [SplitReply [hmm_dim1]]
|
||||
hmm configure dim2 [SplitReply [hmm_dim2]]
|
||||
hmm init
|
||||
}
|
||||
|
||||
##############################################
|
||||
# Create beam monitor counter
|
||||
@@ -178,36 +180,36 @@ proc hmm_setup {mode bankNum rankNum nyc nxc ntc} {
|
||||
#
|
||||
#
|
||||
# Call is: scan2_runa <n>
|
||||
proc scan2_runa {n} {
|
||||
proc scan2_runa {n} {
|
||||
# The termination condition is ignored, because the
|
||||
# histogram server controls the acquisition duration
|
||||
# directly in this case.
|
||||
scan2 run $n timer 0
|
||||
}
|
||||
scan2 run $n timer 0
|
||||
}
|
||||
#
|
||||
# Call is: scan2_runb <n>
|
||||
proc scan2_runb {n count_method count_size count_stop} {
|
||||
proc scan2_runb {n count_method count_size count_stop} {
|
||||
# Commit the termination conditions to the histogram server.
|
||||
# hmm configure stores the values in the dictionary,
|
||||
# then hmm init causes them to be sent to the histogram server.
|
||||
# We just 'assume' they are successfully written.
|
||||
hmm configure FAT_COUNT_METHOD $count_method
|
||||
hmm configure FAT_COUNT_SIZE $count_size
|
||||
hmm configure FAT_COUNT_STOP $count_stop
|
||||
hmm init
|
||||
hmm configure FAT_COUNT_METHOD $count_method
|
||||
hmm configure FAT_COUNT_SIZE $count_size
|
||||
hmm configure FAT_COUNT_STOP $count_stop
|
||||
hmm init
|
||||
# The termination condition is ignored, because the
|
||||
# histogram server controls the acquisition duration
|
||||
# directly in this case. So, use 'timer 0' here.
|
||||
scan2 run $n timer 0
|
||||
}
|
||||
scan2 run $n timer 0
|
||||
}
|
||||
|
||||
# Simulated counter. No error rate. Required for technical reasons...
|
||||
# This counter is used only to block execution till the bm count is actually reached,
|
||||
# for the scan example using hmc and bm objects to control the acquisition duration from SICS.
|
||||
MakeCounter blockctr SIM -1.0
|
||||
blockctr SetExponent 0
|
||||
blockctr SetMode timer
|
||||
blockctr SetPreset 0
|
||||
MakeCounter blockctr SIM -1.0
|
||||
blockctr SetExponent 0
|
||||
blockctr SetMode timer
|
||||
blockctr SetPreset 0
|
||||
|
||||
# Later on we can add some motors to drive...
|
||||
#Motor som2 ASIM 0 100 -1.0 0.01
|
||||
@@ -230,16 +232,16 @@ blockctr SetPreset 0
|
||||
# in to an argument of set_oat_offset to provide progressively
|
||||
# increasing offset, producing an overlapped histogram.
|
||||
#
|
||||
global oatoffset
|
||||
global oatoffset
|
||||
#
|
||||
#Function to apply OAT offsets to the histogram server.
|
||||
proc set_oat_offset {oatoff_x oatoff_y oatoff_t} {
|
||||
hmm configure FAT_OFFSET_OAT_X $oatoff_x
|
||||
hmm configure FAT_OFFSET_OAT_Y $oatoff_y
|
||||
hmm configure FAT_OFFSET_OAT_T $oatoff_t
|
||||
hmm init
|
||||
return
|
||||
}
|
||||
proc set_oat_offset {oatoff_x oatoff_y oatoff_t} {
|
||||
hmm configure FAT_OFFSET_OAT_X $oatoff_x
|
||||
hmm configure FAT_OFFSET_OAT_Y $oatoff_y
|
||||
hmm configure FAT_OFFSET_OAT_T $oatoff_t
|
||||
hmm init
|
||||
return
|
||||
}
|
||||
|
||||
##############################################
|
||||
# Support for data acquisition
|
||||
@@ -247,17 +249,17 @@ proc set_oat_offset {oatoff_x oatoff_y oatoff_t} {
|
||||
|
||||
# A simple procedure to read the histogram data through SICS
|
||||
# and dump the data to a numbered file.
|
||||
proc savehistodata {histomem filename} {
|
||||
set fh [open $filename "w"]
|
||||
proc savehistodata {histomem filename} {
|
||||
set fh [open $filename "w"]
|
||||
# To get the whole memory, we don't need to specify the start or end arguments.
|
||||
# But we need to specify the bank number, this sets the type of data to be read.
|
||||
#
|
||||
set histodata [$histomem get [hmmdictitemval $histomem bank]]
|
||||
set histodata [$histomem get [hmmdictitemval $histomem bank]]
|
||||
# clientput $histodata value
|
||||
puts -nonewline $fh $histodata
|
||||
close $fh
|
||||
return
|
||||
}
|
||||
puts -nonewline $fh $histodata
|
||||
close $fh
|
||||
return
|
||||
}
|
||||
|
||||
##############################################
|
||||
##############################################
|
||||
@@ -269,54 +271,61 @@ proc savehistodata {histomem filename} {
|
||||
# We use it to pause the histogram server, in order to commence the DAQ.
|
||||
# This 'primes' the DAE also (i.e. device drivers reboot the hardware,
|
||||
# buffering processes are started, etc.)
|
||||
proc prepare {} {
|
||||
proc prepare {} {
|
||||
#clientput "Enter prepare" value
|
||||
#
|
||||
# Before configuring the bm, do a short count.
|
||||
# This will cause the counter to reconnect if it needs to...
|
||||
bm count 0 timer
|
||||
bm count 0 timer
|
||||
# Now configure the beam monitor counter for better performance.
|
||||
# (Set a high counter sample rate to get better accuracy).
|
||||
bm send set scan=1
|
||||
bm send set sample=1000
|
||||
bm send set scan=1
|
||||
bm send set sample=1000
|
||||
# Make sure the histogram server is stopped, this guarantees DAQ not in progress already.
|
||||
hmm stop
|
||||
hmm stop
|
||||
# Zero the OAT offsets (whether used or not).
|
||||
global oatoffset
|
||||
set oatoffset 0
|
||||
set_oat_offset 0 0 0
|
||||
global oatoffset
|
||||
set oatoffset 0
|
||||
set_oat_offset 0 0 0
|
||||
#
|
||||
# stdscan prepare $scanobjectname $userobjectname
|
||||
#clientput "hmm pause being done..." value
|
||||
# Pause the histogram server, this primes the DAE for acqisition.
|
||||
hmm pause
|
||||
hmm pause
|
||||
#clientput "Exit prepare" value
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# The count_bm_controlled callback gets called at the start of dataset acquisition.
|
||||
# We use it to perform the dataset acquisition, via the hmc object.
|
||||
# Note we do NOT call stdscan count, since we don't need to run the bm counter twice.
|
||||
proc count_bm_controlled {mode preset} {
|
||||
proc count_bm_controlled {mode preset} {
|
||||
::histogram_memory::count -set feedback status BUSY
|
||||
#clientput "Enter count" value
|
||||
#stdscan count $scanobjectname $userobjectname $point $mode $preset
|
||||
# Start the acquisition, runs till the beam monitor terminates
|
||||
# and then enter paused mode (we have added fifth argument to allow this).
|
||||
# In fact, execution proceeds immediately (the hmc call doesn't block).
|
||||
hmc start $preset $mode pause
|
||||
hmc start $preset $mode pause
|
||||
# Now call the simulated counter. This will cause execution to block
|
||||
# till the hmc acquisition actually finishes. Otherwise, execution will
|
||||
# charge on regardless and the finish callback function gets called
|
||||
# before the last dataset acquisition has finished!
|
||||
blockctr count 0
|
||||
blockctr count 0
|
||||
#clientput "Exit count" value
|
||||
return
|
||||
}
|
||||
::histogram_memory::count -set feedback status IDLE
|
||||
array set param [::data::gumtree_save -list param]
|
||||
data axis 1 $param(run_number)
|
||||
data data_set hmm
|
||||
::hdb::set_save /instrument/detector true
|
||||
::hdb::set_save /data true
|
||||
return
|
||||
}
|
||||
|
||||
# The count_hs_controlled callback gets called at the start of dataset acquisition.
|
||||
# We use it to perform the dataset acquisition, controlled by the histogram server.
|
||||
# Note we do NOT call stdscan count, since we don't need to run the bm counter twice.
|
||||
proc hs_count_hs_controlled {scanobjectname userobjectname point mode preset} {
|
||||
proc hs_count_hs_controlled {scanobjectname userobjectname point mode preset} {
|
||||
#clientput "Enter count" value
|
||||
#stdscan count $scanobjectname $userobjectname $point $mode $preset
|
||||
# Start the acquisition, runs till the histogram server auto-terminates.
|
||||
@@ -325,15 +334,15 @@ proc hs_count_hs_controlled {scanobjectname userobjectname point mode preset} {
|
||||
# The termination condition for the bm counter is just set to a large time period.
|
||||
# After the acquisition terminates, the beam monitor therefore has the correct
|
||||
# status reading and the 'Monitor' entry in the scan data table will be correct.
|
||||
hmc start 1000000000 timer pause 1
|
||||
hmc start 1000000000 timer pause 1
|
||||
# Now call the simulated counter. This will cause execution to block
|
||||
# till the hmc acquisition actually finishes. Otherwise, execution will
|
||||
# charge on regardless and the finish callback function gets called
|
||||
# before the last dataset acquisition has finished!
|
||||
blockctr count 0
|
||||
blockctr count 0
|
||||
#clientput "Exit count" value
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# The collect callback gets called at the end of the dataset acquisition.
|
||||
# We can put stuff here to retrieve data collected at each scan point,
|
||||
@@ -347,13 +356,13 @@ proc hs_count_hs_controlled {scanobjectname userobjectname point mode preset} {
|
||||
# Code for adjusting ancillaries, moving secondary motion stages etc. etc.
|
||||
# from point to point should probably be put into a drive callback function
|
||||
# (but not in this example script).
|
||||
proc hs_collect {scanobjectname userobjectname point} {
|
||||
proc hs_collect {scanobjectname userobjectname point} {
|
||||
#clientput "Enter collect" value
|
||||
set rslt [stdscan collect $scanobjectname $userobjectname $point]
|
||||
set rslt [stdscan collect $scanobjectname $userobjectname $point]
|
||||
# Apply an OAT offset in the x direction (e.g. along tube number axis).
|
||||
global oatoffset
|
||||
incr oatoffset
|
||||
set_oat_offset $oatoffset 0 0
|
||||
global oatoffset
|
||||
incr oatoffset
|
||||
set_oat_offset $oatoffset 0 0
|
||||
# Checking the beam monitor
|
||||
#clientput [bm send read] value
|
||||
# At each scan point, read the total x-y histogram
|
||||
@@ -361,18 +370,18 @@ proc hs_collect {scanobjectname userobjectname point} {
|
||||
# each dataset (when restarting from paused state),
|
||||
# so it represents the hstogram acquired per scan point.
|
||||
#clientput "Exit collect" value
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# The finish callback gets called at the end of the scan.
|
||||
# We use it to stop the histogram server, terminating the dataset.
|
||||
proc finish {} {
|
||||
proc finish {} {
|
||||
#clientput "Enter finish" value
|
||||
# stdscan finish $scanobjectname $userobjectname
|
||||
#clientput "hmm stop being done..." value
|
||||
hmm stop
|
||||
hmm stop
|
||||
# Just in case someone expects zero OAT offsets later on ;)
|
||||
set_oat_offset 0 0 0
|
||||
set_oat_offset 0 0 0
|
||||
# Get and write the data from the main histogram to disk (filename "HistoData").
|
||||
# Sicne this is the first (and only) access to hmm data, it is retrieved from
|
||||
# the server and we don't need to do hmm init first to force update hmm memory.
|
||||
@@ -380,14 +389,14 @@ proc finish {} {
|
||||
# savehistodata hmm "../data/HistoData"
|
||||
#
|
||||
#clientput "Exit finish" value
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
proc count_withbm {mode preset} {
|
||||
prepare;
|
||||
count_bm_controlled $mode $preset;
|
||||
finish;
|
||||
}
|
||||
proc count_withbm {mode preset} {
|
||||
prepare;
|
||||
count_bm_controlled $mode $preset;
|
||||
finish;
|
||||
}
|
||||
|
||||
proc init {} {
|
||||
}
|
||||
@@ -401,17 +410,17 @@ proc count_withbm {mode preset} {
|
||||
}
|
||||
|
||||
proc save {point } {
|
||||
#TODO maybe add nxobj and point parameters.
|
||||
set hor_axis [SplitReply [_hmm_hor_axis]]
|
||||
set vert_axis [SplitReply [_hmm_vert_axis]]
|
||||
#TODO maybe add nxobj and point parameters.
|
||||
set hor_axis [SplitReply [_hmm_hor_axis]]
|
||||
set vert_axis [SplitReply [_hmm_vert_axis]]
|
||||
# set point 0
|
||||
if {$point == 0} {
|
||||
nxcreatefile nexus_hmscan.dic;
|
||||
} else {
|
||||
nxreopenfile
|
||||
}
|
||||
if {$point == 0} {
|
||||
nxcreatefile nexus_hmscan.dic;
|
||||
} else {
|
||||
nxreopenfile
|
||||
}
|
||||
nxscript putattribute program_name run_mode hmmcount
|
||||
hmm_save nxscript entry1 $point;
|
||||
hmm_save nxscript entry1 $point;
|
||||
nxscript_data clear;
|
||||
nxscript_data putint 0 $point;
|
||||
nxscript putslab erun [list $point] [list 1] nxscript_data;
|
||||
@@ -421,16 +430,150 @@ proc count_withbm {mode preset} {
|
||||
nxscript putattribute hmcounts axes run_number:$vert_axis:$hor_axis;
|
||||
nxclosefile;
|
||||
}
|
||||
proc set_sobj_attributes {} {
|
||||
# set_sicsobj_atts sobj klass group name control data
|
||||
if 0 {
|
||||
set_sicsobj_atts hmm_user_configpath detector hmm user_configpath true false;
|
||||
set_sicsobj_atts hmm_dim0 detector hmm dim0 true true;
|
||||
set_sicsobj_atts hmm_dim1 detector hmm dim1 true true;
|
||||
set_sicsobj_atts hmm_dim2 detector hmm dim2 true true;
|
||||
set_sicsobj_atts hmm_histmode detector hmm histmode true true;
|
||||
set_sicsobj_atts hmm_bank detector hmm bank true false;
|
||||
set_sicsobj_atts hmm_rank detector hmm rank true true;
|
||||
set_sicsobj_atts hmm_start detector hmm start true false;
|
||||
set_sicsobj_atts hmm_length detector hmm length false false;
|
||||
set_sicsobj_atts hmm_mode detector hmm mode true true;
|
||||
set_sicsobj_atts _hmm_vert_axis detector hmm vert_axis false true;
|
||||
set_sicsobj_atts _hmm_hor_axis detector hmm hor_axis false true;
|
||||
set_sicsobj_atts _hmm_hor_axis_alias detector hmm hor_axis_alias false true;
|
||||
set_sicsobj_atts _hmm_vert_axis_alias detector hmm vert_axis_alias false true;
|
||||
set_sicsobj_atts _hmm_hor_channel_name detector hmm hor_channel_name false true;
|
||||
}
|
||||
|
||||
publish ::histogram_memory::finish user
|
||||
#publish ::histogram_memory::hs_collect user
|
||||
publish ::histogram_memory::hs_count_hs_controlled user
|
||||
publish ::histogram_memory::count_bm_controlled user
|
||||
publish ::histogram_memory::prepare user
|
||||
publish ::histogram_memory::set_oat_offset user
|
||||
publish ::histogram_memory::scan2_runb user
|
||||
publish ::histogram_memory::scan2_runa user
|
||||
publish ::histogram_memory::returnconfigfile user
|
||||
publish ::histogram_memory::count_withbm user
|
||||
publish ::histogram_memory::save user
|
||||
# SICS commands
|
||||
sicslist setatt blockctr privilege internal;
|
||||
|
||||
# histogram memory macros
|
||||
sicslist setatt ::histogram_memory::finish privilege internal;
|
||||
sicslist setatt ::histogram_memory::hs_count_hs_controlled privilege internal;
|
||||
sicslist setatt ::histogram_memory::count_bm_controlled privilege internal;
|
||||
sicslist setatt ::histogram_memory::prepare privilege internal;
|
||||
sicslist setatt ::histogram_memory::set_oat_offset privilege internal;
|
||||
sicslist setatt ::histogram_memory::scan2_runb privilege internal;
|
||||
sicslist setatt ::histogram_memory::scan2_runa privilege internal;
|
||||
sicslist setatt ::histogram_memory::returnconfigfile privilege internal;
|
||||
sicslist setatt ::histogram_memory::count_withbm privilege internal;
|
||||
sicslist setatt ::histogram_memory::save privilege internal;
|
||||
|
||||
set_sicsobj_atts hmm detector @none hmm_data true true;
|
||||
sicslist setatt hmm privilege user
|
||||
sicslist setatt hmm kind hobj
|
||||
sicslist setatt hmm nxsave true
|
||||
}
|
||||
}
|
||||
|
||||
proc BAT_TABLE {args} {}
|
||||
proc CAT_TABLE {args} {}
|
||||
set hmm_xml(FAT_TABLE) ""
|
||||
proc FAT_TABLE {args} {
|
||||
global hmm_xml
|
||||
if {$args == ""} {return $hmm_xml(FAT_TABLE)}
|
||||
array set param [string toupper $args]
|
||||
set hmm_xml(FAT_TABLE) "<FAT\n"
|
||||
foreach att {SIZE_PERIOD COUNT_METHOD COUNT_SIZE READ_DATA_TYPE} {
|
||||
if {[info exists param($att)]} {
|
||||
append hmm_xml(FAT_TABLE) "$att=\"$param($att)\"\n"
|
||||
}
|
||||
}
|
||||
append hmm_xml(FAT_TABLE) "></FAT>"
|
||||
}
|
||||
proc NAT_TABLE {args} {}
|
||||
set hmm_xml(OAT_TABLE) ""
|
||||
proc OAT_TABLE {args} {
|
||||
global hmm_xml
|
||||
if {$args == ""} {return $hmm_xml(OAT_TABLE)}
|
||||
array set param $args
|
||||
set X_min -210; set X_max 210
|
||||
set Y_min -110; set Y_max 110
|
||||
set NOXCH [SplitReply [hmm configure dim0]]
|
||||
set NOYCH [SplitReply [hmm configure dim1]]
|
||||
set NOTCH [SplitReply [hmm configure dim2]]
|
||||
foreach tag {XTAG YTAG TTAG} {set $tag ""}
|
||||
set hmm_xml(OAT_TABLE) {
|
||||
<OAT NO_OAT_X_CHANNELS=\"$NOXCH\" NO_OAT_Y_CHANNELS=\"$NOYCH\" NO_OAT_T_CHANNELS=\"$NOTCH\">
|
||||
$XTAG
|
||||
$YTAG
|
||||
$TTAG
|
||||
</OAT>
|
||||
}
|
||||
if {[info exists param(NTC)]} {
|
||||
set NOTCH $param(NTC)
|
||||
}
|
||||
foreach coord {X Y T} {
|
||||
if {[info exists param($coord)]} {
|
||||
set ${coord}TAG "<$coord>$param($coord)</$coord>"
|
||||
set bbnum [llength $param($coord)]
|
||||
if {$bbnum > 2} {
|
||||
set NO${coord}CH [expr $bbnum - 1]
|
||||
} else {
|
||||
if {$coord != "T"} {
|
||||
set b0 [lindex $param($coord) 0]
|
||||
set b1 [lindex $param($coord) 1]
|
||||
set NO${coord}CH [expr {1+([set ${coord}_max] - [set ${coord}_min])/($b1 - $b0)}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FAT_TABLE SIZE_PERIOD [expr {$NOXCH*$NOYCH*$NOTCH}]
|
||||
set hmm_xml(OAT_TABLE) [subst $hmm_xml(OAT_TABLE)]
|
||||
return $hmm_xml(OAT_TABLE)
|
||||
}
|
||||
proc SAT_TABLE {args} {}
|
||||
proc SRV_TABLE {args} {}
|
||||
|
||||
proc inst_defaults {} {
|
||||
global ::histogram_memory::hmm_def_filename
|
||||
return $::histogram_memory::hmm_def_filename
|
||||
}
|
||||
proc dae_type {} {
|
||||
global ::histogram_memory::hmm_dae_type
|
||||
return $::histogram_memory::hmm_dae_type
|
||||
}
|
||||
proc ::histogram_memory::configure_server {instdef dtype} {
|
||||
variable hmm_def_filename
|
||||
variable hmm_dae_type
|
||||
set hmm_def_filename $instdef
|
||||
set hmm_dae_type $dtype
|
||||
set configuration "::histogram_memory::returnconfigfile config/hmm/anstohm_linked.xml"
|
||||
debug_msg $configuration
|
||||
hmm configure hmconfigscript $configuration
|
||||
::histogram_memory::hmm_initialize
|
||||
}
|
||||
Publish ::histogram_memory::finish user
|
||||
#Publish ::histogram_memory::hs_collect user
|
||||
Publish ::histogram_memory::hs_count_hs_controlled user
|
||||
Publish ::histogram_memory::count_bm_controlled user
|
||||
Publish ::histogram_memory::prepare user
|
||||
Publish ::histogram_memory::set_oat_offset user
|
||||
Publish ::histogram_memory::scan2_runb user
|
||||
Publish ::histogram_memory::scan2_runa user
|
||||
Publish ::histogram_memory::returnconfigfile user
|
||||
Publish ::histogram_memory::count_withbm user
|
||||
Publish ::histogram_memory::save user
|
||||
Publish BAT_TABLE user
|
||||
Publish CAT_TABLE user
|
||||
Publish FAT_TABLE user
|
||||
Publish NAT_TABLE user
|
||||
Publish OAT_TABLE user
|
||||
Publish SAT_TABLE user
|
||||
Publish SRV_TABLE user
|
||||
|
||||
namespace eval ::histogram_memory {
|
||||
command count {text:monitor,timer mode float: preset} {
|
||||
::histogram_memory::prepare
|
||||
::histogram_memory::count_bm_controlled $mode $preset;
|
||||
::histogram_memory::finish
|
||||
}
|
||||
::histogram_memory::count -addfb text status
|
||||
::histogram_memory::count -set feedback status IDLE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user