102BTechnology instructions
9.2 PID control
S7-1200 Programmable controller
324
System Manual, 11/2011, A5E02486680-05
9.2
PID control
STEP 7 provides the following PID instructions for the S7-1200 CPU:
●
The PID_Compact instruction is used to control technical processes with continuous
input- and output variables.
●
The PID_3Step instruction is used to control motor-actuated devices, such as valves that
require discrete signals for open- and close actuation.
Both PID instructions (PID_3Step and PID_Compact) can calculate the P-, I-, and D-
components during startup (if configured for "pretuning"). You can also configure the
instruction for "fine tuning" to allow you to optimize the parameters. You do not need to
manually determine the parameters.
Note
Execute the PID instruction at constant intervals of the sampling time (preferably in a cyclic
OB).
Because the PID loop needs a certain time to respond to changes of the control value, do
not calculate the output value in every cycle. Do not execute the PID instruction in the main
program cycle OB (such as OB 1).
The sampling time of the PID algorithm represents the time between two calculations of the
output value (control value). The output value is calculated during self-tuning and rounded to
a multiple of the cycle time. All other functions of PID instruction are executed at every call.
PID algorithm
The PID (Proportional/Integral/Derivative) controller measures the time interval between two
calls and then evaluates the results for monitoring the sampling time. A mean value of the
sampling time is generated at each mode changeover and during initial startup. This value is
used as reference for the monitoring function and is used for calculation. Monitoring includes
the current measuring time between two calls and the mean value of the defined controller
sampling time.
The output value for the PID controller consists of three components:
●
P (proportional): When calculated with the "P" component, the output value is proportional
to the difference between the setpoint and the process value (input value).
●
I (integral): When calculated with the "I" component, the output value increases in
proportion to the duration of the difference between the setpoint and the process value
(input value) to finally correct the difference.
●
D (derivative): When calculated with the "D" component, the output value increases as a
function of the increasing rate of change of the difference between the setpoint and the
process value (input value). The output value is corrected to the setpoint as quickly as
possible.