IOP Conference Series: Materials Science and Engineering OPEN ACCESS Fuzzy modeling and control of rotary inverted pendulum system using LQR technique To cite this article: M A Fairus et al 13 IOP Conf. Ser.: Mater. Sci. Eng. 53 19 Related content - Optimal control of inverted pendulum system using PID controller, LQR and MPC Elisa Sara Varghese, Anju K Vincent and V Bagyaveereswaran - Pendulums are magnetically coupled Yaakov Kraftmakher - FOUCAULT'S PENDULUM EXPERIMENT Torvald Köhl View the article online for updates and enhancements. This content was downloaded from IP address 37.44.19.36 on 8//18 at 7:3
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Fuzzy modeling and control of rotary inverted pendulum system using LQR technique M A Fairus 1, Z Mohamed and M N Ahmad 1 Faculty of Electrical Engineering, Universiti Teknikal Malaysia Melaka, Melaka, Malaysia Faculty of Electrical Engineering, Universiti Teknologi Malaysia, Johor, Malaysia E-mail: mfairus@utem.edu.my Abstract. Rotary inverted pendulum (RIP) system is a nonlinear, non-minimum phase, unstable and underactuated system. Controlling such system can be a challenge and is considered a benchmark in control theory problem. Prior to designing a controller, equations that represent the behaviour of the RIP system must be developed as accurately as possible without compromising the complexity of the equations. Through Takagi-Sugeno (T-S) fuzzy modeling technique, the nonlinear system model is then transformed into several local linear time-invariant models which are then blended together to reproduce, or approximate, the nonlinear system model within local region. A parallel distributed compensation (PDC) based fuzzy controller using linear quadratic regulator (LQR) technique is designed to control the RIP system. The results show that the designed controller able to balance the RIP system. 1. Introduction The Rotary Inverted Pendulum (RIP) as in figure 1 is inherently nonlinear, non-minimum phase, unstable and yet controllable system. Since it was introduced by Professor Katsuhisa Furuta, Tokyo Institute of Technology 1 this system has been a benchmark for the control community as a testbed system for linear and nonlinear control law verification. As an underactuated system, the only actuator that is used to control the two degree of freedom of the system is typically a dc motor. By controlling the torque of the dc motor, the angle of both arm and pendulum can be positioned as required. Modeling the RIP is the first crucial task before any control technique can be implemented. Among the well-known techniques are the Euler-Lagrange technique which has extensively discussed in, 3, 4, 5, 8, 14 and the Newton-Euler technique in 6, 8. The resulting equations which can then be used for controller design, involve nonlinear elements in order to closely represent the behaviour of the real system. In linear control methods, the linearization process will took place and the designed controller able to perform well in a small range of operation however under large range of operation this controller will prone to be unstable due to the nonlinearities in the plant. Thus, researchers are tends to focus on nonlinear control methods which has the capability to manage the nonlinearities exist in a plant. However, most nonlinear control will involve complex mathematical solution which could demand higher processing resource when implemented. The complexity has forced researchers to venture into developing methods that can simplify the design process of nonlinear control. One of the methods is fuzzy modeling which used the concept of fuzzy set theory where the model is develop based on either the input-output data Content from this work may be used under the terms of the Creative Commons Attribution 3. licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. Published under licence by Ltd 1
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Figure 1. Rotary inverted pendulum by TeraSoft or the original mathematical model of the system. The fuzzy model proposed by Takagi and Sugeno 7 is described by fuzzy IF-THEN rules where the local dynamics of each fuzzy rule are expressed by a linear system models. These linear system models will be fuzzy blending to form the overall Takagi-Sugeno (T-S) fuzzy model which approximates the nonlinear system. In this paper, the model is obtained from 13 which is based on the Euler-Lagrange technique and from here the T-S fuzzy model under sector nonlinearity approach is then developed. A parallel distributed compensation (PDC) based fuzzy controller using LQR technique is designed to control the RIP system. This paper will focus on the stabilisation controller while the swingup controller is based on 13. This paper is organized as follows: Section describes the construction of T-S fuzzy model. Section 3 provides the controller designed based on the PDC. In Section 4, stability analysis of the closed-loop system is explained. Experimental results are given in Section 5. Finally, the concluding remarks are provided in Section 6.. Takagi-Sugeno Fuzzy Model of RIP In this section the fuzzy model of the RIP is discussed. The mathematical model of the RIP as stated in 13 is derived according to Euler-Lagrange equations. The physical parameters of the system are define in table 1. The following is the mentioned model based on figure. τl M (q) q V m (q, q) q G (q) = (1) where: q = M (q) = V m (q, q) = G (q) = θ1 θ M 11 m l 1 c cos θ m l 1 c cos θ J m c 1 m l1 θ sin (θ ) V m1 1 m c θ 1 sin (θ ) m c g sin θ τ l = k b e k b θ1 R m R m M 11 = J 1 m l1 m c sin θ V m1 = m l 1 c θ sin θ 1 m c θ 1 sin (θ )
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 θ m, l θ 1 Shaft Torque Figure. Schematic diagram of rotary inverted pendulum Table 1. The Mechanical and Electrical System Parameters 13 Symbol Physical Quantity Numerical Value m 1 Mass of arm.56 kg l 1 Length of arm.16 m c 1 Distance to arm center of mass.8 m J 1 Inertia of arm.1558 kg.m m Mass of pendulum. kg l Length of pendulum.16 m c Distance to pendulum center of mass.8 m J Inertia of pendulum.18773 kg.m R m Armature resistance.564 Ω K b Back-emf constant.186 V.s/rad K t Torque constant.186 N.m/A θ 1 Angular displacement of arm - θ 1 Angular velocity of arm - θ Angular displacement of pendulum - θ Angular velocity of pendulum - τ l Applied torque - e Control voltage - Defining the state variables as x 1 x x 3 x 4 T = θ 1 θ θ1 θ T (1) can be simplified and rearranged into more familiar form ẋ 1 = x 3 3
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 ẋ = x 4 ẋ 3 = ẋ 4 = P 3 P 6 cos x sin x ( P4 (P 1 P ) ( P P 4 P3 ) cos ) x x x P 4 P 7 P P 3 x 3 sin x cos x P 4 (P 1 P ) ( P P 4 P3 ) cos x 3 x P3 P 4 x 4 sin x P 4 (P P 5 ) x 3 sin x cos x P 4 (P 1 P ) ( P P 4 P3 ) cos x 4 x P 4 P 8 P 4 (P 1 P ) ( P P 4 P3 ) cos e () x P 6 (P 1 P P 9 ) sin x ( P4 (P 1 P ) ( P P 4 P3 ) cos ) x x x where P3 P 7 cos x P (P 1 P P 9 ) x 3 sin x cos x P 4 (P 1 P ) ( P P 4 P3 ) cos x 3 x P 3 x 4 sin x cos x P 1 x 3 sin x cos x P 4 (P 1 P ) ( P P 4 P3 ) cos x 4 x P 3 P 8 cos x P 4 (P 1 P ) ( P P 4 P3 ) cos e (3) x P 1 = m l1 J 1 P 6 = m c g P = m c P 7 = kb /R m P 3 = m l 1 c P 8 = k t /R m P 4 = m c J P 9 = 1 cos x P 5 = m l1 P 1 = P 3 (P P 5 ) From () and (3), the equations are clearly contain nonlinearities. To develop the T-S fuzzy model, these nonlinearities are chosen as the premise variables, z j (t) (j = 1,,..., p where p is the number of premise variables). In local sector nonlinearity approach, the number of rules that represent the model can be relate through p. Thus, in order to reduce the number of rules the following are chosen (the variables are chosen by referring to 1, 11): z 1 = sin x /x z 3 = x 3 sin x cos x z = cos x z 4 = x 4 sin x Thus, () and (3) can be written as P 3 P 6 z 1 z ẋ 3 = ( P4 (P 1 P ) ( P 4 P 7 P P 3 z z 3 P P 4 P3 ) ) z x P 4 (P 1 P ) ( P P 4 P3 ) z x 3 P 3 P 4 z 4 P 4 (P P 5 ) z 3 P 4 (P 1 P ) ( P 4 P 8 P P 4 P3 ) z x 4 P 4 (P 1 P ) ( P P 4 P3 ) z e (4) ( ( )) ( ( )) P 6 P1 P 1 z ẋ 4 = z1 ( P4 (P 1 P ) ( P3 P 7 z P P1 P 1 z P P 4 P3 ) ) z x z3 P 4 (P 1 P ) ( P P 4 P3 ) z x 3 P 3 z z 4 P 3 (P P 5 ) z z 3 P 4 (P 1 P ) ( P 3 P 8 z P P 4 P3 ) z x 4 P 4 (P 1 P ) ( P P 4 P3 ) z e (5) 4
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Figure 3. Membership function of M j1 and M j Through local sector nonlinearities approach, the fuzzy model can approximate the nonlinear system within x a a, x 3 b b and x 4 c c. Thus, the maximum and minimum value of the premise variables can be define as, max z 1 z 1 min z 1 z 1 x x max z z min z z x x max z 3 z 3 min z 3 z 3 x,x 3 x,x 3 max x,x 4 z 4 z 4 min x,x 4 z 4 z 4 From the maximum and minimum values, z 1 (t), z (t), z 3 (t) and z 4 (t) can be represented in terms of membership functions M j1 (z j (t)) and M j (z j (t)) z 1 (t) = M 11 (z 1 (t)) z 1 M 1 (z 1 (t)) z 1 z (t) = M 1 (z (t)) z M (z (t)) z 1 z 3 (t) = M 31 (z 3 (t)) z 3 M 3 (z 3 (t)) z 3 z 4 (t) = M 41 (z 4 (t)) z 4 M 4 (z 4 (t)) z 4 where M j1 (z j (t)) M j (z j (t)) = 1 Therefore the membership functions can be calculated as M j1 (z j (t)) = z j (t) z j z j z j M j (z j (t)) = z j z j (t) z j z j Figure 3 shows the membership function of M j1 and M j. According to 9, RIP system can be represented by the following T-S fuzzy model: Rule 1 : IF z 1 (t) is 1 M 1 and z (t) is 1 M and z 3 (t) is 1 M 3 and z 4 (t) is 1 M 4 THEN ẋ(t) = 1 Ax (t) 1 Bu (t) Rule : IF z 1 (t) is M 1 and z (t) is M and z 3 (t) is M 3 and z 4 (t) is M 41 THEN ẋ(t) = 5
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Ax (t) Bu (t). Rule 16 : IF z 1 (t) is 16 M 11 and z (t) is 16 M 1 and z 3 (t) is 16 M 31 and z 4 (t) is 16 M 41 THEN ẋ(t) = 16 Ax (t) 16 Bu (t) where i A = 1 1 i A 3 i A 33 i A 34 i A 4 i A 43 i A 44 i B = i B 3 i B 4 and i = 1,,..., 16, x (t) R n is the state vector and u (t) R m is the input vector. By choosing a = π/4, b =.1 and c = 6 thus z 1 =.93, z 1 = 1, z =.771, z = 1, z 3 =.77, z 3 =.77, z 4 = 4.46 and z 4 = 4.46. From these values, the state equation for each of the rules can be determined as follows, 1 A = 3 A = 5 A = 7 A = 9 A = 11 A = 13 A = 15 A = 1 1 3.53.5.43 49.39..6 1 1 3.53.5.47 49.39.6.8 1 1 5.38.5.46 51.86.1.4 1 1 5.38.6.5 51.86.8.43 1 1 3.9.5.43 54.88..6 1 1 3.9.5.47 54.88.6.8 1 1 5.98.5.46 57.6.1.4 1 1 5.98.6.5 57.63.8.43 A = 4 A = 6 A = 8 A = 1 A = 1 A = 14 A = 16 A = 1 1 3.53.5.47 49.39..8 1 1 3.53.5.43 49.39.6.6 1 1 5.38.5.5 51.86.1.43 1 1 5.38.6.46 51.86.8.4 1 1 3.9.5.47 54.88..8 1 1 3.9.5.43 54.88.6.6 1 1 5.98.5.5 57.63.1.43 1 1 5.98.6.46 57.63.8.4 6
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 1 B = 5 B = 9 B = 13 B =.68.89.48.68.89.48 B = 6 B = 1 B = 14 B =.68.89.48.68.89.48 3 B = 7 B = 11 B = 15 B =.68.89.48.68.89.48 4 B = 8 B = 1 B = 16 B =.68.89.48.68.89.48 Given a pair of (x (t), u (t)), the final output of the fuzzy system can be calculated through the following defuzzification process ẋ (t) = i w (z (t)) {i Ax (t) i Bu (t) } i=1 i=1 i w (z (t)) (6) where 1 w (z (t)) = 1 M 1 1 M 1 M 3 1 M 4 w (z (t)) = M 1 M M 3 M 41 3 w (z (t)) = 3 M 1 3 M 3 M 31 3 M 4 4 w (z (t)) = 4 M 1 4 M 4 M 31 4 M 41 5 w (z (t)) = 5 M 1 5 M 1 5 M 3 5 M 4 6 w (z (t)) = 6 M 1 6 M 1 6 M 3 6 M 41 7 w (z (t)) = 7 M 1 7 M 1 7 M 31 7 M 4 8 w (z (t)) = 8 M 1 8 M 1 8 M 31 8 M 41 9 w (z (t)) = 9 M 11 9 M 9 M 3 9 M 4 1 w (z (t)) = 1 M 11 1 M 1 M 3 1 M 41 11 w (z (t)) = 11 M 11 11 M 11 M 31 11 M 4 1 w (z (t)) = 1 M 11 1 M 1 M 31 1 M 41 13 w (z (t)) = 13 M 11 13 M 1 13 M 3 13 M 4 14 w (z (t)) = 14 M 11 14 M 1 14 M 3 14 M 41 15 w (z (t)) = 15 M 11 15 M 1 15 M 31 15 M 4 16 w (z (t)) = 16 M 11 16 M 1 16 M 31 16 M 41 3. Controller Design via Parallel Distributed Compensation (PDC) Fuzzy Controllers In PDC fuzzy controllers design, each control rule is designed by the same premise variables as the system s T-S fuzzy model and implement the linear state feedback control laws in the consequent parts: 7
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Rule 1 : IF z 1 (t) is 1 M 1 and z (t) is 1 M and z 3 (t) is 1 M 3 and z 4 (t) is 1 M 4 THEN u(t) = 1 Kx (t) Rule : IF z 1 (t) is M 1 and z (t) is M and z 3 (t) is M 3 and z 4 (t) is M 41 THEN u(t) = Kx (t). Rule 16 : IF z 1 (t) is 16 M 11 and z (t) is 16 M 1 and z 3 (t) is 16 M 31 and z 4 (t) is 16 M 41 THEN u(t) = 16 Kx (t) where i K is the feedback matrix of each rule. The final model of this controller is expressed by u (t) = 16 i w (z (t)) i Kx (t) i=1 i=1 i w (z (t)) (7) substituting (7) into (6) the closed-loop T-S model can be represented by, ì w (z (t)) íw } (z (t)) {ìa ìb ík x (t) ẋ (t) = ì=1 í=1 ì=1 í=1 ì w (z (t)) íw (z (t)) (8) where i w (z (t)) is as previously discussed. To apply the state feedback control law in PDC fuzzy controller, each of the feedback matrix must be designed for each local linear model then later fuzzy blending through (7). In this paper, the feedback gains are calculated based on the LQR technique. 4. Stability Analysis of the Closed-Loop System The stability of (8) is ensured through a sufficient quadratic stability condition derived in 1. Theorem: The closed-loop T-S fuzzy model is asymptotically stable in the large if there exists a common positive definite matrix P such that the following two conditions are satisfied: where ìì G T P P ìì G < ( ìí G íì ) T ( G G íì ) G P P < ìì G = ìa ìb ìk, ìí G = ìa ìb ík, íì G = ía íb ìk and ì < ís.t. ì w (z (t)) ì w (z (t)) ì=1 í=1 í w (z (t)) í w (z (t)) The above problems can be solved through Matlab Linear Matrix Inequalities (LMI)-toolbox. 8
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 Figure 4. Response of rotary inverted pendulum a) Arm s position b) Pendulum s angle c) Arm s velocity d) Pendulum s velocity e) Control signal 5. Experimental Results In this section, the feedback gains are calculated based on the LQR technique. By minimizing a quadratic cost function of the form, J = x (t) T Q x (t) u (t) T R u (t) dt with Q = 1 1 1 and R = 1 the feedback gain can be calculated by Matlab command, lqr. 1 K = 3.16 149.4 4.366 1.7 K = 3.16 149.4 4.366 1.39 3 K = 3.16 151.6 4.56.5 4 K = 3.16 151.6 4.559 1.7 5 K = 3.16 14.1 4.379 15.5 6 K = 3.16 14.1 4.379 14.7 7 K = 3.16 15. 4.513 15. 8 K = 3.16 15. 4.514 14.89 9 K = 3.16 16.4 4.3.11 1 K = 3.16 16.4 4.3.78 9
IOP Conf. Series: Materials Science and Engineering 53 (13) 19 doi:1.188/1757-899x/53/1/19 11 K = 3.16 16.6 4.58.43 1 K = 3.16 16.6 4.59.9 13 K = 3.16 111.7 4.334 15.31 14 K = 3.16 111.7 4.334 14.97 15 K = 3.16 11.8 4.464 15.47 16 K = 3.16 11.8 4.464 15.14 By selecting P as P =.7.46..4.46.165.37.91..37.3.7.4.91.7.18 1 1 the stability condition of the above Theorem is satisfied. Figure 4 shows the arm s position, pendulum s angle, arm s velocity, pendulum s velocity and control signal of the RIP. 6. Conclusion In this paper, the T-S fuzzy model of the RIP has been presented. The developed model is then verified through experiment by using state feedback control laws via PDC to stabilise the RIP. Stability conditions of this system can be handled as a LMI feasibility problem which can be solved using Matlab LMI-toolbox. Experimental results demonstrate the effectiveness of this approach. Acknowledgment The authors would like to express appreciation to Faculty of Electrical Engineering, Universiti Teknikal Malaysia Melaka, Malaysia for the equipment involved in this paper. References 1 Furuta K, Yamakita M and Kobayashi S 1991 Proc. of Int. Conf. on Industrial Electronics, Control and Instrumentation (Kobe) vol 3 p 193 Jian Z and Yongpeng Z 11 3th Chinese Control Conf. (Yantai) p 493 3 Anvar S M M, Hassanzadeh I and Alizadeh G 1 Int. Conf. on Control Automation and Systems (Gyeonggido) p 195 4 Ahangar-Asr H, Teshnehlab M, Mansouri M and Pazoki A R 11 Int. Conf. on Electrical and Control Engineering (Yichang) p 5656 5 Hou Y, Zhang H and Mei K 11 Int. Conf. on Electrical and Control Engineering (Yichang) p 84 6 Alt B, Hartung C and Svaricek F 11 19th Mediterranean Conf. on Control and Automation (Corfu) p 147 7 Takagi T and Sugeno M 1985 IEEE Trans. on Systems, Man and Cybernetics 15 116 8 Cazzolato B S and Prime Z 11 J. of Control Science and Engineering 11 8 9 Tanaka K and Wang H O 1 Fuzzy Control Systems Design and Analysis: A Linear Matrix Inequality Approach (New York: Wiley-Interscience) 1 Taniguchi T, Tanaka K, Ohtake H and Wang H O 1 IEEE Trans. on Fuzzy Systems 9 55 11 Wen H H and Jyh H C 7 IEEE Trans. on Systems, Man and Cybernetics A 37 39 1 Tanaka K and Sugeno M 199 Fuzzy Sets and Systems 45 135 13 TeraSoft Inc. 1 Electro-Mechanical Engineering Control System User s Manual (Taipei City: Terasoft) 14 Akhtaruzzaman M and Shafie A A 1 Proc. of the IEEE Int. Conf. on Mechatronics and Automation (Xi an) p 134 1