Created histogram_memory namespace.
Created functions to initialise and setup the histogram memory. r1624 | ffr | 2007-03-12 08:41:30 +1100 (Mon, 12 Mar 2007) | 3 lines
This commit is contained in:
committed by
Douglas Clowes
parent
da4631a519
commit
962dfd484b
@@ -1,11 +1,12 @@
|
|||||||
# $Revision: 1.1 $
|
# $Revision: 1.2 $
|
||||||
# $Date: 2007-03-05 05:34:12 $
|
# $Date: 2007-03-11 21:41:30 $
|
||||||
# Author: Mark Lesha (mle@ansto.gov.au)
|
# Author: Mark Lesha (mle@ansto.gov.au)
|
||||||
# Last revision by: $Author: ffr $
|
# Last revision by: $Author: ffr $
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# System: Histogram Server (sample)
|
# System: Histogram Server (sample)
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
namespace eval histogram_memory {
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
# Creating the histogram memories in SICS
|
# Creating the histogram memories in SICS
|
||||||
@@ -14,11 +15,6 @@
|
|||||||
# Make a histogram memory object hmm, allows control of the
|
# Make a histogram memory object hmm, allows control of the
|
||||||
# remote histogram server via http, and acquisition
|
# remote histogram server via http, and acquisition
|
||||||
# of histogram period data.
|
# of histogram period data.
|
||||||
MakeHM hmm anstohttp
|
|
||||||
hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080
|
|
||||||
hmm configure username spy
|
|
||||||
hmm configure password 007
|
|
||||||
hmm configure hmDataPath ../HMData
|
|
||||||
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
@@ -34,7 +30,6 @@ proc returnconfigfile {filename} {
|
|||||||
close $fh
|
close $fh
|
||||||
return $xml
|
return $xml
|
||||||
}
|
}
|
||||||
Publish returnconfigfile User
|
|
||||||
|
|
||||||
# Configure to upload a complete configuration to the histogram server.
|
# Configure to upload a complete configuration to the histogram server.
|
||||||
# In this case it's the main config file plus the FAT, BAT and OAT files
|
# In this case it's the main config file plus the FAT, BAT and OAT files
|
||||||
@@ -58,6 +53,7 @@ hmm configure hmconfigscript "returnconfigfile $cfPath(hmm)/anstohm_full.xml"
|
|||||||
# during DAQ is not allowed. This requires init of the hmm object to level 0.
|
# 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.
|
# Making sure the histogram server is stopped, so we can load configuration.
|
||||||
|
proc hmm_initialize {} {
|
||||||
hmm configure init 0
|
hmm configure init 0
|
||||||
hmm init
|
hmm init
|
||||||
hmm stop
|
hmm stop
|
||||||
@@ -75,7 +71,7 @@ hmm configure init 0
|
|||||||
# This not only makes sure it's stopped, but lets us see certain configuration variables
|
# 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.
|
# 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
|
# Here, define a function to let us read back the value of dictionary items from the hmm
|
||||||
# such as OAT dimensions.
|
# such as OAT dimensions.
|
||||||
proc hmmdictitemval {histomem dictitem} {
|
proc hmmdictitemval {histomem dictitem} {
|
||||||
@@ -87,13 +83,15 @@ proc hmmdictitemval {histomem dictitem} {
|
|||||||
# Configure histogram dimensions, mode, etc. using the dictionary variables.
|
# Configure histogram dimensions, mode, etc. using the dictionary variables.
|
||||||
# For the dimensions, set the 'effective' OAT dimensions which are the
|
# For the dimensions, set the 'effective' OAT dimensions which are the
|
||||||
# histogram period dimensions. Do an init after to cause memory to be allocated.
|
# histogram period dimensions. Do an init after to cause memory to be allocated.
|
||||||
hmm configure histmode transparent
|
proc hmm_setup {mode bankNum rankNum nyc nxc ntc} {
|
||||||
hmm configure bank 0
|
hmm configure histmode $mode
|
||||||
hmm configure rank 3
|
hmm configure bank $bankNum
|
||||||
hmm configure dim0 [hmmdictitemval hmm oat_nyc_eff]
|
hmm configure rank $rankNum
|
||||||
hmm configure dim1 [hmmdictitemval hmm oat_nxc_eff]
|
hmm configure dim0 [hmmdictitemval hmm $nyc]
|
||||||
hmm configure dim2 [hmmdictitemval hmm oat_ntc_eff]
|
hmm configure dim1 [hmmdictitemval hmm $nxc]
|
||||||
|
hmm configure dim2 [hmmdictitemval hmm $ntc]
|
||||||
hmm init
|
hmm init
|
||||||
|
}
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
# Create beam monitor counter
|
# Create beam monitor counter
|
||||||
@@ -158,8 +156,6 @@ MakeHMControl_ANSTO hmc bm hmm
|
|||||||
# hmscan run 5 timer 1 (termination controlled by the beam monitor)
|
# hmscan run 5 timer 1 (termination controlled by the beam monitor)
|
||||||
# scan2_runb 5 TIME 100 IMMEDIATE (termination controlled by the histogram server)
|
# scan2_runb 5 TIME 100 IMMEDIATE (termination controlled by the histogram server)
|
||||||
#
|
#
|
||||||
MakeScanCommand hmscan bm $cfPath(scan)/scan.hdd recover.bin
|
|
||||||
MakeScanCommand scan2 bm $cfPath(scan)/scan.hdd recover.bin
|
|
||||||
#
|
#
|
||||||
# Call is: scan2_runa <n>
|
# Call is: scan2_runa <n>
|
||||||
proc scan2_runa {n} {
|
proc scan2_runa {n} {
|
||||||
@@ -168,7 +164,6 @@ proc scan2_runa {n} {
|
|||||||
# directly in this case.
|
# directly in this case.
|
||||||
scan2 run $n timer 0
|
scan2 run $n timer 0
|
||||||
}
|
}
|
||||||
Publish scan2_runa User
|
|
||||||
#
|
#
|
||||||
# Call is: scan2_runb <n>
|
# 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} {
|
||||||
@@ -185,7 +180,6 @@ proc scan2_runb {n count_method count_size count_stop} {
|
|||||||
# directly in this case. So, use 'timer 0' here.
|
# directly in this case. So, use 'timer 0' here.
|
||||||
scan2 run $n timer 0
|
scan2 run $n timer 0
|
||||||
}
|
}
|
||||||
Publish scan2_runb User
|
|
||||||
|
|
||||||
# Simulated counter. No error rate. Required for technical reasons...
|
# Simulated counter. No error rate. Required for technical reasons...
|
||||||
# This counter is used only to block execution till the bm count is actually reached,
|
# This counter is used only to block execution till the bm count is actually reached,
|
||||||
@@ -226,7 +220,6 @@ proc set_oat_offset {oatoff_x oatoff_y oatoff_t} {
|
|||||||
hmm init
|
hmm init
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish set_oat_offset User
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
# Support for data acquisition
|
# Support for data acquisition
|
||||||
@@ -273,14 +266,13 @@ proc hs_prepare {scanobjectname userobjectname} {
|
|||||||
set oatoffset 0
|
set oatoffset 0
|
||||||
set_oat_offset 0 0 0
|
set_oat_offset 0 0 0
|
||||||
#
|
#
|
||||||
stdscan prepare $scanobjectname $userobjectname
|
# stdscan prepare $scanobjectname $userobjectname
|
||||||
#clientput "hmm pause being done..." value
|
#clientput "hmm pause being done..." value
|
||||||
# Pause the histogram server, this primes the DAE for acqisition.
|
# Pause the histogram server, this primes the DAE for acqisition.
|
||||||
hmm pause
|
hmm pause
|
||||||
#clientput "Exit prepare" value
|
#clientput "Exit prepare" value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish hs_prepare User
|
|
||||||
|
|
||||||
# The count_bm_controlled callback gets called at the start of dataset acquisition.
|
# 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.
|
# We use it to perform the dataset acquisition, via the hmc object.
|
||||||
@@ -300,7 +292,6 @@ proc hs_count_bm_controlled {scanobjectname userobjectname point mode preset} {
|
|||||||
#clientput "Exit count" value
|
#clientput "Exit count" value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish hs_count_bm_controlled User
|
|
||||||
|
|
||||||
# The count_hs_controlled callback gets called at the start of dataset acquisition.
|
# 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.
|
# We use it to perform the dataset acquisition, controlled by the histogram server.
|
||||||
@@ -323,7 +314,6 @@ proc hs_count_hs_controlled {scanobjectname userobjectname point mode preset} {
|
|||||||
#clientput "Exit count" value
|
#clientput "Exit count" value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish hs_count_hs_controlled User
|
|
||||||
|
|
||||||
# The collect callback gets called at the end of the dataset acquisition.
|
# 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,
|
# We can put stuff here to retrieve data collected at each scan point,
|
||||||
@@ -353,13 +343,12 @@ proc hs_collect {scanobjectname userobjectname point} {
|
|||||||
#clientput "Exit collect" value
|
#clientput "Exit collect" value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish hs_collect User
|
|
||||||
|
|
||||||
# The finish callback gets called at the end of the scan.
|
# The finish callback gets called at the end of the scan.
|
||||||
# We use it to stop the histogram server, terminating the dataset.
|
# We use it to stop the histogram server, terminating the dataset.
|
||||||
proc hs_finish {scanobjectname userobjectname} {
|
proc hs_finish {scanobjectname userobjectname} {
|
||||||
#clientput "Enter finish" value
|
#clientput "Enter finish" value
|
||||||
stdscan finish $scanobjectname $userobjectname
|
# stdscan finish $scanobjectname $userobjectname
|
||||||
#clientput "hmm stop being done..." value
|
#clientput "hmm stop being done..." value
|
||||||
hmm stop
|
hmm stop
|
||||||
# Just in case someone expects zero OAT offsets later on ;)
|
# Just in case someone expects zero OAT offsets later on ;)
|
||||||
@@ -373,23 +362,30 @@ proc hs_finish {scanobjectname userobjectname} {
|
|||||||
#clientput "Exit finish" value
|
#clientput "Exit finish" value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Publish hs_finish User
|
}
|
||||||
|
|
||||||
# Configure script mode, then we can configure all the scan callbacks.
|
publish ::histogram_memory::hs_finish user
|
||||||
# The scan list command can be used to check that the callbacks
|
#publish ::histogram_memory::hs_collect user
|
||||||
# are properly defined.
|
publish ::histogram_memory::hs_count_hs_controlled user
|
||||||
# A different count callback is defined in the two cases.
|
publish ::histogram_memory::hs_count_bm_controlled user
|
||||||
|
publish ::histogram_memory::hs_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
|
||||||
|
|
||||||
|
#hmscan function count ::histogram_memory::hs_count_bm_controlled
|
||||||
|
#hmscan function collect ::histogram_memory::hs_collect
|
||||||
|
#hmscan function finish ::histogram_memory::hs_finish
|
||||||
#
|
#
|
||||||
hmscan configure script
|
|
||||||
#hmscan function prepare hs_prepare
|
|
||||||
hmscan function count hs_count_bm_controlled
|
|
||||||
hmscan function collect hs_collect
|
|
||||||
hmscan function finish hs_finish
|
|
||||||
#
|
|
||||||
scan2 configure script
|
|
||||||
#scan2 function prepare hs_prepare
|
#scan2 function prepare hs_prepare
|
||||||
scan2 function count hs_count_hs_controlled
|
scan2 function count ::histogram_memory::hs_count_hs_controlled
|
||||||
scan2 function collect hs_collect
|
#scan2 function collect ::histogram_memory::hs_collect
|
||||||
scan2 function finish hs_finish
|
scan2 function finish ::histogram_memory::hs_finish
|
||||||
#
|
|
||||||
# That's all, folks...
|
MakeHM hmm anstohttp
|
||||||
|
hmm configure hmaddress http://das1-[SplitReply [instrument]]:8080
|
||||||
|
hmm configure username spy
|
||||||
|
hmm configure password 007
|
||||||
|
hmm configure hmDataPath ../HMData
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user