# --------------------------------------------------------------------------
# Initialization script for a simulated TOPSI instrument
#
#
# Dr. Mark Koennecke February, 1996
#---------------------------------------------------------------------------
#                        O P T I O N S

# --------------- Initialize Tcl internals --------------------------------
set auto_path "/data/koenneck/src/sics/tcl"
source $auto_path/topsicom.tcl

# 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  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 ServerLogBaseName  /data/koenneck/src/sics/server
# the path and base name of the internal server logfile to which all
# activity will be logged.

ServerOption ServerPort 2910 
# 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 2913
# The UDP port where the server will wait for Interrupts from clients.
# Obviously, clients wishing to interrupt need to know this number.

ServerOption DefaultTclDirectory /data/koenneck/src/sics/tcl
ServerOption DefaultCommandFile  topsicom.tcl

#---------------------------------------------------------------------------
#                        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       3

#--------------------------------------------------------------------------
#               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  "TOPSI" #initialisation
VarMake sample Text User
sample "DanielOxid"
VarMake Temperature Float User
Temperature 21.5

VarMake Title Text User
Title "TopsiTupsiTapsi"
VarMake User  Text User
User  "Daniel_the_Clementine"

#--------------------------------------------------------------------------
#                D E V I C E S :  M O T O R S

# Motor a4 EL734 LNSP22 4000 5 6
# EL734 motor with parameters: hostname PortNumber Channel MotorID
Motor A1 EL734 lnsp22.psi.ch 4000 2 1   # Monochromator 2Theta
Motor A2 EL734 lnsp22.psi.ch 4000 2 5   # Monochromator 2Theta
Motor A3 EL734 lnsp22.psi.ch 4000 2 6   # Sample Omega
Motor A4 SIM -130. 130. 1. 2.  # Sample 2Theta
Motor A5 SIM -30. 30.   1. 3.  # ? horiz. Translation
Motor A6 SIM -30. 30.   1. 3.  # ? vert Translation
Motor MTL SIM -30. 30. 1. 3.   # mono lower translation
Motor MTU SIM -30. 30. 1. 3.   # mono upper translation
#Motor STL EL734 lnsp22.psi.ch 4000 5 10   # sample lower translation
Motor  STL SIM -30. 30. 1. 3.
Motor STU SIM -30. 30. 1. 3.   # sample upper translation
Motor MGU SIM -50. 50. 1. 3.   # mono upper goniometer
Motor SGL SIM -20. 20. 1. 3.   # sample lower goniometer
Motor SGU SIM -20. 20. 1. 3.   # sample  upper goniometer
Motor SDM SIM -5 5.    1. 3.   # weird Motor

Motor D1R SIM -20. 20. 1. 3. # Diaphragm 1 right 
Motor D1L SIM -20. 20. 1. 3. # Diaphragm 1 left 
Motor D1T SIM -20. 20. 1. 3. # Diaphragm 1 top & Bottom 

Motor D2R SIM -20. 20. 1. 3. # Diaphragm 2 right 
Motor D2L SIM -20. 20. 1. 3. # Diaphragm 2 left 
Motor D2T SIM -20. 20. 1. 3. # Diaphragm 2 top & Bottom 

Motor D3R SIM -20. 20. 1. 3. # Diaphragm 2 right 
Motor D3L SIM -20. 20. 1. 3. # Diaphragm 2 left 
Motor D3T SIM -20. 20. 1. 3. # Diaphragm 2 top & Bottom 
#--------------------------------------------------------------------------
#                      C O U N T E R S
#MakeCounter counter EL737 lnsp22.psi.ch 4000 4
MakeCounter  counter SIM
#--------------------------------------------------------------------------
#         M U L T I D E V I C E  V A R I A B L E S 
MakeMono mono "Ge-111" A1 A2
MakeWaveLength lambda mono
MakeO2T  O2T A3 A4
#--------------------------------------------------------------------------
#     C O N F I G U R E     D E V I C E S     T O    H A L T  I N
#                        I N T E R R U P T 
AddHalt A1 A2 A3 A4 A5 A6 MTL MTU STL STU MGU SGL SGU SDM D1R D1L D1T \
        D2R D2L D2T D3R D3L D3T

#--------------------------------------------------------------------------
#             P R O C E D U R E S

MakeDrive
Publish scan User
Publish ScanCounts Spy
Publish TextStatus Spy
Publish otUnknown User
MakeRuenBuffer
