Merge branch 'RELEASE-3_1' into RELEASE-3_2
Conflicts: sics/site_ansto/instrument/bilby/config/chopper/sct_astrium_chopper.tcl sics/site_ansto/instrument/bilby/config/motors/shutters_sct.tcl sics/site_ansto/instrument/bilby/config/motors/tank_sct.tcl sics/site_ansto/instrument/bilby/util/sics_config.ini sics/site_ansto/instrument/config/environment/hiden_xcs_sct.tcl sics/site_ansto/instrument/config/environment/huber_pilot_sct.tcl sics/site_ansto/instrument/config/environment/isotech_ps_sct.tcl sics/site_ansto/instrument/config/environment/keithley_m2700_sct.tcl sics/site_ansto/instrument/config/environment/magneticField/oxford12tlv_sct.tcl sics/site_ansto/instrument/config/environment/magneticField/tsi_smc_sct.tcl sics/site_ansto/instrument/config/environment/nhq_200_sct.tcl sics/site_ansto/instrument/config/environment/omron_hldc_sct.tcl sics/site_ansto/instrument/config/environment/protekmm_sct.tcl sics/site_ansto/instrument/config/environment/temperature/eurotherm_m2000_sct.tcl sics/site_ansto/instrument/config/environment/temperature/julabo_lh45_gen_sct.tcl sics/site_ansto/instrument/config/environment/temperature/lakeshore_218_sct.tcl sics/site_ansto/instrument/config/environment/temperature/ls336_sct.tcl sics/site_ansto/instrument/config/environment/temperature/ls340_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_base_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_level_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_pres_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_scpi_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_temp_sct.tcl sics/site_ansto/instrument/config/environment/temperature/mercury_valve_sct.tcl sics/site_ansto/instrument/config/environment/temperature/nprvasm2_sct.tcl sics/site_ansto/instrument/config/environment/temperature/pfeiffer_hg_sct.tcl sics/site_ansto/instrument/config/environment/temperature/watlow_mpm_sct.tcl sics/site_ansto/instrument/config/environment/temperature/watlow_mrm_sct.tcl sics/site_ansto/instrument/config/environment/temperature/watlow_mst4_sct.tcl sics/site_ansto/instrument/config/environment/temperature/west_6100.sct sics/site_ansto/instrument/config/source/reactor_status_sct.tcl sics/site_ansto/instrument/hrpd/echidna_configuration.tcl sics/site_ansto/instrument/sans/quokka_configuration.tcl sics/site_ansto/instrument/tas/config/motors/motor_configuration.tcl sics/site_ansto/instrument/util/gen_sct.py sics/site_ansto/instrument/util/motor_utility.tcl
This commit is contained in:
96
site_ansto/instrument/sans/config/commands/growfile.tcl
Normal file
96
site_ansto/instrument/sans/config/commands/growfile.tcl
Normal file
@@ -0,0 +1,96 @@
|
||||
# \file Implements 'dsc actime interval' command.
|
||||
set GROWFILE_STATE "DISABLED"
|
||||
set growfileSaveIndex 0
|
||||
|
||||
|
||||
proc doGrowFile {} {
|
||||
global GROWFILE_STATE
|
||||
global growfileSaveIndex
|
||||
|
||||
# Reset the GROWFILE_STATE variable in case some naughty user sets it directly
|
||||
set GROWFILE_STATE "ENABLED"
|
||||
set HMSTATE [SplitReply [hmm configure daq]]
|
||||
set FSTATE [SplitReply [file_status]]
|
||||
# broadcast CALLED: [info level 0], HMSTATE = $HMSTATE, FSTATE = $FSTATE
|
||||
if { $FSTATE != "UNKNOWN" && $FSTATE != "OPEN" && $HMSTATE == "Started"} {
|
||||
# broadcast growfile $growfileSaveIndex
|
||||
save $growfileSaveIndex "growfile"
|
||||
incr growfileSaveIndex
|
||||
} else {
|
||||
if {$growfileSaveIndex == 0} {
|
||||
broadcast ERROR: GROWFILE HMSTATE = $HMSTATE, FSTATE = $FSTATE. The histmem must be running and you must create a newfile before calling "growfile"
|
||||
} else {
|
||||
broadcast STOP GROWFILE Acquisition finished. HMSTATE = $HMSTATE, FSTATE = $FSTATE.
|
||||
save $growfileSaveIndex "growfile"
|
||||
newfile clear
|
||||
broadcast Saved [hval /experiment/file_name]
|
||||
}
|
||||
set growfileSaveIndex 0
|
||||
sicspoll del doGrowFile
|
||||
set GROWFILE_STATE "DISABLED"
|
||||
hsetprop /instrument/detector/hmm mutable true
|
||||
}
|
||||
}
|
||||
publish doGrowFile user
|
||||
|
||||
|
||||
proc growfile { {interval 300} } {
|
||||
global GROWFILE_STATE
|
||||
global growfileSaveIndex
|
||||
|
||||
set GROWFILE_STATE "DISABLED"
|
||||
set growfileSaveIndex 0
|
||||
|
||||
set as_error 0
|
||||
|
||||
set myrights [set_rights manager]
|
||||
if {$myrights == -1} {
|
||||
return -code error "ERROR: You are not authorized for this operation"
|
||||
}
|
||||
set interval [string tolower $interval]
|
||||
if {$interval == "check" || $interval == "status"} {
|
||||
if { $GROWFILE_STATE == "ENABLED" } {
|
||||
return "GROWFILE $GROWFILE_STATE [sicspoll intervall doGrowFile]"
|
||||
} else {
|
||||
return "GROWFILE $GROWFILE_STATE"
|
||||
}
|
||||
} elseif {[string is integer $interval]} {
|
||||
if {$interval <= 0} {
|
||||
if { $GROWFILE_STATE == "ENABLED" } {
|
||||
sicspoll del doGrowFile
|
||||
set GROWFILE_STATE "DISABLED"
|
||||
}
|
||||
} else {
|
||||
if {$GROWFILE_STATE == "DISABLED"} {
|
||||
sicspoll add doGrowFile script $interval doGrowFile
|
||||
# sicspoll listen # WARNING:When the listening client exits it leaves SICSPOLL task with a corrupt connection object.
|
||||
set GROWFILE_STATE "ENABLED"
|
||||
} else {
|
||||
sicspoll intervall doGrowFile $interval
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set as_error 1
|
||||
}
|
||||
|
||||
set_rights $myrights
|
||||
|
||||
if {$as_error} {
|
||||
return -code error "ERROR: Invalid argument in '[info level 0]', should be an integer or 'check'"
|
||||
}
|
||||
}
|
||||
publish growfile user
|
||||
|
||||
# \brief Run histogram for the specified time and save XY binned data at the given interval.
|
||||
# \param actime Acquisition time in seconds.
|
||||
# \param saveint Save interval in seconds.
|
||||
proc dsc {actime saveint} {
|
||||
hsetprop /instrument/detector/hmm mutable false
|
||||
newfile HISTOGRAM_XY
|
||||
histmem mode time
|
||||
histmem preset $actime
|
||||
histmem start
|
||||
growfile $saveint
|
||||
}
|
||||
|
||||
publish dsc user
|
||||
Reference in New Issue
Block a user