From 555031aa7d9ae198a37489a5002e68d08cc2f3dc Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 28 Aug 2014 13:58:28 +1000 Subject: [PATCH] Histogram memory configuration for Taipan Be filter configuration. --- .../tas/config/hmm/hmm_configuration.tcl | 80 +++++++++++++++++-- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/site_ansto/instrument/tas/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/tas/config/hmm/hmm_configuration.tcl index c10ab5e6..17234452 100644 --- a/site_ansto/instrument/tas/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/tas/config/hmm/hmm_configuration.tcl @@ -1,10 +1,76 @@ -namespace eval histogram_memory { - # Define HP_HMM to make nxscripts_common_1.tcl::nexus::process_filetype_policy happy when setting filetype=BEAM_MONITOR - set HP_HMM "" +# Author Jing Chen (jgn@ansto.gove.au) - # Define isc_initialize to give server_config.tcl:server_init something to call - proc isc_initialize {} { - } - proc set_sobj_attributes {} { + +fileeval $cfPath(hmm)/hmm_configuration_common_1.tcl +set sim_mode [SplitReply [hmm_simulation]] + +proc ::histogram_memory::init_OAT_TABLE {} { + variable INST_NXC "oat_nxc_eff" + variable INST_NYC "oat_nyc_eff" + + if [ catch { + + OAT_TABLE X -setdata MAX_CHAN 30 + OAT_TABLE Y -setdata MAX_CHAN 1024 + OAT_TABLE X -setdata BMIN -0.5 + OAT_TABLE X -setdata BMAX 29.5 + OAT_TABLE Y -setdata BMIN -0.5 + OAT_TABLE Y -setdata BMAX 1023.5 + + set clock_scale 1000 + set freq 50 + + hmm configure fat_clock_scale $clock_scale + hmm configure fat_frame_frequency $freq + hmm configure fat_frame_source EXTERNAL + # The entries in the time bin array are in nanoseconds/clock_scale because the clock base is in nanoseconds + OAT_TABLE -set X { 29.5 28.5 } NXC 30 Y { -0.5 3.5 } NYC 256 T {0 20000} NTC 1 + + if {$::sim_mode == "true"} { + hmm configure oat_ntc_eff 1 + hmm configure $INST_NYC 256 + hmm configure $INST_NXC 30 + } + + } message ] { + if {$::errorCode=="NONE"} {return $message} + return -code error $message } } + +proc ::histogram_memory::pre_count {} {} +proc ::histogram_memory::post_count {} {} +proc ::histogram_memory::isc_initialize {} { + # Instrument specific X and Y dimension names + + if [ catch { + ::histogram_memory::init_hmm_objs + BAT_TABLE -init +# CAT_TABLE -init + SAT_TABLE -init + OAT_TABLE -init + FAT_TABLE -init + ::histogram_memory::ic_initialize + +# TODO set height and width if they want axes in mm + detector_active_height_mm 1.0 + detector_active_height_mm lock + detector_active_width_mm 1.0 + detector_active_width_mm lock + + ::histogram_memory::init_OAT_TABLE + ::histogram_memory::upload_config Filler_defaults + + set ::histogram_memory::histmem_axes(HOR) /instrument/detector/x_bin + set ::histogram_memory::histmem_axes(VER) /instrument/detector/y_bin + ::histogram_memory::set_frame_source INTERNAL + } message ] { + if {$::errorCode=="NONE"} {return $message} + return -code error $message + } +} + +proc histmem {cmd args} { + eval "_histmem $cmd $args" +} +publish histmem user