Chapter 2
PID Algorithms
LabWindows/CVI PID Control Toolkit User Manual
2-2
ni.com
Implementing the PID Algorithm with the PID Functions
This section describes how the PID Control Toolkit functions implement the fast (positional)
PID algorithm. The fast PID algorithm is the default algorithm used in the PID Control
Toolkit.
Error Calculation
The following formula represents the current error used in calculating proportional, integral,
and derivative action, where PV
f
is the filtered process variable.
Proportional Action
Proportional action is the controller gain times the error, as shown in the following formula:
Trapezoidal Integration
Trapezoidal integration is used to avoid sharp changes in integral action when there is a
sudden change in the PV or SP. Use nonlinear adjustment of the integral action to counteract
overshoot. The following formula represents the trapezoidal integration action.
Partial Derivative Action
Because of abrupt changes in the SP, apply derivative action to only the PV, not to the error
(
e
), to avoid derivative kick. The following formula represents the partial derivative action.
Controller Output
Controller output is the summation of the proportional, integral, and derivative action,
as shown in the following formula:
e
(
k
) = (
SP PV
f
)
–
u
P
k
( )
=
K
c
*
e k
( )
(
)
u
I
k
( )
=
K
c
T
i
------
e i
( )
e i
1
–
(
)
+
2
----------------------------------
t
Δ
i
1
=
k
∑
u
D
k
( )
=
K
c
T
d
Δ
t
-----
PV
f
k
( )
PV
f
k
1
–
(
)
–
(
)
–
u k
( )
u
P
k
( )
u
I
k
( )
u
+
D
k
( )
+
=