Uploaded by Mehmet ERYILMAZ

PIDTuningMethods-AutomationStudywithMathCad-a

advertisement
PID Tuning Methods
An Automatic PID Tuning Study with MathCad
Neil Kuyvenhoven
Calvin College
ENGR. 315
December 19, 2002
Abstract
There are several methods for tuning a PID
controller. This paper takes a qualitative look
at three common methods, with comparisons
of accuracy and effectiveness. These three
methods include a guided Trial and Error
method, the Ziegler-Nichols method, and the
Cohen-Coon method. For an exceptionally
responsive system the Trial and Error method
is often used after the Ziegler-Nichols or
Cohen-Coon so as to enhance the rough
results of these two methods. Using these
methods in cooperation will result in a finely
tuned control system. A study is completed
using MathCad to implement automating PID
tuning. Due to the nature of MathCad, the
process is not fully automated due to some
limitations of MathCad, rather the process
solves the solution for manually inputting
PID coefficients, much like a MatLab process.
Introduction
Models will never emulate their actual
physical counterpart perfectly because the
mathematical formulae applied is completely
predictable; whereas, the physical system
being modeled will change over time and due
to unaccounted for disturbances. Control
systems, specifically PID control systems
attempt to reduce the error due to unknown
disturbances by designing for typical
disturbances that ideally will include any
unsuspected disturbances in the physical
system being modeled.
PID systems are very unique to each
application. As one set of settings may be
ideal for one system these same settings can
throw another system horribly off. For this
reason, multiple methods for tuning the PID
coefficients have been made. As some
methods are better than others for given
applications, each method has its advantages
and disadvantages. This paper will outline and
compare the three methods known as Trial
and Error, Ziegler-Nichols, and Cohen-Coon.
PID Basics
Before explaining the methods for tuning PID
control systems, the effects of changing the
different components must be examined. For
the analysis, the system in figure one will be
used, here the plant is shown to be G(S). PID
controllers consist of three components; the
proportional, integral, and derivative controls.
Figure 1 – System with a PID controller
Each of these components has very distinct
effects on the system. Table one outlines the
effects of the PID components on a particular
system. Though there is no set standard for
the way a PID controller is set up, there is
however three main types. These include the
ideal, parallel and series controllers. These
types can be seen in figure 1.5 along with
there corresponding frequency domain
equations as equations one, two and three.
controller will result in drastically different
effects on the the different types of
controllers. This difference is most significant
on the derivative control in the series and
parallel controllers. With the series
controller, the derivative control is operating
on the partially fixed error as it has already
gone through the proportional and integral
control. The is juxtaposed by the parallel
controller where the parameters are order
independent. The effect of the derivative
control is not amplified by proportional
control which results in a less fine tuned
system. The series system begins by
amplifying the error which promotes a faster
response from the integral and derivative
control. The ideal system creates a sensitive
response in the proportional control as small
changes have big effects on the integral and
derivative portions separately. This is
different from the series model due to the lack
of direct interaction between the integral and
series control.
This paper uses the parallel PID control model
for analysis.
Figure 2 – Ideal, series, and parallel PID
configurations
Eq. 1
Eq. 2
To increase the rise time of the system, the
proportional,
integral,
and
derivative
components are tweaked so as to improve the
rise time, steady state error, and overshoot
respectively. Despite the fact that changing
one component effects all the characteristics
as seen in table one, the system can still be
brought to stability with the three
components together; although sometimes
fewer than all three are needed.
Table 1 – Effects of PID
Eq. 3
The difference between these types of PID
controllers is only seen when attempting to
tune them. The outcome can be made similar
with different values, but as is realized from
the equations, one set of parameters for the
Rise Time Steady State
Proportional Decrease Decrease
Integral Decrease Eliminate
Derivative None
None
Overshoot
Increase
Increase
Decrease
Method 1: Trial and Error
Method 2: Ziegler-Nichols
The Trail and Error method requires a closed
loop system, it steps through the system from
proportional to integral to derivative. This
method is a divide and conquer approach, first
it puts the system into a rough solution from
which small tweaks are performed to perfect
the response. To begin, each coefficient of the
PID controller is set to zero. The proportional
component is now considered by increasing
its value until a steady oscillation is obtained
as in figure two. Scaling the current
proportional value down by a factor of two
will give the resulting proportional value.
Applying this proportional value will dismiss
the steady oscillations. Next the integral
coefficient is increased until steady
oscillations are again obtained. The present
value of the integral coefficient is scaled up by
a factor of three and applied to the integral as
the final value. This once again sets
oscillations off, which brings up the
derivative control, this value is increased until
for a final time the oscillations are at a
constant period and amplitude. The
coefficient of the derivative is then scaled
down by a factor of three and applied as the
final value for the derivative control. The
resulting output may still have some noise
associated with it, this must now be tuned by
hand with small educated tweak of the
different coefficients.
The Ziegler Nichols method takes two
approaches depending on the system at hand.
First, with the closed method or begins in
much the same way as the Trial and Error
method as a steady oscillation is desired with
only a proportional influence present. The
proportional value at which the oscillations
become constant is coined the term 'ultimate
gain'. The period of oscillations at the
ultimate gain is termed 'ultimate period'. The
ultimate gain can be found in an simpler way
with the root locus of the open loop transfer
function. The ultimate gain and ultimate
period as noted in figure 2, are applied to the
Ziegler-Nichols formulae as noted in table 2.
This method works provided the closed loop
transfer function is known and there is an
ultimate gain, the point where the root locus
value has zero for the real portion.
Table 2 – Tuning parameters for Ziegler
Nichols closed loop ultimate gain method
KP
KI
KD
P 0.5*Ku
PI 0.45*Ku 1.2/Tu
PID 0.6*Ku
2/Tu Tu/8
The second Ziegler-Nichols method applies to
the open loop transfer function. It is simpler
to calculate because the guess work is taken
out as opposed to the closed loop method
where the accuracy of 'steady oscillations'
becomes an estimation at best. The tuning
parameters for the Ziegler-Nichols open loop
method is shown in table three.
Table 3 – Tuning parameters for ZieglerNichols open loop ultimate gain method
Figure 2 – Steady oscillation illustrating
the ultimate period
KP
P 1/(RL)
PI 0.9/(RL)
PID 1.2/(RL)
TI
TD
3L
2L 0.5L
as seen in figure three and applied to the
Ziegler-Nichols open loop formulae as found
in table three. The outcome of the two
Ziegler-Nichols method is a system with a
fairly clean response, work still must be done
tweaking the system as the Ziegler-Nichols
method will only give rough estimates.
Cohen-Coon
The Cohen-Coon method is a more complex
version of the Ziegler-Nichols method. Using
the same process to come up with the input
values from figure three. The difference
comes with the fact that the rise time is
required. This method is more sensitive than
the Ziegler-Nichols as it is limited to one type
of open loop response. Table four displays the
formulae for the Cohen-Coon method. By the
formulae given in table four, it is obvious that
this system is designed with different
objectives than Ziegler-Nichols
Table 4 – Tuning parameters for
Cohen-Coon method
Figure 3 – Two possible outputs for the
Ziegler-Nichols open loop analsys.
To apply the Ziegler-Nichol open loop
method, the output is monitored as a sharp
step is applied to the input. The response is
monitored for a response similar to that of
figure three, which gives two of the three
possible responses for an open loop system.
The third being an oscillatory system; which
requires the closed approach method rather
than the open loop approach of the ZieglerNichols methods. For this reason it is not
included in the figure. The second diagram in
figure two illustrates a stable system which as
the name suggests, settles to a given steady
state. The last plot in the figure is an unstable
system which approaches infinity due to a
step applied to the input.
With the response captured, values are found
Method Comparison
The methods described thus far are by no
means the only way to tune a PID controller,
though, the specific methods described above
are well known and accepted for their
simplicity and ease of use even though they
will not work with every system. Every
method has its advantages and disadvantages;.
depending on the system at hand, one method
may be preferable over another but by no
means is it the only option.
The Trial and Error method is very common
not only in educational settings due to the
intuition and clarity it provides with what the
PID components are doing. Often after using
a method such as the Ziegler-Nichols or
Cohen-Coon some manual tweaking is
favourable to get the system tuned specifically
for the system at hand, whether it be more
robust to handle large disturbances or keenly
sensitive to respond instantaneously to small
annoyances introduced to the system.
The Ziegler-Nichols and Cohen-Coon method
are systems keyed towards speed rather than
robustness as they are both design with a 25%
damping factor meaning the oscillations will
decrease by a factor of four every period. The
settling time from these systems can vary
depending on the initial overshoot. The
Ziegler-Nichols method is designed around
the point of critical damping, where the root
locus gives a purely imaginary pole. This
system works best with 2nd order systems,
beyond this the oscillations could give more
than on solution for the ultimate gain.
Methods such as Integral of Time Weighted
Absolute Error (ITAE) or Internal Model
Control (IMC). Can be found to do a more
precise job. The standard for PID has not been
set, as the western world welcomes fuzzy
logic more and more systems are leaning this
way.
MathCad Study
The methods thus far have only provided
solutions that are classified as satisfactory
depending on the system. The intent of the
MathCad study was initially to develop a
program that would automatically find a set
of results that meet the overshoot, rise time,
settling time, and steady state error criteria
which is set by the user. The user would input
the plant function and the set point
disturbance in the frequency domain and
have MathCad find a best fit solution with
these inputs. The theory behind the
application is simple, calculate the transfer
function of the system with the input plant
and disturbance and plot the output from the
time domain. Using the time domain
function, the overshoot, rise time settling
time, and steady state error are calculated.
These values are compared against the users
inputs depending on the outcome, the
program will increment one of the PID
coefficients and recalculate the worksheet.
This iterative process would ideally give the
values of the PID components to satisfy the
criteria outlined by the user if the solution
exists.
The objectives of the MathCad program have
been altered due to the capabilities of
MathCad. Using the programming tools with
functions such as H(s) gives multiple errors as
these functions cannot be assigned as is
required with the programming tools. The
result is a worksheet acts much in the same
way as MatLab Simulink. After inputing the
plant function, the user is required to alter the
controller parameters manually as the
worksheet updates the new values on the fly.
This worksheet along with a root locus or
Nyquist plot will allow the user to easily tune
a PID control system with the methods
described in this paper.
MathCad Code
The MathCad code for the worksheet is
shown below, the end result makes only the
plant and the input visible along with the
output plot with the characteristics.
Parallel PID Control
Factored numerator
without any scalar
z
User Input
i
i
1
H( s) :=
2
Input disturbance
Num( s , Kp , Ki , Kd )
scaleNumF( s) :=
partialNumFr( s)
1
s
Factored numerator
Begin Calculations
NumF( s) := scaleNumF( s) ⋅ partialNumF( s)
PID Controller
2
G( s , Kp , Ki , Kd ) :=
Kp⋅ s + Kd ⋅ s + Ki
1 + G( s , Kp , Ki , Kd ) ⋅ H( s )
Num( s , Kp , Ki , Kd ) := numer( T( s , Kp , Ki , Kd ) )
Denominator of Closed loop
Den( s , Kp , Ki , Kd ) := denom( T( s , Kp , Ki , Kd ) )
Zeros of closed loop
Z := solve( Num( s , Kp , Ki , Kd ) , s )
Poles of closed loop
P := ( solve( Den( s , Kp , Ki , Kd ) , s) )
Size of Pole and Zero matricies
z := rows( Z) − 1
p
partialDen F( s) :=
(s − P )
∏
=
i
i
F( s) G( s , Kp , Ki , Kd ) ⋅ H( s)
Numerator of Closed loop
p := rows( P) − 1
Factored denominator
without any scalar
s
Closed Loop Transfer function
T( s , Kp , Ki , Kd ) :=
0
Numerator's scalar
s + 10⋅ s + 20
F( s ) :=
(s − Z )
∏
=
partialNumF( s) :=
Plant
0
Denominator's scalar
scaleDenF( s ) :=
Den( s , Kp , Ki , Kd )
partialDen F( s)
Factored denominator
(
DenF( s) := scaleDenF( s) ⋅ partialDen F( s)
)
Factored Transfer function
TFactor( s) :=
NumF( s)
DenF( s)
Time domain transfer funciton
(
)
h( t) := invlaplace TFactor( s) , s , t
float , 4
complex
SETTLING TIME
@ 90%
SS := 1
Given
Given
x ( q) − SS < SS⋅ .02
x ( q) = SS⋅ .9
x ( q) − SS > −SS⋅ .02
x ( q) > 0
T90% := Find( q)
Ts := Find( q)
Tr := T90% − T10%
RISE TIME
Time for response to go from
10% of steady state to 90% of
steady state
PERCENT OVERSHOOT
X ( t) :=
d
dt
x ( t)
Given
@ 10%
X ( q) = 0
q>0
Given
x ( q) = SS⋅ .1
Tovershoot := Find( q)
x ( q) > 0
T10% := Find( q)
PO :=
.
(
)
x Tovershoot − SS
SS
References
•
Control Tutorials for Matlab. University of
Michigan, 1996.
<http://www.krellinst.org/UCES/archive/cl
asses/control/PID/PID.html>
•
Dorf, Richard, Bishop, Robert. Modern
Control Systems, Prentice Hall, 2000.
•
Examining the Fundamentals of PID
Control,
<http://www.geocities.com/chemforum/pi
dcontrol.htm>
•
Example Problem of PID,
<www.phys.ntnu.no/brukdef/undervisning/si
f4037/Lecturenotes/Example%20Problem%2
0of%20PID.doc>
•
Hubertus, Dr. Comparison of PID Control
Algorithms (all Controllers are not
Created Equal),Expertune Inc. 1999.
<http://www.expertune.com/artCE87.h
tml>
•
Lee, Jay. PID Controller Tunning, Part II –
Reaction Curve Method, Georgia Inst.
Technology. 2001.
<http://dot.che.gatech.edu/Information/res
earch/issicl/che4400/files/lecturenote/lectu
re6b_2.pdf>
•
Lelic, Muhiden, PID Controllers in the
Nineties, Corning Inc. 1999.
<http://www.ece.rutgers.edu/~gajic/IEEET
alk.pdf>
•
Park, S. PID Controller Tuning to Obtain
Desired Closed-Loop Responses for Single
Input, Single Output Systems, Advanced
Institute of Science and Technology.
<http://www.cwru.edu/cse/eche/people/fac
ulty/brosilow/papers/pidcontrol.pdf>
•
Smith, L. C. Fundamentals of Control
Theory, Chemical Engineering,1979.
Download