You are on page 1of 6

PID CONTROL DESIGN WITH GUARANTEED STABILITY

F. Morilla+, F. Vázquez*, R. Hernández+

+
Dpto de Informática y Automática, UNED, C/. Juan del Rosal 16, 28040 Madrid,
Spain. Phone:34-91-3987156. E-mails: fmorilla@dia.uned.es, roberto@dia.uned.es
* Dept. de Informática y Análisis Numérico, Universidad de Córdoba, Campus de
Rabanales, 14071 Córdoba, Spain. Phone: 34-957-218729. E-mail: fvazquez@uco.es

Abstract: This paper presents a Matlab GUI to design PID controllers with guaranteed
stability. The GUI shows the stability region in the respective parameter plane KP-KI or
KP-KD and the boundary curves for frequency response requirements (phase margin,
gain margin, maximum sensitivity and maximum complementary sensitivity).
Combining several requirements the tool splits the stability region into zones and the
user can explore them in order to tune the controller satisfying those requirements. The
GUI can be also used in lectures about stability, robust PID control, PID design in the
frequency domain, PID Loop Shaping, and it can be very useful for students to get
insight into tuning PID controllers. Copyright © 2006 IFAC.

Keywords: computer aided design, PID control, robust control.

1. INTRODUCTION
Imag
In the last years some special design methods for PID Mt circle
controllers based on loop shaping have been
proposed. They can be used for any arbitrary order Unit circle
irrational or non-minimun phase transfer functions
with dead-time (Åström and Hägglund, 2005; Čech Ms circle 1
and Schlegel, 2005; Dormido and Morilla, 2004; M2 Am
- 2t
Morilla and Dormido, 2000). These methods use Mt -1
-1
robustness conditions, expressed in terms of ωcg
θ 1 Real
maximum sensitivity Ms and maximum Ms ωs
complementary sensitivity Mt, or stability margins Mt
expressed in terms of phase margin φm and gain ωt
M 2t - 1 φm
margin Am. These requirements involve that the ωcp
Nyquist curve of the loop transfer function should
avoid the respective Ms or Mt circle, it should
intersect the third or fourth quadrant of the unit circle
or it should intersect the negative real axis far away L(jω)
from the critical point -1, as Figure 1 shows.
Fig. 1. Example of Nyquist plot of the loop transfer
function L(s) and its features.
These requirements give a set of admissible values of The stability region of this family is a subset of R3
the controller parameters, describing the boundaries because there are three parameters. When A(s) and
of robustness region in the parameter plane KP-KI or B(s) are polynomials the characteristic equation (3) is
KP-KD of the PID controller (Shafiei and Shenton, a family of polynomials called polytope of
1997; Schlegel and Mertl, 2004). Most of these polynomials (Barmish, 1988) and, as it is well
methods consider only positive control gains and known, it can be formed by several disjoint sets.
cannot guarantee the stability of the closed loop
In order to obtain stability regions for polytopes
system. Neither they cannot assure that the frequency
some results can be found. The most relevant and
response have the requirements specified.
useful was shown by Ackermann (Ackermann,
The main aim of this paper is to show how the PID 1980). This result allows obtain the stability region in
controller can be designed based on frequency terms of the parametric space, so that necessary and
response requirements assuring stability of the closed sufficient conditions can be established and the
loop system. In Section 2, the stability regions for stability region can be calculated in the plane with a
five types of PID controllers are presented. The low computational cost. With three parameters, a
boundary curves for frequency response requirements sweeping along one of them is necessary, growing
are given in Section 3. The PID graphic user the computational cost.
interface that put in practice these methodologies is
However, there are many other applications. So, it
described in Section 4. Conclusions are presented in
can be used to calculate the maximum stability box
Section 5.
or the stability region for predictive controllers with
two parameters (Mañoso, 1996).
2. STABILITY REGIONS In order to design PID controllers with guaranteed
stability this paper considers the five R2 (plane)
As it is well known, stability is a primary
particular cases, shown in Table 1 joint with their
requirement on a feedback system. Therefore,
characteristic equation:
dealing with PID control it is important to know the
set of controller parameters (it will be called the PI, when KD = 0.
stability region) so that given a point of this region
PD, when KI = 0.
the closed loop system is stable. Moreover, it turns
out that much insight into PID control can be PIDα, when the ratio between the derivative and
obtained by analyzing the stability regions (Åström integral time constants α=TD/ TI is fixed, Note
and Hägglund, 2000). K 2P
that this is equivalent to fix K D = α
Consider the feedback control system shown in KI
Figure 2, in which the process to be controlled is
described by the transfer function PIDKD, when KD is fixed.
B(s) PIDKI, when KI is fixed.
P(s) = (1)
A(s)
Table 1: Stability regions on the parameter plane
Let the controller C(s) of the PID type:
KI Control Plane Characteristic equation
C(s) = K P + + KD s (2) PI KP-KI fPI(s; KP, KI) = s A(s) + s KP B(s)
s + KI B(s) = 0
where KP, KI, KD, are the proportional, integral and PD KP-KD fPD(s; KP, KD) = A(s) + s KD B(s)
derivative gains of the controller, respectively. The + KP B(s) = 0
characteristic equation of the closed-loop system is PIDα KP-KI fα(s; KP, KI) = s KI A(s) + s2 KP2
given by α B(s) + s KP KI B(s) + KI2 B(s)
=0
f(s; KP, KI, KD) = s A(s) + s2 KD B(s) + PIDKD KP-KI fKD(s; KP, KI) = s AD(s) + s KP
+ s KP B(s) + KI B(s) = 0 (3) BD(s) + KI BD(s) = 0
PIDKI KP-KD fKI(s; KP, KD) = AI(s) + s KD BI(s)
D(s) + KP BI(s) = 0
+
where:
R(s) E(s) U(s) Y(s) AD(s) = A(s) + s KD B(s) and BD(s) = B(s)
C(s) P(s) AI(s) = s A(s) + KI B(s) and BI(s) = s B(s)
+ +
-
The notation used in Table 1 allows that the PIDKD
control includes the PI control as a particular case
Fig. 2. Feedback control system. when KD=0, and the PIDKI control includes the PD
control as a particular case when KI=0. In order to do
this, it must be noted that the contribution of the
control parameters, KD and KI respectively, are These requirements give a subset of R3, all possible
involved into the process transfer function. trios of gains (KP, KI, KD) verifying the expressions

Figure 3 shows two examples of stability regions for rB cos (φB - φ (ω ) )


KP = (5)
a non minimum phase process describe by the r (ω )
transfer function
- 10 (s − 2 ) - 10 s + 20 (4) K I rB sin (φB - φ (ω ) )
P(s) = = ω KD - = (6)
(s + 1)(s + 5)(s + 10 ) s 3 + 16 s 2 + 65 s + 50 ω r (ω )

9 where r(ω) and φ(ω) are the magnitude and the phase
8
of P(jω) with respect to the origin and to the negative
real axis. Thus, one point A (r(ωd),φ(ωd)) of the
7
process Nyquist plot
6

KI
5 P( jω) = r (ω) e j (φ (ω )-180) (7)
4

3 is mapping to the target point B (rB ,φB) of the loop


2
Nyquist plot
1
L( jω ) = C( jω ) P( jω ) =
0
-3 -2 -1 0 1 2 3 4 5 6 7
⎛ K ⎞ (8)
KP
= ⎜ K P − j I + j K D ω ⎟ P( jω )
9
⎝ ω ⎠
8

7 where ωd is called the design frequency.


6
Table 2 : Target points for the four requirements
5
KI
4 Requirement Target point
3
PM (φm) φB = φ m ; rB = 1
2
1
1 GM (Am) φB = 0º ; rB =
Am
0
-3 -2 -1 0 1 2 3 4 5 6 7
KP Ms (Ms,θ)
Fig. 3. Stability region of the non minimum phase c = -1
process (4). (a) With PI control. (b) With PIDα
control, using the ratio proposed by Ziegler and 1 R sin θ
R= φB = atan
Nichols α=0.25. Ms - c - R cos θ
The process transfer function in equation (1) does not Mt (Mt,θ) R sin θ
rB =
include dead-time in order to determine the stability sen φ B
regions accurately. M 2t
c=-
M 2t - 1

3. BOUNDARY CURVES Mt
R=
In this paper, the four requirements depicted in M 2t - 1
Figure 1 are considered. As it is well known, these
performances could be reached by loop shaping,
doing that the target point B lies on the Nyquist plot The expressions (5) and (6) have been particularized
L(jω)=C(jω)P(jω) (Åström and Hägglund, 2005; in Table 3 when additional conditions, mentioned in
Dormido and Morilla, 2004). Table 2 gives the target section 2 are imposed to the controller gains. In this
points B corresponding to the four requirements, way a subset of admissible values of the controller
where rB and φB are the magnitude and the phase of parameters can be shown as a boundary curve, in the
point B with respect to the origin and to the negative respective parameter plane KP-KI or KP-KD,. The
real axis. R and c are the centre and the radius of the second row of Table 2 includes the PI control as
respective circle. θ is the angle where the Nyquist particular case when KD=0, and the third row
plot contacts the respective circle. includes the PD control as particular case when KI=0.
Even using a reduced range of frequencies, it is usual
7
that only a bit of the boundary curve lies inside the
corresponding stability region. Only this bit of the 6
boundary curve is interesting for find the control
parameters. The Figure 4 shows an example of 5
boundary curve obtained for the phase margin Valid
φm=60º. This curve splits the stability region into two 4
solutions

KI
zones: I (φm > 60º) and II (φm < 60º).
3
Invalid II
With these information is easy to tune the controller. solutions
2
A point of the boundary curve could be select to get Am=4

φm=60º, a point of the zone I to get φm>60º or a point 1


of the zone II to get φm<60º. It is suitable to choose I

the point with the maximum KI (Dormido and 0


-3 -2 -1 0 1 2 3 4 5 6 7
Morilla, 2004). But also it is not suitable to choose KP
any point near the boundary of stability.
Fig. 5. Stability region and boundary curve for PIDα
control of the non minimum phase process (4). With
Table 3 : Boundary curves for PID control
α=0.1 and Am=4.
Control Boundary curves
Combining two values of the same requirement or
PIDα r cos (φB - φ (ω ) )
KP = B different requirements it is possible to get a lot of
r (ω ) information. The Figure 6 is an example where four
K 2I r (ω) + K I ω rB r (ω) sin (φ B - φ (ω)) -
2
boundary curves split the stability region into ten
- ω 2 α rB2 cos 2 (φ B - φ (ω)) = 0 zones:
I - φm ≥ 60º Am ≤ 4
PIDKD rB cos (φB - φ (ω ) )
KP = II - φm ≥ 60º Am ≥ 4
r (ω )
III - φm ≥ 60º 2 ≤ Am ≤ 4
ω r sin (φ B - φ (ω )) IV - φm ≥ 60º Am ≤ 2
K I = ω2 K D - B
r (ω ) V - φm ≥ 40º Am ≤ 2
PIDKI r cos (φB - φ (ω ) ) VI - 40º ≤ φm ≤ 60º Am ≤ 4
KP = B
r (ω ) VII - 40º ≤ φm ≤ 60º Am ≤ 4
K I rB sin (φ B - φ (ω ) ) VIII - 40º ≤ φm ≤ 60º Am ≤ 2
KD = 2 +
ω ω r (ω ) IX - φm ≤ 40º Am ≥ 2
X - φm ≤ 40º Am ≤ 2
7

But also there are five important points, the five


points where the boundary curves cross over:
6

5
a - φm = 60º Am = 4
b - φm = 60º Am = 4
4 c - φm = 60º Am = 2
KI II
d - φm = 40º Am = 2
3
e - φm = 40º Am = 2
φm=60º 7
2

6
1
I
5 e
0 X
-3 -2 -1 0 1 2 3 4 5 6 7
KP 4
KI VII Am=2
Fig. 4. Stability region and boundary curve for PIDα 3
d b
φm=40º

control of the non minimum phase process (4). With IX VIII c


I φm=60º
α=0.1 and φm=60º. 2 VI
V
IV
Moreover it is normal that some points of the Am=4
1 III
boundary curve inside the respective stability region II
were invalid solutions, because with these controller 0
parameters the Nyquist plot has multiple crossing. -3 -2 -1 0
a
1 2
KP
3 4 5 6 7

The Figure 5 shows an example of boundary curve


with some invalid points (the points outside the Fig. 6. Stability region and boundary curves for PIDα
loop). This curve splits the stability region into two control of the non minimum phase process (4). With
zones: I (Am>4) and II (Am<4). α=0.1, 40º≤φm≤60º, and 2≤Am≤4.
The most valuable information is shown in the
When the requirements Ms and Mt are used, it is parameter plane, KP-KI or KP-KD depending on the
suitable to determine the boundary curve for a range chosen design. The set of yellow lines delimit the
of θ, for example between 5º and 45º, instead of a stability region, the user can to hide it or to display it
single value. Moreover the tangent condition in the using the radio-button on top of the parameter plane.
target point must be verified (Dormido and Morilla, The red, blue, green and cyan points represent
2004). This condition is summarized in the following boundary curves for phase margin, gain margin,
expression: maximum sensitivity and maximum complementary
sensitivity respectively. To hide or to display these
(
rB rB' (ω ) + c rB' (ω ) cos φB − rB φB' (ω) sin φB = 0 (9) ) curves the user must use the requirements radio-
buttons.
where r´B(ω) and φ´B(ω) represent the value of the
A black point can be dragged with the mouse inside
derivative of the magnitude and phase of L(jω) in the parameter plane in order to test different control
the point B respectively. gains. When this point is released; the three edit
Therefore obtaining the boundary curves for Ms and fields show the control gains (KP, KI and KD), the
Mt need more calculations than the curves for φm and Nyquist plot and the frequency response features are
Am. The Figure 7 is an example where two boundary updated. A new simulation is also performed and the
curves for maxima of sensitivity split the stability new time closed loop response is added to the
region into three zones: graphics.

I - Ms ≤ 1.8 Mt ≤ 1.6 In Figure 9 a PIDα controller with α=0.1 has been


II - Ms ≥ 1.8 Mt ≤ 1.6 tuned for the non minimum phase process (4). Four
III - Ms ≥ 1.8 Mt ≥ 1.6 boundary curves has been calculated for single values
of the specifications (φm = 60º, Am = 3, Ms = 1.8, Mt
7 = 1.6) and five values of θ between 10º and 40º. The
black point has been dragged to the zone where φm <
6
60º, Am < 3, Ms < 1.8 y Mt < 1.6. These constraints
5
shape the loop Nyquist plot to get (φm = 55.6º, Am =
2.7, Ms = 1.7, Mt = 1.1) showing that the design was
4 possible.
KI III
Mt=1.6 Note that other important information, the
3
frequencies where the loop performances happen, is
II
presented in Figure 9. In this case, the frequencies are
2
I
in the following order: ωcp ≅ 0.8, ωt ≅ 0.9, ωs ≅ 2.0,
1 ωcg ≅ 3.2. The main windows show also the slope of
Ms=1.8
the loop Nyquist plot in each of these frequencies and
0
-3 -2 -1 0 1 2 3 4 5 6 7
the angles where the plot contacts the circles Ms and
KP Mt. All these information is very important to decide
if the Nyquist plot has a good shape (Åström and
Fig. 8. Stability region and boundary curves for PIDα
Hägglund, 2005).
control of the non minimum phase process (4). With
α=0.1, Ms=1.8, and Mt=1.6. With the control gains selected KP ≅ 2.0, KI ≅ 2.0 and
KD ≅ 0.2, the time response of the closed loop is
good. The output and the set point signal are shown
4. THE PID GUI
on the left. The control signal is shown on the right.
A PID graphic user interface (GUI) has been Comparing these graphics with the Nyquist plot is a
developed in Matlab. The main window is shown in good way to develop intuition for the relations
Figure 9. It is designed to provide simultaneously between the time and frequency responses.
enough information (the stability region, the
The toolbar of the main window includes a menu,
boundary curves, the time and frequency responses)
where user can load and save designs, import a
and to update it quickly when the user makes changes
process from workspace, export a controller to
in the interface.
workspace, set the simulation parameters and choice
The transfer function without dead-time (numerator several aspects of designs.
and denominator) describing the process is on the
upper left corner. A pop-up menu with the five kinds
5. CONCLUSIONS
of designs (PI, PD, PIDα, PIDKD and PIDKI) is on
the upper left corner. The radio-buttons for select the The Matlab GUI described in this paper has been
design requirements are on the middle. The developed for teaching activities in two Spanish
requirements are given by single values or by range universities, improving previous tools of the authors.
between two values in four edit fields. It will be available on http://www.uco.es/~in2vasef/.
This paper presents the fundamentals of this GUI but
Fig. 9. Main window of the Matlab GUI to design PID controller with guaranteed stability.

it also show some of the general benefits of using a Dormido, S. and F. Morilla (2004). Tuning of PID
tool like this to understand concepts about stability, Controllers Based on Sensitivity Margin
robustness and stability margins in PID control loop. Specification. 5th Asian Control Conference,
A non minimum phase process has been used in the Melbourne.
examples but the GUI has been tested with a great Mañoso, C., R. Hernández, A.P. de Madrid and S.
number of transfer functions. Dormido (1996). Robust stability analysis of
predictive controllers using extreme point results.
CESA'96 IMACS Multiconference, Lille-France,
ACKNOWLEDGEMENTS
pp 483-488.
This work has been supported by the Spanish CICYT Morilla, F. and S. Dormido (2000). Methodologies
under grant DPI 2004-05903. This support is very for the tuning of PID controllers in the frequency
gratefully acknowledged. domain. PID’00 IFAC Workshop on Digital
Control: Past, present and future of PID Control,
155-160, Terrassa.
REFERENCES Schlegel, M. and J. Mertl (2004). Stability regions
for PI/PID controller and Matlab program.
Ackermann, J.E. (1980). Parameter Space Design of
International Carpathian Control Conference,
Robust Control Systems. IEEE Transactions on
May 25-28, Zakopane, Poland.
Automatic Control, Vol. AC-25 , 6, 1058-1072.
Shafiei, Z. and A.T. Shenton (1997). Frequency
Åström, K.J. and T. Hägglund (2000). The future of
domain Design of PID Controllers for Stable and
PID control. PID’00 IFAC Workshop on Digital
Unstable Systems with Time Delay. Automatica,
Control: Past, present and future of PID Control,
Volume 33, Issue 12, 2223-2232.
19-30, Terrassa.
Åström, K.J. and T. Hägglund (2005). Advanced PID
Control. ISA-The Instrumentation, Systems, and
Automation Society. Research Triangle Park, NC
27709.
Barmish, B.R. (1988). New tools for robustness
analysis. Proc 27th IEEE Decision and Control
Conf, vol 1, pp 1-6, Dec.
Čech, M. and M. Schlegel (2005). PID controller
design on Internet: www.PIDlab.com.

You might also like