# --------------------------------------------------------------------------
# Initialization script for Triple Axis Instruments
#
# Dr. Mark Koennecke, November 2000
#---------------------------------------------------------------------------
#                        O P T I O N S
set root "/data/koenneck/src/sics"
# first all the server options are set

#ServerOption RedirectFile $root/log/stdtas

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/log/taslog
# the path and base name of the internal server logfile to which all
# activity will be logged.

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

ServerOption LogFileDir $root/simlog
#Where log files from commandlog are stored

ServerOption QuieckPort 2108
# port to send data update messages to

ServerOption statusfile tasstat.tcl

# Telnet Options
ServerOption TelnetPort 1305
ServerOption TelWord sicslogin

# The token system
TokenInit connan

#---------------------------------------------------------------------------
#                        U S E R S

# Here the SICS users are specified
# Syntax: SicsUser name password userRightsCode
SicsUser Spy     007       1
#---------------------------------------------------------------------------
#                        M O T O R S 
Motor A1  SIM 0. 111. -.1 2.   # Monochromator Theta
Motor A2  SIM 33.1 120. -.1 2.   # Monochromator Two-Theta
Motor A3  SIM -177.3 177.3 -.1 2.   # Sample theta or omega
Motor A4  SIM -135.1 123.4   -.1 2.   # Sample Two-Theta
Motor A5  SIM -200 200 -.1 2.   # Analyzer Theta
Motor A6  SIM -116. 166.  -.1 2.   # Analyzer Two-Theta
Motor MCV SIM -9 124. -.1 2.   # Monochromator curvature vertical
Motor SRO SIM 0. 351.  -.1 2.   # Sample table second ring
Motor ACH SIM -.5 11.5  -.1 2.   # Analyzer curvature horizontal
Motor MTL SIM -17 17 -.1 2.   # Monochromator translation lower
Motor MTU SIM -17 17. -.1 2.   # Monochromator Translation upper
Motor STL SIM -30 30.   -.1 2.   # Sample lower translation
Motor STU SIM -30. 30.  -.1 2.   # Sample upper translation
Motor ATL SIM -17 17  -.1 2.   #  Analyzer lower translation
Motor ATU SIM -17 16.88   -.1 2.   #  Analyzer upper translation
Motor MGL SIM -10 10  -.1 2.   #  Monochromator lower goniometer 
#Motor MGU SIM -30. 30.  -.1 2.   #  Monochromator upper goniometer 
Motor SGL SIM -16 16    -.1 2.   #  Sample lower goniometer 
Motor SGU SIM -16  16.  -.1 2.   #  Sample upper goniometer 
Motor AGL SIM -10 10  -.1 2.   #  Analyzer lower goniometer 
#Motor AGU SIM -30. 30.  -.1 2.   #  Analyzer upper goniometer 
#Motor MSC SIM -30. 30.  -.1 2.   #  Monochromator changer 
#Motor ASC SIM -30. 30.  -.1 2.   #  Analyzer changer 
#Motor CSC SIM -30. 30.  -.1 2.   #  Collimator changer
#--------------------------------------------------------------------------
#                        C O U N T E R
MakeCounter counter SIM -1. 
#--------------------------------------------------------------------------
#                SA M P L E   V A R I A B L E S
# AS-CS   cell length
# AA-CC   cell angles
# AX-AZ   scattering vector 1
# BX-BY   scattering vector 2

VarMake AS Float User
VarMake BS Float User
VarMake CS Float User
VarMake AA Float User
VarMake BB Float User
VarMake CC Float User
VarMake AX Float User
VarMake AY Float User
VarMake AZ Float User
VarMake BX Float User
VarMake BY Float User
VarMake BZ Float User
#--------------------------------------------------------------------------- 
#           E N E R G Y & R E L A T E D  V A R I A B L E S 
#
# EI incident energy 
# KI incident neutron wavevector
# EF final neutron energy
# KF final neutron wavevector
# QH-QL Q in reciprocal space
# EN energy transfer


VarMake EI Float User
VarMake KI Float User
VarMake EF Float User
VarMake KF Float User
VarMake QH Float User
VarMake QK Float User
VarMake QL Float User
VarMake EN Float User
#---------------------------------------------------------------------------
#          I N S T R U M E N T   V A R I A B L E S
# DM, DA         d-spacing monochromator, analyzer
# SM, SS, SA     scattering senses monochromator, sample, analyzer
# FX             1 for constant KI, 2 for constant KF
# NP             no of scan points
# TI             preset time
# MN             preset monitor
# IF*            various magnet currents
# HELM           Helmholtz angle of some sort.
# HX-HZ          Helmholtz field components
# F1, F2         Flipper switches

VarMake instrument Text Mugger
instrument SIM-DRUECHAL
instrument lock 
     
VarMake DM Float Mugger
VarMake DA Float Mugger
VarMake SM Int User
VarMake SS Int User
VarMake SA Int User
VarMake FX   Int User 
VarMake NP   Int User
VarMake TI   Float User
VarMake MN   Int User
VarMake IF1V Float User
VarMake IF2V Float User
VarMake IF1H Float User
VarMake IF2H Float User
VarMake HELM Float User
VarMake HX   Float User
VarMake HY   Float User
VarMake HZ   Float User
VarMake SWUNIT Int User

VarMake F1   Int User
VarMake F2   Int User

VarMake title Text User
VarMake user  Text User
VarMake lastcommand Text User
VarMake output Text User
VarMake local Text User
VarMake alf1 Float User
VarMake alf2 Float User
VarMake alf3 Float User
VarMake alf4 Float User
VarMake bet1 Float User
VarMake bet2 Float User
VarMake bet3 Float User
VarMake bet4 Float User

#--------------------------------------------------------------------------
#         I N C R E M E N T   V A R I A B L E S
VarMake DA1   Float User 
VarMake DA2   Float User 
VarMake DA3   Float User
VarMake DA4   Float User
VarMake DA5   Float User
VarMake DA6   Float User
VarMake DMCV  Float User
VarMake DSRO  Float User
VarMake DACH  Float User
VarMake DMTL  Float User
VarMake DMTU  Float User
VarMake DSTL  Float User
VarMake DSTU  Float User
VarMake DATL  Float User
VarMake DATU  Float User
VarMake DMGL  Float User
#VarMake DMGU   Float User
VarMake DSGL  Float User
VarMake DSGU  Float User
VarMake DAGL  Float User
#VarMake DAGU    Float User
#VarMake DMSC   Float User
#VarMake DASC   Float User
#VarMake DCSC   Float User
VarMake DEI Float User
VarMake DKI Float User
VarMake DEF Float User
VarMake DKF Float User
VarMake DQH Float User
VarMake DQK Float User
VarMake DQL Float User
VarMake DEN Float User
VarMake WAV Float User
VarMake ETAM Float User
VarMake ETAS Float User
VarMake ETAA Float User
VarMake QM  Float User
VarMake DQM Float User
VarMake DT  Float User
VarMake LPA Int User
VarMake DI1 Float User
VarMake DI2 Float User
VarMake DI3 Float User
VarMake DI4 Float User
VarMake DI5 Float User
VarMake DI6 Float User
VarMake DI7 Float User
VarMake DI8 Float User

#--------------------------------------------------------------------------
#       Curvature variables
VarMake MRX1  Float Mugger
VarMake MRX2  Float Mugger
VarMake ARX1  Float Mugger
VarMake ARX2  Float Mugger

#-------------------------------------------------------------------------
#       Datafile generation variables
VarMake SicsDataPath Text Mugger
SicsDataPath "$root/tmp/"
VarMake SicsDataPrefix Text Mugger
SicsDataPrefix simchal
SicsDataPrefix lock
VarMake SicsDataPostFix Text Mugger
SicsDataPostFix ".scn"
SicsDataPostFix lock
MakeDataNumber SicsDataNumber "$root/danu.dat"

#------------------------------------------------------------------------
# A helper variable for the status display
VarMake scaninfo text Internal
scaninfo "0,Unknown,1.0,.1"

#--------------------------------------------------------------------------
#     I N S T A L L    S P E C I A L   S I C S    C O M M A N D S
MakeScanCommand iscan counter tas.hdd recover.bin
MakePeakCenter iscan
#---------------------------------------------------------------------------
#  I N S T A L L   T A S    C O M P A T A B I L I T Y   C O M M A N D S
MakeTAS iscan

#--------------------------------------------------------------------------
#        I N S T A L L    T A S   S C R I P T E D   C O M M A N D S

#--------------------------------------------------------------------------
# Install sync
MakeSync localhost 2915 Spy 007

source $root/tascom.tcl





