- Various little fixes to the TAS software
- Added a sync command for synchronizing a simulation server with the master server.
This commit is contained in:
64
tascom.tcl
64
tascom.tcl
@@ -1,11 +1,11 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# In order to run a triple axis spectrometer, SICS has to be made to behave
|
||||
# like the ancinet MAD program from ILL. Some of the MAD commands had to
|
||||
# like the ancient MAD program from ILL. Some of the MAD commands had to
|
||||
# be implemented in C (see tas*.c) but others can be implemented in Tcl.
|
||||
# This file contains the procedures and command definitions for this syntax
|
||||
# adaption from SICS to MAD.
|
||||
#
|
||||
# Mark Koennecke, December 2000
|
||||
# Mark Koennecke, December 2000, March 2001
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -16,8 +16,11 @@ if { [info exists tasinit] == 0 } {
|
||||
set tasinit 1
|
||||
SicsAlias fileeval do User
|
||||
Publish ou User
|
||||
Publish out User
|
||||
Publish fi User
|
||||
SicsAlias fi fix User
|
||||
Publish cl User
|
||||
SicsAlias cl clear
|
||||
Publish co User
|
||||
Publish fm User
|
||||
Publish fz User
|
||||
@@ -33,7 +36,6 @@ if { [info exists tasinit] == 0 } {
|
||||
Publish log User
|
||||
Publish sz User
|
||||
Publish sw User
|
||||
Publish scaninfo Spy
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
@@ -41,7 +43,6 @@ if { [info exists tasinit] == 0 } {
|
||||
|
||||
set tasmot { a1 a2 a3 a4 a5 a6 mcv sro ach mtl mtu stl stu atu mgl sgl \
|
||||
sgu agl}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# some MAD variables can be directly mapped to internal SICS variables.
|
||||
# Some others require special functions to be called for them to be set.
|
||||
@@ -106,7 +107,10 @@ proc madZero args {
|
||||
#--------------------------------------------------------------------------
|
||||
# This routine throws an error if a bad value for fx is given
|
||||
|
||||
proc fxi {val} {
|
||||
proc fxi { {val -1000} } {
|
||||
if {$val == -1000} {
|
||||
return [format " fx = %d " [tasSplit [fx]] ]
|
||||
}
|
||||
if { $val != 1 && $val != 2} {
|
||||
error "ERROR: Invalid value $val for parameter FX"
|
||||
} else {
|
||||
@@ -115,11 +119,17 @@ proc fxi {val} {
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Changing the scattering sense implies a change of the corresponding
|
||||
# motors softzero as well: it is rotated by 180 degree. This is done
|
||||
# by this function
|
||||
# Changing the scattering sense has various consequences:
|
||||
# for SM it is rejected as this requires a major rebuild of the guide hall.
|
||||
# for SS only the parameter is changed.
|
||||
# for SA - the parameter is changed
|
||||
# - the A5 zero point is rotated by 180 degree
|
||||
# - the lower software limit is set to the new zero point
|
||||
|
||||
proc scatSense {par {val -1000} } {
|
||||
if { [tasSplit $par] == $val } {
|
||||
return
|
||||
}
|
||||
switch $par {
|
||||
ss {
|
||||
set mot a3
|
||||
@@ -141,18 +151,40 @@ proc scatSense {par {val -1000} } {
|
||||
if {$val != 1 && $val != -1 } {
|
||||
error "ERROR: invalid scattering sense $val"
|
||||
}
|
||||
set oldzero [tasSplit [madZero $mot]]
|
||||
madZero $mot [expr 180 + $oldzero]
|
||||
$par $val
|
||||
switch $par {
|
||||
sm {
|
||||
error \
|
||||
"REJECTED: Pay 100 mil. swiss francs for a redesign of SINQ first"
|
||||
}
|
||||
ss {
|
||||
$par $val
|
||||
clientput [format " SS = %d" $val]
|
||||
}
|
||||
sa {
|
||||
set oldzero [tasSplit [madZero $mot]]
|
||||
set newZero [expr $val*180 + $oldzero]
|
||||
madZero $mot $newZero
|
||||
a5 softlowerlim $newZero
|
||||
$par $val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# The output command
|
||||
|
||||
|
||||
proc out args {
|
||||
if {[llength $args] == 0 } {
|
||||
output ""
|
||||
} else {
|
||||
output [join $args]
|
||||
}
|
||||
}
|
||||
proc ou args {
|
||||
if {[llength $args] == 0 } {
|
||||
output ""
|
||||
}else {
|
||||
} else {
|
||||
output [join $args]
|
||||
}
|
||||
}
|
||||
@@ -395,7 +427,7 @@ proc varSet { command } {
|
||||
if { [info exists tasmap($token)] == 1} {
|
||||
set ret [catch {eval $tasmap($token) $value} msg]
|
||||
if { $ret != 0} {
|
||||
error [format "ERROR: error %s while setting %s" $msg $token]
|
||||
error [format "ERROR: > %s < while setting %s" $msg $token]
|
||||
} else {
|
||||
clientput [format " %s = %s" $token $value]
|
||||
}
|
||||
@@ -824,7 +856,7 @@ proc log args {
|
||||
|
||||
proc sz args {
|
||||
global tasmot
|
||||
set usage "\n Usage: \n\t sz motor newzero\n"
|
||||
set usage "\n Usage: \n\t sz motor newval \n"
|
||||
set line [string tolower [join $args]]
|
||||
set pos 0
|
||||
set mot [varToken $line $pos]
|
||||
@@ -851,7 +883,8 @@ proc sz args {
|
||||
"%-8sOld: %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" \
|
||||
$mot $loh $los $pos $targ $his $hih $zero]
|
||||
#-------action
|
||||
madZero $mot $val
|
||||
set newZero [expr $zero + ($val - $pos)]
|
||||
madZero $mot $newZero
|
||||
#-------- more output
|
||||
set zero [tasSplit [madZero $mot]]
|
||||
set loh [tasSplit [eval $mot hardlowerlim]]
|
||||
@@ -981,4 +1014,3 @@ proc sw args {
|
||||
clientput [prsw]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user