DESIGN OF FUZZY LOGIC CONTROLLER FOR DOUBLE ROTARY INVERTED PENDULUM Dyah Arini, Dr.-Ing. Ir. Yul Y. Nazaruddin, M.Sc.DIC, Dr. Ir. M. Rohmanuddin, MT. Physics Engineering Department Institut Teknologi Bandung October 007 ABSTRACT Inverted pendulum is a system that often used as an application for control system. One type of this system is double rotary inverted pendulum (DRIP). DRIP has two inverted pendulum that mounted opposite side in rotating disk. Both of the pendulums have to be balanced by turn the rotating disk. This system has one input and three outputs. Its dynamic is very nonlinear and unstable. Therefore, DRIP system is very hard to control, especially by conventional controller such as PID. In this paper, a controller based on fuzzy logic has been developed to control DRIP system. The fuzzy logic controller is one of the intelligent control system that able to control nonlinear system. The fuzzy logic controller uses fuzzy logic. Fuzzy logic is logic that emulate human thought. In design, there are some processes, such as the fuzzification process, inference mechanism, and defuzzification process, that are defined by trial-and-error. DRIP has some condition that the logic is hard to define. Therefore, a method that is used to design fuzzy controller is by observing input and output DRIP system when it was controlled by Linear Quadratic Regulator (LQR) controller. The LQR controller has been design previously. The simulation result using fuzzy controller, system can stable for.5 seconds with first pendulum s RMSE 0.0 radian and second pendulum s 0.05 radian. This value is smaller than using LQR controller which is first pendulum s RMSE 0.0 radian and second pendulum s 0.063 radian. Keyword double rotary inverted pendulum, fuzzy logic controller, nonlinear system, LQR, MATLAB software PREFACE Inverted pendulum is one of the system that often used as application for control system. There is so many inverted pendulum type that has been developed, one of them is double rotary inverted pendulum (DRIP). DRIP has two pendulums that mounted opposite side in rotating disk. The rotating disk will turn to stabilize both of the pendulums in order to be in the upright position. Therefore, DRIP is a nonlinear and unstable system. Because of that, controlling this system is very interesting. There are two parts for controlling DRIP, that are to swing-up the pendulums to the upright position and to stabilize the pendulums when they have been in the upright position. DRIP simulation has been in Simulink MATLAB V7 (Release 4) software. Linear Quadratic Regulator (LQR) controller has been made sucsessfully to control this system. In this paper, fuzzy logic controller is tried to be designed to control DRIP system and the designed fuzzy logic controller will be compared with LQR controller. DRIP is a nonlinear and unstable system. In addition, DRIP is a SIMO (Single-Input-Multi-Output) system that has one input and three outputs. Whereas, fuzzy logic controller is one of the intelligent control system that is usually used to control nonlinear system. It is expected, by using fuzzy logic controller, DRIP can be controlled with optimum performance.. Introduction of Fuzzy System BASIC CONCEPT Fuzzy logic concept is introduced by Lofti A. Zadeh in 965, with his paper Fuzzy Sets [3]. Before fuzzy concept is introduced, the concept that is usually used is based on conventional logic that divide set into two sets, such as true and false or define as 0 and. This logic is called crisp logic. This logic do not define value between 0 and. Whereas, in daily life, sometimes human can solve their problem
and make decisions based on limited information and knowledge. Fuzzy logic emulates human logic, that can make decision based on uncertained and limited information. Fuzzy logic makes approaches to that uncertainty and combines between real value and logic operator. Structure and operation rule that can emulate human decision is called fuzzy system [6]. This fuzzy system can be implemented as control system that is known as Fuzzy Logic Controller.. Fuzzy System Figure.. Fuzzy System Figure. [6] is a fuzzy system that is a static nonlinear mapping between its inputs and outputs. Inputs and outputs are crisp. It means that they are real numbers and not fuzzy sets. Fuzzification block will convert crisp inputs into fuzzy sets. Then, the inference mechanism will use fuzzy rules in the rule base to make a fuzzy conclusion. Defuzzification block will convert fuzzy conclusion into crisp output. Fuzzy sets are sets without clear constraint. A set with clear constraint is called crisp. Classic theory operator such as complement, union, and intersection is used to operate fuzzy sets [3]. The operators that are usually used in fuzzy sets operation are T-norm and S-norm [3]. Membership function (MF) is a curve that shows the mapping of inputs into their membership value (it is also called membership degree) that have value between 0 and. There are several membership function that can be used to define the membership degree such as [7] :. linier membership function. triangular membership function 3. trapezoidal membership function 4. sigmoid membership function Rule base in fuzzy system is specified using linguistic description [6]. The mapping between inputs and outputs in fuzzy system is determined by if-then condition. Fuzzy system inputs are associated as premise and fuzzy system outputs are associated as consequent. Fuzzification process is a process that is mapping the crisp sets into fuzzy sets by using membership function. Defuzzification is an inverse process from fuzzification, that is mapping the fuzzy sets into crisp sets. By defuzzification process, the fuzzy system outputs can be processed further. In general, there are five method of defuzzification: - Centroid of Area (COA) - Bisector of Area (BOA) - Mean of Maximum (MOM) - Smallest of Maximum (SOM) - Largest of Maximum (LOM) Fuzzy inference system is a computation based on concept of fuzzy sets, if-then rules, and fuzzy logic [3]. Basic structure of fuzzy inference system consists of three component, that are rule base (contain fuzzy rules), data base (contain membership function that is used in fuzzy rules), and reasoning mechanism (contain inference procedure). There are three types of inference system that is used in every application, such as Mamdani, Sugeno, and Tsukamoto. The difference between them is the consequent in fuzzy rules and defuzzification process. 3. Double Rotary Inverted Pendulum System 3 SIMULATION Double Rotary Inverted Pendulum (DRIP) is a system that consist of a disk with two pendulums. The pendulums are mounted opposite side in the disk, as Figure 3.. [].
Pendulum I β z τ β Pendulum II l x l α L (0,0,0) e r y e α Figure 3.. Double Rotary Inverted Pendulum Table 3.. Parameters of DRIP System Parameter Notation Value Unit Inertia of the rotating disk J 0 0.06 kg.m Inertia of the first pendulum J 0.008 kg.m Inertia of the second pendulum J 0.00 kg.m Viscous coef. Of rotating disk c 0 0.004 N.m.s Viscous coef. Of first pendulum c 0.003 N.m.s Viscous coef. Of second pendulum c 0.0009 kg Mass of the first pendulum m 0.5 kg Mass of the second pendulum m 0.3 m The displacement from the joint to.the c.m. of the first pendulum l 0.4 m The displacement from the joint to the c.m. of the second l 0.3 m pendulum The radius of the rotating disk L 0.7 m The gravity constant g 9.8 m/s Torque constant K m 0.374 N.m/A Back emf. Constant K b 0.374 Volt/rad Resistant in motor circuit R 8.6 Ω 3. Design of Fuzzy Logic Controller In design of fuzzy logic controller, Mamdani method is used. The fuzzy logic controller inputs are error of first pendulum angle (error β ), error of second pendulum angle (error β ), error of first pendulum & β ), error of second pendulum angular velocity (error & β ), rotating disk angle angular velocity (error (α ), and rotating disk angular velocity (α& ). The unit for angle is in radian. The unit for angular velocity is radian/second. The fuzzy logic controller output is control signal in Volt unit. Error value is gained from the deviation between angle and set point. The set point is when the pendulum in the upright position (0 o ). In determining membership function and fuzzy rules, some knowledge about the DRIP system is needed. DRIP is a nonlinear, unstable, and SIMO (Single-Input-Multi-Output) system, so the knowledge about the DRIP system is got by observing the system while it was controlled by LQR (Linear Quadratic Regulator) controller. LQR controller is a controller that has been already stabilize DRIP. Therefore, the control system is made by imitating LQR behaviour. By trial-and-error method, membership function and fuzzy rules is got. Therefore, the initial condition both of the pendulums is in o. Membership function parameter is made after observe the inputs and outputs system while the system was controlled by LQR controller. Parameters for each variable is as follows: Figure 3.. Membership Function Error β Figure 3.3. Membership Function Error β 3
Figure 3.4. Membership Function Error & β Figure 3.5. Membership Function Error & β Figure 3.6. Membership Function α Figure 3.7. Membership Function α& Figure 3.8. Membership Function Control Signal (u) Rule base is an operator to make decision or output if the controller have certain input. Rule base is determined by trial-and-error method that is by adding and subtracting rules. The 3 rules is as follows:. If (error β =VN) and (error β =VN) then (u=vn). If (error β =VN) and (error β =N) then (u=vn) 3. If (error β =VN) and (error β =Z) then (u=vn) 4. If (error β =VN) and (error β =P) then (u=n) 5. If (error β =VN) and (error β =VP) and (error & β =VP) then (u=n) 6. If (error β =VN) and (α =Z) then (u=vp) 7. If (error β =N) and (α =Z) then (u = VVP) 8. If (error β =Z) and (α =Z) and (α& =Z) then (u = VVP) 9. If (error β =P) then (u = Z) 0. If (error β =VP) and (error & β =VP) then (u = N). If (error β =VN) then (u = VN). If (error β =N) then (u = N) 3. If (error β =Z) then (u = Z) 4. If (error β =P) then (u = P) 5. If (error β =VP) and (error & β =VP) then (u = P) 6. If (error β =VN) then (u = VP) 7. If (error β =N) then (u = P) 8. If (error β =Z) then (u = VP) 9. If (error β =P) then (u = P) 0. If (error β =VP) and (error & β =VP) then (u = VP). If (error β =VP) and (error β =VN) then (u =Z) 4
. If (error β =VP) and (error β =N) then (u = Z) 3. If (error β =VP) and (error β =Z) then (u = N) 4. If (error β =VP) and (error β =P) then (u = N) 5. If (error β =VP) and (error β =VP) and (error & β =VP) then (u = VN) 6. If (error β =Z) then (u = Z) 7. If (error β =N) then (u = N) 8. If (error β =P) then (u = Z) 9. If (error β =P) then (u = VVP) 30. If (error β =N) and (α not = Z) then (u = VN) 3. If (error β =Z) and (α not = Z) and (α& not = Z) then (u = VN) Defuzzification process, that is used in this paper, is centroid of area (COA). Figure 3.. Fuzzy Logic Controller and DRIP 4 RESULT AND ANALYSIS The simulation is done in Simulink MATLAB V7 (Release 4), by initial condition both of the pendulums is o. Double rotary inverted pendulum system default parameter is used as in Table 3... Fuzzy Logic Controller LQR Controller 5
Figure 4.. Pendulums conditions for.5 seconds If the time is lengthened, fuzzy logic controller can not maintain both of the pendulums in the upright position as in Figure 4... First pendulum has been fallen after.5 seconds. If one of the pendulums is fallen, then it will influence other pendulum. In conclusion, the fuzzy logic controller needs improvement to handle this problem. Figure 4.. Pendulums condition after.5 seconds 5 CONCLUSION 5. Conclusion Fuzzy logic controller is designed by adjusting the LQR controller behavior so the fuzzy logic controller can handle DRIP system with certain parameter The designed fuzzy logic controller can control DRIP system for.5 seconds with RMSE for first pendulum 0.0 radian and second pendulum 0.05 radian 3 In comparison with LQR controller, fuzzy logic controller has smaller RMSE and DRIP system can stable quicker. 5. Suggestion Improvement membership function parameter and rule base is needed so fuzzy logic controller can handle double rotary inverted pendulum system for different parameter. In addition, fuzzy logic controller can also maintain the pendulums in upright position for longer time. 6. BIBLIOGRAPHY [] GUI Pen Software Instruction (Double rotary inverted pendulum software manual) [] Hendra Dewantara, Optimasi Pengontrol Fuzzy pada Model Pendulum Terbalik Bertingkat dengan Bantuan Algoritma Genetik Tugas Akhir, Final Project Engineering Physics ITB, 997. [3] J.S.R. Jang, C.T. Sun, and E. Mizutani, Neuro Fuzzy and Soft Computing, Prentice-Hall, Englewood Cliff, New Jersey, 997 [4] J.S.R. Jang, Ned Gulley, Fuzzy Logic Toolbox, for Use with Matlab, The Math Works, 995. [5] Kai Michels, Frank Klawonn, Rudolf Kruse, Andreas Nurnberger, Fuzzy Control: Fundamentals, Stability and Desing of Fuzzy Controllers, Springer, 006. [6] Kevin M. Passino, Stephen Yurkovich, Fuzzy Constrol, Addison-Wesley Longman Inc., 998. [7] Sri Kusumadewi, Artificial Intelligence (Teknik and Aplikasinya), Graha Ilmu, 003. [8] Yolla Indria, Implementasi Pengontrol Fuzzy Pada Pendulum Terbalik Berputar, Final Project Engineering Physics ITB, 003. 6