- Extended the callback interface to register scipts on callbacks - Fixed a stop bug in the anticollision object - Modified the HM code to do zero through a client connection
359 lines
10 KiB
Tcl
359 lines
10 KiB
Tcl
# --------------------------------------------------------------------------
|
|
# Initialization script for a simulated AMOR instrument
|
|
#
|
|
#
|
|
# Dr. Mark Koennecke September,1999 - ??, ????
|
|
#---------------------------------------------------------------------------
|
|
|
|
#------------ our home
|
|
set home /data/koenneck/src/sics
|
|
|
|
#----------- first all the server options are set
|
|
|
|
ServerOption ReadTimeOut 100
|
|
# 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 100
|
|
# timeout when checking for connection req.
|
|
# Similar to above, but for connections
|
|
|
|
ServerOption ReadUserPasswdTimeout 7000
|
|
# 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 LogFileDir $home/tmp
|
|
#LogFileDir is the directory where the command log is going
|
|
|
|
ServerOption LogFileBaseName $home/tmp/server
|
|
# the path and base name of the internal server logfile to which all
|
|
# activity will be logged.
|
|
|
|
ServerOption statusfile $home/tmp/sicsstatus.tcl
|
|
|
|
ServerOption ServerPort 2911
|
|
# 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 2914
|
|
# 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
|
|
|
|
ServerOption DefaultTclDirectory $home/tcl
|
|
ServerOption DefaultCommandFile topsicom.tcl
|
|
|
|
#------ a port for broadcasting UDP messages
|
|
ServerOption QuieckPort 2108
|
|
|
|
#---------------------------------------------------------------------------
|
|
# U S E R S
|
|
|
|
# than the SICS users are specified
|
|
# Syntax: SicsUser name password userRightsCode
|
|
SicsUser Mugger Diethelm 1
|
|
SicsUser User Rosy 2
|
|
SicsUser Spy 007 1
|
|
|
|
#--------------------------------------------------------------------------
|
|
# G E N E R A L 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 AMOR
|
|
Instrument lock
|
|
|
|
|
|
|
|
VarMake Title Text User
|
|
VarMake sample Text User
|
|
sample "DanielSulfid"
|
|
Title "Amore mio in SINQ"
|
|
VarMake User Text User
|
|
User The reflective looser
|
|
|
|
VarMake lastscancommand Text User
|
|
|
|
VarMake Adress Text User
|
|
VarMake phone Text User
|
|
VarMake fax Text User
|
|
VarMake email Text User
|
|
VarMake sample_mur Float User
|
|
|
|
#--------------------------------------------------------------------------
|
|
# B u i l d i n g B l o c k s
|
|
#--------------------------------------------------------------------------
|
|
#
|
|
#=================== Chopper
|
|
VarMake chopperrotation Float User
|
|
chopperrotation 10000.
|
|
|
|
ClientPut "Starting motor initialization ....."
|
|
#=================== frame overlap mirror
|
|
VarMake fomname Text Mugger
|
|
fomname Super Duper Mirror
|
|
fomname lock
|
|
VarMake fomdist Float Mugger
|
|
fomdist 120
|
|
Motor FTZ SIM 0. 120. .1 2. # fom height
|
|
Motor FOM SIM -30. 30. .1 2. # fom omega
|
|
|
|
#================== first diaphragm
|
|
VarMake d1dist Float Mugger
|
|
d1dist 200.
|
|
Motor D1L SIM 0. 120. .1 2. # left
|
|
Motor D1R SIM 0. 120. .1 2. # right
|
|
Motor D1T SIM 0. 120. .1 2. # top
|
|
Motor D1B SIM 0. 1000. .1 2. # bottom
|
|
|
|
#================== polarizer
|
|
VarMake polname Text Mugger
|
|
polname Daniels Special Edition Polarizer
|
|
polname lock
|
|
VarMake poldist Float Mugger
|
|
fomdist 200
|
|
Motor MOZ SIM 0. 1000. .1 2. # pol table height
|
|
Motor MTY SIM -60. 60. .1 2. # pol y movement
|
|
Motor MOM SIM -30. 30. .1 2. # pol omega
|
|
Motor MTZ SIM -30. 30. .1 2. # pol omega height
|
|
|
|
#=================== diaphragm 2
|
|
VarMake d2dist Float Mugger
|
|
d2dist 200.
|
|
Motor D2L SIM 0. 120. .1 2. # left
|
|
Motor D2R SIM 0. 120. .1 2. # right
|
|
Motor D2T SIM 0. 120. .1 2. # top
|
|
Motor D2B SIM 0. 1000. .1 2. # bottom
|
|
|
|
#==================== diaphragm 3
|
|
VarMake d3dist Float Mugger
|
|
d3dist 200.
|
|
Motor D3L SIM 0. 120. .1 2. # left
|
|
Motor D3R SIM 0. 120. .1 2. # right
|
|
Motor D3T SIM 0. 120. .1 2. # top
|
|
Motor D3B SIM 0. 1000. .1 2. # bottom
|
|
|
|
#===================== sample table
|
|
VarMake sampledist Float Mugger
|
|
sampledist 200
|
|
Motor STZ SIM -50. 50. .1 2. # sample height
|
|
Motor SOM SIM -30. 30. .1 2. # sample omega
|
|
Motor SCH SIM -30. 30. .1 2. # sample chi
|
|
Motor SOZ SIM 0. 1000. .1 2. # table height
|
|
|
|
#====================== diaphragm 4
|
|
VarMake d4dist Float Mugger
|
|
d4dist 200.
|
|
Motor D4L SIM 0. 120. .1 2. # left
|
|
Motor D4R SIM 0. 120. .1 2. # right
|
|
Motor D4T SIM 0. 120. .1 2. # top
|
|
Motor D4B SIM 0. 1000. .1 2. # bottom
|
|
|
|
#======================= analyzer
|
|
VarMake ananame Text Mugger
|
|
ananame Daniels Special Edition Analyzer
|
|
ananame lock
|
|
VarMake anadist Float Mugger
|
|
anadist 200
|
|
Motor AOZ SIM 0. 1000. .1 2. # analyzer table height
|
|
Motor AOM SIM -30. 30. .1 2. # analyzer omega
|
|
Motor ATZ SIM -30. 30. .1 2. # analyzer omega height
|
|
|
|
#======================== diaphragm 5
|
|
VarMake d5dist Float Mugger
|
|
d5dist 200.
|
|
Motor D5L SIM 0. 120. .1 2. # left
|
|
Motor D5R SIM 0. 120. .1 2. # right
|
|
Motor D5T SIM 0. 120. .1 2. # top
|
|
Motor D5B SIM 0. 1000. .1 2. # bottom
|
|
|
|
#======================== counter
|
|
VarMake detectordist Float Mugger
|
|
detectordist 200.
|
|
MakeCounter counter SIM .0001
|
|
Motor COZ SIM 0. 1000. .1 2. # counter table height
|
|
Motor C3Z SIM 0. 300. .1 2. # counter height
|
|
Motor COM SIM -30. 30. .1 2. # counter omega
|
|
Motor COX SIM -100. 100. .1 2. # counter x
|
|
ClientPut "Motors initialized"
|
|
|
|
#======================== histogram memory
|
|
#MakeHM hm SinqHM
|
|
MakeHM hm SIM
|
|
hm configure OverFlowMode Ceil
|
|
hm configure HistMode PSD
|
|
hm configure Rank 2
|
|
hm configure dim0 128
|
|
hm configure dim1 256
|
|
hm configure xfac 10
|
|
hm configure yfac 10
|
|
hm configure xoff 64
|
|
hm configure yoff 128
|
|
hm configure BinWidth 4
|
|
hm preset 100.
|
|
hm CountMode Timer
|
|
hm configure HMComputer psds03.psi.ch
|
|
hm configure HMPort 2400
|
|
hm configure Counter counter
|
|
hm configure init 0
|
|
hm genbin 0. 33 5
|
|
hm init
|
|
|
|
ClientPut "Histogram Memory Initialized"
|
|
#--------------------------------------------------------------------------
|
|
# D a t a S t o r a g e
|
|
#------------------------------------------------------------------------
|
|
VarMake SicsDataPath Text Mugger
|
|
SicsDataPath $home/
|
|
SicsDataPath lock
|
|
VarMake SicsDataPrefix Text Mugger
|
|
SicsDataPrefix amortest
|
|
SicsDataPrefix lock
|
|
VarMake SicsDataPostFix Text Mugger
|
|
SicsDataPostFix ".hdf"
|
|
SicsDataPostFix lock
|
|
|
|
MakeDataNumber SicsDataNumber $home/danu.dat
|
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
# C o m m a n d I n i t i a l i z a t i o n
|
|
#-------------------------------------------------------------------------
|
|
#======== Drive
|
|
MakeDrive
|
|
#======== scan
|
|
source $home/object.tcl
|
|
source $home/tcl/scancom.tcl
|
|
MakeScanCommand xxxscan counter topsi.hdd recover.bin
|
|
xxxscan configure amor
|
|
#========== peak & center
|
|
MakePeakCenter xxxscan
|
|
source /data/koenneck/src/sics/countf.tcl
|
|
#========== serial port general purpose
|
|
SerialInit
|
|
Publish serialport User
|
|
Publish p1 User
|
|
#=========== the optimiser
|
|
MakeOptimise opti counter
|
|
|
|
#=========== Amor2T
|
|
set a2t(mom) mom
|
|
set a2t(som) som
|
|
set a2t(coz) coz
|
|
set a2t(cox) cox
|
|
set a2t(stz) stz
|
|
set a2t(soz) soz
|
|
set a2t(d4b) d4b
|
|
set a2t(d5b) d5b
|
|
set a2t(com) com
|
|
set a2t(aom) aom
|
|
set a2t(aoz) aoz
|
|
set a2t(c3z) c3z
|
|
MakeAmor2T a2t a2t aom2t
|
|
|
|
MakeStoreAmor hm a2t
|
|
|
|
#=========== Status Display Support
|
|
MakeAmorStatus amorstatus xxxscan hm
|
|
source amorpar.tcl
|
|
Publish amorpar Spy
|
|
ClientPut "Done Initializing"
|
|
|
|
|
|
scriptcallback connect xxxscan SCANSTART scanmode
|
|
scriptcallback connect hm COUNTSTART tofmode
|
|
sicsdatafactory new wwwdata
|
|
|
|
Publish getmode Spy
|
|
Publish wwwgetdata Spy
|
|
Publish wwwsics Spy
|
|
Publish wwwgetaxis Spy
|
|
|
|
#-----------------------------------------------------------------
|
|
set mode 0
|
|
proc tofmode {} {
|
|
global mode
|
|
set mode 1
|
|
}
|
|
#---------------------------------------------------------------------
|
|
proc scanmode {} {
|
|
global mode
|
|
set mode 0
|
|
}
|
|
#------------------------------------------------------------------
|
|
proc getmode {} {
|
|
global mode
|
|
return $mode
|
|
}
|
|
#--------------------------------------------------------------------
|
|
proc wwwgetdata {} {
|
|
global mode
|
|
if {$mode == 1} {
|
|
wwwtofdata
|
|
} else {
|
|
wwwscandata
|
|
}
|
|
wwwdata writeuu wwwdata
|
|
}
|
|
#---------------------------------------------------------------------
|
|
proc wwwscandata {} {
|
|
wwwdata clear
|
|
set np [string trim [SplitReply [xxxscan np]]]
|
|
wwwdata putint 0 $np
|
|
if {$np > 0} {
|
|
wwwdata copyscanvar 1 xxxscan 0
|
|
wwwdata copyscancounts [expr $np + 1] xxxscan
|
|
wwwdata copyscanmon [expr $np*2 + 1] xxxscan 2
|
|
}
|
|
}
|
|
#----------------------------------------------------------------------
|
|
proc wwwtofdata {} {
|
|
wwwdata clear
|
|
set ntime [string trim [SplitReply [hm notimebin]]]
|
|
set dim0 [string trim [SplitReply [hm configure dim0]]]
|
|
set dim1 [string trim [SplitReply [hm configure dim1]]]
|
|
wwwdata putint 0 $ntime
|
|
wwwdata copytimebin 1 hm
|
|
set start [expr $dim0*$dim1*$ntime]
|
|
set end [expr $start + 2*$ntime]
|
|
wwwdata copyhm [expr $ntime + 1] hm $start $end
|
|
}
|
|
#---------------------------------------------------------------------------
|
|
proc wwwsics {} {
|
|
global mode
|
|
append result "<table BORDER=2>\n"
|
|
append result "<tr><th>User</th> <td>" [SplitReply [user]] "</td></tr>\n"
|
|
append result "<tr><th>Title</th> <td>"
|
|
append result [SplitReply [title]] "</td></tr>\n"
|
|
append result "<tr><th>Status</th> <td>"
|
|
append result [SplitReply [status]] "</td></tr>\n"
|
|
append result "<tr><th>Mode</th><td>"
|
|
if {$mode == 1} {
|
|
append result "time-of-flight"
|
|
} else {
|
|
append result "scan mode"
|
|
}
|
|
append result "</td></tr>\n"
|
|
append result "</table>\n"
|
|
}
|
|
#-------------------------------------------------------------------------
|
|
proc wwwgetaxis {} {
|
|
global mode
|
|
if {$mode == 1} {
|
|
return time-of-flight
|
|
} else {
|
|
set res [scan info]
|
|
set l [split $res ,]
|
|
return [lindex $l 2]
|
|
}
|
|
}
|
|
|
|
|