A single scan record supports a one dimensional scan. It is also possible to link scan records together to define multi-dimensional scans in a quite complex configuration.
Each scan record can control up to four "positioners" and acquire data from up to four process variables (typically detector data or measured positions of devices) during a scan. Two additional output variables can be defined to trigger other process variables (usually "detectors") between the positioning phase and the data acquisition phase. These outputs will be referred to as "detector triggers".
Although the typical use of a scan record is to move "positioners" and record "detector" data at each position, it can also be used for other applications. Any controllable device can be scanned through incremental values while recording data from any other process variables. For example, one of the "positioner" PVs could be used to vary the gain of a detector or the speed of a motor during a scan. Another example would be to use the scan record to vary several power supplies and record the beam position at each value of the supplies. In this context, the scan record becomes a general purpose "Vary w, x, y, z and record a, b, c, d" record. Therefore, throughout this document the word "positioner" and "controller" will be used synonymously. When referring to the data being recorded at each point, the word "detector" will be used.
All of the process variable names used to identify controllers, detectors, and detector triggers are specified using "reassignable links". This allows a scan to be configured on the fly. Scan parameters, including the names of controllers and detectors, can be saved and restored using the BURT.
NOTE: In this version, the PVs used in the "reassignable links" fields must reside in the same IOC.
In Figure 1, when the scan is initiated, the scan record commands several positioners (transform record and motor record) to move to their starting positions. The WAIT_1 record detects when all movement is complete and forces the SCAN record to process again. The SCAN record realizes that the positioning is complete and thus triggers the Detectors. The WAIT_2 record detects when data is valid and forces the SCAN record to process yet again. The SCAN record will then read the Detector Data and command the positioners to their next step. This will continue until the SCAN record has completed the appropriate number of steps. At the end of the scan, the SCAN record contains data arrays for each of the "detectors", as well as arrays that contain the positions to which each controller was commanded at each point. A simple x-y plot using this data will provide the detector data vs. position results.
Figure 1: Typical Database Support for a SCAN
Figure 2: A Two Dimensional Scan Implementation
To initiate a scan, the SCAN_Y record is commanded to begin. It commands its "positioners" to the specified starting point. The WAIT_1 record detects when all motors are stopped and forces the SCAN_Y record to process again. The SCAN_Y record will now write to its "Detector Trigger", which in this case begins a scan of the SCAN_X record. The SCAN_X record will now go through its entire programmed scan, acquiring data from the detectors at each point.
When the SCAN_X record is complete, the WAIT_4 record will force the processing of SCAN_Y, which will increment the position of the y-controller and initiate the x scan once again.
This approach to configuring a two dimensional scan is very flexible. Note that to "test" the x scan, one could write to the "BeginScan" field of SCAN_X which would perform an entire x scan. Although the SCAN_Y record would get processed after the x scan was complete (via the WAIT_4 record), nothing would happen because it was not in the middle of a scan. In addition, any of the motors can be moved individually when a scan is not in process without any unexpected behavior (detectors would not be triggered unless the operator did it deliberately). One could even build a three dimensional scan by adding an additional scan record that initiates the y-scan after positioning a z-controller.
There are three modes for determining the desired value for the positioner. If a positioner is specified as "linear", its desired value is determined by using parameters such as start_position, step_increment, number_of_steps, and end_position. This mode will be discussed in more detail in the next paragraph. If a positioner is specified as "lookup", its next position is found in an array that has been loaded into the record prior to initiating a scan. If the positioner is specified as "on-the-fly", it is commanded to the end_position after the first data point is collected and not changed again for the duration of the scan.
A linear scan involving a single positioner is fully defined by three parameters, e.g., the start position, the step size, and the number of data points. A scan involving N controllers is defined by merely 2N+1 parameters, since the number of data points must be the same for all controllers. For the convenience of interactive users, and to support channel-access clients that define scans differently, the scan record provides for six redundant scan-definition parameters (for the first controller only): START, END, CENTER, WIDTH, STEP, and NPTS. The record calculates values for unspecified parameters so that the set is always self consistent, and it imposes an upper limit (MAXPTS) on NPTS. WIDTH may be negative.
There is no unique prescription for removing inconsistencies among redundant parameters, and no hardcoded set of preferences among parameters is likely to please everyone. Therefore, the scan record allows the user to "freeze" parameters, so that they will not be changed in the record's internal attempts to ensure self-consistency of the parameter set. Frozen parameters can be changed by the user and by any other client. It is the user's responsibility to ensure that frozen parameters do not prevent freely specifying unfrozen parameters. For example, if both STEP and NPTS are frozen, changes to WIDTH will be rejected. Similarly, if both START and CENTER are frozen, changes to END and WIDTH will have no effect. By default, START, STEP, and NPTS are frozen. When the record cannot adjust the parameters to be consistent, a flag is raised (ALRT) and a message reported (SMSG).
Although this approach may seem to present the user with an overwhelming number of choices, it should be noted that "by default" the user only has to enter START, STEP, and NPTS to fully define the scan of a controller. The "user interface" (usually medm or another CA client) need only present the user with these fields. However, by changing the "freeze flags" from the default and presenting the user with different fields to fill in, the scan can be defined in a completely flexible way. The result is that a simple scan can be defined easily, but advanced users are not limited in flexibility.
For those controllers defined as "linear", each desired position is placed in the "desired position" array that is used for lookup mode. Therefore, after the scan is complete, this array will always contain the sequence of desired positions to which the controller was commanded. These values will have been provided by the user for "lookup" mode and calculated by the scan record for "linear" mode. This array will contain no useful data if "on-the-fly" mode was used.
If neither Detector Trigger contains a valid PV, the scan record will skip this step and acquire the data immediately. Note that specifying a "Detector Trigger" requires the scan record to be processed an additional time each point.
For single dimension scans, the scan is complete when the ExecuteScan flag is set back to zero by the record processing routine. The application program can then read the position arrays and the data arrays (or have a monitor set on them so the record will "post_monitors" when complete).
For two dimension scans similar to Figure 2, the application program should read the arrays from the SCAN_X record after the completion of each x scan and correlate it to the current y controller information. This will allow the application program to display data after each x scan. The scan record will buffer the data for only one x scan, so the application must read the arrays before the next x scan is completed. If the scan is fast enough that this may prevent a problem, the application program can contribute to the wait record algorithm such that the y -controllers are not moved until the application program has completely read the previous SCAN_X data.
On slow scans, the application program may want to see the scan is process on a point by point basis. Therefore, the scan record will "post_monitors" on fields that it updates each point, but it will not post monitors faster than 20 times per second. If a scan is proceeding at a rate less than 20 points per second, every point will be posted. If a scan is proceeding at 100 steps per second, scalar values will be posted every 5th point (approx). In either case, the array data will contain every point at the completion of the scan. It is not recommended that the application program use the point to point data except for keeping the operator aware of the progress of the scan.
--------------------------------------------------------------- Field Type DCT Initial Access Modify Rec Proc PP Monitor --------------------------------------------------------------- VERS FLOAT No 1.0 Yes No No No VAL DOUBLE No 0 Yes Yes No No SMSG STRING No Null Yes Yes Yes No CMND ENUM No 0 Yes Yes Yes No ALRT UCHAR No 0 Yes No Yes No RPVT NOACCESS No Null No No No No MPTS SHORT Yes 100 Yes No No No EXSC SHORT No 0 Yes Yes Yes No PXSC UCHAR No 0 Yes No No No NPTS SHORT Yes 100 Yes Yes Yes No FPTS RECCHOICE Yes 1 Yes Yes No No CPT SHORT No 0 Yes No Yes* No PCPT SHORT No 0 Yes No No No TOLP ULONG No 0 Yes No No No P1PV STRING Yes Null Yes Yes No No P2PV STRING Yes Null Yes Yes No No P3PV STRING Yes Null Yes Yes No No P4PV STRING Yes Null Yes Yes No No R1PV STRING Yes Null Yes Yes No No R2PV STRING Yes Null Yes Yes No No R3PV STRING Yes Null Yes Yes No No R4PV STRING Yes Null Yes Yes No No T1PV STRING Yes Null Yes Yes No No T2PV STRING Yes Null Yes Yes No No D1PV STRING Yes Null Yes Yes No No D2PV STRING Yes Null Yes Yes No No D3PV STRING Yes Null Yes Yes No No D4PV STRING Yes Null Yes Yes No No P1DB NOACCESS No Null No No No No P2DB NOACCESS No Null No No No No P3DB NOACCESS No Null No No No No P4DB NOACCESS No Null No No No No R1DB NOACCESS No Null No No No No R2DB NOACCESS No Null No No No No R3DB NOACCESS No Null No No No No R4DB NOACCESS No Null No No No No T1DB NOACCESS No Null No No No No T2DB NOACCESS No Null No No No No D1DB NOACCESS No Null No No No No D2DB NOACCESS No Null No No No No D3DB NOACCESS No Null No No No No D4DB NOACCESS No Null No No No No P1NV LONG No 0 Yes Yes Yes No P2NV LONG No 0 Yes Yes Yes No P3NV LONG No 0 Yes Yes Yes No P4NV LONG No 0 Yes Yes Yes No R1NV LONG No 0 Yes Yes Yes No R2NV LONG No 0 Yes Yes Yes No R3NV LONG No 0 Yes Yes Yes No R4NV LONG No 0 Yes Yes Yes No T1NV LONG No 0 Yes Yes Yes No T2NV LONG No 0 Yes Yes Yes No D1NV LONG No 0 Yes Yes Yes No D2NV LONG No 0 Yes Yes Yes No D3NV LONG No 0 Yes Yes Yes No D4NV LONG No 0 Yes Yes Yes No P1SM RECCHOICE Yes 0 Yes Yes No No P1SP FLOAT Yes 0 Yes Yes Yes No P1FS RECCHOICE Yes 0 Yes Yes No No P1SI FLOAT Yes 0 Yes Yes Yes No P1FI RECCHOICE Yes 0 Yes Yes No No P1CP FLOAT Yes 0 Yes Yes Yes No P1FC RECCHOICE Yes 0 Yes Yes No No P1EP FLOAT Yes 0 Yes Yes Yes No P1FE RECCHOICE Yes 0 Yes Yes No No P1WD FLOAT Yes 0 Yes Yes Yes No P1FW RECCHOICE Yes 0 Yes Yes No No P1DV FLOAT No 0 Yes No Yes* No P1LV FLOAT No 0 Yes No No No R1CV FLOAT No 0 Yes No Yes* No R1LV FLOAT No 0 Yes No No No R1DL FLOAT Yes 0 Yes Yes No No P1EU STRING Yes 16 Yes Yes No No P1HR FLOAT Yes 0 Yes Yes No No P1LR FLOAT Yes 0 Yes Yes No No P1PR SHORT Yes 0 Yes Yes No No P1PA FLOAT ARRAY No Null Yes Yes Yes No P2SM RECCHOICE Yes 0 Yes Yes No No P2SP FLOAT Yes 0 Yes Yes Yes No P2FS RECCHOICE Yes 0 Yes Yes No No P2SI FLOAT Yes 0 Yes Yes Yes No P2FI RECCHOICE Yes 0 Yes Yes No No P2CP FLOAT Yes 0 Yes Yes Yes No P2FC RECCHOICE Yes 0 Yes Yes No No P2EP FLOAT Yes 0 Yes Yes Yes No P2FE RECCHOICE Yes 0 Yes Yes No No P2WD FLOAT Yes 0 Yes Yes Yes No P2FW RECCHOICE Yes 0 Yes Yes No No P2DV FLOAT No 0 Yes No Yes* No P2LV FLOAT No 0 Yes No No No R2CV FLOAT No 0 Yes No Yes* No R2LV FLOAT No 0 Yes No No No R2DL FLOAT Yes 0 Yes Yes No No P2EU STRING Yes 16 Yes Yes No No P2HR FLOAT Yes 0 Yes Yes No No P2LR FLOAT Yes 0 Yes Yes No No P2PR SHORT Yes 0 Yes Yes No No P2PA FLOAT ARRAY No Null Yes Yes Yes No P3SM RECCHOICE Yes 0 Yes Yes No No P3SP FLOAT Yes 0 Yes Yes Yes No P3FS RECCHOICE Yes 0 Yes Yes No No P3SI FLOAT Yes 0 Yes Yes Yes No P3FI RECCHOICE Yes 0 Yes Yes No No P3CP FLOAT Yes 0 Yes Yes Yes No P3FC RECCHOICE Yes 0 Yes Yes No No P3EP FLOAT Yes 0 Yes Yes Yes No P3FE RECCHOICE Yes 0 Yes Yes No No P3WD FLOAT Yes 0 Yes Yes Yes No P3FW RECCHOICE Yes 0 Yes Yes No No P3DV FLOAT No 0 Yes No Yes* No P3LV FLOAT No 0 Yes No No No R3CV FLOAT No 0 Yes No Yes* No R3LV FLOAT No 0 Yes No No No R3DL FLOAT Yes 0 Yes Yes No No P3EU STRING Yes 16 Yes Yes No No P3HR FLOAT Yes 0 Yes Yes No No P3LR FLOAT Yes 0 Yes Yes No No P3PR SHORT Yes 0 Yes Yes No No P3PA FLOAT ARRAY No Null Yes Yes Yes No P4SM RECCHOICE Yes 0 Yes Yes No No P4SP FLOAT Yes 0 Yes Yes Yes No P4FS RECCHOICE Yes 0 Yes Yes No No P4SI FLOAT Yes 0 Yes Yes Yes No P4FI RECCHOICE Yes 0 Yes Yes No No P4CP FLOAT Yes 0 Yes Yes Yes No P4FC RECCHOICE Yes 0 Yes Yes No No P4EP FLOAT Yes 0 Yes Yes Yes No P4FE RECCHOICE Yes 0 Yes Yes No No P4WD FLOAT Yes 0 Yes Yes Yes No P4FW RECCHOICE Yes 0 Yes Yes No No P4DV FLOAT No 0 Yes No Yes* No P4LV FLOAT No 0 Yes No No No R4CV FLOAT No 0 Yes No Yes* No R4LV FLOAT No 0 Yes No No No R4DL FLOAT Yes 0 Yes Yes No No P4EU STRING Yes 16 Yes Yes No No P4HR FLOAT Yes 0 Yes Yes No No P4LR FLOAT Yes 0 Yes Yes No No P4PR SHORT Yes 0 Yes Yes No No P4PA FLOAT ARRAY No Null Yes Yes Yes No D1CV FLOAT No 0 Yes No Yes* No D1LV FLOAT No 0 Yes No No No D1EU STRING Yes 16 Yes Yes No No D1HR FLOAT Yes 0 Yes Yes No No D1LR FLOAT Yes 0 Yes Yes No No D1PR SHORT Yes 0 Yes Yes No No D1DA FLOAT ARRAY No Null Yes No Yes No D2CV FLOAT No 0 Yes No Yes* No D2LV FLOAT No 0 Yes No No No D2EU STRING Yes 16 Yes Yes No No D2HR FLOAT Yes 0 Yes Yes No No D2LR FLOAT Yes 0 Yes Yes No No D2PR SHORT Yes 0 Yes Yes No No D2DA FLOAT ARRAY No Null Yes No Yes No D3CV FLOAT No 0 Yes No Yes* No D3LV FLOAT No 0 Yes No No No D3EU STRING Yes 16 Yes Yes No No D3HR FLOAT Yes 0 Yes Yes No No D3LR FLOAT Yes 0 Yes Yes No No D3PR SHORT Yes 0 Yes Yes No No D3DA FLOAT ARRAY No Null Yes No Yes No D4CV FLOAT No 0 Yes No Yes* No D4LV FLOAT No 0 Yes No No No D4EU STRING Yes 16 Yes Yes No No D4HR FLOAT Yes 0 Yes Yes No No D4LR FLOAT Yes 0 Yes Yes No No D4PR SHORT Yes 0 Yes Yes No No D4DA FLOAT ARRAY No Null Yes No Yes No T1CD FLOAT Yes 0 Yes Yes No No T2CD FLOAT Yes 0 Yes Yes No No ---------------------------------------------------------------* Monitors on these fields are not posted any faster than 20 Hz. Some changes may not be posted! Do not rely on these fields for step-to-step info.
--------------------------------------------------------------------------------------------- Name Summary Description --------------------------------------------------------------------------------------------- VERS Code Version Reflects the version of scan record processing routines. VAL Value Field Not Used. SMSG State Message This field contains a message from the record alerting the operator to any error conditions. It can be cleared by writing a `0' to the CMND field. CMND Command Field This field is used to send commands to the record. The following commands are currently defined: 0 - Clear the State Message Field 1 - Execute a "dry run" scan and check the desired positions against the control limits of the positioner(s). ALRT Alert Field This field is set to one when an alert condition exists in the record (e.g Scan parameters too constrained, defined scan exceeds limits, scan aborted, etc). The cause of the alert will be indicated in the State Message Field (SMSG). RPVT Record Private Pointer to a structure that maintains information about the scan record. MPTS Maximum Number This field is used to specify the maximum number of of Points points that will be used for any scan defined for this record. This value is used to allocate memory for all the array oriented fields, so the value will significantly affect memory usage. EXSC Execute Scan Writing a `1' to this field will initiate a scan. Writing a `0' will abort the scan. The record will reset this field to `0' when the scan is finished. PXSC Previous Execute Status of the EXSC flag the last time the record was Scan processed. NPTS Number of Points This entry defines the number of points for the scan. If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. This value is constrained to be less than or equal to MPTS. FPTS Freeze Flag CPT Current Point This field contains the current point of an active scan. The posting of events on this field is throttled to 20 Hz, so for fast scans not every new value will be posted. PCPT Previous Current This field contains the value of CPT that was last posted Point (not every change is posted, see CPT desctiption). TOLP Time of Last Tick count of last time monitors were posted on the Posting "throttled" fields (e.g. CPT) PnPV Positioner n Process (n=1-4): These fields contain the Process Variable names Variable of the controllers that will be commanded during the scan. PnNV Positioner n Name (n=1-4): These flags indicate if the ASCII string entered Valid in PnPV was found to be an existing Process Variable. PnDV Positioner n (n=1-4): These fields contain the desired value for each Desired Value postioner for the current point in the scan. The posting of events on these fields is throttled to 20 Hz, so for fast scans not every "desired value" will be posted. PnLV Positioner n Last (n=1-4): Last value `posted' for PnDv. Value RnPV Readback n (n=1-4): If specified, the scan record will read this Process Variable "actual position" of the controller to confirm it has reached its "desired position". If this value is within a specified deadband of the desired position, the scan will continue. RnNV Readback n Name (n=1-4): These flags indicate if the ASCII string entered Valid in RnPV was found to be an existing Process Variable. RnCV Readback n (n=1-4) : These fields contain the current value for each Current Value postioner readback for the current point in the scan. The posting of events on these fields is throttled to 20 Hz, so for fast scans not every new value will be posted. RnLV Readback n Last (n=1-4): Last value `posted' for RnCV. Value RnDL Readback n Delta (n=1-4) : If RnPV is specified, the scan record will confirm that the Read Back value is within this dead band, or the scan will be halted. PnSM Positioner n Step (n=1-4) : Indicates if the desired positions for a controller Mode are to be calculated in a linear fashion (incremented by step size), found in a "desired position array", or given a final position command at the beginning of the scan (on- the-fly). PnPA Positioner n (n=1-4): This array contains the step positions for a Position Array controller if it uses the "lookup" mode (see PnSM). This array is filled in by the record during a scan if the controller was in "linear" mode. If the number of steps was less than MPTS, the remainder of the array is filled with the data from the last step. PnSP Positioner n Start (n=1-4): For controllers in the "linear" or "on-the- Position fly" mode, this field specifies the start position for the controller. If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. PnFS Positioner n Freeze Flag PnSI Positioner n Step (n=1-4): For controllers in the "linear" mode, this field Increment specifies the step increment. If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. PnFI Positioner n Freeze Flag PnEP End Position (n=1-4): For controllers in the "linear" mode, this field contains the last position to which the controller will be commanded. If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. PnFE Positioner n Freeze Flag PnCP Positioner n Center (n=1-4): For controllers in the "linear" mode, this field Position may be used to define the center position of a scan. If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. PnFC Positioner n Freeze Flag PnWD Positioner n Width (n=1-4): For controllers in the "linear" mode, this field may be used to define the width of the scan (the distance from the start position to the finish position). If the freeze flag is set, the record will not change this value in its attempt to keep the scan definition parameters consistent. PnFW Positioner n Freeze Flag PnLR Positioner n Low (n=1-4): These are user configurable fields to describe low Range and high ranges for the positioner data (used by some channel access clients). PnHR Positioner n High Range PnPR Positioner n (n=1-4) : This is a user configurable fields to describe the Precision display precision for the positioner data (used by some channel access clients). PnEU Positioner n (n=1-4) : This is a user configurable fields to describe the Engineering Units units for the positioner data (used by some channel access clients). TnPV Detector Trigger n (n=1-2): These fields contain the Process Variable names Process Variable of the "Detector Triggers" that are written to between the positioning phase and the data acquisition phase of the record. TnNV Trigger n Name (n=1-2): These flags indicate if the ASCII string entered Valid in TnPV was found to be an existing Process Variable. TnCD Trigger n Command (n=1-2): This is the data that is written to the Detector Trigger PV's. DnPV Data n Process (n=1-4): These fields contain the Process Variable names Variable of the data that will be recorded at each point within the scan. DnNV Data n Name Valid (n=1-4): These flags indicate if the ascii string entered in DnPV was found to be an existing Process Variable. DnCV Detector n Current (n=1-4): These fields contain the current value for each Value detector for the current point in the scan. The posting of events on these fields is throttled to 20 Hz, so for fast scans not every new value will be posted. DnLV Detector n Last (n-1-4): Last value `posted' for DnCV. Value DnDA Detector n Data (n=1-4): This array (length = MPTS) contains the detector Array data for each point in the scan. If the number of steps was less than MPTS, the remainder of the array is filled with the data from the last step. DnLR Detector n Low (n=1-4): These are user configurable fields to describe low Range and high ranges for the detector data (used by some channel access clients). DnHR Detector n High Range DnPR Detector n (n=1-4): This is a user configurable fields to describe the Precision display precision for the detector data (used by some channel access clients). DnEU Detector n (n=1-4): This is a user configurable fields to describe the Engineering Units units for the detector data (used by some channel access clients). PnDB Positioner n dbAddr (n=1-4): Pointer to the dbAddr structure of the PV entered in PnPv. If PV is not found, the value is NULL. RnDB Readback n dbAddr (n=1-4): Pointer to the dbAddr structure of the PV entered in RnPv. If PV is not found, the value is NULL. TnDB Trigger n dbAddr (n=1-2): Pointer to the dbAddr structure of the PV entered in TnPv. If PV is not found, the value is NULL. DnDB Detector n dbAddr (n=1-4): Pointer to the dbAddr structure of the PV entered in DnPv. If PV is not found, the value is NULL. ---------------------------------------------------------------------------------------------
Table of Contents Next Chapter