- Adding first working version of the McStas SICS connection to cvs
SKIPPED: psi/polterwrite.c
This commit is contained in:
@ -10,13 +10,12 @@ Hardware is configured into the SICS system by executing special hardware
|
||||
configuration commands from the server initialisation file. These commands
|
||||
are described here. Much SICS hardware is hooked up to the system via RS-232
|
||||
interfaces. The SICS server communicates with such devices through a serial
|
||||
port server program running on a Macintosh PC. All such devices require on
|
||||
port server program running on the instrument computer All such devices require on
|
||||
initialisation the following parameters:
|
||||
<ul>
|
||||
<li><b>hostname</b> The name of the macintosh computer.
|
||||
<li><b>hostname</b> The name of the instrument computer.
|
||||
<li><b>port</b> The port number where the serial port server program is
|
||||
listening for requests. It is given on the Macintosh screen when the serial
|
||||
port server is running. It is usually 4000.
|
||||
listening for requests. It is usually 4000.
|
||||
<li><b>channel</b> The number of the RS-232 interface on the Macintosh. 0 is
|
||||
the standard Macintosh modem port, 1 is the standard Macintosh printer port,
|
||||
2 is the first connector on the interface extension box. This leads to much
|
||||
@ -146,6 +145,10 @@ accessible as object name. Failrate is the per centage of invocations
|
||||
at which the counter will generate a random failure for testing error
|
||||
treatment code. If failrate is less then 0, there are no
|
||||
failures. This can be used in a instrument simulation server.
|
||||
<dt>MakeCounter name mcstas
|
||||
<dd>Creates a counter which interoperates with a McStas simulation. Please note,
|
||||
that the McStas module mccontrol must have been initialized before this initialization
|
||||
can work.
|
||||
<DT>MakeCounter name EL737 host port chan
|
||||
<DD>This command creates a single
|
||||
counter name, using an EL737 driver. The counter is at host host, listening
|
||||
|
@ -20,6 +20,7 @@ Go to:
|
||||
<li> Advice about <a href=hwini.htm> hardware </a> configuration.
|
||||
<li> A description of <a href = command.htm> command </a> initialisation.
|
||||
<li> Managing the SICS <a href="helpman.htm"> help </a> system.
|
||||
<li> Connecting SICS to <a href="mcstas.htm">McStas</a> Simulations.
|
||||
</ul>
|
||||
</p>
|
||||
<!latex-on>
|
||||
|
@ -47,6 +47,7 @@ which is described elsewhere.
|
||||
%html hwini.htm 1
|
||||
%html command.htm 1
|
||||
%html helpman.htm 2
|
||||
%html mcstas.htm 2
|
||||
%html special.htm 1
|
||||
%html serial.htm 2
|
||||
%html status.htm 2
|
||||
|
140
doc/manager/mcstas.htm
Normal file
140
doc/manager/mcstas.htm
Normal file
@ -0,0 +1,140 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>The McStas SICS Interface</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>The McStas SICS Interface</H1>
|
||||
<P>
|
||||
It is useful to drive a simulation of an instrument with the same interface as is used at
|
||||
the original instruments. One of the better packages for performing simulations of neutron
|
||||
scattering instruments, including samples, is McStas. This section describes SICS
|
||||
interface to McStas simulations. The interface consists of three parts:
|
||||
<ul>
|
||||
<li>A McStas controller module which controls the actual simulation.
|
||||
<li>A McStas reader which is responsible for reading simulated data into
|
||||
SICS counters and histogram memories.
|
||||
<li>Counter and histogram memory drivers which redirect their actions to the
|
||||
McStas controller module.
|
||||
</ul>
|
||||
The general ideas is that all parameters are handled through the normal SICS simulation
|
||||
drivers. The counting operations, however, are linked with the McStas simulation. In order
|
||||
to be portable, many aspects are controlled by scripts. These scripts are configured at the
|
||||
McStas Controller. Several scripts must be defined:
|
||||
<dl>
|
||||
<dt>startmcstas
|
||||
<dd>This script will be invoked when counting starts and has to collect the necessary
|
||||
settings from SICS, construct a McStas command line and start the simulation. As a return
|
||||
value this script has to return the PID of the started mcstat process.
|
||||
<dt>mcstastest pid
|
||||
<dd>Tests if the McStas simulation is still running.
|
||||
<dt>mcstasdump pid
|
||||
<dd>Has to send a signal to McStas which causes it to dump its data without terminating.
|
||||
Current versions of McStas do this on receiving the USR2 signal.
|
||||
<dt>mcstasstop pid
|
||||
<dd>Stops the McStas simulation.
|
||||
<dt>mcstasread
|
||||
<dd>Reads the McStas simulation output and transfers monitor and histogram memory data
|
||||
into the appropriate SICS objects.
|
||||
</dl>
|
||||
</p>
|
||||
<h2>McStas Requirements and SICS Requirements</h2>
|
||||
<p>
|
||||
In order for the McStas SICS interface to work the McStas simulation has to be configured
|
||||
in a certain way:
|
||||
<ul>
|
||||
<li>All parameters which have to pass between SICS and McStas have to be declared as
|
||||
simulation parameters in the DEFINE INSTRUMENT section of the instrument definition file.
|
||||
Alternatively SICS can write the data to be passed to McStas into a file. But then this
|
||||
file must be read in the INITIALIZE section of the instrument definition and values must
|
||||
be assigned to the appropriate McStas variables.
|
||||
<li>McStas must dump its data into a single file: use the <b>-f filename</b> option.
|
||||
The format must be <b> --format=XML</b>.
|
||||
<li> In order to count on monitor, a modified PSD_monitor component MUST be used in the
|
||||
simulation. This component writes the collected total counts into a file. This file is
|
||||
the read by SICS in order to determine the control monitor. Evaluating the McStas XML dump \
|
||||
file each time proved to be to inaccurate. The name of the file containing the monitor
|
||||
must be configured through: mccontrol configure mcmonfile name-of-file.
|
||||
<li>The mcstas simulation executable must be declared with allowexec in order to be able
|
||||
to start with the Tcl exec command.
|
||||
</ul>
|
||||
</p>
|
||||
<h2>The McStas Reader</h2>
|
||||
<p>
|
||||
In order to enable trasnfer from McStas result files into SICS objects a reader object is
|
||||
needed. This module supports only XML formatted McStas files, with the output dumped into
|
||||
one file. The McStas options to achieve this are: <b>-f filename --format="XML"</b>
|
||||
This module supports the following commands:
|
||||
<dl>
|
||||
<dt>mcreader open filename
|
||||
<dd>Opens a McStas simulation file for reading.
|
||||
<dt>mcreader close
|
||||
<dd>Closes a McStas file after use.
|
||||
<dt>mcreader insertmon path object monitornumber
|
||||
<dd>This transfers a monitor value from a previously opened McStas file into a SICS
|
||||
monitor field. The McStas field read is the values tag belonging to the component. The
|
||||
parameters:
|
||||
<dl>
|
||||
<dt>path
|
||||
<dd>The path to the correct values field in the simulation file. The format is the same
|
||||
as the path format for NXopenpath in the NeXus-API (which will internally be used). For
|
||||
groups, the name attribute is used a path component.
|
||||
<dt>object
|
||||
<dd>The counter object into which the monitor is read. This is a limitation, with the
|
||||
this McStas interface only counters can store monitors.
|
||||
<dt>monitornumber
|
||||
<dd>Monitornumber is the monitor channel into which the value is to be stored.
|
||||
</dl>
|
||||
<dt>mcreader inserthm path hmobject
|
||||
<dd>Inserts array data stored under path in the histogram memory array of hmobject which
|
||||
must be a valid SICS histogram memory object. The path is the same as given for insertmon,
|
||||
but of course the data part of the detector must be addressed.
|
||||
</dl>
|
||||
</p>
|
||||
<H2>The McStas Controller</h2>
|
||||
<p>
|
||||
The actual control of the "counting" operation of the McStas simulation is done by the
|
||||
McStas controller module in SICS. Internally this module implements the routines for
|
||||
counting virtual neutrons. Towards the SICS interpreter, an interface is exhibited which
|
||||
allows to configure and test the McStas controller. The McStas Controller delegates many
|
||||
tasks to script procedures written in SICS's internal Tcl scripting language. This is done
|
||||
in order to achieve a degree of generality for various types of instruments and in order
|
||||
to allow easier adaption to differing demands. This is the SICS interface implemented:
|
||||
<dl>
|
||||
<dt>mccontrol configure mcstart startscriptname
|
||||
<dd>Configures the script which starts the McStas simulation. Startscriptname is the name
|
||||
of a Tcl procedure which collects the necessary information from SICS, builds a command
|
||||
line and finally starts the simulation. This script is expected to return either an error or
|
||||
the PID of the started process. Startscriptname will be called with the parameters mode and
|
||||
preset which represent the counting characteristics.
|
||||
<dt>mccontrol configure mcisrunning runtestscriptname
|
||||
<dd>Configures the name of a script which tests if the McStas process is still running.
|
||||
Runtestscriptname is called with the PID as a parameter. This returns 0 in the case the
|
||||
McStas simulation was stopped or 1 if it is still running.
|
||||
<dt>mccontrol configure mcdump dumpscriptname
|
||||
<dd>Configures the name of the script which causes McStas to dump intermediate results.
|
||||
The script will be called with the PID of the started McStas process as a parameter.
|
||||
<dt>mccontrol configure mckill killscript
|
||||
<dd>Configure the name of a procedure which kills the current McStas simulation
|
||||
process. KillScript will be called with the PID of the McStas simulation as a parameter.
|
||||
<dt>mccontrol configure mccopydata copyscript
|
||||
<dd>This configures the name of a script which has the task to read the results of
|
||||
a McStas simulation and assign values to SICS monitors and histogram memories.
|
||||
<dt>mccontrol configure update updateintervallinseconds
|
||||
<dd>This configures the minimum time between McStas dumps in seconds. The idea is that
|
||||
SICS buffers values during a simulation run and does not interrupt the McStas process to
|
||||
often.
|
||||
<dt>mccontrol configure mcmonfile filename
|
||||
<dd>This configures the file which mccontrol is going to read in order to watch the
|
||||
simulation control monitor.
|
||||
<dt>mccontrol list
|
||||
<dd>Prints a listing of the configuration parameters.
|
||||
<dt>mccontrol run scriptkey
|
||||
<dd>Invokes one of the scripts configure for testing purposes. scripkey can be one of:
|
||||
mcstart, mcisrunning, mcdump, mckill and mccopydata.
|
||||
</dl>
|
||||
Standard scripts for many of the script routines required are provided for the unix
|
||||
environment in the file mcsupport.tcl. Please note, that all system executables called
|
||||
from scripts must be registrered with SICS using the allowexec command.
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
169
doc/user/tasub.htm
Normal file
169
doc/user/tasub.htm
Normal file
@ -0,0 +1,169 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>TASUB: The Triple Axis Calculation Module</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>TASUB: The Triple Axis Calculation Module</H1>
|
||||
<P>
|
||||
On a triple axis instrument the parameters incoming energy, Q-position in 3D and
|
||||
analyzed energy have to be changed frequently. These calculations are the task of
|
||||
the TASUB module. This module uses the calculus described by M. Lumsden, J. L.
|
||||
Roberston and M. Yethiraj in J. Appl. Cryst. (2005), 38, 405-411. The special feauture of
|
||||
this algorithm is that the tilt cradles of the sample table are used to help during
|
||||
alignment and in order to drive out of plane (within the limits of the tilt cradles).
|
||||
For alignment, two reflections must be located and their angles and Q-E parameters
|
||||
entered into the module. Then a UB matrix can be calculated. With a UB matrix, the
|
||||
Q-E variables ei, ki, ef, kf, en, qh, qk and ql can be driven as virtual motors in
|
||||
SICS.
|
||||
</P>
|
||||
<h2>Commands understood by Tasub</h2>
|
||||
<p>
|
||||
<h3>Monochromator and Analyzer Parameters
|
||||
<p>
|
||||
Incident and scattered energies are defined by monochromator crystals. In order for the
|
||||
calculations to work, some parameters need to be configured. Monochromator and analyzer
|
||||
parameters can be accessed with the prefixes:
|
||||
<ul>
|
||||
<li>tasub mono
|
||||
<li>tasub ana
|
||||
</ul>
|
||||
The parameter syntax used is as usual: giving only the parameter name queries the value,
|
||||
giving the parameter plus a value sets the parameter to the new value. The following
|
||||
parameters are supported:
|
||||
<dl>
|
||||
<dt>dd
|
||||
<dd>The d-spacing of the reflection used
|
||||
<dt>ss
|
||||
<dd>The scattering sense, 1 or -1 are possible.
|
||||
<dt>hb1
|
||||
<dd>First parameter for the calculation of the horizontal curvature
|
||||
<dt>hb2
|
||||
<dd>Second parameter for the calculation of the horizontal curvature
|
||||
<dt>vb1
|
||||
<dd>First parameter for the calculation of the vertical curvature
|
||||
<dt>vb2
|
||||
<dd>Second parameter for the calculation of the vertical curvature
|
||||
</dl>
|
||||
An example:
|
||||
<dl>
|
||||
<dt>tasub mono dd
|
||||
<dd>will print the current d-spacing of the monochromator
|
||||
<dt>tasub mono dd 4.3
|
||||
<dd>Will set the d-spacing of the monochromator to 4.3
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Cell Parameters</h3>
|
||||
<p>
|
||||
In order for the UB matrix calculation to work, the cell constants must be known:
|
||||
<dl>
|
||||
<dt>tasub cell
|
||||
<dd>This command prints the current cell parameters.
|
||||
<dt>tasub cell a b c alpha beta gamma
|
||||
<dd>This command sets the new cell parameters. All six values must be given.
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Reflection Management</h3>
|
||||
<p>
|
||||
In order to calculate a UB matrix a list of reflections must be maintained. This is done
|
||||
with the commands in this section:
|
||||
<dl>
|
||||
<dt>tasub clear
|
||||
<dd>Clears the reflection list
|
||||
<dt>tasub listref
|
||||
<dd>Prints a list of all known reflections.
|
||||
<dt>tasub del num
|
||||
<dd>Delete the reflection number num from the list
|
||||
<dt>tasub addref qh qk ql
|
||||
<dd>Adds a reflection to the list. The indices of the reflections are given. The angles
|
||||
and energy values are read from the motors. Use this command only when the instrument is
|
||||
positioned right on a reflection.
|
||||
<dt>tasub addref qh qk ql a3 a4 sgu sgl ei ef
|
||||
<dd>Add a new reflection to the list. Besides the indices all angles are given:
|
||||
a3, the sample rotation, a4, sample two theta, sgu, upper tilt cradle, sgl, lower tilt
|
||||
cradle and incoming energey ei and outgoing energy ef.
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Calculations</h3>
|
||||
<p>
|
||||
This section covers the parameters and commands to use to make the module do calculations
|
||||
for you.
|
||||
<dl>
|
||||
<dt>tasbub const ki | kf
|
||||
<dd>Sets a parameter to determine if KI or KF is fixed when the energy transfer en is
|
||||
being driven. Allowed values: ki, kf
|
||||
<dt>tasub const
|
||||
<dd>Prints if ki or kf is fixed.
|
||||
<dt>tasub ss
|
||||
<dd>Prints the sample scattering sense.
|
||||
<dt>tasub ss 1 | -1
|
||||
<dd>Sets the sample scattering sense. Allowed values are either 1 or -1.
|
||||
<dt>tasub makeub r1 r2
|
||||
<dd>Calculate a new UB matrix from the current cell constants and the entries r1 and r2 in
|
||||
the reflection list. r1 and r2 are integer numbers. This command will not only print the
|
||||
new UB matrix but also the results of various back and forth calculations performed with
|
||||
the new UB matrix. This can be inspected in order to check the new UB. WARNING: The calculation
|
||||
will go wrong if the scattering sense at the sample has changed since the reflections used
|
||||
for the UB matrix determination have been entered.
|
||||
<dt>tasub listub
|
||||
<dd>prints the current UB matrix.
|
||||
<dt>tasub calcang qh qk ql ei ef
|
||||
<dd>Will calculate new angles for the Q-E position specified. The angles will be
|
||||
printed in the order: monochromator two theta, sample rotation, sample two theta,
|
||||
lower tilt cradle, upper tilt cradle and analyzer two theta.
|
||||
<dt>tasub calcqe a2 a3 a4 sgu sgl a6
|
||||
<dd>Calculates and prints the Q-E position from the angles given: a2 = monochromator
|
||||
two theta, a3 = sample rotation, a4 = sample tow theta, sgu = upper tilt cradle, sgl =
|
||||
lower tilt cradle and a6 = analyzer two theta. The Q-E position is printed in the sequence:
|
||||
qh, qk, ql, ei, ef.
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Virtual Motors</h3>
|
||||
<p>
|
||||
The tasub module also installs the following virtual motors into SICS: ei, ki, qh, qk, ql,
|
||||
en, ef, kf and qm. All these motors can be used in SICS drive, run or scan commands like real
|
||||
motors. Driving them triggers a recalculation of angles and the drives the real motors to
|
||||
appropriate values. The virtual motors have a very limited command set
|
||||
(shown at the example of qh):
|
||||
<dl>
|
||||
<dt>qh
|
||||
<dd>The name of the motor alone will print its current position.
|
||||
<dt>qh target
|
||||
<dd>This will print the last requested target position for this virtual motor.
|
||||
</dl>
|
||||
</p>
|
||||
<p>
|
||||
The virtual motor qm implements <b>powder mode</b>. In this mode, only the sample two theta
|
||||
and energy motors will be driven, sample rotation and tilt cradles will be left at their
|
||||
respective positions. THis is commonly used to analyze the energy transfer of powder samples.
|
||||
</p>
|
||||
<p>
|
||||
There is another important command:
|
||||
<dl>
|
||||
<dt>tasub update
|
||||
<dd>This command will force a recalculation of the current Q-E position for the virtual
|
||||
motors from angles. Normally tasub will take care of this. However, if any of the angle
|
||||
motors are moved directly or manualy, this command might be required. The SICS dr
|
||||
wrapper command, however, even takes care of this.
|
||||
</dl>
|
||||
</p>
|
||||
<h3>Internal Commands</h3>
|
||||
<p>
|
||||
The tasub module supports some more commands which are used by SICS in order to restore
|
||||
the tasub configuration between instantiations of SICS. These commands are documented here
|
||||
for the sake of completeness:
|
||||
<dl>
|
||||
<dt>tasub setub ub11 ub12 ub13 ub21 ub22 ub23 ub31 ub32 ub33
|
||||
<dd>Sets the UB matrix. Nine values are required.
|
||||
<dt>tasub setnormal n1 n2 n3
|
||||
<dd>This command sets the plane normal which is required in calculations. Normally this
|
||||
plane normal is automatically generated during the calculation of the UB matrix.
|
||||
<dt>tasub settarget qh qk ql qm ki kf
|
||||
<dd>Sets the Q-E target.
|
||||
<dt>tasub r1 qh qk ql a3 a4 sgu sgl ki kf
|
||||
<dt>tasub r2 qh qkl ql a3 a4 sgu sgl ki kf
|
||||
<dd>These commands set the values for the two reflections used for generating the UB
|
||||
matrix.
|
||||
</dl>
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
Reference in New Issue
Block a user