102BTechnology instructions
9.2 PID control
S7-1200 Programmable controller
328
System Manual, 11/2011, A5E02486680-05
9.2.2
PID_Compact instruction
The PID controller uses the following formula to calculate the output value for the
PID_Compact instruction.
y = K
p
(w - x) +
(c · w - x)
[
(b · w - x) +
1
T
I
·
s
T
D
· s
a · T
D
· s + 1
]
y
Output value
x
Process value
w
Setpoint value
s
Laplace operator
K
p
Proportional gain
(P component)
a
Derivative delay coefficient
(D component)
T
1
Integral action time
(I component)
b
Proportional action weighting
(P component)
T
D
Derivative action time
(D component)
c
Derivative action weighting
(D component)
Table 9- 13 PID_Compact instruction
LAD / FBD
SCL
Description
"PID_Compact_1"(
Setpoint:=_real_in_,
Input:=_real_in_,
Input_PER:=_word_in_,
ManualEnable:=_bool_in_,
ManualValue:=_real_in_,
Reset:=_bool_in_,
ScaledInput=>_real_out_,
Output=>_real_out_,
Output_PER=>_word_out_,
Output_PWM=>_bool_out_,
SetpointLimit_H=>_bool_out_,
SetpointLimit_L=>_bool_out_,
InputWarning_H=>_bool_out_,
InputWarning_L=>_bool_out_,
State=>_int_out_,
Error=>_dword_out_);
PID_Compact provides a PID controller with
self-tuning for automatic and manual mode.
PID_Compact is a PIDT1 controller with
anti-windup and weighting of the P- and D-
component.
1
STEP 7 automatically creates the technological object and instance DB when you insert the instruction. The instance
DB contains the parameters of the technological object.
2
In the SCL example, "PID_Compact_1" is the name of the instance DB.
Table 9- 14 Data types for the parameters
Parameter and type
Data type
Description
Setpoint
IN
Real
Setpoint of the PID controller in automatic mode. Default value: 0.0
Input
IN
Real
Process value. Default value: 0.0
You must also set sPid_Cmpt.b_Input_PER_On = FALSE.