NB: This manual documents a 20+ year old version of EPICS, see here for the EPICS 7 Record Reference documentation.
EPICS Record Reference Manual
Another important difference is that unlike the PID record, the CPID record has four different modes: normal mode, sequencer mode, local mode, and manual mode. The normal mode causes the CPID record to function in the same way as the PID record does. The other modes significantly change how the CPID record functions. All these modes are explained in this chapter.
When in normal mode, the CPID record performs the same equation as the PID record. This equation consists of three parts: the proportional, the integral, and the derivative. Using the gain that exists for each of these terms, the user can weight each contribution according to the response of the process being controlled.
The fields in this record fall into several categories:
scan parameters
controlled variable and setpoint parameters
output, readback, and mode parameters
expression parameters
operator display parameters
alarm parameters
monitor parameters
run-time parameters
I/O Intr
.However, the CPID record contains an additional field that affects its processing while in normal mode. The minimum delta time field (MDT) is a scanning field particular to the CPID record and PID records. It can be configured by the user or modified at run-time. It contains a floating point value which represents the minimum amount of time between record processing so that if the amount of time between the last time the record was processed and the current time is less than MDT, then DM and the output value (OVAL) are set to 0. If MDT is left at its default value (0), the minimum delta will be equal to one clock tick.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
MDT | Minimum Delta Time | FLOAT | Yes | 0 | Yes | Yes | No | No |
The setpoint value is set in the VAL field. Unlike the PID record, the setpoint value cannot be read from other records, but must be set via dbPuts. It is set equal to CVAL, the value retrieved from the CVL link, when the record is initialized.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
CVL | Controlled value location (an input link) | INLINK | Yes | 0 | No | No | N/A | No |
VAL | Setpoint value | FLOAT | No | 0 | Yes | Yes | Yes | Yes |
where
The terms KP, KI, and KD are the only terms configured by the user. These terms represent the gain for the proportional (KP), integral (KI), and the derivative (KD). A field exists for each of these terms (the KP, KI, and KD fields). KP should be configured according to the characteristics of the controlled variable; KI should be set equal to the number of times that the integral contribution repeats the proportional contribution; and KD should equal the number of minutes until the derivative contribution repeats the proportional contribution.
The PID record calculates the other terms of the expression:
n
delM(n)
and the other parts of the expression are held in several different run-time fields, which are not configurable prior to run-time, nor modifiable at run-time, but can be accessed so that their values can be used.
When in Normal Mode, the DM field contains the change in manipulated value, i.e., the result of the PID expression delM(n). For other modes, the value is different, but is always an increment which can be accessed by the desired output link (DOL) of an analog output record. Since its value represents an increment, the OIF field of the analog output record should be set to Incremental
. Note that the final result to be written may not be the same as the final result of the equation; that is, DM, the result of the equation, may not equal OVAL, the output value, depending on the mode.
The P, I, D, CT, DT, ERR, and DERR fields are used to calculate the PID expression. They are not configurable prior to, nor modifiable during, run-time, but may be of interest when fine tuning the gains of each contribution (KP, KI, KD). The following lists the fields as they relate to the expression:
n
. Error at current sampling (VAL-CVAL).
n
- En-1
. Difference between current error and error at last sampling.
KP * DERR
En * dTn * KI
Kp * Kd * (err/dt(n) - derr/dt(n-1))
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
KP | Proportional Gain | FLOAT | Yes | 0 | Yes | Yes | No | No |
KI | Integral Gain, in repeats per minute. | FLOAT | Yes | 0 | Yes | Yes | No | No |
KD | Derivative Gain, in repeats per minute | FLOAT | Yes | 0 | Yes | Yes | No | No |
DM | Change in Manipulated Value | FLOAT | No | 0 | Yes | No | Yes | No |
P | Proportional contribution to DM. | FLOAT | No | 0 | Yes | No | Yes | No |
I | Integral contribution to DM. | FLOAT | No | 0 | Yes | No | Yes | No |
D | Derivative contribution to DM. | FLOAT | No | 0 | Yes | No | Yes | No |
CT | Clock ticks when previous process occurred. | ULONG | No | 0 | Yes | No | Yes | No |
DT | Time difference in seconds between processing steps. | FLOAT | No | 0 | Yes | No | Yes | No |
ERR | Current error (VAL - CVAL). | FLOAT | No | 0 | Yes | No | Yes | No |
DERR | Delta Error | FLOAT | No | 0 | Yes | No | Yes | No |
Firstly, the record has two output modes, CHANGE and POSITION, set by the OMOD field. If OMOD is (0,1), then the output mode will be (CHANGE, POSITION). The OMOD field cannot be modified at run-time, so it must be configured to be either CHANGE or POSITION. It is initialized to CHANGE by default.
When CHANGE, the record sets OVAL equal to DM, the result of the PID expression. DM being itself an increment, OVAL is an incremental value in the CHANGE mode. If the record is in POSITION mode, OVAL is an absolute value obtained by adding OVAL to DM. In this case, OVAL will be the last value of OVAL when it was written unless it was changed by database access.
if CHANGE OVAL = DM if POSITION OVAL = OVAL + DMAfter OVAL is adjusted in case it violates the value limits explained below, DM is set equal to OVAL when in CHANGE mode. When in position mode, after any adjustments, DM is set equal to OVAL - MLST, MLST being the value of OVAL the last time the record was processed. This way, DM is always an increment, adjusted to be within the value limits.
Secondly, there are four different modes on top of the output mode: Normal, Sequencer, Manual, and Local.
Note: DM is calculated even for modes other than Normal. This prevents the DT change in time contribution from "winding up" when the mode is other than Normal. |
Finally, MAX, MIN, DMAX, and DMIN fields are used to specify limits for the output value. The MAX and MIN fields limit the value of OVAL, whereas the DMAX and DMIN fields limit the value of DM. How these fields do this for the different modes is somewhat complex. See Section 11, Record Processing, in this chapter for a further explanation of how these fields work.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
OUT | Output Link | OUTLINK | Yes | 0 | No | No | N/A | No |
ORBL | Output Readback Location | INLINK | Yes | No | No | No | No | |
OMOD | Output Mode | RECCHOICE | Yes | 0 | Yes | No | No | No |
ORBV | Output Readback Value | FLOAT | No | 0 | Yes | Yes | No | No |
MAX | Maximum Limit | FLOAT | Yes | 0 | Yes | Yes | No | No |
MIN | Minimum Limit | FLOAT | Yes | 0 | Yes | Yes | No | No |
DMAX | Maximum Change | FLOAT | Yes | 0 | Yes | Yes | No | No |
DMIN | Minimum Change | FLOAT | Yes | 0 | Yes | Yes | No | No |
LOC | Local Mode Switch | INLINK | Yes | No | No | No | ||
MMOD | Manual Mode Request | GBLCHOICE | Yes | 0 | Yes | Yes | No | No |
SMOD | Sequencer Mode Request | GBLCHOICE | Yes | 0 | Yes | Yes | No | No |
MVAL | Manual Value | FLOAT | Yes | 0 | Yes | Yes | No | No |
SVAL | Sequencer Value | FLOAT | Yes | 0 | Yes | Yes | No | No |
EGU is a string of up to 16 characters describing the units of PID's manipulated values measures. It is retrieved by the get_units
record support routine. It must be configured by the user if at all.
The HOPR and LOPR fields set the upper and lower display limits for the VAL, HIHI, HIGH, LOW, LOLO, VAL, P, I, D, and CVAL fields.
The PREC field determines the floating point precision with which to display VAL and CVAL. 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.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
EGU | Engineering Units | STRING | Yes | null | 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 |
PREC | Display Precision | SHORT | Yes | 0 | Yes | Yes | No | No |
NAME | Record Name | STRING | Yes | 0 | Yes | No | No | |
DESC | Description | STRING | Yes | Null | Yes | Yes | No | No |
The limit alarms trigger alarms on the VAL field. They are configured by the user in the HIHI, LOLO, HIGH, and LOW fields using floating point values. For each of these fields, there is a corresponding severity field which can be either NO ALARM, MINOR, or MAJOR. See Alarm Specification, Chapter 1, 4, for a complete explanation of alarms and these fields. Alarm Fields, Chapter 2, 3, 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 | Hihi Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HSV | High Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LSV | Low Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
LLSV | Lolo Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | Yes |
HYST | Alarm Deadband | DOUBLE | Yes | 0 | Yes | Yes | No | No |
The ODEL field is not implemented in the PID record.
See Monitor Specification, Chapter 1, 5, 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 |
ODEL | Output deadband for DM | FLOAT | Yes | 0 | Yes | Yes | No | No |
The CVAL field is the controlled variable value retrieved from the CVL link.
The LALM field is used to implement the hysteresis factor for the alarms.
The ALST field holds the last value for OVAL, but has no other function for the record.
The MLST field holds the last value for the OVAL field. It is used to calculate a value for DM when the record is in the POSITION mode. After any other calculations, DM is set equal to OVAL - MLST. Thus, even in POSTION mode, DM always holds a relative value, the difference between DM and the value of OVAL from the last time the record was processed.
The PMOD field indicates the current mode of the record:
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
CVAL | Value of controlled variable | FLOAT | No | 0 | Yes | Yes/No | No | No |
OVAL | Output Value | FLOAT | No | 0 | Yes | Yes | Yes | No |
ODM | Old DM. | FLOAT | No | 0 | Yes | No | Yes | No |
LALM | Value from when last monitors for alarm were triggered | FLOAT | No | 0 | Yes | No | No | No |
ALST | Value when last monitors for archiver were triggered | FLOAT | No | 0 | Yes | No | No | No |
MLST | Value when last monitors for value changes were triggered | FLOAT | No | 0 | Yes | No | No | No |
LOVL | Last Readback Value | FLOAT | No | 0 | Yes | No | No | No |
PMOD | Current Mode | RECCHOICE | Yes | 0 | No | Yes | No | |
LMOD | Last Mode | RECCHOICE | Yes | 0 | yes | No | No | No |
ODM | Old DM Value | FLOAT | No | 0 | Yes | No | No | No |
upper_disp_limit = hopr
lower_disp_limit = lopr
upper_ctrl_limit = hopr
lower_ctrl_limit = lopr
upper_alarm_limit = hihi
upper_warning_limit = high
lower_warning_limit = low
lower_alarm_limit = lolo
Generated with Harlequin WebMaker