pelican
Create pas/config/source/source.tcl config/source/source_common.tcl pelican_configuration.tcl deploySICS.sh Don't deploy script validator configs, they are obsolete server_config.tcl Source config has been moved to config/source and is specialised for each instrument by calling the instrument specific initialiser ::source:isc_initalize commands_common_1.tcl The monitor mode and preset are recorded when running the count command counter_common_1.tcl Report and record the counts and time for the multicounter and each monitor. Also record the mode and preset for the multicounter. hmm_configuration_common_1.tcl Cleanup, remove obsolete code. Report and record the hmm total counts and time. Allow monitor controlled acquisition from the histogram server nxscripts_common_1.tcl Add DataType to NXdata section, preserve case in text attributes. scan_common_1.tcl Provide sensible feedback for our bmonscan and hmscan objects. Set run_mode when doing a scan. Allow users to select the datatype for histmem scans and to force a scan wombat_configuration.tcl echidna_configuration.tcl platypus_configuration.tcl kowari_configuration.tcl quokka_configuration.tcl Load source config. quokka_configuration.tcl SICS-198 HACK, Add AttrotDeg and RotApDeg status feedback. sans/commands/commands.tcl Add status feedback for quokka "guide" command. sans/parameters/parameters.tcl Make sure data can be saved as xml (replace % with _percent) SICS-198 HACK, add AttRotDeg and RotApDeg status feedback. utility.tcl Fix nasty "params array generator" bug. SICS commands execute at runlevel 0 which means that the params anonymous array must be made at this level. Provide the normalattlist command to enable creating attribute lists with the case preserved. Added the runsics, runtestsics and sicsclient scripts to CVS. Added source configurations for echidna, wombat, kowari, quokka, platypus, and pelican to CVS r2644 | ffr | 2008-07-11 11:09:57 +1000 (Fri, 11 Jul 2008) | 53 lines
This commit is contained in:
committed by
Douglas Clowes
parent
b4fb916018
commit
01be487c52
93
site_ansto/instrument/util/runsics
Executable file
93
site_ansto/instrument/util/runsics
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
# We should really have an init script calling this or something like it.
|
||||
INSTRUMENT=${HOSTNAME#ics1-}
|
||||
|
||||
# Start SICS
|
||||
startsics() {
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS is already running
|
||||
return 1
|
||||
fi
|
||||
echo Starting SICS
|
||||
cd /usr/local/sics/server
|
||||
nohup $PWD/SICServer ${INSTRUMENT}_configuration.tcl
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SUCCESS
|
||||
return 1
|
||||
else
|
||||
echo SICS failed to start
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Start script validator
|
||||
startscriptvalidator() {
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS script validator is already running
|
||||
return 1
|
||||
fi
|
||||
echo Starting SICS Script Validator
|
||||
cd /usr/local/sics/server/
|
||||
SICS_SIMULATION=script_validator nohup $PWD/SICServer ${INSTRUMENT}_configuration.tcl
|
||||
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SUCCESS
|
||||
return 1
|
||||
else
|
||||
echo SICS script validator failed to start
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
progname=`basename $0`
|
||||
echo Usage: $progname start
|
||||
echo "To start SICS and the Script validator"
|
||||
echo
|
||||
echo You can get status or stop SICS as follows,
|
||||
echo $progname status
|
||||
echo $progname stop
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $1 = "start" ]
|
||||
then
|
||||
startsics
|
||||
echo
|
||||
startscriptvalidator
|
||||
echo
|
||||
elif [ $1 = "stop" ]
|
||||
then
|
||||
if killall SICServer; then
|
||||
echo Terminating all SICS servers
|
||||
else
|
||||
echo No SICS servers are running
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo FAILED to stop SICServer
|
||||
else
|
||||
echo SICServer stopped
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo FAILED to stop SICS script validator
|
||||
else
|
||||
echo SICS script validator stopped
|
||||
fi
|
||||
elif [ $1 = "status" ]
|
||||
then
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICServer running
|
||||
else
|
||||
echo SICServer NOT running
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS script validator running
|
||||
else
|
||||
echo SICS script validator NOT running
|
||||
fi
|
||||
fi
|
||||
93
site_ansto/instrument/util/runtestsics
Executable file
93
site_ansto/instrument/util/runtestsics
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
# We should really have an init script calling this or something like it.
|
||||
INSTRUMENT=${HOSTNAME#ics1-}
|
||||
|
||||
# Start SICS
|
||||
startsics() {
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS is already running
|
||||
return 1
|
||||
fi
|
||||
echo Starting SICS
|
||||
cd /usr/local/TEST_SICS/${INSTRUMENT}/sics/server
|
||||
SICS_SIMULATION=full nohup $PWD/SICServer ${INSTRUMENT}_configuration.tcl
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SUCCESS
|
||||
return 1
|
||||
else
|
||||
echo SICS failed to start
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Start script validator
|
||||
startscriptvalidator() {
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS script validator is already running
|
||||
return 1
|
||||
fi
|
||||
echo Starting SICS Script Validator
|
||||
cd /usr/local/TEST_SICS/${INSTRUMENT}/sics/server
|
||||
SICS_SIMULATION=script_validator nohup $PWD/SICServer ${INSTRUMENT}_configuration.tcl
|
||||
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SUCCESS
|
||||
return 1
|
||||
else
|
||||
echo SICS script validator failed to start
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
progname=`basename $0`
|
||||
echo Usage: $progname start
|
||||
echo "To start SICS and the Script validator"
|
||||
echo
|
||||
echo You can get status or stop SICS as follows,
|
||||
echo $progname status
|
||||
echo $progname stop
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $1 = "start" ]
|
||||
then
|
||||
startsics
|
||||
echo
|
||||
startscriptvalidator
|
||||
echo
|
||||
elif [ $1 = "stop" ]
|
||||
then
|
||||
if killall SICServer; then
|
||||
echo Terminating all SICS servers
|
||||
else
|
||||
echo No SICS servers are running
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo FAILED to stop SICServer
|
||||
else
|
||||
echo SICServer stopped
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo FAILED to stop SICS script validator
|
||||
else
|
||||
echo SICS script validator stopped
|
||||
fi
|
||||
elif [ $1 = "status" ]
|
||||
then
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICServer running
|
||||
else
|
||||
echo SICServer NOT running
|
||||
fi
|
||||
if netstat -ltp 2> /dev/null|grep -q "server-val-${INSTRUMENT}.*SICServer"; then
|
||||
echo SICS script validator running
|
||||
else
|
||||
echo SICS script validator NOT running
|
||||
fi
|
||||
fi
|
||||
5
site_ansto/instrument/util/sicsclient
Executable file
5
site_ansto/instrument/util/sicsclient
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
INSTRUMENT=${HOSTNAME#ics1-}
|
||||
|
||||
socat READLINE,history=history tcp4:127.0.0.1:server-${INSTRUMENT},crlf
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Some useful functions for SICS configuration.
|
||||
|
||||
# $Revision: 1.13 $
|
||||
# $Date: 2008-06-23 02:41:12 $
|
||||
# $Revision: 1.14 $
|
||||
# $Date: 2008-07-11 01:09:57 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
@@ -215,110 +215,6 @@ proc ::environment::mkenvinfo {sobj paramlist} {
|
||||
}
|
||||
}
|
||||
|
||||
# Returns attribute name and value
|
||||
proc getatt {sicsobj att} {
|
||||
if [catch {
|
||||
lindex [split [tolower_sicslist $sicsobj $att] =] 1
|
||||
} reply ] {
|
||||
return -code error $reply
|
||||
} else {
|
||||
return $reply
|
||||
}
|
||||
}
|
||||
|
||||
proc normalgetatt {sicsobj att} {
|
||||
if [catch {
|
||||
lindex [split [sicslist $sicsobj $att] =] 1
|
||||
} reply ] {
|
||||
return -code error $reply
|
||||
} else {
|
||||
return $reply
|
||||
}
|
||||
}
|
||||
|
||||
# @brief Determine if a SICS object implements the drivable interface.
|
||||
#
|
||||
# @param sicsobj, Name of a SICS object
|
||||
# @return 1 if drivable, otherwise 0
|
||||
proc is_drivable {sicsobj} {
|
||||
if [catch {
|
||||
getatt $sicsobj drivable
|
||||
} reply] {
|
||||
return -code error $reply
|
||||
}
|
||||
if {$reply == "true"} {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# Utility fucntion for setting the home and upper and lower
|
||||
# limits for a motor
|
||||
proc setHomeandRange {args} {
|
||||
set usage "
|
||||
Usage: setHomeandRange -motor motName -home homeVal -lowrange low -uprange high
|
||||
eg
|
||||
setHomeandRange -motor mchi -home 90 -lowrange 5 -uprange 7
|
||||
this sets the home position to 90 degreess for motor mchi
|
||||
with the lower limit at 85 and the upper limit at 97
|
||||
"
|
||||
if {$args == ""} {clientput $usage; return}
|
||||
array set params $args
|
||||
set motor $params(-motor)
|
||||
set home $params(-home)
|
||||
set lowlim [expr $home - $params(-lowrange)]
|
||||
set uplim [expr $home + $params(-uprange)]
|
||||
|
||||
uplevel 1 "$motor softlowerlim $lowlim"
|
||||
uplevel 1 "$motor softupperlim $uplim"
|
||||
uplevel 1 "$motor home $home"
|
||||
}
|
||||
|
||||
# Use this to create an array of named parameters to initialise motors.
|
||||
proc params {args} {
|
||||
upvar 1 "" x;
|
||||
if [info exists x] {unset x}
|
||||
foreach {k v} $args {set x([string tolower $k]) $v}
|
||||
}
|
||||
|
||||
# Parse motor readings for virtual motor scripts.
|
||||
proc SplitReply { text } {
|
||||
set l [split $text =]
|
||||
return [string trim [lindex $l 1]]
|
||||
}
|
||||
|
||||
# Sets motor position reading to pos by adjusting the softzero
|
||||
proc setpos {motor pos} {
|
||||
set currPos [SplitReply [$motor]]
|
||||
set oldZero [SplitReply [$motor softzero]]
|
||||
set newZero [expr $currPos - $pos + $oldZero]
|
||||
uplevel #0 "$motor softzero $newZero"
|
||||
}
|
||||
|
||||
proc getinfo {object} {
|
||||
set wc [format "%s_*" $object];
|
||||
set objlist [sicslist match $wc];
|
||||
foreach v $objlist {
|
||||
if { [SplitReply [sicslist $v type]]== "SicsVariable"} {
|
||||
clientput [$v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Convenience function for setting klass group and name attributes
|
||||
# on sics object metadata
|
||||
proc set_sicsobj_atts {sobj aklass agroup aname acontrol adata} {
|
||||
sicslist setatt $sobj klass $aklass;
|
||||
if {$agroup != "@none"} {
|
||||
sicslist setatt $sobj group $agroup;
|
||||
}
|
||||
sicslist setatt $sobj long_name $aname;
|
||||
sicslist setatt $sobj control $acontrol;
|
||||
sicslist setatt $sobj data $adata;
|
||||
}
|
||||
|
||||
## TODO put all the utility macros in the utility namespace
|
||||
namespace eval utility {
|
||||
variable instrument_names [list echidna wombat kowari quokka platypus pelican taipan]
|
||||
@@ -404,6 +300,121 @@ proc mkData {sobj name aklass args} {
|
||||
return [info $option $args];
|
||||
}
|
||||
}
|
||||
# Returns attribute name and value
|
||||
proc getatt {sicsobj att} {
|
||||
if [catch {
|
||||
lindex [split [tolower_sicslist $sicsobj $att] =] 1
|
||||
} reply ] {
|
||||
return -code error $reply
|
||||
} else {
|
||||
return $reply
|
||||
}
|
||||
}
|
||||
|
||||
proc normalgetatt {sicsobj att} {
|
||||
if [catch {
|
||||
lindex [split [sicslist $sicsobj $att] =] 1
|
||||
} reply ] {
|
||||
return -code error $reply
|
||||
} else {
|
||||
return $reply
|
||||
}
|
||||
}
|
||||
|
||||
proc ::utility::normalattlist {sicsobj} {
|
||||
if [ catch {
|
||||
foreach att [sicslist $sicsobj] {
|
||||
lappend atts [split [string range $att 0 end-1] =]
|
||||
}
|
||||
return [join $atts]
|
||||
} message ] {
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error $message
|
||||
}
|
||||
}
|
||||
# @brief Determine if a SICS object implements the drivable interface.
|
||||
#
|
||||
# @param sicsobj, Name of a SICS object
|
||||
# @return 1 if drivable, otherwise 0
|
||||
proc is_drivable {sicsobj} {
|
||||
if [catch {
|
||||
getatt $sicsobj drivable
|
||||
} reply] {
|
||||
return -code error $reply
|
||||
}
|
||||
if {$reply == "true"} {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# Utility fucntion for setting the home and upper and lower
|
||||
# limits for a motor
|
||||
proc setHomeandRange {args} {
|
||||
set usage "
|
||||
Usage: setHomeandRange -motor motName -home homeVal -lowrange low -uprange high
|
||||
eg
|
||||
setHomeandRange -motor mchi -home 90 -lowrange 5 -uprange 7
|
||||
this sets the home position to 90 degreess for motor mchi
|
||||
with the lower limit at 85 and the upper limit at 97
|
||||
"
|
||||
if {$args == ""} {clientput $usage; return}
|
||||
array set params $args
|
||||
set motor $params(-motor)
|
||||
set home $params(-home)
|
||||
set lowlim [expr $home - $params(-lowrange)]
|
||||
set uplim [expr $home + $params(-uprange)]
|
||||
|
||||
uplevel 1 "$motor softlowerlim $lowlim"
|
||||
uplevel 1 "$motor softupperlim $uplim"
|
||||
uplevel 1 "$motor home $home"
|
||||
}
|
||||
|
||||
# Use this to create an array of named parameters to initialise motors.
|
||||
proc params {args} {
|
||||
upvar #0 "" x;
|
||||
if [info exists x] {unset x}
|
||||
foreach {k v} $args {set x([string tolower $k]) $v}
|
||||
}
|
||||
|
||||
# Parse motor readings for virtual motor scripts.
|
||||
proc SplitReply { text } {
|
||||
set l [split $text =]
|
||||
return [string trim [lindex $l 1]]
|
||||
}
|
||||
|
||||
# Sets motor position reading to pos by adjusting the softzero
|
||||
proc setpos {motor pos} {
|
||||
set currPos [SplitReply [$motor]]
|
||||
set oldZero [SplitReply [$motor softzero]]
|
||||
set newZero [expr $currPos - $pos + $oldZero]
|
||||
uplevel #0 "$motor softzero $newZero"
|
||||
}
|
||||
|
||||
proc getinfo {object} {
|
||||
set wc [format "%s_*" $object];
|
||||
set objlist [sicslist match $wc];
|
||||
foreach v $objlist {
|
||||
if { [SplitReply [sicslist $v type]]== "SicsVariable"} {
|
||||
clientput [$v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Convenience function for setting klass group and name attributes
|
||||
# on sics object metadata
|
||||
proc set_sicsobj_atts {sobj aklass agroup aname acontrol adata} {
|
||||
sicslist setatt $sobj klass $aklass;
|
||||
if {$agroup != "@none"} {
|
||||
sicslist setatt $sobj group $agroup;
|
||||
}
|
||||
sicslist setatt $sobj long_name $aname;
|
||||
sicslist setatt $sobj control $acontrol;
|
||||
sicslist setatt $sobj data $adata;
|
||||
}
|
||||
|
||||
|
||||
proc debug {args} {
|
||||
clientput $args
|
||||
|
||||
Reference in New Issue
Block a user