Files
ADAndor/documentation/simDetectorDoc.html
rivers 5ba5589ea2 Minor fixes
git-svn-id: https://subversion.xor.aps.anl.gov/synApps/areaDetector/trunk@10305 dc6c5ff5-0b8b-c028-a01f-ffb33f00fc8b
2010-03-22 18:45:39 +00:00

299 lines
9.7 KiB
HTML
Executable File

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>areaDetector Simulation driver</title>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
</head>
<body>
<div style="text-align: center">
<h1 style="text-align: center">
areaDetector Simulation driver</h1>
<h2>
August 18, 2009</h2>
<h2>
Mark Rivers</h2>
<h2>
University of Chicago</h2>
</div>
<p>
&nbsp;</p>
<h2>
Table of Contents</h2>
<ul>
<li><a href="#Introduction">Introduction</a></li>
<li><a href="#Driver_parameters">Simulation driver specific parameters</a></li>
<li><a href="#Unsupported">Unsupported standard driver parameters</a></li>
<li><a href="#Configuration">Configuration</a></li>
<li><a href="#MEDM_screens">MEDM screens</a></li>
<li><a href="#Viewers">Image viewers</a></li>
</ul>
<h2 id="Introduction">
Introduction</h2>
<p>
simDetector is a driver for a simulated area detector. The simulation detector is
useful as a model for writing real detector drivers. It is also very useful for
testing plugins and channel access clients.
</p>
<p>
This driver inherits from <a href="areaDetectorDoc.html#ADDriver">ADDriver</a>.
It implements nearly all of the parameters in NDStdDriverParam_t (see <a href="areaDetectorDoxygenHTML/asyn_n_d_array_driver_8h.html">
asynNDArryDriver.h</a>) and in ADStdDriverParam_t (see <a href="areaDetectorDoxygenHTML/_a_d_driver_8h.html">
ADArrayDriver.h</a>), with the exception of the file saving parameters, which
it does not implement. It also implements a few parameters that are specific to
the simulation detector. The <a href="areaDetectorDoxygenHTML/classsim_detector.html">
simDetector class documentation</a> describes this class in detail.</p>
<p>
The writeInt32 and writeFloat64 methods override those in the base class. The driver
takes action when new parameters are passed via those interfaces. For example, the
ADAcquire parameter (on the asynInt32 interface) is used to turn acquisition (i.e.
computing new images) on and off.
</p>
<h2 id="Driver_parameters">
Simulation driver specific parameters</h2>
<p>
The simulation driver-specific parameters are the following:
</p>
<table border="1" cellpadding="2" cellspacing="2" style="text-align: left">
<tbody>
<tr>
<td align="center" colspan="7">
<b>Parameter Definitions in simDetector.cpp and EPICS Record Definitions in simDetector.template</b></td>
</tr>
<tr>
<th>
Parameter index variable</th>
<th>
asyn interface</th>
<th>
Access</th>
<th>
Description</th>
<th>
drvInfo string</th>
<th>
EPICS record name</th>
<th>
EPICS record type</th>
</tr>
<tr>
<td>
SimGainX</td>
<td>
asynFloat64</td>
<td>
r/w</td>
<td>
Gain in the X direction</td>
<td>
SIM_GAINX</td>
<td>
$(P)$(R)GainX<br />
$(P)$(R)GainX_RBV</td>
<td>
ao<br />
ai</td>
</tr>
<tr>
<td>
SimGainY</td>
<td>
asynFloat64</td>
<td>
r/w</td>
<td>
Gain in the Y direction</td>
<td>
SIM_GAINY</td>
<td>
$(P)$(R)GainY<br />
$(P)$(R)GainY_RBV</td>
<td>
ao<br />
ai</td>
</tr>
<tr>
<td>
SimGainRed</td>
<td>
asynFloat64</td>
<td>
r/w</td>
<td>
Gain of the red channel</td>
<td>
SIM_GAIN_RED</td>
<td>
$(P)$(R)GainRed<br />
$(P)$(R)GainRed_RBV</td>
<td>
ao<br />
ai</td>
</tr>
<tr>
<td>
SimGainGreen</td>
<td>
asynFloat64</td>
<td>
r/w</td>
<td>
Gain of the green channel</td>
<td>
SIM_GAIN_GREEN</td>
<td>
$(P)$(R)GainGreen<br />
$(P)$(R)GainGreen_RBV</td>
<td>
ao<br />
ai</td>
</tr>
<tr>
<td>
SimGainBlue</td>
<td>
asynFloat64</td>
<td>
r/w</td>
<td>
Gain of the blue channel</td>
<td>
SIM_GAIN_BLUE</td>
<td>
$(P)$(R)GainBlue<br />
$(P)$(R)GainBlue_RBV</td>
<td>
ao<br />
ai</td>
</tr>
<tr>
<td>
SimResetImage</td>
<td>
asynInt32</td>
<td>
r/w</td>
<td>
Set to 1 to reset image back to initial conditions</td>
<td>
RESET_IMAGE</td>
<td>
$(P)$(R)Reset<br />
$(P)$(R)Reset_RBV</td>
<td>
longout<br />
longin</td>
</tr>
</tbody>
</table>
<p>
For monochrome images (NDColorMode=NDColorModeMono) the simulation driver initially
sets the image[i, j] = i*SimGainX + j*SimGainY * ADGain * ADAcquireTime * 1000.
Thus the image is a linear ramp in the X and Y directions, with the gains in each
direction being detector-specific parameters. Each subsquent acquisition increments
each pixel value by ADgain*ADAcquireTime*1000. Thus if ADGain=1 and ADAcquireTime=.001
second then the pixels are incremented by 1. If the array is an unsigned 8 or 16
bit integer then the pixels will overflow and wrap around to 0 after some period
of time. This gives the appearance of bands that appear to move with time. The slope
of the bands and their periodicity can be adjusted by changing the gains and acquire
times.
</p>
<p>
For color images (NDColorMode=NDColorModeRGB1, RGB2 or RGB3) there are 3 images
computed, one each for the red, green and blue channels. Each image is computed
with the same algorithm as for the monochrome case, except each is multiplied by
its appropriate gain factor (SimGainRed, SimGainGreen, SimGainBlue). Thus if each
of these color gains is 1.0 the color image will be identical to the monochrome
image, but if the color gains are different from each other then image will have
color bands.</p>
<h2 id="Unsupported">
Unsupported standard driver parameters</h2>
<ul>
<li>Collect: Number of exposures per image (ADNumExposures)</li>
<li>Collect: Trigger mode (ADTriggerMode)</li>
<li>File control: No file I/O is supported</li>
</ul>
<h2 id="Configuration">
Configuration</h2>
<p>
The simDetector driver is created with the simDetectorConfig command, either from
C/C++ or from the EPICS IOC shell.</p>
<pre>int simDetectorConfig(const char *portName,
int maxSizeX, int maxSizeY, int dataType,
int maxBuffers, size_t maxMemory,
int priority, int stackSize)
</pre>
<p>
The simDetector-specific fields in this command are:</p>
<ul>
<li><code>maxSizeX</code> Maximum number of pixels in the X direction for the simulated
detector.</li>
<li><code>maxSizeY</code> Maximum number of pixels in the Y direction for the simulated
detector. </li>
<li><code>dataType</code> Initial data type of the detector data. These are the enum
values for NDDataType_t, i.e.
<ul>
<li>0=NDInt8</li>
<li>1=NDUInt8</li>
<li>2=NDInt16</li>
<li>3=NDUInt16</li>
<li>4=NDInt32</li>
<li>5=NDUInt32</li>
<li>6=NDFloat32</li>
<li>7=NDFloat64</li>
</ul>
</li>
</ul>
<p>
For details on the meaning of the other parameters to this function refer to the
detailed documentation on the simDetectorConfig function in the <a href="areaDetectorDoxygenHTML/sim_detector_8cpp.html">
simDetector.cpp documentation</a> and in the documentation for the constructor
for the <a href="areaDetectorDoxygenHTML/classsim_detector.html">simDetector class</a>.
</p>
<p>
There an example IOC boot directory and startup script (<a href="simdetector_st_cmd.html">iocBoot/iocSimDetector/st.cmd)</a>
provided with areaDetector.
</p>
<h2 id="MEDM_screens">
MEDM screens</h2>
<p>
The following is the MEDM screen ADBase.adl connected to a simulation detector.
</p>
<div style="text-align: center">
<h3>
ADBase.adl</h3>
<img alt="ADBase_sim.png" src="ADBase_sim.png" />
</div>
<p>
The following is the MEDM screen that provides access to the specific parameters
for the simulation detector.
</p>
<div style="text-align: center">
<h3>
simDetector.adl</h3>
<img alt="simDetector.png" src="simDetector.png" />
</div>
<h2 id="Viewers">
Image viewers</h2>
<p>
The following is an IDL <a href="areaDetectorViewers.html#IDLViewer">epics_ad_display</a>
screen using <a href="http://cars.uchicago.edu/software/idl/imaging_routines.html#image_display">
image_display</a> to display the simulation detector images.
</p>
<div style="text-align: center">
<h3>
epics_ad_display.pro</h3>
<img alt="simDetector_image_display.png" src="simDetector_image_display.png" />
</div>
<p>
The following is an ImageJ plugin <a href="areaDetectorViewers.html#ImageJViewer">
EPICS_AD_Viewer</a> screen displaying color simulation detector images.
</p>
<div style="text-align: center">
<h3>
ImageJ plugin EPICS_AD_Viewer</h3>
<img alt="simDetector_ImageJ_display.png" src="simDetector_ImageJ_display.png" />
</div>
</body>
</html>