Difference between revisions of "RRM 3-14 Calcout"
RalphLange (talk | contribs) (→Expression: Added ';', literals, constants, assignment) |
(Correct INPx field data) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 35: | Line 35: | ||
<TABLE BORDER="1"> | <TABLE BORDER="1"> | ||
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TR> | <TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TR> | ||
<TD>INPA<TD>Input Link A<TD>INLINK<TD>Yes<TD> | <TD>INPA<TD>Input Link A<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPB<TD>Input Link B<TD>INLINK<TD>Yes<TD> | <TD>INPB<TD>Input Link B<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPC<TD>Input Link C<TD>INLINK<TD>Yes<TD> | <TD>INPC<TD>Input Link C<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPD<TD>Input Link D<TD>INLINK<TD>Yes<TD> | <TD>INPD<TD>Input Link D<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPE<TD>Input Link E<TD>INLINK<TD>Yes<TD> | <TD>INPE<TD>Input Link E<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPF<TD>Input Link F<TD>INLINK<TD>Yes<TD> | <TD>INPF<TD>Input Link F<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPG<TD>Input Link G<TD>INLINK<TD>Yes<TD> | <TD>INPG<TD>Input Link G<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPH<TD>Input Link H<TD>INLINK<TD>Yes<TD> | <TD>INPH<TD>Input Link H<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPI<TD>Input Link I<TD>INLINK<TD>Yes<TD> | <TD>INPI<TD>Input Link I<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPJ<TD>Input Link J<TD>INLINK<TD>Yes<TD> | <TD>INPJ<TD>Input Link J<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPK<TD>Input Link K<TD>INLINK<TD>Yes<TD> | <TD>INPK<TD>Input Link K<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>INPL<TD>Input Link L<TD>INLINK<TD>Yes<TD> | <TD>INPL<TD>Input Link L<TD>INLINK<TD>Yes<TD> <TD>Yes<TD>Yes<TD>No | ||
</TABLE> | </TABLE> | ||
Line 60: | Line 60: | ||
----- | ----- | ||
'''NOTE:''' A complete up-to-date description of the calculation expression can be found in the '''Application Developer's Guide''', chapter libCom / calc / Infix Expression Syntax (19.2.1 for EPICS 3.14.11). | '''NOTE:''' A complete up-to-date description of the calculation expression can be found in the '''Application Developer's Guide''', chapter libCom / calc / Infix Expression Syntax (19.2.1 for EPICS 3.14.11). The length of the CALC field has changed in recent releases, it used to be 40 characters. | ||
----- | ----- | ||
Line 66: | Line 66: | ||
<TABLE BORDER="1"> | <TABLE BORDER="1"> | ||
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR> | <TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR> | ||
<TD>CALC<TD>Calculation<TD>STRING[ | <TD>CALC<TD>Calculation<TD>STRING[80]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes<TR> | ||
<TD>VAL<TD>Value<TD>DOUBLE<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>No<TR> | <TD>VAL<TD>Value<TD>DOUBLE<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>RPCL<TD>Reverse Polish<TD>NOACCESS<TD>No<TD>0<TD>No<TD>No<TD>N/A<TD>No | <TD>RPCL<TD>Reverse Polish<TD>NOACCESS<TD>No<TD>0<TD>No<TD>No<TD>N/A<TD>No | ||
Line 79: | Line 79: | ||
==== Constants ==== | ==== Constants ==== | ||
* PI: returns the mathematical constant | * PI: returns the mathematical constant <tt>π</tt> | ||
* D2R: evaluates to | * D2R: evaluates to <tt>π</tt>/180 which, when used as a multiplier, converts an angle from degrees to radians | ||
* R2D: evaluates to 180/ | * R2D: evaluates to 180/<tt>π</tt> which as a multiplier converts an angle from radians to degrees | ||
==== Operands ==== | ==== Operands ==== | ||
Line 240: | Line 240: | ||
<TD>OOPT<TD>Output Execute Option<TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | <TD>OOPT<TD>Output Execute Option<TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | ||
<TD>DOPT<TD>Output Data Option<TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | <TD>DOPT<TD>Output Data Option<TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | ||
<TD>OCAL<TD> Output Calculation<TD>STRING[36]<TD>Yes<TD>Null<TD>Yes<TD>Yes<TD>No<TD> | <TD>OCAL<TD> Output Calculation<TD>STRING[36]<TD>Yes<TD>Null<TD>Yes<TD>Yes<TD>No<TD>Yes<TR> | ||
<TD>OVAL<TD>Output Value<TD>DOUBLE<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD> | <TD>OVAL<TD>Output Value<TD>DOUBLE<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>No<TR> | ||
<TD>OEVT<TD>Event To Issue<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | <TD>OEVT<TD>Event To Issue<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | ||
<TD>ODLY<TD>Output Execution Delay<TD>FLOAT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> | <TD>ODLY<TD>Output Execution Delay<TD>FLOAT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR> |
Latest revision as of 19:17, 22 March 2016
Calcout - Calculation Output Record
The Calculation Output or "Calcout" record is similar to the Calc record with the added feature of having outputs (an "output link" and an "output event") which are conditionally executed based on the result of the calculation. This feature allows conditional branching to be implemented within an EPICS database (e.g., process Record_A only if Record_B has a value of 0). The Calcout record is also similar to the Wait record (with additional features) but uses EPICS standard INLINK and OUTLINK fields rather than the DBF_STRING fields used in the Wait record. For new databases, it is recommended that the Calcout record be used instead of the Wait record.
Parameter Fields
The fields in this record fall into these categories:
- scan parameters
- read parameters
- expression parameters
- output parameters
- operator display parameters
- alarm parameters
- monitor parameters
- run-time parameters
Scan Parameters
The Calcout record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used. Since the Calcout record supports no direct interfaces to hardware, it cannot be scanned on I/O interrupt, so its SCAN field cannot be I/O Intr
.
Read Parameters
The read parameters for the Calcout record consist of 12 input links INPA, INPB, ... INPL. The fields can be database links, channel access links, or constants. If they are links, they must specify another record's field. If they are constants, they will be initialized with the value they are configured with and can be changed via dbPuts
. These fields cannot be hardware addresses. In addition, the Calcout record contains the INAV, INBV, . . . INLV fields which indicate the status of the link fields, for example, whether or not the specified PV was found and a link to it established. See Operator Display Parameters for an explanation of these fields.
See Address Specification for information on how to specify database links.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor |
---|---|---|---|---|---|---|---|
INPA | Input Link A | INLINK | Yes | Yes | Yes | No | |
INPB | Input Link B | INLINK | Yes | Yes | Yes | No | |
INPC | Input Link C | INLINK | Yes | Yes | Yes | No | |
INPD | Input Link D | INLINK | Yes | Yes | Yes | No | |
INPE | Input Link E | INLINK | Yes | Yes | Yes | No | |
INPF | Input Link F | INLINK | Yes | Yes | Yes | No | |
INPG | Input Link G | INLINK | Yes | Yes | Yes | No | |
INPH | Input Link H | INLINK | Yes | Yes | Yes | No | |
INPI | Input Link I | INLINK | Yes | Yes | Yes | No | |
INPJ | Input Link J | INLINK | Yes | Yes | Yes | No | |
INPK | Input Link K | INLINK | Yes | Yes | Yes | No | |
INPL | Input Link L | INLINK | Yes | Yes | Yes | No |
Expression
Like the Calc record, the Calcout record has a CALC field in which the developer can enter an infix expression which the record routine will evaluate when it processes the record. The resulting value is placed in the VAL field. This value can then be used by the OOPT field (see Output Parameters) to determine whether or not to write to the output link or post an output event. It can also be the value that is written to the output link. The CALC expression is actually converted to opcode and stored in Reverse Polish Notation in the RPCL field. It is this expression which is actually used to calculate VAL. The Reverse Polish expression is evaluated more efficiently during run-time than an infix expression. CALC can be changed at run-time, and a special record routine will call a function to convert it to Reverse Polish Notation.
The infix expressions that can be used are very similar to the C expression syntax, but with some additions and subtle differences in operator meaning and precedence. The string may contain a series of expressions separated by a semi-colon character ';' any one of which may actually provide the calculation result; however all of the other expressions included must assign their result to a variable. All alphabetic elements described below are case independent, so upper and lower case letters may be used and mixed in the variable and function names as desired. Spaces may be used anywhere within an expression except between the characters that make up a single expression element.
The range of expressions supported by the calculation record are separated into literals, constants, operands, algebraic operators, trigonometric operators, relational operators, logical operators, the assignment operator, parentheses and commas, and the question mark or '?:' operator.
NOTE: A complete up-to-date description of the calculation expression can be found in the Application Developer's Guide, chapter libCom / calc / Infix Expression Syntax (19.2.1 for EPICS 3.14.11). The length of the CALC field has changed in recent releases, it used to be 40 characters.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
CALC | Calculation | STRING[80] | Yes | 0 | Yes | Yes | Yes | Yes |
VAL | Value | DOUBLE | No | 0 | Yes | Yes | Yes | No |
RPCL | Reverse Polish | NOACCESS | No | 0 | No | No | N/A | No |
Literals
- Standard double precision floating point numbers
- Inf: Infinity
- Nan: Not a Number
Constants
- PI: returns the mathematical constant π
- D2R: evaluates to π/180 which, when used as a multiplier, converts an angle from degrees to radians
- R2D: evaluates to 180/π which as a multiplier converts an angle from radians to degrees
Operands
The expression can use the values retrieved from the INPx links as operands, though constants can be used as operands too. These values retrieved from the input links are stored in the A-L fields. The values to be used in the expression are simply referenced by the field letter. For instance, the value obtained from the INPA link is stored in the field A, and the value obtained from INPB is stored in field B. The field names can be included in the expression which will operate on their respective values, as in A+B.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
A | Input Value A | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
B | Input Value B | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
C | Input Value C | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
D | Input Value D | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
E | Input Value E | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
F | Input Value F | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
G | Input Value G | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
H | Input Value H | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
I | Input Value I | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
J | Input Value J | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
K | Input Value K | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
L | Input Value L | DOUBLE | No | 0 | Yes | Yes/No | Yes | Yes |
The keyword VAL returns the current contents of the expression's result field, i.e. the VAL field for the CALC expression and the OVAL field for the OCAL expression. (These fields can be written to by a CA put, so it might not be the result from last time the expression was evaluated).
Also, the RNDM unary function can be included as an operand in the expression in order to generate a random number between 0 and 1.
Algebraic Operators
- ABS: Absolute value (unary)
- SQR: Square root (unary)
- MIN: Minimum (any number of args)
- MAX: Maximum (any number of args)
- FINITE: returns non-zero if none of the arguments are NaN or Inf (any number of args)
- ISNAN: returns non-zero if any of the arguments is NaN or Inf (any number of args)
- CEIL: Ceiling (unary)
- FLOOR: Floor (unary)
- LOG: Log base 10 (unary)
- LOGE: Natural log (unary)
- EXP: Exponential function (unary)
- ^: Exponential (binary)
- ** : Exponential (binary)
- + : Addition (binary)
- - : Subtraction (binary)
- * : Multiplication (binary)
- / : Division (binary)
- % : Modulo (binary)
- NOT: Negate (unary)
Trigonometric Operators
- SIN: Sine
- SINH: Hyperbolic sine
- ASIN: Arc sine
- COS: Cosine
- COSH: Hyperbolic cosine
- ACOS: Arc cosine
- TAN: Tangent
- TANH: Hyperbolic tangent
- ATAN: Arc tangent
Relational Operators
- >= : Greater than or equal to
- > : Greater than
- <= : Less than or equal to
- <: Less than
- # : Not equal to
- = : Equal to
Logical Operators
- && : And
- || : Or
- ! : Not
Bitwise Operators
- | : Bitwise Or
- & : Bitwise And
- OR : Bitwise Or
- AND: Bitwise And
- XOR: Bitwise Exclusive Or
- ~ : One's Complement
- << : Left shift
- >> : Right shift
Assignment Operator
- := : assigns a value (right hand side) to a variable (i.e. field)
Parentheses and Comma
The open and close parentheses are supported. Nested parenthesis are supported.
The comma is supported when used to separate the arguments of a binary function.
Conditional Expression
The C language's question mark operator is supported. The format is:
condition ? True result : False result
Example Expressions
Algebraic
A + B + 10
- Result is A + B + 10
Relational
(A + B) < (C + D)
- Result is 1 if (A+B) < (C+D)
- Result is 0 if (A+B) >= (C+D)
Question Mark
(A+B)<(C+D)?E:F+L+10
- Result is E if (A+B) < (C+D)
- Result is F+L+10 if (A+B) >= (C+D)
Logical
A&B
- Causes the following to occur:
- Convert A to integer
- Convert B to integer
- Bit-wise And A and B
- Convert result to floating point
Output Parameters
These parameters specify and control the output capabilities of the Calcout record. They determine when to write the output, where to write it, and what the output will be. The OUT link specifies the Process Variable to which the result will be written. The OOPT field determines the condition that causes the output link to be written to. It's a menu field that has six choices:
Every Time
-- write output every time record is processed.On Change
-- write output every time VAL changes, i.e., every time the result of the expression changes.When Zero
-- when record is processed, write output if VAL is zero.When Non-zero
-- when record is processed, write output if VAL is non-zero.Transition To Zero
-- when record is processed, write output only if VAL is zero and last value was non-zero.Transition To Non-zero
-- when record is processed, write output only if VAL is non-zero and last value was zero.
The DOPT field determines what data is written to the output link when the output is executed. The field is a menu field with two options: Use CALC
or Use OCAL
. If Use CALC
is specified, when the record writes its output it will write the result of the expression in the CALC record, that is, it will write the value of the VAL field. If Use OCAL
is specified, the record will instead write the result of the expression in the OCAL field, which is contained in the OVAL field. The OCAL field is exactly like the CALC field and has the same functionality: it can contain the string representation of an expression which is evaluated at run-time. Thus, if necessary, the record can use the result of the CALC expression to determine if data should be written and can use the result of the OCAL expression as the data to write.
If the OEVT field specifies a non-zero integer and the condition in the OOPT field is met, the record will post a corresponding event. If the ODLY field is non-zero, the record pauses for the specified number of seconds before executing the OUT link or posting the output event. During this waiting period the record is "active" and will not be processed again until the wait is over. The field DLYA is equal to 1 during the delay period. The resolution of the delay entry is system dependent.
The IVOA field specifies what action to take with the OUT link if the Calcout record enters an INVALID alarm status. The options are Continue normally
, Don't drive outputs
, and Set output to IVOV
. If the IVOA field is Set output to IVOV
, the data entered into the IVOV field is written to the OUT link if the record alarm severity is INVALID.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
OUT | Output Specification | OUTLINK | Yes | 0 | Yes | Yes | N/A | No |
OOPT | Output Execute Option | RECCHOICE | Yes | 0 | Yes | Yes | No | No |
DOPT | Output Data Option | RECCHOICE | Yes | 0 | Yes | Yes | No | No |
OCAL | Output Calculation | STRING[36] | Yes | Null | Yes | Yes | No | Yes |
OVAL | Output Value | DOUBLE | No | 0 | Yes | Yes | Yes | No |
OEVT | Event To Issue | SHORT | Yes | 0 | Yes | Yes | No | No |
ODLY | Output Execution Delay | FLOAT | Yes | 0 | Yes | Yes | No | No |
IVOA | Invalid Output Action | GBLCHOICE | Yes | 0 | Yes | Yes | No | No |
IVOV | Invalid Output Value | DOUBLE | Yes | 0 | Yes | Yes | No | No |
Operator Display Parameters
These parameters are used to present meaningful data to the operator. Some are also meant to represent the status of the record at run-time. An example of an interactive MEDM display screen that displays the status of the Calcout record is located here.
The EGU field contains a string of up to 16 characters which is supplied by the user and which describes the values being operated upon. The string is retrieved whenever the routine get_units
is called. The EGU string is solely for an operator's sake and does not have to be used.
The HOPR and LOPR fields only refer to the limits of the VAL, HIHI, HIGH, LOW, and LOLO fields. PREC controls the precision of the VAL field.
The INAV-INLV fields indicate the status of the link to the PVs specified in the INPA-INPL fields, respectively. The field can have three possible values:
Ext PV NC
-- the PV wasn't found on this IOC and a Channel Access link hasn't been established.Ext PV OK
-- the PV wasn't found on this IOC and a Channel Access link has been established.Local PV
-- the PV was found on this IOC.Constant
-- the corresponding link field is a constant.
The OUTV field indicates the status of the OUT link. It has the same possible values as the INAV-INLV fields.
The CLCV and OLCV fields indicate the validity of the expression in the CALC and OCAL fields, respectively. If the expression is invalid, the field is set to one.
The DLYA field is set to one during the delay interval specified in ODLY.
See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
EGU | Engineering Units | STRING [16] | Yes | Null | Yes | Yes | No | No |
PREC | Display Precision | SHORT | Yes | 0 | Yes | Yes | No | No |
HOPR | High Operating Range | FLOAT | Yes | 0 | Yes | Yes | No | No |
LOPR | Low Operating Range | FLOAT | Yes | 0 | Yes | Yes | No | No |
INAV | Link Status of INPA | RECCHOICE | No | 1 | Yes | No | No | No |
INBV | Link Status of INPB | RECCHOICE | No | 1 | Yes | No | No | No |
INCV | Link Status of INPC | RECCHOICE | No | 1 | Yes | No | No | No |
INDV | Link Status of INPD | RECCHOICE | No | 1 | Yes | No | No | No |
INEV | Link Status of INPE | RECCHOICE | No | 1 | Yes | No | No | No |
INFV | Link Status of INPF | RECCHOICE | No | 1 | Yes | No | No | No |
INGV | Link Status of INPG | RECCHOICE | No | 1 | Yes | No | No | No |
INHV | Link Status of INPH | RECCHOICE | No | 1 | Yes | No | No | No |
INIV | Link Status of INPI | RECCHOICE | No | 1 | Yes | No | No | No |
INJV | Link Status of INPJ | RECCHOICE | No | 1 | Yes | No | No | No |
INKV | Link Status of INPK | RECCHOICE | No | 1 | Yes | No | No | No |
INLV | Link Status of INPL | RECCHOICE | No | 1 | Yes | No | No | No |
OUTV | OUT PV Status | RECCHOICE | No | 0 | Yes | No | No | No |
CLCV | CALC Valid | LONG | No | 0 | Yes | Yes | No | No |
OCLV | OCAL Valid | LONG | No | 0 | Yes | Yes | No | No |
DLYA | Output Delay Active | USHORT | No | 0 | Yes | No | No | No |
NAME | Record Name | STRING [29] | Yes | 0 | Yes | No | No | No |
DESC | Description | STRING [29] | Yes | Null | Yes | Yes | No | No |
Alarm Parameters
The possible alarm conditions for the Calc record are the SCAN, READ, Calculation, and limit alarms. The SCAN and READ alarms are called by the record support routines. The Calculation alarm is called by the record processing routine when the CALC expression is an invalid one, upon which an error message is generated.
The following alarm parameters which are configured by the user define the limit alarms for the VAL field and the severity corresponding to those conditions.
The HYST field defines an alarm deadband for each limit. See Alarm Specification for a complete explanation of alarms and these fields. Alarm Fields lists other fields related to a alarms that are common to all record types.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
HIHI | Hihi Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
HIGH | High Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
LOW | Low Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
LOLO | Lolo Alarm Limit | FLOAT | Yes | 0 | Yes | Yes | No | Yes |
HHSV | Severity for a Hihi Alarm | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HSV | Severity for a High Alarm | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LSV | Severity for a Low Alarm | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LLSV | Severity for a Lolo Alarm | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HYST | Alarm Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
Monitor Parameters
These parameters are used to determine when to send monitors for the value fields. The monitors are sent when the value field exceeds the last monitored field by the appropriate deadband, the ADEL for archiver monitors and the MDEL field for all other types of monitors. If these fields have a value of zero, every time the value changes, monitors are triggered; if they have a value of -1, every time the record is scanned, monitors are triggered. See Monitor Specification for a complete explanation of monitors.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
ADEL | Archive Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
MDEL | Monitor, i.e. value change, Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
Run-time Parameters
These fields are not configurable using a configuration too and none are modifiable at run-time. They are used to process the record.
The LALM field is used to implement the hysteresis factor for the alarm limits.
The LA-LL fields are used to decide when to trigger monitors for the corresponding fields. For instance, if LA does not equal the value for A, monitors for A are triggered. The MLST and MLST fields are used in the same manner for the VAL field.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
LALM | Last Alarmed Value | DOUBLE | No | 0 | Yes | No | No | No |
ALST | Archive Last Value | DOUBLE | No | 0 | Yes | No | No | No |
MLST | Monitor Last Value | DOUBLE | No | 0 | Yes | No | No | No |
LA | Previous Input Value for A | DOUBLE | No | 0 | Yes | No | No | No |
LB | Previous Input Value for B | DOUBLE | No | 0 | Yes | No | No | No |
LC | Previous Input Value for C | DOUBLE | No | 0 | Yes | No | No | No |
LD | Previous Input Value for D | DOUBLE | No | 0 | Yes | No | No | No |
LE | Previous Input Value for E | DOUBLE | No | 0 | Yes | No | No | No |
LF | Previous Input Value for F | DOUBLE | No | 0 | Yes | No | No | No |
LG | Previous Input Value for G | DOUBLE | No | 0 | Yes | No | No | No |
LH | Previous Input Value for H | DOUBLE | No | 0 | Yes | No | No | No |
LI | Previous Input Value for I | DOUBLE | No | 0 | Yes | No | No | No |
LJ | Previous Input Value for J | DOUBLE | No | 0 | Yes | No | No | No |
LK | Previous Input Value for K | DOUBLE | No | 0 | Yes | No | No | No |
LL | Previous Input Value for L | DOUBLE | No | 0 | Yes | No | No | No |
Record Support
Record Support Routines
init_record
For each constant input link, the corresponding value field is initialized with the constant value if the input link is CONSTANT or a channel access link is created if the input link is PV_LINK.
A routine postfix is called to convert the infix expression in CALC and OCAL to reverse polish notation. The result is stored in RPCL and ORPC, respectively.
process
See next section.
special
This is called if CALC or OCAL is changed. special calls postfix.
get_value
Fills in the values of struct valueDes so that they refer to VAL.
get_units
Retrieves EGU.
get_precision
Retrieves PREC.
get_graphic_double
Sets the upper display and lower display limits for a field. If the field is VAL, HIHI, HIGH, LOW, or LOLO, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.
get_control_double
Sets the upper control and the lower control limits for a field. If the field is VAL, HIHI, HIGH, LOW, or LOLO, the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.
get_alarm_double
Sets the following values:
upper_alarm_limit = HIHI upper_warning_limit = HIGH lower_warning_limit = LOW lower_alarm_limit = LOLO
Record Processing
process()
The process()
routine implements the following algorithm:
- Fetch all arguments.
- Call routine calcPerform(), which calculates VAL from the postfix version of the expression given in CALC. If calcPerform() returns success, UDF is set to FALSE.
- Check alarms. This routine checks to see if the new VAL causes the alarm status and severity to change. If so, NSEV, NSTA and LALM are set. It also honors the alarm hysteresis factor (HYST). Thus the value must change by at least HYST before the alarm status and severity changes.
- Determine if the Output Execution Option (OOPT) is met. If it is met, either execute the output link (and output event) immediately (if ODLY = 0), or schedule a callback after the specified interval. See the explanation for the
execOutput()
routine below. - Check to see if monitors should be invoked.
- Alarm monitors are invoked if the alarm status or severity has changed.
- Archive and value change monitors are invoked if ADEL and MDEL conditions are met.
- Monitors for A-L are checked whenever other monitors are invoked.
- NSEV and NSTA are reset to 0.
- If no output delay was specified, scan forward link if necessary, set PACT FALSE, and return.
execOutput()
- If DOPT field specifies the use of OCAL, call the routine calcPerform for the postfix version of the expression in OCAL. Otherwise, use VAL.
- If the Alarm Severity is INVALID, follow the option as designated by the field IVOA.
- If the Alarm Severity is not INVALID or IVOA specifies "Continue Normally", put the value of OVAL to the OUT link and post the event in OEVT (if non-zero).
- If an output delay was implemented, process the forward link.
EPICS Record Reference Manual - 19 MAY 1998