- TDC histogram memory driver sort of working
- New class for scripting datafiles - SANS-II almost complete initialization file
This commit is contained in:
599
sans2.tcl
Normal file
599
sans2.tcl
Normal file
@@ -0,0 +1,599 @@
|
||||
# --------------------------------------------------------------------------
|
||||
# Initialization script for the instrument SANSII at SINQ
|
||||
#
|
||||
# Dr. Mark Koennecke, January - ???? 2003
|
||||
#---------------------------------------------------------------------------
|
||||
# O P T I O N S
|
||||
set root "/afs/psi.ch/user/k/koennecke/src/sics"
|
||||
# first all the server options are set
|
||||
|
||||
ServerOption SaveFile $root/tmp/sans2stat.tcl
|
||||
# File to save the status of the instrument too
|
||||
|
||||
ServerOption ReadTimeOut 10
|
||||
# timeout when checking for commands. In the main loop SICS checks for
|
||||
# pending commands on each connection with the above timeout, has
|
||||
# PERFORMANCE impact!
|
||||
|
||||
ServerOption AcceptTimeOut 10
|
||||
# timeout when checking for connection req.
|
||||
# Similar to above, but for connections
|
||||
|
||||
ServerOption ReadUserPasswdTimeout 500000
|
||||
# time to wiat for a user/passwd to be sent from a client. Increase this
|
||||
# if there is a problem connecting to a server due to network overload\
|
||||
|
||||
ServerOption LogFileBaseName $root/tmp/sans2log
|
||||
# the path and base name of the internal server logfile to which all
|
||||
# activity will be logged.
|
||||
|
||||
ServerOption ServerPort 2915
|
||||
# the port number the server is going to listen at. The client MUST know
|
||||
# this number in order to connect. It is in client.ini
|
||||
|
||||
ServerOption InterruptPort 2917
|
||||
# The UDP port where the server will wait for Interrupts from clients.
|
||||
# Obviously, clients wishing to interrupt need to know this number.
|
||||
# Telnet Options
|
||||
ServerOption TelnetPort 1301
|
||||
ServerOption TelWord sicslogin
|
||||
|
||||
# The token system
|
||||
TokenInit connan
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# U S E R S
|
||||
|
||||
# than the SICS users are specified
|
||||
# Syntax: SicsUser name password userRightsCode
|
||||
SicsUser Manager Joachim 1
|
||||
SicsUser User Kohl 2
|
||||
SicsUser Spy 007 1
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# S I M P L E V A R I A B L E S
|
||||
|
||||
# now a few general variables are created
|
||||
# Syntax: VarMake name type access
|
||||
# type can be one of: Text, Int, Float
|
||||
#access can be one of: Internal, Mugger, user, Spy
|
||||
|
||||
VarMake Instrument Text Internal
|
||||
Instrument "SANS-II at SINQ,PSI"
|
||||
#initialisation
|
||||
Instrument lock
|
||||
|
||||
VarMake title Text User
|
||||
VarMake User Text User
|
||||
VarMake SubTitle Text User
|
||||
VarMake environment Text User
|
||||
VarMake comment Text User
|
||||
VarMake samplename Text User
|
||||
VarMake email Text User
|
||||
VarMake fax Text User
|
||||
VarMake phone Text User
|
||||
VarMake adress Text User
|
||||
VarMake sample Text User
|
||||
VarMake BatchRoot Text User
|
||||
VarMake starttime Text User
|
||||
BatchRoot $root
|
||||
|
||||
VarMake sampletable Text User
|
||||
|
||||
#----------- Initialize data storage stuff
|
||||
VarMake SicsDataPath Text Mugger
|
||||
SicsDataPath $root/tmp/
|
||||
SicsDataPath lock
|
||||
VarMake SicsDataPrefix Text Mugger
|
||||
SicsDataPrefix sansII
|
||||
SicsDataPrefix lock
|
||||
VarMake SicsDataPostFix Text Mugger
|
||||
SicsDataPostFix ".hdf"
|
||||
SicsDataPostFix lock
|
||||
MakeDataNumber SicsDataNumber $root/tmp/DataNumber
|
||||
|
||||
#=========================================================================
|
||||
# Initialize ECB system
|
||||
#========================================================================
|
||||
|
||||
#--------- GPIB Controller with National Instruments driver
|
||||
MakeGPIB gpib ni
|
||||
|
||||
#-------- MakeECB name gpib-controller board-number gpib-address
|
||||
MakeECB ecb1 gpib 0 5
|
||||
|
||||
#--------- Function to switch ecb to automatic control
|
||||
proc ecbauto {} {
|
||||
ecb1 func 162 1 0 0 0
|
||||
}
|
||||
Publish ecbauto User
|
||||
|
||||
ecbauto
|
||||
|
||||
#-------------- ECB Motors
|
||||
# Motor name ecb ecb-controller ecb-motor-index hardlowerlimit hardupperlimit
|
||||
|
||||
Motor sr ecb ecb1 1 -10000. 10000.
|
||||
sr encoder 0
|
||||
sr control 0
|
||||
sr range 1
|
||||
sr multi 0
|
||||
sr multchan 0
|
||||
sr acceleration 1000
|
||||
sr rotation_dir -1
|
||||
sr startspeed 330
|
||||
sr maxspeed 1000
|
||||
sr auto 330
|
||||
sr manuell 50
|
||||
sr delay 50
|
||||
sr offset 0
|
||||
sr dtolerance .01
|
||||
sr step2deg 1
|
||||
sr step2dig 0
|
||||
sr backlash .15
|
||||
|
||||
Motor stx ecb ecb1 2 -16000. 16000.
|
||||
stx encoder 0
|
||||
stx control 0
|
||||
stx range 1
|
||||
stx multi 0
|
||||
stx multchan 0
|
||||
stx acceleration 500
|
||||
stx rotation_dir -1
|
||||
stx startspeed 330
|
||||
stx maxspeed 1000
|
||||
stx auto 500
|
||||
stx manuell 50
|
||||
stx delay 50
|
||||
stx offset 0
|
||||
stx dtolerance .01
|
||||
stx step2deg 1
|
||||
stx step2dig 0
|
||||
stx backlash .15
|
||||
|
||||
Motor stz ecb ecb1 3 6500. 20000.
|
||||
stz encoder 0
|
||||
stz control 0
|
||||
stz range 1
|
||||
stz multi 0
|
||||
stz multchan 0
|
||||
stz acceleration 500
|
||||
stz rotation_dir -1
|
||||
stz startspeed 330
|
||||
stz maxspeed 1000
|
||||
stz auto 500
|
||||
stz manuell 50
|
||||
stz delay 50
|
||||
stz offset 0
|
||||
stz dtolerance .01
|
||||
stz step2deg 1
|
||||
stz step2dig 0
|
||||
stz backlash .15
|
||||
|
||||
Motor sc ecb ecb1 4 -2000. 70000.
|
||||
sc encoder 0
|
||||
sc control 0
|
||||
sc range 1
|
||||
sc multi 0
|
||||
sc multchan 0
|
||||
sc acceleration 500
|
||||
sc rotation_dir -1
|
||||
sc startspeed 330
|
||||
sc maxspeed 1000
|
||||
sc auto 500
|
||||
sc manuell 50
|
||||
sc delay 50
|
||||
sc offset 0
|
||||
sc dtolerance .01
|
||||
sc step2deg 1
|
||||
sc step2dig 0
|
||||
sc backlash .15
|
||||
|
||||
Motor gu ecb ecb1 5 -10000. 10000.
|
||||
gu encoder 0
|
||||
gu control 0
|
||||
gu range 1
|
||||
gu multi 0
|
||||
gu multchan 0
|
||||
gu acceleration 500
|
||||
gu rotation_dir -1
|
||||
gu startspeed 330
|
||||
gu maxspeed 1000
|
||||
gu auto 500
|
||||
gu manuell 40
|
||||
gu delay 50
|
||||
gu offset 0
|
||||
gu dtolerance .02
|
||||
gu step2deg 1
|
||||
gu step2dig 0
|
||||
gu backlash .15
|
||||
|
||||
Motor gl ecb ecb1 6 -10000. 10000.
|
||||
gl encoder 0
|
||||
gl control 0
|
||||
gl range 1
|
||||
gl multi 0
|
||||
gl multchan 0
|
||||
gl acceleration 500
|
||||
gl rotation_dir -1
|
||||
gl startspeed 330
|
||||
gl maxspeed 1000
|
||||
gl auto 500
|
||||
gl manuell 40
|
||||
gl delay 50
|
||||
gl offset 0
|
||||
gl dtolerance .02
|
||||
gl step2deg 1
|
||||
gl step2dig 0
|
||||
gl backlash .15
|
||||
|
||||
|
||||
Motor tu ecb ecb1 7 -10000. 10000.
|
||||
tu encoder 0
|
||||
tu control 0
|
||||
tu range 1
|
||||
tu multi 0
|
||||
tu multchan 0
|
||||
tu acceleration 500
|
||||
tu rotation_dir 1
|
||||
tu startspeed 330
|
||||
tu maxspeed 1000
|
||||
tu auto 330
|
||||
tu manuell 40
|
||||
tu delay 50
|
||||
tu offset 0
|
||||
tu dtolerance .01
|
||||
tu step2deg 1
|
||||
tu step2dig 0
|
||||
tu backlash .15
|
||||
|
||||
|
||||
Motor tl ecb ecb1 8 -10000. 10000.
|
||||
tl encoder 0
|
||||
tl control 0
|
||||
tl range 1
|
||||
tl multi 0
|
||||
tl multchan 0
|
||||
tl acceleration 500
|
||||
tl rotation_dir 1
|
||||
tl startspeed 330
|
||||
tl maxspeed 1000
|
||||
tl auto 330
|
||||
tl manuell 40
|
||||
tl delay 50
|
||||
tl offset 0
|
||||
tl dtolerance .01
|
||||
tl step2deg 1
|
||||
tl step2dig 0
|
||||
tl backlash .15
|
||||
|
||||
Motor om ecb ecb1 9 -10000. 10000.
|
||||
om encoder 1
|
||||
om control 1
|
||||
om range 1
|
||||
om multi 0
|
||||
om multchan 0
|
||||
om acceleration 500
|
||||
om rotation_dir 1
|
||||
om startspeed 330
|
||||
om maxspeed 1000
|
||||
om auto 100
|
||||
om manuell 40
|
||||
om delay 50
|
||||
om offset 0
|
||||
om dtolerance .01
|
||||
om step2deg 1
|
||||
om step2dig 10
|
||||
om backlash .15
|
||||
|
||||
Motor sz ecb ecb1 10 -10000. 10000.
|
||||
sz encoder 0
|
||||
sz control 0
|
||||
sz range 1
|
||||
sz multi 0
|
||||
sz multchan 0
|
||||
sz acceleration 500
|
||||
sz rotation_dir 1
|
||||
sz startspeed 330
|
||||
sz maxspeed 1000
|
||||
sz auto 500
|
||||
sz manuell 40
|
||||
sz delay 50
|
||||
sz offset 0
|
||||
sz dtolerance .001
|
||||
sz step2deg 1
|
||||
sz step2dig 0
|
||||
sz backlash .15
|
||||
|
||||
Motor sx ecb ecb1 11 -10000. 10000.
|
||||
sx encoder 0
|
||||
sx control 0
|
||||
sx range 1
|
||||
sx multi 0
|
||||
sx multchan 0
|
||||
sx acceleration 500
|
||||
sx rotation_dir 1
|
||||
sx startspeed 330
|
||||
sx maxspeed 1000
|
||||
sx auto 500
|
||||
sx manuell 40
|
||||
sx delay 50
|
||||
sx offset 0
|
||||
sx dtolerance .01
|
||||
sx step2deg 1
|
||||
sx step2dig 0
|
||||
sx backlash .15
|
||||
|
||||
Motor sy ecb ecb1 12 -10000. 10000.
|
||||
sy encoder 0
|
||||
sy control 0
|
||||
sy range 1
|
||||
sy multi 0
|
||||
sy multchan 0
|
||||
sy acceleration 500
|
||||
sy rotation_dir 1
|
||||
sy startspeed 330
|
||||
sy maxspeed 1000
|
||||
sy auto 500
|
||||
sy manuell 50
|
||||
sy delay 50
|
||||
sy offset 0
|
||||
sy dtolerance .001
|
||||
sy step2deg 1
|
||||
sy step2dig 0
|
||||
sy backlash .15
|
||||
|
||||
Motor dz ecb ecb1 13 1.05 6.0
|
||||
dz encoder 0
|
||||
dz control 0
|
||||
dz range 1
|
||||
dz multi 0
|
||||
dz multchan 0
|
||||
dz acceleration 2000
|
||||
dz rotation_dir -1
|
||||
dz startspeed 330
|
||||
dz maxspeed 1000
|
||||
dz auto 500
|
||||
dz manuell 40
|
||||
dz delay 1000
|
||||
dz offset 0
|
||||
dz dtolerance .001
|
||||
dz step2deg 53076
|
||||
dz step2dig 0
|
||||
dz backlash .15
|
||||
|
||||
Motor dh ecb ecb1 14 -14000. 16000.
|
||||
dh encoder 0
|
||||
dh control 0
|
||||
dh range 1
|
||||
dh multi 0
|
||||
dh multchan 0
|
||||
dh acceleration 1000
|
||||
dh rotation_dir -1
|
||||
dh startspeed 330
|
||||
dh maxspeed 1000
|
||||
dh auto 500
|
||||
dh manuell 40
|
||||
dh delay 50
|
||||
dh offset 0
|
||||
dh dtolerance .001
|
||||
dh step2deg 1
|
||||
dh step2dig 0
|
||||
dh backlash .15
|
||||
|
||||
Motor dv ecb ecb1 15 -14000. 25000.
|
||||
dv encoder 0
|
||||
dv control 0
|
||||
dv range 1
|
||||
dv multi 0
|
||||
dv multchan 0
|
||||
dv acceleration 2000
|
||||
dv rotation_dir -1
|
||||
dv startspeed 330
|
||||
dv maxspeed 1000
|
||||
dv auto 500
|
||||
dv manuell 40
|
||||
dv delay 50
|
||||
dv offset 0
|
||||
dv dtolerance .001
|
||||
dv step2deg 1
|
||||
dv step2dig 0
|
||||
dv backlash .15
|
||||
|
||||
Motor az1 ecb ecb1 16 -3900. 0.
|
||||
az1 encoder 0
|
||||
az1 control 0
|
||||
az1 range 1
|
||||
az1 multi 0
|
||||
az1 multchan 0
|
||||
az1 acceleration 1000
|
||||
az1 rotation_dir -1
|
||||
az1 startspeed 330
|
||||
az1 maxspeed 1000
|
||||
az1 auto 330
|
||||
az1 manuell 40
|
||||
az1 delay 50
|
||||
az1 offset 0
|
||||
az1 dtolerance .001
|
||||
az1 step2deg 1
|
||||
az1 step2dig 0
|
||||
az1 backlash .15
|
||||
|
||||
Motor atz ecb ecb1 17 -3900. 0.
|
||||
atz encoder 0
|
||||
atz control 0
|
||||
atz range 1
|
||||
atz multi 0
|
||||
atz multchan 0
|
||||
atz acceleration 1000
|
||||
atz rotation_dir -1
|
||||
atz startspeed 330
|
||||
atz maxspeed 1000
|
||||
atz auto 330
|
||||
atz manuell 40
|
||||
atz delay 50
|
||||
atz offset 0
|
||||
atz dtolerance .001
|
||||
atz step2deg 1
|
||||
atz step2dig 0
|
||||
atz backlash .15
|
||||
|
||||
#===========================================================================
|
||||
# The ECB system has the drawback that only one out of 8 motors in a rack
|
||||
# can run at any given time. Access to such motors has to be serialized.
|
||||
# This is done through the anticollision system originally developed for
|
||||
# TRICS. This system registers requests from motors to run and then calls
|
||||
# a script which serializes the running of motors. This system is used at
|
||||
# SANS to deal with the rack logic. This section installs the necessary
|
||||
# scripts and configures the system.
|
||||
#===========================================================================
|
||||
AntiCollisionInstall
|
||||
anticollision register sr
|
||||
anticollision register stx
|
||||
anticollision register stz
|
||||
anticollision register sc
|
||||
anticollision register gu
|
||||
anticollision register gl
|
||||
anticollision register tu
|
||||
anticollision register tl
|
||||
anticollision register om
|
||||
anticollision register sz
|
||||
anticollision register sx
|
||||
anticollision register sy
|
||||
anticollision register dz
|
||||
anticollision register dh
|
||||
anticollision register dv
|
||||
anticollision register az1
|
||||
anticollision register atz
|
||||
|
||||
#------------ assignment which motors belong into which rack
|
||||
set rack1 [list sr stx sty sc gu gl tu tl]
|
||||
set rack2 [list om sz sx dz dh dv az1 atz]
|
||||
set rack3 [list sy]
|
||||
|
||||
proc sans2rack args {
|
||||
global rack1 rack2 rack3
|
||||
set length [ expr [llength $args]/2.]
|
||||
#-------- make list which motors have to be run in each rack
|
||||
for { set i 0} { $i < $length} {incr i} {
|
||||
set mot [lindex $args [expr $i * 2]]
|
||||
set target [lindex $args [expr ($i *2) + 1]]
|
||||
if { [lsearch $rack1 $mot] >= 0} {
|
||||
lappend rack1mot $mot
|
||||
lappend rack1target $target
|
||||
}
|
||||
if { [lsearch $rack2 $mot] >= 0} {
|
||||
lappend rack2mot $mot
|
||||
lappend rack2target $target
|
||||
}
|
||||
if { [lsearch $rack3 $mot] >= 0} {
|
||||
lappend rack3mot $mot
|
||||
lappend rack3target $target
|
||||
}
|
||||
}
|
||||
#------- append a dummy to each in order to ensure existence
|
||||
lappend rack1mot dummy
|
||||
lappend rack1target 0.0
|
||||
lappend rack2mot dummy
|
||||
lappend rack2target 0.0
|
||||
lappend rack3mot dummy
|
||||
lappend rack3target 0.0
|
||||
#-------- how many levels do we have?
|
||||
set level -1
|
||||
if { [llength $rack1mot] > $level} {
|
||||
set level [llength $rack1mot]
|
||||
}
|
||||
if { [llength $rack2mot] > $level} {
|
||||
set level [llength $rack2mot]
|
||||
}
|
||||
if { [llength $rack3mot] > $level} {
|
||||
set level [llength $rack3mot]
|
||||
}
|
||||
if { $level <= 1} {
|
||||
error "Nothing to do"
|
||||
}
|
||||
#------------ we are set to serialize
|
||||
anticollision clear
|
||||
for {set i 0} {$i < $level} {incr i} {
|
||||
set tst [expr $i + 1]
|
||||
if { [llength $rack1mot] > $tst} {
|
||||
anticollision add $i [lindex $rack1mot $i] \
|
||||
[lindex $rack1target $i]
|
||||
}
|
||||
if { [llength $rack2mot] > $tst } {
|
||||
anticollision add $i [lindex $rack2mot $i] \
|
||||
[lindex $rack2target $i]
|
||||
}
|
||||
if { [llength $rack3mot] > $tst } {
|
||||
anticollision add $i [lindex $rack3mot $i] \
|
||||
[lindex $rack3target $i]
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
Publish sans2rack User #---------for testing purposes
|
||||
anticollision script sans2rack
|
||||
#====================== PSI Motoren ===================================
|
||||
Motor ome SIM -180. 180. .1 -.1
|
||||
Motor chi SIM -20. 20. .1 -.1
|
||||
#====================== Multi Motor Setup ==============================
|
||||
MakeMulti detector
|
||||
detector alias dz x
|
||||
detector endconfig
|
||||
SicsAlias detector dt
|
||||
|
||||
MakeMulti bs
|
||||
bs alias dh x
|
||||
bs alias dv y
|
||||
bs endconfig
|
||||
|
||||
MakeMulti chamber
|
||||
chamber alias sr omega
|
||||
chamber alias stx x
|
||||
chamber alias sty y
|
||||
chamber alias sc c
|
||||
chamber endconfig
|
||||
|
||||
MakeMulti gonio
|
||||
gonio alias gu chi
|
||||
gonio alias gl phi
|
||||
gonio alias tu xu
|
||||
gonio alias tl yu
|
||||
gonio endconfig
|
||||
|
||||
MakeMulti table
|
||||
table alias om om
|
||||
table alias sz z
|
||||
table alias sx x
|
||||
table alias sy y
|
||||
table endconfig
|
||||
#====================== HISTOGRAM MEMORY ================================
|
||||
MakeCounter counter ecb ecb1
|
||||
MakeECB tdc gpib 0 7
|
||||
MakeHM banana tdc
|
||||
banana configure dim0 128
|
||||
banana configure dim1 128
|
||||
banana configure rank 2
|
||||
banana configure Counter counter
|
||||
banana configure bank 0
|
||||
banana configure map 9
|
||||
banana configure range 0
|
||||
banana configure n 0
|
||||
banana configure ecb tdc
|
||||
banana configure fill 0
|
||||
banana configure mode HMXY
|
||||
banana init
|
||||
banana exponent 6
|
||||
banana CountMode timer
|
||||
banana preset 100
|
||||
#===================================== data file writing ================
|
||||
MakeNXScript
|
||||
#===================================== install commands ==================
|
||||
MakeDrive
|
||||
MakeRuenBuffer
|
||||
commandlog auto
|
||||
#=================================== load specific command file ===========
|
||||
source $root/sans2com.tcl
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user