areaDetector  3-5-0
EPICS areaDetector framework
simDetector.h
Go to the documentation of this file.
1 #include <epicsEvent.h>
2 #include "ADDriver.h"
3 
4 #define DRIVER_VERSION 2
5 #define DRIVER_REVISION 9
6 #define DRIVER_MODIFICATION 0
7 
9 class epicsShareClass simDetector : public ADDriver {
10 public:
11  simDetector(const char *portName, int maxSizeX, int maxSizeY, NDDataType_t dataType,
12  int maxBuffers, size_t maxMemory,
13  int priority, int stackSize);
14 
15  /* These are the methods that we override from ADDriver */
16  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
17  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
18  virtual void setShutter(int open);
19  virtual void report(FILE *fp, int details);
20  void simTask();
22 protected:
23  int SimGainX;
24  #define FIRST_SIM_DETECTOR_PARAM SimGainX
25  int SimGainY;
29  int simOffset;
30  int SimNoise;
32  int SimMode;
42  int SimOffset;
57 
58 private:
59  /* These are the methods that are new to this class */
60  template <typename epicsType> int computeArray(int sizeX, int sizeY);
61  template <typename epicsType> int computeLinearRampArray(int sizeX, int sizeY);
62  template <typename epicsType> int computePeaksArray(int sizeX, int sizeY);
63  template <typename epicsType> int computeSineArray(int sizeX, int sizeY);
64  int computeImage();
65 
66  /* Our data */
67  epicsEventId startEventId_;
68  epicsEventId stopEventId_;
69  NDArray *pRaw_;
70  NDArray *pBackground_;
71  bool useBackground_;
72  NDArray *pRamp_;
73  NDArray *pPeak_;
74  NDArrayInfo arrayInfo_;
75  double *xSine1_;
76  double *xSine2_;
77  double *ySine1_;
78  double *ySine2_;
79  double xSineCounter_;
80  double ySineCounter_;
81 };
82 
83 typedef enum {
88 } SimModes_t;
89 
90 typedef enum {
94 
95 #define SimGainXString "SIM_GAIN_X"
96 #define SimGainYString "SIM_GAIN_Y"
97 #define SimGainRedString "SIM_GAIN_RED"
98 #define SimGainGreenString "SIM_GAIN_GREEN"
99 #define SimGainBlueString "SIM_GAIN_BLUE"
100 #define SimOffsetString "SIM_OFFSET"
101 #define SimNoiseString "SIM_NOISE"
102 #define SimResetImageString "RESET_IMAGE"
103 #define SimModeString "SIM_MODE"
104 #define SimPeakStartXString "SIM_PEAK_START_X"
105 #define SimPeakStartYString "SIM_PEAK_START_Y"
106 #define SimPeakWidthXString "SIM_PEAK_WIDTH_X"
107 #define SimPeakWidthYString "SIM_PEAK_WIDTH_Y"
108 #define SimPeakNumXString "SIM_PEAK_NUM_X"
109 #define SimPeakNumYString "SIM_PEAK_NUM_Y"
110 #define SimPeakStepXString "SIM_PEAK_STEP_X"
111 #define SimPeakStepYString "SIM_PEAK_STEP_Y"
112 #define SimPeakHeightVariationString "SIM_PEAK_HEIGHT_VARIATION"
113 #define SimXSineOperationString "SIM_XSINE_OPERATION"
114 #define SimXSine1AmplitudeString "SIM_XSINE1_AMPLITUDE"
115 #define SimXSine1FrequencyString "SIM_XSINE1_FREQUENCY"
116 #define SimXSine1PhaseString "SIM_XSINE1_PHASE"
117 #define SimXSine2AmplitudeString "SIM_XSINE2_AMPLITUDE"
118 #define SimXSine2FrequencyString "SIM_XSINE2_FREQUENCY"
119 #define SimXSine2PhaseString "SIM_XSINE2_PHASE"
120 #define SimYSineOperationString "SIM_YSINE_OPERATION"
121 #define SimYSine1AmplitudeString "SIM_YSINE1_AMPLITUDE"
122 #define SimYSine1FrequencyString "SIM_YSINE1_FREQUENCY"
123 #define SimYSine1PhaseString "SIM_YSINE1_PHASE"
124 #define SimYSine2AmplitudeString "SIM_YSINE2_AMPLITUDE"
125 #define SimYSine2FrequencyString "SIM_YSINE2_FREQUENCY"
126 #define SimYSine2PhaseString "SIM_YSINE2_PHASE"
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Sets an int32 parameter.
Definition: ADDriver.cpp:114
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:141
NDDataType_t
Enumeration of NDArray data types.
Definition: NDAttribute.h:27
int SimGainX
Definition: simDetector.h:23
int SimPeakNumX
Definition: simDetector.h:37
Definition: simDetector.h:87
int SimXSine2Amplitude
Definition: simDetector.h:47
Definition: simDetector.h:91
int SimYSineOperation
Definition: simDetector.h:50
int SimPeakNumY
Definition: simDetector.h:38
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: asynPortDriver.cpp:2083
int SimGainGreen
Definition: simDetector.h:27
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: asynNDArrayDriver.cpp:679
Definition: simDetector.h:92
int SimXSine1Frequency
Definition: simDetector.h:45
int SimGainRed
Definition: simDetector.h:26
int SimPeakStepX
Definition: simDetector.h:39
Definition: simDetector.h:86
Structure returned by NDArray::getInfo.
Definition: NDArray.h:71
SimSineOperation_t
Definition: simDetector.h:90
int SimMode
Definition: simDetector.h:32
list value
Definition: makeDbAndEdl.py:234
Definition: simDetector.h:85
int SimYSine1Frequency
Definition: simDetector.h:52
int SimYSine1Phase
Definition: simDetector.h:53
int SimYSine2Amplitude
Definition: simDetector.h:54
int SimYSine2Frequency
Definition: simDetector.h:55
int SimPeakStartX
Definition: simDetector.h:33
int simOffset
Definition: simDetector.h:29
int SimNoise
Definition: simDetector.h:30
int SimPeakStepY
Definition: simDetector.h:40
int SimXSine1Amplitude
Definition: simDetector.h:44
virtual void setShutter(int open)
Set the shutter position.
Definition: ADDriver.cpp:32
SimModes_t
Definition: simDetector.h:83
int SimGainY
Definition: simDetector.h:25
int SimGainBlue
Definition: simDetector.h:28
int SimXSine2Frequency
Definition: simDetector.h:48
Definition: simDetector.h:84
int SimPeakStartY
Definition: simDetector.h:34
int SimXSineOperation
Definition: simDetector.h:43
Simulation detector driver; demonstrates most of the features that areaDetector drivers can support.
Definition: simDetector.h:9
int SimYSine1Amplitude
Definition: simDetector.h:51
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int SimOffset
Definition: simDetector.h:42
int SimYSine2Phase
Definition: simDetector.h:56
int SimPeakHeightVariation
Definition: simDetector.h:41
int SimPeakWidthY
Definition: simDetector.h:36
int SimXSine1Phase
Definition: simDetector.h:46
int SimXSine2Phase
Definition: simDetector.h:49
int SimPeakWidthX
Definition: simDetector.h:35
int SimResetImage
Definition: simDetector.h:31