Files
sics/doc/user/foman.tex
2000-02-11 15:21:07 +00:00

1801 lines
86 KiB
TeX

\documentclass[12pt,a4paper]{report}
%%\usepackage[dvips]{graphics}
%%\usepackage{epsf}
\setlength{\textheight}{24cm}
\setlength{\textwidth}{16cm}
\setlength{\headheight}{0cm}
\setlength{\headsep}{0cm}
\setlength{\topmargin}{0cm}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\hoffset}{0cm}
\setlength{\marginparwidth}{0cm}
\begin{document}
\begin{center}
\begin{huge}
FOCUS--Reference Manual \\
\end{huge}
Version April, 1999\\
Dr. Mark K\"onnecke \\
Labor f\"ur Neutronenstreuung\\
Paul Scherrer Institut\\
CH--5232 Villigen--PSI\\
Switzerland\\
\end{center}
\clearpage
\clearpage
\tableofcontents
\clearpage
\chapter{Introduction}
% html: Beginning of file: `focus.htm'
\label{f0}
Welcome to the Time-Of-Flight spectrometer FOCUS at SINQ! This manual
describes how to operate FOCUS through the means of the instrument
control software system SICS. SICS means: Sinq Instrument Control
System. SICS is a client server system. This means there is a magic server
program running somewhere which does all the work. The user interacts
only with client applications which communicate with the server
through the network. Most instument hardware (motor controllers,
counter boxes etc.) is connected to the system through RS-232 serial
connections. These RS-232 ports are connected to a Macintosh-PC which
acts as a terminal server by means of a special program running on
it. The SICS server communicates with this terminal server and other
devices through the network.
% html: End of file: `focus.htm'
\chapter{User Commands}
% html: Beginning of file: `sicsinvoc.htm'
\section{SICS Invocation}
\label{f1}
SICS means SINQ Instrument Control System.
SICS is a client server system. This means there are at least two programs
necessary to run the experiment. The first
is the
SICServer which does the actual instrument control work. A user rarely needs
to bother about this server program as it is meant to run all the time.
See instructions below if things go wrong.
Then there are client programs which interact with the
instrument control server. These client programs implement the status
displays and a command line application which forwards commands to the
SICS server and displays its response. Graphical User Interfaces may
be added at a later time.
The user has only to deal with
these SICS client programs. SICS Clients and the SICServer communicate
with each other through the TCP/IP network.
Currently five SICS clients are available:
\begin{itemize}
\item A command line control client for sending commands to the SICS
server and displaying its repsonses.
\item A status display for the powder diffractometers DMC and HRPT.
\item A status display for TOPSI.
\item A status display for SANS.
\item A status display for FOCUS.
\item A status display for AMOR.
\item A SICS variable watcher. This application graphically logs the
change of a SICS variable over time. Useful for monitoring for
instance temperature controllers.
\end{itemize}
\subsection{Steps necessary for logging in to SICS}
The following actions have to be taken in order to interact with the
SICS server through a client:
\begin{itemize}
\item Start the client application.
\item Connect the client to a SICS server.
\item In case of command line clients: authorize yourself as
privileged SICS user.
\end{itemize}
\subsection{Starting SICS client applications }
These programs can be started on a DigitalUnix system by issuing the
following commands at the command prompt:
\begin{description}
\item[sics \&] for the control client.
\item[powderstatus \&] for the DMC status display client.
\item[topsistatus \&] for the TOPSI status display.
\item[sansstatus \&] for the SANS status display.
\item[focustatus] for the FOCUS status display.
\item[amor] for the AMOR status display and control application.
\item[varwatch \&] for the variable watcher.
\end{description}
On a PC you may find icons for starting the different programs on the
desktop.
Each of these clients has usage instructions online which can be displayed
through the help/about menu entry.
\subsection{Connecting}
After startup any SICS client is not connected to a SICS server and thus not
active. A connection is established through the connect menu of the client.
\subsection{Authorization}
SICS is a multi user instrument control system. In order to prevent
malicious manipulations of the instrument SICS supports a hierarchy of user
rights. In order to run an experiment you need at least user level privilege.
In order to achieve this privilege you have to invoke the User Parameter/Set
Rights dialog. There you have to enter the apropriate username and password
kindly provided by your instrument scientist.
\subsection{Restarting the Server}
The SICS server should be running all the time. It is only down if something
went wrong. You can check for the presence of the SICS server by loging in
to the instrument computer and typing {\bf CheckSICS} at the command
prompt. The output will tell you what is happening. If you need to restart
the SICS server log in as the instrument user at the instrument computer and
invoke the apropriate command to start the server. These are:
\begin{description}
\item[DMC] Computer = lnsa05,User = DMC
\item[TOPSI] Computer = lnsa07,User = TOPSI
\item[SANS] Computer = lnsa10,User = SANS
\item[TRICS] Computer = lnsa13, User = TRICS
\item[HRPT] Computer = lnsa11, User = HRPT
\item[FOCUS] Computer = lnsa12, User = FOCUS
\item[AMOR] Computer = lnsa14, User = AMOR
\item[DRUECHAL] Computer = lnsa16, User = DRUECHAL
\end{description}
For starting the SICS server type {\bf startsics}. This is a shell script
which will starts all necessary server programs. This script works only on
the instrument computer and in the appropriate instrument account.
If all this does not help look under trouble shooting
SICS (cf.\ Section~\ref{f19}).
% html: End of file: `sicsinvoc.htm'
% html: Beginning of file: `drive.htm'
\section{Drive commands}
\label{f2}
Many objects in SICS are {\bf drivable }. This means they can run to a new value. Obvious examples are motors. Less obvious examples include composite adjustments such as setting a wavelength or an energy. This class of objects can be operated by the {\bf drive, run, Success } family of commands. These commands cater for blocking and non-blocking modes of operation.
{\bf run var newval var newval ... } can be called with one to n pairs of object new value pairs. This command will set the variables in motion and return to the command prompt without waiting for the requested operations to finish. This feature allows to operate other devices of the instrument while perhaps a slow device is still running into position.
{\bf Success } waits and blocks the command connection until all pending operations have finished (or an interrupt occured).
{\bf drive var newval var newval ... } can be called with one to n pairs of object new value pairs. This command will set the variables in motion and wait until the driving has finished. A drive can be seen as a sequence of a run command as stated above immediatly followed by a Success command.
% html: End of file: `drive.htm'
% html: Beginning of file: `fomo.htm'
\section{FOCUS motors}
\label{f3}
\subsection{Physical Motors}
\begin{description}
\item[MTT] Monochromator two theta. Only readable up to know. Must be moved manually
by pushing the detector around.
\item[MSL ] Monochromator shielding lift.
\item[MTH] Monochromator theta.
\item[MTX] Monochromator x-translation, vertical to monochromator surface.
\item[MTY] Monochromator y-translation, parallel to monochromator surface.
\item[MGO] Monochromator tilting.
\item[M1CH] Monochromator 1 curvature horizontal.
\item[M1CV] Monochromator 1 curvature vertical.
\end{description}
\subsection{Virtual motors}
Virtual motors are instrument parameters which can be driven with the
drive and run commands, though they are not physical motors. Mostly
this encompasses coordinated movements of motors around several axis
or other lengthy and error prone hardware operations.
\begin{description}
\item[lambda] wavelength
\item[ei] incident energy in meV.
\item[fermispeed] fermi chopper speed.
\item[diskspeed] disk chopper speed. This works only when the chopper is NOT in
synchonized mode.
\item[phase] chopper phase difference.
\item[ratio] This is the ratio fermispeed/diskspeed. A value of two would mean that the diskchopper is running at half the speed of the fermichopper.
Please note that the phase is set to 0
automatically while running this command by the chopper controller
software from Dornier.
\end{description}
% html: End of file: `fomo.htm'
% html: Beginning of file: `chopper.htm'
\section{Chopper Control}
\label{f4}
FOCUS is equipped with a Dornier Chopper system running two choppers:
a disk chopper and a fermi chopper. In most situations the diskchopper is
in slave mode. This means his speed is a predefined ratio of the
speed of the fermichopper. Furthermore, there is a phase difference between
the two choppers in order to allow for the fligh time of neutrons
between choppers.
The program handling RS-232 requests at the chopper control computer
is rather slow. This would slow the SICS server to unacceptable
levels, if any request would be handled through the RS-232 interface. In order
to cope with the problem, the SICS server buffers chopper
information. This information is updated any minute if not set otherwise.
The chopper system control is divided into several distinct objects: There
is the actual chopper controller which mainly serves for answering
status requests. Then there are a couple of virtual motors which
represent the four modifiable parameters of the chopper control
system. These can be driven through the normal drive (cf.\ Section~\ref{f2}) command. The commands understood by the
chopper controller object are:
\begin{description}
\item[choco list] prints a listing of all known chopper parameters.
\item[choco name] print only the value of parameter name. Possible values for name
can be extratcted from the list printed with choco list.
\item[chosta] This command procedure prints a status listing of the chopper
system in a nicely formatted stefan-happy form.
\end{description}
The following virtual motor variables exist for the chopper system.
\begin{description}
\item[fermispeed] fermi chopper speed
\item[diskspeed] disk chopper speed. Note, that driving this parameter while the
chopper system is in synchronous mode will throw an error condition.
\item[phase] The phase difference between the two choppers.
\item[ratio] The ratio of fermi to disk chopper speeds.
\item[updateintervall] The update intervall for the buffering of chopper data. Units are
seconds. Setting to low values here will compromise the responsiveness
of the SICS server.
\end{description}
Each of the variables kindly prints its current value when given as a
command. Modifying values happens through the normal drive
command. For instance the command:
\begin{verbatim}
drive fermispeed 10000
\end{verbatim}
will drive the fermi chopper to 10000 RPM eventually and if no problem occurs.
Please check your input carefully for all chopper commands.
Dornier has provided no way to stop an erraneous command in its software. So, if you intend to run the chopper to 1000 RPM and mistyped it as 10000 then
you'll wait for 20 minutes until the chopper is at speed!
% html: End of file: `chopper.htm'
% html: Beginning of file: `count.htm'
\section{Counting Commands.}
\label{f5}
\begin{description}\item[count mode preset] Does a count operation in mode with a preset of preset.
The parameters are optional. If they are not
given the count will be started with the current setting in the histogram
memory object. After the count, StoreData will be automatically called.
\item[ Repeat num mode preset.] Calls count num times. num is a required parameter. The other two are
optional and are handled as described above for count.
\end{description}
Both commands make sure, that measured data is written to files.
% html: End of file: `count.htm'
% html: Beginning of file: `logging.htm'
\section{Logging your activity}
\label{f6}
SICS offers not less then three different ways of logging your
commands and the SICS server's responses:
\begin{itemize}
\item The SICS command line client allows to open a log file on your
local computer and on your account. This can be achieved through the
File/Open Logfile menu entry. Select a file name and hit save. From
then on, any output in the SICS clients terminal area will be written
into the selected file. There is a gotcha: ouptut may not be immediately
visible in the file. This is due to buffering of I/O by the operating
system. If you want to flush, either open a new file or exit the
client. Flushing I/O at each line written is possible, but would have
a massive and unacceptable performance impact.
\item You may create a similar per client log file on the computer running
the SICS server through the logbook (cf.\ Section~\ref{f21}) command.
\item Then there is a way to log all activity registered from users with
either user or manager privilege into a file. This means: all commands
which affect the experiment regardless from which client they have
been issued. This is accomplished with the
commandlog (cf.\ Section~\ref{f22}) command.
\end{itemize}
% html: End of file: `logging.htm'
% html: Beginning of file: `logbook.htm'
\subsection{LogBook command}
\label{f21}
Some users like to have all the input typed to SICS and responses
collected in a file for further review. This is implemented via the LogBook
command. LogBook is actually a wrapper around the config file command.
LogBook understands the following syntax:
\begin{description}
\item[ LogBook] alone prints the name of the current logfile and the status of event
logging.
\item[ LogBook file filename] This command sets the filename to which output will be printed.
Please note that this new filename will only be in effect after restarting
logging.
\item[ LogBook on] This command turns logging on. All commands and all answers will be
written to the file defined with the command described above. Please note,
that this command will overwrite an existing file with the same name.
\item[ LogBook off] This command closes the logfile and ends logging.
\end{description}
% html: End of file: `logbook.htm'
% html: Beginning of file: `commandlog.htm'
\subsection{The Commandlog}
\label{f22}
The commandlog is a file where all communication with clients
having user or manager privilege is logged. This log allows to retrace each
step of an experiment. This log is usually switched off and must be
configured by the instrument manager. There exists a special command,
commandlog, which allows to control this log file.
\begin{description}
\item[commandlog new filename] starts a new commandlog writing to filename. Any prior files will be
closed. The log file can be found
in the directory specified by the ServerOption LogFileDir. Usually this is
the log directory.
\item[commandlog] displays the status of the commandlog.
\item[commandlog close] closes the commandlog file.
\item[commandlog auto] Switches automatic log file creation on. This is normally switched on.
Log files are written to the log directory of the instrument account. There
are time stamps any hour in that file and there is a new file any 24 hours.
\item[commandlog tail n] prints the last n entries made into the command log. n is optional and defaults to 20. Up to 1000 lines are held in an internal buffer for this command.
\end{description}
% html: End of file: `commandlog.htm'
% html: Beginning of file: `batch.htm'
\section{Batch Processing in SICS}
\label{f7}
Users rarely wish to stay close to the instrument all the time but appreciate
if the control computer runs the experiment for them while they
sleep. SICS supports two different ways of doing this:
\begin{itemize}
\item SICS has a built in macro programming (cf.\ Section~\ref{f23}) facility based on the
popular scripting language Tcl. The most primitive usage of this
facility is processing batch files.
\item Second there is the LNS R\"unbuffer (cf.\ Section~\ref{f24}) system.
\end{itemize}
% html: End of file: `batch.htm'
% html: Beginning of file: `macro.htm'
\subsubsection{Macro Commands}
\label{f23}
SICS has a built in macro facility. This macro facility is aimed at instrument managers and users alike. Instrument managers may provide customised measurement procedures in this language, users may write batch files in this language. The macro language is John Ousterhout's Tool Command Language (TCL). Tcl has control constructs, variables of its own, loop constructs, associative arrays and procedures. Tcl is well documented by several books and online tutorials, therefore no details on Tcl will be given here. All SICS commands are available in the macro language. Some potentially harmful Tcl commands have been deleted from the standard Tcl interpreter. These are: exec, source, puts, vwait, exit,gets and socket. A macro or batch file can be executed with the command:
{\bf FileEval name } tries to open the file name and executes the script in this file.
Then there are some special commands which can be used within macro-sripts:
{\bf ClientPut sometext1 ... } writes everything after ClientPut to
the client which started the script. This is needed as SICS supresses
the output from intermediate commands in scripts. Except error
messages and warnings. With clientput this scheme can be circumvented
and data be printed from within scripts.
{\bf SICSType object } allows to query the type of the object specified by object. Possible return values are
\begin{itemize}
\item {\bf DRIV } if the object is a SICS drivable object such as a motor
\item {\bf COUNT } if the object is some form of a counter.
\item {\bf COM } if the object is a SICS command.
\item {\bf NUM } if the object is a number.
\item {\bf TEXT } if object is something meaningless to SICS.
\end{itemize}
{\bf SICSbounds var newval } checks if the new value newval lies within the limits for varaible var. Returns an error or OK depending on the result of the test.
{\bf SICSStatus var } SICS devices such as counters or motor may be
started and left running while the program is free to do something
else. This command inquires the status of such a running device. Return values are internal SICS integer codes. This command is only of use for SICS programmers.
{\bf SetStatus newval } sets the SICS status to one of: Eager, UserWait, Count, NoBeam, Driving, Running, Scanning, Batch Hatl or Dead. This command is only available in macros.
{\bf SetInt newval, GetInt } sets SICS interrupts from macro scripts. Not recommended! Possible return values or new values are: continue, abortop, abortscan, abortbatch, halt, free, end. This command is only permitted in macros. Should only be used by SICS programmers.
% html: End of file: `macro.htm'
% html: Beginning of file: `buffer.htm'
\subsubsection{R\"unbuffer Commands}
\label{f24}
LNS scientists have got used to using R\"unbuffers for instrument
control. A R\"unbuffer is an array of SICS commands which
typically represent a measurement. This R\"unbuffer can be edited
at run time. This is very similar to a macro. In contrast to a macro
only SICS commands are allowed in R\"unbuffers. When done with
editing the R\"unbuffer it can be entered in a R\"unlist. This
is a stack of R\"unbuffers which get executed one by one. While
this is happening it is possible (from another client) to modify the
R\"unlist and edit and add additional R\"unbuffers on top of
the stack. This allows for almost infinite measurement and gives more
control than a static batch file. In order to cater for this scheme
three commands have been defined:
The {\bf Buf } object is responsible for creating and deleting R\"unbuffers. The syntax is:
\begin{itemize}
\item {\bf Buf new name } creates a new empty R\"unbuffer with the name name. name will be installed as a SICS object afterwards.
\item {\bf Buf copy name1 name2 } copies R\"unbuffer name1 to buffer name2.
\item {\bf Buf del name } deletes the R\"unbuffer name.
\end{itemize}
After creation, the R\"unbuffer is accessible by his name. It
then understands the commands:
\begin{itemize}
\item {\bf NAME append what shall we do with a drunken sailor } will add all text after append as a new line at the end of the R\"unbuffer.
\item {\bf NAME print } will list the contents of the R\"unbuffer.
\item {\bf NAME del iLine } will delete line number iLine from the R\"unbuffer.
\item {\bf NAME ins iLine BimBamBim } inserts a new line {\bf after } line iLine into the R\"unbuffer. The line will consist of everything given after the iLine.
\item {\bf NAME subst pattern newval } replaces all occurences of pattern in the R\"unbuffer by the text specified as newval. Currently this feature allows only exact match but may be expanded to Unix style regexp or shell like globbing.
\item {\bf NAME save filename } saves the contents of the R\"unbuffer into file filename.
\item {\bf NAME load filename } loads the R\"unbuffer with the data in file filename.
\item {\bf NAME run } executes the R\"unbuffer.
\end{itemize}
The R\"unlist is accessible as object {\bf stack }. Only one R\"unlist per server is permitted. The syntax:
\begin{itemize}
\item {\bf stack add name } adds R\"unbuffer name to the top of the stack.
\item {\bf stack list } lists the current R\"unlist.
\item {\bf stack del iLine } deletes the R\"unbuffer iLine from the R\"unlist.
\item {\bf stack ins iLine name } inserts R\"unbuffer name after R\"unbuffer number iLine into the R\"unlist.
\item {\bf stack run } executes the R\"unlist and returns when all R\"unbuffers are done.
\item {\bf stack batch } executes the R\"unlist but does not return when done but waits for further R\"unbuffers to be added to the list. This feature allows a sort of background process in the server.
\end{itemize}
% html: End of file: `buffer.htm'
% html: Beginning of file: `token.htm'
\subsection{The Token Command}
\label{f8}
In SICS any client can issue commands to the SICS server. This
is a potential source of trouble with users possibly issuing conflicting
commands without knowing. In order to deal with this problem a
{\tt{}"{}}token{\tt{}"{}} mechanism has been developed. In this context the token is a
symbol for the control of an instrument. A connection can grab the
token and then has full control over the SICS server. Any other
connection will not be privileged to do anything useful, except
looking at things. A token can be released manully with a
special command or is automatically released when the connection
dies. Another command exists which allows a SICS manager to
force his way into the SICS server. The commands in more detail:
\begin{description}
\item[token grab] Reserves control over the instrument to the client isssuing this
command. Any other client cannot control the instrument now. However, other
clients are still able to inspect variables.
\item[token release] Releases the control token. Now any other client can control the
instrument again. Or grab the control token.
\item[token force password] This command forces an existing grab on a token to be released. This
command requires manager privilege. Furthermore a special password must be
specified as third parameter in order to do this. This command does not grab
control though.
\end{description}
% html: End of file: `token.htm'
% html: Beginning of file: `focussps.htm'
\section{FOCUS SPS Commands}
\label{f9}
The following commands are handled with the help of the Siemens SPS-system.
\subsection{The Shutter}
\label{f9:SHUDDER}
Even the shutter can be controlled from within SICS. This is safe because
the shutter will not open if the door to the instrument is open. In Local
Beam Control (LBC) speak this status is named {\tt{}"{}}Enclosure is broken{\tt{}"{}}. Be
careful anyway because some idiots may climb the fence..... The following
SICS commands control the shutter:
\begin{description}
\item[shutter] The command shutter without arguments returns the status of the shutter.
This can be one of open, closed, Enclosure is broken.
\item[shutter open] opens the shutter when possible.
\item[shutter close] closes the shutter.
\end{description}
\subsection{The Collimator}
\label{f9:COLLI}
FOCUS is equiped with a rotating collimator. This can be either idle or
moving. This collimator can be controlled from SICS with the following
commands:
\begin{description}
\item[colli] prints the current status of the collimator which can be either
idle or moving.
\item[colli idle] switches the collimator to idle mode.
\item[colli moving] swicthes the collimator into moving mode.
\end{description}
\subsection{Flight Box}
\label{f9:FBOX}
The flight path in the detector box is normally filled with argon.
In order to detect a possible
leak an oxygen sensor is provided. The status of this sensor can be inquired
from within SICS with the command:
\begin{description}
\item[fbox] prints the status of the flightbox. Which can be either OK or Problem.
\end{description}
Obviously this cannot be controlled from the computer as any problem with
this requires massive mechanical intervention (searching the leak and
refilling argon).
% html: End of file: `focussps.htm'
\chapter{Advanced Topics}
% html: Beginning of file: `samenv.htm'
\section{ Sample Environment Devices}
\label{f10}
\subsection{SICS Concepts for Sample Environment Devices}
\label{f10:concept}
SICS can support any type of sample environment control device if there is a
driver for it. This includes temperature controllers, magnetic field controllers
etc. The SICS server is meant to be left running continously. Therefore there
exists a facility for dynamically configuring and deconfiguring environment
devices into the system. This is done via the {\bf EVFactory} command.
It is expected that instrument scientists will provide command procedures or
specialised R\"unbuffers for configuring environment devices and setting
reasonable default parameters.
In the SICS model
a sample environment device has in principle two modes of operation. The first
is the drive mode. The device is monitored in this mode when a new value for it
has been requested. The second mode is the monitor mode. This mode is entered
when the device has reached its target value. After that, the device must be
continously monitored throughout any measurement. This is done through the
environment monitor or {\bf emon}. The emon understands a few commands of its
own.
Within SICS all sample environement devices share some common behaviour
concerning parameters and abilities. Thus any given environment device
accepts all of a set of general commands plus some additional commands
special to the device.
In the next section the EVFactory, emon and the general commands understood
by any sample environment device will be discussed. This reading is mandatory
for understanding SICS environment device handling. Then there will be another
section discussing the special devices known to the system.
\subsection{SampleEnvironment Error Handling}
A \label{f10:error}sample environment device may fail to stay at its preset value during a
measurement. This condition will usually be detected by the emon. The question
is how to deal with this problem. The requirements for this kind of error
handling are quite different. The SICS model therefore implements several
strategies for handling sample environment device failure handling.
The strategy to use is selected via a variable which can be set by the user for
any sample environment device separately. Additional error handling strategies
can be added with a modest amount of programming. The error handling strategies currently
implemented are:
\begin{description}
\item[Lazy] Just print a warning and continue.
\item[Pause] Pauses the measurement until the problem has been resolved.
\item[Interrupt] Issues a SICS interrupt to the system.
\item[Safe] Tries to run the environment device to a value considered safe by the
user.
\end{description}
\subsection{General Sample Environment Commands}
\label{f10:general}
\subsubsection{EVFactory}
EVFactory is responsible for configuring and deconfiguring sample environment
devices into SICS. The syntax is simple:
\begin{description}
\item[EVFactory new name type par par ...] Creates a new sample environment device. It will be known to SICS by the
name specified as second parameter. The type parameter decides which driver to
use for this device. The type will be followed by additional parameters
which will be evaluated by the driver requested.
\item[EVFactory del name] Deletes the environment device name from the system.
\end{description}
\subsubsection{emon}
The environment monitor emon takes for the monitoring of an environment device
during measurements. It also initiates error handling when appropriate. The emon
understands a couple of commands.
\begin{description}
\item[emon list] This command lists all environment devices currently registered in the
system.
\item[emon register name] This is a specialist command which registers the environment device name
with the environment monitor. Usually this will automatically be taken care
of by EVFactory.
\item[emon unregister name] This is a specialist command which unregisters the environment device name
with the environment monitor. Usually this will automatically be taken care
of by EVFactory Following this call the device will no longer be monitored and
out of tolerance errors on that device no longer be handled.
\end{description}
\subsubsection{General
Commands UnderStood by All Sample Environment Devices}
\label{f10:all}
Once the evfactory has been run successfully the controller is
installed as an object in SICS. It is accessible as an object then
under the name specified in the evfactory command. All environemnt
object understand the common commands given below.
Please note that each command discussed below MUST be prepended with the name
of the environment device as configured in EVFactory!
The general commands understood by any environment controller can be subdivided
further into parameter commands and real commands. The parameter commands just
print the name of the parameter if given without an extra parameter or
set if a parameter is specified. For example:
\begin{quotation}
Temperature Tolerance\end{quotation}
prints the value of the variable Tolerance for the environment controller
Temperature. This is in the same units as the controller operates,
i. e. for a temperature controller Kelvin.
\begin{quotation}
Temperature Tolerance 2.0\end{quotation}
sets the parameter Tolerance for Temperature to 2.0. Parameters known to ANY
envrironment controller are:
\begin{description}
\item[Tolerance] Is the deviation from the preset value which can be tolerated before an
error is issued.
\item[ Access] Determines who may change parameters for this controller.
Possible values are:
\begin{itemize}
\item 0 only internal
\item 1 only Managers
\item 2 Managers and Users.
\item 3 Everybody, including Spy.
\end{itemize}
\item[LowerLimit] The lower limit for the controller.
\item[UpperLimit] The upper limit for the controller.
\item[ErrHandler.] The error handler to use for this controller. Possible values:
\begin{itemize}
\item 0 is Lazy.
\item 1 for Pause.
\item 2 for Interrupt
\item 3 for Safe.
\end{itemize}
For an explanantion of these values see the section about error (cf.\ Section~\ref{f10:error}) handling
above.
\item[ Interrupt] The interrupt to issue when an error is detected and Interrupt error
handling is set. Valid values are:
\begin{itemize}
\item 0 for Continue.
\item 1 for abort operation.
\item 2 for abort scan.
\item 3 for abort batch processing.
\item 4 halt system.
\item 5 exit server.
\end{itemize}
\item[SafeValue] The value to drive the controller to when an error has been detected and
Safe error handling is set.
\end{description}
Additionally the following commands are understood:
\begin{description}
\item[send par par ...] Sends everything after send directly to the controller and return its
response. This is a general purpose command for manipulating controllers
and controller parameters directly. The protocoll for these commands is
documented in the documentation for each controller. Ordinary users should
not tamper with this. This facility is meant for setting up the device with
calibration tables etc.
\item[ list] lists all the parameters for this controller.
\item[ no command, only name.] When only the name of the device is typed it will return its
current value.
\item[ name val ] will drive the device to the new value val. Please note that the same
can be achieved by using the drive command.
\item[ name log on] Switches logging on. If logging is on, at each cycle in the
{\bf emon}
the
current value of the environment variable will be recorded together with a
time stamp. Be careful about this, for each log point a bit of memory is
allocated. At some time the memory is exhausted! {\bf Log clear}
frees
it again
and {\bf log frequency} (both below)
allows to set the logging time intervall.
\item[ name log off] Switches logging off.
\item[name log clear] Clears all recorded time stamps and values.
\item[name log gettime] This command retrieves a list of all recorded time stamps.
\item[name log getval] This command retrieves all recorded values.
\item[name log getmean] Calculates the mean value and the standard deviation for all logged
values and prints them.
\item[name log frequency val] With a parameter sets, without a parameter requests the logging intervall
for the log created. This parameter specifies the time intervall in seconds
between log records. The default is 300 seconds.
\item[name log file filename] Starts logging of value data to the file filename. All normal logging to
memory will be
disabled. Logging will happen any 5 minutes initially. The logging frequency
can be changed with the name log frequency command. Each entry in the file is
of the form date time value. The name of the file must be specified relative
to the SICS server.
\item[name log close ] Stops logging data to the file.
\end{description}
\subsection{Special Environment Control Devices}
This section lists the parameters needed for configuring a special environment
device into the system and special parameters and commands only understood by
that special device. All of the general commands listed above work as well!
\subsubsection{ITC-4 and ITC-503 Temperature Controllers}
\label{f10:itc4}
These temperature controller are fairly popular at SINQ. They are
manufactured by
Oxford Instruments. At the back of this controller is a RS-232
socket which must be connected to a Macintosh computer running the SINQ
terminal server program via a serial cable. Please make sure with a different
Macintosh or a PC that the serial line is OK and the ITC-4 responding before
plugging it in.
\paragraph{ITC-4 Initialisation}
An ITC-4 can be configured into the system by:
\begin{quotation}
EVFactory new Temp ITC4 computer port channel\end{quotation}
This creates an ITC-4 controller object named Temp within the system. The
ITC-4 is expected to be connected to the serial port channel at the
Macintosh computer computer running the SINQ terminal server program
listening at port port. For example:
\begin{quotation}
EVFactory new Temp ITC4 lnsp22.psi.ch 4000 7\end{quotation}
connects Temp to the Macintosh named lnsp22, serial port 6
(7 above is no typo!), listening at port 4000.
\paragraph{ITC-4 Additional Parameters}
The ITC-4 has a few more parameter commands:
\begin{description}
\item[timeout] Is the timeout for the Macintosh terminal server program waiting for
responses from the ITC-4. Increase this parameter if error messages
containg ?TMO appear.
\item[ sensor] Sets the sensor number to be used for reading temperature.
\item[ control] Sets the control sensor for the ITC-4. This sensor will be used
internally for regulating the ITC-4.
\item[divisor] The ITC4 does not understand floating point numbers, the ITC-503 does.
In order to make ITC4's read and write temperatures correctly floating point
values must be multiplied or divided with a magnitude of 10. This parameter
determines the appropriate value for the sensor. It is usually 10 for a sensor
with one value behind the comma or 100 for a sensor with two values after
the comma.
\item[multiplicator] The same meaning as the divisor above, but for the control sensor.
\end{description}
\paragraph{Installing an ITC4 step by step}
\begin{enumerate}\item Connect the ITC temperature controller to port 6 on the Macintosh
serial port extension box. Port 6 is specially configured for dealing with
the ideosyncracies of that device. No null modem is needed.
\item Install the ITC4 into SICS with the command: \newline
evfactory new name Macintoshname 4000 7\newline
Thereby replace name with the name you want to address the ITC4 in SICS. A
good choice for a name is temperature, as such a value will be written to data files.
Please note, that SICS won't let you use that name if it already exists. For
instance if you already had a controller in there. Then the command:\newline
evfactory del name \newline
will help. Macintoshname is the name of the instrument Macintosh PC.
\item Configure the upper and lowerlimits for your controller appropriatetly.
\item Figure out which sensor you are going to use for reading temperatures.
Configure the sensor and the divisor parameter accordingly.
\item Figure out, which sensor will be used for controlling the ITC4. Set the
parameters control and multiplicator accordingly. Can be the same as the
sensor.
\item Think up an agreeable temperature tolerance for your measurement. This
tolerance value will be used 1) to figure out when the ITC4 has reached its
target position. 2) when the ITC4 will throw an error if the ITC4 fails to
keep within that tolerance. Set the tolerance parameter according to the
results of your thinking.
\item Select one of the numerous error handling strategies the control
software is able to perform. Configure the device accordingly.
\item Test your setting by trying to read the current temperature.
\item If this goes well try to drive to a temperature not to far from the
current one.
\end{enumerate}
\paragraph{ITC-4 Trouble Shooting}
If the ITC-4 {\bf does not respond at all}, make sure the serial connection to
the Macintosh is working. Use standard RS-232 debugging procedures for doing
this. The not responding message may also come up as a failure to
connect
to the ITC-4 during startup.
If error messages containing the string {\bf ?TMO} keep appearing
up followed
by signs that the command has not been understood, then increase the
timeout. The standard
timeout of 10 microseconds can be to short sometimes.
You keep on reading {\bf wrong values} from the ITC4. Mostly off by a
factor 10. Then set the divisor correctly. Or you may need to choose a
decent sensor for that readout.
Error messages when {\bf trying to drive the ITC4}. These are usually the
result of a badly set multiplicator parameter for the control sensor.
The ITC4 {\bf never stops driving}. There are at least four possible
causes for this problem:
\begin{enumerate}
\item The multiplicator for the control sensor was wrong and the ITC4 has now
a set value which is different from your wishes. You should have got error
messages then as you tried to start the ITC4.
\item The software is reading back incorrect temperature values
because the sensor and
divisor parameters are badly configured. Try to read the temperature and if
it does have nothing to do with reality, set the parameters accordingly.
\item The tolerance parameter is configured so low, that the ITC4 never
manages to stay in that range. Can also be caused by inappropriate PID
parameters in the ITC4.
\item
You are reading on one sensor (may be 3) and controlling on another one (may
be 2). Then it may happen that the ITC 4 happily thinks that he has reached
the temperature because its control sensor shows the value you entered as
set value. But read sensor 3 still thinks he is far off. The solution is to
drive to a set value which is low enough to make the read sensor think it is
within the tolerance. That is the temperature value you wanted after all.
\end{enumerate}
\subsubsection{Haake Waterbath Thermostat}
\label{f10:haake}
This is sort of a bucket full of water equipped with a temperature
control system. The RS-232 interface of this device can only be operated at
4800 baud max. This is why it has to be connected to the serial printer port
of the Macintosh serial port server computer. This makes the channel number to
use for initialisation a 1 always. The driver for this device has been
realised in the Tcl extension language of the SICS server. A prerequisite
for the usage of this device is that the file hakle.tcl is sourced in the
SICS initialisation file and the command inihaakearray has been published.
Installing the
Haake into SICS requires two steps: first create an array with
initialisation parameters, second install the device with evfactory. A
command procedure is supplied for the first step. Thus the initialisation
sequence becomes:
\begin{quotation}
inihaakearray name-of-array macintosh-computer name port channel\newline
evfactory new temperature tcl name-of-array\end{quotation}
An example for the SANS:
\begin{quotation}
inihaakearray eimer lnsp25.psi.ch 4000 1 \newline
evfactory new temperature tcl eimer\end{quotation}
Following this, the thermostat can be controlled with the other environment
control commands.
The Haake Thermostat understands a single special subcommand: {\bf sensor}.
The thermostat may be equipped with an external sensor for controlling and
reading. The subcommand sensor allows to switch between the two. The exact
syntax is:
\begin{quotation}
temperature sensor val\end{quotation}
val can be either intern or extern.
\subsubsection{Dilution Cryostat}
\label{f10:dilu}
This is a large ancient device for reaching very low temperatures. This
cryostat can be configured into SICS with the command:
\begin{verbatim}
EVFactory new Temp dillu computer port channel table.file
\end{verbatim}
Temp is the name of the dilution controller command in SICS, dillu is the
keyword which selects the dilution driver, computer, port and channel are
the parameters of the Macintosh-PC running the serial port server program.
table.file is the fully qualified name of a file containing a translation
table for this cryostat. The readout from the dilution controller is a
resistance. This table allows to interpolate the temperature from the
resistance measurements and back. Example:
\begin{verbatim}
evfactory new temperature dillu lnsp19.psi.ch 4000 1 dilu.tem
\end{verbatim}
installs a new dilution controller into SICS. This controller is connected
to port 1 at the Macintos-PC with the newtwork adress lnsp19.psi.ch. On this
macintosh-PC runs a serial port server program listening at TCP/IP port
4000. The name of the translation table file is dilu.tem.
The dilution controller has no special commands, but two caveats: As of
current (October 1998) setting temperatures does not work due to problems
with the electronics. Second the dilution controller MUST be connected to
port 1 as only this port supports the 4800 maximum baud rate this device
digests.
\subsubsection{Bruker Magnet Controller B-EC-1}
\label{f10:bruker}
This is the Controller for the large magnet at SANS. The controller is a
box the size of a chest of drawers. This controller can be operated in one
out of two modes: in {\bf field} mode the current for the magnet is controlled via
an external hall sensor at the magnet. In {\bf current} mode, the output current
of the device is controlled. This magnet can be configured into SICS with a
command syntax like this:
\begin{quotation}
evfactory new name bruker Mac-PC Mac-port Mac-channel\end{quotation}
name is a placeholder for the name of the device within SICS. A good
suggestion (which will be used throughout the rest of the text) is magnet.
bruker is the keyword for selecting the bruker driver. Mac-PC is the name of
the Macintosh PC to which the controller has been connected, Mac-Port is the
port number at which the Macintosh-PC's serial port server listens.
Mac-channel is the RS-232 channel to which the controller has been
connected. For example (at SANS):
\begin{verbatim}
evfactory new magnet bruker lnsp25.psi.ch 4000 9
\end{verbatim}
creates a new command magnet for a Bruker magnet Controller connected to
serial port 9 at lnsp25.
In addition to the standard environment controller commands this magnet
controller understands the following special commands:
\begin{description}
\item[magnet polarity] Prints the current polarity setting of the controller. Possible
answers are plus, minus and busy. The latter indicates that the controller
is in the process of switching polarity after a command had been given to
switch it.
\item[magnet polarity val] sets a new polarity for the controller. Possible values for val are
{\bf minus} or {\bf plus}. The meaning is self explaining.
\item[magnet mode] Prints the current control mode of the controller. Possible
answers are {\bf field} for control via hall sensor or {\bf current} for
current control.
\item[magnet mode val] sets a new control mode for the controller. Possible values for val are
{\bf field} or {\bf current}. The meaning is explained above.
\item[magnet field] reads the magnets hall sensor independent of the control mode.
\item[magnet current] reads the magnets output current independent of the control mode.
\end{description}
Warning: There is a gotcha with this. If you type only magnet a
value will be returned. The meaning of this value is dependent on the
selected control mode. In current mode it is a current, in field mode it is
a magnetic field. This is so in order to support SICS control logic.
You can read values at all times explicitly using magnet current or
magnet field.
\subsubsection{The CryoFurnace.}
\label{f10:ltc11}
The CryoFurnace at PSI is equipped with a Neocera LTC-11 temperature
controller. This controller can control either an heater or an analag output
channel. Futhermore a choice of sensors can be selected for controlling the
device. The LTC-11 behaves like a normal SICS environment control device
plus a few additional commands. An LTC-11 can be configured into SICS with
the following command:
\begin{quotation}
evfactory new name ltc11 Mac-PC Mac-port Mac-channel\end{quotation}
name is a placeholder for the name of the device within SICS. A good
suggestion is temperature.
ltc11 is the keyword for selecting the LTC-11 driver. Mac-PC is the name of
the Macintosh PC to which the controller has been connected, Mac-Port is the
port number at which the Macintosh-PC's serial port server listens.
Mac-channel is the RS-232 channel to which the controller has been
connected. For example (at DMC):
\begin{verbatim}
evfactory new temperature ltc11 lnsp18.psi.ch 4000 6
\end{verbatim}
creates a new command magnet for a LTC-11 temperature Controller connected to
serial port 6 at lnsp18.
The additional commands understood by the LTC-11 controller are:
\begin{description}
\item[temperature sensor ] queries the current sensor used for temperature readout.
\item[temperature sensor val ] selects the sensor val for temperature readout.
\item[temperature controlanalog ] queries the sensor used for controlling the analog channel.
\item[temperature controlanalog val ] selects the sensor val for controlling the analog channel.
\item[temperature controlheat ] queries the sensor used for controlling the heater channel.
\item[temperature controlheat val ] selects the sensor val for controlling the heater channel.
\item[temperature mode] queries if the LTC-11 is in analog or heater control mode.
\end{description}
Further notes: As the CryoFurnace is very slow and the display at the
controller becomes unusable when the temperature is read out to often, the
LTC-11 driver buffers the last temperature read for 5 seconds. Setting the
mode of the LTC-11 is possible by computer, but not yet fully understood and
therefore unusable.
\subsubsection{The Eurotherm Temperature Controller}
\label{f10:euro}
At SANS there is a Eurotherm temperature controller for the sample heater.
This and probably other Eurotherm controllers can be configured into SICS
with the following command. The eurotherm needs to be connected with a
nullmodem adapter.
\begin{quotation}
evfactory new name euro Mac-PC Mac-port Mac-channel\end{quotation}
name is a placeholder for the name of the device within SICS. A good
suggestion is temperature.
euro is the keyword for selecting the Eurotherm driver. Mac-PC is the name of
the Macintosh PC to which the controller has been connected, Mac-Port is the
port number at which the Macintosh-PC's serial port server listens.
Mac-channel is the RS-232 channel to which the controller has been
connected. {\bf WARNING:} The eurotherm needs a RS-232 port with an unusual
configuration: 7bits, even parity, 1 stop bit. Currently only the SANS
Macintosh port 13 (the last in the upper serial port connection box) is
configured like this! Thus, an example for SANS and the name temperature
looks like:
\begin{verbatim}
evfactory new temperature euro lnsp25.psi.ch 4000 13
\end{verbatim}
There are two further gotchas with this thing:
\begin{itemize}
\item The eurotherm needs to operate in the EI-bisynch protocoll mode. This has
to be configured manually. For details see the manual coming with the machine.
\item The weird protocoll spoken by the Eurotherm requires very special control
characters. Therefore the send functionality usually supported by a SICS
environment controller could not be implemented.
\end{itemize}
\subsubsection{The PSI-EL755 Magnet Controller}
\label{f10:el755}
This is magnet controller developed by the electronics group at
PSI. It consists of a controller which interfaces to a couple of power
supplies. The magnets are then connected to the power supplies. The
magnetic field is not controlled directly but just the power output of
the power supply. Also the actual output of the power supply is NOT
read back but just the set value after ramping. This is a serious
limitation because the computer cannot recognize a faulty power supply
or magnet. The EL755 is connected to SICS with the command:
\begin{quotation}
evfactory new name el755 Mac-PC Mac-port Mac-channel index\end{quotation}
with Mac-PC, Mac-port and Mac-channel being the usual data items for
describing the location of the EL755-controller at the Macintosh
serial port server. index is special and is the number of the power
supply to which the magnet is connected. An example:
\begin{verbatim}
evfactory new maggi el755 lnsa09.psi.ch 4000 5 3
\end{verbatim}
connects to power supply 3 at the EL755-controller connected to lnsa09
at channel 5. The magnet is then available in the system as maggi. No
special commands are supported for the EL755.
% html: End of file: `samenv.htm'
% html: Beginning of file: `histogram.htm'
\section{Histogram memory}
\label{f11}
Histogram memories are used in order to control large area sensitive
detectors or single detectors with time binning information.
Basically each detector maps to a defined memory location. The
histogram memory wizard takes care of putting counts detected in the
detector into the proper bin in memory. Some instruments resolve energy
(neutron flight time) as
well, than there is for each detector a row of memory locations mapping to
the time bins. As usual in SICS the syntax is the name of the histogram
memory followed by qualifiers and parameters. As a placeholder for the
histogram memories name in your system, HM will be used in the following
text.
A word or two has to be lost about the SICS handling of preset values for
histogram memories.
Two modes of operation have to be distinguished: counting until a timer has passed,
for example: count for 20 seconds. This mode is called timer mode. In the other
mode, counting is continued until a control monitor has reached a certain
preset value. This mode is called Monitor mode. The preset values in Monitor
mode are usually very large. Therefore the counter has an exponent data variable.
Values given as preset are effectively 10 to the power of this exponent. For
instance if the preset is 25 and the exponent is 6, then counting will be
continued until the monitor has reached 25 million. Note, that this scheme with
the exponent is only in operation in Monitor mode.
\subsection{ Configuration}
A HM has a plethora of configuration options coming with it which define
memory layout, modes of operation, handling of bin overflow and the like.
Additionally there are HM model specific parameters which are needed
internally in
order to communicate with the HM. In
most cases the HM will already have been configured at SICS server startup
time. However, there are occasion where these configuartion option need to
enquired or modified at run time. The command to enquire the current value
of a configuration option is: {\bf HM configure option}, the command to set it is:
{\bf HM configure option newvalue}. A list of common configuration options and their
meaning is given below:
\begin{description}
\item[ HistMode] HistMode describes the modes of operation of the histogram memory.
Possible values are:
\begin{itemize}
\item Transparent, Counter data will be written as is to memory. For debugging
purposes only.
\item Normal, neutrons detected at a given detector will be added to the
apropriate memory bin.
\item TOF, time of flight mode, neutrons found in a given detector will be
put added to a memory location determined by the detector and the time
stamp.
\item Stroboscopic mode. This mode serves to analyse changes in a sample due
to an varying external force, such as a magnetic field, mechanical stress
or the like. Neutrons will be stored in memory according to detector
position and phase of the external force.
\end{itemize}
\item[ OverFlowMode] This parameter determines how bin overflow is handled. This happend
when more neutrons get detected for a particular memory location then are
allowed for the number type of the histogram memory bin. Possible values
are:
\begin{itemize}
\item Ignore. Overflow will be ignored, the memory location will wrap around
and start at 0 again.
\item Ceil. The memory location will be kept at the highest posssible value
for its number type.
\item Count. As Ceil, but a list of overflowed bins will be maintained.
\end{itemize}
\item[ Rank] Rank defines the number of histograms in memory.
\item[ Length ] gives the length of an individual histogram.
\item[ BinWidth] determines the size of a single bin in histogram memory in bytes.
\item[dim0, dim1, dim2, ... dimn] define the logical dimensions of the histogram. Must be set if the
the sum command (see below) is to be used. This is a clutch necessary to
cope with the different notions of dimensions in the SINQ histogram memory
and physics.
\end{description}
For time of flight mode the time binnings can be retrieved and modified with
the following commands. Note that these commands do not follow the configure
syntax given above. Please note, that the usage of the commands for
modifying time bins is restricted to instrument managers.
\begin{description}
\item[HM timebin] Prints the currently active time binning array.
\item[HM genbin start step n] Generates a new equally spaced time binning array. Number n time bins
will be generated starting from start with a stepwidth of step.
\item[HM setbin inum value] Sometimes unequally spaced time binnings are needed. These can be
configured with this command. The time bin iNum is set to the value value.
\item[HM clearbin] Deletes the currently active time binning information.
\end{description}
\subsection{Histogram Memory Commands}
Besides the configuration commands the HM understands the following
commands:
\begin{description}
\item[HM preset] with a new value sets the preset time or monitor for counting. Without a
value prints the current value.
\item[HM exponent] with a new value sets the exponent to use for the preset time
in Monitor mode. Without a
value prints the current value.
\item[CountMode ] with a new values sets the count mode. Possible values are Timer for a
fixed counting time and Monitor for a fixed monitor count which has to be
reached before counting finishes. Without a value print the currently active
value.
\item[HM init ] after giving configuration command sthis needs to be called in order to
transfer the configuration from the host computer to the actual HM.
\item[HM count] starts counting using the currently active values for CountMode and
preset. This command does not block, i.e. in order to inhibit further
commands from the console, you have to give Success afterwards.
\item[HM InitVal val] initialises the whole histogram memory to the value val. Ususally 0 in
order to clear the HM.
\item[ HM get i iStart iEnd] retrieves the histogram number i. A value of -1 for i denotes retrieval
of the whole HM. iStart and iEnd are optional amd
allow to retrieve a subset of a histogram between iStart and iEnd.
\item[HM sum d1min d1max d2min d2max .... dnmin dnmax] calculates the sum of an area on the detector. For each dimension a
minimum and maximum boundary for summing must be given.
\end{description}
% html: End of file: `histogram.htm'
% html: Beginning of file: `fowrite.htm'
\section{FOCUS Data Storage}
\label{f12}
FOCUS writes data into portable binary NeXus files. The scheme implemented
involves opening a new file for any run and updating this file at
predefined intervalls during counting operations. All this is commonly
handled automatically by the count (cf.\ Section~\ref{f5})
command. However, data file writing can be initiated and configured
manually from the command line through the following commands:
\begin{description}
\item[storefocus start] Write a new data file
\item[storefocus update] Updates the current data file.
\item[storefocus intervall] prints the current update intervall to use during counting. Units
is minutes.
\item[storefocus intervall newval] Sets the update intervall to newval minutes.
\item[killfile] This command will overwrite the last data file written and thus
effectively erase it. Therefore this command requires manager privilege.
\end{description}
% html: End of file: `fowrite.htm'
% html: Beginning of file: `motor.htm'
\section{SICS motor handling}
\label{f13}
In SICS each motor is an object with a name. Motors may take commands which basically come in the form {\em motorname command }. Most of these commands deal with the plethora of parameters which are associated with each motor. The syntax for manipulating variables is, again, simple. {\em Motorname parametername } will print the current value of the variable. {\em Motorname parametername newval } will set the parameter to the new value specified. A list of all parameters and their meanings is given below. The general principle behind this is that the actual (hardware) motor is kept as stupid as possible and all the intracacies of motor control are dealt with in software. Besides the parameter commands any motor understands these basic commands:
\begin{itemize}
\item {\bf Motorname list } gives a listing of all motor parameters.
\item {\bf Motorname reset } resets the motor parameters to default values.
This is software zero to 0.0 and software limits are reset to hardware
limits.
\item {\bf Motorname position} prints the current position of the motor.
All zero point and sign corrections are applied.
\item {\bf Motorname hardposition} prints the current position of the motor.
No corrections are applied. Should read the same as the controller box.
\item {\bf Motorname interest} initiates automatic printing of any position
change of the motor. This command is mainly interesting for implementors of
status display clients.
\end{itemize}
Please note that the actual driving of the motor is done via the drive (cf.\ Section~\ref{f2}) command.
\subsection{The motor parameters}
\begin{itemize}
\item {\bf HardLowerLim } is the hardware lower limit. This is read from the motor controller and is identical to the limit switch welded to the instrument. Can usually not be changed.
\item {\bf HardUpperLim } is the hardware upper limit. This is read from the motor controller and is identical to the limit switch welded to the instrument. Can usually not be changed.
\item {\bf SoftLowerLim } is the software lower limit. This can be defined by the user in order to restrict instrument movement in special cases.
\item {\bf SoftUpperLim } is the software upper limit. This can be defined by the user in order to restrict instrument movement in special cases.
\item {\bf SoftZero } defines a software zero point for the motor. All further movements will be in respect to this zeropoint.
\item {\bf Fixed } can be greater then 0 for the motor being fixed and less then
or equal to zero for the motor being movable.
\item {\bf InterruptMode } defines the interrupt to issue when the motor fails. Some motors are so critical for the operation of the instrument that all operations are to be stopped when there is a problem. Other are less critical. This criticallity is expressed in terms of interrupts, denoted by integers in the range 0 - 4 translating into the interrupts: continue, AbortOperation, AbortScan, AbortBatch and Halt. This parameter can usually only be set by
managers.
\item {\bf Precision } denotes the precision to expect from the motor in positioning. Can usually only be set by managers.
\item {\bf AccessCode } specifies the level of user privilege necessary to operate the motor. Some motors are for adjustment only and can be harmful to move once the adjustment has been done. Others must be moved for the experiment. Values are 0 - 3 for internal, manager, user and spy. This parameter can only be changed by managers.
\item {\bf Sign } reverses the operating sense of the motor.
For cases where electricians and not physicists have defined the operating sense of the motor. Usually a parameter not to be changed by ordinary users.
\end{itemize}
% html: End of file: `motor.htm'
% html: Beginning of file: `counter.htm'
\section{SICS counter handling}
\label{f14}
A counter in SICS is a controller which operates single neutron
counting tubes and monitors.
A counter can operate in one out of two modes: counting until a timer has
passed,
for example: count for 20 seconds. Counting in this context means that the noutrons coming in during these 20 seconds are summed together. This mode is called timer mode. In the other
mode, counting is continued until a specified neutron monitor has
reached a certain
preset value. This mode is called Monitor mode. The preset values in Monitor
mode are usually very large. Therefore the counter has an exponent data variable.
Values given as preset are effectively 10 to the power of this exponent. For
instance if the preset is 25 and the exponent is 6, then counting will be
continued until the monitor has reached 25 million. Note, that this scheme with
the exponent is only in operation in Monitor mode.
Again, in SICS the counter is an object which understands a set of
commands:
\begin{itemize}
\item {\bf countername SetPreset val } sets the counting preset to val.
\item {\bf countername GetPreset } prints the current preset value.
\item {\bf countername preset val} With a parameter sets the preset, without inquires the preset value. This is a duplicate of getpreset and setpreset which has been provided for consistency with other commands.
\item {\bf countername SetExponent val } sets the exponent for the counting
preset in monitor mode to val.
\item {\bf countername GetExponent } prints the current exponent used
in monitor mode.
\item {\bf countername SetMode val } sets the counting mode to val. Possible values are Timer for timer mode operation and Monitor for waiting for a monitor to reach a certain value.
\item {\bf countername GetMode } prints the current mode.
\item {\bf countername mode val} With a parameter sets the mode,
without inquires the mode value. This is a duplicate of getmode and
setmode which has been provided for consistency with other
commands. Possible values for val are either monitor or timer.
\item {\bf countername SetExponent val } sets the exponent for the counting
preset in monitor mode to val.
\item {\bf countername GetCounts } prints the counts gathered in the last run.
\item {\bf countername GetMonitor n } prints the counts gathered in the monitor number n in the last run.
\item {\bf countername Count preset } starts counting in the current mode and the the preset preset.
\item {\bf countername status } prints a message containing the preset and
the current monitor or time value. Can be used to monitor the progress of
the counting operation.
\item {\bf countername gettime } Retrieves the actual time the counter
counted for. This excludes time where there was no beam or counting was
paused.
\item {\bf countername getthreshold m} retrieves the value of the threshold
set for the monitor number m.
\item {\bf countername setthreshold m val} sets the threshold for monitor m
to val. WARNING: this also makes monitor m the active monitor for evaluating
the threshold. Though the EL7373 counterbox does not allow to select the
monitor to use as control monitor in monitor mode, it allows to choose
the monitor used for pausing the count when the count rate is below the
threshold (Who on earth designed this?)
\item {\bf countername send arg1 arg2 arg3 ...} sends everything behind
send to the counter controller and returns the reply of the counter
box. The command set to use after send is the command set documented
for the counter box elsewhere. Through this feature it is possible to
diretclly configure certain variables of the counter controller from
within SICS.
\end{itemize}
% html: End of file: `counter.htm'
% html: Beginning of file: `ctrl.htm'
\section{Serial Port Direct Access}
\label{f15}
At SINQ serial devices are connected to a Macintosh computer. This Mac runs
a serial port server which allows to read and write data through TCP/IP
sockets to a serial port connected to the Mac. This document describes a simple
interface for communicating with such serial devices.
\subsection{Invocation}
The interface to a serial device connected to a Mac is initialised with the
following command given at the Tcl prompt:\newline
{\em Controller name computer port channel}\newline
This command opens a connection to the serial port on the Mac and
installs a new command in order to interact with it. The parameters:
\begin{itemize}
\item name: is the name of the new command to generate for the connection in Tcl.
\item computer: is the computer name of the Macintosh.
\item port: is the TCP/IP port number at which the Macintosh
serial port server is is listening. Usually this is 4000.
\item channel: is the number of the RS-232 port to connect to.
\end{itemize}
\subsection{Usage}
Once the connection has been initialised name is available as a new command
in Tcl. Let us assume, MC as the name for the purpose of this description.
MC then can be used as follows:\newline
{\em MC -tmo value}\newline
Configures the timeout for the connection to value.
Value is in microseconds.\newline
{\em MC arg1 arg2 ..... argn}\newline
Everything after MC is written to the serial port. The reply received from
the port is returned.
All these commands can return errors. Mostly these refer to the wrong device
being specified on initialisation. The others are network problems.
% html: End of file: `ctrl.htm'
% html: Beginning of file: `system.htm'
\subsection{System Commands}
\label{f16}
{\bf Sics\_Exitus }. A single word commands which shuts the server down. Only Managers may use this command.
{\bf wait time } waits time seconds before the next command is executed. This does not stop other clients from issuing commands.
{\bf ResetServer } resets the server after an interrupt.
{\bf Dir } a single word command which lists all objects available in the SICS system in its current configuration.
{\bf status } A single word command which makes SICS print its current
status. Possible return values can be:
Eager to execute commands, Scanning, Counting, Running, Halted. Note that if a command is executing which takes some time to complete
the server will return an ERROR: Busy message when further commands are issued.
{\bf status interest} initiates automatic printing of any status change in the
server. This command is primarily of interest for status display client
implementors.
{\bf backup file} saves the current values of SICS variables and selected
motor and device parameters to the disk file specified as
parameter. If no file parameter is given the data is written to the
system default status backup file.
The format
of the file is a list of SICS commands to set all these parameters
again. The file is written on the instrument computer relative to the
path of the SICS server. This is usually /home/INSTRUMENT/bin.
{\bf restore file} reads a file produced by the backup command described
above and restores SICS to the state it was in when the status was saved with
backup. If no file argument is given the system default file gets
read.
% html: End of file: `system.htm'
% html: Beginning of file: `topscan.htm'
\section{The Scan Command }
\label{f17}
An important concept in neutron scattering instrument control is a
{\tt{}"{}}scan{\tt{}"{}}. For a simple scan a range of instrument positions is divided
into equidistant steps. The instrument then proceeds to drive to each
of these points and collects data at each of them.
The general idea of the scan object for TOPSI is, that you configure the
scan by typing commands at the command line. Once, the configuration is
finished the requested scan is started. A data file will be written
automatically to the default location. The scan command can not only scan
over motors but also about some variables which relate to motors. For
instance lamda for the wavelength. Scan can scan over more then one variable.
The syntax of the scan command in some detail:
\begin{description}
\item[scan clear] Clears current scan parameters.
\item[scan list] lists current scan parameters.
\item[ scan var name start step] Defines a variable (motor) to be scanned. The name of the variable, a
start value and a stpe width need to be given. More then one scan variable
can be specified.
\item[ scan modvar name start step] Modifies the scan parameters for scan variable name to the new values
given.
\item[scan getvars] Returns a list of currently active scan variables terminated with the
string -END-.
\item[ scan NP num ] Sets the number of scan points.
\item[ scan Preset val] Sets the Preset value for the scan. Without a parameter, inquires the
current value.
\item[ scan Mode val] Sets the count mode for the scan. Without a parameter, inquires the
current value. Possible values are Timer or Monitor.
\item[ scan run ] Executes the scan.
\item[scan cinterest] This call enables automatic printing of scan counts to your connection
when new values arise. This command is primariliy of interest for status display
clients.
\item[scan pinterest] This function makes the scan command send a notification (the string
ScanVarChange) to you whenever the scan variables get modified. This command
is primarily of interest for status display clients.
\end{description}
\subsection{ Center Scan }
Center scan is a convenience command which starts a scan around a specified
center value. This mostly used for centering purposes. The syntax is like this:
\begin{quotation}
cscan var center delta np preset\end{quotation}
All parameters must be specified. The parameters and their meanings:
\begin{itemize}
\item {\bf var} is the variable which is to be center scanned.
Only one can be specified.
\item {\bf center} is the value to use as center of the scan.
\item {\bf delta} is the step width to use for the scan.
\item {\bf np} is the number of points to scan in each direction.
\item {\bf preset} is the preset to use for the counter. As the counter mode,
the mode currently configured active in the scan object is used.
\end{itemize}
\subsection{ Simple Scan }
Simple scan is a convenience command which starts a scan for one to several
variables with a simplified syntax. The syntax is like this:
\begin{quotation}
sscan var1 start end var2 start end ... np preset\end{quotation}
All parameters must be specified. The parameters and their meanings:
\begin{itemize}
\item {\bf var1 start end} This is how the variables to scan are specified. For
each variable scanned the name of the
variable, the start value and the end value of the scan must be
given. More then one triplet
can be given in order to allow for several scan variables.
\item {\bf np} is the number of points to scan.
\item {\bf preset} is the preset to use for the counter. As the counter mode,
the mode currently configured active in the scan object is used.
\end{itemize}
\subsection{Peak And Center}
These two commands are related to the scan command insofar as they act upon
the results of the last scan still in memory. The command {\bf peak} prints
the position, FWHM and maximum value of the peak in the last scan. The
command {\bf center} drives the first scan variable to the peak center of the
last scan. Both peak and center use a rather simple but effective method for
locating peaks. The prerequisite is that the peak is approximatly
gaussian shaped. The
algorithm first locates the peak maximum. Then it goes to the left and
right of the maximum and tries to find the points of half maximum peak height.
The two points are interpolated from the data and the peak position
calculated as the middle point between the two halfheight points.
% html: End of file: `topscan.htm'
% html: Beginning of file: `config.htm'
\subsection{Configuration Commands}
\label{f18}
SICS has a command for changing the user rights of the current client server connection, control the amount of output a client receives and to specify additional logfiles where output will be placed. All this is accessed through the following commands:
The SICS server logs all its activities to a logfile, regardless of what the user requested. This logfile is mainly intended to help in server debugging. However, clients may register an interest in certain server events and can have them displayed. This facility is accessed via the {\bf GetLog } command. It needs to be stressed that this log receives messages from {\bf all } active clients. GetLog understands the following messages:
\begin{itemize}
\item {\bf GetLog All } achieves that all output to the server logfile is also written to the client which issued this command.
\item {\bf GetLog Kill } stops all logging output to the client.
\item {\bf GetLog OutCode } request that only certain events will be logged to the client issuing this command. Enables only the level specified. Multiple calls are possible.
\end{itemize}
Possible values for OutCode in the last option are:
\begin{itemize}
\item {\bf Internal } internal errors such as memory errors etc.
\item {\bf Command } all commands issued from any client to the server.
\item {\bf HWError } all errors generated by instrument hardware. The SICS server tries hard to fix HW errors in order to achieve stable operations and may not generate an error message if it was able to fix the problem. This option may be very helpful when tracking dodgy devices.
\item {\bf InError } All input errors found on any clients input.
\item {\bf Error } All error messages generated by all clients.
\item {\bf Status } some commands send status messages to the client invoking the command in order to monitor the state of a scan.
\item {\bf Value } Some commands return requested values to a user. These messages have an output code of Value.
\end{itemize}
The {\bf config } command configures various aspects of the current client server connection. Basically three things can be manipulated: The connections output class, the user rights associated with it, and output files.
\begin{itemize} \item The command {\bf config OutCode val } sets the output code for the connection. By default all output is sent to the client. But a graphical user interface client might want to restrict message to only those delivering requested values and error messages and suppressing anything else. In order to achieve this, this command is provided. Possible values Values for val are Internal,Command, HWError,InError,Status, Error, Value. This list is hierarchical. For example specifying InError for val lets the client receive all messages tagged InError, Status, Error and Value, but not HWError, Command and Internal messages.
\item Each connection between a client and the SICS server has user rights assocociated with it. These user rights can be configured at runtime with the command {\bf config Rights Username Password }. If a matching entry can be found in the servers password database new rights will be set.
\item Scientists are not content with having output on the screen. In order to
check results a log of all output may be required. The command {\bf config
File name } makes all output to the client to be written to the file
specified by name as well. The file must be a file accessible to the server,
i.e. reside on the same machine as the server. Up to 10 logfiles can be
specified. Note, that a directly connected line printer is only a special
filename in unix.
\item {\bf config close num} closes the log file denoted by num again.
\item {\bf config list} lists the currently active values for outcode and user
rights.
\end{itemize}
% html: End of file: `config.htm'
% html: Beginning of file: `trouble.htm'
\section{SICS Trouble Shooting }
\label{f19}
There is no such thing as bug free software. There are always bugs, nasty
behaviour etc. This document shall help to solve these problems. The usual
symptom will be that a client cannot connect to the server or the server is
not responding.
An essential prerequisite of SICS is that the server is up
and running. The system is configured to restart the SICServer whenever it
fails. Only after a reboot or when the keepalive processes were killed (see
below) the SICServer must be restarted. This is done for all instruments by
typing:
\begin{verbatim}
startsics
\end{verbatim}
at the command prompt. startsics actually starts two programs: one is
the replicator application which is responsible for the automatic
copying of data files to the laboratory server. The other is the SICS
server. Both programs are started by means of a shell script called
{\bf keepalive}. keepalive is basically an endless loop which calls
the program again and again and thus ensures that the program will
never stop running.
When the SICS server hangs, or you want to enforce an reinitialization of
everything the server process must be killed. This can be accomplished either manually or through a shell script.
\subsection{Stopping SICS}
All SICS processes can be stopped through the command:
\begin{verbatim}
killsics
\end{verbatim}
given at the unix command line. You must be the instrument user
(for example DMC) on the instrument computer for this to work properly.
\subsection{Finding the SICS server}
The first thing when killing the SICS server manually is to find the
server process.
Log in as Instrument user on the instrument computer (for instance DMC on
lnsa05). Type the command:
\begin{verbatim}
/home/DMC> ps -A
\end{verbatim}
Note the capital A given as parameter. The reward will be listing like this:
\begin{verbatim}
PID TTY S TIME CMD
0 ?? R 01:56:28 [kernel idle]
1 ?? I 1:24.44 /sbin/init -a
3 ?? IW 0:00.20 /sbin/kloadsrv
24 ?? S 40:39.58 /sbin/update
97 ?? S 0:04.87 /usr/sbin/syslogd
99 ?? IW 0:00.03 /usr/sbin/binlogd
159 ?? S 1:43.70 /usr/sbin/routed -q
285 ?? S 1:00.45 /usr/sbin/portmap
293 ?? S 6:03.45 /usr/sbin/ypserv
299 ?? I 0:00.37 /usr/sbin/ypbind -s -S psunix,lnsa05.psi.ch
307 ?? I 0:00.52 /usr/sbin/mountd -i
309 ?? I 0:00.07 /usr/sbin/nfsd -t8 -u8
311 ?? I 0:00.09 /usr/sbin/nfsiod 7
317 ?? S 5:51.54 /usr/sbin/automount -f /etc/auto.master -M /psi
370 ?? I 0:28.58 -accepting connections (sendmail)
389 ?? S 1:41.15 /usr/sbin/xntpd -g -c /etc/ntp.conf
419 ?? S 6:00.16 /usr/sbin/snmpd
422 ?? S 1:00.91 /usr/sbin/os_mibs
438 ?? S 34:29.67 /usr/sbin/advfsd
449 ?? I 3:16.29 /usr/sbin/inetd
482 ?? IW 0:11.53 /usr/sbin/cron
510 ?? IW 0:00.02 /usr/lbin/lpd
525 ?? I 5:31.67 /usr/opt/psw/psw_agent -x/dev/null -f/usr/opt/psw/psw_agent.conf
532 ?? I 0:00.74 /usr/opt/psw/psw_sensor_syswd 1 -x/dev/null
555 ?? I 0:00.58 /usr/bin/nsrexecd
571 ?? I 0:20.27 /usr/dt/bin/dtlogin -daemon
583 ?? S 1:38.27 lpsbootd -F /etc/lpsodb -l 0 -x 1
585 ?? IW 0:00.04 /usr/sbin/getty /dev/lat/620 console vt100
586 ?? IW 0:00.03 /usr/sbin/getty /dev/lat/621 console vt100
587 ?? I 35:59.85 /usr/bin/X11/X :0 -auth /var/dt/authdir/authfiles/A:0-aaarBa
657 ?? I 0:01.46 rpc.ttdbserverd
4705 ?? IW 0:00.05 dtlogin -daemon
9127 ?? I 0:00.37 /usr/bin/X11/dxconsole -geometry 480x150-0-0 -daemon -nobuttons -verbose -notify -exitOnFail -nostdin -bg gray
9317 ?? IW 0:00.73 dtgreet -display :0
14412 ?? S 0:39.71 netscape
15524 ?? I 0:00.57 rpc.cmsd
21678 ?? S 0:00.11 telnetd
31912 ?? S 0:10.65 /home/DMC/bin/SICServer /home/DMC/bin/dmc.tcl
584 console IW + 0:00.21 /usr/sbin/getty console console vt100
21978 ttyp1 S 0:00.63 -tcsh (tcsh)
22269 ttyp1 R + 0:00.10 ps -A
\end{verbatim}
This is a listing of all running processes on the machine where this command
has been typed. Note, in this case, at the bottom in the line starting with
{\tt 31912 ?? } an entry for the SICS server. In this example the server
is running. If the server is down, no such entry would be present.
\subsection{ Killing a hanging SICS server }
Suppose, the situation is that the SICS server does not respond anymore. It
needs to be forcefully exited. Please note, that it is always better to
close the server via the {\tt Sics\_Exitus} command typed with manager
privilege in one of the command clients. In order to kill the server it is
needed to find him first using the scheme given above. The information
needed is the number given as first item in the same line where the server
is listed. In this case: {\tt 31912}. Please note, that this number will
always be different. The command to force the server to stop is:
\begin{verbatim}
/home/DMC> kill -9 31912
\end{verbatim}
Note, the second parameter is the number found with {\tt ps -A}. The
SICServer will be restarted automatically by the system. Occasionally, it
may happen, that you cannot connect to the SICS server after such an
operation. This is due to some network buffering problems. Doing the killing
again usually solves the problem.
\subsection{ Shutting The SICS Server Down Completely}
This is done for you by the killsics shell script. Just type
\begin{verbatim}
killsics
\end{verbatim}
at the unix command line. Here is what killsics does for you:
In order to completely shutdown the SICS server two process must be killed:
the actual SICS server and the process which automatically restarts the
SICServer. The latter must be killed first. It can be found in the ps -A
listing as a line reading {\bf keepalive SICServer }. Kill that one as
described above, then kill the SICServer. For restarting SICS after this,
use the startsics command.
\subsection{Restart Everything}
If nothing seems to work any more, no connections can be obtained etc, then
the next guess is to restart everything. This is especially necessary if
mechanics or electronics people were closer to the instrument then 400 meters.
\begin{enumerate}
\item Reboot the Macintosh PC by switching it off at the silver button on the
left. Press deep and a few seconds to achieve an effect. The LED right to the
button should be off, before you press again to boot the Macintosh.
\item Reboot the histogram memory. It has a tiny button labelled RST. That' s
the one. Can be operated with a hairpin, a ball point pen or the like.
\item Wait 5 minutes. The Macintosh may take that time to come up again.
\item Restart the SICServer. Watch for any messages about things not being
connected or configured.
\item Restart and reconnect the client programs.
\end{enumerate}
If this fails (even after a second) time there may be a network problem which
can not be resolved by simple means.
\subsection{Getting New SICS Software}
Sometimes you might want to be sure that you have the latest SICS software.
This is how to get it:
\begin{enumerate}
\item Login to the instrument account.
\item If you are no there type cd to get into the home directory.
\item Type {\bf killsics} at the unix prompt in order to stop the SICS server.
\item Type {\bf sicsinstall exe} at the unix prompt for copying new
SICS software from the general distribution area.
\item Type {\bf startsics} to restart the SICS software.
\end{enumerate}
\subsection{Hot Fixes}
When there is trouble with SICS you may be asked by one of the SICS
programmers to copy the most recent development reason of the SICS server
to your machine. This is done as follows:
\begin{enumerate}
\item Login to the instrument account.
\item cd into the bin directory, for example: /home/DMC/bin.
\item Type {\bf killsics} at the unix prompt in order to stop the SICS server.
\item Type {\bf cp /data/koenneck/src/sics/SICServer .} at the unix prompt.
\item Type {\bf startsics} to restart the SICS software.
\end{enumerate}
{\bf !!!!!! WARNING !!!!!!!. Do this only when advised to do so by a competent
SICS programmer. Otherwise you might be copying a SICS server in an
instable experimental state!}
\subsection{ HELP debugging!!!!}
The SICS server hanging or crashing should not happen. In order to sort such
problems out it is very helpful if any available debugging information is
saved and presented to the programmers. Information available are the log
files as written continously by the SICS server and posssible core files
lying around. They have just this name: core. In order to save them create a
new directory (for example dump2077) and copy the stuff in there. This looks
like:
\begin{verbatim}
/home/DMC> mkdir dump2077
/home/DMC> cp log/*.log dump2077
/home/DMC> cp core dump2077
\end{verbatim}
The {\tt /home/DMC> } is just the command prompt. Please note, that core
files are only available after crashes of the server. These few commands
will help to analyse the cause of the problem and to eventually resolve it.
% html: End of file: `trouble.htm'
\end{document}