Skip to main content

PID Calculation

Instruction Parameters

Supported PLC Series

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S

Supported Data Registers

MXYKLFTCSZRQD@DConstant
S--------

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1-
CarryF11.2-

Number of Steps

Steps
2

Operands

OperandDescription
SThe 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 RegisterItemDescription and Range
SSet Value (SV)0 ~ 16,000
S+1Process Value (PV)0 ~ 16,000
S+2Manipulation Value (MV)0 ~ 16,000
S+3Process Value after Filtering (PVnf)0 ~ 16,000
S+4Manual Manipulation Value (MVMAN)0 ~ 16,000
S+5Function 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+6Reserved
S+7Reserved
S+8Reserved
S+9Reserved
S+10ReservedStatus
Refer to this table.
S+11Reserved
S+12Reserved
S+13Reserved
S+14Reserved
S+15Reserved
S+16Reserved
S+17Reserved
S+18Reserved
S+19Reserved
Calculation Occurrence

The S operation data occurs within a for-each loop.

Setting Data for Each Loop

DataDescription
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

FunctionDescription
Automatic or Manual Mode SelectionThe 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-LearningThe 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 × 100Proportional 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 DataIf 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 NumberFunctionDescription
Bit 0 ~ 3ReservedReserved
Bit 4Apply self-learning dataStatus when the control is performed by using the collected self-learning data.
Bit 5Collect self-learning dataStatus 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 6StabilityStatus 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 7Self-learning retentionStatus in which the self-learning data is stored in the memory.
Bit 8Process Value (PV) inertia amount data retentionStatus ON when a non-zero value is stored in the process value (PV) inertia amount memory.
Bit 9 ~ 15ReservedReserved

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.

Examples