- Fixed SICS up to run with up to three TRICS detectors.

- added 150 detectors the default for FOCUS middle bank.
- added documentation for el734_test
This commit is contained in:
cvs
2001-02-09 16:04:46 +00:00
parent 96e2fc44c0
commit 5be8359212
24 changed files with 1842 additions and 224 deletions

View File

@ -1,5 +1,5 @@
#line 468 "histogram.w"
#line 469 "histogram.w"
/*---------------------------------------------------------------------------
H I S T D R I V
@ -13,7 +13,7 @@
#define MAXCHAN 4096
#line 81 "histogram.w"
#line 82 "histogram.w"
typedef struct __HistDriver {
/* configuration data */
@ -77,17 +77,17 @@
void *pPriv;
} HistDriver;
#line 480 "histogram.w"
#line 481 "histogram.w"
#line 238 "histogram.w"
#line 239 "histogram.w"
pHistDriver CreateHistDriver(pStringDict pDict);
void DeleteHistDriver(pHistDriver self);
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
SConnection *pCon);
#line 481 "histogram.w"
#line 482 "histogram.w"
#endif

View File

@ -1,5 +1,5 @@
#line 441 "histogram.w"
#line 442 "histogram.w"
/*--------------------------------------------------------------------------
H I S T M E M
@ -28,10 +28,11 @@
eHNormal,
eHTOF,
eHStrobo,
eHRPT
eHRPT,
ePSD
} HistMode;
#line 33 "histogram.w"
#line 34 "histogram.w"
typedef enum {
eOIgnore,
@ -40,22 +41,22 @@
eReflect
} OverFlowMode;
#line 461 "histogram.w"
#line 462 "histogram.w"
/*--------------------------------------------------------------------------*/
#line 302 "histogram.w"
#line 303 "histogram.w"
pHistMem CreateHistMemory(char *drivername);
void DeleteHistMemory(void *self);
#line 318 "histogram.w"
#line 319 "histogram.w"
int HistGetOption(pHistMem self, char *name, char *result, int iResultLen);
int HistSetOption(pHistMem self, char *name, char *value);
int HistConfigure(pHistMem self, SConnection *pCon, SicsInterp *pSics);
#line 346 "histogram.w"
#line 347 "histogram.w"
float GetHistPreset(pHistMem self);
int SetHistPreset(pHistMem self, float fVal);
@ -70,7 +71,7 @@
int HistBlockCount(pHistMem self, SConnection *pCon);
#line 375 "histogram.w"
#line 376 "histogram.w"
int SetHistogram(pHistMem self, SConnection *pCon,
int i,int iStart, int iEnd, HistInt *lData);
@ -79,7 +80,7 @@
HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
#line 410 "histogram.w"
#line 411 "histogram.w"
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
@ -88,7 +89,7 @@
int argc, char *argv[]);
#line 463 "histogram.w"
#line 464 "histogram.w"
#endif

View File

@ -1,5 +1,5 @@
#line 486 "histogram.w"
#line 487 "histogram.w"
/*---------------------------------------------------------------------------
H I S T M E M -- Internal
@ -11,7 +11,7 @@
#ifndef SICSHISTMEMINT
#define SICSHISTMEMINT
#line 260 "histogram.w"
#line 261 "histogram.w"
typedef struct __HistMem {
pObjectDescriptor pDes;
@ -29,7 +29,7 @@
int iUpdateIntervall;
} HistMem;
#line 496 "histogram.w"
#line 497 "histogram.w"
#endif

View File

@ -1,3 +1,3 @@
7647
7665
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n

723
doc/el734_test.tex Normal file
View File

@ -0,0 +1,723 @@
% [...DOC.SINQ]EL734_TEST.TEX - Ident 1D02
% ===========================
%%
%%====================================================================
%%
%% +--------------------------------------------------------------+
%% | Paul Scherrer Institute |
%% | SINQ Division |
%% | |
%% | This software may be used freely by non-profit organizations.|
%% | It may be copied provided that the name of P.S.I. and of the |
%% | author is included. Neither P.S.I. nor the author assume any |
%% | responsibility for the use of this software outside of P.S.I.|
%% +--------------------------------------------------------------+
%%
%% Project . . . . . . . . . . : SINQ
%% Brief Document Title . . . . : Description of EL734 Step Motor Test Prog
%% Author . . . . . . . . . . . : D.Maden
%% Date of creation . . . . . . : 29-Jan-1996
%%
%% Updates:
%% 13-Nov-1996 DM. Vn 1D02 of program.
%%====================================================================
%%
\documentclass[openbib,a4paper,twoside,11pt]{article}
\usepackage{array}
%
\addtolength{\textheight}{35mm}
\setlength{\textwidth}{160mm}
\setlength{\oddsidemargin}{8mm}
\setlength{\evensidemargin}{-10mm}
\setlength{\topmargin}{-20mm}
%
\setcounter{tocdepth}{2}
%
\newcommand{\pdp}{\protect\makebox[3.7em][l]{PDP-11}}
\newcommand{\uvax}{\protect\makebox[4.8em][l]{microVAX}}
%
\newcounter{two} \setcounter{two}{2}
\newcommand{\uvaxii}{\protect\makebox[5.8em][l]{microVAX~\Roman{two}}}
\newcounter{three} \setcounter{three}{3}
\newcommand{\uvaxiii}{\protect\makebox[6.2em][l]{microVAX~\Roman{three}}}
%
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\let\PBS=\PreserveBackslash % shorthand
%
% Define "\usc" to get a proper underscore!!
\newcommand{\usc}{\protect\makebox[0.6em]{\protect\rule{0.5em}{0.1ex}}}
%
\newcommand{\camac}{\protect\makebox[4.1em][l]{CAMAC}}
%
% Define insertplot is insert a PostScript plot.
% Usage:
% \insertplot{<file>}{<height>}{<left-margin>}
% Example:
% \insertplot{dvipsdoc.pal}{70mm}{5.0mm}
%
\def\insertplot#1#2#3{\par
\hbox{%
\hskip #3
\vbox to #2{
\vfil
\special{ps: plotfile #1}
}%
}
}
%
\title{EL734 Stepping Motor Test Program}
\author{D. Maden}
\date{12th November, 1996}
%
\begin{document}
\maketitle
\section{Introduction}
% ======================
%
This note describes the program {\bf el734{\usc}test}, which can be used to
test a stepping motor connected to an EL734 Stepping Motor Controller.
The current version of the program is {\em Ident 1D02}.
The program runs under either the Unix\footnote{So far, the program has been
tested only under the DEC version of Unix, i.e. {\em Digital Unix}.}
operating system or
the OpenVMS operating system. The program is normally invoked via a
simple command line from the console prompt and then runs to completion.
In the interests of simplicity, this note describes how to
run {\bf el734{\usc}test} on a Digital Unix workstation
when logged in as user ``lnsg''. It assumes that the shell being used
is {\em tcsh}. Once the correct environment has been defined, however,
the operation of the program is identical under both Unix and OpenVMS.
Notes specific to the OpenVMS implementation will be found in
Appendix~\ref{OpenVMS-Notes}.
%
\section{Hardware Configuration}
% ================================
%
Although other configurations are possible, it is assumed in this
description that the EL734 is connected via an asynchronous serial
line to a Macintosh (or PC) running a LabVIEW ``terminal server'' program.
This program is referred to as {\em TS} in the following. See ??? for
details of {\em TS}. A Description of how to start {\em TS} is given in
Appendix~\ref{TS-Notes}.
{\bf el734{\usc}test} accesses the EL734 via {\em TS} by
creating a TCP/IP network socket and opening a connection to it.
{\bf el734{\usc}test} is a so-called ``TCP/IP client'' and the LabVIEW
program
is a so-called ``TCP/IP server''. {\bf el734{\usc}test} buffers commands
for
the EL734 into packets which it sends to the terminal server via the socket.
The terminal server extracts the commands from each packet, executes them in
sequence and compiles the various responses from the EL734 into a response
packet which it then sends back to {\bf el734{\usc}test}. The details of
this
packet protocol are described elsewhere.
In order for {\bf el734{\usc}test} to be able to establish a connection to
the
terminal server, it is necessary to know the Internet host name
of the Macintosh or PC on which the terminal server program is running,
the Internet port number on which this program accepts
connections from its clients and the channel number of the asynchronous
serial line which is connected to the EL734.
The host name is usually indicated by a label on the Macintosh. The
following is the current list of LabVIEW host assignments:
%
\begin{center}\begin{tabular}{|c|c|c|c|} \hline
Host & Alias & Internet Address & Instrument \\
\hline
pswm18.psi.ch & lnsw02 & 129.129.90.18 & ? \\
? & lnsp22 & 129.129.90.172 & TOPSI \\
pswm60.psi.ch & lnsw15 & 129.129.90.60 & ? \\
\hline
\end{tabular}\end{center}
%
The default port number is 4000. The channel number is a small integer. A
value of zero for the channel number usually refers to
to the Macintosh's ``modem port''.
%
\section{Running {\bf el734{\usc}test}}
% =======================================
%
The startup files of the ``lnsg'' accounts are normally set up so that
{\bf el734{\usc}test} can be invoked merely by typing the command: \\[1.0ex]
%
\hspace*{20mm} \verb# el734_test [options ...]# \\[1.0ex]
%
A list of the options recognised by the program can be
obtained by issuing the command: \\[1.0ex]
%
\hspace*{20mm} \verb# el734_test -help# \\[1.0ex]
%
It generates the following information about the program:%
%
\begin{verbatim}
EL734 Motor Controller Test Program 1, Ident 1D02.
Started at Mon Nov 11 13:03:43 1996
My name is "el734_test"
Usage: el734_test [options ...]
Valid options are:
-help Generates this help text.
-? <option> Get detailed help on <option>.
-?res Get list of Xlib resources.
-?par Get help on EL734 parameters.
-host <host-name> Specify name of TCP/IP server.
-port <port-number> Specify its TCP/IP port number.
-chan <channel> Specify channel number of EL734.
-motor <index> Specify motor number (1 .. 12)
-id <device-id> Specify expected EL734 ID.
-tmo <secs> Specify time-out to wait for response.
-low <low-limit> Specify low limit for -ref, -step
and -rndm.
-high <high-limit> Specify high limit for -ref, -step
and -rndm.
-n <n-moves> Specify number of moves to make.
-seed <seed-value> Specify random number seed.
-verbose <wid> Specify "verbosity". Dflt = 10.
-wait <secs> Specify wait time between moves.
Parameter setting/saving options:
-limits <lo>/<hi> Set the Lo/Hi software limits.
-ur@ <pos> Set the current position to be <pos>.
-save <file> Read motor params and save to file.
-load <file> Read file and set motor params.
Positioning options:
-stop Stop the motor moving.
-position <target> Position the motor.
-random Perform <n-moves> random moves.
-saw Perform <n-moves> moves between -low
and -high
-step <step-size> Perform incremental moves from -low
to -high
-ff Fast forward to high software limit.
-fb Fast backward to low software limit.
-sf Slow forward to high software limit.
-sb Slow backward to low software limit.
-ref Perform reference seek.
-hunt Hunt for reference point.
-m is an abbreviation for -motor
-p is an abbreviation for -position
-lo is an abbreviation for -low
-hi is an abbreviation for -high
-rndm is an abbreviation for -random
-s is an abbreviation for -stop
No default is allowed for -host, -chan or -motor, i.e. values for
these parameters must be supplied either via a resource file or on
the command line. If <file> is specified as "-" or "=", standard
input or output will be used rather than a file.
When the program starts, the device identifier will be used to ensure
that an EL734 is being addressed. <device-id> defaults to "STPMC
EL734". Specifying "ignore" for <device-id> will suppress the ID
check.
The positioning options, i.e. -position, -ref, -hunt, -random, -saw,
-step, -ff, -fb, -sf and -sb are mutually exclusive. If neither a
positioning option nor a -save, -load, -stop, -ur@ nor -limits
option has been specified, "-save -" will be assumed.
Regardless of the order of options on the command line, -load will be
done before any positioning commands and -save will be done last.
A motor movement can be interrupted by hitting <Ctrl-C>.
\end{verbatim}%
%
\subsection{Options}
The various options recognised by the {\bf el734{\usc}test} program are
described in the following table. Note that the positioning options,
i.e. \verb#-position#, \verb#-ref#, \verb#-hunt#,
\verb#-random#, \verb#-saw#, \verb#-step#, \verb#-ff#, \verb#-fb#,
\verb#-sf# and \verb#-sb# as well as the \verb#-stop# option, are
mutually exclusive. If neither a positioning option nor a
\verb#-limits#, \verb#-save# nor \verb#-load# option
has been specified,
``\verb#-save -#'' will be assumed. \\[1.5ex]
%
\hspace*{3mm}\begin{tabular}{|p{40mm}@{}p{105mm}|} \hline
\verb#-? <option># & More detailed help about \verb#<option>#
will be given. \\ \hline
\verb#-?res# & Gives a list of option resource names. \\ \hline
\verb#-?par# & Gives a list of EL734 parameters. \\ \hline
\verb#-chan <channel># & \verb#<channel>#
specifies the serial port to which the EL734
is connected. There is no default. \\ \hline
\verb#-fb# & A {\em fb} (Fast-Backward) command will be sent to the motor.
The motor will move at full speed, with ramp, to
its lower software limit ({\em h} parameter). \\ \hline
\end{tabular}
\newpage
\hspace*{3mm}\begin{tabular}{|p{40mm}@{}p{105mm}|} \hline
\verb#-ff# & A {\em ff} (Fast-Forward) command will be sent to the motor.
The motor will move at full speed, with ramp, to
its upper software limit ({\em h} parameter). \\ \hline
\verb#-high <high-limit># & This option sets an upper limit for the
\verb#-random#, \verb#-saw#, and \verb#-step# options.
Its default is the
motor's upper software limit ({\em h} parameter). \verb#-high#
may be abbreviated to \verb#-hi#. \\ \hline
\verb#-host <host-name># & \verb#<host-name># specifies
the name of the host where {\em TS} is running. There is no
default. It may be specified as a name, e.g. {\em lnsw02}, or
as an Internet address, e.g. {\em 129.129.90.18}. \\ \hline
\verb#-hunt# & This will search for the motor's reference point and
then perform a \verb#-ref# operation. Refer
to Appendix~\ref{Hunting} for more information. \\ \hline
\verb#-id <device-id># & When {\bf el734{\usc}test} first starts, it sets
the EL734 into on-line mode and then sends an {\em id} command
to the controller. The response should begin with the characters
``STPMC EL734''. If, for some reason, the response to the {\em
id} command is expected to be something else, the \verb#-id#
option can be used to specify what is expected. Specifying
\verb#<device-id># as ``ignore'' will suppress the identifier
check. \\ \hline
\verb#-limits <lo>/<hi># & This option will set the motor's lower and
upper software limits ({\em h} parameters). The \verb#/# is
mandatory and no white space is permitted in the
\verb#<lo>/<hi># argument. \\ \hline
\verb#-load <file># & The file \verb#<file># is read and the motor
parameters are set accordingly. If \verb#<file># is specified
as ``\verb#-#'' or ``\verb#=#'', standard input is used as
the source of
parameter specifications. The \verb#-load# option is discussed
in more detail in Section~\ref{Load-Save}. \\ \hline
\verb#-low <low-limit># & This option sets a lower limit for the
\verb#-random#, \verb#-saw#, and \verb#-step# options.
Its default is the
motor's lower software limit ({\em h} parameter). \verb#-low#
may be abbreviated to \verb#-lo#. \\ \hline
\verb#-motor <index># & \verb#<index># is an integer between 1
and 12 specifying the motor to be used. There is no default.
\verb#-motor# may be abbreviated to \verb#-m#. \\ \hline
\verb#-n <n-moves># & This option sets the number of moves to be
performed by the \verb#-random# and \verb#-saw# options. The
default for \verb#<n-moves># is 5. \\ \hline
\verb#-port <port-number># & \verb#<port-number>#
specifies the TCP/IP port number which is being used by
{\em TS} to listen for connections.
The default is 4000. \\ \hline
\verb#-position <target># & The motor will be positioned to \verb#<target>#
and the program will wait until the final position
is reached. If \verb#<target># is outside the software limits
for the motor, a range error will be reported. If other errors
occur during the movement, they will also be reported.
\verb#-position# may be abbreviated to \verb#-p# \\ \hline
\verb#-random# & The motor will be positioned to random target positions
within the range specified by the \verb#-low# and \verb#-high#
options. The number of movements is specified by the \verb#-n#
option and the delay period between movements is specified by
the \verb#-wait# option. \verb#-random# may be abbreviated to
\verb#-rndm#. \\ \hline
\verb#-ref# & The motor will be positioned to its reference point. The
location of the reference point and the method used to reach it
are defined as part of the motor's parameter set. This option is
not available for motors with absolute encoders. \\ \hline
\end{tabular}
\newpage
\hspace*{3mm}\begin{tabular}{|p{40mm}@{}p{105mm}|} \hline
\verb#-save <file># & The motor's parameters will be read from the EL734
and saved into file \verb#<file># in a form which can be used
by the \verb#-load# option. If \verb#<file># is specified
as ``\verb#-#'', the list of parameters is written to standard
output. The \verb#-save# option is discussed in
more detail in Section~\ref{Load-Save}. \\ \hline
\verb#-saw# & The motor will be positioned alternately to the positions
specified by the \verb#-low# and \verb#-high# options. The
\verb#-n# and \verb#-wait# options have the same meaning as
for the \verb#-random# option. \\ \hline
\verb#-sb# & A {\em sb} (Slow-Backward) command will be sent to the motor.
The motor will move at its start/stop speed to
its lower software limit ({\em h} parameter). \\ \hline
\verb#-seed <seed-value># & The random number generator used to generate
random wait times and random positions is itself, by default,
initialised with a random seed derived from the time of day. A
specific random number sequence can be achieved by specifying an
integer seed value via the \verb#-seed# option. \\ \hline
\verb#-sf# & A {\em sf} (Slow-Forward) command will be sent to the motor.
The motor will move at its start/stop speed to
its upper software limit ({\em h} parameter). \\ \hline
\verb#-step <step-size># & If \verb#<step-size># is positive, the
motor will be positioned to the position specified by the
\verb#-low# option and then moved in steps of size
\verb#<step-size># until the position specified by the
\verb#-high# option is reached or would be exceeded. If
\verb#<step-size># is negative, the motor will first be
positioned to \verb#-high# and then stepped downwards. The
\verb#-n# and \verb#-wait# options have the same meaning as
for the \verb#-random# option.\\ \hline
\verb#-stop# & An {\em s} (Stop) command will be sent to the
motor. \\ \hline
\verb#-tmo <secs># & The \verb#-tmo# option specifies the time-out to be
used in waiting for a response to a command sent to the EL734.
The default is 5 seconds unless the \verb#-ref# or
\verb#-hunt# option is
specified, in which case it is 30 seconds. \verb#<secs># may
be specified as a fixed point number. Only 1 decimal place
is significant and the
maximum is 999.9. A negative value (not recommended) will
cause the server to wait
for ever and a value of zero
will cause the server not to wait at all. \\
~ & {\bf Note:} the value of the \verb#-tmo# option is {\em not}
related to the time required for the motor to complete its
motion. It relates to the time which the motor requires to
free itself from an end-stop or to perform the final seek
of its reference point.\\ \hline
\verb#-ur@ <pos># & This option (you-are-at) will set the motor's current
position to be \verb#<pos># via the {\em uu} command. \\ \hline
\verb#-verbose <wid># & Specify the {\em verbosity} (default = 10). During
any motor movement, an updating display of the current motor
position is generated in a field of width \verb#<wid>#.
If \verb#<wid># is set to zero, this updating display
is suppressed. If \verb#<wid># is too small,
odd results are obtained! \\ \hline
\verb#-wait <secs># & \verb#<secs># is an integer specifying the time
to wait between movements performed by the \verb#-random#,
\verb#-saw# and \verb#-step# commands. If \verb#<secs># is
zero, no wait is performed. If it is negative, a random wait
time between 1 and \verb#-<secs># seconds is performed. \\
\hline
\end{tabular}
\newpage
\section{Loading and Saving Motor Parameters}
% =============================================
\label{Load-Save}
The \verb#-load# and \verb#-save# options are used for loading a motor's
parameters from a file and saving a motor's parameters to a file,
respectively. An example of a file generated via the \verb#-save# option
and suitable for use by the \verb#-load# option is shown in
Appendix~\ref{Save-File}.
The best way to create a file for the \verb#-load# option is
to use the \verb#-save# option to create it and then to modify it with one's
favourite editor. For normal use, this should suffice. The following details
are intended as an aid to anyone who wishes to use {\bf el734{\usc}test}
interactively via the ``\verb#-load -#'' option.
The format of records in the load file should be of the form: \\[1.0ex]
%
\hspace*{20mm} \verb# <cmnd> [%d] [<par1>] [<par2>] [! Comments ...]# %
\\[1.0ex]
where items in square brackets are optional depending on \verb#<cmnd>#.
\verb#<cmnd># is one of the commands accepted by the EL734. It may also
be {\em wait}, {\em exit} or {\em quit}. If \verb#%d# is present, it
will be substituted with the motor number as specified via the
\verb#-motor# option.
Specifying \verb#<cmnd># to be either {\em exit} or {\em quit} will cause
{\bf el734{\usc}test} to exit\footnote{End-of-file will also cause {\bf
el734{\usc}test} to exit. Note that, if commands are being read from the
terminal, end-of-file is indicated by $<$Ctrl-D$>$ on a Unix system, {\em
not} $<$Ctrl-Z$>$.}. The value {\em wait}
will cause {\bf
el734{\usc}test} to wait until the motor specified via the \verb#-motor#
option is idle.
{\bf el734{\usc}test} also recognises the special status reading commands
{\em msr} and {\em ss}. In these cases the program tests the various status
bits in the response from the EL734 and displays appropriate messages.
Some of the EL734 commands, in particular the {\em fm} and {\em fd}
commands, cause the motor position to be reset to zero. For this reason,
{\bf el734{\usc}test} reads the motor position just before starting a load
operation and attempts to set this position again using the {\em uu}
command when the load operation is completed. If however, {\bf
el734{\usc}test} detects any motor commands which may cause the motor to
move, this resetting of the motor position is suppressed.
Note that {\bf el734{\usc}test} is not able to handle commands to the
EL734 which generate multiple output records such as the {\em cfg},
{\em ?}, {\em ?c}, {\em ?m} or {\em ?p} commands.
%
\section{Examples}
% ==================
%
The following are a few examples of using {\bf el734{\usc}test}. For
clarity, it is assumed that the following alias has been defined: \\[1.0ex]
%
\hspace*{20mm}%
\verb#alias do_el734 "el734_test -host lnsw15 -chan 5 -motor 4"#%
\\[1.0ex]
%
so that all the following examples will operate on Motor 4 of the EL734
connected to Channel 5 of the {\em Terminal Server} \verb#lnsw15#.
\begin{itemize}
\item[$>$] \verb#do_el734#\\
This will read the status of the motor and display it on the terminal.
\item[$>$] \verb#do_el734 -save m4_params#\\
This will read all the motor's parameters and save them in file
\verb#m4_params# in the current directory.
\item[$>$] \verb#do_el734 -p 150.4#\\
This will position the motor to 150.4 and wait until it has stopped
moving.
\item[$>$] \verb#do_el734 -n 100 -wait -20 -lo 20 -hi 80 -rndm#\\
This will perform 100 random movements of the motor in the range from 20
to 80. After each movement, the program will wait for a randomly
selected interval of up to 20 seconds.
\end{itemize}
To test several motors simultaneously, {\bf el734{\usc}test} may be started
from several terminals at the same time. In this case, one should be careful
not to drive the same motor simultaneously
from more than one copy of the program!
%
\section{Setup for {\bf el734{\usc}test}}
% =========================================
%
\subsection{Resource Database}
\label{resources}
%
In addition to specifying options for {\bf el734{\usc}test} on the command
line, it is possible to set them in a so-called ``resource database''
in a manner similar to that used by the X-window software package. In order
to do this, it is first necessary to know the name of the resources
associated with the various options. The following list of resource names
is obtained via the \verb#-?res# option:%
\begin{verbatim}
The correspondence between options and resource names is as follows:
Option Equivalent resource name
====== ========================
-? *el734HelpItem
-?res *el734HelpRes
-?par *el734HelpPar
-chan *el734Chan
-fb *el734Fb
-ff *el734Ff
-help *el734Help
-high *el734High
-host *el734Host
-hunt *el734Hunt
-id *el734Id
-limits *el734Limits
-load *el734Load
-low *el734Low
-motor *el734Motor
-n *el734N
-port *el734Port
-position *el734Position
-random *el734Random
-ref *el734Ref
-save *el734Save
-saw *el734Saw
-sb *el734Sb
-seed *el734Seed
-sf *el734Sf
-step *el734Step
-stop *el734Stop
-tmo *el734Tmo
-wait *el734Wait
\end{verbatim}%
%
When {\bf el734{\usc}test} is started, it scans several files to compile
its resource database. On Unix systems, these files, in order of decreasing
precedence, are: \\[1.0ex]
%
\hspace*{20mm} \verb#~/SinQ_rc#\\
\hspace*{20mm} \verb#/usr/lib/X11/app-defaults/SinQ_rc#\\
\hspace*{20mm} \verb#~/.Xdefaults#\\
\hspace*{20mm} \verb#/usr/lib/X11/app-defaults/Xdefaults#\\[1.0ex]
%
Any options specified on the command line supersede specifications in any of
these files. As an example, the host on which the terminal server program
is running could be specified by including the record: \\[1.0ex]
%
\hspace*{20mm} \verb#*el734Host: lnsw15#\\[1.0ex]
%
in one of the resource database files listed above. It would then not be
necessary to specify the \verb#-host# option on the command line.
Other defaults could be set similarly by using the appropriate resource
names as specified in the above table.
%
\subsection{Paths and Aliases}
%
The compiled and linked version of {\bf el734{\usc}test} is located
in directory \verb#~maden/motor#. There is a
symbolic link to this file from \verb#/public/bin/el734_test#.
The directory \verb#/public/bin# should be included in the default path
of the ``lnsg'' account by including a statement of the form: \\[1.0ex]
%
\hspace*{20mm} \verb#set path = ( $path /public/bin )#\\[1.0ex]
%
in the file \verb#~lnsg/.cshrc#. Actually, on the SINQ data acquisition
computers, \verb#~lnsg/.cshrc# is set up so that it invokes
the system startup script, \verb#~/.cshrc#, and this is where
\verb#~/public/bin# is added to the default path.
It is clearly a simple matter to define an alias to facilitate usage of the
program. For example: \\[1.0ex]
%
\hspace*{20mm} %
\verb#alias xxx "el734_test -host lnsw15 -chan 5 -m 6"#
%
\newpage
\appendix
\section{Notes on the OpenVMS Version of {\bf el734{\usc}test}}
\label{OpenVMS-Notes}
On OpenVMS systems, {\bf el734{\usc}test} compiles its resource database
from the following files, in order of decreasing precedence: \\[1.0ex]
%
\hspace*{20mm} \verb#decw$user_defaults:SinQ_rc.dat#\\
\hspace*{20mm} \verb#decw$group_defaults:SinQ_rc.dat#\\
\hspace*{20mm} \verb#decw$system_defaults:SinQ_rc.dat#\\
\hspace*{20mm} \verb#decw$user_defaults:decw$xdefaults.dat#\\
\hspace*{20mm} \verb#decw$group_defaults:decw$xdefaults.dat#\\
\hspace*{20mm} \verb#decw$system_defaults:decw$xdefaults.dat#\\[1.0ex]
%
{\bf el734{\usc}test} should be run via a so-called {\em DCL foreign
command}. Assuming that the executable image of {\bf el734{\usc}test} is in
directory \verb#psi_public:[exe_axp]#,
one would do this via the DCL command:
\\[1.0ex]
\hspace*{20mm} \verb#$ el734_test :== $psi_public:[exe_axp]el734_test#\\[1.0ex]
%
located in one's \verb#login.com# file. The program can then be run
exactly as on a Unix system.
%
\vspace*{40mm}
\section{Notes on the LabVIEW Terminal Server Program}
\label{TS-Notes}
The LabVIEW terminal server program is set up so that it automatically runs
when it is started. It is therefore sufficient to double-click on its icon
with the Macintosh \verb#finder# to get the program to run. The terminal
server program is located in directory: \\[1.0ex]
%
\hspace*{20mm} \verb#System Utilities:LabVIEW 3.1.1:Users:# \\
\hspace*{40mm} \verb#A SerPortServer:A Main Server.vi# \\[1.0ex]
%
The Macintosh is also usually configured so that there is an alias of the
terminal server program in the start-up directory. The program then starts
to run automatically whenever the Macintosh is powered up.
%
\newpage
\section{An Example of a Motor Parameter File}
\label{Save-File}
The following is an example of a file generated by the \verb#-save# option.
This file is suitable for use by the \verb#-load# option. Records beginning
with \verb#!# are ignored by \verb#-load#.
Note that the {\em ec} command is not supported prior to Version~1.0
of the EL734 controller firmware.
\begin{verbatim}
! EL734 Status at Fri Nov 8 09:56:24 1996
! ============
! Controller ID = "STPMC EL734 V1.0 FFF"
! Server lnsp22, Port 4000, Channel 5, Motor 6
!
mn %d TOPSI_6_STT ! Motor name
ec %d 0 0 ! Zero the encoder mapping
ec %d 1 6 ! Encoder mapping (type/number)
a %d 2 ! Precision
fd %d -100 1 ! Encoder gearing (numer/denom)
fm %d 200 1 ! Motor gearing (numer/denom)
d %d 0.1 ! Inertia tolerance
e %d 7 ! Start/stop ramp (kHz/sec)
f %d 1 ! Open loop/Closed loop (0/1)
g %d 300 ! Start/stop frequency (Mot-S/sec)
h %d 1.00 38.00 ! Low/High Software Limits
j %d 2000 ! Top speed (Mot-S/sec)
k %d -1 ! Reference mode
! -11 = LoLim+Index is ref. pt.
! -1 = LoLim is ref. pt.
! 0 = Abs encoder
! 1 = HiLim is ref. pt.
! 2 = Separate ref. pt.
! 11 = HiLim+Index is ref. pt.
! 12 = Separate+Index ref. pt.
l %d 0 ! Backlash/Spielausgleich (Mot-S)
m %d 3 ! Position tolerance (Enc-Steps)
q %d 99.0 ! Reference switch width
t %d 0 ! One-sided operation flag (0 = no)
v %d 0.00 ! Null point
w %d 0 ! Air-cushion dependency
z %d 0 ! Circumf. of encoder (Enc-Steps)
mem %d 0.0/38.7 ! User data register
!
! # of positionings, SP = 41
! # of positioning faults, ST = 0
! # of positioning failures, SR = 0
! # of air-cushion failures, SA = 0
!
! Current position is 20.00
! Status, MSR = Idle.
! Flags, SS = 0
! Input status is "off".
\end{verbatim}
%
\newpage
\section{The Reference Point Search Algorithm}
\label{Hunting}
The procedure used by the \verb#-hunt# option for searching for a
motor's reference point depends on the
setting of the {\em k} parameter. The following table describes the
various search algorithms\\[3.0ex]
%
\begin{tabular}%
{|c%
|>{\PBS\raggedright\hspace{0pt}}p{30mm}%
|>{\PBS\raggedright\hspace{0pt}}p{105mm}|}
\hline
{\bf K} & {\bf Type} & {\bf Algorithm} \\ \hline \hline
0 & Absolute encoder & \verb#-hunt# is not supported. \\ \hline
-1 & Low-limit switch is reference point &
The value of the {\em q} parameter (reference-point width) is read and
checked to be greater than zero.
The {\em h} and {\em v} parameters (software limits and zero-point) are
read and checked to be consistent. If the {\em v} parameter is greater
than the low software limit, a warning is displayed but this is not
considered to be a fatal error.
The {\em h} parameters are set to large values and the current position
is set to zero ({\em uu} command).
The motor is then driven to
its low-limit switch via an {\em fb} (fast-backward) command.
The program waits until the motor stops moving. If no \verb#-tmo# option
has been specified, a time-out of 30 seconds is used for this operation.
The motor status is then checked
to ensure that the low-limit switch was reached. It also
checks the {\em ss} status to ensure that the reference point (LSX)
is not active. If all checks are successful,
the current position is set to the value of the {\em v} parameter
via the {\em uu} command, the software limits are restored and a
reference seek is initiated via the {\em rf} command. The program
again waits until the motor stops moving and checks the motor status to
ensure that the reference seek was successful. The motor is finally
positioned to its lower software limit, if this is greater than {\em v}.
\\ \hline
1 & High-limit switch is reference point &
This is analogue to the K~=~-1 case. \\ \hline
2 & Separate reference point &
The {\em q}, {\em h} and {\em v} parameters are checked as in the
K~=~-1 case. A warning is issued if the zero-point is outside
the software limits but this is not treated as a fatal error.
The motor is then driven backwards in steps with a step-size equal to
95\% of the {\em q} parameter until a position is found where the
reference-point (LSX) is active or the low-limit is reached. If the
lower-limit is reached, the motor is re-positioned to its start position
and it is then stepped forward to its high-limit. Assuming the
reference-point is eventually found,
the current position is set to the value of the
{\em v} parameter via the {\em uu} command, the software limits are
restored and a reference seek is initiated via the {\em rf} command.
\\ \hline
\end{tabular}
\\[5.0ex]
\begin{tabular}%
{|c%
|>{\PBS\raggedright\hspace{0pt}}p{80mm}%
|>{\PBS\raggedright\hspace{0pt}}p{54mm}|}
\hline
{\bf K} & {\bf Type} & {\bf Algorithm} \\ \hline \hline
-11 & Low-limit switch is reference point with reference
mark on encoder & Same as K~=~-1 \\ \hline
11 & High-limit switch is reference point with reference
mark on encoder & Same as K~=~1 \\ \hline
12 & Separate reference point with reference
mark on encoder & Same as K~=~2 \\ \hline
\end{tabular}
\end{document}

View File

@ -315,6 +315,143 @@ extern int close(int fp);
}
return 1; /* success, finally */
}
/*------------------------------------------------------------------------*/
int SINQHMConfigurePSD(pSINQHM self, int iMode,
int xSize, int xOff, int xFac,
int ySize, int yOff, int yFac,
int iBinWidth,
float *iEdges, int iEdgeLength)
{
int status, iRet;
struct req_buff_struct Req_buff;
struct rply_buff_struct Rply_buff;
int iLength, i, iDelay;
unsigned int iExtra;
char *pBuffer = NULL, *pPtr;
struct tof_edge_arr tea;
int iTeaLength;
struct tof_bank toba;
assert(self);
/* set up detector bank information. This code supports only
one detector bank as of now. Which is appropriate for the
detector at hand.
*/
self->iBinWidth = iBinWidth;
SINQHMDefineBank(self,0,0,xSize*ySize,
iEdges,iEdgeLength);
/* figure out how long we are going to be*/
iLength = 36 + self->iBanks*sizeof(struct tof_bank);
for(i = 0; i < self->iBanks; i++)
{
iLength += 8 + self->pBank[i].iEdgeLength*sizeof(SQint32);
}
if(iLength < 64)
iLength = 64;
/* allocate send buffer */
pBuffer = (char *)malloc(iLength*sizeof(char));
if(!pBuffer)
{
return HIST_BAD_ALLOC;
}
memset(pBuffer,0,iLength);
/* do the message header */
iExtra = iLength - sizeof(Req_buff);
if(iExtra < 0)
iExtra = 0;
iDelay = self->pBank[0].iEdges[0];
Req_buff.bigend = htonl (0x12345678);
Req_buff.cmnd = htonl (SQHM_CONFIG);
Req_buff.u.cnfg.mode = htonl (iMode);
Req_buff.u.cnfg.u.psd.n_extra_bytes = htonl (iExtra);
Req_buff.u.cnfg.u.psd.n_edges = htons (1);
Req_buff.u.cnfg.u.psd.n_banks = htons (1);
Req_buff.u.cnfg.u.psd.xOffset = htons (xOff);
Req_buff.u.cnfg.u.psd.yOffset = htons (yOff);
Req_buff.u.cnfg.u.psd.xFactor = htons (xFac);
Req_buff.u.cnfg.u.psd.yFactor = htons (yFac);
Req_buff.u.cnfg.u.psd.xSize = htons (xSize);
Req_buff.u.cnfg.u.psd.ySize = htons (ySize);
Req_buff.u.cnfg.u.psd.preset_delay = htonl((int)iEdges[0]);
memcpy(pBuffer,&Req_buff,36);
pPtr = pBuffer + 36;
/* do the edge thingies */
for(i = 0; i < self->iBanks; i++)
{
tea.n_bins = htonl(self->pBank[i].iEdgeLength-1);
if(self->pBank[i].iEdgeLength == 2)
{
tea.flag = htonl(0);
}
else
{
tea.flag = htonl(1);
}
tea.edges = self->pBank[i].iEdges;
memcpy(pPtr,&tea,8);
pPtr += 8;
iTeaLength = self->pBank[i].iEdgeLength*4;
memcpy(pPtr,self->pBank[i].iEdges,iTeaLength);
pPtr += iTeaLength;
}
/* do the swiss bank structures */
for(i = 0; i < self->iBanks; i++)
{
toba.first = htons(self->pBank[i].iStart);
toba.n_cntrs = htons(self->pBank[i].iEnd);
toba.edge_indx = htons(i);
toba.bytes_per_bin = htons(self->iBinWidth);
memcpy(pPtr,&toba,sizeof(struct tof_bank));
pPtr += sizeof(struct tof_bank);
}
/* all packed up neat and nicely, send it */
/* try, get a connection to master server */
status = OpenMasterConnection(self);
if(status < 0)
{
if(pBuffer)
free(pBuffer);
return status;
}
/* send request */
status = send(self->iMasterSocket,pBuffer,iLength ,0);
if(pBuffer)
{
free(pBuffer);
}
if(status == -1)
{
return SEND_ERROR;
}
/* get a reply */
iRet = GetMasterReply(self,&Rply_buff,sizeof(Rply_buff));
if(iRet < 0)
{
/* try close the socket */
close(self->iMasterSocket);
self->iMasterSocket = 0;
return iRet;
}
else
{
/* close the socket */
status = close(self->iMasterSocket);
self->iMasterSocket = 0;
if((status != 0) && (errno != ECONNRESET))
{
return CLOSE_ERROR;
}
}
return 1; /* success, finally */
}
/*------------------------------------------------------------------------*/
int SINQHMDeconfigure(pSINQHM self, int iHarsh)
{
@ -1272,26 +1409,39 @@ extern int close(int fp);
free(pWork->iEdges);
pWork->iEdges = NULL;
}
iDelay = (int)iEdges[0];
pWork->iStart = iStart;
pWork->iEnd = iEnd;
pWork->iEdgeLength = iEdgeLength;
if(iEdgeLength == 2)
{
{ /*
fixed binwidth: two values required: start stop in
edge[0], edge[1]
*/
pWork->iFlag = 0;
}
else
pWork->iDelay = iDelay;
pWork->iEdges = (unsigned int *)malloc(2*sizeof(unsigned int));
if(!pWork->iEdges)
{
return HIST_BAD_ALLOC;
}
pWork->iEdges[0] = htonl((unsigned int)iEdges[0]);
pWork->iEdges[1] = htonl((unsigned int)(iEdges[1] - iDelay));
return 1;
}
/*
normal case: create the bin boundaries
*/
pWork->iFlag = 1;
pWork->iEdgeLength++;
iEdgeLength++;
}
pWork->iEdges = (unsigned int *)malloc(iEdgeLength *
sizeof(unsigned int));
if(!pWork->iEdges)
{
return HIST_BAD_ALLOC;
}
iDelay = iEdges[0];
pWork->iDelay = iDelay;
for(i = 0; i < iEdgeLength-1; i++)
{
@ -1361,14 +1511,6 @@ extern int close(int fp);
tofi.preset_delay = htonl(self->pBank[0].iDelay);
memcpy(pPtr,&tofi,12);
pPtr += 12;
/*
Req_buff.u.cnfg.u.tof.n_extra_bytes = htonl(iExtra);
Req_buff.u.cnfg.u.tof.n_edges = htons((short int)self->iBanks);
Req_buff.u.cnfg.u.tof.n_banks = htons((short int)self->iBanks);
Req_buff.u.cnfg.u.tof.preset_delay = htonl(self->pBank[0].iDelay);
memcpy(pBuffer,&Req_buff,24);
pPtr = pBuffer + 24;
*/
/* do the edge thingies */
for(i = 0; i < self->iBanks; i++)

View File

@ -1,5 +1,5 @@
#line 317 "sinqhm.w"
#line 346 "sinqhm.w"
/*---------------------------------------------------------------------------
S I N Q H M
@ -17,7 +17,7 @@
typedef struct __SINQHM *pSINQHM;
/*------------------------------ Error codes -----------------------------*/
#line 295 "sinqhm.w"
#line 324 "sinqhm.w"
#define HMCOMPUTER_NOT_FOUND -2
#define SOCKET_ERROR -3
@ -39,26 +39,32 @@
#define DAQ_INHIBIT -19
#define DAQ_NOTSTOPPED -20
#line 333 "sinqhm.w"
#line 362 "sinqhm.w"
/*------------------------------ Prototypes ------------------------------*/
#line 113 "sinqhm.w"
#line 118 "sinqhm.w"
pSINQHM CreateSINQHM(char *pHMComputer, int iMasterPort);
pSINQHM CopySINQHM(pSINQHM self);
void DeleteSINQHM(pSINQHM self);
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
#line 133 "sinqhm.w"
#line 142 "sinqhm.w"
int SINQHMError2Text(int iErr, char *pBuffer, int iBufLen);
#line 146 "sinqhm.w"
#line 155 "sinqhm.w"
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
int iBinWidth, int iLowBin, int iCompress);
int SINQHMConfigurePSD(pSINQHM self, int iMode,
int xSize, int xOff, int xFac,
int ySize, int yOff, int yFac,
int iBinWidth,
float *iEdges, int iEdgeLength);
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,
@ -68,7 +74,7 @@
int SINQHMKill(pSINQHM self);
#line 232 "sinqhm.w"
#line 261 "sinqhm.w"
int SINQHMOpenDAQ(pSINQHM self);
int SINQHMCloseDAQ(pSINQHM self);
@ -85,14 +91,14 @@
void *pData, int iDataLen);
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
#line 336 "sinqhm.w"
#line 365 "sinqhm.w"
#line 204 "sinqhm.w"
#line 232 "sinqhm.w"
int SINQHMDefineBank(pSINQHM self, int iBankNumber, int iStart, int iEnd,
float *iEdges, int iEdgeLength);
#line 337 "sinqhm.w"
#line 366 "sinqhm.w"
#endif

View File

@ -30,6 +30,9 @@
int iRank;
int iPacket;
int iBanks;
int xSize, ySize;
int xOff, xFac;
int yOff, yFac;
SBank pBank[MAXBANK];
} SINQHM;

View File

@ -53,7 +53,7 @@ This information is kept in a bank data structure:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap1}
$\langle$SBank {\footnotesize 2a}$\rangle\equiv$
$\langle$SBank {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -90,7 +90,7 @@ the lower edges of all time bins.
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap2}
$\langle$SType {\footnotesize 2b}$\rangle\equiv$
$\langle$SType {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -105,6 +105,9 @@ $\langle$SType {\footnotesize 2b}$\rangle\equiv$
\mbox{}\verb@ int iRank;@\\
\mbox{}\verb@ int iPacket;@\\
\mbox{}\verb@ int iBanks;@\\
\mbox{}\verb@ int xSize, ySize;@\\
\mbox{}\verb@ int xOff, xFac;@\\
\mbox{}\verb@ int yOff, yFac;@\\
\mbox{}\verb@ SBank pBank[MAXBANK];@\\
\mbox{}\verb@ } SINQHM;@\\
\mbox{}\verb@@$\diamond$
@ -112,7 +115,7 @@ $\langle$SType {\footnotesize 2b}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 2bc.
\item Macro defined by scraps ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -122,7 +125,9 @@ computer, the second the port number at which the master server is
listening. iClientPort defines a port for data communication. If no such
port is open, this value will be 0. iStatus is a status flag. iBanks is the
number of detector banks defined. pSBank is an array of bank data structures
describing the detector banks. In order to
describing the detector banks.
xOff, xFac and yOff and yFac are the offset and factor values needed for
the PSD calculation for TRICS and AMOR. In order to
maintain this data structure two functions are defined:
\section{Byte swapping}
@ -132,7 +137,7 @@ types for your compiler and computer.
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap3}
$\langle$SType {\footnotesize 2c}$\rangle\equiv$
$\langle$SType {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -144,14 +149,14 @@ $\langle$SType {\footnotesize 2c}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 2bc.
\item Macro defined by scraps ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap4}
$\langle$Protos {\footnotesize 3a}$\rangle\equiv$
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -159,12 +164,14 @@ $\langle$Protos {\footnotesize 3a}$\rangle\equiv$
\mbox{}\verb@ pSINQHM CopySINQHM(pSINQHM self);@\\
\mbox{}\verb@ void DeleteSINQHM(pSINQHM self); @\\
\mbox{}\verb@ void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);@\\
\mbox{}\verb@ void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,@\\
\mbox{}\verb@ int ySize, int yOff, int yFac);@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 3abc, 6a.
\item Macro defined by scraps ?, ?, ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -175,6 +182,8 @@ mentioned above for the description of the data structure. DeleteSINQHM
frees all memory associated with a SINQHM structure given by self. The
pointer to self is invalid ever afterwards.
CopySINQHM creates a copy of the SINQHM structure passed in with self.
SINQHMSetPar sets time of flight parameters.
SINQHMSetPSD defines PSD parameters for TRICS/AMOR type detectors.
\section{SINQHM error handling}
If not denoted otherwise all public SINQHM functions return an integer 1 on
@ -184,7 +193,7 @@ call to:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap5}
$\langle$Protos {\footnotesize 3b}$\rangle\equiv$
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -194,7 +203,7 @@ $\langle$Protos {\footnotesize 3b}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 3abc, 6a.
\item Macro defined by scraps ?, ?, ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -210,12 +219,17 @@ needed:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap6}
$\langle$Protos {\footnotesize 3c}$\rangle\equiv$
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@ int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength, @\\
\mbox{}\verb@ int iBinWidth, int iLowBin, int iCompress);@\\
\mbox{}\verb@ int SINQHMConfigurePSD(pSINQHM self, int iMode,@\\
\mbox{}\verb@ int xSize, int xOff, int xFac,@\\
\mbox{}\verb@ int ySize, int yOff, int yFac,@\\
\mbox{}\verb@ int iBinWidth, @\\
\mbox{}\verb@ float *iEdges, int iEdgeLength);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ int SINQHMDeconfigure(pSINQHM self, int iHarsh);@\\
\mbox{}\verb@ int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,@\\
@ -229,14 +243,14 @@ $\langle$Protos {\footnotesize 3c}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 3abc, 6a.
\item Macro defined by scraps ?, ?, ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap7}
$\langle$IProtos {\footnotesize 4}$\rangle\equiv$
$\langle$IProtos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -245,7 +259,7 @@ $\langle$IProtos {\footnotesize 4}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 4, 6b.
\item Macro defined by scraps ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -262,6 +276,20 @@ may choose to strat at a different memory location. iCompress is for
compression. All data will be right shifted by iCompress bits before
storage. To my knowledge this feature is currently not implemented.
SINQHMConfigurePSD configures a TRICS/AMOR type detector. The parameters are:
\begin{description}
\item[self] The histogram memory data structure.
\item[iMode] The actual histogram mode with all submask bits.
\item[xSize] The x size of the detector.
\item[xOff] The offset in x for the detector position decoding.
\item[xFac] The factor used in decoding the x detector position.
\item[ySize] The y size of the detector.
\item[yOff] The offset in y for the detector position decoding.
\item[yFac] The factor used in decoding the y detector position.
\item[iBinWidth] The binwidth of the histograms.
\item[iEdges] An array holding the time binning edges.
\item[iEdgeLength] The length of iEdges.
\end{description}
SINQHMDeconfigure deconfigures the histogram memory. This is necessary prior
to reconfiguration. The only parameter iHarsh defines how brutal the master
@ -294,7 +322,7 @@ Thus the following functions are required:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap8}
$\langle$TOFProto {\footnotesize 5a}$\rangle\equiv$
$\langle$TOFProto {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -311,7 +339,7 @@ $\langle$TOFProto {\footnotesize 5a}$\rangle\equiv$
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap9}
$\langle$TOFintern {\footnotesize 5b}$\rangle\equiv$
$\langle$TOFintern {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -334,6 +362,7 @@ SINQHMTimeBin actually sends the new time binning to the histogram memory.
SINQHMTimeBin is a static internal function.
\section{Data aquisition functions}
These functions allow to do data aquisition and retrieve or set histograms.
Data aquisition is fairly involved. In order for data aquisition to happen
@ -348,7 +377,7 @@ cleared by default.
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap10}
$\langle$Protos {\footnotesize 6a}$\rangle\equiv$
$\langle$Protos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -371,7 +400,7 @@ $\langle$Protos {\footnotesize 6a}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 3abc, 6a.
\item Macro defined by scraps ?, ?, ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -410,7 +439,7 @@ to any serious data aquisition.
\section{Further internal routines}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap11}
$\langle$IProtos {\footnotesize 6b}$\rangle\equiv$
$\langle$IProtos {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
@ -423,7 +452,7 @@ $\langle$IProtos {\footnotesize 6b}$\rangle\equiv$
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro defined by scraps 4, 6b.
\item Macro defined by scraps ?, ?.
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
@ -494,8 +523,8 @@ $\langle$ErrCode {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@@$\langle$ErrCode {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@\\
\mbox{}\verb@/*------------------------------ Prototypes ------------------------------*/@\\
\mbox{}\verb@@$\langle$Protos {\footnotesize 3a, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$TOFProto {\footnotesize 5a}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$Protos {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$TOFProto {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@$\diamond$
\end{list}
@ -517,10 +546,10 @@ $\langle$ErrCode {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@#ifndef SINQHMINTERNAL@\\
\mbox{}\verb@#define SINQHMINTERNAL@\\
\mbox{}\verb@#define MAXBANK 1@\\
\mbox{}\verb@@$\langle$SBank {\footnotesize 2a}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$SType {\footnotesize 2b, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$IProtos {\footnotesize 4, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$TOFintern {\footnotesize 5b}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$SBank {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$SType {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$IProtos {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$TOFintern {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@@$\diamond$

View File

@ -87,6 +87,9 @@ the lower edges of all time bins.
int iRank;
int iPacket;
int iBanks;
int xSize, ySize;
int xOff, xFac;
int yOff, yFac;
SBank pBank[MAXBANK];
} SINQHM;
@}
@ -96,7 +99,9 @@ computer, the second the port number at which the master server is
listening. iClientPort defines a port for data communication. If no such
port is open, this value will be 0. iStatus is a status flag. iBanks is the
number of detector banks defined. pSBank is an array of bank data structures
describing the detector banks. In order to
describing the detector banks.
xOff, xFac and yOff and yFac are the offset and factor values needed for
the PSD calculation for TRICS and AMOR. In order to
maintain this data structure two functions are defined:
\section{Byte swapping}
@ -115,6 +120,8 @@ types for your compiler and computer.
pSINQHM CopySINQHM(pSINQHM self);
void DeleteSINQHM(pSINQHM self);
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,
int ySize, int yOff, int yFac);
@}
The first function creates a new SINQHM data structure and initialises the
@ -123,6 +130,8 @@ mentioned above for the description of the data structure. DeleteSINQHM
frees all memory associated with a SINQHM structure given by self. The
pointer to self is invalid ever afterwards.
CopySINQHM creates a copy of the SINQHM structure passed in with self.
SINQHMSetPar sets time of flight parameters.
SINQHMSetPSD defines PSD parameters for TRICS/AMOR type detectors.
\section{SINQHM error handling}
If not denoted otherwise all public SINQHM functions return an integer 1 on
@ -146,6 +155,11 @@ needed:
@d Protos @{
int SINQHMConfigure(pSINQHM self, int iMode, int iRank, int iLength,
int iBinWidth, int iLowBin, int iCompress);
int SINQHMConfigurePSD(pSINQHM self, int iMode,
int xSize, int xOff, int xFac,
int ySize, int yOff, int yFac,
int iBinWidth,
float *iEdges, int iEdgeLength);
int SINQHMDeconfigure(pSINQHM self, int iHarsh);
int SINQHMGetStatus(pSINQHM self,int *iMode, int *iDaq,
@ -171,6 +185,20 @@ may choose to strat at a different memory location. iCompress is for
compression. All data will be right shifted by iCompress bits before
storage. To my knowledge this feature is currently not implemented.
SINQHMConfigurePSD configures a TRICS/AMOR type detector. The parameters are:
\begin{description}
\item[self] The histogram memory data structure.
\item[iMode] The actual histogram mode with all submask bits.
\item[xSize] The x size of the detector.
\item[xOff] The offset in x for the detector position decoding.
\item[xFac] The factor used in decoding the x detector position.
\item[ySize] The y size of the detector.
\item[yOff] The offset in y for the detector position decoding.
\item[yFac] The factor used in decoding the y detector position.
\item[iBinWidth] The binwidth of the histograms.
\item[iEdges] An array holding the time binning edges.
\item[iEdgeLength] The length of iEdges.
\end{description}
SINQHMDeconfigure deconfigures the histogram memory. This is necessary prior
to reconfiguration. The only parameter iHarsh defines how brutal the master
@ -217,6 +245,7 @@ SINQHMTimeBin actually sends the new time binning to the histogram memory.
SINQHMTimeBin is a static internal function.
\section{Data aquisition functions}
These functions allow to do data aquisition and retrieve or set histograms.
Data aquisition is fairly involved. In order for data aquisition to happen

View File

@ -8,7 +8,7 @@
#ifdef __alpha
#ifndef __vms
#pragma nomember_alignment
#pragma pack 1
#endif
#endif
/*------------------------------------------------------------------------------
@ -23,6 +23,7 @@
#define MAX_CLIENTS 8 /* The maximum number of active clients */
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
** which can be handled in TOF mode */
#define MAX_PSD_CNTR 65536 /* maximum number of PSD elements */
#define MAX_TOF_NBINS 32768 /* The maximum number of bins in a TOF histog */
#define MAX_TOF_EDGE 16 /* The maximum number of TOF edge arrays */
#define VMIO_BASE_ADDR 0x1900 /* VME address of a (possible) VMIO10 module */
@ -332,6 +333,20 @@
struct tof_edge_arr edge_0;
struct tof_bank bank_0;
} tof;
struct {
uint n_extra_bytes;
usint n_edges;
usint n_banks;
uint preset_delay;
usint xFactor;
usint yFactor;
usint xOffset;
usint yOffset;
usint xSize;
usint ySize;
struct tof_edge_arr edge_0;
struct tof_bank bank_0;
} psd;
} u;
} cnfg;

View File

@ -109,6 +109,7 @@
"tof",
"strobo",
"hrpt",
"psd",
NULL
};

View File

@ -537,10 +537,16 @@
/*-----------------------------------------------------------------------*/
int HistSetOption(pHistMem self, char *name, char *value)
{
int status;
assert(self);
self->iInit = 1;
strtolower(name);
return StringDictUpdate(self->pOption,name, value);
status = StringDictUpdate(self->pOption,name, value);
if(status == 0)
{
return StringDictAddPair(self->pOption,name, value);
}
}
/*-----------------------------------------------------------------------*/
int HistConfigure(pHistMem self, SConnection *pCon, SicsInterp *pSics)
@ -1161,7 +1167,7 @@
return 0;
}
/* configure command */
/* interest command */
strtolower(argv[1]);
if(strcmp(argv[1],"interest") == 0)
{
@ -1325,10 +1331,12 @@
}
else
{
SCWrite(pCon,"ERROR: you are not privileged for attempted operation",eError);
SCWrite(pCon,
"ERROR: you are not privileged for attempted operation",eError);
return 0;
}
}
/* normal counting*/
else if(strcmp(argv[1],"count") == 0)
{
if(SCMatchRights(pCon,self->iAccess))
@ -1347,7 +1355,27 @@
}
else
{
SCWrite(pCon,"ERROR: you are not privileged for attempted operation",eError);
SCWrite(pCon,
"ERROR: you are not privileged for attempted operation",eError);
return 0;
}
}
/* forced count, for the case several hm need to be started */
else if(strcmp(argv[1],"countf") == 0)
{
if(SCMatchRights(pCon,self->iAccess))
{
iRet = HistDoCount(self,pCon);
if(iRet == 1)
{
SCSendOK(pCon);
}
return iRet;
}
else
{
SCWrite(pCon,
"ERROR: you are not privileged for attempted operation",eError);
return 0;
}
}
@ -1365,7 +1393,8 @@
}
else
{
SCWrite(pCon,"ERROR: you are not privileged for attempted operation",eError);
SCWrite(pCon,
"ERROR: you are not privileged for attempted operation",eError);
return 0;
}
}

View File

@ -17,7 +17,8 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ eHNormal,@\\
\mbox{}\verb@ eHTOF,@\\
\mbox{}\verb@ eHStrobo,@\\
\mbox{}\verb@ eHRPT@\\
\mbox{}\verb@ eHRPT,@\\
\mbox{}\verb@ ePSD@\\
\mbox{}\verb@ } HistMode;@\\
\mbox{}\verb@@$\diamond$
\end{list}

View File

@ -12,7 +12,8 @@ histograms. Let's discuss these different modes first.
eHNormal,
eHTOF,
eHStrobo,
eHRPT
eHRPT,
ePSD
} HistMode;
@}
A histogram memory can be operated in transparent mode. It has not yet been

View File

@ -37,6 +37,16 @@
#define DET1XS 2 /* pixel size in x of detector 1 */
#define DET1YS 2 /* pixel size in y of detector 1 */
#define DET1DESC "Non existent Detector"
#define DET2X 256 /* x -length of detector 1 */
#define DET2Y 256 /* y-length of detector 1 */
#define DET2XS 2 /* pixel size in x of detector 1 */
#define DET2YS 2 /* pixel size in y of detector 1 */
#define DET2DESC "Non existent second Detector"
#define DET3X 256 /* x -length of detector 1 */
#define DET3Y 256 /* y-length of detector 1 */
#define DET3XS 2 /* pixel size in x of detector 1 */
#define DET3YS 2 /* pixel size in y of detector 1 */
#define DET3DESC "Non existent third Detector"
#define DETAMAX 256 /* maximum length of pixelsize array */
/* histogram memory names */
@ -44,6 +54,12 @@
#define HM2 "hm2"
#define HM3 "hm3"
/*
offset variable names
*/
#define HM2OFF "hm2off"
#define HM3OFF "hm3off"
/*------------------------ the data structure ----------------------------*/
typedef struct __NexTrics {
pObjectDescriptor pDes;
@ -55,6 +71,7 @@
int iFirst;
int iFrameNum;
pICallBack pCall;
float hm2Off, hm3Off;
} NexTrics;
/* event type */
@ -66,6 +83,7 @@
pNexTrics pNew = NULL;
int iRet;
CommandList *pCom = NULL;
pSicsVariable pVar = NULL;
/* allocate memory */
pNew = (pNexTrics)malloc(sizeof(NexTrics));
@ -123,6 +141,25 @@
pNew->iFirst = 1;
pNew->iFrameNum = 0;
pVar = FindVariable(pSics,HM2OFF);
if(pVar)
{
pNew->hm2Off = pVar->fVal;
}
else
{
pNew->hm2Off = -45.;
}
pVar = FindVariable(pSics,HM3OFF);
if(pVar)
{
pNew->hm3Off = pVar->fVal;
}
else
{
pNew->hm3Off = 45.;
}
return pNew;
}
/*-------------------------------------------------------------------------*/
@ -209,11 +246,11 @@
}
/* create the command */
iRet = AddCommand(pSics,"nexus",NexTricsAction,DeleteNexTrics,
iRet = AddCommand(pSics,"nxtrics",NexTricsAction,DeleteNexTrics,
pNew);
if(!iRet)
{
SCWrite(pCon,"ERROR: duplicate command nexus not created",eError);
SCWrite(pCon,"ERROR: duplicate command nxtrics not created",eError);
}
return iRet;
}
@ -226,7 +263,8 @@
CounterMode eMode;
HistInt lData[DET1X*DET1Y], i, lVal;
int32 iVal;
float fVal;
float fVal, fTTheta;
pMotor pMot;
/* write motors */
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
@ -235,10 +273,20 @@
"framephi","PHI");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frameomega","OM");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frame2theta","stt");
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG1");
/*
read two theta
*/
pMot = FindMotor(pServ->pSics,"stt");
if(!pMot)
{
sprintf(pBueffel,"WARNING: cannot find motor stt");
SCWrite(pCon,pBueffel,eWarning);
return 0;
}
/* get the position */
iRet = MotorGetSoftPosition(pMot,pCon,&fTTheta);
/* write frame time */
SNXFormatTime(pBueffel,512);
@ -266,14 +314,63 @@
NXDputalias(hfil,self->pDict,"framemonitor",&iVal);
/* write detector1 histogram */
GetHistogram(self->pHistogram1,pCon,0,0,DET1X*DET1Y,lData,DET1X*DET1Y*sizeof(HistInt));
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG1");
GetHistogram(self->pHistogram1,pCon,0,0,DET1X*DET1Y,lData,
DET1X*DET1Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
/*
do detector 2 histogram
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG2");
GetHistogram(self->pHistogram2,pCon,0,0,DET2X*DET2Y,lData,
DET2X*DET2Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta + self->hm2Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
}
/*
do detector 3 histogram
*/
if(self->pHistogram3 != NULL)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
SNXSPutMotor(pServ->pSics,pCon,hfil,self->pDict,
"frametilt","DG3");
GetHistogram(self->pHistogram2,pCon,0,0,DET3X*DET3Y,lData,
DET3X*DET3Y*sizeof(HistInt));
NXDputalias(hfil,self->pDict,"framecounts",lData);
fVal = fTTheta + self->hm3Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
/* the NXdata links */
NXDaliaslink(hfil,self->pDict,"frame","detectorx");
NXDaliaslink(hfil,self->pDict,"frame","detectory");
NXDaliaslink(hfil,self->pDict,"frame","framecounts");
}
/* temperature */
SNXSPutEVVar(hfil,self->pDict,"temperature",
pCon,
@ -421,8 +518,10 @@
"monotheta","MUCA");
/* detector data */
/* first set detector variables in dictionary */
/* detector data
first set detector variables in dictionary
This is the first detector.
*/
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET1X);
@ -508,6 +607,202 @@
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
/*
second frame, but only if present
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET2X);
NXDupdate(self->pDict,"framedim1",pBueffel);
sprintf(pBueffel,"%d",DET2Y);
NXDupdate(self->pDict,"framedim2",pBueffel);
strcpy(pBueffel,DET2DESC);
iRet = NXDputalias(hfil,self->pDict,"ddescription",pBueffel);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 description",eError);
}
for(i = 0; i < DET2X; i++)
{
fPix[i] = i * DET2XS;
}
iRet = NXDputalias(hfil,self->pDict,"detectorx",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 x-axis description",
eError);
}
for(i = 0; i < DET2Y; i++)
{
fPix[i] = i * DET2YS;
}
iRet = NXDputalias(hfil,self->pDict,"detectory",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector1 y-axis description",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2zerox");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector x zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzerox",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor x zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2zeroy");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector2 y zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzeroy",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor y zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det2dist");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector distance not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detdist",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor2 y distance",
eError);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/*
third detector, but only if present
*/
if(self->pHistogram2 != NULL)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
sprintf(pBueffel,"%d",DET3X);
NXDupdate(self->pDict,"framedim1",pBueffel);
sprintf(pBueffel,"%d",DET3Y);
NXDupdate(self->pDict,"framedim2",pBueffel);
strcpy(pBueffel,DET3DESC);
iRet = NXDputalias(hfil,self->pDict,"ddescription",pBueffel);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 description",eError);
}
for(i = 0; i < DET3X; i++)
{
fPix[i] = i * DET3XS;
}
iRet = NXDputalias(hfil,self->pDict,"detectorx",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector2 x-axis description",
eError);
}
for(i = 0; i < DET3Y; i++)
{
fPix[i] = i * DET3YS;
}
iRet = NXDputalias(hfil,self->pDict,"detectory",fPix);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detector1 y-axis description",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3zerox");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 x zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzerox",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor x zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3zeroy");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 y zero point not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detzeroy",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor y zero point",
eError);
}
pVar = NULL;
pVar = FindVariable(pServ->pSics,"det3dist");
if(pVar)
{
fVal = pVar->fVal;
}
else
{
SCWrite(pCon,"ERROR: Variable detector 3 distance not found ",
eError);
fVal = -2188.99;
}
iRet = NXDputalias(hfil,self->pDict,"detdist",&fVal);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write detecor 3 y distance",
eError);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/* do sample information */
strcpy(pBueffel,"UNKNOWN");
@ -622,7 +917,12 @@
SCWrite(pCon,"WARNING: cannot link against monochromator group",eWarning);
}
/* links in detector group */
/*
links in detector group
detector 1
*/
strcpy(pBueffel,"detector1");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
@ -660,6 +960,108 @@
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
/*
links in detector group, detector 2
*/
if(self->pHistogram2)
{
strcpy(pBueffel,"detector2");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector description",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectorx");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectory");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzerox");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x zero ",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzeroy");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y zero",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detdist");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector distance",
eWarning);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/*
links in detector group, detector 3
*/
if(self->pHistogram3)
{
strcpy(pBueffel,"detector3");
NXDupdate(self->pDict,"dnumber",pBueffel);
iRet = NXDaliaslink(hfil,self->pDict,"det1","ddescription");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector description",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectorx");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detectory");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y-axis",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzerox");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector x zero ",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detzeroy");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector y zero",
eWarning);
}
iRet = NXDaliaslink(hfil,self->pDict,"det1","detdist");
if(iRet != NX_OK)
{
SCWrite(pCon,"WARNING: cannot link against detector distance",
eWarning);
}
iRet = 1;
iRet = NXDputalias(hfil,self->pDict,"detvalid",&iRet);
if(iRet != NX_OK)
{
SCWrite(pCon,"ERROR: failed to write frame validity",eError);
}
}
/* links in sample group */
iRet = NXDaliaslink(hfil,self->pDict,"samplev","samplename");
@ -798,7 +1200,7 @@
}
/*-------------------------------------------------------------------------
NexusGetFrame opens a TRICS NeXus file and retrieves a frame for the
specified detector from it. This is a specila feature for the
specified detector from it. This is a special feature for the
status display.
---------------------------------------------------------------------------*/
static int NexusGetFrame(SConnection *pCon, pNexTrics self,

View File

@ -6,6 +6,8 @@
Mark Koennecke, August 1997 - November 1998
Updated to support the larger detector resolution and possible
TOF and stroboscopic modes, Mark Koennecke, February 2001
Copyright:
@ -198,10 +200,11 @@
char pBueffel[512];
float fVal;
int iVal, iSet;
int32 iAxis[128];
int32 iAxis[256];
int i, iRet;
long lVal;
HistInt lData[65536];
HistInt *lData = NULL;
const float *fTime = NULL;
CommandList *pCom = NULL;
pHistMem self = NULL;
CounterMode eMode;
@ -211,6 +214,7 @@
float fRot, fTilt, fLambda;
pDummy pDum;
pIDrivable pDrive;
int iDim[MAXDIM], nDim, histSize;
/* start file */
Nfil = SNXStartSANS(pCon,pSics);
@ -555,14 +559,64 @@
NXDputalias(Nfil,pDict,"ddmo",&iVal);
fVal = GetHistCountTime(self,pCon);
NXDputalias(Nfil,pDict,"ddtime",&fVal);
GetHistogram(self,pCon,0,0,65536,lData,65536*sizeof(HistInt));
/*
Deal with actual histogram. Due to stroboscopic modes and the
new detector electronics we need to find out about the size
ourselves now. And possibly write time binning information.
*/
GetHistDim(self, iDim,&nDim);
histSize = 1;
for(i = 0; i < nDim; i++)
{
histSize *= iDim[i];
}
lData = (HistInt *)malloc(histSize*sizeof(HistInt));
if(!lData)
{
SCWrite(pCon,"ERROR: out of memory, FAILED to store data, file corrupt",
eError);
NXclose(&Nfil);
return 0;
}
GetHistogram(self,pCon,0,0,histSize,lData,histSize*sizeof(HistInt));
sprintf(pBueffel," %d ",iDim[0]);
NXDupdate(pDict,"dim1",pBueffel);
sprintf(pBueffel," %d ",iDim[1]);
NXDupdate(pDict,"dim2",pBueffel);
if(nDim == 2)
{
sprintf(pBueffel," -rank 2 -dim {%d,%d} ", iDim[0], iDim[1]);
NXDupdate(pDict,"countdim",pBueffel);
}
else if (nDim == 3)
{
sprintf(pBueffel," -rank 3 -dim {%d,%d,%d} ", iDim[0], iDim[1],
iDim[2]);
NXDupdate(pDict,"countdim",pBueffel);
sprintf(pBueffel," %d ",iDim[2]);
NXDupdate(pDict,"timedim",pBueffel);
}
NXDputalias(Nfil,pDict,"ddcounts",lData);
for(i = 0; i < 256; i++)
free(lData);
/* write x and y axis */
for(i = 0; i < iDim[0]; i++)
{
iAxis[i] = i;
}
NXDputalias(Nfil,pDict,"ddcx",iAxis);
for(i = 0; i < iDim[1]; i++)
{
iAxis[i] = i;
}
NXDputalias(Nfil,pDict,"ddcy",iAxis);
/* write time binning if appropriate */
if(nDim == 3)
{
fTime = GetHistTimeBin(self,&iVal);
NXDputalias(Nfil,pDict,"ddtb",(void *)fTime);
}
if(pSiem)
{
iRet = SPSGetADC(pSiem,1,&iVal);
@ -579,6 +633,10 @@
NXDaliaslink(Nfil,pDict,"dan","ddcy");
NXDaliaslink(Nfil,pDict,"dan","ddmo");
NXDaliaslink(Nfil,pDict,"dan","vlambda");
if(nDim == 3)
{
NXDaliaslink(Nfil,pDict,"dan","ddtb");
}
/* send quieck message for autoamtic copying*/
i = 131;

View File

@ -32,6 +32,9 @@ vlambda = /entry1,NXentry/SANS,NXinstrument/Dornier-VS,NXchopper/SDS \
#-------------------- monitor 1
m1counts = /entry1,NXentry/SANS,NXinstrument/monitor1,NXmonitor/SDS \
counts -type DFNT_INT32
#-------------------- proton monitor
pbcounts = /entry1,NXentry/SANS,NXinstrument/integrated_beam,NXmonitor/SDS \
counts -type DFNT_INT32
#--------------------- collimator
colli = /entry1,NXentry/SANS,NXinstrument/collimator,NXcollimator/SDS \
length -attr {units,m}
@ -70,12 +73,19 @@ ddmo = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS monitor_counts
-type DFNT_UINT32 -rank 1 -dim {1}
ddtime = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS \
counting_time -attr {units,seconds}
countdim = -rank 2 -dim {256,256}
timedim = 1
dim1 = 256
dim2 = 256
ddcounts = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS counts \
-type DFNT_UINT32 -rank 2 -dim {128,128} -attr {signal,1}
-type DFNT_UINT32 -LZW $(countdim) -attr {signal,1}
ddcx = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS detector_x \
-type DFNT_UINT32 -rank 1 -dim {128} -attr {axis,1}
-type DFNT_UINT32 -rank 1 -dim {$(dim1)} -attr {axis,1}
ddcy = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS detector_y \
-type DFNT_INT32 -rank 1 -dim {128} -attr {axis,2}
-type DFNT_INT32 -rank 1 -dim {$(dim2)} -attr {axis,2}
ddtb = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS tof_or_gummi \
-rank 1 -dim {$(timedim)} -attr {axis,3} \
-attr {units,uSecOrStroboscopicDimension}
ddtemp = /entry1,NXentry/SANS,NXinstrument/detector,NXdetector/SDS \
temperature
#--------Sample

View File

@ -11,12 +11,10 @@ hm genbin 120.000000 35.000000 512
hm init
datafile focus-1001848.hdf
datafile setAccess 3
hm3 CountMode timer
hm3 preset 100.000000
hm2 CountMode timer
hm2 preset 100.000000
hm2 preset 2.000000
hm1 CountMode timer
hm1 preset 100.000000
hm1 preset 2.000000
dbfile UNKNOWN
dbfile setAccess 2
# Motor th
@ -30,11 +28,23 @@ th AccessCode 2.000000
#Crystallographic Settings
hkl lambda 0.703790
hkl setub -0.124702 0.001618 -0.041357 -0.104448 -0.001326 0.049388 0.000751 0.084094 0.001574
det1dist 300.
det3dist 300.000000
det3dist setAccess 1
det3zeroy 128.000000
det3zeroy setAccess 1
det3zerox 128.000000
det3zerox setAccess 1
det2dist 300.000000
det2dist setAccess 1
det2zeroy 128.000000
det2zeroy setAccess 1
det2zerox 128.000000
det2zerox setAccess 1
det1dist 300.000000
det1dist setAccess 1
det1zeroy 128.
det1zeroy 128.000000
det1zeroy setAccess 1
det1zerox 128.
det1zerox 128.000000
det1zerox setAccess 1
mono2theta 36.77
mono2theta setAccess 1
@ -72,6 +82,22 @@ ph Fixed -1.000000
ph sign 1.000000
ph InterruptMode 0.000000
ph AccessCode 2.000000
# Motor dg3
dg3 SoftZero 0.000000
dg3 SoftLowerLim -10.000000
dg3 SoftUpperLim 40.000000
dg3 Fixed -1.000000
dg3 sign 1.000000
dg3 InterruptMode 0.000000
dg3 AccessCode 2.000000
# Motor dg2
dg2 SoftZero 0.000000
dg2 SoftLowerLim -10.000000
dg2 SoftUpperLim 40.000000
dg2 Fixed -1.000000
dg2 sign 1.000000
dg2 InterruptMode 0.000000
dg2 AccessCode 2.000000
# Motor dg1
dg1 SoftZero 0.000000
dg1 SoftLowerLim -10.000000
@ -123,7 +149,9 @@ twotheta AccessCode 2.000000
lastscancommand UNKNOWN
lastscancommand setAccess 2
banana CountMode timer
banana preset 100.000000
banana preset 2.000000
banana genbin 100.000000 13.000000 64
banana init
sample_mur 0.000000
sample_mur setAccess 2
email UNKNOWN
@ -135,7 +163,7 @@ phone setAccess 2
adress UNKNOWN
adress setAccess 2
# Counter counter
counter SetPreset 1000.000000
counter SetPreset 100.000000
counter SetMode Timer
# Motor som
som SoftZero 0.000000
@ -407,5 +435,5 @@ sample DanielOxid
sample setAccess 2
title TopsiTupsiTapsi
title setAccess 2
starttime 2000-12-15 15:44:22
starttime 2001-01-29 16:18:12
starttime setAccess 2

View File

@ -62,7 +62,7 @@
**
** If <arg0> = "focus"
** <arg1> = name of hostM (Mittel-bank) (dflt=localhost).
** <arg2> = #-counters in Mittel-bank (dflt=151).
** <arg2> = #-counters in Mittel-bank (dflt=150).
** <arg3> = name of hostO (Ober-bank) (dflt=lnse05.vme).
** <arg4> = #-counters in Ober-bank (dflt=117).
** <arg5> = name of hostU (Unter-bank) (dflt=lnse06.vme).
@ -926,9 +926,9 @@
if (hostM[0] == NIL) hostM = "localhost";
if (p_arg2 == NULL) {
ndetM = 151;
ndetM = 150;
}else if (p_arg2[0] == NIL) {
ndetM = 151;
ndetM = 150;
}else {
if ((sscanf (p_arg2, "%i", &ndetM) != 1) ||
(ndetM <= 0) ||

View File

@ -218,7 +218,7 @@
#define LWL_PSD_PWF 0x20000000 /* PSD-mode Power Fail bit */
#define LWL_PSD_TIME 0x000fffff /* PSD-mode time stamp extraction
mask */
#define LWL_PSD_FLASH_MASK 0x00ff /* mask for flash count
#define LWL_PSD_FLASH_MASK 0x00ff /* mask for flash count */
#define LWL_SM_NC (0x10000000) /* Strobo-Mode/No-Coinc 0 chan dgrm hdr */
#define LWL_SM_NC_C1 (0x11000000) /* Strobo-Mode/No-Coinc 1 chan dgrm hdr */

View File

@ -35,6 +35,9 @@
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
Modified to work without counter in slave mode.
Mark Koennecke, January 2001
----------------------------------------------------------------------------*/
#include <string.h>
#include <stdlib.h>
@ -86,6 +89,8 @@
CommandList *pCom = NULL;
int iStart = 0;
int iInit = 0, i;
int xOff, xFac, yOff, yFac;
int iPort;
assert(self);
assert(self->pPriv);
@ -120,29 +125,36 @@
PrintHMError("No network name for histogram memory computer found",pCon);
return 0;
}
iPort = (int)fVal;
/* the counter */
status = StringDictGet(pOpt,"counter",pcCounter,254);
if(!status)
{
PrintHMError("No network name for histogram memory computer found",pCon);
return 0;
SCWrite(pCon,"WARNING: no counter control found for this HM",
eWarning);
pInternal->pCounter = NULL;
}
else
{
pCom = FindCommand(pSics,pcCounter);
if(!pCom)
{
PrintHMError("EL737 counter for histogram memory not found",pCon);
PrintHMError("EL737 counter for histogram memory not found",
pCon);
return 0;
}
pInternal->pCounter = (pCounter)pCom->pData;
if(!pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,COUNTID))
if(!pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
COUNTID))
{
PrintHMError("EL737 counter for histogram memory is invalid",pCon);
PrintHMError("EL737 counter for histogram memory is invalid",
pCon);
return 0;
}
}
/* ok! put in HM */
pInternal->pMaster = CreateSINQHM(pHMComputer,(int)fVal);
pInternal->pMaster = CreateSINQHM(pHMComputer,iPort);
if(!pInternal->pMaster)
{
PrintHMError("No memory to allocate SINQHM",pCon);
@ -227,6 +239,9 @@
case eHRPT:
iMode = SQHM__HRPT;
break;
case ePSD:
iMode = SQHM__HM_PSD;
break;
default:
PrintHMError("Unsupported mode requested",pCon);
return 0;
@ -249,12 +264,63 @@
PrintHMError("Unsupported overflowmode requested",pCon);
return 0;
}
if(self->eHistMode != ePSD)
{
status = SINQHMConfigure(pInternal->pMaster,
iMode,
self->iRank,
self->iLength,
self->iBinWidth,
0,0);
}
else
{
status = StringDictGetAsNumber(pOpt,"xoff",&fVal);
if(!status)
{
PrintHMError(
"No xOff value for PSD mode found",pCon);
return 0;
}
xOff = (int)fVal;
status = StringDictGetAsNumber(pOpt,"xfac",&fVal);
if(!status)
{
PrintHMError(
"No xFac value for PSD mode found",pCon);
return 0;
}
xFac = (int)fVal;
status = StringDictGetAsNumber(pOpt,"yoff",&fVal);
if(!status)
{
PrintHMError(
"No yOff value for PSD mode found",pCon);
return 0;
}
yOff = (int)fVal;
status = StringDictGetAsNumber(pOpt,"yfac",&fVal);
if(!status)
{
PrintHMError(
"No yFac value for PSD mode found",pCon);
return 0;
}
yFac = (int)fVal;
/* xSize and ySize are supposed to be in dim */
status = SINQHMConfigurePSD(pInternal->pMaster,
iMode,
self->iDims[0],
xOff,
xFac,
self->iDims[1],
yOff,
yFac,
self->iBinWidth,
self->fTime,
self->iTimeChan);
}
if(status < 0)
{
SINQHMError2Text(status, pError,131);
@ -294,8 +360,11 @@
pInternal = self->pPriv;
/* tell the counter box our current status */
if(pInternal->pCounter != NULL)
{
SetCounterMode(pInternal->pCounter,self->eCount);
pInternal->pCounter->pDriv->fPreset = self->fCountPreset;
}
/* first zero the HM */
@ -328,13 +397,17 @@
/* start the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->StartCount(pInternal->pCounter,pCon);
}
return 0;
}
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQPause(pHistDriver self, SConnection *pCon)
@ -359,13 +432,17 @@
}
/* pause the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->Pause(pInternal->pCounter,pCon);
}
return 0;
}
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQContinue(pHistDriver self, SConnection *pCon)
@ -390,13 +467,17 @@
}
/* continue the El737 counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->Continue(pInternal->pCounter,pCon);
}
return 0;
}
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQHalt(pHistDriver self)
@ -420,7 +501,10 @@
}
/* Halt counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
@ -429,9 +513,14 @@
{
iRet = 0;
}
else
{
iRet = 1;
}
}
return iRet;
}
return 0;
return 1;
}
/*---------------------------------------------------------------------------*/
static int SQStatus(pHistDriver self, SConnection *pCon)
@ -449,7 +538,10 @@
pInternal = self->pPriv;
/* first check at counter */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
@ -460,7 +552,7 @@
return status;
}
}
}
/* now check at HM */
iRet = SINQHMGetStatus(pInternal->pMaster,&iMode,&iDaq,
@ -476,6 +568,15 @@
{
return HWPause;
}
else if(iDaq == 1)
{
status = HWBusy;
}
else if(iDaq == 0)
{
status = HWIdle;
}
return status;
}
@ -498,11 +599,18 @@
}
/* now counter errors */
if(pInternal->pCounter != NULL)
{
return pInternal->pCounter->pDriv->GetError(pInternal->pCounter->pDriv,
iCode,
pError,
iErrLen);
}
else
{
/* this can't be */
return 0;
}
}
/*--------------------------------------------------------------------------*/
static int SQFixIt(pHistDriver self, int iCode)
@ -541,9 +649,14 @@
}
/* do counter errors */
return pInternal->pCounter->pDriv->TryAndFixIt(pInternal->pCounter->pDriv,
if(pInternal->pCounter != NULL)
{
return pInternal->pCounter->pDriv->TryAndFixIt(
pInternal->pCounter->pDriv,
iCode);
}
return COTERM;
}
/*---------------------------------------------------------------------------*/
static int SQGetData(pHistDriver self, SConnection *pCon)
{
@ -575,14 +688,18 @@
/* do only counter, histograms are read on demand */
pCountInt = pInternal->pCounter->pDes->GetInterface(pInternal->pCounter,
if(pInternal->pCounter != NULL)
{
pCountInt = pInternal->pCounter->pDes->GetInterface(
pInternal->pCounter,
COUNTID);
if(pCountInt)
{
return pCountInt->TransferData(pInternal->pCounter,
pCon);
}
return 0;
}
return 1;
}
/*--------------------------------------------------------------------------*/
static int SQGetHistogram(pHistDriver self, SConnection *pCon,
@ -748,8 +865,11 @@
assert(self->pPriv);
pInternal = self->pPriv;
if(pInternal->pCounter != NULL)
{
return GetMonitor(pInternal->pCounter,i,pCon);
}
return 0;
}
/*---------------------------------------------------------------------------*/
static float SQGetTime(pHistDriver self,SConnection *pCon)
@ -761,8 +881,11 @@
assert(self->pPriv);
pInternal = self->pPriv;
if(pInternal->pCounter != NULL)
{
return GetCountTime(pInternal->pCounter,pCon);
}
return -999.99;
}
/*---------------------------------------------------------------------------*/
static int SQPreset(pHistDriver self, SConnection *pCon, HistInt iVal)
@ -829,6 +952,12 @@
StringDictAddPair(pOption,"hmcomputer","psds02.psi.ch");
StringDictAddPair(pOption,"hmport","2400");
StringDictAddPair(pOption,"counter","Rudolf");
StringDictAddPair(pOption,"xsize","256");
StringDictAddPair(pOption,"xoff","100");
StringDictAddPair(pOption,"xfac","10");
StringDictAddPair(pOption,"ysize","256");
StringDictAddPair(pOption,"yoff","100");
StringDictAddPair(pOption,"yfac","10");
StringDictAddPair(pOption,"init","1");
/* initialise our private data structure */

View File

@ -215,8 +215,8 @@ VarMake email Text User
VarMake sample_mur Float User
MakeDataNumber SicsDataNumber "$shome/sics/danu.dat"
#InitSANS $shome/sics/sansdict.dic
InitDMC
InitSANS $shome/sics/sansdict.dic
#InitDMC
MakeScanCommand xxxscan counter topsi.hdd recover.bin
MakePeakCenter xxxscan
@ -244,9 +244,9 @@ banana init
ClientPut "HM initialized"
source $shome/sics/tcl/scancom.tcl
#source $shome/sics/countf.tcl
source $shome/sics/tcl/count.tcl
Publish count User
Publish repeat user
#source $shome/sics/tcl/count.tcl
#Publish count User
#Publish repeat user
source $shome/sics/tcl/fit.tcl
Publish fit Spy
SerialInit
@ -266,6 +266,8 @@ Motor chi SIM 0. 360. .1 2. # chi circle
Motor phi SIM -360. 360. .1 2. # phi circle
Motor muca SIM 30. 36. .1 2. # phi circle
Motor dg1 SIM -10. 40. .1 2. # phi circle
Motor dg2 SIM -10. 40. .1 2. # phi circle
Motor dg3 SIM -10. 40. .1 2. # phi circle
SicsAlias phi ph
SicsAlias chi ch
SicsAlias twotheta stt
@ -274,12 +276,24 @@ VarMake monodescription Text Mugger
monodescription "unknownit crystal"
VarMake mono2theta Text Mugger
mono2theta 36.77
VarMake det1zerox Text Mugger
VarMake det1zerox Float Mugger
det1zerox 128.
VarMake det1zeroy Text Mugger
VarMake det1zeroy Float Mugger
det1zeroy 128.
VarMake det1dist Text Mugger
VarMake det1dist Float Mugger
det1dist 300.
VarMake det2zerox Float Mugger
det2zerox 128.
VarMake det2zeroy Float Mugger
det2zeroy 128.
VarMake det2dist Float Mugger
det2dist 300.
VarMake det3zerox Float Mugger
det3zerox 128.
VarMake det3zeroy Float Mugger
det3zeroy 128.
VarMake det3dist Float Mugger
det3dist 300.
VarMake detstepwidth Float Mugger
detstepwidth 0.1
detstepwidth lock
@ -534,53 +548,49 @@ MakeScanCommand xxxscan counter topsi.hdd recover.bin
MakePeakCenter xxxscan
#MakeHM hm1 SinqHM
MakeHM hm1 SIM
hm1 configure HistMode HRPT
hm1 configure OverFlowMode reflect
hm1 configure HistMode PSD
hm1 configure Rank 1
#hm1 configure Length 400
hm1 configure Length 65536
hm1 configure dim0 256
hm1 configure dim1 256
hm1 configure BinWidth 4
hm1 preset 100.
hm1 CountMode Timer
#hm1 configure HMComputer lnse02.psi.ch
hm1 configure xoff 100
hm1 configure xfac 10
hm1 configure yoff 100
hm1 configure yfac 10
#hm1 configure HMComputer psds03.psi.ch
#hm1 configure HMPort 2400
#hm1 configure Counter counter
hm1 configure Counter counter
hm1 genbin 0 10000 2
hm1 configure init 0
hm1 init
MakeHM hm2 SIM
hm2 configure HistMode HRPT
hm2 configure OverFlowMode reflect
hm2 configure HistMode PSD
hm2 configure Rank 1
#hm2 configure Length 400
hm2 configure Length 65536
hm2 configure dim0 256
hm2 configure dim1 256
hm2 configure BinWidth 4
hm2 preset 100.
hm2 CountMode Timer
#hm2 configure HMComputer lnse02.psi.ch
#hm2 configure HMPort 2400
#hm2 configure Counter counter
hm2 init
MakeHM hm3 SIM
hm3 configure HistMode HRPT
hm3 configure OverFlowMode reflect
hm3 configure Rank 1
#hm3 configure Length 400
hm3 configure Length 65536
hm3 configure dim0 256
hm3 configure dim1 256
hm3 configure BinWidth 4
hm3 preset 100.
hm3 CountMode Timer
#MakeHM hm3 SIM
#hm3 configure HistMode PSD
#hm3 configure Rank 1
#hm3 configure Length 65536
#hm3 configure dim0 256
#hm3 configure dim1 256
#hm3 configure BinWidth 4
#hm3 configure HMComputer lnse02.psi.ch
#hm3 configure HMPort 2400
#hm3 configure Counter counter
hm3 init
#hm3 init
ClientPut "Installed 4-circle stuff"
@ -588,7 +598,7 @@ ClientPut "Installed 4-circle stuff"
#source transact.tcl
#Publish transact Spy
MakeSPS sps lnsa12.psi.ch 4000 4
#MakeSPS sps lnsa12.psi.ch 4000 4
#source beamdt.tcl
#------------- C804-DC motors
@ -667,6 +677,7 @@ Publish co User
#source helium.tcl
MakeTRICSNEXUS sicsdatanumber $shome/sics/tmp trics.dic
source $shome/sics/tcl/tricscount.tcl
source autofile.tcl
autofilepath $shome/tmp/auto

View File

@ -46,7 +46,7 @@ mono0 = \
/frame0000,NXentry/TRICS,NXinstrument/monochromator,NXcrystal/NXVGROUP
#------------------------- CountControl
framepreset = \
/$(framename),NXentry/TRICS,NXinstrument/count_control,NXmonitor/SDS preset
/$(framename),NXentry/TRICS,NXinstrument/count_control,NXcounter/SDS preset
framemode = /$(framename),NXentry/TRICS,NXinstrument/count_control,NXcounter/SDS countmode \
-type DFNT_UINT8 -rank 1 -dim {132}
framemonitor = /$(framename),NXentry/TRICS,NXinstrument/count_control,NXcounter/SDS monitor \
@ -61,7 +61,7 @@ detectorx = /frame0000,NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/SDS x \
-attr {axis,1} -attr {units,mm} -type DFNT_FLOAT32 \
-rank 1 -dim {$(framedim1)}
detectory = /frame0000,NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/SDS y \
-attr {axis,1} -attr {units,mm} -type DFNT_FLOAT32 \
-attr {axis,2} -attr {units,mm} -type DFNT_FLOAT32 \
-rank 1 -dim {$(framedim2)}
det1 = \
/$(framename),NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/NXVGROUP