The FAQ on on PID Controller Tuning
- What is a PID controller?
- When must a PID be tuned, and why?
- How is a PID tuned?
- Special problems in realization and implementation
- Software, tutorials, training courses, and references
What is a PID controller?
Return to Contents
PID stands for Proportional-Integral-Derivative. This
is a type of feedback controller whose output, a control
variable (CV), is generally based on the error (e) between
some user-defined set point (SP) and some measured
process variable (PV). Each element of the PID controller
refers to a particular action taken on the error:
- Proportional: error multiplied by a gain, Kp. This is an adjustable amplifier. In many systems Kp is responsible for process stability: too low and the PV can drift away; too high and the PV can oscillate.
- Integral: the integral of error multiplied by a gain, Ki. In many systems Ki is responsible for driving error to zero, but to set Ki too high is to invite oscillation or instability or integrator windup or actuator saturation.
- Derivative: the rate of change of error multiplied by a gain, Kd. In many systems Kd is responsible for system response: too high and the PV will oscillate; too low and the PV will respond sluggishly. The designer should also note that derivative action amplifies any noise in the error signal.
Tuning of a PID involves the adjustment of
Kp, Ki, and Kd
to achieve some user-defined "optimal" character
of system response.
Although many architectures exist for control systems, the
PID controller is mature and well-understood by practitioners.
For these reasons, it is often the first choice for new
controller design. It satisfies Occam's Razor in being the
simplest solution for most cases.
A simple digital implementation of a PID controller, in which
rectangular integration is assumed, is as follows:
This is referred to as two-degree-of-freedom (two-DOF) design. Notice for this implementation it's assumed that all three controller actions involve ek. Many practitioners try to avoid this: applying Kp and/or Kd to the set point can magnify transient errors introduced by rapid changes to the SP. Consider the alternative implementation, in which Kp and Kd are applied only to the PV:
...which is one-DOF. You can apply any level of complexity to a PID implementation simply by basing it on a different type of integration. Consider this implementation based on trapezoidal integration:
Increasing complexity is not necessarily wise, however:
this alone will not make derivative action noise go away,
nor will it make an inherently unstable system stable.
The practice of having Kp=0 and Kd=0
acting on the SP are only special cases of two-DOF design
and are mostly used in process industries. There is nothing
wrong in having greater Kp acting on the SP than
on the PV in applications where SP tracking is required.
The effect is improved transient response to SP change.
In transfer function terms, this is referred to as "zero
placement." If the proportional term uses the error signal,
then the closed loop transfer function (CLTF) will have a
lead term (or, numerator zero). This can give rise to quick,
large changes if the command contains steps (and derivative
action amplifies this).
Asea Brown Boveri
is one manufacturer providing a more
than true two-DOF controller. It uses the ideal form with
a weighting factor (beta) in the SP path. You can then
tune for optimum load rejection (Kp and
Kd on error) and then adjust beta to weigh the
extent to which the SP is included in the proportional
action; e.g. if beta=0, you have an I-PD controller; if
beta=1 you have an IP-D controller. Some tuning methods
allow you to calculate beta to position the resulting
closed-loop zero optimally.
Motion control
In many cases, you might not want to let the SP make steps,
even if the user requests it. Steps can cause integrator
windup, actuator saturation, stresses, and other nonlinear
effects. A motion controller (for instance) would ramp the
SP from one position to another at a velocity and
acceleration the motor can handle.
In motion control, a full PID might include a first-order
filter in front of the SP memory, to separate the system
poles. This is essential if you choose PID on single
loops instead of some multivariable method for motion
control.
In motion control applications, the SP is governed by a
trajectory generator. Besides the standard parameters
(Kp, Ki, and Kd), other
parameters are involved: velocity, acceleration, and
friction (feedforward). Their purpose is to reduce
tracking error during acceleration/deceleration,
at higher speeds and at motion start/stop. These are
equivalent to variable gain and SP weighting.
When must a PID be tuned, and why?
Return to Contents
You may not encounter the same process twice. If you
don't, you won't see the same type of controller twice.
There are different types of objectives to be addressed
by a controller: error can be minimized in different ways,
as can CV activity. Some systems have interactions, and
those interactions may be of various strengths. And any
interaction affects tuning of an individual PID. There
is no single definition of best tuned that applies to
all loops, so no single tuning aid will tune all loops
optimally. Tuning is part of the design of the loop.
You might see a need for a loop to be tuned if it responds
slowly, or if it oscillates too much, or if it has a
steady-state error; and most definitely if it's
unstable! :-)
A PID MAY HAVE TO BE TUNED
WHEN...
- Careful consideration was not given to the units of gains and other parameters.
- The process dynamics were not well-understood when the gains were first set, or the dynamics have (for any reason) changed.
- Some characteristics of the control system are direction-dependent (e.g. actuator piston area, heat-up/cool-down of powerful heaters).
- You (as designer or operator) think the controller can perform better.
Always remember to check the hardware first. You may
not have to tune the controller at all.
A PID MAY NOT HAVE TO BE TUNED WHEN...
- A control valve sticks. (You may be able to spot this without leaving the control room.) Valves must be able to respond to commands.
- A control valve is stripped out from high-pressure flow. A valve's response to a command must have some effect on the system.
- Measurement taps are plugged, or sensors are disconnected. Bad measurements may have you correcting for errors that don't exist.
How is a PID tuned?
Return to Contents
Coming up with first-pass tuning values is very
easy: make a step change on the output, trend the
response, pull two values off the trend, and apply
a few simple equations. You then check how well the
tuning works in real life.
That's the hard part. And for many loops, this works
fine. But you have to be able to come up with acceptable
control for the problem loops as well, and that doesn't
reduce to a simple procedure.
The operator
In a process plant you do NOT block the operator from
doing anything unless it is absolutely unsafe. In all
other areas, the operator is the driver and has a free
hand.
Gain scheduling
Systems in which process dynamics will change in known
ways during operation will often benefit from gain
scheduling, in which Kp (at least) is the
result of a closed-form expression or a table look-up
based on a known process characteristic. This technique
depends on good knowledge or prediction of the process.
Feedforward control
Systems in which set point changes or disturbances can
be anticipated can sometimes benefit from feedforward
action, in which the anticipated changes are processed
independently of process error. You can compensate for
them approximately, before they have a chance to
influence process dynamics.
One reader does this with cascade control loops on the
Honeywell DCS by using the SP as feedforward input, then
optimizing feedback response with the normal tuning
constants, and adjusting feedforward gain to optimize
the SP response separately.
Inner loop control
Sometimes you may want to control separate quantities
within the same system, e.g. position and velocity in
motion control. In those cases you might have an outer
loop for position, and an inner (faster responding) loop
for velocity. (Don't apply Kd twice!)
Special problems in realization and implementation
Return to Contents
Differentiation noise
If a signal is noisy, the noise content will be
greatly amplified by differentiation; this is why
even digital controllers will almost never implement
a pure derivative. If the rate of the process variable
cannot be fed back directly, practitioners will often
use low-pass filters in conjunction with the
differentiator to attenuate noise. (In the analog
world, you'd need such a filter just to make the
differentiator realizable.)
The following is a listing (written in Java) for a
nonlinear digital rate algorithm used until recent
years in Centaur upper-stage launch vehicles. This
algorithm has as inputs eta (error in quantized bits,
and the quantizer is included here), and ddr (the
current rate, in error units/sec).
This algorithm provides some interesting features:
- phase lead maintained for a decade of higher frequency than with a linear low-pass filter;
- better performance in the presence of (small amounts of) noise.
In order to implement such a rate algorithm in your PID, you'd need the following:
- RES, your quantizer resolution in error units/bit
- ADDR, a "large" increment of rate added or subtracted each duty cycle. For Atlas/Centaur, engineers would use somewhere around one-third to one-fifth the smallest rate detectable by a very simple differentiator: RES/TS (one bit of error over one sampling interval).
- FDDR, a "small" increment of rate. For Atlas/Centaur, engineers would use somewhere around one-fifth to one-tenth of RES/TS.
- TAU, a multiplier (less than 1) used in case the rate increments given by ADDR and FDDR still turn out to be just too big. Atlas/Centaur used 0.5 to 0.9 in many cases.
Integrator windup
Integrator windup is a condition that results when
integral action saturates a controller without
the controller driving the error signal toward zero.
If the integrator does not have saturation, then it
can increase without bound, and without leading to
faster system response. This is a condition that
can potentially affect all controllers with integral
action. It can result in limit cycling or even
instability.
In the area of multibody articulated dynamic systems,
this area can be of particular concern. Consider the
Space Station photovoltaic arrays in sun-tracking mode.
The beta gimbals would rotate the arrays at the orbit
rate, 4 deg/min. In a situation in which operators
wanted to avoid a thermal problem with the arrays,
they might command the arrays to flip 180 degrees.
A step command of 180 degrees would saturate the (PID)
beta gimbal control system, and integrator windup
would occur. Rocketdyne saw instability of the beta
gimbal as a result.
Rocketdyne's solution was to individually limit each
action of the controller: proportional, integral and
derivative alike; they then would limit controller
output. This indeed solved the integrator windup
problem, at the expense of a slower response. If we
think of the controller output as
Pk + Ik + Dk at time k,
a large step would quickly cause Pk and
Ik to saturate. Then, as soon as
Dk = -Pk - Ik, the control
signal is nulled and controller output becomes zero,
so the gimbal slews at constant rate.
Here are four methods for dealing with windup in your
controller without unnecessarily limiting Pk
and Dk:
- Conditional Integration. If the controller output is saturated, and input and output are of the same sign, then set integrator input to zero.
- Limited Integration. If the integrator is saturated, and controller input is of the same sign, then set integrator input to zero.
- Tracking Anti-Windup. If the controller output is saturated, reduce the integrator input by some constant times the difference between unsaturated and saturated controller output.
- Modified Tracking Anti-Windup. Limit integrator input by some constant times the sum of Ik and saturated (Pk + Dk), so that if either of those two components exceeds your limits, the integrator is turned off.
References and Resources
- Anderson and Moore, Optimal Control: Linear Quadratic Methods
- Astrom and Hagglund, PID controllers.
- Bohn, C. and D. Atherton. "An Analysis Package Comparing PID Anti-Windup Strategies." IEEE Control Systems, April 1995.
- Liptak, Instrument Engineers' Handbook, Volume 1: Process Measurement.
- Liptak, Instrument Engineers' Handbook, Volume 2: Process Control.
- McMillan and Considine, eds., Process/Industrial Instruments and Controls Handbook.
- Palm, Control Systems Engineering.
- St. Clair, Controller Tuning and Control Loop Performance. Order it online here. Site contains a link to companion software.
- Rocketdyne (Space Station Freedom) document RJ00260, Beta Gimbal Electronic Control Unit, 1993.
- I like what the PIDlab guys have done, with clean Java applets for PID tuning. This looks highly useful not just for tweaking the actual knobs, but for training purposes as well.
- Control Station is Windows software specifically designed for process control training, including PID tuning.
- 20-sim has standard PID models and allows for C-Code generation even in the free demo version.
- BESTune evaluation version can be downloaded as well.
- "Practical Process Control" at the University of Connecticut
- Introductory course with an online simulator.
- John Popelish has written a short tutorial on a practical tuning method that is based on the graphical time presentation of process and and controller output. It's available HERE.
Authors
Doug Cooper
Sam Crisafulli
danyangliu
Michael Doherty
Walter Driedger
Rob Ellwood
Rod Fearn
Ron Graham (Editor)
Harvey Gratt
hh_ca
C. Kleijn
Spehro Pefhany
jhsc
Peter Nachtwey
Kari Olson
John Popelish
Carl Porter
Richard Salliss
smithjf1
Patrick Smout
David St. Clair
John Stiekema
Charles D. H. Williams
