Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 Predictive Control Design Based on Neural Model of a Non-linear System Anna Jadlovská, Nikola Kabakov, Ján Sarnovský Department of Cybernetics and Artificial Intelligence, Faculty of Electrical Engineering and Informatics, Technical University of Košice, Slovak Republic anna.jadlovska@tuke.sk, nikola.kabakov@gmail.com, jan.sarnovsky@tuke.sk Abstract: This paper provides two approaches for design of Generalized Predictive Control (GPC) algorithm for a non-linear dynamic system. In the classical approach of the GPC strategy the recursive method of least square is considered for calculating of the linearized model parameters from the known analytic description of a particular non-linear system. The other purpose of this paper is to show an intelligent approach in which a feed-forward neural network (Multi Layer Perceptron – MLP) is used for modeling the same non-linear system within the frames of the predictive control. The possibility of on-line estimation of an actual parameters from the off-line trained neural model of the non-linear system by means method of the instantaneous linearization in each sample point is considered in GPC algorithm design. The validity of classical and neural GPC strategy is tested by computer simulations in Matlab/Simulink language using architecture of S-functions of the library PredicLib. Keywords: non-linear dynamic system, neural model, parametric estimation, predictive control algorithm 1 Introduction Model Predictive Control (MPC) is one of the most wide spread advanced control techniques for dynamic systems in the industry. The main idea of MPC algorithms is to solve an optimization problem in order to find the control vector trajectory that optimizes the cost function over a future prediction horizon [2], [3]. This paper provides two approaches for the design of Generalized Predictive Control (GPC) algorithm for non-linear systems. In the classical approach of GPC strategy (part 2) the recursive least square method (RLSM) is considered for the calculation of the linearized model parameters from the known analytic description of the dynamic system [8]. In the intelligent approach is a feedforward neural network (Multi Layer Perceptron – MLP) used for modeling and the estimation of the actual parameters of the non-linear system which are – 93 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System considered in GPC design (part 4-6). The neural model of non-linear system is typically trained in advance, but the GPC controller is designed on-line using the parameter estimation from the neural model. The main idea of this paper is to show how on-line estimation of the actual parameters from off-line trained neural model using the gain matrix is applied in the GPC algorithm [5]. The neural model of non-linear system is linearized by means method of the instantaneous linearization in each sample point and the result of this linearization technique – the estimated parameters from neural ARX model (NARX) of the system are used for design of the GPC algorithm (part 6). The practical simulations by the language Matlab/Simulink, Neural Toolbox and the library PredicLib [6] of this paper illustrate that the classical GPC and the neural GPC strategies using linearization technique can be used for predictive control of a particular non-linear dynamic system. 2 GPC Algorithm - Classical Approach The calculating of the cost function for optimal control for the k-th step can be considered as J (k ) = N2 Nu j = N1 j =1 ∑ e 2 ( k + j / k ) + ∑ λ Δu 2 ( k + j / k ) (1) where for the predictive horizons holds N1 ≥ 1 , N2 ≥ N1, 1 ≤ Nu ≤ N2 , λ is the positive weight coefficient and e(k + j / k ) = yˆ (k + j / k ) − r(k + j / k ) is the prediction error, where yˆ( k + j / k ) is the predicted system output value and r ( k + j / k ) is the system output required value. By [8] the most SISO (Single-Input/SingleOutput) systems when is considered the operation around a particular set-point and after linearization can be described by the linear discrete AutoRegresive model with eXternal input (ARX). Using the modification of ARX model we can get CARIMA (Controlled AutoRegresive Integrate Moving Average) model which is used in GPC algorithm [2] and is described by eq. (2) A(q −1 ) y (k ) = B(q −1 )u (k − 1) + C ( q −1 ) Δ ξ (k ) (2) where A(q-1), B(q-1), C(q-1) are the polynomials of the delay operator q-1: A(q −1 ) = 1 + a1q −1 + a2 q −2 + ... + ana q − na , B(q −1 ) = b0 + b1q −1 + b2 q −2 + ... + bnb q − nb , C (q −1 ) = 1 + c1q −1 + c2 q −2 + ... + cnc q − nc In the equation (2) ξ ( k ) is a white noise with zero mean and Δ = 1 − q −1 . According [2] the future output value of the system is given by (3) – 94 – Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 yˆ(k + j / k ) = Gj (q−1 )Δ u(k + j −1) + Γ j (q−1 )Δ u(k −1) + Fj (q−1 ) y(k ) (3) In the equation (3) the polynomials G j ( q −1 ) , Γ j ( q −1 ) and F j ( q −1 ) are calculated by solving of Diophantine equations: C (q −1 ) = E j (q −1 ) A(q −1 )Δ + q − j F j (q −1 ) B (q −1 ) E j (q −1 ) = G j (q −1 )C (q −1 ) + q − j Γ j (q −1 ) The predictor (3) can be written as yˆ = GΔu + F (q −1 ) y (k ) + Γ (q −1 )Δu (k − 1) (4) where ⎡ yˆ( k + N1 / k ) ⎤ ⎢ yˆ( k + N + 1/ k ) ⎥ 1 ⎥, yˆ = ⎢ ⎢ ⎥ M ⎢ ⎥ ˆ( y k + N / k ) 2 ⎣ ⎦ ⎡ g N1 ⎢ g N +1 G = ⎢⎢ 1 M ⎢ ⎢⎣ g N 2 Δu(k) ⎡ ⎤ ⎢ Δu(k +1) ⎥ ⎥, Δu = ⎢ ⎢ ⎥ M ⎢ ⎥ Δu(k + N -1) u ⎣ ⎦ g N1 −1 L g N1 − Nu +1 ⎤ ⎡ Γ N1 (q -1 ) ⎤ ⎡ FN1 ( q −1 ) ⎤ ⎢ ⎥ ⎢ ⎥ ⎥ -1 −1 g N1 L g N1 − Nu + 2 ⎥ ⎢ Γ N1 +1 (q )⎥ ⎢ FN1 +1 ( q ) ⎥ -1 −1 , Γ (q ) = ⎢ ⎥ , F (q ) = ⎢ ⎥. M O M ⎥ M M ⎢ ⎥ ⎢ ⎥ ⎥ ⎢⎣ Γ N 2 (q -1 ) ⎥⎦ ⎢⎣ FN2 ( q −1 ) ⎥⎦ g N 2 −1 L g N2 − Nu +1 ⎥⎦ Because two last items of (4) depends only on the previous states, we can include those into one item f, then the equation of the predictor is ŷ = GΔu + f. The cost function (1) can be written in the matrix form for the computing of an optimal control J = (GΔu + f − r )T (GΔu + f − r ) + λ ΔuT Δu (5) where r = [ r ( k + N1 ), r ( k + N1 + 1),..., r ( k + N 2 )] is the reference trajectory and λ T is the weight coefficient. The equation (5) can be written as J= 1 T Δu HΔu + bT Δu + f 0 2 (6) where H = 2(G T G + λ I ) , bT = 2( f − r )T G , f 0 = ( f − r )T ( f − r ) . The minimum of the cost function J can be found by making gradient of J equal to zero, which leads to Δu = − H −1b = −(G T G + λ I ) −1 G T ( f − r ) . – 95 – (7) A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System The result of this equation is the trajectory consisting from the increments of the control signal and the first of them is applied on the system and is given by: Δu (k ) = K (r − f ) , where K is the first row of the matrix (G T G + λ I ) −1 G T , so an actual controller output value is u (k ) = u (k − 1) + K (r − f ) . For the systems with the constrains on the controller output value, on the controller increment output value or on the system output value, the vector Δu is calculated by function quadprog of Optimization Toolbox of the language Matlab Δu = quadprog (H, b T, LCON, v, UMIN, UMAX), where UMIN ≤ Δu ≤ UMAX , LCON Δu ≤ v. The vectors UMIN and UMAX are the column vectors those elements are minimal and maximal values of Δu(k). With using the matrix LCON and the vector v can be defined the system of an inequalities which insures that constrain conditions will be satisfied [6]. LCON 1 ⎡1 ⎢1 =⎢ ⎢# ⎢ ⎣1 LCON 2 ⎡ −1 0 ⎢ −1 −1 =⎢ ⎢# # ⎢ ⎣ −1 −1 0 1 # 1 " 0⎤ ⎡ ⎡1⎤ ⎤ " 0 ⎥⎥ ⎢ ⎥ , v1 = ⎢( uMAX − u (k − 1) ) . ⎢⎢# ⎥⎥ ⎥ ⎥ % # ⎢⎣ ⎢⎣1⎥⎦ ⎥⎦ ⎥ " 1⎦ 0⎤ ⎡ ⎡ −1⎤ ⎤ 0 ⎥⎥ ⎢ ⎥ , v2 = ⎢( uMIN − u (k − 1) ) . ⎢⎢ # ⎥⎥ ⎥ % #⎥ ⎢⎣ −1⎥⎦ ⎦⎥ ⎥ ⎣⎢ " −1⎦ " " ⎡ ⎤ ⎡1⎤ ⎢ ⎥ LCON 3 = G, v3 = ⎢ yMAX . ⎢⎢# ⎥⎥ − F (q −1 ). y (k ) − Γ (q −1 ).Δu (k − 1) ⎥ ⎢⎣ ⎥⎦ ⎢⎣1⎥⎦ ⎡ ⎤ ⎡ −1⎤ ⎢ ⎥ LCON 4 = −G, v4 = ⎢ yMIN . ⎢⎢ # ⎥⎥ + F (q −1 ). y (k ) + Γ (q −1 ).Δu (k − 1) ⎥ ⎢⎣ ⎥⎦ ⎢⎣ −1⎥⎦ LCON ⎡ LCON 1 ⎤ ⎡ v1 ⎤ ⎢L ⎥ ⎢v ⎥ = ⎢ CON 2 ⎥ , v = ⎢ 2 ⎥ ⎢ v3 ⎥ ⎢ LCON 3 ⎥ ⎢ ⎥ ⎢ ⎥ L ⎣v4 ⎦ ⎣ CON 4 ⎦ In the programmable environment Matlab/Simulink was designed GPC algorithm for the dynamic non-linear SISO system using S-functions. Algorithm GPC for the calculation of the control signal value for the k - th step: – 96 – Acta Polytechnica Hungarica 1 Vol. 5, No. 4, 2008 reading of the polynomials A(q-1), B(q-1), C(q-1) of the linearized discrete model (2) of the non-linear system, the reference vector trajectory r(k) and the output of the system y(k), 2 cyclical calculating of the polynomials Gj(q-1), Γj (q-1) and F(q-1) by solving Diophantine equations for j = 1, 2, .., N2, 3 creating of the matrixes G, Γ and F, 4 if is required the constrain for the values of u(k), Δu(k) or y(k), then continue by the step 8, 5 calculating of the feedback gain of the control vector K, 6 calculating of the controller output increment Δu(k) = K (w – f), 7 continue by the step 12, 8 creating of the matrix LCON and vectors v, UMIN, UMAX, 9 calculating of the matrixes H and b T, 10 Δu = quadprog(H, b T, LCON, v, UMIN, UMAX), 11 Δu(k) is the first element of the vector Δu, 12 u(k) = u(k-1) + Δu(k), k = k+1 and continue by the step 1. 3 Verification of GPC Algorithm for a Non-linear System by Simulation The simulation model of the non-linear system consists of two tanks, one cylindrical and the other spherical with the free outflow. The inflow to the first tank is controlled by the relative open of the valve V1. The outflow from the first tank is an inflow to the second one. The physical variables and the parameters of the hydraulic system which is described in Fig. 1 are: h1(t) [m] - the water level in cylindrical tank, h1MAX(t) [m] - the max water level in cylindrical tank, h2(t) [m] - the water level in the spherical tank, h2MAX(t) [m] - the max water level in the spherical tank, M1 (t) [kg/s] - the mass inflow to the cylindrical tank, M2 (t) [kg/s] - the mass inflow to the spherical tank, – 97 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System M3 (t) [kg/s] - the mass outflow from the spherical tank, MZ1 (t) [kg/s] - the disturbance mass inflow to the cylindrical tank, MZ2(t) [kg/s] - the disturbance mass inflow to the spherical tank, u1(t) - the rise of an input outlet of the cylindrical tank, S [m2] - the tank’s bottom area, S1 [m2] - the area of the outflow of the cylindrical tank, R [m] - the diameter of the spherical tank, S2 [m2] is the outflow space of spherical tank. Figure 1 Model of the hydraulic system For changing the levels h1(t) and h2(t) according to [6] it holds that dh1 (t ) = M 1 (t ) − M 2 (t ) + M Z 1 (t ) dt dh (t ) ρπ (2 Rh2 ( t ) − h22 ( t )) 2 = M 2 (t ) − M 3 (t ) + M Z 2 (t ) dt ρS (8) The mass flows M1(t), M2(t) and M3(t) can be described by the equations (9), where kV1 is the constructing constant of the input outlet of the cylindrical tank and f(u1(t)) is characteristic function of the valve V1 M 1 (t ) = kV 1 f (u1 (t )) M 1MAX , M 2 (t ) = ρ S1 2 gh1 (t ), M 3 (t ) = ρ S2 2 gh2 (t ) – 98 – (9) Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 The mass inflow M1(t) depends on the relative open value of u1 (t ) ∈ 0,1 and on the value of maximal mass inflow M1MAX. Let the function f(u1(t)) be linear. Then the equation for the mass inflow can be written as M 1 (t ) = kV 1u1 (t ) M 1MAX (10) After inducting equations (9) and (10) to the equations (8) we obtain non-linear differential equations (11) describing dynamics of the changing levels in the simulation model - two tanks without interaction dh1 (t ) kV 1u1 (t ) M 1MAX − ρ S1 2 gh1 (t ) + M Z 1 (t ) = dt ρS dh2 (t ) ρ S1 2 gh1 (t ) − ρ S2 2 gh2 (t ) + M Z 2 (t ) = dt ρπ (2 Rh2 (t ) − h22 (t )) (11) By expansion to Taylor series for the set-point SP = [u10, h10, h20] we obtain the linearized model, which can be written by Laplace transformation as transfer functions FH 2 / U1 ( s ) and then using Z-transformation can be obtained the discrete transfer function of the dynamic system F ( z ) = B ( z ) / A ( z ) . For verification of designed GPC algorithm was used the simulation language Matlab/Simulink. The functional block of GPC controller is included into the library PredicLib [6]. The parameters of the simulation model of the hydraulic system are M1MAX = 500kg/s, h1MAX = 6m, S = 7.07m2, S1 = 0.0314m2, R = 1.5m, S2 = 0.0314 m2 and ρ = 1000 kg/m3. For the calculation of the linearized model parameters the recursive method of the least square was used for the set-point SP that corresponds to the actual value of the system output h2(t). After conversion of the discretized transfer function to time area operator z is substituted with operator q. By this way the polynomials A(q-1) and B(q-1) of the discrete CARIMA model (2) can be acquired. The polynomial C(q-1) is time invariant and is chosen to be equal to one. The orders of discrete model´s polynomials are na = 2, nb = 2 and nc = 0. The prediction horizon for the output of the system is chosen on ten steps forward and for the control signal on five steps, so N1 = 1, N2 = 10, Nu = 5. The sample period is TVZ = 10s. Next is necessary to consider the constrains for the control signal value and the system output value because u1 (t ) ∈ 0,1 and h2 (t ) ∈ 0,3 . The weight coefficient for the control signal value increment Δu(t) is λ=0.1. The control scheme of the simulation in an environment Matlab/Simulink is described in Fig. 2. – 99 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System [W(:,1),W(:,3:12)*2] ref(t) y(t) Vector of reference trajectory A(z) u(t) B(z) 1 u1(t) C(z) h1(t) h2(t) Mz2(t) Adaptive GPC Disturbance Mz1 SISO Mz2(t) C(z) h1(t) Mz1(t) Mz1(t) Coupled tanks, one cylindrical and one spherical Disturbance Mz2 Mux Sum Mux u(t),h2(t),ref(t) -KGain Band-Limited White Noise B(z) h2(t) A(z) [w(:,1),w(:,2)*2] Reference value Figure 2 The simulation predictive control scheme – classical approach On the output of the system have effect disturbance in the form of the white noise that simulates the measurement error. Also the disturbance mass inflows MZ1 and MZ2 act on the system. The disturbance mass inflow to the cylindrical tank has value MZ1 = 50kg.s-1 and acts on in time from 2500s to 3500s. The disturbance mass inflow to the spherical tank have value MZ2 = 20kg.s-1 and acts on in time from 6500s to 7500s. The result of tracking of the reference trajectory ref(t) by the system’s output h2(t) using GPC algorithm is on Fig. 3. The output of the GPC controller – the optimal control signal u1(t) is described in Fig. 4. 2 1.8 ref(t) h2(t) 1.6 1.4 1 2 h (t) [m] 1.2 0.8 0.6 0.4 0.2 0 0 1000 2000 3000 4000 5000 t [s] 6000 7000 8000 9000 10000 Figure 3 Tracking the reference trajectory ref(t) by the output of the non-linear system h2(t) – 100 – Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 1 0.9 0.8 0.7 u(t) 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1000 2000 3000 4000 5000 t [s] 6000 7000 8000 9000 10000 Figure 4 The GPC controller output – control signal u1(t) 4 Predictive Control Structure Using Parameter Estimation from a Neural Model Next we will consider about the GPC algorithm design for a non-linear system (hydraulic two tanks system) using the neural model of NARX structure [2], [7]. The predictive control scheme using the estimation the system parameters from off-line trained neural NARX model, which are applied in the algorithm of GPC, is illustrated on Fig. 5. estimated parameters ai(k), bi(k) Prediction output of the process yref(k) GPC controller Neural model of process u(k) y(k) Process Figure 5 The predictive control scheme based on the neural model - intelligent approach The loop consists of the controlled non-linear hydraulic system described by the equations (11), the neural process model of NARX structure and GPC controller. Because GPC algorithm needs parameters of a linear model of the dynamic system, in this paper a linear model is extracted from the non-linear neural NARX – 101 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System model by calculation of the gain matrix (part 5). The estimated parameters of the dynamic system from off-line trained neural model are applied for the calculation of the predictor by algebraic theory which is used in GPC algorithm [5], [6]. The optimal predictive controller output vector Δuopt is determined by minimization of the cost function (1). The first term in the cost function refers to the square variation of the predicted system output from the desired reference trajectory, while the second term is added in order to limit the controller output, greater λ yields less active the controller output. The first element of the calculated optimal controller output vector is directed to the hydraulic system input. The remaining vector elements are not utilized and the entire procedure is repeated at the time t = ( k + 1) TVZ , (the principle of receding horizon) [3]. The first prediction horizon N1 is usually chosen to be 1. The choice of the second prediction horizon N 2 and the control horizon N u are: N 2 is usually chosen as to cover the most of the control system’s transient, while N u , which denotes the significance of the future controller outputs shouldn’t be greater then N 2 / 2 . 5 Neural Model of a Non-linear Dynamic System In this part we will discuss some basic aspects of the non-linear system identification using from among numerous neural networks structures only MultiLayer Perceptron – MLP (a feed-forward neural network) [1], [9] with respect to the model based neural predictive control, where the control law is based upon the neural model. We will use in this paper a feed-forward neural network MLP with a single hidden layer. This structure is shown in the matrix notation in Fig. 6 [5], [7]. The matrix W1 represents the input weights, the matrix W2 represents the output weights, Fh represents a vector function containing the non-linear (tanh) neuron functions. The “1” shown in Fig. 6 together with the last column in the matrix W1 gives the offset in the network. The network input is represented by ) vector Z in and the network output is represented by vector Z out . The mismatch ) between the desired output Z out and an aproximated output Z out is the prediction error E . The output from the neural network MLP can be written as ⎛ ⎡Y ⎤ ⎞ X 2 = W2 Fh ⎜ W1 ⎢ 0 ⎥ ⎟ . ⎝ ⎣ 1 ⎦⎠ (12) From a trained MLP by Back-Propagation Error Algorithm (BPA – the first-order gradient method) a gain matrix M can be found by differentiating with respect to – 102 – Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 the input vector of the network. The gain matrix M can be calculated using (12) as M= dZˆ out dX 2 dX 2 dY1 dX1 = = . T . T = W2 .Fh´ ( X 1 ) .W1* T T dZ in dYo dY1 dX1 dYo where W1* (13) W1 (excluding the last column). The above mentioned the gain matrix M allows an on-line estimation of the actual parameters from an off-line trained neural model of the non-linear system. Zin X1 Y0 1 Fh Zout X2 Zˆ out Y1 W1 W2 +E - Figure 6 The matrix block diagram of the neural network MLP With the inspiration from linear ARX model described in [8], next we will use a general model structure suitable for representing the dynamics of a wide range of non-linear system – neural ARX model (NARX) [4], [10], which is defined by Yˆ (k ) = FN (Y (k − 1),...,Y (k − p ),U (k − 1),...,U (k − m ),θ ) Y (k ) = Yˆ (k ) + E (k ) (14) where FN is the unknown non-linear vector function to be approximated, E(k) is the prediction error, p and m denote the number of delayed outputs and inputs. The non-linear mapping FN can be approximated by a feed-forward neural network, e.g. MLP. The feed-forward neural network FN is configured to represent the NARX model by applying p delayed values of the system output and m delayed values of the system input to the network inputs and assigning it’s output Ŷ(k) to be Y(k), θ is the vector of the network parameters. An optimal value of the network parameters is usually obtained by using a training algorithm BPA that minimizes the following cost function: N ( J NN (θ ) = ∑ Y ( i ) − Yˆ ( i, θ ) i =1 ) 2 (15) on the basis of this gradient with respect to the network parameters. N in equation (15) is the length of input-output data set used for the network training. – 103 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System We will consider that the neural NARX model has the input vector Zin and the output vector Ẑ out : Zin (k ) = {Y (k −1),K,Y (k − p),K, U (k −1),K, U (k − m)} Zˆ (k ) = Yˆ (k ) (16) out After training the neural network MLP by BPA the actual gain matrix M(k) can be on-line estimated and calculated for neural ARX model as M(k) = dZˆ out ( k ) dZinT ( k ) { = dYˆ ( k ) d {Y ( k −1) ............ U ( k − m) = −aˆ1 ( k ) K − aˆ p ( k ) bˆ1 ( k ) K bˆm ( k ) } } T = (17) where âi (k ) for i=1,…, p, b̂i (k ) for i = 1, …, m are estimated parameters of the neural NARX model for step k . Using the method of an instantaneous linearization we can extract the parameters of the dynamic system from an off-line trained neural model using the gain matrix [5], [6] instead an estimation parameters of the linear model by the method of the least square. The GPC algorithm uses these estimated parameters from the neural model for control signal calculation. 6 Simulation Results of GPC Algorithm based on Neural Model – Intelligent Approach The results of the estimation the system parameters from an off-line trained neural NARX model and their application in GPC algorithm using an algebraic theory are presented for a non-linear test SISO system – two tanks system (11). The output of the system is the water level in the second tank y (t ) = h2 (t ). . We consider NARX model with 4 inputs and 6 neurons in the hidden layer. The activation functions in the hidden layer are „tanh“ functions and in the output layer is selected a linear function. The actual values of the estimated parameters can be obtained from the gain matrix M (k ) by (17). The GPC algorithm in the k - th step consists the following calculations: 1 the real output of the system (11) y (k ) is measured, 2 the calculation of the linearized parameters âi ,b̂i from the neural NARX model by the gain matrix (17), – 104 – Acta Polytechnica Hungarica Vol. 5, No. 4, 2008 3 the estimated parameters are implemented in the GPC algorithm and an optimal control value is obtained by minimized the cost function (1), 4 an optimal control value is applied on the system input, 5 k = (k+1)TVZ and go to step 1. The implementation of the resulting GPC controller including a neural network model for parameter estimation is shown on Fig. 7. [W(:,1),W(:,3:12)*2] Vector of referenc e trajectory 1 ref (t ) y (t ) A(z) u 1(t ) u (t ) B(z) Mz1(t) C(z) Adapti ve GPC Disturb ance M z1 SISO Mz2(t) C(z) h1(t) h1(t) Mz1(t ) Di sturbance Mz 2 Mz2(t ) h2(t) Coupl ed tanks, one c yli ndri cal and one spheri cal Mux Sum Mux u(t),h2(t),re f(t) -KBand-Li mi ted White Noi se Gain B(z) A(z) y (t ) N ETin N ETin(t) u (t ) Extracting of ARX m odel parameters from NARX NET in [w(:,1),w(:,2)*2] Referenc e val ue Figure 7 The GPC control scheme using neural model The presentation of the results of GPC strategy using on-line parameter estimation from an off-line trained neural model is illustrated on Figs. 8 and 9, where the noise of measurement – the white noise is added to the output of the system (11) at N1 = 1, N 2 = 10 , N u = 5, λ = 0.1 . The disturbances input flows are added to the input of the non-linear system. The plot on Fig. 8 compares the reference output of the system h2ref(t) and the actual output of the closed-loop system h2(t). A perfect model-following behaviour is achieved, although we can see an oscillating control signal on Fig. 9. This simulation example shows the possibility of an application of the neural modeling using the structure ARX known from the theory of the linear identification and also the possibility to apply GPC algorithm known from linear control theory for the control of non-linear SISO systems which have no the hard nonlinearities in the control structure in Fig. 5. – 105 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System 2.5 ref(t) h 2 (t) ref(t),h2(t) [m] 2 1.5 1 0.5 0 0 1000 2000 3000 4000 5000 t[s] 6000 7000 8000 9000 10000 Figure 8 Tracking the reference trajectory ref(t) by the output of the non-linear system h2(t) using the parameter estimation from neural NARX model 0 .7 0 .6 0 .5 u(t) 0 .4 0 .3 0 .2 0 .1 0 0 1000 2000 3000 4000 5000 t[s ] 6000 7000 8000 9000 10000 Figure 9 The control signal of the GPC controller based on parameter estimation from neural NARX model The library PredicLib is created as a software tools by Simulink and Matlab language built-in functions. It contains blocks of Model Predictive Control (MPC) algorithms, concrete GPC algorithms for SISO and MIMO systems and MPC algorithms based on the state space model of the systems. PredicLib (Fig. 10) contains also the blocks for an extracting of the parameters from neural NARX model and extracting of the discrete state space model parameters from neural Nonlinear Innovation State Space (NISS) model of the controlled system, a block of the discrete Kalman estimator and a block for conversion of the discrete state space model to the transfer function. Some demo simulations of MPC algorithms for the control of the linear and the non-linear systems are included in the library. Some of the predictive control algorithms blocks demo applications created by using Matlab Web Server are accessible Virtual laboratory CyberVirtLab [http://cyberneticsmws.fei.tuke.sk/MatlabWebServer_welcome]. – 106 – Acta Polytechnica Hungarica ref (t) y (t) Vol. 5, No. 4, 2008 ref (t) u(t) y (t) GPC SISO GPC MIMO ref (t) ref (t) y (t) y (t) A(t) u(t) u(t) ref (t) x(t) u(k) A(z) MPC based on state space model Extracting of ARX model parameters from NARX ref (t) u(t) A(t) B(t) B(t) B(t) C(t) C(t) C(t) GPC MIMO Adaptive D(t) GPC SISO Adaptive NETin NETin u(t) C(t) A(t) Extracting of DSS model parameters from NISS xe(k) Discrete Kalman estimator D(t) B(t) x(t) A(t) y (k) B(t) u(t) B(t) A(t) num(z) den(z) Transformation of DSS to T F MPC based on state space model Adaptive GPC_SISO_DISC GPC_SISO_DISC_A GPC_SISO_CON GPC_SISO_CON_A GPC_MIMO_DISC GPC_MIMO_DISC_A GPC_MIMO_CON GPC_MIMO_CON_A MPC_SISO_DISC MPC_SISO_DISC_A MPC_SISO_CON MPC_SISO_CON_A GPC_SISO_ILIN GPC_SISO_RMNS GPC_SISO_NARX GPC_SISO_NISS Trainig data Verification Figure 10 Screenshot of the library PredicLib from Simulink Conclusion In this paper are presented two approaches - classical and intelligent for the design of GPC algorithm for a non-linear system. The disadvantage of the classical approach of GPC strategy using as linearization technique for an estimate parameters of the dynamic model is that analytic description of non-linear system must be given. If analytical model of the dynamic system is unknown the better solution is to use an intelligent approach – GPC based on the neural NARX or NISS model for MIMO non-linear systems. In this paper is neural NARX model trained as an one-step predictor for a non-linear SISO system. After training this NARX model was used for on-line estimation of the system parameters which allow to calculate a linear predictor. This linear predictor of the system was used for solving of an optimization problem of GPC algorithm. The practical simulations by the language Matlab/Simulink, Neural Toolbox and PredicLib illustrate, that this intelligent neural GPC control strategy using linearization technique by the gain matrix produces more excellent performance for control of the non-linear system as GPC strategy using of the classical approach. Applying the principle of an instantaneous linearization to the GPC design gives tremendous advantages over the conventional nonlinear predictive control design. – 107 – A. Jadlovská et al. Predictive Control Design Based on Neural Model of a Non-linear System Acknowledgment This research has been supported by the Scientific Grant Agency of Slovak Republic under project Vega No. 1/0617/08 Multiagent Network Control Systems with Automatic Reconfiguration. References [1] S. Chen, S.Billings, P. Grant: Non-linear System Identification Using Neural Networks, International Journal of Control 51, No. 6, pp. 11911214, 1990 [2] D. W. Clarke, C. Monthadi, P. S. Stuffs: Generalized Predictive Control, Automatica, Vol. 23, pp. 137-148, part 1, part 2, 1987 [3] C. E. Garcia, D. M. Prett, M. Morari: Model Predictive Control: Theory and Practise – A Survey, Automatica, Vol. 25, pp. 335-348, 1989 [4] A. Jadlovská, J. Sarnovský: Using of Dynamic Neural Models in Feedforward Control Structure”, in Automatizace - Journal of Automation, No. 4, Vol. 46, pp. 236-241, Praha, ISSN 0005-125X, (in Slovak), 2003 [5] A. Jadlovská: Modeling and Control of Dynamic Processes Using Neural Networks, FEI-TU, Košice, Informatech Ltd., p. 173, ISBN 80-88941-22-9, (in Slovak), 2003 [6] N. Kabakov: Predictive Control of Non-linear Processes, Thesis to Dissertation Exam, FEI-TU Košice, 53 pages, (in Slovak), 2006 [7] I. J. Leontaritis: Input-Output Parametric Models for Non-linear Systems, Part 1, Part 2, International Journal of Control, No. 2, Vol. 41, pp. 303-344, 1985 [8] L. Ljung: System Identification, Theory for User, Prentice Hall, 1987 [9] K. S. Narendra, A. U. Levin: Identification and Control of Dynamical Systems Using Neural Networks, IEEE Transaction on Neural Networks 1, No. 1, pp. 4-27, 1990 [10] M. Norgaard: NNSID Toolbox, Technical report, Department of Automation, DTU, 1997 – 108 –