NB: This manual documents a 20+ year old version of EPICS, see here for the EPICS 7 Record Reference documentation.

[Next] [Previous] [Top] [Contents] [Index]

EPICS Record Reference Manual

Chapter 35: subArray

1. Introduction

The normal use for the subArray record type is to obtain sub-arrays from waveform records. Setting either the number of elements (NELM) or index (INDX) fields causes the record to be processed anew so that applications in which the length and position of a sub-array in a waveform record vary dynamically can be implemented using standard EPICS operator interface tools.

The first element of the sub-array, that at location INDX in the referenced waveform record, can be displayed as a scalar, or the entire subarray (of length NELM) can be displayed in the same way as a waveform record. If there are fewer than NELM elements in the referenced waveform after the INDX, only the number of elements actually available are returned, and the number of elements read field (NORD) is set to reflect this. This record type does not support writing new values into waveform records.

The subArray's fields fall into the following categories:

scan parameters

read parameters

array parameters

operator display parameters

run-time parameters

2. Scan Parameters

The subArray record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in Scan Fields, Chapter 2, 2. In addition, Scanning Specification, Chapter 1, 1, explains how these fields are used.

3. Read Parameters

The subArray's input link (INP) should be configured to reference the Waveform record. It should specify the VAL field of a Waveform record. The INP field can be a channel access link, in addition to a database link. See Address Specification, Chapter 1, 2, for information on specifying links.

In addition, the DTYP field must specify a device support module. Currently, the only device support module is Soft Channel.
FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP

4. Array Parameters

These parameters determine the number of array elements (the array length) and the data type of those elements. The Field Type of Value (FTVL) field determines the data type of the array.

The user specifies the maximum number of elements allowed in the subarray in the MALM field. Generally, the number should be equal to the number of elements of the Waveform array (found in the Waveform's NELM field). The MALM field is used to allocate memory. The subArray's Number of Elements (NELM) field is where the user specifies the actual number of elements that the subArray will contain. It should of course be no greater than MALM; if it is, the record processing routine sets it equal to MALM.

The INDX field determines the offset of the subArray record's array in relation to the Waveform's. For instance, if INDX is 2, then the subArray will read NELM elements starting with the third element of the Waveform's array. Thus, it equals the index number of the Waveform's array.

The actual sub-array is referenced by the VAL field.
FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
FTVLField Type of ValueGBLCHOICEYes0YesNoNoNo
VALValue Field(See FTVL)No0YesYesYesNo
MALMMaximum Number of Elements In Sub-arrayULONGYes1YesNoNoNo
NELMNumber of Elements In Sub-arrayULONGYes1YesYesNoYes
INDXIndex Into Referenced Array ULONGYes0YesYesNoYes

5. Operator Display Parameters

These parameters are used to present meaningful data to the operator. They display the value and other parameters of the subarray record either textually or graphically.

EGU is a string of up to 16 characters describing the engineering units (if any) of the values which the subArray holds. It is retrieved by the get_units record support routine.

The HOPR and LOPR fields set the upper and lower display limits for the sub-array elements. Both the get_graphic_double and get_control_double record support routines retrieve these fields.

The PREC field determines the floating point precision with which to display VAL. It is used whenever the get_precision record support routine is called.

See Chapter 2, Fields Common to All Record Types, for more on the record name (NAME) and description (DESC) fields.
FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
EGUEngineering UnitsSTRING [16]YesnullYesYesNoNo
HOPRHigh Operating RangeFLOATYes0YesYesNoNo
LOPRLow Operating RangeFLOATYes0YesYesNoNo
PRECDisplay PrecisionSHORTYes0YesYesNoNo
NAMERecord NameSTRING [29]Yes0YesNoNoNo
DESCDescriptionSTRING [29]YesNullYesYesNoNo

6. Alarm Parameters

The subarray record has the alarm parameters common to all record types. Alarm Fields, Chapter 2, 3, lists other fields related to a alarms that are common to all record types.

7. Run-time Parameters

These fields are not configurable by the user. They are used for the record's internal processing or to represent the current state of the record.

The NORD field holds a counter of the number of elements read into the array. It can be less than NELM even after the array is full if NELM exceeds the number of existing elements in the referenced array, i.e., the Waveform's array.

BPTR contains a pointer to the record's array.
FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
NORD Number of Elements ReadLONGNo0YesNoNoNo
BPTRBuffer PointerNOACCESSNonullYesNoNoNo

8. Record Support Routines


Using MALM and FTVL, space for the array is allocated. The array address is stored in BPTR. This routine checks to see that device support is available and a device support read routine is defined. If either does not exist, an error message is issued and processing is terminated. If device support includes init_record, it is called.


See next section.


Fills in the values of struct valueDes so that they refer to the sub-array.


This is called by dbNameToAddr. It makes the dbAddr structure refer to the actual buffer holding the result.


Retrieves NELM.


Sets NORD.


For the elements in the array, this routine routines HOPR and LOPR. For the INDX field, this routine returns MALM - 1 and 0. For NELM, it returns MALM and 1. For other fields, it calls recGblGetGraphicDouble().


For array elements, this routine retrieves HOPR and LOPR. Otherwise, recGblGetControlDouble() is called.


Retrieves EGU.


Retrieves PREC.

9. Record Processing

Routine process implements the following algorithm:

1. Check to see that the appropriate device support module exists. If it doesn't, an error message is issued and processing is terminated with the PACT field still set to TRUE. This ensures that processes will no longer be called for this record. Thus error storms will not occur.

2. Sanity check NELM and INDX. If NELM is greater than MALM it is set to MALM. If INDX is greater than MALM it is set to MALM-1.

3. Call device support read routine. This routine is expected to place the desired sub-array at the beginning of the buffer and set NORD to the number of elements of the sub-array that were read.

4. If PACT has been changed to TRUE, the device support read routine has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE. Otherwise, process sets PACT TRUE at this time. This asynchronous processing logic is not currently used but has been left in place.

5. Check to see if monitors should be invoked.

6. Scan forward link if necessary, set PACT FALSE, and return.

10. Device Support

10.1. Fields Of Interest To Device Support

The device support routines are primarily interested in the following fields:
Name Summary Description
PACT Processing ActiveSee Chapter 2, Fields Common to All Record Types for an explanation of these fields.
DPVTDevice Private
UDFVAL Undefined
NSEVNew Alarm Severity
NSTANew Alarm Status
INPInput Link This field is used by the device support routines to locate its input.
FTVLField Type of ValueThis is DBF_STRING, ... ,DBF_ENUM. The device support routine should check that this is correctly defined.
MALMMaximum Number Of Elements in Sub-arrayNumber of elements that will fit in the array the record allocates. Device support must never return more elements than this.
NELMNumber Sub-array ElementsNumber of elements in desired sub-array.
INDXIndex Into Referenced ArrayIndex of beginning of desired sub-array in source array.
BPTRBuffer Pointer Address of array device support must copy the source array into.
NORDNumber Of Elements ReadDevice support must set this value when it completes.

10.2. Device Support Routines

Device support consists of the following routines:


report(FILE fp, paddr)
not currently used.


Not currently used.


This routine is called by the record support init_record routine.


Enough of the source waveform is read into BPTR, from the beginning of the source, to include the requested sub-array. The sub-array is then copied to the beginning of the buffer. NORD is set to indicate how many elements of the sub-array were acquired.

10.3. Device Support For Soft Records

Only the device support module Soft Channel is currently provided. The INP link type must be either DB_LINK or CA_LINK.

Soft Channel

INP is expected to point to a waveform record.

1. - Introduction
2. - Scan Parameters
3. - Read Parameters
4. - Array Parameters
5. - Operator Display Parameters
6. - Alarm Parameters
7. - Run-time Parameters
8. - Record Support Routines
9. - Record Processing
10. - Device Support
10.1. - Fields Of Interest To Device Support
10.2. - Device Support Routines
10.3. - Device Support For Soft Records
Soft Channel

EPICS Record Reference Manual - 19 MAY 1998
[Next] [Previous] [Top] [Contents] [Index]

Generated with Harlequin WebMaker