Sei sulla pagina 1di 34

SPECIAL REPORT

HOW TO TUNE
PID LOOPS
www.controldesign.com

How to tune PID loops


Servo-motor applications and temperature-control applications
often need training after the auto-tune
By Mike Bacidore, editor in chief

A Control Design reader writes: I often have difficulty tuning PID loops, especially for tem-
perature control applications and servo-motor motion applications. If I use a temperature
controller, the auto-tune built into the device often works well if I follow the manufacturer’s
recommendations. However, if the temperature control or motion control is through a PLC
or other advanced controller, it’s often a long training process to find the optimum coeffi-
cients for the proportional, integral and derivative of the control loop.

Whether I am controlling the temperature of my medical cleaning process skid or moving


my servo-controlled three-axis gantry, if the process variable (PV), such as temperature or
position, needs to change slowly, it’s easy. As soon as I need better performance, such as a
fast change in temperature or position, or if dynamic loads are involved, my PID loops be-
come unstable and oscillate or the process variable overshoots or undershoots the setpoint.
I can’t afford to burn up the medical device I’m cleaning or have a spongy motion-control
system that can’t snap to a position.

How do I achieve a quick-responding PID control loop that can handle dynamic changes to
the process variable without chasing PID coefficients for days? What are some rules when
designing the control system for these closed-loop control applications?

Where do I start and what are some best practices to get stability and optimal control in
process-skid and motion-control applications from both a hardware and a PID tuning stand-
point. What are some procedures to follow to help reduce PID-loop-tuning time? Any sug-
gestions are appreciated?

How to tune PID loops 2


www.controldesign.com

ANSWERS Before beginning, adjust the set point (SP)


P IS FOR PROPORTIONAL BAND to about 80% of the normal process setting.
First, determine what engineering units the
tuning parameters use. This allows you to 1. Start with the proportional band at what-
understand if increasing or decreasing a ever the default value is, or 50% of setting
parameter has a positive or negative effect. range.
2. Set both the integral and derivative pa-
The P in PID is for proportional band. It is rameters to zero.
also known as gain. Increasing the propor-
tional-band setting decreases its effect Wait a few minutes for the temperature to
on the loop. Whereas increasing the gain stabilize. Note that it will not be at the set
parameter increases the effect. Proportional point, generally lower.
band = 100/gain.
Upset the loop by introducing loss either by
I is for integral. This is the time parameter. raising the set point 10% or removing heat
It is also known as reset. Increasing integral through whatever method is practical. I
parameter increases the effect; decreasing have used air guns; opened doors of furnac-
reset parameter increases the effect. Inte- es; sprayed cold water from a garden hose;
gral = 1/reset. turned off main-burner gas-supply valves;
tripped circuit breakers. And I’ve even shov-
D is for the derivative parameter. It is also eled snow onto rotary kiln infeed conveyors
referred to as rate. These terms act the in an attempt to simulate process heat loss.
same: Increasing the value will increase the
effect on the loop. Observe the response. If the output slowly
increases and the temperature does not
For both integral and derivative, the units of oscillate, decrease (increase the effect) the
time must be understood, as well (millisec- proportional band and repeat the upset.
onds or seconds). Do this several times until you see a pro-
nounced oscillation of the process variable;
A reasonably quick method to create a sta- it still will not be at set point.
ble loop requires a process upset through
heat loss. This method is used without the Now, without disturbing the process, in-
process actually being in operation. crease the integral term one step at a time,

How to tune PID loops 3


www.controldesign.com

waiting a reasonable length of time after what. I will give a simplified example of what
making a change until the temperature is I mean by resolution of the control variable.
now oscillating around the set point. This
oscillation may not be very noticeable, but If the application is controlling the tem-
remember you are in a steady state condi- perature in a small 5-ft-by-5-ft room, for
tion at this time. example, and you try using a 500,000-Btu
furnace as your control variable, then your
Next, upset the loop using whatever meth- loop will never be stable. You will always
od available and observe the response. You overshoot to an extreme oscillation around
can now add in a small amount of derivative the set point because you have too coarse
term one step at a time after upsetting the of a control variable.
process until there is acceptable perfor- — Dan Michki, senior robotics/controls engineer,

mance. Decent enough control should now East Balt Bakeries, www.eastbalt.com, Chicago

be occurring, allowing you to run the sys-


tem under real process conditions. EQUIPMENT, ALGORITHM,
SAMPLE RATE
Further fine tuning is now performed with First, know your equipment. Don’t try to
small changes to one parameter at a time tune over an issue that is caused by faulty
and allowing sufficient time for the change or erratic equipment. Make sure there are
to be observed. Try to operate the loop in no external equipment problems causing
as many different process conditions as issues in your PID control—for example, tun-
practical. Record all changes along with ing a methane-powered generator with a
performance notes to aid in solving future dirty methane supply or tuning a generator
problems. on top of a governor. Also watch out for lag
— Mike Krummey, electrical engineering manager, or dead time in your equipment, which can
Matrix Packaging Machinery, www.matrixpm.com be caused by actuators or sensors that are
slow to respond to dynamic changes. And,
NO DERIVATIVE VALUE lastly, keep an eye out for external noise on
In my experience, using PID-loop function your PV signal; use a filter whenever pos-
blocks in a PLC the first thing that I do is to sible to be sure the feedback is pure.
remove the derivative value completely. I
have yet to find an application where a de- Next, know your algorithm. All controllers
rivative value was needed. The second thing are not created equal, and most manufac-
to consider is the resolution of your control turers have their own interpretation of the
variable. If the resolution is too high, then PID equation. Look through the help file or
you will never get stable control, no matter product documentation to determine which

How to tune PID loops 4


www.controldesign.com

version of the PID equation your control- PID equation, Kr*(en – e(n-1)), Kr is the calcu-
ler is using. This will help you to determine lated coefficient, but the gain is determined
the proper values for your coefficients. This based on the error at the current time minus
also explains why the auto-tune works so the error at the time before. So, with a calcu-
well with the temperature controller you lated coefficient of 1, if the error goes from
mention. Using the manufacturer’s recom- 2 to 10, then the D term is 8; but, if the error
mendations, which are fine-tuned to the then goes from 10 to 12, the D term is 2 with
manufacturer’s algorithm, will undoubtedly the error still increasing. The D term dropped
produce better results. to 2 because the error rate of increase slowed
even though the error itself increased. On the
Set your sample rate. PID sample rate flip side, with the goal of eliminating error as
identifies how often the instruction will fast as possible, the derivative term can also
calculate a new output value. Make sure become a hindrance. If the D term sees a
the rate at which you are calculating is dramatic swing toward correcting the error, it
set appropriately. Setting the rate too will mitigate the gain to avoid an overshoot,
low will cause your controller to miss which could unintentionally cause an under-
important changes, and sampling too fast shoot if not set properly. In other words, use
could cause instability in your integral and the derivative term carefully and only when
derivative terms. Try to shrink the sample absolutely necessary.
rate as much as possible, but, more impor- — Bill Dehner, technical marketer, AutomationDirect,

tantly, keep that value constant. www.automationdirect.com

As for the tuning itself, I’m not saying you MULTIPLE PIDs
are trying to tune the values all at once, but I mainly work with temperature controls, and
don’t. You’ll go insane. Instead, cancel out each piece of equipment has a unique tem-
the integral and derivative, and focus on the perature profile within the temperature zone.
proportional term first. Get the proportional The battle of having a PID loop that reacts
value to a point where the system is correct- quickly without overshooting is a common
ing quickly in the right direction. Then add problem. In the aerospace-parts manufactur-
the integral term in and tune until you get the ing industry, this overshoot is tightly con-
desired response in the low-error range. For trolled via AMS 2750 requirements.
most systems the PI control is good enough,
but if you need derivative control, remember One of the easiest ways that I have found to
that the derivative is based on the rate of help resolve this is with multiple PID loops.
change in the error, not the error itself. For In the past, we just had a single PID for the
example, looking at the derivative part of this controller, but more modern controllers are

How to tune PID loops 5


www.controldesign.com

allowing multiple PIDs. This is achieved by the heating fluid. Similarly, by decreasing
setting a PID for a temperature range. This the flow of steam, the temperature drops.
will allow you to have an aggressive PID and The change in steam flow impacts the final
not worry about the overshoot. Then, when steady state temperature of the exit steam.
you get closer to your setting, you can have Processes such as this are relatively easy
a PID that is less aggressive and will not to tune using the basic tuning rules avail-
overshoot. For example: I’m trying to heat able. This type of process is also known as
a furnace to 1,200 °F at a ramp rate of 50 a self-regulating process.
°F/ minute. We will use a PID setting for
0-1,100 °F; then there will be a different PID An example of a semi-continuous tempera-
setting for the range from 1,101 °F and up. ture control application would be tempera-
This will allow us to tune the 1,101 °F-and-up ture control of a furnace or batch reactor
differently than we do the lower range. If (Figure 2). To increase the temperature,
the first PID was used, then we would surely the power to the heating element or flow
overshoot. However, once the temperature of steam through the reactor jacket is in-
reaches 1,101 °F, then the second PID takes creased. As the amount of heat to the vessel
over and controls less aggressively so that increases, the rate of temperature change
we don’t overshoot. increases. By decreasing the heat into the
— Scott Richardson, continuous improvement manager, system, the temperature will still rise, albeit
special processes, Woodward, www.woodward.com, at a much slower rate. Note, however, that
Rockford, Illinois turning off the heat completely won’t cause
the vessel to start cooling instantaneously.
TEMPERATURE CONTROL The dynamics between the heating and cool-
CHALLENGES ing can be remarkably different. Addition-
Temperature control applications can be ally, the inertia of the heating processes is
broken into two main categories—fully con- challenging. The walls of the vessels, or even
tinuous and semi-continuous (or batch). the material that is being heated, all absorb
An example of a fully continuous tempera- energy and generally are slow to release
ture controller is a shell-and-tube heat the energy. This presents a challenge. These
exchanger (Figure 1). In this application, semi-continuous temperature control ap-
the exit temperature is controlled by ad- plications are highly nonlinear both in terms
justing the flow rate of heating fluid, such of their operating range and in terms of their
as steam, through the shell side. As the operating direction (heating versus cooling).
flow of heating fluid is increased, the tem- Temperature control exhibits give-and-take
perature also increases until it eventually dynamics that practitioners must consider in
settles at a temperature well below that of order to strike the proper balance.

How to tune PID loops 6


www.controldesign.com

Cold Liquid
Warm Liquid Flow
(L/min) Valve Position (%)

FULLY CONTINUOUS
Figure 1: In this shell-and-tube-heat-exchanger application,
the exit temperature is controlled by adjusting the flow rate
of heating fluid, such as steam, through the shell side.
(Source: Control Station)

Steam Flow
(lbs/hr)

Controller Output
(%)
Exit Temp (ºC)

Set Point (ºC)

Header Pressure

Steam Supply
Header

To understand the solution, one must un- lating influence over time. The proportional
derstand how a PID controller reacts to and integral terms drive the process toward
disturbances and set-point changes. Most set point in order to eliminate error, and
PID controllers work using three corrective they will not stop until the error is gone. The
forces: proportional, integral and derivative. derivative term, on the other hand, does not
The proportional term simply adds a correc- account for the value of error (if it’s large
tion term to the output based on the current or small); it only accounts for the rate of
error (SP-PV). The integral term adjusts the change of the error. If the error is chang-
output based upon how much error and for ing quickly, the derivative term has a large
how long the error has persisted, accumu- influence and works to prevent the error

How to tune PID loops 7


www.controldesign.com

Reactant Feed

Conversion (%)

Controller Output (%)


Reactor Temp (ºC)

Steam to Jacket

SEMI-CONTINUOUS
Figure 2: To increase furnace or batch-re-
actor temperature, the power to the heat-
ing element or flow of steam through the
reactor jacket is increased. As the amount of
from changing too quickly. When all three
heat to the vessel increases, the rate of tem-
forces work together, you get a fast correc- perature change increases. By decreasing
the heat into the system, the temperature
tion using proportional and integral driving
will still rise, albeit at a much slower rate.
the output to get the process variable to set (Source: Control Station)

point, and the counteraction of the deriva-


tive pulling back on the correction once the
process variable starts to change too rapidly. Let’s focus on the modeling part first. For
the sake of simplicity, we will stick to first
In most cases, the full PID algorithm is rec- order models. Let’s look at an open-loop
ommended for semi-continuous type tem- bump test of a semi-continuous furnace,
perature controllers. like an annealing furnace (Figure 3), and
examples of open-loop step tests for self-
There are many methods for tuning semi- regulating and non self-regulating process-
continuous temperature controllers, and all es (Figure 4). Notice that the temperature-
apply a similar approach: model the process control example from the furnace doesn’t
to characterize its dynamics, and then use really look like either of the models. In fact,
that model to calculate tuning values based these types of semi-continuous temperature
on tuning correlations. controllers are best represented by a hybrid

How to tune PID loops 8


www.controldesign.com

IMPACT OF HEATING ELEMENT POWER ON TEMPERATURE OF FURNACE

FURNACE TEST
Figure 3: In an open-loop bump test of a semi-continuous furnace, the temperature-control ex-
ample doesn’t really look like either of the models. In fact, these types of semi-continuous tem-
perature controllers are best represented by a hybrid of the two models.
(Source: Control Station)

of the two models. That is a different topic as a non-self-regulating process. Figure 5


for another time. shows an integrating process applied to the
initial dynamics. Since we only require the
In practice, you have two options. The tra- initial dynamic response, the time required
ditional method to generate a model is to for testing can be significantly reduced. The
do a step test in manual mode and wait for integrating model parameters (K* Integra-
the process to complete its response. The tor Gain and p
Process Deadtime) can be
challenge with this method is that it takes a generated either with software or by hand
very long time for these types of processes using the slope method detailed at www.
to steady out, if they ever do. The other op- controldesign.com/controlguru.
tion is to treat the initial process dynamics

How to tune PID loops 9


www.controldesign.com

Once a model has been generated, tuning The biggest challenge with using an IMC ap-
correlations can be employed to generate proach to tuning temperature controllers is
a set of tuning parameters without having the selection of the closed-loop time con-
to trial-and-error tune. For this example, we stant, c
, which is often referred to as lamb-
can use the internal model control (IMC) da. This value represents the time needed
method to generate full PID Tuning values for the process to reach 63% of a set-point
for an integrating process (See equation 1 change. The closed-loop time can be based
on the next page). either off of a particular design objective or

SELF-REGULATING NON-SELF-REGULATING

SELF-REGULATING AND NON-SELF-REGULATING


Figure 4: These examples show open-loop step tests for self-regulating and non-self-regulating
processes. (Source: Control Station)

INTEGRATING PROCESS
Figure 5: An integrating process is applied to the initial dynamics. Since we only require the ini-
tial dynamic response, the time required for testing can be significantly reduced.
(Source: Control Station)

How to tune PID loops 10


www.controldesign.com

IMC TUNING CORRELATIONS


NON-SELF — REGULATING PROCESSES

EQUATION 1

EQUATION 2

EQUATION 3

on the process’ dynamics. An estimate for


the closed-loop time constant for a non- and with the goal of providing a quick
self-regulating process can be calculated initial response with minimal overshoot.
by determining the amount of time that This method has been used with success
it takes for the PV to change by 1% when on furnaces, ovens, fermenters and batch
the controller output (CO) is changed by reactors. In the end, there is always a
1%. Once this time is determined, it can be trade-off between fast initial response and
multiplied by 0.63 to determine the amount overshoot. Indeed, the PID controller of-
of time it takes to reach 63% of the 1% PV fers a simple means for control that has its
change. A simple method for estimating c
is limitations, especially as the deadtime of
shown above in equation 2. the system gets very large or as nonlinear-
ity increases. In those cases, a simple PID
Applying this method to the temperature controller may not be adequate, and more
loop explored earlier, the closed-loop time advanced forms of control such as adap-
constant is estimated above in equation 3. tive PID, model predicative control or even
fuzzy logic may be appropriate.
This method is designed to generate tun- — Robert Rice, Ph.D., vice president of engineering,

ing parameters quickly, using minimal data Control Station, www.controlstation.com

How to tune PID loops 11


www.controldesign.com

TAME THAT LOOP thermal mass to overshoot the set point pri-
A major aspect of controlling both thermal or to the sensor being able to respond (lots
and position control loops begins with mak- of power, large lag, small thermal mass).
ing the loop as tame as possible. This starts Such a configuration needs a very slow con-
at the system design stage. trol response and gentle gains to keep from
overreacting in the lag time. Moving the
For the thermal loops, limiting the lag time sensor closer to the heater cuts the lag time
helps to reduce the overshoot. Time lag is but may also blind the sensor to what is
a high (theoretically infinite) order system happening at the load. Either experimenta-
but may be modeled reasonably by fewer tion or modeling, or both, can help to locate
stages to get a reasonable approximation, a reasonable sensor placement to minimize
as long as the pure lag time is not too lag. Other solutions, such as heat pipes, may
long. Pure lag time, or transport time, is also be used to reduce the lag and to make
the time between applying a pulse to the the system closer to equal temperatures, if
input and seeing any change in the feed- that is a critical need.
back sensor response.
Additional sensors may also be used to limit
There is a trade-off in selecting the physi- heating to a reasonable level approximating
cal position of the temperature sensor with the desired temperature while the main sen-
respect to the heating element and with sor is slower responding but sensing nearer
respect to the controlled load zone. Re- to the temperature control point (dual loop
member, the control loop tries to minimize control). Alternatively, intermediate temper-
the error as seen by the sensor. If the sen- atures may also be estimated, using a model
sor is too far from the load and too close of the system, as well as the power being
to the heater, the response at the load can driven into the system, but these both are
be slow and the sensor may not see varia- well past the realm of a basic PID controller.
tions at the load; the loop will, however, be
very easy to control. Place the sensor too On several medical-application tempera-
far from the heater, and the lag time can ture-control projects of which I have been
make overshoot very hard to avoid. Place involved, PID was not an optimal control
the sensor on the other side of the thermal strategy; a targeted control system design
mass away from the heater, and the prob- was used instead to allow significantly better
lem only gets worse. stability and response. The addition of a zero
(lead = differentiation) into the integrator,
The overshoot can be particularly bad if the plus an additional zero (differentiator) with
heater can supply sufficient heat into the gain, gave a pair of zeros that were avail-

How to tune PID loops 12


www.controldesign.com

able to attract the poles of the system for When handling larger inertial mismatches,
a stable, fast response. The control point the system may be modeled at a mass-
stayed to within ~.01 °C (as measured with spring-mass (rotary inertia, torsional
the control sensor), with a fraction of a sec- spring, rotary inertia, to be more exact),
ond response time to transients. Air load on which has an anti-resonance (both masses
the system from waving a piece of paper at rotating in opposition and a resonance,
it were readily detected and rejected. One which is approximately the motor mass
project used a heat pipe to equalize the tem- and the spring working against the signifi-
perature over a fairly wide area that also had cantly larger load inertia [series and paral-
variable thermal loads. Any cold spot tended lel resonances, if you will]).
to condense the gas phase, quickly releasing
heat into the colder area while not causing This is actually the motor inertia, the spring
measurable changes to those regions al- constant of any shaft and coupler, and the
ready at temperature. load inertia. Most people will recognize a
mass connected via a spring to a second
Knowledge about the system being con- mass. The equations are the same, but many
trolled is of great help in determining the did not see the math worked in rotary units
proper control approach. In the absence of in basic physics.
a good model, a little experimentation as to
the placement of your temperature feed- Optimizing the mechanical system for fast
back device(s) can significantly make a sys- response control also starts long before
tem easier to control. Apply a short pulse tuning. Such factors as presence or absence
of power to the heater and then watch the of gearheads, the degree of backlash and
response on a digital oscilloscope. You may the style of motor couplers can significantly
want a second (temporary) sensor at the change the settling time and can limit the
load to allow you to visualize the lag time response of any best control method. Over
and filtering effects of the thermal circuit, the years, I have moved well away from
both at the control sensor and at the load. PID. We at QuickSilver Controls use posi-
For example, a slight overshoot at the tion velocity integration acceleration (PVIA)
sensor may still produce an underdamped due to the large range of loads it accom-
response at the region you are trying to modates. The motor and its load may be
control. Even if you are using a straight PID modeled as a torque source coupled to the
rather than an optimized controller, making motor inertia, which is in turn, coupled to
the problem easier by proper sensor loca- the load mass via a spring. The gain is the
tion selection will make for a much more ratio of acceleration at the motor shaft and
stable and robust control system. encoder to the input torque. The spring

How to tune PID loops 13


www.controldesign.com

represents the shaft and coupling stiffness. to anti-resonance frequency, causing a


At low frequencies, the motor will see the greater change in gain for which the con-
combined inertias (Jmotor + Jload). The low trol system will have to cope. Appropriate
frequency motion does not significantly filtering, which is not present in a basic PID
excite the spring. The gain (acceleration system, can shape the overall system re-
per torque) drops off with frequency. At sponse to provide a robust and responsive
a certain frequency, the lag introduced by system. From the design side, the use of an
the spring causes the load inertia to have adequately stiff shaft and coupler can push
opposite phase to the motor inertia; that is, the resonance frequencies higher to move
the motions will be in opposite directions. them away from the range of frequencies
This is the anti-resonance frequency and in which the motion is desired. Adding in-
corresponds to a local low point in gain/fre- ertia to the motor, or very near to the mo-
quency point. As the excitation frequency tor, can reduce the frequency ratio of the
further increases, the load inertia has less resonance and anti-resonance frequencies,
and less motion relative to the motor, as the reducing excess gain, which may cause
springiness of the coupling from the motor trouble in simpler PID systems. Finally,
to the load inertia limits the acceleration gearing may be used to reduce the load
of the load inertia. The slope of the gain/ inertia as seen by the motor to effectively
frequency plot doubles each octave in this reduce the ratio of motor to load inertia.
frequency range. This gain increases until This again limits the gain rise between
the spring constant of the shaft and coupler anti-resonance frequencies and resonant
interacting with the motor inertia will cause frequencies, which tames the system for
a maximum gain point called resonance. simple PID controllers. Gearing reduces the
The peak in gain here may be very strong if reflected inertia by the square of the gear
there is little damping in the system. Be- ratio. The addition of a properly filtered ac-
yond this frequency, the motor inertia will celeration estimate provides an electronic
dominate and the gain/frequency plot will approximation of a viscous inertial damper,
again drop off by a factor of 2 for each oc- which provides an additional damping and
tave. Note this is a simplified model; things significantly boosts the phase margin over
can get much more interesting when more a range of frequencies that can be as large
elements are considered and especially if as two or three octaves. This may eliminate
there is any backlash in the system. the need for tight notch filters, which may
have issues as the load changes.
Increasing the relative inertia of the load
compared to the motor inertia will cause Finally, we use a patented interaction
a greater ratio of the resonance frequency between the motor and the driver stage

How to tune PID loops 14


www.controldesign.com

to introduce additional damping into the thicker shafts; solid anchors for the motor
system, by a combination of active and and for the gearhead, if needed, to handle
passive methods, which further adds to the reaction forces. This is missed more of-
the gain margin. As shipped, the system ten than would be expected. Minimizing the
typically will operate open shaft to ap- load where possible is also helpful.
proximately 5x motor inertia with minimal
additional tuning. With about 10 minutes Yes, there is expertise available to handle
of effort, a 100:1 inertial mismatch may be more difficult control problems, but in a
easily obtained. According to varying lit- large majority of the systems, a little effort
erature, PID is typically limited to less than up front can make the control effort much
a 10:1 inertial mismatch. easier, less expensive and more robust.

Using straight PID, it is important to be Why lag is so bad: control systems are
aware that there are series and parallel all about timely responses to measured
implementations, and various implemen- stimulus. Lag increases uncertainty in
tations in between. The method of tun- the system. Think about investing with
ing each of these significantly varies. The information that is months or years old,
series implementation tends to have more or driving watching a 10-second-delayed
tuning interactions but is more common of video. It would be very difficult to respond
analog controllers. to a light changing when you were already
through it by the time you saw it change.
Remember, the first step is to start with The control system has the same problem
an easily controllable solution. For ther- if a heater has already supplied sufficient
mal, pick a sensor location without too energy into a system to overshoot the set
much lag, if possible, and (almost) always temperature by the time the sensor starts
between the heater and the region to be to respond. In the absence of timely data, a
thermally controlled. Try to minimize lag model of the system that gives a predictive
in the system, which includes both the response may be needed, or the maximum
physical system and any computational rate of power must be limited—driving re-
lag in the system, such as a slower or ally slowly, in the comparison. Mathemati-
overtaxed PLC. cally, lag degrades the phase margin of a
system, forcing either lower gains or low
With mechanical systems, for fast respons- stability margins (overshoot), or even os-
es, minimize the springiness and lost mo- cillations (loss of stability).
tion in the system—tight and stiff couplers; — Donald Labriola P.E., president, QuickSilver Controls,

lower backlash gearing, if needed; shorter, www.quicksilvercontrols.com

How to tune PID loops 15


www.controldesign.com

START WITH THE LOOP above the PV. If for some reason the ramp
Here are some techniques I have used in is faster than the system can physically sup-
the past when a fast temperature ramp fol- port, the output will be pegged and you are
lowed by minimal overshoot is desired. out of control. At that point the SP will pull
away from the PV. Having an outrun limit
Obviously a good understanding of how PID means that when you regain control, your
loops work is essential (See www.innovative- overshoot will be less severe than it would
controls.com/blog/basics-tuning-pid-loops). have otherwise been, but it’s still better to
keep the ramp slow enough to stay in con-
Use a ramping set point with an expo- trol so that this never happens.
nential decay at the end to knock off the
terminal elbow. That was a technique I If, rather than controlling on the way up,
came across back in 2006 for exactly this you want to heat up to the target as fast as
problem—a difficult temperature loop that the system’s capacity will allow, an alter-
needed to ramp up quickly to a target nate technique is to set up a learning sys-
set point, but not significantly overshoot tem. This is something I did last year with
it. Ramping the set point at a proper rate an oven system that had a huge latency; it
keeps the loop under control the whole would continue heating up very significantly
way up, meaning your output is not even after we cut the heating output. When
pegged. If it is pegged, the PV will lag, and it’s time to heat, have your PID loop output
you are out of control, and it will overshoot track its maximum. Then, when the PV gets
badly. The solutions are to either slow your within x degrees of the target SP, cut the
ramp rate or add physical heating capac- output track to zero and release the loop to
ity to achieve the desired rate. But, if you automatic. You may need to hold the out-
ramp in control at a constant rate until you put at zero for a few seconds before releas-
reach the target, then stop. The loop will ing. Here’s the tricky part: Have a timer that
have settled controlling at a steady rise runs for about 1.5 times as long as it takes
in temperature and will have a small but that system to get to its maximum initial
avoidable overshoot when you switch to overshoot. Capture the highest (smooth/fil-
the steady target set point. Instead, slow tered) PV during that entire duration. When
the ramp at the end to knock the corner the timer expires, automatically adjust the x
off the ramp-target transition, and you can offset based on how much the PV overshot
consistently nail the target. or undershot the set point so it hits it closer
the next time. Have clamps on that x offset
SP outrun limits: program your ramping so, if something odd happens, it will still be
set point to never be more than x degrees reasonable the next time.

How to tune PID loops 16


www.controldesign.com

The other big technique here is to use controller tune itself, occasionally adjusting
adaptive gain control. Use one set of tun- the S curves in the servo controller.
ing parameters during the ramp, and then — Chris Hard​y, systems integration engineer,Cross

switch to a different set for the soak. I find Integrated Systems Group, www.crossisg.com, CSIA

the above techniques usually eliminate the (www.controlsys.org) member, Birmingham, Alabama

need for this, but in some systems it can


be beneficial. REMEMBER TO RECORD
PAST SETTINGS
Derivative action is only useful when there While PID loops make life easier by auto-
is a significant time delay from a step mating process control functions, they also
change in output until the result of that present challenges in a variety of applica-
change starts to be seen in the PV. Loops tions to achieve optimal stability and con-
controlling variables such as flow, pressure, trol. The following method can be applied
level speed, and position—where an output across the board to improve loop tuning.
change affects the PV everywhere in-
stantly—never need derivative. By contrast, Before making any changes, be sure to
loops controlling variables such as tempera- record the current PID settings. It is also a
ture, pH and other chemical concentrations good idea to have a record of past set-
deal with fluids where the change in output tings, stable or otherwise. Finally, check for
must be mixed, convected or transported safety concerns.
from the point where the output affects the
fluid to the measurement point. Those loops The following steps are for a controller set
may benefit from derivative action. How- to interacting type. Most controllers offer
ever, when manually tuning, I usually avoid a choice.
using derivative, except as a last resort.
1. a. Turn integral to no integral action.
These techniques also are covered in my b. Turn the derivative time to as small a
loop tuning blog at www.innovativecon- number as possible. These settings are
trols.com/blog/advanced-pid-loop-tuning- often called Off.
methods. 2. a. Increase the gain in steps until the loop
begins to cycle. This gain will be called
As for motion control, most of my experi- Kcu.
ence is in process controls. But in my little b. Record the period of cycling in min-
experience with servo controllers, I’ve utes. Call this Pn.
always just sent the target position from the c. Decrease gain to stable levels as soon
PLC to the servo controller and let the servo as possible.

How to tune PID loops 17


www.controldesign.com

These readings are only estimates. That usually provides some really good re-
3. C
 alculate Kc = Kcu/2 for aggressive loop sults to start with.
tuning.
4. Calculate Kc = Kcu/4 for conservative In general, I think full PID controllers are
tuning. rather rarely used, but they have their place.
5. Ti (integral time in minutes) = 1.2Pn. Obviously, the more elements you need to
6. Td (derivative time in minutes) = Pn/8. control, the more difficult it becomes to find
7. Tf (Filter time) = Pn/8. the optimal solution.
— Marcel Voigt, senior solutions engineer,

If the process is not too noisy, it may be as B&R Industrial Automation, www.br-automation.com

well to turn the filter off. To some degree,


filter and derivative just offset each other. 5 TUNING TIPS
This is a complex question in two parts—
For especially difficult cases, an experi- process PID tuning for temperature and
enced expert consultant may be required motion control PID tuning.
on-site.
— Lee Payne, president, Dataforth, www.dataforth.com The customer doesn’t give specifics about
the system or mechanics. Thus, his difficulty
FOCUS ON PI to be able to tune his system might come
Motion systems usually only use PI control- from poor mechanics, inappropriate motor-
lers and add filters on top of it to filter out and-gearbox sizing, the low bandwidth of
machine-specific interferences. If you have his system, saturated amplifier or a number
a specific frequency, you could use a simple of other things.
notch filter; for more challenging issues a bi-
quad could get you some really nice results For motion-control PID tuning, here are
and a better-performing motion system. some general guidelines.
1. Always perform sizings to take in account
We have a built-in system that measures the load to motor inertial mismatch, which
the system response and you can apply is the most common problem and the
filter directly into the resulting bode plot. source of loop instability. It will be hard to
tune if this load inertia is too high.
As for temperature or other control loops, 2. Remove system backlash as much as pos-
we have similar functionality based on our sible in the driven components. For exam-
mechatronics libraries. We can identify the ple, use servo gearboxes with 16 arc-min
system the loop needs to control and apply or less; and use backlash-free couplings,
default settings based on the identification. low backlash nuts or belt and pulleys.

How to tune PID loops 18


www.controldesign.com

3. Use the step response method (command — Warren Osak, founder and CEO,

vs. response) to see how the system is re- Electromate, www.electromate.com

acting. This is commonly performed using


an oscilloscope or is sometimes provided MOTION PROFILE
with the controller manufacturer’s software. Even though the control of temperatures
You need to see what you are doing; other- and servo positioning both use PID, they are
wise, you are just shooting in the dark. different animals. Both systems have to deal
4. Start tuning with integral gain at zero; with inertia. In a temperature control sys-
increase proportional gain to get a bit of tem there is thermal mass (thermal inertia).
overshoot response; and then adjust the This mass is normally quite high and causes
derivative gain a bit at the same time to a long lag between an output change and
damp the oscillations. Add integral gain actually seeing a resultant. Normally this is
at the end to remove the static error. many minutes. This is the time constant of
Think of it as a pyramid. The base of the the system. In the case of heating a large
pyramid is KD; the middle of the pyramid metal object such as an extruder barrel, we
is KP; and the top of the pyramid is KI. will have a much higher time constant than
The KD (derivative gain) would have the an air heating system where we are control-
highest value, followed by KP (propor- ling a gas valve for a furnace. With a servo
tional gain) with a lower value, followed system, the time constants are typically in
by KI (integral gain) with the lowest the millisecond range. When we ask for mo-
value. Manual tuning is a trial-and-error tion, we get a response very quickly.
process. For systems with underdamped
conditions, increase KP and decrease KD Most servo systems these days have the
in tandem. For systems with poor accu- ability to generate their own gains. This
racy, gradually increase KI. For systems is internally done by the system making
with high frequency ringing, increase KD. several velocity changes, and as a result of
5. At all time, make sure the current output those changes, it calculates the time con-
of the amplifier is not saturated; otherwise, stant of the system. From that information,
this procedure is invalid, and tuning is im- it will generate the gains.
possible. Saturated current can mean you
are asking too much torque from the motor In a servo control system, we normally gen-
and amplifier or you are asking for a speed erate a motion profile for the velocity part
higher than what your system can achieve. of the control. This can typically be done in
A deeper analysis of the complete system the motion command and is normally trap-
might still be needed to help diagnose flaws ezoidal or triangular. When we use a profile,
or weaknesses. we don’t just command the system to jump

How to tune PID loops 19


www.controldesign.com

immediately to the new position, but to allow it, depending on the amount of power
move to the destination with a velocity pro- available and the mass of the system. Using
file. In the case of a trapezoidal profile, we a profile doesn’t mean the system can’t be
cause the servo to ramp up to a constant snappy; it just means that we are anticipat-
velocity, remain at that velocity for a pe- ing the work needed to accelerate the mass
riod and then decelerate to zero. When we ahead of time, which keeps the positioning
reach zero, we should be at our requested system from having to make huge correc-
position. A trapezoidal profile accomplishes tions during the move.
the requested motion. This keeps the servo
from seeing a huge position error and thus An example might be if we wanted to move
causing a large velocity command to the our car exactly 50 feet ahead and stop. We
servo. This typically results in a quite large wouldn’t tromp on the gas pedal to get
overshoot and most likely ringing badly there. We would slightly accelerate, then
around the desired target point depending hold and then decelerate. It’s a very basic
on how aggressive the gains are. example, but relevant.
— Doug Moldenhauer, senior controls engineer,

When using a profile move internally the Optimation, www.optimation.us

servo sees a constantly increasing position


set point throughout the whole position LIMITED PID
move until it reaches the target. We can PID is limited for these problems. On the
think of this as a virtual set point with a pro- servo side, it is well documented that PID
file. When this is utilized, the servo doesn’t cannot handle dynamic loads without
see the huge position error but follows the changing gains. Most servo manufacturers
profile and just having to make minor veloc- provide S-curve to reduce startup and shut-
ity/position corrections to stay on the pro- down disturbance, gain adjustment for sys-
file. This allows the system to have higher tems that have a load buildup or build down
gains for tight position control without (such as a winder/unwinder), and adaptive
causing the excursions that would normally controls based on speed or operating vari-
result from those higher gains. This is like ables. Some use alternate control loop strat-
making thousands of very small moves egies, such as entering time constants and
continuously until the target is reached. inertia instead of proportional and integral
The profile’s acceleration and deceleration values. Or fuzzy logic and neural networks
slopes will be dependent on the mass and are good options for very dynamic loads.
inertia of the system. Just because it’s a
servo doesn’t mean it can snap to a com- On ovens, temperature gets challenging
manded position, as physics just won’t if there is a large thermal mass or signifi-

How to tune PID loops 20


www.controldesign.com

cant multi-zone influence. The ways out of and we have a model of the controller from
this one are using derivative, which I could the manufacturer’s instructions. Then we
never figure out; using cascade control if only need a little math to back-calculate
there are other temperature zones; or using what parameters to use in the controller.
model predictive or neural networks as is
done on glass furnaces or high-end building If the process is self-regulating (like some
HVAC systems. temperature processes), then lambda tun-
ing means the loop will not oscillate and
The problem is that the question is how to the temperature will make a first-order ap-
tune PID, and these answers suggest not to proach to the set point, with a time con-
use PID or to put a layer above it. stant (lambda) that you choose. This aligns
— Mike Triassi, business development manager, perfectly with your goal.
Optimation, www.optimation.us

If the process is integrating (like some other


LAMBDA TUNING temperature processes), then any standard
For the temperature applications, I can PI or PID controller will give a temperature
answer, having done this in 12 pharmaceu- overshoot on set-point steps. Lambda tun-
tical or biotech plants. I believe a similar ing still means the loop will not oscillate,
approach will help with the motion control and you choose a response time (lambda).
applications. The PID tuning is part of a But to prevent the overshoot, you need a
specialty that we call “control performance” little more math to choose an alternate PID
in Emerson. It’s part because you can only algorithm, a set-point filter or a helpful non-
tune the controller after you make every- linearity in the process or controller.
thing else right in the loop—the control
valve or slave flow loop, the process sen- You can read my white paper on lambda tun-
sor/transmitter and the controller configu- ing at www.controldesign.com/lambdatuning.
ration including choice of PID algorithm. — Mark Coughran, senior process control consultant,

Emerson Process Management,

Instead of chasing PID coefficients for days, www.emersonprocess.com

we use a synthesis method called lambda


tuning. Our overall model of the loop has AGGRESSIVE TUNING
a model of the process and a model of the Unfortunately, I do not have 3D (or three-
controller, wired as a feedback system. axis, robotic) servo-motion-control experi-
Synthesis means we know how we want the ence and cannot provide guidance on that
loop to perform; we can measure how the application. However, some of the issues
process responds to the controller output; posed are fairly common among customers.

How to tune PID loops 21


www.controldesign.com

There is no magic bullet for quick response log the data in a .txt or .csv file with the time,
over a wide operating envelop. End users SP (set point: the target or goal value of the
have to consider the critical parameters. Is process), PV (the process variable) and MV
it OK to overshoot a process limit, or does (the manipulated variable: the control output)
that create too much risk? If overshooting is listed in columns. This data can also be dis-
OK, then you can use more aggressive tun- played and graphed using a spreadsheet.
ing; if there is too much safety or cost risk,
then the loop should be de-tuned or have Next, determine if you have a non-integrat-
an over-damped response, characterized ing (velocity or temperature) system or
as a “conservative” response. If a loop is an integrating system (position or level).
tuned aggressively, with an under-damped Some systems have one, two or more poles.
response, then it can easily exhibit the be- Some of these poles are real, but if there
havior described by the reader’s remark, “if are two or more there can be complex
dynamic loads are involved, my PID loops poles that will cause oscillations even when
become unstable and oscillate.” I modi- driven open-loop (with no feedback). Try to
fied a basic tuning presentation I created estimate the open-loop parameters by the
with Nathan Lichti of Apache to provide response to some form of open-loop excita-
simple visual guidance in tuning loops or in tion. Each different type of open-loop sys-
trial-and-error adjustments once standard tem has a set of equations that can be used
methods are used for tuning. I believe this to calculate the closed-loop gains. Acker-
presentation (www.controldesign.com/pid- mann’s formula is a good way to calculate
tuningbasics) will provide a good guide to closed-loop gains for motion systems. The
understanding PID tuning basics. internal model control (IMC) method is
— Gene Chen, DCS/safety systems product manager, good at calculating gains for temperature
North America Yokogawa of America, control, if the plant parameters are known.
www.yokogawa.com/us

Ackermann’s formula is basically a pole-


KNOW YOUR SYSTEM placement algorithm. If all the poles are
You can’t control what you don’t under- placed on the real axis in the z or s domain,
stand unless one uses a lot of trial and error. there will be no overshoot or oscillations.
Therefore, the first thing to do is identify Ackermann’s formula calculates 1 gain for
the system by determining the general sys- every pole in the open-loop system, plus
tem type and estimating the parameters. one more if an integrator gain is used. For
example, a simple motor-control system
In this exercise, the engineer records how the has a gain and a time constant. The time
system responds to stimulus. It is helpful to constant determines the location of the

How to tune PID loops 22


www.controldesign.com

open-loop system’s single pole. However, In short, know your system’s basic transfer
if the motor is going to be used for posi- function. Use graphs or trend plots to esti-
tion control, then the system has another mate the open loop parameters. Use the ap-
pole for integrating the velocity to position. propriate algorithm for calculating the closed
Finally the integrator in the PID adds an- loop gains so the closed loop poles are on or
other pole so a simple closed-loop position close to the real axis, and have realistic ex-
control system has three poles. Therefore, pectations on how fast the response can be.
three gains (P, I and D gains) are required — Peter Nachtwey, president, Delta Computer Systems,

to place the three poles in the s plane. www.deltamotion.com

There are limitations. The controller can STEADY STATE


only output a maximum of ± 100%. Low-res- The nature of the control loop must be un-
olution feedback and sample jitter can se- derstood before tuning. Is it self-regulating or
verely limit the usefulness of the derivative integrating? In a self-regulating process, the
gain. There are also limitations on power. process variable will typically reach a steady
There may not be enough power to acceler- state value for a given controller output, such
ate or decelerate as quickly as desired. This as flow control. In an integrating process, the
is easy to determine by looking at a trend rate of change of the process variable will
plot. If the MV saturates during acceleration typically remain constant for a given control-
or deceleration, the acceleration or decel- ler output—for example, manipulating an
eration ramps must be made longer. Tuning inflow or outflow valve to a tank when the
will not help this. In fact while the control process variable is tank level. The two types
output is saturated (at its maximum value), of processes have different tuning rules.
the system will behave like an open loop
system. As pointed out, using ramps (as op- The tuning goal must also be clear. Is it to
posed to simple on/off controls) makes tun- reach set point as quickly as possible or to
ing easier. Motion control systems should ensure there is no overshoot? Ensure that
always use ramps to keep the control out- the tuning parameters selected align with
put from saturating. Another limiting factor the desired outcome. There is also tuning
is deadtime, which is the time between the software available to assist in identifying
control output changes and when the PV processes and tuning PID controllers.
starts to respond. It is unrealistic to expect
a temperature system to reach an SP within Whether tuning manually or with software,
the longer of five times the dead time or the process should be in a steady state pri-
five times the plant time constant without or to bumping the process. Also, the tuning
oscillating using just a simple PID. procedure should be performed at or near

How to tune PID loops 23


www.controldesign.com

the expected process operating point. If the troller is designed to solve a difficult con-
process operates over a wide range and is trol problem. For instance, the nonlinear
not linear, tuning parameters may need to MFA controller can control various types
be calculated for other operating ranges of extremely nonlinear processes in differ-
and the tuning parameters can be sched- ent industries and applications. Each MFA
uled based on the current operating range. controller is like a specifically developed
— Paul Wentzell, global process technical consultant, medicine to cure one specific ailment. For
Rockwell Automation, www.rockwellautomation.com the user, it is an effective yet easy-to-use
controller. Therefore, large deployment
MODEL-FREE ADAPTIVE CONTROL is more likely. For instance, the Siemens
Since you are providing mission-critical sys- Apogee building automation system has
tems, I suggest that you solve the PID tun- embedded MFA controllers to control
ing problems with a systematic approach. temperature, flow, pressure and humidity,
There are mainly three control methods that with no controller tuning required. Na-
have achieved commercial success on the bors Industries use MFA controllers for its
market: PID, model-based control (MBC) DrillSmart auto-drilling systems.
and model-free adaptive (MFA) control.
1. PID is a “one algorithm fits all” method. PID is used for a large variety of processes
Inevitably, its capability is limited. In other where no detailed process info is required
words, PID is more like a general-purpose (black box). Model-based control is well-
medicine, except there is no way for one suited for controlling a process where
medicine to effectively cure all illnesses. So, detailed knowledge is available (white box).
PID tuning difficulties can be fundamental, MFA is suitable for controlling processes
especially for those loops where PID won’t with qualitative process knowledge but no
work well, no matter how you tune it. detailed process models are available (gray
2. Model-based control is more like a “one box). In addition, the process dynamics can
algorithm fits one system” method. If the have significant variations. Many industrial
process dynamics do not change fre- processes are gray boxes that have fre-
quently and the process model can be quent load, fuel, and dynamic changes.
well-maintained, model-based control can
provide excellent performance. However, For your medical-device and motion-control
since it is so specialized and has a poten- applications, embedded MFA control soft-
tially high installation and maintenance ware may be required, depending on your
cost, large deployment is difficult. control system platform.
3. MFA control takes a “one algorithm solves — Dr. George S. Cheng, CEO, CyboSoft and

one problem” approach. Each MFA con- CyboEnergy, www.cybosoft.com.

How to tune PID loops 24


www.controldesign.com

INERTIA RATIO changed with the digital control algorithm.


When optimizing PID control loops, or even I/O processing needs to occur at well-timed
starting the process of creating a mo- intervals, or else you’ll experience jitter ef-
tion system that requires precise PID loop fects that end up appearing like noise on
control, the most important starting point is your I/O. The timing is also important in
to size the application appropriately, aim- terms of programming difference equa-
ing for a 5:1 inertia ratio. As a result, tuning tions (filters, PID) whose coefficients can be
time can be drastically reduced, particularly calculated off-line and applied with predict-
when using a PC-based control system. Ad- able performance. Reconstruction of sig-
ditionally, choosing a robust drive system nals sampled on an irregular basis has been
and servo motors goes a long way toward researched and studied, but best avoided
simplifying the tuning process. when trying to do simple and more practi-
cal applications like what I think you are
Other helpful features to look for in a con- trying to do.
trol platform, in order to streamline PID
tuning, are integrated analytics and moni- I recently saw a PLC that didn’t bother to
toring tools. In conclusion, users should try to execute programs or process I/O at
seek out system-integrated tools that pro- regular time intervals. It just ran programs
vide more features and functionality in one as fast as it possibly could. Timing changed
place. One must also seriously consider the depending on paths taken in the program
efficiencies and savings that can be gener- and also changed as the program grew or
ated from drive configuration and tuning shrunk. Imagine what the result of integrals
via a central PC-based controller rather and differentials would look like if your time
than via the individual drives. delta is constantly changing. I watched a
— Matt Prellwitz, drives technology application special- colleague maintain the PID parameters as
ist, Beckhoff Automation, www.beckhoff.com the program evolved. A lot of the “tuning”
unfortunately had nothing to do with the
CONTROLLER, PLANT dynamics of the plant or feedback control-
AND PERFORMANCE ler; it was just dealing with fundamental
One topic mentioned was performing feed- processing issues.
back control with a PLC. Be forewarned
that there are a number of PLCs out there I’m not saying all PLCs behave like this.
that have not been designed with real-time Some do a good job with real-time pro-
control/processing in mind. Some thought cessing. I only bring this up because this
needs to be applied to how inputs and alone could be a big contributor to some
outputs are sampled and released and ex- of your struggles. Read up on these topics

How to tune PID loops 25


www.controldesign.com

and arm yourself with tough questions for order (power applied to a heating element
your PLC supplier. causes thermal energy to increase at some
rate) and an electric servo is a good ex-
There were some examples provided for ample of second order (current, or torque
different types of systems to which control- input to the motor accelerates the axis
lers can be applied, which in control theory position). This is good to know because
is commonly referred to as a “plant.” A it can be mathematically shown that PID
plant is a generic term for a dynamic sys- rarely makes sense for a first order system
tem whose states (or process variables) you (PI is much more applicable; leave the D
want to control. It has causal relationships set to zero). In the second order case, PID
between the inputs you drive and its resul- is essential for stability purposes.
tant states that can be directly or indirectly
measured and hopefully controlled. It can The next property is linearity. It’s not
be a heating or cooling element applied to always the case that 10% control input re-
air. It could be an electric servo motor driv- sults in 10% rate of change of plant output
ing a robot or gantry axis. It could be an hy- and that 90% input equates to exactly 90%
draulic valve that’s driving position, speed output rate of change. If this isn’t the case,
or force output of an hydraulic cylinder. It’s it’s sometimes useful to understand this
my opinion that not enough time and at- and compensate your PID with gain sched-
tention is spent understanding a plant. Too ules, or just scale the output of the PID
often, I’ve seen a PID controller arbitrarily with lookup tables, so your PID output has
applied to a plant, followed by lengthy as much of a linear relationship with plant
trial-and-error tuning sessions. A little bit of output as possible. This will make your
attention to the plant model can make this controller respond much more consistently
process simpler and less time-consuming. with respect to different inputs.
I’ll go through a few of the more important
properties I think someone should under- Another property is dynamic response. If
stand about a plant. you apply 10% control input, and it takes a
few seconds for the plant to start to change
First property is order. For a first order its outputs, then you are dealing with a
system, the control input influences the plant that has low open-loop bandwidth
first derivative, or rate of change or the with no potential for fast (but still stable)
plant output. In a second order system, closed-loop response. A good rule of thumb
the control input influences the second is a plant needs to respond four to five
derivative of the plant output. A tempera- times faster than the desired response of
ture controller is a good example of first the closed-loop system. If the plant can’t

How to tune PID loops 26


www.controldesign.com

meet these criteria, then you will have a lot For stability, this needs to be proven by
of trouble achieving your control goals. thorough testing. Step response testing is a
very common method for testing and is no
The last pointer I have on this is paying doubt useful. I like testing with dynamic in-
attention to units. If you can scale control puts. Drive your PID input with a sine wave
inputs so they are using the same units as and vary the frequency once. If you see the
the plant outputs, then you’ll find PID tuning output moving at a much larger amplitude
to be fairly consistent from one application than the input, you’ve found a resonance
to another. Let’s say the process variable is and potential area of instability. Another
in x units. If I scale the control input to be thing to watch for is when the output is
in units of x units/second, then I know right moving at full amplitude of the input, but is
away that a Kp of 2*PI radians (1Hz) will get lagging by a half wavelength or more; then
me very close to a 1-second response. your controller tuning lacks margin and
could potentially go unstable.
There was mention of tracking performance,
stability and robustness to changing loads. In terms of robustness to part variation or
These are all important properties of a good load changes, this again can only be proven
controller and very much in line with differ- through testing. Pick extreme operating
ent measures we use to specify and validate points to test your controller. If the control-
controllers. I’ll mention right away that trying ler is too sluggish at one operating point
to score high marks on all of these topics is and marginally stable at the other extreme,
not easy to do with just a PID controller. this is a clear indicator that you will need
more than a PID to control the system to
In terms of tracking, I’d suggest reading desired specifications.
a little bit about feed-forward control. If
you have some a priori knowledge of how One last comment on PID coefficients: They
to drive control inputs to achieve desired work together to define the poles of your
outputs, put that knowledge in your control system defined by your closed-loop transfer
algorithm and let the PID do the rest of the function. The location of these poles tells a
control for you. If you know x amount of lot about how responsive, stable or unstable
current applied to a heater will eventually a system can behave. If you tune a Kp that
get you to a steady state fluid temperature, gets you close to the responsiveness you
then just add that current to the output of need, but then start tuning a Ki to improve
the PID. The PID has less work to do and steady state error and then find the system
can now focus on compensating for distur- starts to resonate a little bit, it might be
bance inputs or load changes. worth your while to increase Kp rather than

How to tune PID loops 27


www.controldesign.com

back off on Ki. When you change one coef- That being said, what can we do when an
ficient, it’s likely you will need to scale the auto-tune feature is not good enough or not
others, as well. available?
— Jason Kraft, engineering specialist, controls,

Eaton, www.eaton.com Once the auto-tune feature is complete,


methodically write down the values of the
DEDICATED TO CONTROL PID and feed-forward parameters, plus any
First, if the controller has an auto-configure auto-filtering parameters/values established
and/or -tune feature, by all means use it. To- by the auto-tuner.
day’s tuning technology is greatly enhanced
over just a few years ago and the auto-tune From this point it’s important to remember
feature can automatically adapt to, say, a what these specific parameters do.
given motor-drive mechanism, without a de-
crease in performance in many applications; Proportional (P) gain is the amount of con-
and, in other applications, it can get you to trol variable (CV) response action propor-
a working baseline much more quickly than tionally presented against the error signal
starting from scratch. There are many differ- determined by the difference of the mea-
ent versions of PID control and PID topolo- sured process variable (PV) and the com-
gies found in temperature controllers that mand/set point (SP). For unity gain, the PV
are not normally the same as used for mo- range is set directly proportional to the CV
tion control. For the purposes of this answer, range (Figure 6).
motion control examples are utilized.
Integral (I) gain is the amount of control
It has been my experience that control variable (CV) response action presented
loops needing fast dynamic response, such against the accumulated error over time
as motion control, require their own dedi- (error/ _time); thus presenting a propor-
cated controller, whether a PLC is utilized tional CV output signal as a function of its
or not; and, even with this, there are times gain setting depending on the amount of
that signal/feedback latency can have sig- error and length of time the error is pres-
nificant detrimental effects, depending on ent. Integral gain presents phase lag into
the components selected and/or how they the system, which is important to remember
were chosen to work together. Additionally when instability is an issue.
if you can only view the outside loop (po-
sition-loop) response, you are basically in Derivative (D) gain is the amount of control
the dark as to what is happening within the variable (CV) response action presented
internal control loops (current and velocity). against the rate of change of the error

How to tune PID loops 28


www.controldesign.com

PROCESS VARIABLE (PV) RESPONSE WITH DIFFERENT PROPORTIONAL GAINS

Underdamped

Critically damped

Overdamped

Step Command

TIME

HOW MUCH DAMPING?


Figure 6: Proportional (P) gain is the amount of control variable (CV) response action proportion-
ally presented against the error signal determined by the difference of the measured process vari-
able (PV) and the command/set point (SP).
(Source: Kollmorgen)

( _error/ _time); thus presenting a pro- amplifier or summing circuit/algorithm, and


portional CV output signal as a function of goes directly into the pre-amp stage driving
its gain setting depending on how fast the the power devices, presenting a phase lead
error is changing. into the system. The feed forward signal
presents power to the motor to counter the
Feed forward gain is a non-error-based sig- damping effect of the acceleration of mass
nal that jumps ahead with a predefined sig- and thus provides a pre-determined phase
nal, based on a measured disturbance and/ lead control response.
or command change. When utilized with
a closed-loop system, the signal typically Signal filtering, whether utilized in the
jumps over several hardware/algorithm forward control path or feedback signal,
control blocks, such as PID blocks, filters, is generally used to smooth out the over-

How to tune PID loops 29


www.controldesign.com

all system response by reducing electrical If your auto-tuner has established filter
feedback noise, audible noise, high-frequen- settings within the control loops, let them
cy noise and system resonances/harmonics. be; establishing filter types and frequen-
cies by manual examination is beyond the
Even with a good understanding of how scope of the writ; and generally a good
these control blocks work, for any spe- auto-tuner will be able to determine the
cific controller it can become daunting to needed filter settings.
explain what adjustment needs to be made
for a specific topology’s desired response, If slight methodic gain tweaking does not
as compared to some measured step re- get you within acceptable parameters,
sponse, due to the different interactions one way to proceed is to basically start
and interdependencies of the responding from scratch except for the auto-tuner
PID algorithms with a fixed or varying load. filter settings; let them be, at least for the
P, I and D algorithms can be designed in first attempts.
series, in parallel or in some combination
of series and parallel, with each control-de- A fresh start: For servo-motor systems we
sign technique presenting a different style often talk in terms of three different control
CV response against a fixed or varying loops: I-loop (current loop), vel-loop (veloc-
load, disturbance or command. Your tuning ity loop) and position loop.
method can also vary as a function of the
specifications of the process/work being The I-loop is the innermost loop and fastest
accomplished, all presenting multiple ways of the three. The I-loop is active when the
and priorities to optimally tune a servo controller is in a current/torque mode, ve-
controlled load. locity mode or position mode. The current
gain setting is normally pre-calculated from
With the basic definitions in mind with such parameters as motor inductance and
your specific process, it may be reason- resistance. It will likely also have integrators
able to tweak some of your gains up and to help to compensate for PWM dead time
down slightly to get a feel for how the among other things. In most cases you will
system response changes. If applicable, it not need to adjust these settings, and, if one
is best to examine the vel-loop step input does, it typically should be done in conjunc-
response first and separate, from the posi- tion with the manufacturer’s post applica-
tion loop, if there is a position loop. Me- tions department / instructions. For exam-
thodically write down the values, record ple, when a servo-motor controller’s I-loop
what happens and accordingly make slight is set too high, it will often display itself with
changes in the gain settings. a load noise coming from the motor that a

How to tune PID loops 30


www.controldesign.com

change in vel-loop gain cannot reconcile; tional gain until you have approximately 10-
and this instability may only manifest itself 15% (no more than 15%) with an undershoot
at specific currents and/or speeds. For this of approximately 3-5% (no more than 5%).
type issue, the I-loop gain setting can typi-
cally be reduced 10-15% without affecting The step response may identify oscillations,
the system performance. resonance and/or harmonics that will need
filtering or source identification to achieve
The vel-loop is the second fastest of the desired response goal. This is beyond the
three and for many the most troubling to scope of this brief write-up.
compensate or fine-tune. Even if the system
is going to be run in position-loop mode, the Repeatedly provide a velocity step input
vel-loop needs to be properly compensated command to determine the velocity (CV)
first for the system to act at optimum levels. response, and increase the vel-loop’s inte-
gral gain until any steady-state error has
The vel-loop is active when the controller is been reduced to zero.
in a velocity mode and position mode.
The Integral function presents phase lag to
In order to compensate/tune the vel-loop, your system, which increases risk of insta-
provide a step input to determine its step bility; you do not want any more vel-loop
response; then from the CV velocity re- integral gain than it takes to reduce the
sponse, adjust and fine tune the vel-loop’s steady-state error within acceptable levels.
proportional, integral and derivative gains.
Too much velocity overshoot and audible When the position-loop is to be closed,
noise—objectionable oscillations creating many engineers prefer to zero or minimize
humming, buzzing—are signs that a gain vel-loop integral gain and allow the position-
limit has been reached; back it off slightly. loop integral gain to dominate, creating a
stiffer system. My recommendation is to find
With the controller in its velocity mode, set the preferred setting for the vel-loop integral
all vel-loop gains—proportional, integral and gain, even if the controller is to be used in
derivative—to zero. Utilize filters as set by position mode, for possible reference.
the auto-tuner; if there is no auto-tuner set
filters to zero. Repeatedly provide a velocity step input
command to determine the velocity (CV)
Repeatedly provide a velocity step input response, and increase the vel-loop’s de-
command to determine the velocity (CV) rivative gain until the desired high speed PV
response, and increase the vel-loop’s propor- response is achieved.

How to tune PID loops 31


www.controldesign.com

If the response looks good, do not add in any


derivative gain; if the response appears to be Make step command

not fast enough, add as little derivative gain as


possible to achieve your fast-response goal. Does the motion NO
Turn up Kd
oscillate or make noise?

YES
Though velocity feed forward is not a func-
tion of the closed-loop system, it is based Turn down Kd by 2/3

on the measured amplitude of change


(disturbance and/or command) to present Make step command

a pre-defined (open-loop-type) response,


Is the overshoot more
NO
similar to a derivative function; thus if your than half of your Turn up Kp
overshoot spec?
system has velocity feed forward capabil-
ity, it may be important to consider its gain YES
setting as a function of the load type. Even Make step command
if only for experimentation, it may be desir-
able to reduce your velocity feed forward NO
Is the overshoot more
Turn up Ki
than your spec?
gain to possibly one-third or less of its
perceived ideal gain setting—direct drive, YES
fixed load—when there is compliance and/ Set the Integral Limits
or backlash within the system. Remember
that a positive phase shift is presented by
Done
the velocity feed forward gain; typically you
don’t want to add any more positive feed
forward than it takes to offset phase lag TUNING METHOD
Figure 7: Kd = Derivative Gain;
from the integrator, and filters if required, Kp = Proportional Gain, Ki = Integral Gain.
(Source: Kollmorgen)
over the speed range of the axis.

It is most desirable to have your feed for- gain are changed/updated, the proportional
ward parameter and derivative gain set and integral gains need to be retuned for
before tuning proportional and integral their optimum performance (Figure 7).
gains based on a step response. However,
unless the user has significant experience When using this tuning method, be sure
with a particular controller and subject PV that the command output is not clipping
load, it is unlikely the values will be set close the step command. If the command output
enough on the first try. When either the does clip the step command, you have a
feed forward parameter and/or derivative nonlinear system. If the system is nonlinear,

How to tune PID loops 32


www.controldesign.com

the generalizations made on this page may VALIDATION


not apply. If you are determined to tune Tuning a PID control can be quite challeng-
despite the nonlinearities, make sure that ing, especially when you take into account
there is a repeatable way to generate the load changes and nonlinearities of your
nonlinearities, as well as the ability to try system. Basically, the optimal tuning of
many different scenarios. a PID control requires not only a deeper
knowledge of the system in question, but
The position-loop when utilized is the slowest also a more in-depth knowledge of existent
of the three. The position-loop is only active techniques for PID tuning. However, there
when the controller is in its position Mode. are some heuristics that you can use to bet-
The position-loop’s capability is a function of ter define PID tuning.
the vel-loop compensation. A bad vel-loop =
a non-optimized position-loop. Know your system: The first thing you have
to do before controlling a system is know
In order to tune the position-loop, present how it should behave. This can start by veri-
repeating positon commands under a defined fying the existent literature that can provide
move and adjust for position-loop propor- you with mathematical models of your sys-
tional gain for the desired response—quick re- tem. This process can be very time-consum-
sponse with some overshoot before settling, ing, but it will give you the insight of differ-
no-overshoot (overdamped), minimum set- ent nonlinearities that could influence the
tling time—based on the axis’ criteria/specifi- response, especially when trying to achieve
cations. If the axis’ criteria demands minimal optimal control. You don’t need to model
position error (PE) while holding position or every single detail. For control process, we
during a specific motion profile segment, one are really interested around the frequency
may wish to try introducing integral gain to that could invert the feedback loop signal
the position-loop. This will often mean the re- (also known as phase margin crossover fre-
moval or significant reduction of the vel-loop quency), and there is where you really have
integral gain. Position-loop derivative gain is to be accurate. So, simple approximations
not typically utilized. for first-order model with delay could be
enough to model your system. Sometimes,
After tuning, if your PE looks like noise, you your model is a series of rules or an input-
know you have a good compensation for output mapping that was obtained empiri-
most applications; but this is not always cally, but you know how it behaves.
possible for many reasons.
— Hurley Gill, senior systems and applications engineer, Validate the model of your system: After
Kollmorgen, www.kollmorgen.com you have an understanding of how your

How to tune PID loops 33


www.controldesign.com

system works and hopefully you have then another option is to use the Chien-
qualified parameters, you must have the Hrones-Reswick technique, which allows
properties quantified. Then you must do you to optimize for servo operations.
experiments in real life to be sure that you
know the parameters’ variation. Also, you Validate the closed-loop control system for
can design experiments to quantify missing all ranges: This is the most important task
parameters to better calibrate your model. of the process. This encompasses validating
The important aspect of it is that you know that the parameters obtained by an auto-
how the system behaves and it is based on tuning feature or by design will work on all
reality. Also, it is important to test in differ- conditions of operation of your system. This
ent operating points since a furnace could also requires that you have a supervisory
have different behavior from near ambient system that will verify if any special danger-
temperature than in high temperature. ous condition could be reached and have a
sequence to shut down the system. A good
Apply some tuning technique for PID: controls developer will define this operation
After you define your system, you should first, before you start to tune a controller. It
try to tune your PID. You have a dynamic might even need to be done manually. Then
model of your system. This consists of you can see if your system would work in
using simulation tools integrated with all conditions that were defined. Notice that
optimization to obtain the best PID pa- this validation can also be developed in a
rameters based on certain criteria. If your hardware-in-the-loop scenario, where your
model really reflects reality, the output of high-fidelity model can perform the extreme
this operation could give a very good ap- conditions while an experiment can validate
proximation of the optimum parameters, if your controller is running correctly for
and, since it is off-line, it can be pretty some operating points.
fast. However, this requires a high-fidelity
model, which can very costly, too. Another Now, this is an iterative process where you
option is to use empirical techniques that need to revisit previous steps until you con-
were developed for some specific situa- verge into a proper result. Some vendors
tions. The most famous is Ziegler-Nichols have solved that problem for you for spe-
method, which is used as a benchmark for cific applications like process control using
any other type of techniques. However, PLC applications or motor or motion control
this was heavily tailored to process con- for motor drivers.
trol applications where the s-shaped re- — Alex Barp, senior software engineer, LabView R&D—

sponse was predominant. However, if you dynamic control and simulation, National Instruments,

are interested in servo control for motion, www.ni.com

How to tune PID loops 34

Potrebbero piacerti anche