conman.c
Reduce log noise by setting iout = eInternal for macros. servlog.c Fixed timestamp in logfiles to get hours. hmm_configuration_common_1.tcl Added ML's mods to wombat config: ie BAT and FAT TABLE attributes and elements for multi-period acquisition and histo-streaming. Fixed "failed lsearch" bug. It's more robust to test for a non-successful lsearch instead of a failed lsearch. nxscripts_common_1.tcl SICS-297 Fixed Saving data series in a scratch file overwrites earlier entries. instdict_specification.tcl Added "scobj" kind and "sct_indexed_motor" sics object type for script context controllers and and objects. hipadaba_configuration_common.tcl Added sct_indexed_motor sics obj type to ::hdb::sobjadd and scobj kind to ::hdb::add_node sct_positmotor_common.tcl Update the index SICS variable when updating the current index value to make sure that the position is saved in the data file. You must now provide the hdb node_name when creating the sct posit motor. mk_sct_positmotor now sets the "param" and "long_name" attributes on the posit motor object util/utility.tcl Added ::utility::set_sct_indexed_motor_attributes to set SICS object attributes required for generating hdb info for an SCT_POSIT_MOTOR nxscript.c Merge the ansto mod to putslab (rev1.7) which adds support for saving unbuffered data from the histmem. sicshipadaba.c This incorporates the patch made to CommandSetCallback in rev1.10 so it can just be copied as is (ie no merge required). WARNING: There are changes to ListHdbNode to handle record separators which may affect us. Disabled sending hdb command start and stop messages because they break gumtree sicshdbfactory.c Disabled sending hdb command start and stop messages because they break gumtree hipadaba_configuration_common.tcl R2.4DEV The sct_posit_motor case of ::hdb::sobjadd is only needed to call add_node with kind=scobj. nxscripts_common_1.tcl R2.4DEV Added ::nexus::scobj::sdsinfo _gen_nxdict now skips nodes with data_type == "none" new util/script_context_util.tcl R2.4DEV Adds ::scobj::hinitprops command to initialise the hdb properties for script context object nodes. sct_positmotor_common.tcl R2.4DEV Use ::scobj::hinitprops utility command to initialise hdb properties on script context object parameter nodes. dynstring.c DynStringReplace should memcopy '\0', otherwise it can get the wrong length for iTextLen. Added DynStringReplaceWithLen to allow initialising a dynstring with char arrays which contain null chars and other non-ascii chars. Useful for read and write buffers in script context. ascon.c AsconRead return NULL for noResponse and AsconFailed otherwise the "result" node gets set with a spurious empty value. scriptcontext.c SctActionHandler only set the "result" node if there really is a reply. sicsobj.c Update from M.K. site_ansto.c Added galil and ordela hvps protocol handlers for scriptcontext. motor_dmc2280.c Allow home parameter to be outside of limits (for KOWARI) hardsup/makefile Added ordela HVPS protocol handler hardsup/sct_orhvpsprot.c New ordela HVPS protocol handler. Retries on NAKs and re-orders pot channels (ie toggles lower two bits). hardsup/sct_velselprot.c Start velocity selector protocol handler. hardsup/sct_galilprot.c Completed galil protocol handler. hipadaba_configuration_common.tcl Add new style SICS objects to hdb tree. instdict_specification.tcl Added scobj to kind list and sct_motor to sics object list. (and some housekeeping) hmm_configuration_common_1.tcl Added ratemaps to simulation. Fixe BAT_TABLE and added PERIOD_INDICES as per Mark Lesha's mods for multi-period acquisition. ratemaps now return float. sct_postimotor_common.tcl Now setting properties on the posit motor object so that it can be automatically added to the hdb tree. hrpd/config/motors/motor_configuration.tcl Fixed simulated msd motor so that it's handle properly in the hdb layer. sans/config/hmm/detector_ordela.tcl Updated the ordela calibration script to use the new sct_orhvpsprop.c script context controller. quokka_configuration.tcl Deleted lines which set the hdb properties for script context posit motors. This is now handled automatically as for other SICS objects. utility.tcl setpos now replaces the motor setpos subcommand. Added functions to set script context object attributes and sct_posit motor attributes. Created hparPath and hsibPath convenience commands for new-style SICS objects. script_context_util.tcl NEW! Adds hinitprops function to initialise the hdb properties for a script context object r2758 | ffr | 2008-12-12 17:53:53 +1100 (Fri, 12 Dec 2008) | 113 lines
This commit is contained in:
committed by
Douglas Clowes
parent
121aac2946
commit
e36e9f1146
@@ -340,9 +340,9 @@ proc ::hdb::add_subtree {hpath subtree {object @none} {type @none} {makenode @no
|
||||
switch $makenode {
|
||||
"@none" {
|
||||
foreach {n v} $subtree {
|
||||
if {[lsearch -exact $::nexus_classes $n] != -1} {
|
||||
if {[lsearch -exact $::nexus_classes $n] >= 0} {
|
||||
add_subtree $hpath $v $object $n NXclass
|
||||
} elseif {[lsearch -exact $SICStypes $n] != -1} {
|
||||
} elseif {[lsearch -exact $SICStypes $n] >= 0} {
|
||||
add_subtree $hpath $v $object $n sicsobject
|
||||
} elseif {$n=="link"} {
|
||||
add_subtree $hpath $v $object $n link
|
||||
@@ -541,6 +541,10 @@ proc ::hdb::add_node {basePath args} {
|
||||
hsetprop $node_path/$child klass [getatt $node_name klass]
|
||||
}
|
||||
}
|
||||
scobj {
|
||||
set node_path ${basePath}/$node_name
|
||||
hfactory $node_path link $node_name
|
||||
}
|
||||
script - getset {
|
||||
# A r/w pair of scripts, node = a node path
|
||||
set node_path $basePath/[normalgetatt $node_name long_name]
|
||||
@@ -706,7 +710,7 @@ proc ::hdb::sobjadd {hpath sobj args} {
|
||||
set hpath [add_hpath $hpath $sobjatt(group)]
|
||||
if {[catch {hsetprop $hpath type part} err]} {clientput $err error}
|
||||
}
|
||||
if {[lsearch [hlist $hpath] $sobjatt(long_name)] != -1} {
|
||||
if {[lsearch [hlist $hpath] $sobjatt(long_name)] >= 0} {
|
||||
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
|
||||
} elseif {$sobjatt(kind) == "hdb_subtree"} {
|
||||
add_subtree $hpath [$sobj]
|
||||
@@ -785,6 +789,11 @@ proc ::hdb::sobjadd {hpath sobj args} {
|
||||
# TODO
|
||||
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
||||
}
|
||||
# TODO Can this be replaced with a sct_* glob?
|
||||
sct_posit_motor {
|
||||
set sobjName [normalgetatt $sobj long_name]
|
||||
add_node $hpath node $sobjName long_name $sobjName kind scobj
|
||||
}
|
||||
environment_controller {
|
||||
todo_msg "$sobjatt(type) case, add $sobj to $hpath"
|
||||
}
|
||||
@@ -848,7 +857,7 @@ proc ::hdb::prune {instdict} {
|
||||
foreach name $candidates {
|
||||
array unset dictval
|
||||
array set dictval $dictarr($name)
|
||||
if {[lsearch $dictval(property) nxvgroup] != -1} {
|
||||
if {[lsearch $dictval(property) nxvgroup] >= 0} {
|
||||
# Link targets are not candidates for pruning
|
||||
continue
|
||||
}
|
||||
@@ -862,7 +871,7 @@ proc ::hdb::prune {instdict} {
|
||||
if {[llength [array get dictarr $name/*]] == 0} {
|
||||
array unset dictarr $name
|
||||
} else {
|
||||
if {[lsearch $candidates $name/*] != -1} {
|
||||
if {[lsearch $candidates $name/*] >= 0} {
|
||||
lappend new_candidates $name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,14 @@ set boolean {true false}
|
||||
|
||||
# SICS OBJECTS MUST PROVIDE THE FOLLOWING INFORMATION
|
||||
set sobj_klass_list {@none aperture attenuator collimator command crystal data detector disk_chopper entry environment experiment graphics instrument slits monitor monochromator parameter derived_parameter plc sample scan sensor source user}
|
||||
set sobj_sicstype_list {chopperadapter environment_controller sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject}
|
||||
set sobj_sicstype_list {chopperadapter environment_controller sicsvariable macro motor configurablevirtualmotor singlecounter histmem nxscript sicsdata scanobject sct_posit_motor}
|
||||
# Different kinds of things are added to the hdb in different ways.
|
||||
# command: This is something a client can run with hset /a/b/c start, it may have parameters and feedback.
|
||||
# Parameters and feedback should be made available in 'ilists' named after the command.
|
||||
# script: Supplies an rscript and a wscript to attach to a node for hgets and hsets.
|
||||
# hobj: Something that can be hattached to a node. {motor sicsvariable histmem}.
|
||||
# hdb_subtree: Is a macro which returns a keyed list that describes a hdb subtree.
|
||||
set sobj_kind_list {command hobj script getset hdb_subtree}
|
||||
set sobj_kind_list {command hobj script getset hdb_subtree scobj}
|
||||
set sobj_interfacelist [subst {drivable {$boolean} countable {$boolean} callback {$boolean} environment {$boolean} }]
|
||||
|
||||
set privilege_list {spy user manager readonly internal}
|
||||
@@ -43,6 +43,29 @@ set sobj_attlist [subst {
|
||||
}]
|
||||
|
||||
# OBJECT SPECIFIC ATTRIBUTES
|
||||
set chopperadapter_attlist [subst {
|
||||
$sobj_attlist
|
||||
savecmd {print}
|
||||
sdsinfo {print}
|
||||
nxalias {text}
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set environment_controller_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set histmem_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
# A macro can be attached to an hdb node as a command or a script
|
||||
set macro_attlist [subst {
|
||||
$sobj_attlist
|
||||
}]
|
||||
|
||||
set motor_attlist [subst {
|
||||
$sobj_attlist
|
||||
units alpha
|
||||
@@ -55,36 +78,15 @@ set configurablevirtualmotor_attlist [subst {
|
||||
$motor_attlist
|
||||
}]
|
||||
|
||||
set singlecounter_attlist [subst {
|
||||
set nxscript_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set histmem_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set scanobject_attlist [subst {
|
||||
$sobj_attlist
|
||||
}]
|
||||
|
||||
set sicsvariable_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set environment_controller_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
# A macro can be attached to an hdb node as a command or a script
|
||||
set macro_attlist [subst {
|
||||
$sobj_attlist
|
||||
}]
|
||||
|
||||
set nxscript_attlist [subst {
|
||||
set sct_posit_motor_attlist [subst {
|
||||
$sobj_attlist
|
||||
}]
|
||||
|
||||
@@ -93,11 +95,13 @@ set sicsdata_attlist [subst {
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set chopperadapter_attlist [subst {
|
||||
set sicsvariable_attlist [subst {
|
||||
$sobj_attlist
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
|
||||
set singlecounter_attlist [subst {
|
||||
$sobj_attlist
|
||||
savecmd {print}
|
||||
sdsinfo {print}
|
||||
nxalias {text}
|
||||
mutable [subst {{$boolean}}]
|
||||
}]
|
||||
# INSTRUMENT DICTIONARIES MUST PROVIDE THE FOLLOWING INFORMATION
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.43 $
|
||||
# $Date: 2008-11-06 23:13:50 $
|
||||
# $Revision: 1.44 $
|
||||
# $Date: 2008-12-12 06:53:49 $
|
||||
# Author: Ferdi Franceschini
|
||||
# Based on the examples in the hs_test.tcl sample configuration by Mark Lesha.
|
||||
# http://gumtree.ansto.gov.au:9080/nbicms/bragg-systems/histogram-server/hs_test.tcl/view
|
||||
@@ -52,6 +52,8 @@ namespace eval histogram_memory {
|
||||
hmm configure statuscheck false
|
||||
hmm configure num_events_filled_to_histo 12345
|
||||
hmm configure acq_dataset_active_sec 9.8
|
||||
hmm configure ratemap_xy_max_bin 123
|
||||
hmm configure ratemap_xy_total 321
|
||||
foreach bm $::counter::isc_beam_monitor_list {
|
||||
set bm_num [string index $bm end]
|
||||
if [string is integer $bm_num] {
|
||||
@@ -674,7 +676,7 @@ proc HISTMEM_TABLE {tpath args} {
|
||||
"-setel" {
|
||||
set element [lindex $arglist 0]
|
||||
set value [lindex $arglist 1]
|
||||
if {[lsearch [::utility::tabget hmm_xml $tpath/_ALLOWED_ELEMENTS_] $element] != -1} {
|
||||
if {[lsearch [::utility::tabget hmm_xml $tpath/_ALLOWED_ELEMENTS_] $element] >= 0} {
|
||||
::utility::tabset hmm_xml $tpath/$element/_CONTENT_ $value
|
||||
} else {
|
||||
error "ERROR: $element is not an allowed element in $tpath"
|
||||
@@ -683,7 +685,7 @@ proc HISTMEM_TABLE {tpath args} {
|
||||
"-setatt" {
|
||||
set attname [lindex $arglist 0]
|
||||
set value [lindex $arglist 1]
|
||||
if {[lsearch [::utility::tabget hmm_xml $tpath/_ALLOWED_ATTRIBUTES_] $attname] != -1} {
|
||||
if {[lsearch [::utility::tabget hmm_xml $tpath/_ALLOWED_ATTRIBUTES_] $attname] >= 0} {
|
||||
::utility::tabset hmm_xml $tpath/_ATTLIST_/$attname $value
|
||||
} else {
|
||||
error "ERROR: $attname is not an allowed attribute in $tpath"
|
||||
@@ -751,8 +753,8 @@ proc HISTMEM_TABLE {tpath args} {
|
||||
#
|
||||
proc BAT_TABLE {args} {
|
||||
if [ catch {
|
||||
set attributes { FRAME_FREQUENCY SIZE_PERIOD COUNT_METHOD COUNT_SIZE READ_DATA_TYPE }
|
||||
set elements {{ }}
|
||||
set attributes { NO_BAT_ENTRIES NO_BAT_PERIODS NO_REPEAT_ENTRY NO_REPEAT_TABLE NO_EXECUTE_TABLE }
|
||||
set elements {{ PERIOD_INDICES }}
|
||||
|
||||
set tag BAT
|
||||
foreach {opt arglist} [::utility::get_opt_arglist $args] {}
|
||||
@@ -806,11 +808,11 @@ proc BAT_TABLE {args} {
|
||||
"-del" {
|
||||
foreach att [lindex $attributes 0] el [lindex $elements 0] {
|
||||
set index [lsearch -exact $arglist $el]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delel $el
|
||||
}
|
||||
set index [lsearch -exact $arglist $att]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delatt $att
|
||||
}
|
||||
}
|
||||
@@ -894,11 +896,11 @@ proc CAT_TABLE {args} {
|
||||
"-del" {
|
||||
foreach att [lindex $attributes 0] el [lindex $elements 0] {
|
||||
set index [lsearch -exact $arglist $el]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delel $el
|
||||
}
|
||||
set index [lsearch -exact $arglist $att]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delatt $att
|
||||
}
|
||||
}
|
||||
@@ -927,7 +929,7 @@ proc CAT_TABLE {args} {
|
||||
#
|
||||
proc FAT_TABLE {args} {
|
||||
if [ catch {
|
||||
set attributes { FRAME_FREQUENCY SIZE_PERIOD COUNT_METHOD COUNT_SIZE READ_DATA_TYPE VIEW_MAG_X VIEW_MAG_Y}
|
||||
set attributes { FRAME_FREQUENCY SIZE_PERIOD NOS_PERIODS COUNT_METHOD COUNT_SIZE READ_DATA_TYPE VIEW_MAG_X VIEW_MAG_Y HISTO_STREAMING }
|
||||
set elements {{ }}
|
||||
|
||||
set tag FAT
|
||||
@@ -982,11 +984,11 @@ proc FAT_TABLE {args} {
|
||||
"-del" {
|
||||
foreach att [lindex $attributes 0] el [lindex $elements 0] {
|
||||
set index [lsearch -exact $arglist $el]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delel $el
|
||||
}
|
||||
set index [lsearch -exact $arglist $att]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delatt $att
|
||||
}
|
||||
}
|
||||
@@ -1112,11 +1114,11 @@ proc OAT_TABLE {args} {
|
||||
"-del" {
|
||||
foreach att [array names attlookup] el [lindex $elements 0] {
|
||||
set index [lsearch -exact $arglist $el]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delel $el
|
||||
}
|
||||
set index [lsearch -exact $arglist $att]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $tag -delatt $attlookup($att)
|
||||
}
|
||||
}
|
||||
@@ -1201,7 +1203,7 @@ proc SAT_TABLE {args} {
|
||||
"-del" {
|
||||
foreach att $attributes {
|
||||
set index [lsearch -exact $arglist $att]
|
||||
if {$index != -1} {
|
||||
if {$index >= 0} {
|
||||
HISTMEM_TABLE $attpath -delatt $att
|
||||
}
|
||||
}
|
||||
@@ -1576,14 +1578,14 @@ sicslist setatt ::histogram_memory::time long_name time
|
||||
sicslist setatt ::histogram_memory::time mutable true
|
||||
sicslist setatt ::histogram_memory::time units seconds
|
||||
|
||||
::utility::macro::getset int ::histogram_memory::ratemap_xy_max_bin {} {
|
||||
::utility::macro::getset float ::histogram_memory::ratemap_xy_max_bin {} {
|
||||
return "ratemap_xy_max_bin = [lindex [hmm configure ratemap_xy_max_bin] 2]"
|
||||
}
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin klass detector
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin long_name max_binrate
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin mutable true
|
||||
|
||||
::utility::macro::getset int ::histogram_memory::ratemap_xy_total {} {
|
||||
::utility::macro::getset float ::histogram_memory::ratemap_xy_total {} {
|
||||
return "ratemap_xy_total = [lindex [hmm configure ratemap_xy_total] 2]"
|
||||
}
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_total klass detector
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace eval ::sobj::positmotor {
|
||||
namespace eval ::scobj::positmotor {
|
||||
variable posit_table
|
||||
variable posit_indices
|
||||
# TODO Add a script to edit the posit_table and attach it to indexed nodes with read and write actions.
|
||||
@@ -155,7 +155,7 @@ namespace eval ::sobj::positmotor {
|
||||
set posit_table($motor,$posindex) $val
|
||||
}
|
||||
|
||||
proc mk_sct_positmotor {sct_controller motor param table_ID posit_list} {
|
||||
proc mk_sct_positmotor {sct_controller motor parnode param table_ID posit_list} {
|
||||
variable posit_table
|
||||
variable posit_indices
|
||||
|
||||
@@ -171,14 +171,13 @@ namespace eval ::sobj::positmotor {
|
||||
|
||||
|
||||
if [ catch {
|
||||
set ns ::sobj::positmotor
|
||||
set parnode ${motor}_motor
|
||||
MakeSICSObj $parnode SCT_MOTOR
|
||||
set ns ::scobj::positmotor
|
||||
# set parnode ${motor}_motor
|
||||
MakeSICSObj $parnode SCT_POSIT_MOTOR
|
||||
# Make setable position parameter and poll it.
|
||||
VarMake $param float user
|
||||
hattach /sics/${parnode} $param $param
|
||||
# hattach /sics/${parnode} $param $param
|
||||
set posindex_node /sics/${parnode}/${param}
|
||||
# hfactory $posindex_node plain spy float
|
||||
hfactory $posindex_node plain user float
|
||||
hsetprop $posindex_node read ${ns}::rd_index $param $motor
|
||||
hsetprop $posindex_node state_reading_index ${ns}::state_reading_index $posindex_node $param $motor
|
||||
hsetprop $posindex_node write ${ns}::w_index $sct_controller $posindex_node $param $motor
|
||||
@@ -213,6 +212,10 @@ namespace eval ::sobj::positmotor {
|
||||
$sct_controller poll $posindex_node
|
||||
$sct_controller write $posindex_node
|
||||
|
||||
sicslist setatt $parnode long_name $parnode
|
||||
|
||||
hinitprops $parnode
|
||||
hinitprops $parnode $param
|
||||
} message ] {
|
||||
return -code error $message
|
||||
}
|
||||
@@ -220,7 +223,7 @@ namespace eval ::sobj::positmotor {
|
||||
|
||||
namespace export mk_sct_positmotor
|
||||
}
|
||||
namespace import ::sobj::positmotor::*
|
||||
namespace import ::scobj::positmotor::*
|
||||
##
|
||||
# Eg
|
||||
# hfactory /controllers plain spy none
|
||||
|
||||
@@ -298,8 +298,10 @@ proc ::nexus::newfile_collection {args} {
|
||||
set state(file,namestyle) $param(-savetype)
|
||||
file_set_list "UNKNOWN"
|
||||
if {$param(-savetype) == "scratch"} {
|
||||
set state(file,isNewScratchFile) true
|
||||
set state(file,incr_datnum) false
|
||||
} else {
|
||||
set state(file,isNewScratchFile) false
|
||||
set state(file,incr_datnum) true
|
||||
}
|
||||
set idNum [expr 1 + [SplitReply [sicsdatanumber]]]
|
||||
@@ -445,12 +447,7 @@ proc ::nexus::save {{point 0}} {
|
||||
} else {
|
||||
set isNewFile false
|
||||
}
|
||||
if [string match -nocase "*scratch*" $currFilename($data_label)] {
|
||||
set isScratchFile true
|
||||
} else {
|
||||
set isScratchFile false
|
||||
}
|
||||
if {$isNewFile || $isScratchFile} {
|
||||
if {$isNewFile || $state(file,isNewScratchFile)} {
|
||||
::nexus::createfile $currFilename($data_label)
|
||||
dataFileName $currFilename($data_label)
|
||||
estart [lindex [sicstime] 1]
|
||||
@@ -464,6 +461,7 @@ proc ::nexus::save {{point 0}} {
|
||||
::nexus::makelinks
|
||||
::nexus::set_plotdata_info
|
||||
::nexus::nxclosefile $currFilename($data_label)
|
||||
set state(file,isNewScratchFile) false
|
||||
} else {
|
||||
eend [lindex [sicstime] 1]
|
||||
# timestamp [expr {[clock seconds] - $start_seconds_array($data_label)}]
|
||||
@@ -728,8 +726,12 @@ proc ::nexus::save {{point 0}} {
|
||||
} else {
|
||||
$p_arr(savecmd) $p_arr(sicsdev) $p_arr(nxalias) $data_type
|
||||
}
|
||||
} elseif {[info exists p_arr(savecmd)] || [info exists p_arr(nxalias)]} {
|
||||
error_msg "/$hpath/$child must have both 'savecmd' and 'nxalias' properties\nThe actual property list for /$hpath/$child is [array get p_arr]"
|
||||
} elseif {[info exists p_arr(nxalias)]} {
|
||||
if {[info exists p_arr(mutable)] && $p_arr(mutable) == "true" } {
|
||||
nxscript puthdb /$hpath/$child point $pt
|
||||
} else {
|
||||
nxscript puthdb /$hpath/$child
|
||||
}
|
||||
}
|
||||
::nexus::savetree $hpath/$child $pt
|
||||
}
|
||||
@@ -774,6 +776,9 @@ proc ::nexus::save {{point 0}} {
|
||||
}
|
||||
array set p_arr [::utility::hlistplainprop /$hpath]
|
||||
set data_type [lindex [split [hinfo /$hpath] , ] 0]
|
||||
if {$data_type == "none"} {
|
||||
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)]} {
|
||||
@@ -1007,7 +1012,7 @@ proc ::nexus::macro::getset_save {sobj nxalias data_type args} {
|
||||
}
|
||||
} message ] {
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error $message
|
||||
return -code error "::nexus::macro::getset_save, $message"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1061,7 +1066,8 @@ namespace eval ::nexus {
|
||||
}
|
||||
|
||||
proc ::nexus::sicsvariable::save {svar nxalias data_type args} {
|
||||
array set attribute [attlist $svar]
|
||||
if [ catch {
|
||||
array set attribute [attlist $svar]
|
||||
set val [SplitReply [$svar]]
|
||||
if {[lindex $args 0] == "point"} {
|
||||
set index [lindex $args 1]
|
||||
@@ -1080,8 +1086,12 @@ 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)
|
||||
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,6 +1106,17 @@ proc ::nexus::sicsvariable::sdsinfo {svar data_type args} {
|
||||
}
|
||||
}
|
||||
|
||||
namespace eval ::nexus::scobj {}
|
||||
proc ::nexus::scobj::sdsinfo {svar 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"
|
||||
}
|
||||
}
|
||||
|
||||
namespace eval ::nexus::chopperadapter { }
|
||||
proc ::nexus::chopperadapter::save {sobj nxalias data_type args} {
|
||||
array set attribute [attlist $sobj]
|
||||
@@ -1216,7 +1237,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.45 $}]
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.46 $}]
|
||||
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
|
||||
#namespace eval data {
|
||||
@@ -1239,3 +1260,4 @@ set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
#}
|
||||
|
||||
::nexus::init
|
||||
publish ::nexus::data user
|
||||
|
||||
@@ -14,3 +14,4 @@ config/scan/scan_common_1.tcl
|
||||
config/nexus/nxscripts_common_1.tcl
|
||||
config/commands/commands_common.tcl
|
||||
config/motors/sct_positmotor_common.tcl
|
||||
config/motors/sct_jogmotor_common.tcl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.32 $
|
||||
# $Date: 2008-10-20 00:08:30 $
|
||||
# $Revision: 1.33 $
|
||||
# $Date: 2008-12-12 06:53:51 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
@@ -685,12 +685,17 @@ ss2d long_name bottom
|
||||
|
||||
# Virtual and Simulated Motors
|
||||
# ----------------------------
|
||||
|
||||
Motor msd ASIM [params\
|
||||
units mm\
|
||||
hardlowerlim 2500\
|
||||
hardupperlim 3500\
|
||||
]
|
||||
asyncqueue mc4\
|
||||
axis I\
|
||||
units mm\
|
||||
stepsPerX $slitStepRate\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
hardlowerlim 2500\
|
||||
hardupperlim 3500\
|
||||
]
|
||||
msd part sample
|
||||
msd long_name mono_sample_mm
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# Ordela 21000N detector calibration
|
||||
|
||||
proc ord_get_pot { potxy potnumber } {
|
||||
# NOTE: Contains reordering of lower 2 bits. Remove when device driver is fixed!!! (?)
|
||||
for { set rsp "Bad" } { $rsp == "Bad" } { } {
|
||||
set potname [ format "%s%d" $potxy [ expr $potnumber ^ 3 ] ]
|
||||
set rspall [ dhv1 cmd P $potname ]
|
||||
set potname [ format "%s%d" $potxy $potnumber ]
|
||||
set rspall [ sct_dhv1 transact "P $potname" ]
|
||||
set rsp [lindex [split $rspall " "] 1]
|
||||
}
|
||||
return $rsp
|
||||
@@ -12,9 +11,8 @@ proc ord_get_pot { potxy potnumber } {
|
||||
Publish ord_get_pot User
|
||||
|
||||
proc ord_set_pot { potxy potnumber potvalue } {
|
||||
# NOTE: Contains reordering of lower 2 bits. Remove when device driver is fixed!!! (?)
|
||||
set potname [ format "%s%d" $potxy [ expr $potnumber ^ 3 ] ]
|
||||
set rsp [ dhv1 cmd p $potname $potvalue ]
|
||||
set potname [ format "%s%d" $potxy $potnumber ]
|
||||
set rsp [ sct_dhv1 transact "p $potname $potvalue" ]
|
||||
return $rsp
|
||||
}
|
||||
Publish ord_set_pot User
|
||||
|
||||
@@ -33,7 +33,7 @@ set 20sample_table {
|
||||
20 -464.3
|
||||
}
|
||||
|
||||
mk_sct_positmotor sct_mc1 samx samplenum 20SAMPLES $20sample_table
|
||||
mk_sct_positmotor sct_mc1 samx changer_position samplenum 20SAMPLES $20sample_table
|
||||
|
||||
set auto_ap_table {
|
||||
2.5 0
|
||||
@@ -47,24 +47,5 @@ set auto_ap_table {
|
||||
25.0 215
|
||||
30.0 250
|
||||
}
|
||||
mk_sct_positmotor sct_mc3 apx aperture auto_ap $auto_ap_table
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mk_sct_positmotor sct_mc3 apx autoSampleAp aperture auto_ap $auto_ap_table
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.18 $
|
||||
# $Date: 2008-11-03 23:23:25 $
|
||||
# $Revision: 1.19 $
|
||||
# $Date: 2008-12-12 06:53:52 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by: $Author: ffr $
|
||||
|
||||
@@ -55,38 +55,3 @@ server_init
|
||||
hsetprop /instrument/parameters/derived_parameters/$pname/feedback/status data false
|
||||
hsetprop /instrument/parameters/derived_parameters/$pname/feedback/status nxsave false
|
||||
}
|
||||
hsetprop /sct_mc1 control false
|
||||
hsetprop /sct_mc1 data false
|
||||
hsetprop /sct_mc2 control false
|
||||
hsetprop /sct_mc2 data false
|
||||
hsetprop /sct_mc3 control false
|
||||
hsetprop /sct_mc3 data false
|
||||
hsetprop /sct_mc4 control false
|
||||
hsetprop /sct_mc4 data false
|
||||
|
||||
hfactory /instrument/parameters/changer_position link samx_motor
|
||||
hsetprop /instrument/parameters/changer_position data true
|
||||
set param samplenum
|
||||
hsetprop /instrument/parameters/changer_position/${param} savecmd ::nexus::sicsvariable::save
|
||||
hsetprop /instrument/parameters/changer_position/${param} sdsinfo ::nexus::sicsvariable::sdsinfo
|
||||
hsetprop /instrument/parameters/changer_position/${param} control true
|
||||
hsetprop /instrument/parameters/changer_position/${param} data true
|
||||
hsetprop /instrument/parameters/changer_position/${param} nxsave true
|
||||
hsetprop /instrument/parameters/changer_position/${param} mutable true
|
||||
hsetprop /instrument/parameters/changer_position/${param} sicsdev $param
|
||||
hsetprop /instrument/parameters/changer_position/${param} nxalias $param
|
||||
hsetprop /instrument/parameters/changer_position/${param} klass parameter
|
||||
|
||||
hfactory /instrument/parameters/autoSampleAp link apx_motor
|
||||
hsetprop /instrument/parameters/autoSampleAp data true
|
||||
set param aperture
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} savecmd ::nexus::sicsvariable::save
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} sdsinfo ::nexus::sicsvariable::sdsinfo
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} control true
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} data true
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} nxsave true
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} mutable true
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} sicsdev $param
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} nxalias $param
|
||||
hsetprop /instrument/parameters/autoSampleAp/${param} klass parameter
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SICS common configuration
|
||||
|
||||
# $Revision: 1.45 $
|
||||
# $Date: 2008-10-27 04:55:40 $
|
||||
# $Revision: 1.46 $
|
||||
# $Date: 2008-12-12 06:53:47 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
# RELEASE_NUMBER: $Name: not supported by cvs2svn $
|
||||
@@ -34,6 +34,8 @@ plc_simulation false
|
||||
VarMake sics_fullsimulation Text internal
|
||||
|
||||
source util/utility.tcl
|
||||
source util/script_context_util.tcl
|
||||
|
||||
proc syncbackup {file} {
|
||||
backup motorSave
|
||||
backup $file
|
||||
@@ -139,7 +141,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
sics_release lock
|
||||
|
||||
::utility::mkVar sics_revision_num Text internal
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.45 $}]
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.46 $}]
|
||||
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
sics_revision_num lock
|
||||
|
||||
@@ -216,6 +218,8 @@ proc server_set_sobj_attributes {} {
|
||||
::nexus::set_sobj_attributes
|
||||
::histogram_memory::set_sobj_attributes
|
||||
::utility::set_chopper_attributes
|
||||
::utility::set_sctobj_attributes
|
||||
::utility::set_sct_posit_motor_attributes
|
||||
## TODO move the following to the new ansto gumxml.tcl
|
||||
sicslist setatt getgumtreexml privilege internal
|
||||
clientput "serverport [get_portnum $::serverport]"
|
||||
@@ -250,6 +254,7 @@ proc server_init {} {
|
||||
sicslist setatt sics_suid long_name sics_suid
|
||||
|
||||
server_set_sobj_attributes
|
||||
|
||||
} message ] {
|
||||
clientput $errorContext
|
||||
clientput $callStack
|
||||
|
||||
@@ -103,7 +103,7 @@ proc setdiff {A B} {
|
||||
proc _intersection {lista listb} {
|
||||
set result {}
|
||||
foreach elem [join $listb] {
|
||||
if { [lsearch -exact $lista $elem] != -1 } {
|
||||
if { [lsearch -exact $lista $elem] >= 0} {
|
||||
lappend result $elem
|
||||
}
|
||||
}
|
||||
|
||||
20
site_ansto/instrument/util/script_context_util.tcl
Normal file
20
site_ansto/instrument/util/script_context_util.tcl
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace eval ::scobj { }
|
||||
##
|
||||
# @brief Initialise the hdb properties required for generating the GumTree interface and
|
||||
# saving data for script context objects
|
||||
proc ::scobj::hinitprops {sobj args} {
|
||||
if {$args == ""} {
|
||||
set hpath /sics/$sobj
|
||||
hsetprop $hpath nxalias $sobj
|
||||
} else {
|
||||
set hpath /sics/$sobj/$args
|
||||
hsetprop $hpath nxalias ${sobj}_$args
|
||||
}
|
||||
hsetprop $hpath control true
|
||||
hsetprop $hpath data true
|
||||
hsetprop $hpath nxsave true
|
||||
hsetprop $hpath mutable true
|
||||
hsetprop $hpath klass parameter
|
||||
hsetprop $hpath sicsdev $sobj
|
||||
hsetprop $hpath sdsinfo ::nexus::scobj::sdsinfo
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
# Some useful functions for SICS configuration.
|
||||
|
||||
# $Revision: 1.19 $
|
||||
# $Date: 2008-10-13 04:40:06 $
|
||||
# $Revision: 1.20 $
|
||||
# $Date: 2008-12-12 06:53:53 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
@@ -366,10 +366,16 @@ proc SplitReply { text } {
|
||||
}
|
||||
|
||||
# Sets motor position reading to pos by adjusting the softzero
|
||||
proc setpos {motor pos} {
|
||||
set currPos [SplitReply [$motor]]
|
||||
proc setpos {motor pos args} {
|
||||
if {$args == ""} {
|
||||
set currPos [SplitReply [$motor]]
|
||||
set newPos $pos
|
||||
} else {
|
||||
set currPos $pos
|
||||
set newPos [lindex $args 0]
|
||||
}
|
||||
set oldZero [SplitReply [$motor softzero]]
|
||||
set newZero [expr $currPos - $pos + $oldZero]
|
||||
set newZero [expr $currPos - $newPos + $oldZero]
|
||||
uplevel #0 "$motor softzero $newZero"
|
||||
}
|
||||
|
||||
@@ -429,6 +435,22 @@ proc ::utility::set_histomem_attributes {} {
|
||||
sicslist setatt $hm mutable true
|
||||
}
|
||||
}
|
||||
proc ::utility::set_sctobj_attributes {} {
|
||||
foreach sobj [sicslist type SctController] {
|
||||
hsetprop /$sobj control false
|
||||
hsetprop /$sobj data false
|
||||
}
|
||||
}
|
||||
proc ::utility::set_sct_posit_motor_attributes {} {
|
||||
foreach sobj [sicslist type SCT_POSIT_MOTOR] {
|
||||
sicslist setatt $sobj klass parameter
|
||||
sicslist setatt $sobj data true
|
||||
sicslist setatt $sobj control true
|
||||
sicslist setatt $sobj nxsave true
|
||||
sicslist setatt $sobj mutable true
|
||||
sicslist setatt $sobj privilege user
|
||||
}
|
||||
}
|
||||
proc ::utility::set_motor_attributes {} {
|
||||
# Bug: SICS-57 on Jira
|
||||
# The first entry in [sicslist type motor] is 'motor' when
|
||||
@@ -822,7 +844,7 @@ proc ::utility::macro::getset {type name arglist body} {
|
||||
$body
|
||||
}]
|
||||
|
||||
publish $name user
|
||||
publish $name spy
|
||||
if {$arglist == ""} {
|
||||
sicslist setatt $name access read_only
|
||||
} else {
|
||||
@@ -840,6 +862,14 @@ proc ::utility::macro::getset {type name arglist body} {
|
||||
sicslist setatt $name savecmd ::nexus::macro::getset_save
|
||||
sicslist setatt $name sdsinfo ::nexus::macro::getset_sdsinfo
|
||||
}
|
||||
proc hparPath {} {
|
||||
set hpath [sct]
|
||||
return [file dirname $hpath]
|
||||
}
|
||||
proc hsibPath {sibling} {
|
||||
set hpath [sct]
|
||||
return [file dirname $hpath]/$sibling
|
||||
}
|
||||
namespace import ::utility::*;
|
||||
Publish getinfo spy
|
||||
Publish setpos user
|
||||
|
||||
Reference in New Issue
Block a user