# Control of Nonlinear Dynamic Inverted Pendulum System Using Fuzzy Logic Based Control Methods

DOI : 10.17577/IJERTV3IS090434

Text Only Version

#### Control of Nonlinear Dynamic Inverted Pendulum System Using Fuzzy Logic Based Control Methods

*1Ahmet GAN, 1Zeynel BA, 2Hakan AÃ‡IKGÃ–Z, 1Ã–.Fatih KEÃ‡ECOLU

1Kahramanmara SÃ¼tÃ§Ã¼ mam University Electrical-Electronic Engineering Department Kahramanmara/Turkey Kilis 7 Aralk University Vocational High School Electrical Programming Department Kilis/Turkey

AbstractInverted pendulum is a system having a nonlinear mathematic model, when inspected properly perishable balance condition pendulum angle and the vehicle position can be controlled by an input applied to the vehicle and dynamically unstable. This type of non-linear system control applications of conversion capabilities of fuzzy logic based controllers are successful. In this study, the non-linear dynamic inverted pendulum system based on fuzzy logic control method of different developed to control system performance and effects will be explored.

Keywords Fuzzy logic based controller, inverted pendulum.

1. INTRODUCTION

Almost none of the systems in real life is not linear. Non- static, energy storage systems and containing the elements of the parameters varies, depending on the status variable systems are non-linear dynamic systems. Non-linear dynamic systems, usually due to the fact that it is very difficult to perform control applications. This type of non-linear system control applications of conversion capabilities of fuzzy logic based controllers are successful [1]. The fuzzy logic controller (BMD), put forward by Lotfi A. Zadeh in 1965, have been used extensively in industry due to certainly expert knowledge and skills [2]. Inverted pendulum that is nonlinear unstable system is a system for training purposes to apply a variety of controls methods working on control theory and to examine the results [3]. Determining for the purpose of control the control algorithms for inverted pendulum system is important in terms of performance. In the literature, linear quadratic control, PID-based control is widely used in the control system of sliding mode inverted pendulum.

In the literature, there are inverted pendulum systems in different structure. Depending on the moving vehicle one rod systems, depending on the vehicle moving double rod systems, rotary single-arm systems, triple inverted pendulum systems are some of the based pendulum systems that is the subject of research in the literature. The most common of these is the type of vehicle and the rod. Following parts of this work will be explored the inverted pendulum system consisting of vehicle and rod and fuzzy logic based control methods control the performance effects [4-8]. In the following part, to create basic later examinations inverted pendulum model consisting of vehicle and rod is introduced.

2. INVERTED PENDULUM SYSTEM MODEL

The inverted pendulum system as seen figure 1 consists of its length l, its mass m intensive accepted bar endpoints, M mounting a vehicle at point P on the asteroid belt. The angle () with vertical position rods passing through the point P and the distance (x) from a reference point on the horizontal axis are represented and x. Rod movement is constrained to the xy plane mounted vehicle able to move only along the x axis. In this section, the inverted pendulums non-linear dynamic model is found using newton's laws [9].

Fig. 1. Inverted pendulum system

When resolving the mathematical model of inverted pendulum system, the center of gravity of the mass of the bar starts on (x, y) coordinate plane equation (1) and equation (2) can be expressed as follows.

xG x l sin (1)

yG l cos (2)

Newton's second rule when applied to moving towards x, it is obtained differential equation in equality (3).

d 2 x d 2 x

M m G u

dt 2 dt 2 (3)

If differential equations in equality (3) and following equalitys are used,

d

x

.

y x cx 1 0 0 0 X x

. 0 0 1 0

(11)

dt sin (cos )

.

d

2 . ..

2 sin (sin ) 2 (cos )

dt (4)

. ml sin(x ) x2 mg sin(x ) cos(x ) u

dt

d cos (sin ).

x2 3 4 3 3

M m m cos2 (x3 )

d

2 . ..

2 cos (cos ) 2 (sin )

. ml sin(x ) cos(x ) x 2 ( M m) gsin(x ) u cos(x )

dt

Equation (5) can be written as follows:

x4 3 3 4 3 3

l ( M m m cos 2 (x 3 ))

Table 1 shows the parameter values for inverted pendulum

.. .

(M m) x ml (sin )

..

2 ml (cos ) u (5)

system.

TABLE 1. USED PARAMETRIC VALUES FOR INVERTED

Secondly, when m the mass of the moving around the point P Newton second rule is implemented, equality (6) differential equation is obtained.

d 2 x d 2 y

m G l cos m G l sin mgl sin

dt 2 dt 2 (6)

If the information in equality (1), (2) and (4) is written in place of equality (6),

.. . ..

m x l (sin ) 2 l (cos ) l cos

 Parameters Symbol Value Unit Mass of the vehicle M 2.4 kg Mass of the inverted pendulum m 0.23 kg Bar length inverted pendulum l 0.36 m Gravity acceleration g 9.8 m/sn2 Path length L 0.5 m

. ..

PENDULUM

3. FUZZY LOGIC CONTROL

m l (cos ) 2

l (sin ) l sin mgl sin

(7) If the necessary refinements perform, equality (8) is achieved.

.. ..

m x cos ml mg sin (8)

Nonlinear system model given by equality (5) and (8) can be written as follows in the form of state-space.

.. ..

x1 x, x2 x x1 , x3 , x4 x3 (9)

.

The real world is generally complex due to uncertainty, abstinence certain thought and instability. Uncertainties can always be found many social, economic and technical issues because of being literally immature human thought. This complexity and uncertainty, it is possible to qualify the call to blur [10]. A fuzzy logic controller block diagram (BMD) is given in Figure 2. BMD, with general structure, makes up of four basic components as fuzzification, fuzzy inference, flushing and knowledge base.

x1 x

x

1

. .

d x d x 2 d x x

x

2

.

dt dt

3

dt x

x

4

.

3

.

Fig. 2. General structure of the BMD

x4 (10)

Fuzzification unit is the process of converting that receiving input information from system to symbolic values

linguistic qualifiers.

Fuzzy inference unit, fuzzy values recieved fuzzification unit, are produced fuzzy results implementing on rle base. The most used method in fuzzy inference methods and used in this study is the Mamdani methods.

Defuzzification unit is provided a fuzzy knowledge from the decision making unit turbidity and obtaining the actual value to be used in practice. Defuzzification is the process of converting from fuzzy information to certain results.

Knowledge base consists of a data table information collected about the system that will be inspected. Connections between inputs and outputs are provided using the rules in the rule base. When developing rule base for a system, system that may affect the output of input values should be determined. Fuzzy control rules are usually derived from expert knowledge [11-16].

The input and output values in the defuzzification process of BMD are transformed into symbolic expressions. The designed controller used in the linguistic variables NL (Negative Big), NM (negative medium), NS (Negative Small), Z (Zero), PS (Positive Small), PM (Positive Medium), PL (Positive Large), including seven variables are used.

The choice of the membership functions for each input to the system may be triangular, trapezoidal, sinusoidal, Cauchy, bells, sigmoid, gaussian types. Triangular membership functions are used in this study. The position of the vehicle and the angle of the inverted pendulum used for triangular shaped membership function by error, error change and shapes belonging to the output are shown in figure 3-8.

Fig. 3. The error for the position of the vehicle

Fig. 4. The error change for the position of the vehicle

Fig. 5. The output for the location of the vehicle

Fig. 6. The error for the angle of inverted pendulum

Fig. 7. The error change for the angle of inverted pendulum

Fig. 8. The output for the angle of inverted pendulum

The angle control of the inverted pendulum and position control of the vehicle used in the rule table is given in table 1. In the controller input fuzzy inference unit its relationship with benefiting from specialist knowledge is provided by the rules set. In this study, when determining the rules AND (and) fuzzy operators was used. These rules have been created in the form of If e is NL and de is NS, u is NL. In this study 49 rules were created by using all linguistic variables.

In the defuzzification unit, by finding error and error change membership weight values for each rule, at least a member weight of these two values and accordingly, output membership (u) values are determined. The numerical value obtained at the output of the defuzzification unit is applied to the system [17-19].

TABLE 2. 7×7 rule table for location control of vehicle and angle of inverted pendulum

 u de NL NM NS Z PS PM PL e NL NL NL NL NL NM NS Z NM NL NL NL NM NS Z PS NS NL NL NM NS Z PS PM Z NL NM NS Z PS PM PL PS NM NS Z PS PM PL PL PM NS Z PS PM PL PL PL PL Z PS PM PL PL PL PL
4. PD CONTROL

In a closed loop control system, the task of control elements size measuring element output fed back through to compare with the size of the input and comparison of the error value may arise from the structure and depending on its control actions is to generate an appropriate command or control signal. There are four fundamental control effect used control elements. They are dual or on-off control (on-off) effect, proportion (P) effect, integral (I) effect and derivative (D) effect. The general structure of a closed loop fuzzy control system is provided in figure 9.

Fig. 9. Classic PD control system

Working in various supervision bodies (P, PI, PD, PID) are created this combination of one or more underlying control effects with used appropriately. PD controller in the control system is used to minimize the system rise time, overshoot and instability. The output equations for PD controller are given in equation (12).

U ( s ) ( K P K D s ) E ( s ) (12)

5. PD-FUZZY SYSTEM

The fuzzy controllers are also designed different structure as in conventional controllers as in the form of hybrid fuzzy controllers PD fuzzy, PI fuzzy, PID fuzzy. PD-fuzzy control system was created with reference to classical PD control system and is a fuzzy control system which has two- input single-output. A PD linear controller is composed of proportional and derivative gain factor [20-22]. PD-fuzzy controller MATLAB/Simulink diagram is shown in the figure 11.

Fig. 11. PD-Fuzzy Controller MATLAB/Simulink block diagram

6. SIMULATION STUDIES

Nonlinear model of inverted pendulum system is modelled in MATLAB/Simulink. PD and PD fuzzy controller are implemented to modelled inverted pendulum system. Proportional gain value (Kp) for PD controller in angle control of inverted pendulum and differential gain value (Kd) are set to Kp=40, Kd=8. As for position control of the vehicle, proportional gain value (Kp) for PD controller and differential gain value (Kd) are set to Kp=1, Kd=3. Control signal has been applied to inverted pendulum system by limiting in the range of u=[-1,1]. The reference angle value of inverted pendulum is taken 0 radian, the reference position for vehicle location is taken 0.1m. 49 technical rule table has

been created for angle of pendulum and location of vehicle in inverted pendulum PD fuzzy logic control.

For envisaged system, PD and PD-fuzzy controllers models designed in MATLAB/Simulink are given in figure 12-13.

Fig. 12. PD Controller Matlab/Simulink block diagram

Fig. 13. PD-Fuzzy Controller Matlab/Simulink block diagram

Simulation results in MATLAB/Simulink belonging to PD controller angle of inverted pendulum and position control of the vehicle are given in Figure 14-15. Simulation results belonging to PD-fuzzy controller angle of the inverted pendulum and position control of the vehicle are given in Figure 16-17.

0.01

0.005

0

-0.005

-0.01

0.015

-0.020 10 20 30 40 50 60 70 80 90 100

Time(sec)

Fig. 14. Angle control of the inverted pendulum with PD controller

0.12

0.1

Position(m)

0.08

0.06

0.04

0.02

0

-0.020 10 20 30 40 50 60 70 80 90 100

Time(sec)

Fig. 15. Position control of the vehicle with PD controller

0.01

0.005

0

-0.005

REFERENCES

1. .H.Alta, Bulank Mantk:Bulankllk Kavram Enerji, Elektrik, Elektromekanik-3e, Temmuz 1999, Say 62, Sayfalar:80-85, Bilesim yaynclk A.., stanbul.

 -0.01 [3] Yeung K. S. and Chen Y. P., Sliding-mode controller design of a single link flexible manipulator under gravity, Int. J. Contr., v. 52, no. 1, s.101117, 1990. -0.015 [4] Yazici A., Karamancioglu A., A Nonlinear Programming Approach -0.020 10 20 30 40 50 60 70 80 90 100 For The Swing-Up Control Problem, Journal of Engineering and Architectural Faculty of Eskiehir Osmangazi University, v. .XXI, no.

2. L. A. Zadeh, Fuzzy sets, Inform, Control, Vol.8, 1965, pp.338-353

Time(sec)

Fig. 16. Angle control of the inverted pendulum with PD-Fuzzy controller

0.12

0.1

Position(m)

0.08

0.06

0.04

0.02

0

-0.020 10 20 30 40 50 60 70 80 90 100

Time(sec)

Fig. 17. Position control of the vehicle with PD-Fuzzy controller

7. CONCLUSIONS

Inverted pendulum system is single-entry multiple-output SIMO (Single Input Multiple Output). There are studies has been checked independently of each other only position of the vehicle despite reference entry or only angle of the pendulum in spite of reference entry. In this study on the SIMO model PD and PD-fuzzy logic controller have been proposed for both position of the vehicle and control of the angle of the pendulum. In Figure 14 in inspections carried out by PD controller inverted pendulum in the vertical position [-0.003 0.0045] with small oscillations in the range of angle stability is observed in 10 seconds. In Figure 16 in inspections performed by the PD-fuzzy controller inverted pendulum in the vertical position [-0.0005 0.001] with small oscillations in the range of angle stability is observed in 15 seconds. In Figure 15, in inspections carried out by PD controller in the horizontal position of the vehicle it is seen the equilibrium without oscillations in 15 seconds. In Figure 17, in inspections carried out by PD-fuzzy controller in the horizontal position of the vehicle in the range of [0.095 0.119] it is seen the equilibrium with small oscillations in 40 seconds. As it is seen from a graph obtained, for angle control of inverted pendulum PD-fuzzy controller in a vertical position in a smaller angle its oscillations, but the balance has been observed that longer. In the position control of the vehicle PD controller does not swing in the horizontal position and is found to be in equilibrium in a shorter time. When the angle of the inverted pendulum control system and position control of the vehicle are examined in terms of time to equilibrate, PD controller has a better dynamic performance. When the angle of the inverted pendulum control system are examined in terms of oscillation parameters, PD-fuzzy controller, when the position of the vehicle are analyzed in terms of control release parameters PD controller has a better dynamic performance. In subsequent studies, due to control strategies based on the rule base and capable of deciding skilled, rule base of the fuzzy controller and by working on membership functions it can be taken more optimal results.

2, s.107-122, 2008

1. Chatterjee D., Patra A., Joglekar H.K., Swing-up and Stabilization of aCartPendulum System Under Restricted Cart Track Length, Systems & Control Letters, v. 47, s. 355 364, 2002.

2. Yazc A, Karamancolu A, A Linear Programming Based Sliding Mode Control design for Stabilization of a Double Inverted Pendulum, Proceedings of the Institution of Mechanical Engineers, Part I, Journal of Systems and Control Engineering, v. 220, no.4,s.315- 321, 2006.

3. Awtar S., King N., Allen T., Bang I., Hagan M.,Skidmore D., Craig K., Inverted Pendulum Systems:Rotary and Arm-Driven- a Mechatronic System Design Case Study, Mechatronics, s. 357-370, 2002.

4. Su H., Woodham C.A., On the Uncontrollable Damped Triple Inverted Pendulum, Journal of Computational and Applied Mathematics, v.151,s.425443, 2003.

5. Ogata, K., Modern Control Engineering,Prentice-Hall Inc, 1990.

6. Kahveciolu A.,Parlaktuna O.,Korul A., Ik Y., Bir UÃ§an rtifa KontrolÃ¼nde Klasik ve Bulank-PD Denetleyici Performanslarnn KarlatrlmasHavaclk ve Uzay Teknolojileri Dergisi Ocak 2006 Cilt 2 Say 3 (9-20).

7. GÃ¼lez, K., Asenkron Motorun Dsp (Saysal aret lemci) Tabanl Bir Kontrol Sistemi Kullanlarak Ysa (Yapay Sinir Alar) le Performansnn Arttrlmas, Yldz Teknik Ãœniversitesi, Fen Bilimleri EnstitÃ¼sÃ¼, Doktora Tezi, stanbul-1999.

8. ekkeli, M., Yldz, C., Ã–zÃ§alk H.R., Bulank Mantk ve PI Denetimli DC-DC KonvertÃ¶r Modellenmesi ve Dinamik Performans Karlatrlmas, 4. Otomasyon Sempozyumu , Samsun, Mays 2007.

9. Ã–zek, A., Sinecen, M., Klima Sistem KontrolÃ¼nÃ¼n Bulank Mantk ile Modellenmesi, Pamukkale Ãœniversitesi MÃ¼hendislik FakÃ¼ltesi MÃ¼hendislik Bilimleri Dergisi, Cilt:10,Say:3, Sayfa: 353-358, Yl:2004.

10. Ã–zkop, E., Alta, .H., Bulank Mantk Denetleyici ile Aktif Otomobil SÃ¼spansiyon Denetimi XII. EEBB MÃ¼hendislii Ulusal Kongresi Ve Fuar, Eskiehir Osmangazi Ãœniversitesi, Eskiehir. Kasm 1418, 2007.

11. Arulmozhiyal, R., Baskaran, K., Space Vector Pulse Width Modulation Based Speed Control of Induction Motor using Fuzzy PI Controller, International Journal Computer and Electrical Engineering, Vol.1, No.1, April 2009.

12. it, S., ÃœÃ§ Fazl Sincap Kafesli ndÃ¼ksiyon Motorunun Bulank Mantk Esasl YÃ¶ntemler Kullanlarak Denetimi KSÃœ, Fen Bilimleri EnstitÃ¼sÃ¼, YÃ¼ksek Lisans Tezi, Kahramanmara-2013.

13. AÃ§kgÃ¶z, H., KeÃ§eciolu, Ã–.F., ekkeli, M., VektÃ¶r Denetim YÃ¶ntemi Uygulanan SÃ¼rekli Mknatsl Senkron Motorun Bulank Mantk Denetleyici ile Hz Denetimi,Otomatik Kontrol Ulusal Toplants (TOK2013), 26-28 EylÃ¼l 2013, Malatya.

14. Ã–zÃ§alk, H.R., KlÃ§, E., it, S., Uzay VektÃ¶r Darbe Genilik ModÃ¼lasyonu le SÃ¼rÃ¼len ÃœÃ§ Fazl Bir Asenkron Motorun Denetiminde PI-Fuzzy Tipi Denetim YÃ¶nteminin Baarmnn ncelenmesi, Otomatik Kontrol Ulusal Toplants (TOK2013), 26-28 EylÃ¼l 2013, Malatya.

15. Gani, A., Ã–zÃ§alk, H.R., AÃ§kgÃ¶z H., KlÃ§, E., Ã–.F. KeÃ§eciolu Farkl Kural Tabanlar Kullanarak PI-Bulank Mantk Denetleyici ile Doru Akm Motorunun Hz Denetim Performansnn ncelenmesi, Akademik Platform Fen ve MÃ¼hendislik Bilimleri Dergisi (APJES), Cilt 2, Say 1,

Ocak 2014.

16. YÃœKSEL, ., Otomatik kontrol, Uluda Ãœniversitesi GÃ¼Ã§lendirme Vakf yayn, No 47,2001.

17. BR, A., Otomatik Kontrol Sistemleri, LiteratÃ¼r Yaynclk, stanbul

1999.

18. Kuo, B.C., Ã‡eviri:Bir, A., 1999, Otomatik Kontrol Sistemleri, LiteratÃ¼r Yaynlar:35,s.186-187.