Sequence Record (seq)

The Sequence record is used to trigger the processing of up to ten other records and send values to those records. It is similar to the fanout record, except that it will fetch an input value and write an output value instead of simply processing a collection of forward links. It can also specify one of several selection algorithms that determine which values to write. It has no associated device support.

Parameter Fields

The record-specific fields are described below, grouped by functionality.

Scan Parameters

The sequence record has the standard fields for specifying under what circumstances it will be processed. These fields are listed in Scan Fields.

Desired Output Parameters

These fields determine where the record retrieves the values it is to write to other records. All of these values are not necessarily used, depending on the selection algorithm.

The sequence record can retrieve up to 16 values from 16 locations. The user specifies the locations in the Desired Output Link fields (DOL0-DOLF), which can be either constants, database links, or channel access links. If a Desired Output Link is a constant, the corresponding value field for that link is initialized to the constant value. Otherwise, if the Desired Output Link is a database or channel access link, a value is fetched from the link each time the record is processed.

The value fetched from the Desired Output Links are stored in the corresponding Desired Output Value fields (DO0-DOF). These fields can be initialized to a constant value, and may subsequently be changed via dbPuts.

Desired Output Link Fields

FieldSummaryTypeDCT DefaultReadWriteCA PP
DOL0Input link 0INLINKYes YesYesNo
DOL1Input link1INLINKYes YesYesNo
DOL2Input link 2INLINKYes YesYesNo
DOL3Input link 3INLINKYes YesYesNo
DOL4Input link 4INLINKYes YesYesNo
DOL5Input link 5INLINKYes YesYesNo
DOL6Input link 6INLINKYes YesYesNo
DOL7Input link 7INLINKYes YesYesNo
DOL8Input link 8INLINKYes YesYesNo
DOL9Input link 9INLINKYes YesYesNo
DOLAInput link 10INLINKYes YesYesNo
DOLBInput link 11INLINKYes YesYesNo
DOLCInput link 12INLINKYes YesYesNo
DOLDInput link 13INLINKYes YesYesNo
DOLEInput link 14INLINKYes YesYesNo
DOLFInput link 15INLINKYes YesYesNo

Desired Output Value Fields

FieldSummaryTypeDCT DefaultReadWriteCA PP
DO0Value 0DOUBLENo YesYesNo
DO1Value 1DOUBLENo YesYesNo
DO2Value 2DOUBLENo YesYesNo
DO3Value 3DOUBLENo YesYesNo
DO4Value 4DOUBLENo YesYesNo
DO5Value 5DOUBLENo YesYesNo
DO6Value 6DOUBLENo YesYesNo
DO7Value 7DOUBLENo YesYesNo
DO8Value 8DOUBLENo YesYesNo
DO9Value 9DOUBLENo YesYesNo
DOAValue 10DOUBLENo YesYesNo
DOBValue 11DOUBLENo YesYesNo
DOCValue 12DOUBLENo YesYesNo
DODValue 13DOUBLENo YesYesNo
DOEValue 14DOUBLENo YesYesNo
DOFValue 15DOUBLENo YesYesNo

Output Parameters

When the record is processed, the desired output values are retrieved for the links in the record's selection algorithm and are written to the corresponding output link (LNK0-LNKF). These output links can be database links or channel access links; they cannot be device addresses. There are sixteen output links, one for each desired output link. Only those that are defined are used.

FieldSummaryTypeDCT DefaultReadWriteCA PP
LNK0Output Link 0OUTLINKYes YesYesNo
LNK1Output Link 1OUTLINKYes YesYesNo
LNK2Output Link 2OUTLINKYes YesYesNo
LNK3Output Link 3OUTLINKYes YesYesNo
LNK4Output Link 4OUTLINKYes YesYesNo
LNK5Output Link 5OUTLINKYes YesYesNo
LNK6Output Link 6OUTLINKYes YesYesNo
LNK7Output Link 7OUTLINKYes YesYesNo
LNK8Output Link 8OUTLINKYes YesYesNo
LNK9Output Link 9OUTLINKYes YesYesNo
LNKAOutput Link 10OUTLINKYes YesYesNo
LNKBOutput Link 11OUTLINKYes YesYesNo
LNKCOutput Link 12OUTLINKYes YesYesNo
LNKDOutput Link 13OUTLINKYes YesYesNo
LNKEOutput Link 14OUTLINKYes YesYesNo
LNKFOutput Link 15OUTLINKYes YesYesNo

Selection Algorithm Parameters

When the sequence record is processed, it uses a selection algorithm similar to that of the selection record to decide which links to process.The select mechanism field (SELM) has three algorithms to choose from: All, <<Specified >> or Mask.

Record fields related to the Selection Algorithm

FieldSummaryTypeDCT DefaultReadWriteCA PP
SELMSelect MechanismMENU (seqSELM)Yes YesYesNo
SELNLink SelectionUSHORTNo1YesYesNo
SELLLink Selection LocINLINKYes YesYesNo
SHFTShift for Mask modeSHORTYes-1YesYesNo
OFFSOffset for SpecifiedSHORTYes YesYesNo

Fields Description

SELM - Selection Mode

IndexIdentifierChoice String
0 seqSELM_All All
1 seqSELM_Specified Specified
2 seqSELM_Mask Mask

See "Selection Algorithms Description" below;

SELL - Link Selection Location

This field can be initialized as a CONSTANT or as a LINK to any other record. SELN will fetch its value from this field when the seq record is processed. Thus, when using Mask or Specified modes, the links that seq will process can be dynamically changed by the record pointed by SELL.

SELN - Link Selection

When SELM = Specified this is the index number of the link that will be processed, used in combination with the OFFS field:

  SELN = SELN + OFFS

(By default, the OFFS is initalized to ZERO)

When SELM = Mask this field is the bitmask that will be used to determine which links will be processed by the seq record, in combination with the SHFT field:

  if (SHFT >= 0)
    SELN = SELN << -SHFT
  else
    SELN = SELN >> SHFT

(By default, the SHFT is initalized to -1)

Note about SHFT and OFFS fields

The first versions of seq record had DO, DOL, LNK and DLY fields starting with index ONE (DO1, DOL1, LNK1 and DLY1). Since EPICS 7 the seq record now supports 16 links, starting from index ZERO (DO0, DOL0, LNK0 and DLY0). The SHFT and OFFS fields were introduced to keep compatibility of old databases that used seq records with links indexed from one.

To use the DO0, DOL0, LNK0, DLY0 fields when SELM = Mask, the SHFT field must be set to ZERO

Selection Algorithms Description

All

The All algorithm causes the record to process each input and output link each time the record is processed, in order from 0 to 15. So when SELM is All, the desired output value from DOL0 will fetched and sent to LNK0, then the desired output value from DOL1 will be fetched and sent to the location in LNK1, and so on until the last input and output link DOF and LNKF. (Note that undefined links are not used.) If DOLx is a constant, the current value field is simply used and the desired output link is ignored. The SELN field is not used when All is the algorithm.

Specified

When the Specified algorithm is chosen, each time the record is processed it gets the integer value in the Link Selection (SELN) field and uses that as the index of the link to process. For instance, if SELN is 4, the desired output value from DO4 will be retrieved and sent to LNK4. If DOLx is a constant, DOx is simply used without the value being fetched from the input link.

Mask

When Mask is chosen, the record uses the individual bits of the SELN field to determine the links to process. When bit 0 of SELN is set, the value from DO0 will be written to the location in LNK0; when bit 1 is set, the valud from DO1 will be written to the location in LNK1 etc. Thus for example if SELN is 3, the record will retrieve the values from DO0 and DO1 and write them to the locations in LNK0 and LNK1, respectively. If SELN is 63, DO0...DO5 will be written to LNK0...LNK5.

Delay Parameters

The delay parameters consist of 16 fields, one for each I/O link discussed above. These fields can be configured to cause the record to delay processing the link. For instance, if the user gives the DLY1 field a value of 3.0, each time the record is processed at run-time, the record will delay processing the DOL1, DOV1, and LNK1 fields for three seconds. That is, the desired output value will not be fetched and written to the output link until three seconds have lapsed.

FieldSummaryTypeDCT DefaultReadWriteCA PP
DLY0Delay 0DOUBLEYes YesYesNo
DLY1Delay 1DOUBLEYes YesYesNo
DLY2Delay 2DOUBLEYes YesYesNo
DLY3Delay 3DOUBLEYes YesYesNo
DLY4Delay 4DOUBLEYes YesYesNo
DLY5Delay 5DOUBLEYes YesYesNo
DLY6Delay 6DOUBLEYes YesYesNo
DLY7Delay 7DOUBLEYes YesYesNo
DLY8Delay 8DOUBLEYes YesYesNo
DLY9Delay 9DOUBLEYes YesYesNo
DLYADelay 10DOUBLEYes YesYesNo
DLYBDelay 11DOUBLEYes YesYesNo
DLYCDelay 12DOUBLEYes YesYesNo
DLYDDelay 13DOUBLEYes YesYesNo
DLYEDelay 14DOUBLEYes YesYesNo
DLYFDelay 15DOUBLEYes YesYesNo

Operator Display Parameters

These parameters are used to present meaningful data to the operator. The Precision field (PREC) determines the decimal precision for the VAL field when it is displayed. It is used when the get_precision record routine is called.

See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.

FieldSummaryTypeDCT DefaultReadWriteCA PP
PRECDisplay PrecisionSHORTYes YesYesNo
NAMERecord NameSTRING [61]No YesNoNo
DESCDescriptorSTRING [41]Yes YesYesNo

Alarm Parameters

The sequence record has the alarm parameters common to all record types. Alarm Fields lists the fields related to alarms that are common to all record types.

Record Support

Record Processing

Routine process implements the following algorithm:

  1. First, PACT is set to TRUE, and the link selection is fetched. Depending on the selection mechanism, the link selection output links are processed in order from LNK0 to LNKF. When LNKx is processed, the corresponding DLYx value is used to generate a delay via watchdog timer.
  2. After DLYx seconds have expired, the input value is fetched from DOx (if DOLx is constant) or DOLx (if DOLx is a database link or channel access link) and written to LNKx.
  3. When all links are completed, an asynchronous completion call back to dbProcess is made (see the Application Developer's Guide for more information on asynchronous processing.)
  4. Then UDF is set to FALSE.
  5. Monitors are checked.
  6. The forward link is scanned, PACT is set FALSE, and the process routine returns.

For the delay mechanism to operate properly, the record is processed asynchronously. The only time the record will not be processed asynchronously is when there are no non-NULL output links selected (i.e. when it has nothing to do.) The processing of the links is done via callback tasks at the priority set in the PRIO field in dbCommon (see the Application Developer's Guide for more information on call