Acta Polytechnica Hungarica Vol. 6, No. 2, 2009 The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic Martin Kratmüller SIEMENS PSE sro Slovakia Dúbravská cesta 4, 845 37 Bratislava, Slovak Republic E-mail: martin.kratmueller@siemens.com Abstract: Fuzzy adaptive tracking controllers for a class of uncertain nonlinear dynamical systems are proposed and analyzed. The controller consists of adaptive and robustifying components whose role is to nullify the effect of uncertainties and achieve a desired tracking performance. The interactions between the two components have been investigated. We use the Takagi-Sugeno-Kang type of the fuzzy logic system to approximate the controller. It is proved that the closed-loop system using this adaptive fuzzy controller is globally stable in the sense that all signals involved are bounded. Finally, we apply the method of direct adaptive fuzzy controllers to control an inverted pendulum and the simulation results are included. Keywords: adaptive fuzzy approach, nonlinear plant, T-S-K fuzzy logic 1 Introduction Designing a control law requires a model of the plant to be controlled. However, a plant model of a physical system usually contains uncertainties. There are currently two approaches to deal with uncertainties-adaptive control and robust control. The adaptive control scheme reduces uncertainties by learning them. Most of the adaptive controllers involve certain types of function approximators in their learning mechanism (see, for example [1]-[5]). In this proposed controller, we use fuzzy logic based approximators. The learning rate of adaptation law is relatively slow and this can lead to a prolonged transcient response. In contrast, a robust control scheme focuses on compensating the uncertainties by employing high gain. By combining the two control schemes, the resulting adaptive robust control techniques have all the advantages of the robust and adaptive control. The adaptive control scheme attempts to determine all of the uncertainties whose characteristics cannot be captured by the learning mechanism of the adaptive control part. Examples of such approaches are reported in the papers [6]-[10], among others. –5– M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic This paper also combines the adaptive and robust approaches in the proposed tracking controller architecture. A fuzzy logic-based function approximator is used for the purpose of learning system uncertainties. The robustifying term of the controller compensates for the modeling inaccuracies. We derive a bound on the steady-state tracking error as a function of the controller’s gain. Specifically, We give an expression for an uncertainty region of the tracking error. The proposed controller guarantees the uniform ultimate boundedness of the tracking error. We use other fuzzy logic systems that are different from those used in ([2] and [3]). This form of the fuzzy logic system is called the Takagi-Sugeno-Kang type. And the consequent part of the fuzzy rules is based on the locally linear feedback control theory. In Section 2, the considered problem formulation is shown. In Section 3, the utilized fuzzy logic system is described. The main result is presented is Section 5. In Section 6, the proposed design steps of the direct adaptive fuzzy controller are used to control an inverted pendulum system. Some conclusions of this paper are given in last Section. 2 Problem Formulation Consider the n-th order nonlinear systems of the form x (n ) = f (x, t) + bu y=x (1) where f is unknown but bounded function, b is positive unknown constant and u ∈ R , y ∈ R are the input and output of the system, respectively. Let x = [x, x, , x (n −1) ]T = [x1 , x 2 , , x n ]T ∈ R n be the state vector of the system which is assumed to be available. Let x d = x d ( t ) = [x d ( t ) , x d ( t ) , and let e = x − x d = [e, e, , x (dn −1) ( t )]T denote the desired state trajectory , e(n −1) ]T . We wish to construct a controller u such that lim e ( t ) = 0 . t →∞ 3 Description of the T-S-K Fuzzy Logic System The fuzzy rule base contains a collection of fuzzy IF-THEN rules R l : IF x1 is F1l and u = K1l x1 + K l2 x 2 + and x n is Fnl THEN + K ln x n (2) –6– Acta Polytechnica Hungarica Vol. 6, No. 2, 2009 where Fil is the label of the fuzzy set in i, K il is the constant coefficient of the consequent part of the fuzzy rule for l = 1, 2,… . The product operation for the fuzzy implication and the singleton fuzzifier technology, the final output values is ⎛ M u (x) = l =1 ⎝ ⎞ n ∑ ⎜⎜ ∏ μ i =1 Fil ( x i ) ⎟⎟ ⋅ ( K1l x1 + K l2 x 2 + ⎠ ⎛ ⎜ ⎜ l =1 ⎝ M n ∑∏ i =1 + K ln x n ) (3) ⎞ μ Fl ( x i ) ⎟ i ⎟ ⎠ where μ Fl ( x i ) are the membership function for i = 1, 2,… , n and l = 1, 2,… , M . i If the μ Fl ( x i ) ‘s are fixed and the K il ‘s is viewed as adjustable parameter, then i (3) can be rewritten as u ( x ) = θT ξ ( x ) (4) where θ = ⎡ K11 ,… , K1n , K12 ,… , K 2n ,… , K1n ,… , K nn ⎤ ⎣ ⎦ ( T is a parameter vector and ξ ( x ) = ξ11 ( x ) ,… , ξ1n ( x ) , ξ12 ( x ) ,… , ξn2 ( x ) ,… , ξ1n ( x ) ,… , ξ nn ( x ) ) T is a regressive vector with the regressor ξlj ( x ) defined as [1] ⎛ ⎜ ⎜ ξlj ( x ) = ⎝ ⎞ n ∏μ i =1 ⎛ ⎜ ⎜ l =1 ⎝ M Fil n ∑∏ 4 i =1 ( x i ) ⎟⎟ ⋅ x j ⎠ (5) ⎞ μ Fl ( x i ) ⎟ i ⎟ ⎠ Projection Operator Consider a vector-valued function of time T θ ( t ) = ⎡ K11 ( t ) ,… , K1n ( t ) , K12 ( t ) ,… , K 2n ( t ) ,… , K1n ( t ) ,… , K nn ( t ) ⎤ ∈ R m ⎣ ⎦ (6) where i = 1,… , m . We wish the components θi to be between θiL and θiU , that is, θiL ≤ θi ( t ) ≤ θiU . One way how to achieve this goal is by setting θi ( t ) = 0 when θi ( t ) reaches either of the bounds and tends to go beyond the bound, that is [11], –7– M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic ⎧ 0 θi = θiL and θi ( t ) < 0 ⎪⎪ U θi ( t ) = ⎨ θi = θi and θi ( t ) > 0 ⎪θ ( t ) otherwise ⎪⎩ i (7) For compactness, we use the notation Proj for the right hand side of (7). Thus, we ( ) () can write θi ( t ) = Pr ojθi θi , i = 1,… , m , or in vector notation, θ ( t ) = Pr ojθ θ . 5 Control Law Development We assume that function f ( x ) in unknown to us. We approximate f ( x ) using fuzzy logic system θTf ξ f ( x ) . Let θ*f = arg min sup f ( x ) − θTf ξ θ*f be „optimal“ constant vectors such that f (x) (8) θ*g = arg min sup g ( x ) − θTg ξ (x) (9) θf x∈Ω θg x∈Ω g where Ω ⊆ R n is a region in which the state x is constrained to reside. We assume that f ( x ) − θ*f ξf ( x ) ≤ d f ∀ x ∈Ω (10) g ( x ) − θ*g ξ ∀ x ∈Ω (11) T T g ( x ) ≤ dg where d f > 0 , d g > 0 and each element of θ*f is a constant and bounded below and above as follows θfLi ≤ θ*fi ≤ θfUi ∀ 0 < θgLj ≤ θ*g j ≤ θgUj i = 1,… , rf (12) ∀ (13) j = 1,… , rg or in vector notation θfL ≤ θ*f ≤ θfU and θgL ≤ θ*g ≤ θgU (14) –8– Acta Polytechnica Hungarica Vol. 6, No. 2, 2009 We assume that the lower and upper bounds are known to us. This assumption may seem unrealistic and restrictive. However, one can just choose rough bounds based on experience or any knowledge about the nonlinearities. We define the adaptation parameter errors as φ = θf − θ*f and φ = θg − θ*g (15) g f To proceed, we analyze the tracking error dynamics. We write the error dynamics as ⎡0 1 ⎢0 0 e=⎢ ⎢ ⎢ ⎣0 0 1 0⎤ ⎡0 ⎤ ⎥ ⎢ ⎥ 0⎥ n (n) e + ⎢ ⎥ x( ) − xd ⎥ ⎢0 ⎥ ⎥ ⎢ ⎥ 0⎦ ⎣1 ⎦ ( 0 ( n (n) = Ae − bke + bke + b x ( ) − x d ( ) (n) = ( A − bk ) e + b ke + f + gu − x d ) (16) ) where k is chosen so that A m = A − bk is asymptotically stable. We use the adaptation laws ( φf ( t ) = θf ( t ) = Pr ojθf Γf σξf ) ( φg ( t ) = θg ( t ) = Pr ojθg Γ g σξg u a (17) ) r ×rg where Γf ∈ R rf ×rf and Γ g ∈ R g (18) are diagonal symmetric positive definite matrices and σ = eT P b . The matrix P is the solution of A Tm P + PA m = −2Q for Q = QT > 0 . It is easy to verify, using the definition of Proj and the fact that for each i we have θfLi ≤ θ*fi ≤ θfUi and θgLi ≤ θ*gi ≤ θgUi , that ( (Γ ( ) ) φTf Γ f−1 Pr ojθf Γ f σξf − σξf ≤ 0 φTg −1 g Pr ojθg (19) ( Γ σξ u ) − σξ u ) ≤ 0 g f a f (20) a where ua = 1 θTg ξ g ( −θ ξ + x( ) − ke) T f f n d (21) –9– M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic The initial values of the components of θg are chosen to satisfy (13), where for each j = 1,… , rg , we have ωgj > 0 . This ensures that θTg ξ > 0 because we choose g fuzzy sets so that at least one rule fires at any time and so at least one component of ξ is nonzero and in fact positive. g We use the following fuzzy adaptive control law [11] u = ua + us (22) where u s satisfies the following conditions ( (n) σ ke + f + gu a + gu s − x d )≤ε (23) σu s ≤ 0 where ε > 0 is a design parameter. There are several different ways to select u s so that it satisfies (23). Let h f ≥ ξ f θfU − θfL and h g ≥ ξ θgU − θgL u a . Given the design parameter g ε , we select positive numbers ε1 , ε 2 and ε3 such that ε = ε1 + ε 2 + ε3 . Then k s should satisfy the following condition 2 2 h g2 1 ⎛⎜ d f + u a d g h f2 + + g⎜ 2ε1 4ε 2 4ε3 ⎝ 2 ks ≥ ⎞ ⎟ ⎟ ⎠ (24) When the gain k s satisfies the above condition, u s = −k s σ guarantees that (23) are satisfied. This can be shown by completing the squares. An alternative implementation of the robustifying component is ⎛b⎞ ⎛σ⎞ u s = − ⎜ ⎟ sat ⎜ ⎟ ⎜ ⎟ ⎝g⎠ ⎝δ⎠ where sat(x) = sign(x) (25) is x >1 and b = d f + d g u a + θfU − θfL ξf + θgU − θgL ξg u a sat(x) = x and δ = x ≤ 1, 4ε . It is easy to b verify that the above u s satisfies (23). We now proceed to analyze the dynamics of the tracking error. – 10 – if Acta Polytechnica Hungarica Vol. 6, No. 2, 2009 Theorem 1 Consider the closed-loop system n x( ) = f ( x ) + g ( x ) u u = ua + us ( ) ( Γ σξ u ) θf = Pr ojθf Γ f σξ f θg = Pr ojθf f g (26) a where u s satisfies (23). Then we have eT ( t ) P e ( t ) ≤ exp ( −μt ) eT ( 0 ) P e ( 0 ) + a) b) if there θ*f exist θ*g and λ min ( Q ) ε where μ = λ max ( P ) μ such that f ( x ) = θ*T f ξ f (x) and then the origin of the ⎡ e φ φ ⎤ -space is stable f g⎥ ⎢⎣ ⎦ and hence e , φ ( t ) and φ ( t ) are bounded and e ( t ) → 0 as t → ∞ . g ( x ) = θ*g T ξ g (x) , f g 1 T e P e . The time derivative of V evaluated 2 on the solutions of the closed-loop system (1), (22) is Proof: To prove (a), we consider V = ( (n) V = eT Pe = −eT Qe + σPb ke + f + gu − x d ) (27) Substituting into the above expression for the control law given by (22) and applying (23) gives ( (n) V = −eT Qe + σ ke + f + gu a + gu s − x d ≤ −eT Qe + ε ≤ −λ min ( Q ) e + ε ≤ − 2 where μ = λ min ( Q ) λ max ( P ) ) λ min ( Q ) λ max ( P ) (28) eT Pe + ε = −μV + ε . Invoking now the Comparison lemma (see, for example [12]), we obtain (a). To prove (b), we consider the following Lyapunov function candidate V= ( 1 T e P e + φT Γ f−1 φ + φT Γg−1 φ f f g g 2 ) (29) – 11 – M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic *T By assumption, f ( x ) = θ*T f ξ ( x ) , g ( x ) = θg ξ f (20) and (n) x d − ke = (23) θ*T f ξf hold. In + θ*T f ξf u a . addition, g it (x) as well as conditions (19), follows from (21) that Taking into account all of the above mentioned expressions in evaluating the time derivative of V on the trajectories of the closedloop system (26), we obtain V = eT Pe + φT Γf−1 φ + φT Γg−1 φ f f g g ≤ −eT Qe + σgu s ≤ −eT Qe ≤ − λ min ( Q ) λ max ( P ) eT P e = −μeT P e (30) It follows from the above that the closed-loop system (26) is stable and therefore, e ( t ) , φf ( t ) and φ ( t ) are bounded for t ≥ 0 . g To show that e → 0 as t → ∞ , we integrate (30) to obtain ∫ V ( τ) dτ = V ( t ) − V ( 0) ≤ ∫ ( −μe Pe ) dτ t t 0 0 T (31) or equivalently t ∫ μe Pedτ ≤ V ( 0) − V ( t ) ≤ V ( 0) T (32) 0 ∫ ( e P e ) dτ t Thus, lim t →∞ 0 T exists and is finite. It follows from the first part of the theorem that eT Pe is bounded and since d T e P e ≤ −μeT Pe + ε , we conclude that dt d T e P e is also bounded. Therefore, eT Pe is uniformly continuous. By dt Barbalat’s lemma [13], eT Pe → 0 as t → ∞ , which concludes the proof of the theorem. From (a) of the above theorem and the expression for u s given in (25), we can see that the design parameter ε determines the final accuracy of the tracking error which can be made arbitrarily small. As expected, the smaller the desired tracking error, the larger the controller‘s gain is required. This means the tracking error can be made arbitrarily small by increasing the controller’s authority. – 12 – Acta Polytechnica Hungarica 6 Vol. 6, No. 2, 2009 Simulation Example In this example, we apply the adaptive fuzzy controller to the system y'' + 1 y' + 1.7y − 0.5u = 0 0.25 + y (33) Define six fuzzy sets over interval <-10, 10> with labels N3, N2, N1, P1, P2, P3. The membership functions are 1 μ N1 ( x ) = e μ N2 ( x ) = μ N3 ( x ) = 1 e( x +1.5 ) (35) 2 1 1+ e (36) 5( x + 2 ) 1 μ P1 ( x ) = e (37) ( x − 0.5)2 1 μ P2 ( x ) = e μ P3 ( x ) = (34) ( x + 0.5 )2 (38) ( x −1.5)2 1 1+ e (39) −5( x − 2 ) The reference model is assumed to be M (s) = 1 s 2 + 2s + 1 (40) and the reference signal is the square periodic signal of magnitude 1.5 and frequency 0.01 Hz. ⎡50 30 ⎤ We choose P = ⎢ ⎥ , k1 = 2 , k 2 = 1 , and λ min ( P ) = 1.52 . To satisfy the ⎣30 20 ⎦ constraint related to x we choose V = 0.25 , d f = 20 , d g = 2.1 and ε = 0.25 . At 200th second of simulation the system (33) was switched to another system ⎡ ⎤ 1 ⎥ y' + y − 5u = 0 − y''' + 5y'' + ⎢ 1.7 ⎢ ( 0.25 + y )2 ⎥ ⎣ ⎦ – 13 – (41) M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic All initial states have been set to zero y ( 0 ) = y' ( 0 ) = y'' ( 0 ) = y''' ( 0 ) = 0 . As it can be seen from Fig. 1, the simulation results confirm a good adaptation capability of the proposed control system. The system dynamic changes are in particular manifested by changes of control input signal (Fig. 2). [-] 7 6 5 4 3 2 1 0 0 50 100 150 200 250 300 350 400 s Figure 1 The state x1 (blue dashed line), its desired reference model value y m ( t ) (green solid line) and reference signal (red solid line) [-] 50 40 30 20 10 0 -10 0 50 100 150 200 250 Figure 2 Control signal – 14 – 300 350 400 s Acta Polytechnica Hungarica Vol. 6, No. 2, 2009 Conclusions In this paper, the TSK-type fuzzy logic system is used in the adaptive fuzzy controller. The major advantage is that the accurate mathematical model of the system is not required to be known. The proposed method can guarantee the global stability of the resulting closed-loop system in the sense that all signals involved are uniformly bounded. Furthermore, the specific formula of the bounds is also given. Finally, we use the adaptive fuzzy controller to regulate the system to the origin. We also showed explicitly how the supervisory control forced the state to be within the constraint set. References [1] Wang, L.-X.: A Course in Fuzzy Systems and Control. Englewood Cliffs, NJ: Prentice-Hall, 1997 [2] Wang, L.-X.: Stable Adaptive Fuzzy Control of Nonlinear System. IEEE Trans. Fuzzy Syst., Vol. 1, pp. 146-155, 1993 [3] Wang, L.-X.: Stable Adaptive Fuzzy Controllers with Application to Inverted Pendulum Tracking, IEEE Trans. on Syst., Man and Cyberneticspart B, Vol. 26, pp. 677-691, 1996 [4] M. Sugeno, M. Nishida: Fuzzy Control of Model Car, Fuzzy Sets Systems, Vol. 16, pp. 103-113, 1985 [5] T. Takagi, M. Sugeno: Fuzzy Identification of Systems and its Applications to Modeling and Control, IEEE Trans. on Systems, Man, and Cybern., SMC-15(1), pp. 116-132, 1985 [6] Shaocheng Tong, Han-Xiong Li: Fuzzy Adaptive Sliding-Mode Control for MIMO Nonlinear Systems, IEEE Transactions on Fuzzy Systems, Vol. 11, No. 3, June 2003 [7] Chih-Lyang Hwang: A Novel Takagi-Sugeno-based Robust Adaptive Fuzzy Sliding-Mode Controller, IEEE Transactions on Fuzzy Systems, Vol. 12, No. 5, October 2004 [8] Shiuh-Jer Huang, Wei-Cheng Lin: Adaptive Fuzzy Controller With Sliding Surface for Vehicle Suspension Control, IEEE Transactions on Fuzzy Systems, Vol. 11, No. 4, August 2003 [9] Ya-Chen Hsu, Guanrong Chen, Han-Xiong Li: A Fuzzy Adaptive Variable Structure Controller with Applications to Robot Manipulators, IEEE Transactions on Systems, Man, and Cybernetics, Part B: Cybernetics, Vol. 31, No. 3, June 2001 [10] Yansheng Yang, Changjiu Zhou: Design of Fuzzy Adaptive Robust Control Algorithm via Small Gain Approach, Proceedings of the 2002 IEEE International Conference on Fuzzy Systems,Vol. 1, 2002, pp. 650-655 – 15 – M. Kratmüller The Adaptive Control of Nonlinear Systems Using the T-S-K Fuzzy Logic [11] Wang, L.-X.: Adaptive Fuzzy Systems and Control, Design and Stability Analysis. Englewood Cliffs, NJ: Prentice-Hall, 1994 [12] H. K. Khalil: Nonlinear Systems. Upper Saddle River, NJ 07458: Prentice Hall, second ed., 1996 [13] J. E. Slotine, W. Li: Applied Nonlinear Control. Englewood Cliffs, NJ: Prentice - Hall, Inc., 1991 – 16 –