Copyright © IFAC Computer Aided Design in Cont rol Systems. Beijing. PRC. 1988
AN EXPERT SYSTEM FOR TUNING PID CONTROLLERS
J.
Lieslehto,
J.
T. Tanttu and H. N. Koivo
Department of Electrical Engineering, T ampere University of Technology, p .a. B ox 527, SF-33JOJ Tampere, Finland
•
Abstract. In this paper a prototype expert system is developed for tuning of PIn controllers for single-input single-output systems. The paper first describes general ideas behind the use of expert systems in computer aided control engineering. Next the functional description of the developed expert system is given. A description of the tuning methods finishes the paper. Keywords. Artificial intelligence; Expert systems; PIn control
INTRonUCTION
p
In this paper a prototype expert system is developed for tuning of PIn controllers for single-input single-output systems. The purpose of the pr~ gram is twofold . To gain experience in constructing useful expert systems and to implement the system with a portable microcomputer for use in start-ups and periodical checks of controllers in industrial plants.
• •
We are now able to implement advanced control strategies using computers. nespite of these advances, PIn controllers are still the most widely used controllers in the industry. Several tuning methods for PIn controllers have been represented in the literature. Knowledge about different tuning methods is needed in the selection and application of the appropriate tuning method. By collecting this knowledge into an expert system a less-than-expert operator can be helped to find better tuning parameters for PIn controllers.
• Figure 1: Three dimensional search space.
for a set-point change as illustrated in Fig. 1. A PIn controller can be tuned by moving in this search space on a trial and error basis.
TUNING OF PID CONTROLLERS
The main problem in PIn controller tuning is that the three tuning parameters, kc, Ti and Td, do not readily translate into the desired performance and robustness characteristics which the control system designer has in mind (Rivera, Morari, Skogestad, 1986). Several tuning rules has been proposed to solve this problem. Using these rules the tuning parameters are calculated
Tuning of PIn controllers is basically a search problem in a three dimensional space. Points in the· search space correspond to different selections of a PIn controller's three tuning parameters. By choosing different points of the tuning space we can produce for example different step responses
34 1
J.
342
Liesle hto, J. T. TanllU and H . N. Koi\'o
p
•
Figure 2: Tuning by simple methods. Figure 3: Methods with fine tuning. from process data, for example from a reaction curve or a critical point. These methods give us one point in the search space, where PID controller tuning should be satisfactory. This case is illustrated in Fig. 2. These simple tuning methods often offer us satisfactory PID controller tuning. But for certain processes these tuning methods produce completely unsatisfactory results. These methods are also always trying to produce similar tunings result, but our definition for a saticfactory tuning result varies for different processes. For example the control system designer might want a fast step response with some overshoot or alternatively a slow step response without any overshoot. The simple tuning methods do not give us any assistance in reaching such goals. To make trade offs between different design objectives possible, fine tuning parameters are added into the tuning methods. This means that a curve is separated from the three dimensional search space. We are able to move along this curve by selecting different values for the fine tuning parameter as illustrated in Fig. 3. The fine tuning parameter is also more closely connected to desired performance and robustness characteristics than PID controller's three tuning parameters. In the expert system the tuning method proposed by Banyasz and Keviczky (1982) uses as its fine tuning parameter the phase margin. The method proposed by Astrom and Hagglund (1984) uses as its fine tuning parameter either the phase margin or the amplitude margin. In the Internal Model
Control (IMC) method (Rivera, Morari, Skogestad, 1986) the fine tuning parameter is the closedloop time constant.
FUNCTIONAL DESCRIPTION The functional description 'o f the expert system is illustrated in Fig. 4. First the user is asked to supply the model. This can be one of the simple transfer function models, for example one time constant and delay, typically used in the process industries or a general transfer function model. In case of a general, high order transfer function model the Routh approximation is applied to find a reduced order model. Another possibility is the critical point model, that is the ultimate gain, the ultimate period and possibly the process delay. The model can also be a discrete time z-transfer function. The last possibility is measurement data from the process. This can be either a step or an impulse response measured from an open-loop system. The system is identified by the method proposed by Nishikawa and others (1984) . Based on the model of the plant the expert system next selects the tuning method to be applied. An initial value is calculated for the fine tuning parameter of the selected method. A sampling time is also suggested for the digital PID controller. Next the selected tuning method is applied and
343
An Expert System for Tu nin g PID Controllers
tv'ODEL INPUT
velopment environment. Numerical methods are coded partly in Common Lisp and partly in Fortran.
TUNING METHODS The tuning methods currently included in the expert system are the critical point method proposed by Astrom and Hagglund (1984), the timeseries model based method proposed by Banyasz and Keviczky (1982) and the Internal Model Control based method proposed by Rivera, Morari and Skogestad (1986) . Astrom-Hagglund Method Astrom and Hagglund propose, in the spirit of the classical Ziegler-Nichols tuning rules, the use of the critical point of the Nyqvist curve of the open loop transfer function for the tuning of the scalar PID controller. Let G( s) be the transfer function of the process and 1 GPID(s) = kp(l + - + TdS) (1) T,S
Figure 4: The functional description of the expert system.
the transfer function of the PID controller. At the critical point for the open loop transfer function
G(jW)
= K(w)e1
(w)
(2)
it holds that the tuning parameters of the PID controller are calculated. The discretized version of the PID controller is also created. This is done using Tustin's approximation. The user is able to analyse the tuning by simulation. Noise can be added to both the controller output and the measurement in simulation. The simulation model can also be different from the design model. This way the user is able to study robustness of the controller. After simulations the user is asked to analyse the simulation results and the tuning. Through the menu interface the user is able to require for example less overshoot for a step response or better robustness of the controller. Based on this qualitative feedback from the user the value of the fine tuning parameter is changed and the PID controller is retuned. In this iterative manner the most satisfactory tuning is searched. The user can also ask the expert system to suggest another tuning method. The expert system is implemented on a Symbolics 3670 computer using KEE expert system de-
1/ Kc
K(w e ) =
!p(w e )
(3) (4)
-'11"
where Wc is the critical frequency and Kc the critical gain. For the PID controlled plant the loop transfer function at critical frequency becomes
The first version of the method uses the phase margin as its fine tuning parameter. For the phase margin !Pm it holds tan !Pm =
1 We Td -
(6)
-WeT,
Several choices of Td and T, satisfy this equation. A possible choice is to set
(7) where a: is a design parameter. Using Eq.(7) it follows from Eq.(6) for the derivation time tan !Pm
+
J~ + tan
2
!Pm
(8)
J.
344
Lies le h LO,
J.
T. T a nttu a nd H . N. Ko ivo
Finally requiring unit gain for the loop transfer function at the critical frequency yields kp = Kc
cos
(9)
The PID controller parameters proposed originally by Ziegler and Nichols (1942) are 0 . 6K e
kp
'/I'
Ti
Figure 5: Open-loop (feedforward) control
(10)
(11)
Wc '/I'
Td
4we
(12)
the ratio a being thus equal to four. Using this value tuning rules Eq.(7), (8) and (9) become kp Ti Td
cos
(13) (14) (15)
The second version of the method uses the amplitude margin as its fine tuning parameter (Tanttu, 1987). From Eq.(5) it follows that by selecting Kc kp= -
Am
and
1 Td= - W;Ti
(16)
(17)
the amplitude margin Am is obtained for the loop transfer function with all choices of integration time Ti. Using the integration time proposed by Ziegler and Nichols Eq.(l1) yields 1 Td= - -
Figure 6: Closed-loop (feedback) control.
(18)
'/I'We
Internal Model Control Rivera, Morari and Skogestad apply in their paper the Internal Model Control (IMC) principle for the design of PID controllers. The idea of IMC was presented by Garcia and Morari (1982) but similar concepts have been used also previously. The goal of our control system design is achieve fast and accurate set point tracking in spite of external disturbances. Furthermore the control system should also be insensitive to modelling errors i.e. robust. If no external disturbances exist and our process model is correct the open-loop control scheme of Fig. 5 is an optimal way to solve the set point tracking problem. Choose simply (19)
where Gm is the transfer function of our process model. The disadvantages of this control scheme are obvious, lack of robustness for modelling errors, inability to cope with un measured disturbances and the fact that the controller is seldom realizable. However, the design procedure is very easy and the control system stability is a trivial issue - system is stable if both the controller and the plant are stable. The feedback control system of Fig. 6, on the contrary, handles quite effectiv~ly plant/model mismatches and unmeasured disturbances but the tuning of the controller and the closed loop stability are not trivial issues. Using the notations of Fig. 6 the closed loop transfer function become
(20)
where r is the setpoint and d the external disturbance. The key idea of IMC controller structure of Fig. 7 is to combine the best of both worlds - the easiness of the feedforward controller design and the ability of the feedback controller to handle external disturbances and modelling errors. This is achieved by relating the feedforward and feedback control transfer functions via transformations (21) (22)
:\n Expert System for Tuning Pl O Con trollers
345
at most 1. Rivera, Morari and Skogestad suggest that a good choice for the filter is
F-
- (1
Figure 7: Internal Model Control. Using the notations of Fig. 7 we obtain 1- GmG o d r+---:::-;-=--'---'--:::--"7 1 + G o(G p - Gm) • (23) If the model is perfect (Gp = Gm) Eq.(23) simplifies to Eq.(20) by using transformation Eq.(21) . If in addition no disturbances exist (d = 0), Eq.(23) reduces to y=
G pG o
1 + G o(G p - Gm)
(24) which is same as the feedforward control structure of Fig. 5. From the controller design point of view IMC is an alternate way to parametrize the feedback controller of Fig. 6. We first design the open-loop controller G o usin the setting of Fig. 7 and then transform it back to conventional feedback controller using Eq.(21) . Unfortunately the controller of Eq.(19) is not realizable for several reasons. If the process model Gm has an unstable zero the controller will be unstable and accordingly the glosed loop system. If the model contains a time delay the controller of Eq.(19) is not causal and thus unrealizable. For strictly proper system models the controller Eq.(19) is improper and thus the controller gain will be infinite for high frequencies. Finally in the real world of modelling errors (G m =I Gp) the closed loop system may be unstable if the controller Eq.(19) is used . To solve these problems the IMC design procedure is divided into two steps. First the model Gm is factored
1
+ cs)n
(27)
When the model is perfect Eq.(27) determines the response of the closed loop system and the smaller the tuning parameter c is the faster the response (and larger the bandwidth) of the closed loop system is. Thus from the performance point of view we should make the tuning parameter c as small as possible but robustness requirements set a lower limit for it. Notice also that high frequency measurement noise should be interpreted as a modelling error and it also sets a lower limit for c. The structure of the controller obtained using the IMC design method depends on the complexity of the process model. In their article Rivera, Morari and Skogestad present a comprehensive list of process models for which the resulting controller is of PID-type (sometimes augmented with a first order lag). The obvious benefit of the IMC method is the direct connection of the fine tuning parameter c to the performance/robustness trade off in the controller design. The main problem is that a PID-type of controller is obtained only for a restricted set of low order models. However, these include the most widely used process models in industry. Banyaaz-Keviczky Method The original Banyasz-Keviczky is based on a time-series plant model of the form
A(Z-l)y(t) = B(Z-l)U(t - k) + d(t)
(28)
where the polynomials A and B are given by =
1 + alz- 1 +a2 z - 2
(29)
bo + b1z- 1
(30)
Clarke (1986) suggest a generalization of their ideas replacing polynomial B with an extended polynomial
(25) so that G+ contains all the time delays and unstable zeroes of the model; consequently G_ is stable and causal. However it may be improper. So the IMC controller is defined by (26) where F is such a low-pass filter that G o is proper or if derivative action is allowed has a zero excess
With this model the integer k is the prior assumed value for the minimum dead-time expected. The polynomial B (z-l) contains n + 1 parameters such that n + k is the maximum value of the dead-time expected, plus 2. The model may be regarded as a generalization of the second order system with a dead time.
J.
346
Liesle hto, J. T. T a nttu a nd H . N. Koivo
A design method is proposed for a discrete PID controller
REFERENCES
(34)
Astrom,K.J. and T.Hagglund (1984) . A utomatic tuning of simple regulators with specifications on phase and amplitude margins.A utomatica,£O, 645-651.
where {r(t)} is the reference sequence and P(z-I) contains the tuning parameters of the controller. The basic idea of the design is to cancel the process poles by selecting
Banya.sz,C. and L.Keviczky (1982). Direct methods for self-tuning PID regulators. IFAC Symposium on Identification, Washington, DC.
(35)
Clarke,D. (1986). Automatic tuning of PID regulators. Expert Systems and Optimisation in ProceslJ Control Technical Press, pp. 85-104.
(1- Z-I)u(t) p(Z-I)
p(z-I)e(t) Po
(32)
+ PIZ- I + P2Z-2
r( t) - y( t)
e( t)
(33)
With this selection the loop transfer function Go becomes (36) Substituting Z-I = e- jwh , where w is the angular frequency and h the sampling interval, and denoting the scaled angular frequency wh with the symbol 0 the design equations become 1
(k- -)O+arctan 2
r:~=o b, sin iO r:n b '0 = --
Garcia,C.E. and M.Morari (1982) . Internal model control. 1. A unifying review and some new results. Ind.Eng. Chem.Process Des .Dev .,£5, 308-323. Nishikawa, Sannomiya, Ohta and Tanaka (1984). A method for auto-tuning of PID control parameters. Automatica, £0, 321-332.
,=0 ,COSt
Rivera,D.E., M.Morari and S.Skogestad (1986). Internal model control. 4. PID controller design. Ind.Eng.Chem.Process DelJ.Dev.,£5, 252-265.
and
We have now obtained the parameters of the PID controller of Eq.(32) in terms of the parameters of the time series model PI P2
= =
POal
(39)
POa2
(40)
The remaining free parameter Po is obtained via specifying the desired phase margin
CONCLUSIONS An expert system for the tuning of PID controllers has been developed. The expert system makes it possible for a less-than-expert user to apply several different methods for tuning of PID controllers. Based on the known information about the plant the expert system is able to select appropriate tuning methods and apply them. The user is able to analyse different tunings by simulation. Based on the user's qualitative feedback of simulation results the expert system is able to retune PID controllers. In this iterative manner the most satisfactory tuning is searched.
Tanttu,J.T. (1987). Tuning of the scalar PID controller. Tampere 'University of Technology, Tampere, Finland Ziegler,J.G. and N.B.Nichols (1942) . Optimum settings for automatic controllers. TranlJ . ASME,6~, 759-768