PID Calculation
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S | ✓ | - | - | ✓ | ✓ | - | - | - | - | ✓ | - | ✓ | ✓ | ✓ | - |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | - |
| Carry | F11.2 | - |
Number of Steps
| Steps |
|---|
| 2 |
Operands
| Operand | Description |
|---|---|
| S | The only operand. Entries are only WORD data registers. This is where the result of the PID operation is stored. This requires 20 data registers. |
S Operation Data Result
| Data Register | Item | Description and Range |
|---|---|---|
| S | Set Value (SV) | 0 ~ 16,000 |
| S+1 | Process Value (PV) | 0 ~ 16,000 |
| S+2 | Manipulation Value (MV) | 0 ~ 16,000 |
| S+3 | Process Value after Filtering (PVnf) | 0 ~ 16,000 |
| S+4 | Manual Manipulation Value (MVMAN) | 0 ~ 16,000 |
| S+5 | Function Selection Flag Refer to this table. | Bit 0: - Automatic (0) - Manual (1) Bit 1: Enable Self-Learning Bit 2: Kp × 100 Bit 15: Request to delete the learned data |
| S+6 | Reserved | |
| S+7 | Reserved | |
| S+8 | Reserved | |
| S+9 | Reserved | |
| S+10 | Reserved | Status Refer to this table. |
| S+11 | Reserved | |
| S+12 | Reserved | |
| S+13 | Reserved | |
| S+14 | Reserved | |
| S+15 | Reserved | |
| S+16 | Reserved | |
| S+17 | Reserved | |
| S+18 | Reserved | |
| S+19 | Reserved |
Calculation Occurrence
The S operation data occurs within a for-each loop.
Setting Data for Each Loop
| Data | Description |
|---|---|
| Set Value (SV) | The desired target value that the user wants to control. |
| Process Value (PV) | The current value of the controlled unit read from the analog module. The process value (PV) must be regularly updated by the user using the FROM instruction while reading the value from the analog module, or the MOV instruction to update the measurement values. |
| Manipulation Value (MV) | The result of the PID operation that needs to be output to the control unit by using an analog or I/O module. |
| Process Value after Filtering (PVnf) | Filtering is used to prevent instantaneous deviation caused by the process value (PV) noise. The filtered process value (PV) is stored in the PVnf area. When the filter coefficient (α) is 0, the filtering is not applied to the process value (PV). This area can only be monitored. |
| Manual Manipulation Value (MVMAN) | When in manual mode, the value set as the manual manipulated value is output as the Manipulation Value (MV). |
Function Selection Flag
| Function | Description |
|---|---|
| Automatic or Manual Mode Selection | The user gets to select whether to control the control unit automatically by using the PID function or to output the value specified in the manual manipulation value (MV) to the control unit. |
| Enable Self-Learning | The self-learning function allows the user to take advantage of its ability to calculate the most suitable manipulation value (MV) output level for the set value (SV) based on the result of the previously executed PID control. |
| Kp × 100 | Proportional Gain (Kp), while set, can be expanded from 1 ~ 6,553,500. If this flag was forcefully reset, it is necessary to reconfigure the Kp × 100 as the Kp constant in order to obtain the same control effect. |
| Delete Self-Learning Data | If this flag is set, the PLC is initialized to delete all of the self-learning data that has already been collected to build a new learning data. Because the self-learning data is composed of files that are internal-use only for the PLC CPU, the user cannot use this for reference. |
Status
| Bit Number | Function | Description |
|---|---|---|
| Bit 0 ~ 3 | Reserved | Reserved |
| Bit 4 | Apply self-learning data | Status when the control is performed by using the collected self-learning data. |
| Bit 5 | Collect self-learning data | Status ON when the self-learning data is being collected. When the value of the set value (SV) is changed, the function of collecting the self-learning data gets activated. |
| Bit 6 | Stability | Status in which the control system is stable. The process value (PV) and set value (SV) are the same, and the manipulation value (MV) output is fixed with no change. |
| Bit 7 | Self-learning retention | Status in which the self-learning data is stored in the memory. |
| Bit 8 | Process Value (PV) inertia amount data retention | Status ON when a non-zero value is stored in the process value (PV) inertia amount memory. |
| Bit 9 ~ 15 | Reserved | Reserved |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
Instruction Usage
The PIDINIT instruction must be used before the PIDCAL instruction.
Refer to the PIDINIT instruction.