Self-Tuning Control Matlab Toolbox - Memodology and Design

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Copyright © IFAC Computer Aided Control Systems

Design, Gent, Belgium, 1997

SELF-TUNING CONTROL MATLAB TOOLBOX - MEmODOLOGY AND DESIGN

Vladimir BobaI, Roman Prokop

Department of Automatic Control, Faculty of Technology Zlin,


Technical University Bmo, nom. TGM 275, 762 72 Zlin, Czech Republic,
tel.,fax: +420 677211521
E-mail.·[email protected]

Abstract: The contribution presents a class of SISO discrete self-tuners for simulation and
industrial applications. The proposed adaptive controllers can be divided into two parts.
The first part covers PID adaptive algorithms with utilization of traditional methods. The
second part is based on polynomial solutions of control problems. Both class of algorithms
were unified and incorporated into a Matlab - like Toolbox for self-tuning control.

Key words: Self-tuning control, Recursive least squares, PID control, Pole assigment,
Polynomial equations.

1. INTRODUCTION squares method, its numerical stability is improved


by means of an LD decomposition and adaptation is
The aim of this paper is to present a class of SISO supported by directional forgetting (KulhavY, 1987).
self-tuners which covers a wide spectrum of control The parameter estimates are used for the calculation
problems. One part of self-tuning principles is based of control param~ters and control law. The control
on traditional control design principles. The second law computes the controller output in sampling
part deals with. control design utilizing polynomial periods.
approach and Diophantine equations.

In control design of complex, non-linear and time 2. DIGITAL PID CONTROLLERS


variant technological processes, a challenge of using
sophisticated advanced algorithms offers, as they can The PID controller setting, developed by Ziegler and
attain better technical and economical parameters. Nichols (1942) more as half a century ago, is still
One of the promising direction in modem control widely used in industry. In this well-known approach
theory has been adaptivity. The concept of self- the parameters of controller are calculated from the
tuning control (STC) in adaptive control arose in the ultimate (critical) gain Kpu and the ultimate period of
sixties. From that time it has been enormously oscillations Tu of the closed loop system. These
studied and developed. critical parameters are obtained from experimental
setting of the proportional controller in feedback.
The self-tuning algorithms proposed here utilize the The gain of the controller is increased until
recursive identification procedure for estimation of oscillation with constant amplitude is obtained
discrete-time parameters of inherently continuous Lstrom and Hagglund (1995) proposed to use a relay
working controlled plants. Identification procedure in the feedback loop instead of the proportional
can be switched off when the parameters estimates controller. The analytic determination of the
reach their true values. The identification part of the ultimate parameters Kpu and Tu for the continuous
designed controllers is utilizes the recursive least transfer function differs from the discrete one. In the

127
first case the poles of the characteristic polynomial which holds a 2 + fJ2 = 1 . Then the
of closed-loop system must lie on the imaginary axis characteristic polynomial (5) includes a
and in left-hand of the s-plane. The computation of
quadratic three-term C/(z) = Z2 -2az+l .
Kpu and Tu can be obtaned by substitution s = jw. in
• The characteristic polynomial (5) includes one or
the characteristic polynomial. This solution is the
same as the experimental setting of proportional more real poles z, = a (imaginary part fJ = 0).
controller by Ziegler-Nichols method. The control loop is on the stability boundary in
case of a = -1 , because the positive pole a = 1
2.1 Determining of ultimate parameters will not put the control loop into oscillation.
Then characteristic polynomial (5) includes j-
The relations for tuning of discrete PID controllers terms C, (z) = (z + 1)', j = 1,2, .. . .
will be now derived. Let the process be described by
the single input single output (SI SO) system model The characteristic polynomial must be divisible by
in the form of the discrete transfer function one of these terms and it leads in the first case to the
solution of the polynomial equation

(1)

Z·+<I[A(Z-/)+Z-4 KJI'~Z-/)] =
(6)
where U(z) and Y(z) are the z-transforms of the =(Z2 -2az+l)zn+<l-2 E(Z-/)
controller output and the process output, d is the
time delay expressed as an integer multiple of the
sampling period To. A and B are n-degree
where
polynomial defined by
lI+d-l

A(Z-/) = 1 + 'i:,a,z-' . B(Z-/) ='i:,b,z-' (2)


E(Z-/) = 1 + Le,z-' (7)
1=1
;=} 1=1

Let the process (1) is controlled by the proportional and unknown parameters are Kpu, a and coefficients
e;of the polynomial E(z).
controller
In the second case we obtain the polynomial
G (z)= U(z) =K (3) equation
C E(z) P

where E(z) = W(z) - Y(z) is z-transform of the error,


W(z) is z-transform of the reference signal. When
solving the equations (1) and (3) we get the transfer
function of the closed control loop where

(9)
(4)

and unknown parameters are Kpu coefficients J; of


The denominator of the transfer function (4) is the the polynomial F(z).
characteristic polynomial
The solution of equation (8) can be obtained in a
simpler form. The pole a = -1 forms the oscillating
component (-1/ which corresponds to a continuous

whose poles determine the behaviour of the closed function cos~t


T with ultimate period Tu= 2To. The
control loop. The poles of the characteristic o
polynomial (5) lie on the unit circle and inside unit variable z is defined in z-transformation as
circle when the condition Kp = Kpu(I'aJ is fulfilled.
Two possibilities of the pole placement of the z = e' -"To = cos wTo + j sin w~ (10)
characteristic polynomial on the unit circle may
occur so that the closed control loop is on the
stability boundary: Equation (10) gives for w. = 21r = ~ the solution
• The characteristic polynomial (5) includes a pair 1'. To
of complex conjugate poles z J.2 = a ± j fJ for Z = -1. The ultimate gain for the open-loop system is
then given by

128
previous value u(k-1) and from compensation
(11) increment seem to be suitable

The equation (6) can be solved e. g. by comparison


of terms with the same of variable z. The right
solution must be selected from equations (6) or (10) where controller parameters
according to the condition that all other poles of
characteristic polynomial (5) are stable. qO,qpql = f(Kp,T;,Td,To)'

The term CJ z) = z: - 2az + 1 has its equivalent 2.3 pm controller with a filter constant in the D-
in continuous form as the denominator
part
z: - 2 cOSOJ MTOZ + 1 of z-transformation of the Let the controller be described by a transfer function
harmonic function cos OJ t or sin OJ t and the real in the form
component a can be the expressed as
u(s)
G S =--=K 1 - +TdS)
( 1+ -- (16)
21rTo c() E(s) p T;s 1+TJs
a = cOS(J) MTO = cos-- (12)
T.,(To )
where T, is a filter constant improves the dynamic
The equation for computing of the ultimate period behaviour of the control loop. Using Tustin
can be easily derived from equation (12) approximation the transfer function (16) can be
transcribed into the form
(13)
u(k) = pJu(k -1) + p:u(k - 2)+q oe(k) +
+ qJe(k -1)+q:e(k - 2) . (17)
The relations for calculation of the ultimate
parameters for second order process model (n = 2, d
= 0 in equations (1) and (2» has been proposed by where PJ,P: = f(To'~) (see Isermann, 1989) and
BobaI (1995). The auto-tuning procedure for the
third process model (n = 3, d = 0 in equations (1) qo,qJ,q: =f(Kp,T;,Td,~,To). The PIDparameters
and (2» can be derived by some analytical ways. for computing of the controller parameters in the
BobaI (1994) used for the calculation of the poles of equations (15) and (17) are given by Ziegler-Nichols
the third order process model the Cardan formulas. (1942) relations
Calculation of the ultimate gain for the fourth and
higher order process model is necessary realize by T; = O.5TM ; Td = O.l25Tu (18)
numerical way, e.g. using MATLAB. It is suitable
use for deriving of the relations Symbolic Math
Toolbox. 2.4 Tahahashi's pm controller
2.2 Recurrent pm control algorithms Unfavourable large changes of the controller output
amplitude can be reduced, when the process output
Let the continuous PID controller be described by a reference value w(k) is included only in the integral
transfer function in the form component

u(S) ( 1 ) (14) T
Gc(S)=-() =Kp 1+-+TdS u(k) = K (y(k-1)- y(k)+2..[w(k)- y(k)] +
E S T;s p T;
T
To get a digital version of the PID controller, we +--f!... [2y(k -1) - y(k) - y(k -2)]) + u(k-1)
should discretize the integral and derivative To
component at the equation (14). For discretizing the (19)
integral component, usually forward rectangular This is a well-known recurrent control algorithm
method (FRM), backward rectangular method proposed by Takahashi et al. (1971), where
(BRM) or trapezoidal method (TRM) are used. The
derivative component is mostly replaced by the 1st
3Kpu Tu
order difference (two-point difference). For practical K =O.6K (1_T;,). T= KpTu . T =-"'---
use the recurrent control algorithms which compute P "" Tu' I 1.2Kpu' d 40Kp
the actual value of the controller output u(k) from the (20)

129
The relations (20) show that the PID parameters According to Fig. 1 the control law is governed by
depend only on the ultimate gain Kplb on the the equation:
ultimate period of oscillations Tu and on the
sampling period To . P(z-' )U(z-') = Q(z-' )(Y(z-') + N (z -'))
p (22)
+R(z -' )W(z-')

3. UNIFIED SISO SELF-TUNERS


The aim of this part is a design of self-tuning where W(z-') = G., Jz} is the reference and Np is
F,.(z )
controllers (STC) based on polynomial approach.
The adaptive control systems in the sense of STC the measurement noise.
consists of two loops. The inner loop is composed of
a controlled plant and a linear regulator. The Polynomials P, Q and R are subjected to the control
regulator parameters are adjusted in the outer loop synthesis. In the parlance of algebra several control
containing a recursive parameter estimation aims can be formulated in a similar and unified way.
procedure and a control design calculation. The The solution is adopted from Kucera, Sebek (1984)
discrete-time synthesis of the control design consists and the control synthesis is formulated via
in solving of a pair of polynomial Diophantine Diophantine polynomial equations. The feedback
equations. The right hand sides of these equations polynomials are given by:
establish the control aim to be achieved. Thus, the
same set of parameter calculations covers a wide
spectrum of possibilities and an appropriate
performance behaviour can be easily obtained. and the feedforward polynomials are given by:

3.1 System Description and Control Design

Consider a single input - output control system


depicted in Fig. 1. In (23), (24) the polynomials of the right hand side
determines the control aim in the following way:
a) For H=M=1 equations (23), (24) represent a
w=o~ v
dead-beat (DB) servo problem (tracking error
Fw vanishes as soon as possible).
R b) For H=1 and M given by spectral factorization
Cf=-
P

p y
q,=g (25)
p
where A. (z-') = A(z) and the quadratic
(deterministic) cost

Fig. 1. Single input - output contol system. (26)

Note that for Q = R a traditional feedback regulator


operating on the tracking error is obtained. Signals is minimized (LQ problem).
w and v · represent the reference and disturbance c) For M given by (25) and H given by the second
signal, respectively. The SISO discrete-time model is spectral factorization
according to (2) described by the equation:
A(z-' )pA.(z -') + C(z-' )vC.(z-' ) = H.(z -' )H(z-' )
A (z-' )Y (z-') = B(z-')U (z-') + C(z-' )NJz-') (27)
(21)
where: equations (23), (24) nunllmzes the quadratic
I
y(Z·I), U(Z·I), N/z· ) is the output, input and white (stochastic) in the sense of steady-state variances
noise (zero-mean) sequences with variance v, (LQG problem):
respectively
2 2
A , B, C are polynomials in Z·I with conditions J = ({JCJ. + XCJ (.. _y) (28)
A (0);41; B(O)=O.
Equation (21) represents a well-known ARMAX
d) For H and M both stable, the general pole-
model, a special case for C (z-' ) =1 is an ARX placement problem (PP) is solved.
model.

130
Polynomial equations (23), (24) with spectral factors A (z·J )fPA.(z·J) + B(z·J)Z B.(z·J) =
(25), (27) yield the regulator polynomials under the (31)
= go + glz·J + z) + gl(Z·' + Zl)
following conditions:
a.) polynomials A and B are relatively prime
13) polynomials F", and B are relatively prime where
More details can be found in Ku~era and Sebek go = fP{l+a: +a:)+ Z{b: +b:)
(1984), Ku~ra (1980), Sebek and Ku~era (1982).
gJ = fP aJ(1+a 2 ) + Zbp, (32)
3.2 Parameter Estimation and Adaptive Control g, = za,
For spectral factorization (27), expression (31) is
Almost all mathematical models differs from similar with
physical systems. That is one of the reason for go = 1'(1+ a: +a;)+v(l+c: +c;)
adaptive control strategies. The most commonly used
approach for parameter estimation is the recursive gJ = .ooJ(l+a, ) + VCJ(1 + c,) (33)
least squares method. By re-arranging of (21) the g, = pa,
following equation
The spectral factors m(z·I), f(zol) are given:
y(k) = e'(k)z(k) + v(k) (29) go
~J =2-g, + (2+g,
g o ) 1 -gJ1

can be obtained. In equation (29) @'(k)=


(al •... an"'bJ, ...• bnbocJ, ... cncJ is the parameter vector, ~, =~-~J +~~/ -4g: (34)
z '(k)=(-y(k-1) •... ,-y(k-n,J, u(k-1) •... u(k-na), s(k-).··· s(k-
nJ) is the observation vector and s(k) is the m = 1 m = _g_J_ m = g2
o J ~, + g2 2 ~2
prediction error.
(h(), hI. h] in the same way for (33».
In the case of the ARX model, the data s(k-1), ... s(k-
The Diophantine equations of control synthesis
n,) are omitted as well as the parameters Ci . To
(LQG) have the form (for the stepwise reference):
avoid the burst effect and enable directional
forgetting, the algorithm LDDIF was utilized (see
KulhavY, 1987). (1 + aJz·J+ a,z·' ){Po + PJz·J + P2Z·') + (bJz· J+b,z·' )
(qo +qJz·J) = (1 +mJz·J +m2z·' ){1 +hJz·J +h2z·' )
The discrete self-tuner is then obtained by the
combination of parameter estimation and control (1- z·J)(so + sJz·J + S2Z·' + sJz·J) + (bJz· J + b2z·' )ro =
design for a given structure of the controlled object.
= (1 + mJz·J + m,z·' )(l + hJz· J + h2z·' )
Owing to the unified approach of the control
synthesis, the same set of control calculation can (35)
offer four types of control costs and two types of We can obtain the explicit formulas for Pi. qi. ri by
identified models. Thus, a control engineer can simply equating the coefficients at like powers of zol
easily change the aim and model according to in the left and right side of eqs. (35). The resultant
appropriate and requisite industrial circumstances. control law is given:
Each self-tuner of given structure has two main
"knobs". The first is for the option of the model u(k) = row(k) - pJu(k -1) - p,u(k - 2) - qoy(k)-
(ARX, ARMAX), the second one is for the selection -qJy(k -1)
of performance criterion (DB, LQ, LQG and PP).
(36)
3.3 Dlustrative Example It is clear that (36) covers the following possibilities:
1) LQG problem for mi, hi given by (32), (33), (34)
Suppose a SISO second order ARMAX structure: 2) LQ problem for hl=h]=O and mi given by (32),
(34)
y(k)+a Jy(k -l)+a ,y(k-2) =b Ju(k-1) 3) DB problem for hl=h]=ml=m]=O
+b ,y(k - 2)+na (k) +cJn a (k -l)+c,n a (k - 2) 4) PP problem for a special option of hi, mi ( for
instance hl=h]=O and mi creating a stable m(zol).
(30)

First, we have to perform spectral factorizations (25),


4. STC MATLAB-TOOBOX
(27). There exist formulas for the second-order
factorization (see e.g. Peterka) given by the
An STC MATLAB-Toolbox was developed for
following expression (for (25».
control design, simulation, testing and real-time
verifying of proposed algorithms. This toolbox is

131
written in m-files using the functions Control System BobaI, V. (1994). Robust self-tuning PID controller.
Toolbox, Symbolic Math Toolbox, MATLAB 4.2 In: Proc. 1st IFAC Workshop on New Trends
and SIMULINK 1.3. This toolbox includes tools in Design of Control Systems, Smolenice,
which facilitate following: Slovak Republic, 312-317.
BobaI, V. , M. Kubal~ik and M . UIehla (1995). Auto-
1. Simulation of controlled process in the form of: tuning of digital PID controllers using recursive
continuous-time model, discrete time model, identification. In: Proc. 5th IFAC syposium on
model obtained by the recursive identification Adaptive Systems in Control and Signal
from the measurable date. Processing, Budapest, Hungary, 384-389.
2. Recursive identification: RLSM with exponential BobaI, V. (1995). Self-tuning Ziegler-Nichols PID
forgetting, RLSM with directional forgetting, controller. International Journal of Adaptive
projected algorithm. Control and Signal Processing, 9, 213-226.
3. Controller PID design on the basis of: Ziegler- Isermann, R. (1989). Digital control systems.
Nichols method, pole placement method (design Springer Verlag Berlin.
on the basis of the dominant poles for a second Ku~ra, V. (1980). A Dead-beat Servo Problem.
order continuous model, design using a double Int.J.ofControl, 32, No.1, p.107-113.
real pole and couple of complex conjugated poles Ku~era, v., Sebek, M.(1984). A Polynomial Solution
proposed by BobaI et al.(1995» . Unified design to Regulation and Tracking.Part I, 11.
based on the polynomial approach was Ky bernetilm, 20, p.177-188, 257-282.
incorporated into the Toolbox. Kulhavj, R. (1987). Restricted exponential
4. Real-time control using the acquisition card forgetting in real time identification.
PCL-812 PG with Real Time Toolbox. Automatica, 23, 586-600.
MacM~k , 1. , O. Dnibek and S. Krejci (1995).
Adaptive discrete PID controller. In: Proc.
5. CONCLUSIONS Scientific Papers, University of Pardubice, 58,
Czech RepUblic.
The paper is aimed to a class of self-tunning control PivoiUca, P. (1995). Modelling, adaptive, neural and
algorithms for SI SO systems. The self-tuners fuzzy control of coal power plants. In: Proc.
included in STC MATLAB-Toolbox are relatively 2nd IFAC Symposium on Power Plants and
simple, sufficiently robust and suitable for Power Systems, CancUn, Mexico.
controlling a large class of industrial processes. This Prokop, R., Turisova, Z., Meszaros, A. (1992).
toolbox has been used for implementation of the self- Unified Self-tuners for Industrial Applications,
tuning Ziegler-Nichols PID controllers. Controller In: Proc. IFAC Conf LCA , Wien, 167-172.
(19), (20) with tuning procedure for the second order Sebek, M., Ku~ra, V., (1982). Polynomial
model has been applied for temperature and pH Approach to Quadratic Tracking in Discrete
value control in laboratory fermenter (VaSek, 1995), Linear Systems. IEEE Trans.on AC, 27, 1007-
the same controller derived for the third order model 1010.
has been applied by PivoiUca (1995) for the control of Takahashi, Y. , C. Chan and D. Auslander (1971).
the 200 MW power plant. Controller (17), (18) has Parametereinstellung bei linearen DDC-
been successfully tested for the control of pilot Algorithmen. Regelungstech. Prozessdatenver.,
distillation column (MacM~ek et al ., 1995). The 19, 237-284.
unified approach to self-tuners was successfully VaSek, V. (1995). Laboratory fermentor computer
applied in metallurgic industry and some of results control. In: Proc. 10th Conference Process
were presented in Prokop et al. (1992). Control '95, Slovak Technical University
Bratislava, 243-247.
Ziegler, 1. G. and N. B. Nichols (1942). Optimum
ACKNOWLEDGEMENTS settings for automatic controllers. Trans.
ASME, 64, 759-768.
This work was supported by the Grant Agency of the
Czech Republic under grant No. 102/9610927 and by
the grant VUT Bmo No. FUZ 601 08.

REFERENCES

Lstrom, K. J. and T. HAgglund (1995). PID


Controllers: Theory, Design and Tuning. 2nd
Edition, Research Triangle Park, North
Carolina, USA.

132

You might also like