Copyright 0 IFAC System Structure and Control, Nantes, France, 1998
A SIMPLE ADAPTIVE PID TUNER Cs. Banyasz
and
L. Keviczky
Computer and Automation Institute, Hungarian Academy of Sciences H-1502, Budapest, Kende u 13-17, HUNGARY Phone: +36-1-166-5435; Fax: +36-1-166-7503 e-mail:
[email protected].
[email protected]
Abstract: This paper introduces a new approach, which is based on a stochasticdeterministic recursive adaptive scheme, estimating the process parameters and the time delay at the same time and using design formulas for automatic tuning of the PI D regulator parameters. Copyright © 1998 IFAC Keywords: Adaptive PID regulator, time delay estimation, recursive estimation.
1. INTRODUCTION
collection of papers dealing with automatically tuned and/or adaptive PID regulators.
Discrete PID regulators can be implemented in many different ways. Different structures correspond to different continuous PI D regulators. The most common sampled data PID regulator is given by the discrete transfer function
In our investigation the PID regulator is applied in a closed-loop system given in Fig. 1. This figure shows the continuous process given by the transfer function Gpc = He-Sf /G , the zero order holding (Z.O.H.) element and the discrete transfer function GR of the regulator. Here 't is the time delay of the process.
where Z-l is the backward shift operator. The gain, the integral and derivative time constants of the corresponding continuous regulator can easily be obtained by applying different approximations for the integral and derivative actions. This form includes a PI regulator, too using P with P2 :; O. (In case of an integrating plant GR = P should be applied.) DISCRETE PID REGULATOR
2. TIlE APPLIED PROCESS MODEL In the industrial practice it is a good approximation to use a second order time delay lag as continuous process transfer function in most of the cases, i.e.
CONTINUOUS PROCESS
Please note that historically the PID regulator was first introduced for this class of processes. There are several ways to obtain the discrete time equivalent transformation of Gpc . The step response equivalent (SRE) transformation of Gpc is (see, e.g., in Keviczky (1979)):
Fig. 1 The block scheme of the closed-loop system Many rules exist for tuning continuous and discrete time PID regulators, which procedures are, however, in many cases non-trivial. Therefore, the automatic tuning of PI D regulators has a great practical importance. The REFERENCES give a good
(3)
and using Gpc(s) given by (2), 471
G' (
-I) _
b{Z-1 +b2 Z-2 - 1 ' 1 , +al Z +a2 Z
PO Z
b~
Z-d
_d
= I + a)' q 1 + a2
2
q
2
N
(7)
q
(4)
is obtained. Because the different notation by q has importance only in the theoretical analysis and q-I has the same sense as
where the discrete time delay of the process is d'
=d + I = entier(t) + I
with the applied sampling time h . The argument or Gpo corresponds to the ordinary z-transform and
p(Z-I)
b~(l +y Z-I)
t
l-z-
1
~-
PlO REGULA TOR
!
q-1 h
While Gpo gives an exact matching in all sampling instants, Gpo ensures an exact approximation only at h ~ 0, which is the continuous case itself. (See the corresponding closed-loop system in Fig. 3.) 3. THE APPLIED REGULATOR DESIGN
METHOD The process is assumed to be a stable, second order dead-time lag whose discrete transfer function has the form -I
Gpo(z bo
PO
q
k >0
If the continuous process is a stable, non-integrating plant, then the poles of a SRE Gpo are inside the unit circle. If the continuous process is a minimum phase, second order lag, then the zero (-y) of Gpo is also within the unit circle. For higher order minimum phase continuous processes we can get the zero outside the unit circle, because of the approximating character (and the necessarily occurred bias) of the second order model. This can also happen, if the time delay of the process is not an integer multiple of the sampling interval, which is the general case. In case of a non-minimum phase continuous process the zero is always outside the unit circle.
(6)
q-d
*0
B(Z-I)
)= A(Z-I)
The above process model needs four parameters to be estimated if the time delay is apriori known or available from preliminary investigations.
where q is the forward shift operator: q x(t) =x{t + 1). It can be well seen that 0 is a forward difference operator corresponding to the wellknown first order Euler-approximation. Applying (6) for (2), the discrete transfer function b0" q-2 - l+a)' q-I +a2 q
y(t)
Fig. 3 Second order plant by 0 transformation
Another approach to compute the discrete transformation of Gpc is based on the so-called 0transformation introduced by Goodwin and coworkers (1986). In spite of some recent publications and books, the origin of this transformation can be led back to early publications of this field (see, e.g., Farmanfarma (1957) ). Avoiding a detailed analysis, this approach is used here only to compute an equivalent Gpo discrete transfer function. The 0transformation is a simple substitution of the Laplace variable s by 0, i.e.:
-I) _
SECOND ORDER PROCESS MODEL BY I) rRANSFORMA nON
l+a{z I +a2'z-2
I
The Gpo computed by the SRE principle ensures an exact matching between the continuous and discrete time (sampled by h) transient processes of the system, if a step input excitation is applied. This is the case if a Z.O.H. is used, which is the general industrial practice. Thus a SRE Gpo gives an exact discrete time modelling of the closed loop in the sampling instants. Such system is shown in Fig. 2, where Yr{t) , e{t), u{t) and y{t) are the reference signal, control error, process input and output, respectively.
G" (
(9)
b~'
r--r-'
Fig. 2 Second order plant by SRE transformation
s~o=-
(8)
d" = d + 2 = entier(t) + 2
y(t)
1+a;z-I +a2 Z-2
N
where
operator, where the integer argument t is discrete time of the sampled system).
0;
b"0 Z_d -1+ " -2 al Z a2 Z
can also be written at the practical investigations,
Z-Ix{t) = x{t-l) (the meaning of the backward shift
SRE SECOND ORDER PROCESS MODEL
therefore
-I) --1+"
" (z GPO
(5)
PlO REGULATOR
Z-I,
=
2
472
Note that the a-transformation based Gpo has no zero. In case of a parameter estimation procedure the applied structure of BI A makes only difference , how
1t wh )'Sinwh --+--arcto -rodh = -1t+
to obtain G~o or Gpo .
equations for GF
=I,
(15)
ensuring the prescribed
$a == 1.07 == 60° results in an implicit nonlinear
Most of the optimal regulator design algorithms are based on the inverse of the process model. This is valid for advanced and classical tuning procedures, too. In case of noninvertable models, a good approximation is preferred ensuring acceptable robustness for plant parameters and regulator realization sensitivities.
relationship )'Sinx 1 - 2arctg --'--1+ ycos.x x= = g(x) 2d-l
(16)
of type x = g(x), which generally has only iterative solution. This iterative solution can be performed in many ways , however, the simplest, so called relaxation type algorithm has the form
Since the process is stable and a second order model is used, a very good robust design idea is to choose P proportional to the denominator of the estimated process model:
(17) (11)
Having obtained the solution, the optimal integral gain is
i.e., to use
~2(1- cos.x) K J = --;======~
which means all poles cancellation and is applicable for stable processes only. One should note that this was the original design idea connected to the invention of the PI D regulators. In the tuning practice it meant that the regulator cancels the two largest time constants in the process dynamics. Following this idea, the resulting simple closed-loop is easy to be handled from the designer's point of view . The reduced closed-loop consists of a seriallyconnected integrator and a pure delay Z-k and sometimes a serial compensator GF , which is easy to realise in digital control systems, see Fig. 4. e(r
1 +yz-I
( -I)
K1 - - _ 1 GF Z
u(r)
l- z
(18)
~1+2ycosx+y2
(12)
The solution of Eqs. (16) and (18) is plotted in Fig. 5 for different values of d in the function of y .
KJ
::: '----...r--:: ... =-.... -...:'-....-... ---r H '•••• --••••---'J 0.8 0.6 0.4
){r)
I !
Fig. 5 The optimal K J in the function of d and y Using the serial expansion of (16) and (18) the design formula
Fig. 4 The reduced closed-loop system for optimal design In this simple closed-loop system there is a strong relationship between the overshoot of the unit step response and the prescribed phase-advance $ a' as our earlier investigations showed (see Banyasz and coworkers (1982,1985)).
1 = x =-...,.--.,.--,--..,-
K J
2d(I+Y)-(I-Y)
(y> 0)
(19)
can be obtained, which gives a very good approximation for y > 0 values.
Introducing the integral gain
Formerly the case y = 0 was investigated by Banyasz and Keviczky (1982), when the nonlinear equation has an explicit solution
(13)
the solution of the absolute value
KJ = KIO =
X
1 =-2k-l
(y =0)
(20)
(14)
and it was shown that the optimal gain gives nice step responses with overshoot values between 1% and 5%.
and phase 473
It should be noted that for y < 0 a serial filter
regulators assume the apriori knowledge of the time delay. This was the case in our former studies, too. Repeat the same strategy for the model structure determined by the 0 -transformation. Introducing the estimated parameter vector
(21)
can also be applied together with Eq. (20). In this case the step response will have the same shape as for KI :: K IO , however, the transient will be slower, depending on the time constant represented by GF via y . (These modifications are suggested only for inverse stable discrete models:
(25)
of the process approximated by Gpo given in (8) and the observation vector
Iyl < 1 )
f(t -I) = [u(t - k), -y(t -1~ -y(t - 2)r
It can be shown that for the poorly-damped zero and for a wide range of unstable zero it only slightly modifies the required step response. However, for nonminimum phase processes with a zero IZII> 1 it may be desirable to compensate the undershoot caused by a zero close to 1 by introducing a closed-loop pole PI . This design technique, based on the fact that an unstable zero ZI can optimaUy be compensated by the stable pole PI :: Ijzl ' was analysed in Banyasz, Hetthessy and Keviczky (1985) and resulted in a simple additional serial filter
the well-known RLS method is formulated by the formulae
and
R = _1_ {R I
I_I : k=dW
1
::
2(d+2)-1
2d+3
I-I
_ RI
I f(t -1) fT (t -I)RI _ I w 2 + fT (t -1)RI _d(t -I)
}
(28)
In case of noisy measurements different versions of the recursive ELS, IV or ML methods can be applied, which are not treated here. (In our practice the recursive IV method proved to be most powerful and less sensitive to the different problems concerning closed-loop identification.) Having obtained the estimated process parameters, the PI D regulator parameters can finally be computed by the application of the following formulae
(23)
using (9) and bo :: b;: . It is interesting to see that in case of lim KI ::: lim :: _ h~O h h~O 2't + 3h
w2
which is applied for the on-line adaptive parameter estimation. (The closed-loop identifiability condition is fulfilled and the persistently excitation must be ensured through the reference signal Yr(t).) Here o< w $; 1 is the exponential forgetting factor and (28) stands for the so-called naive programming form (in the practice a U-D factorization algorithm is preferred to use). Note that k (corresponding to d") is apriori known.
which is very easy to compute and realise. At the beginning of these investigations the first and simplest case y:: 0 seemed to have a theoretical value only with probability zero. The further studies investigating the applicability of the 0transformation showed that for h ~ 0 the Gpo ensures very good approximation of the continuous transient processes. On the basis of the above the best applicable design rule should be based on the form (7), which results in the optimal gain
K __ 1- 2k-1
(26)
1 Kit =K1 = 2k-1
(24)
we obtain the well known classical design rule of thumb back, available for integrators, compensating dead-time processes. It is important to note that the most important advantage of using Gpo is that decreasing the sampling interval the overall design goal can always be obtained by the application of (23). (The other advantage will be seen at the adaptive delay estimation.)
(29)
(30)
(31)
(32) The above regulator parameters correspond to the following integral and derivative time constants:
4. ADAPTIVE TIJNING OF REGULATOR PARAMETERS IN CASE OF APRIORI KNOWN PROCESS DELAY
(33)
Practically all methods published for adaptive 474
To
hi/;'/(I-o.;)
=
of BM. For this reason the RLS equations (25}-(28) can be used with the modified
(34)
(37)
These parameters correspond to an equivalent realizable continuous PID regulator if 0 < < 1.
a;
If the process itself has an integrator (i.e., z =1 is a pole in the discrete model), then the following regulator
-I) = Po + PI Z-I + P2 z-2 = p( z-I)
GRO( Z
f(t -1) = [u(t), u(t -1), ... , u(t - M), -y(t -1), -y(t - 2)r (38)
parameter and observation vectors. Having obtained
(35)
BM(z-I), the equivalent
should be applied instead of (1). In this case a discrete model Gpo is identified between u(t) and 6y(t) = y(t) - y(t -1) as input and output, instead of u(t) and y(t), respectively.
(39)
numerator (parameter and delay) will be determined by a model matching at zero frequency . For the determination of the two unknown parameters:
5. ADAPTIVE TIJNING OF REGULATOR PARAMETERS IN CASE OF UNKNOWN TIME DELAY
i., the zero and first order derivatives of BM (jro) and B"(jro) will be required to be equal at ro =0 .
and
In spite of the several possible ways, how the process time delay can be included into the parameter estimation, only very few references are known suggesting estimation algorithms (see e .g . Habermayer and Keviczky (1985), Kurz (1979), Kurz and Goedecke (1981».
First the equation
The direct estimation of the discrete time (integer) delay makes the LS estimation strongly nonlinear which is very sensitive for the initial conditions and for the selected recursive technique. (Practically this is the case at a continuous time estimation, however, a rational fraction approximation (e.g., low order Pade in Agarwal and coworkers (1986» can improve the linearity, while the higher order derivatives makes the method noise sensitive.)
gives
h;
A
(
-I) = bo + bl Z-I + ... + bA_M M Z A
A
instead of Z-i: B with an assumed delay
M
=
I
bi
(41)
i=1
Then (42)
The most widely suggested method estimates a BM Z
h;
results in (36)
i.. Here
(43)
M
is the possible maximum value of k. The best A
A
approximating Band k can be found by probing
where (41) was also used. Note that k is not an integer number yet here. In a practical application the best integer approximation of (43) should be used, i.e.
different values of k in a second estimation phase. This phase can be based upon the best approximating impulse responses (see Kurz (1979» or on the best statistical significance of the estimated parameters in
i. =entier(i + 0.5) =;1"
a window determined by i. and the order of B (see Habermayer and Keviczky (1985». In these methods the order of B is n, i.e., equals to the order of A. (Assuming a second order process this means two parameters are to be estimated for SRE models.)
(44)
In the following design steps the formulae (29)-(32)
hi
can be used with h; and i. for the determination of the optimal regulator parameters.
The special structure of Gpo in (8) allows to introduce a very simple new method to estimate and d". This method also estimates the parameters
b;
6. SIMULATION EXAMPLES
EXample 1 475
advantage of the algorithm is that it improves if the sampling interval tends to zero, which is not the case with the application of self-tuning regulators, in general. The only drawback of the method is that the number of parameters to be estimated increases with decreasing sampling time.
Consider the second order process with discrete transfer function given by G" PD
(Z-I)= 1-1.3z 0.1 1+0.
Z-2
4z -2
(45)
where the time delay k = 2 changes to k =3 at t =45 and it is unknown for the adaptive regulator. Here Ro = 100 I, W =0.95 and qo =0 was used at the simulation. The square wave reference signal excitation had a time period 10. The maximal order M=4 was used for
BM(z-I)).
Fig. 6 shows the
(i),
Fig. 7 shows the
true (k) and estimated delay estimated integer delay
(f),
The introduced regulator estimates the process parameters and the time delay simultaneously, therefore we call this one a completely adaptive PID regulator. REFERENCES Agarwal, M. and C. Camidas (1986). On-line estimation of time delay and continuous-time process parameters. American Control Conference'86, Seattle,728-733. Banyasz, Cs. and L. Keviczky (1982). Direct methods for self-tuning PID regulators. 6th IFAC Symp. on Ident. and Syst. Par. Est.,Washington D.e. (USA),1249-1254. Banyasz, Cs., l. Hetthessy and L. Keviczky (1985). An adaptive PI D regulator dedicated for microprocessor based compact controllers. 7th IFAC Symp. on Ident. and Syst. Par. Est., York (UK) ,1299-1304. Farmanfarma, G. (1957). Analysis of linear sampleddata systems with finite pulse width: open loop. Trans. of AIEE, 75, 808-819. Gawthrop, P.l . and M.T. Nihtila (1984). Identification of time delays using a polynomial identification method. Report CE/T/11 ,School of Engineering & Applied Sciences, University of Sussex. Goodwin, G.e., R. Lozano Leal, D.Q. Mayne and R.H. Middleton (1986). Reapproachment between continuous and discrete model reference adaptive control. Automatica, 22,199-207 . Habermayer, M. and L. Keviczky (1985) . Investigation of an adaptive Smith controller by simulation. 7th Conference on Digital Computer Applications to Process Control, Vienna. Keviczky, L. and F. CsaIci (1973). Design of control system with dead-time in the time domain. Acta Technica Academiae Scientiarum Hungaricae, 74,63-84. Keviczky, L. (1979). On the transfer functions of sampled continuous systems. Technical Report, University of Minnesota,Department of Electrical Engineering, Minneapolis (USA). Kurz, H. (1979). Digital parameter-adaptive control of processes with unknown or time-varying deadtime. 5th IFAC Symp. on Ident. and Syst. Par. Est., Darmstadt. Kurz, H. and W. Goedecke (1981). Digital parameter adaptive control of processes with unknown deadtime. Automatica,17, 245-252. Wittenmark, B. (1979). Self-tuning PID controllers based on pole-placement. Report of Dept. of Automatic Control, Lund Institute of Technology.
too. The latter figure
shows the speed of adaptation, which is quite fast. Fig. 8 shows the reference (Yr(t)) and output signals (y(t)) of the closed control loop. After an initial fast adaptation the closed loop transient behaviour became worst at t =45 because of the change in the process delay, but the adaptive regulator converges to the optimal one again. Example 2 Consider a second order process with double poles
and apply the same circumstances used at the previous example. Fig. 9 shows the true (k) and the estimated integer delay
(f).
Example 3 Consider a very oscillating open loop process with
-I) -
G" ( z PD
0.2 Z-2 -1-1.5z-I+0.7z-2
(47)
and use exactly the same circumstances applied at the Example 1. Fig. 10 shows the true (k) and estimated delay
(f).
The reference (Yr(t)) and output (y(t)) signals of the closed control loop can be seen in Fig. 11. 7. CONCLUSION Because the industrial practice has almost no opposition against the implementation of PI D regulators (even if they are adaptive), therefore the adaptive PID regulator described in this paper has a promising future as an application area of adaptive control theory. The introduced method is very simple, it needs the application of a reliable recursive parameter estimation and all other necessary quantities are computed by explicit formulas. Another 476
4
4,---------------------------
1
3
3 A
---
-_. k 2
2
--k
I
II -
I, I
__-
t
o
Fig. 6 Adaptation of a changing process time delay
Fig. 7 Estimation of the discrete time delay
20
40
60
100
80
A
k
I
I t O~--------~--------~----~
o
k
o
20
40
60
80
100
4~------------------------~
5~----------------------_,
4
3 3
k
- - Yr(t) __ y(t)
2
2+r------------~
k
o -1~__~----~--~----~----~~ :l 20 40 100 60 80
o~----
o
Fig. 8 Closed-loop transients of the adaptive regulator 4.-________________________
__--__----__----__----~->-
20
40
60
80
100
Fig. 9 True and estimated integer delay
~
10 8
3
6
k 2
4
-- Yr(t)
2
__ y(t)
A
k
0
o~----~--
o
20
·2
__----~--------_+-t-,40
50
80
t
-4
100
0
Fig. 10 True and estimated delay
20
40
60
80
Fig. 11 Reference and output signals
477
100