SICS-294 anstohttp.c

Histmem now only calls TaskYield after SICS has finished initalising, this stops the statusfile task from being called early and overwriting the status file. Created ANSTO_MakeHistMemory command to install ANSTO_HistAction
Added veto functions.  Mapped the HistDriver interface Pause() and Continue() commands to AnstoHttpVeto and AnstoHttpNoVeto. Implemented an ANSTO_Histaction to call AnstoHttpPause when sent a "pause" subcommand.

hmcontrol_ansto.c
Call AnstoHttpPause() directly when Pause_HM_After_Count is set to preserver current behaviour.

counterdriv.c
Now sends the correct "SICS RESUME" command to resume a paused count.

ansto_sctdriveadapter.c NEW
This lets you create driveable objects from script-context controllers which have one node for setting a parameter and another node for reading the parameter (eg temperature controllers, choppers, velocity selectors)

sctemonadapter.c NEW
This generates an environment monitor interface for script-context controllers so that the emon object in SICS will be able to pause counters if the controller goes out of tolerance.

sct_usbtmcprot.c, usbtmc.h NEW
First attempt at a protocol handler for USB Test and Measurement Class devices

sct_julabo_lh45.tcl NEW
Implements script-context controller for the Julabo LH45 temperature controller.

Makefile
Added ansto_sctdriveadapter and sctemonadapter

hardsup/makefile
Added velocity selector and usbtmc protocol handlers

hardsup/sct_velselprot.c
Simplified, don't worry about trying to implement a login handler for now, just implement a "Reading" handler.

site_ansto.c
Add the velocity selector and USBTMC protocol handlers.
Added the ANSTO_MakeHM command

instrument/config/hipadaba/common_instrument_dictionary.tcl
Added support for auxiliary data, ie extra meta-data entries in the "data" group of the nexus file.
Add new NXvelocity_selector object under /instrument.

instrument/config/hipadaba/hipadaba_configuration_common.tcl
Add the new "sct_object" script-context controller objects to the hdb tree.

instrument/config/hipadaba/instdict_specification.tcl
Define the new sct_object controllers.

instrument/config/hmm/hmm_configuration_common_1.tcl
Use the new ANSTO_MakeHM command to create histmem drivers which support veto.
Define allowed attributes and elements for the BAT_TABLE and FAT_TABLE
Stop between counts instead of pausing because setting pause now sends a veto.

instrument/config/motors/sct_jogmotor_common.tcl
You now need to specify klass when creating a jogmotor.

instrument/config/motors/sct_positmotor_common.tcl
You can now specify an optional function which calculates the instrument parameter (eg attenuation) from a posit table entry when defining a posit motor.

instrument/config/nexus/nxscripts_common_1.tcl
Report file status info in the /experiment section of the hdb tree.  Add auxiliary data to data file.
Handle saving data from script-context controller objects.

instrument/util/script_context_util.tcl
Added procedure to set required properties  for saving script-context object data.

instrument/util/utility.tcl
Added set_sct_object_attributes proc to automatically set required attributes on SCT_OBJECTs
Fixed hlistplainprop to deal with empty property fields on hdb nodes.

instrument/server_config.tcl
Call the new nexus initialisation command and set attributes on sct objects.

hrpd/config/motors/motor_configuration.tcl
New absenc home readings for mchi and mphi. New absenc home and range for mf1

hipd/config/commands/commands.tcl
Exported and published the new ajscmds so that they can be used in batch files.

hipd/config/motors/motor_configuration.tcl
New mchi absenc home

rsd/config/hmm/hmm_configuration.tcl
Provide support for saving corrected hmm data

rsd/config/motors/motor_configuration.tcl
Use simple names for motors.

SICS-329

sans/config/INSTCFCOMMON.TXT
Added julabo and lakeshore configuration files to list.

sans/config/optics/guide_configuration.tcl
Added entrance aperture positions to the configuration table and the cn_maps which map the index to the component ID.

sans/commands/commands.tcl
The "guide" command now set EApPosYmm after driving the guides in place.
The indexed position to component maps (cn_map) have been moved to the guide_configuration.tcl file.

sans/motors/motor_configuration.tcl
Set samy home to 56.1mm

sans/config/velsel/sct_velsel.tc NEW
Implements script-context controller object for the NVS40 velocity selector. TODO tilt-angle control, driveable interface.

sans/config/hmm/hmm_configuration.tcl
Set 5.08mm spacing on detector width. Use pixel-offset for vertical and horizontal detector axes.

sans/config/motors/motor_configuration.tcl
Swap directions of beamstops 4 and 5 (the two smallest)
New config parameters for samx, samthet, apx, det, detoff, bsz,

sans/config/motors/positmotor_configuration.tcl
Added descriptive headers to positmotor configuration tables and new synstax for the make positmotor command.

sans/config/nexus/nxscripts.tcl
Implemented initialisation command.

sans/config/parameters/parameters.tcl
Added SampleThickness and TransmissionFlag.  Calculate SamplePosYmm from samy and SamyOffsetmm.
Added beamstops to hdb tree.

reflectometer/config/nexus/nxscripts.tcl
Implement the initialisation procedure.

r2767 | ffr | 2009-03-31 10:16:54 +1100 (Tue, 31 Mar 2009) | 123 lines
This commit is contained in:
Ferdi Franceschini
2009-03-31 10:16:54 +11:00
committed by Douglas Clowes
parent eec824f98a
commit d2f57e4615
39 changed files with 2026 additions and 557 deletions

View File

@@ -10,7 +10,10 @@ sicsdatafactory new nxscript_data
::utility::mkVar eend Text user end_time true entry false true
::utility::mkVar timestamp int user time_stamp true entry false true
::utility::mkVar data_run_number int user run_number true instrument false true
::utility::mkVar save_count int user save_count true experiment true true
::utility::mkVar currpoint int user currpoint true experiment true true
::utility::mkVar nexus_datatype text user DataType true data false true
::utility::mkVar file_status text user file_status true experiment true true
::utility::mkVar file_set_list Text user file_set true experiment true true
sicslist setatt data_run_number mutable true
sicslist setatt timestamp mutable true
@@ -56,6 +59,8 @@ namespace eval nexus {
link {axis 2 ::histogram_memory::time_channel}
link {axis 3 ::histogram_memory::vertical_axis}
link {axis 4 ::histogram_memory::horizontal_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm}
save_policy {include @all exclude {hmm_xy hmm_xt hmm_yt hmm_x hmm_y hmm_t}}
}
@@ -63,6 +68,8 @@ namespace eval nexus {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::vertical_axis}
link {axis 3 ::histogram_memory::horizontal_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_xy}
save_policy {include @all exclude {hmm hmm_xt hmm_yt hmm_x hmm_y hmm_t}}
}
@@ -70,6 +77,8 @@ namespace eval nexus {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::time_channel}
link {axis 3 ::histogram_memory::horizontal_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_xt}
save_policy {include @all exclude {hmm_xy hmm hmm_yt hmm_x hmm_y hmm_t}}
}
@@ -77,30 +86,36 @@ namespace eval nexus {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::time_channel}
link {axis 3 ::histogram_memory::vertical_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_yt}
save_policy {include @all exclude {hmm_xy hmm_xt hmm hmm_x hmm_y hmm_t}}
}
HISTOGRAM_X {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::horizontal_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_x}
save_policy {include @all exclude {hmm_xy hmm_xt hmm_yt hmm hmm_y hmm_t}}
}
HISTOGRAM_Y {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::vertical_axis}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_y}
save_policy {include @all exclude {hmm_xy hmm_xt hmm_yt hmm_x hmm hmm_t}}
}
HISTOGRAM_T {
link {axis 1 data_run_number}
link {axis 2 ::histogram_memory::time_channel}
link {aux_data 1 ::histogram_memory::time}
link {aux_data 2 ::histogram_memory::total_counts}
link {data_set hmm_t}
save_policy {include @all exclude {hmm_xy hmm_xt hmm_yt hmm_x hmm_y hmm}}
}
}
variable filetype_spec [concat [array get bmon_filetype_spec] [array get histmem_filetype_spec] ]
}
##
@@ -191,7 +206,9 @@ proc newFileName {idNum postfix} {
variable state
variable nexusdic
variable currFilename
variable save_count_arr
variable start_seconds_array
variable file_states
array set state {
file,open "false"
@@ -204,7 +221,18 @@ proc newFileName {idNum postfix} {
set nexusdic "nexus.dic"
array set currFilename ""
array set save_count_arr ""
array set start_seconds_array ""
array set file_states {U "UNKNOWN" O "OPEN" C "CLOSED" S "SAVING"}
save_count 0
currpoint 0
file_status UNKNOWN
}
proc ::nexus::ic_initialize {} {
variable bmon_filetype_spec
variable histmem_filetype_spec
variable filetype_spec [concat [array get bmon_filetype_spec] [array get histmem_filetype_spec] ]
}
##
@@ -282,6 +310,8 @@ proc ::nexus::newfile_collection {args} {
variable state
variable data_gp_path
variable currFilename
variable save_count_arr
variable file_states
set valid_options [list "-labels" "-filetype" "-savetype"]
set required_options [list "-filetype" "-savetype"]
@@ -296,7 +326,8 @@ proc ::nexus::newfile_collection {args} {
default { error "ERROR: Invalid file suffix $file_suffix" }
}
set state(file,namestyle) $param(-savetype)
file_set_list "UNKNOWN"
array unset save_count_arr
array unset currFilename
if {$param(-savetype) == "scratch"} {
set state(file,isNewScratchFile) true
set state(file,incr_datnum) false
@@ -310,11 +341,13 @@ proc ::nexus::newfile_collection {args} {
set state(file,labels) $param(-labels)
if {$param(-savetype) == "scratch"} {
foreach fid $state(file,labels) {
set save_count_arr($fid) 0
set currFilename($fid) [format "%s/scratch_%s.%s" [::nexus::datapath] $fid $file_suffix]
lappend files $currFilename($fid)
}
} else {
foreach fid $state(file,labels) {
set save_count_arr($fid) 0
set currFilename($fid) [newFileName $idNum $file_suffix]
incr idNum
lappend files $currFilename($fid)
@@ -324,12 +357,16 @@ proc ::nexus::newfile_collection {args} {
} else {
set state(file,fileset) "false"
set state(file,labels) @singlefile
set save_count_arr(@singlefile) 0
if {$param(-savetype) == "scratch"} {
set currFilename(@singlefile) [format "%s/scratch.%s" [::nexus::datapath] $file_suffix]
} else {
set currFilename(@singlefile) [newFileName $idNum $file_suffix]
}
}
save_count 0
currpoint 0
file_status $file_states(U)
hsetprop $data_gp_path currentfiletype UNKNOWN
if {$param(-filetype) == "clear"} {
::nexus::data clear
@@ -337,6 +374,8 @@ proc ::nexus::newfile_collection {args} {
hsetprop $data_gp_path currentfiletype UNKNOWN
hsetprop $data_gp_path datatype UNKNOWN
nexus_datatype "UNKNOWN"
file_set_list "UNKNOWN"
# dataFileName "UNKNOWN"
} else {
::nexus::process_filetype_policy $param(-filetype) filetype_spec
nexus_datatype $param(-filetype)
@@ -407,6 +446,8 @@ proc ::nexus::save {{point 0}} {
variable start_seconds
variable start_seconds_array
variable currFilename
variable save_count_arr
variable file_states
set valid_options [list "-index" "-label"]
set required_options [list "-index"]
@@ -456,20 +497,32 @@ proc ::nexus::save {{point 0}} {
set start_seconds [clock seconds]
# set start_seconds_array($data_label) $start_seconds
timestamp 0
file_status $file_states(O)
::nexus::nxreopenfile $currFilename($data_label)
file_status $file_states(S)
::nexus::save_data $point
::nexus::makelinks
::nexus::set_plotdata_info
::nexus::nxclosefile $currFilename($data_label)
file_status $file_states(C)
incr save_count_arr($data_label)
save_count $save_count_arr($data_label)
currpoint $point
set state(file,isNewScratchFile) false
} else {
eend [lindex [sicstime] 1]
# timestamp [expr {[clock seconds] - $start_seconds_array($data_label)}]
timestamp [expr {[clock seconds] - $start_seconds}]
dataFileName $currFilename($data_label)
file_status $file_states(O)
::nexus::nxreopenfile $currFilename($data_label)
file_status $file_states(S)
::nexus::save_data $point
::nexus::nxclosefile $currFilename($data_label)
file_status $file_states(C)
incr save_count_arr($data_label)
currpoint $point
save_count $save_count_arr($data_label)
}
} message ] {
::nexus::nxclosefile $currFilename($data_label)
@@ -552,6 +605,8 @@ proc ::nexus::save {{point 0}} {
# Records that /data/data_set should be linked to datsource and sets a data type identifier
# data axis 1|2|3|4 datsource
# Records that /data/axisn should be linked to datsource
# data aux_data 1|2|3|4|5|6|7|8|9 datsource
# Records that /data/aux_datan should be linked to datsource
# data clear
# Clears all link targets and sets the data type identifier to unknown
# data alias <name>, remove alias <name>
@@ -571,7 +626,7 @@ proc ::nexus::save {{point 0}} {
set arglist [lrange $arguments 1 end]
switch $opt {
"axis" {
"axis" - "aux_data" {
debug_msg "'axis' case of switch"
set link_target [lindex $arguments 2]
if {[getatt $link_target privilege] == "internal"} {
@@ -584,7 +639,7 @@ proc ::nexus::save {{point 0}} {
if {[getatt $link_target type] == ""} {
error "Unknown link target $link_target"
}
set hp $dpath/axis_$axnum
set hp $dpath/${opt}_$axnum
# if {[::utility::hgetplainprop $hp link] == "@none"} {
hsetprop $hp link [getatt [lindex $arguments 2] id]
hsetprop $hp long_name [getatt [lindex $arguments 2] long_name]
@@ -689,6 +744,9 @@ proc ::nexus::save {{point 0}} {
nxscript putattribute $p_arr(link) signal 1
set data_set_alias $p_arr(link)
}
"aux_data_*" {
continue
}
default {error "ERROR: [info level -1]->set_plotdata_info, Unsupported data path $hpath/$child"}
}
}
@@ -730,7 +788,7 @@ proc ::nexus::save {{point 0}} {
if {[info exists p_arr(mutable)] && $p_arr(mutable) == "true" } {
nxscript puthdb /$hpath/$child point $pt
} else {
nxscript puthdb /$hpath/$child
nxscript puthdb /$hpath/$child point 0
}
}
::nexus::savetree $hpath/$child $pt
@@ -776,18 +834,27 @@ proc ::nexus::save {{point 0}} {
}
array set p_arr [::utility::hlistplainprop /$hpath]
set data_type [lindex [split [hinfo /$hpath] , ] 0]
if {$data_type == "none"} {
if {$data_type == "none" && $p_arr(type) != "nxvgroup"} {
#XXX Do we need to check data_type here. This would skip NXVGROUP nodes
return;
}
if {$p_arr(data) == "true" && $p_arr(nxsave) == "true" && [info exists p_arr(nxalias)]} {
set alias $p_arr(nxalias)
if {[info exists p_arr(sdsinfo)]} {
if {[info exists p_arr(mutable)] && $p_arr(mutable) == "true"} {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $p_arr(sicsdev) $data_type mutable true]"
} else {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $p_arr(sicsdev) $data_type mutable false]"
}
} elseif {[info exists p_arr(type)] && $p_arr(type) == "nxvgroup"} {
if {[info exists p_arr(sdsinfo)]} {
if {[info exists p_arr(mutable)] && $p_arr(mutable) == "true"} {
if {[info exists p_arr(savecmd)]} {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $p_arr(sicsdev) $data_type mutable true]"
} else {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $data_type mutable true]"
}
} else {
if {[info exists p_arr(savecmd)]} {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $p_arr(sicsdev) $data_type mutable false]"
} else {
set nxdictionary($alias) "$dictPath/SDS $name [$p_arr(sdsinfo) $data_type mutable false]"
}
}
} elseif {[info exists p_arr(type)] && $p_arr(type) == "nxvgroup"} {
set nxdictionary($alias) "$dictPath/NXVGROUP"
}
}
@@ -971,12 +1038,12 @@ proc ::nexus::motor::save {motor nxalias data_type args} {
proc ::nexus::motor::sdsinfo {motor data_type args} {
array set param $args
array set attribute [::utility::normalattlist $motor]
set dtype [::nexus::hdb2nx_type $data_type]
if {[info exists attribute(units)]} {
set units_att " -attr {units,$attribute(units)} "
} else {
set units_att " "
}
set dtype [::nexus::hdb2nx_type $data_type]
set name_att " -attr {long_name,$attribute(long_name)} "
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1} $units_att $name_att"
@@ -1067,7 +1134,6 @@ namespace eval ::nexus {
proc ::nexus::sicsvariable::save {svar nxalias data_type args} {
if [ catch {
array set attribute [attlist $svar]
set val [SplitReply [$svar]]
if {[lindex $args 0] == "point"} {
set index [lindex $args 1]
@@ -1086,9 +1152,6 @@ proc ::nexus::sicsvariable::save {svar nxalias data_type args} {
default {error "ERROR: [info level -1]->::nexus::sicsvariable::save, unknown type $data_type"}
}
}
if {[info exists attribute(units)]} {
nxscript putattribute $nxalias units $attribute(units)
}
} message ] {
if {$::errorCode=="NONE"} {return $message}
return -code error "::nexus::sicsvariable::save, $message"
@@ -1096,18 +1159,24 @@ proc ::nexus::sicsvariable::save {svar nxalias data_type args} {
}
# TODO Add optional units to sicsvariables
proc ::nexus::sicsvariable::sdsinfo {svar data_type args} {
proc ::nexus::sicsvariable::sdsinfo {sobj data_type args} {
array set param $args
set dtype [::nexus::hdb2nx_type $data_type]
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1}"
} else {
return " -type $dtype"
}
set dtype [::nexus::hdb2nx_type $data_type]
array set attribute [::utility::normalattlist $sobj]
if {[info exists attribute(units)]} {
set units_att " -attr {units,$attribute(units)} "
} else {
set units_att " "
}
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1} $units_att"
} else {
return " -type $dtype $units_att"
}
}
namespace eval ::nexus::scobj {}
proc ::nexus::scobj::sdsinfo {svar data_type args} {
proc ::nexus::scobj::sdsinfo {data_type args} {
array set param $args
set dtype [::nexus::hdb2nx_type $data_type]
if {$param(mutable) == true} {
@@ -1138,19 +1207,22 @@ proc ::nexus::chopperadapter::save {sobj nxalias data_type args} {
default {error "ERROR: [info level -1]->::nexus::chopperadapter::save, unknown type $data_type"}
}
}
if {[info exists attribute(units)]} {
nxscript putattribute $nxalias units $attribute(units)
}
}
proc ::nexus::chopperadapter::sdsinfo {sobj data_type args} {
array set param $args
set dtype [::nexus::hdb2nx_type $data_type]
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1}"
} else {
return " -type $dtype"
}
set dtype [::nexus::hdb2nx_type $data_type]
array set attribute [::utility::normalattlist $sobj]
if {[info exists attribute(units)]} {
set units_att " -attr {units,$attribute(units)} "
} else {
set units_att " "
}
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1} $units_att"
} else {
return " -type $dtype $units_att"
}
}
proc ::nexus::singlecounter::save {counter nxalias data_type args} {
todo_msg "Save counter: $counter"
@@ -1185,9 +1257,6 @@ proc ::nexus::script::save {script nxalias data_type args} {
} else {
nxscript putslab $nxalias [list 0] [list $size] $darray
}
if {[info exists attribute(units)]} {
nxscript putattribute $nxalias units $attribute(units)
}
}
} message ] {
if {$::errorCode=="NONE"} {return $message}
@@ -1195,18 +1264,24 @@ proc ::nexus::script::save {script nxalias data_type args} {
}
}
proc ::nexus::script::sdsinfo {script data_type args} {
proc ::nexus::script::sdsinfo {sobj data_type args} {
if [ catch {
array set param $args
set dtype [::nexus::hdb2nx_type $data_type]
if {[getatt $script klass] == "sensor"} {
array set attribute [::utility::normalattlist $sobj]
if {[info exists attribute(units)]} {
set units_att " -attr {units,$attribute(units)} "
} else {
set units_att " "
}
if {[getatt $sobj klass] == "sensor"} {
if {$param(mutable) == true} {
return " -type $dtype -rank 1 -dim {-1}"
return " -type $dtype -rank 1 -dim {-1} $units_att"
} else {
return " -type $dtype"
return " -type $dtype $units_att"
}
} else {
set darray [$script -arrayname]
set darray [$sobj -arrayname]
set size [SplitReply [$darray used]]
if {$param(mutable) == true} {
return " -type $dtype -rank 2 -dim {-1,$size}"
@@ -1237,7 +1312,7 @@ foreach expt $::nexus::exports {
set tmpstr [string map {"$" ""} {$Name: not supported by cvs2svn $}]
set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
set tmpstr [string map {"$" ""} {$Revision: 1.46 $}]
set tmpstr [string map {"$" ""} {$Revision: 1.47 $}]
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
#namespace eval data {