• No results found

Control Of An Inverted Pendulum Using Fuzzy Logic

N/A
N/A
Protected

Academic year: 2019

Share "Control Of An Inverted Pendulum Using Fuzzy Logic"

Copied!
24
0
0

Loading.... (view fulltext now)

Full text

(1)

CONTROL OF AN INVERTED PENDULUM USING FUZZY LOGIC

MOHD HAFIZAN BIN ANUAR

This report is submitted in partial fulfillment of the requirement for the award of Bachelor of Electronic Engineering (Industrial Electronic) With Honours

Faculty of Electronic and Computer Engineering University Teknikal Malaysia Melaka

(2)

UNIVERSTI TEKNIKAL MALAYSIA MELAKA

FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

BORANG PENGESAHAN STATUS LAPORAN PROJEK SARJANA MUDA II

Tajuk Projek : CONTROL OF AN INVERTED PENDULUM USING FUZZY LOGIC

Sesi Pengajian : 2008/2009

Saya ………..………MOHD HAFIZAN BIN ANUAR………. (HURUF BESAR)

mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:

1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi

pengajian tinggi.

4. Sila tandakan ( ) :

SULIT*

(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)

TERHAD* (Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________ ___________________________________

(TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)

Alamat Tetap: No. 10, Lorong Lengkongan,

Kg. Raja Uda, 42000 Pelabuhan Klang,

Selangor

(3)

iii

“I hereby declare that this report is the result of my own except for quotes as cited in the references”.

Signature :………..

Author :……….

(4)

iv

“I hereby declare that I have read this report and in my opinion this report is sufficient in terms of the scope and quality for the award of Bachelor of Electronic

Engineering (industrial Electronic) With Honours.”

Signature :………

Supervisor’s Name :………

(5)

v

(6)

vi

ACKNOWLEDGEMENT

Firstly, I would like to thank to the Almighty God, Allah SWT that had gave me an opportunity to finish this final year project successfully. Without His bless there are nothing could be done in such a way.

My appreciation also goes to my family who has been so tolerant and supporting me all these years. Their love, emotional and spiritual support that they gave to me had encouraged me to do the best to achieve success in the future.

Besides that, I would like to express my heartily gratitude to my supervisor. Mr. Mohd Shakir bin Md Saat for the guidance, enthusiasm and support given throughout the progress of this project.

Nevertheless, thanks al lot to all Inverted Pendulum group members that had been helping me from the beginning till the end of this project. Their support had encouraged me to give the best in this project.

Lastly, not to forget to all my housemates and BENE classmates and those whom contribute in directly or indirectly to complete this report, thanks a lot, may Allah bless you all.

(7)

vii

ABSTRACT

(8)

viii

ABSTRAK

(9)

ix

TABLE OF CONTENTS

CHAPTER TITLE PAGE

PROJECT TITLE i

STATUS REPORT APPROVEMENT FORM ii

DECLARATION FORM iii

SUPERVISOR’S APPROVEMENT iv

DEDICATION v

ACKNOWLEGDEMENT vi

ABSTRACT vii

ABSTRAK viii

TABLE OF CONTENTS ix

LIST OF TABLES xii

LIST OF FIGURES xiii

LIST OF APPENDIX xv

I INTRODUCTION

1.1 Project Overview 1

1.2 Problem Statement 3

1.3 Objective 3

1.4 Scope of Project 3

(10)

x

II LITERATURE REVIEW

2.1 Literature Review 5

2.2 Introduction to Inverted Pendulum System 8 2.2.1 Applications of Inverted Pendulum 10

2.2.1.1Simulation of Dynamics of a Robotic Arm 10 2.2.1.2Model of a Human Standing Still 11

2.3 PID Controller 11

2.3.1 The characteristics of P, I and D controllers 13

2.3.2 PI and PD Controller 14

2.3.3 PID Controller Design 15

III PROJECT METHODOLOGY

3.1 Methodology of this project 16

3.2 Flow Chart of Project Methodology 17

IV RESULT, ANALYSIS AND DISCUSSION

4.1 Physical Parameters of Inverted Pendulum 19 4.2 Result for Open Loop Inverted Pendulum System 19

4.2.1 Mathematical Model Used 21

4.2.2 Result in the workspace 22

4.2.3 Plotting Graph 23

4.2.4 Linearized Model 24

4.2.5 Eigen Value 24

4.2.7 Unstable System 25

4.2.7 Controllability 25

4.2.8 Closed loop poles 25

4.3 Result for Designing Fuzzy Logic Controller 27

4.3.1 Fuzzy Logic Concept 27

(11)

xi

4.3.3 Why Fuzzy Control 28

4.3.4 Rule-Base 29

4.3.5 Linguistic Variables 30

4.3.6 Membership Function 30

4.4 Various types of MF’s. 30

4.4.1 Linear Representation 30

4.4.2 S-Curve Representation (Sigmoid) 31

4.4.3 Triangular Representation 31

4.5 Shouldered Fuzzy Sets 32

4.6 Fuzzy Operations 33

4.6.1 Fuzzy Intersection 33

4.6.2 Fuzzy Union 33

4.6.3 Fuzzy Complement 34

4.7 Defuzzification 34

4.7.1 Mean of Maximum 35

4.7.2 Smallest of Maximum 35

4.8 FLC Implementation 36

4.8.1 FLC Inputs & Outputs 36

4.9 Steps taken for FLC 36

4.9.1 Result with a plus of gains 44

4.10 Inverted Pendulum System Plant 45

4.10.1 Final Plant Result 50

4.10.2 Final Output Result 51

4.11 Discussion 52

V CONCLUSION AND RECOMMENDATION

5.1 Conclusion and Recommendation 55

REFERENCES 57

APPENDIX A 59

APPENDIX B 60

(12)

xii

LIST OF TABLES

NO TITLE PAGE

2.1 Comparison between KP, KI and KD 14

4.1 Example of Differences between Crisp Logic and Fuzzy Logic 27

4.2 Rule-Bases 39

4.3 Fuzzy rule matrix for controlling the cart’s position and

pendulum’s angle 48

4.4 Linguistic Term for Fuzzy rule matrix 48

(13)

xiii

LIST OF FIGURES

NO TITLE PAGE

1.1 Inverted Pendulum used in this project 1

1.2 A full view of an Inverted Pendulum 2

2.1 Inverted pendulum system on a moving cart 10

2.2 A unity feedback system 12

2.2 Fuzzy Controller Block Diagram 13

2.3 A PID controlled system 14

3.1 Flow chart of project methodology 17

4.1 Free body diagram of inverted pendulum with cart 18

4.2 The input pulse for Inverted Pendulum System 19

4.3 The response for pendulum’s angle 20

4.4 Parameters needed 20

4.5 Command to subplot both graph in a figure 23

4.6 Plotting graph of angle and graph of position in a figure 23

4.7 Poles location for the eigen values 24

4.8 Unstable system 25

4.9 Closed loop poles 26

4.10 The unstable poles had been changed from the unstable

side (a) to the stable side (b) for all poles 26

4.11 Fuzzy Controller Block Diagram 29

4.12 Linear Representation 30

4.13 S-Curve representations (Sigmoid) 31

4.14 The inflection (flex or cross-over) point, where the domain value

is 50% true 31

4.15 Triangular representation 32

(14)

xiv

4.17 The intersection 33

4.18 Union 33

4.19 SOM and MOM 35

4.20 Membership Function 40

4.21 Plant with gains 44

4.22 Output Plant with gains 44

4.23 Inverted pendulum open loop system plant 45

4.24 Inverted pendulum closed loop system plant with FLC 45 4.25 Inverted pendulum closed loop system plant with FLC and

PID controller 45

4.26 Inverted pendulum subsystem plant 46

4.27 Subsystem for subsystem 46

4.28 Fuzzy for position 48

4.29 Membership function for position 48

4.30 Fuzzy for angle 49

4.31 Membership function for angle 49

4.32 Full system plant with gains 50

4.33 Full system plant with gains and PID 50

4.34 Stable output for position 51

4.35 Stable output for angle 51

(15)

xv

LIST OF APPENDIX

NO TITLE PAGE

A INVERTED PENDULUM 59

B FREE BODY DIAGRAM OF INVERTED PENDULUM 60

C EXAMPLES OF INVERTED PENDULUM SYSTEM IN

(16)

CHAPTER I

INTRODUCTION

In this chapter, the background of the project study, the objective, as well as the scope of the project and so on will be discussed.

[image:16.595.168.472.462.691.2]

1.1 Project Overview

Figure 1.1 Inverted Pendulum used in this project

(17)

2

pivot is mounted on a carriage (cart), which in its turn can move on a horizontal direction. The cart is driven by a motor, which can exert on it a variable force. The bar would naturally tend to fall down from the top vertical position, either to the left or right which are positions of unsteady equilibrium.

The goal of the experiment is to stabilize the pendulum (bar) on the top vertical position. This is possible by exerting on the cart through the motor a force which tends to contrast the 'free' pendulum dynamics. The correct force has to be calculated measuring the instant values of the horizontal position and the pendulum angle.

[image:17.595.116.542.465.559.2]

The inverted pendulum is a traditional example (neither difficult nor trivial) of a controlled system. Therefore, to control and maintain the pendulum in the upright position while the cart placed at the desired position, an extremely good Fuzzy Logic Controller (FLC) will be design. The result can be showed by using MATLAB and Simulink. At the end of this project, the expected result of the best designed of Fuzzy Logic Controller will be found.

(18)

3

1.2 Problem Statement

Control of inverted pendulum system is recognized as a benchmark problem for various controller designs and widely employed within laboratories for education and research purposes. It is popular due to its simple setup and several interesting features such as the instability, nonlinearity, and non-minimum phase characteristics.

The inverted pendulum system is an intriguing subject from the control point of view due to their intrinsic nonlinearity. The problem is to balance the inverted pendulum as well as it requires a continuous correction mechanism to stay upright since the system is unstable, non-linear, and has non-minimum phase behavior as mentioned.

1.3 Objective

The objectives of this project are to balance the pendulum on a moving cart and to find a better control approach for the Inverted Pendulum System by using Fuzzy Logic Controller.

i. To synthesis the mathematical model of the Inverted Pendulum. ii. To understand the concept of Inverted Pendulum model.

iii. To design a Fuzzy Logic Controller (FLC) to control the system.

1.4 Scope of Project

The scope of this project are:

i. To study the concept of an inverted pendulum system.

ii. After that, a mathematical model of the inverted pendulum system is derived using mathematical model which is created by K. Ogata (1978).

(19)

4

1.5 Research Development

This project is about the nonlinear system. In that case, the first thing to be learned is the concept of the nonlinear system. After that, the research should be focusing on the concept of inverted pendulum system without any controller. Next is to study how to derive the mathematical model of the inverted pendulum system without any controller.

This nonlinear system needs a controller to control the system. The controller suggested is Fuzzy Logic Controller. Therefore, the concept and how to design the inverted pendulum system with the Fuzzy Logic Controller need to be learnt and understand.

All of these derivations will be implemented in MATLAB and Simulink program and the results need to be analyzed. For that reason, it is necessary to learnt and really understand how to use the MATLAB commands and tools. It is really important to be well understood in MATLAB and Simulink programming as this project totally employs this MATLAB and Simulink program.

(20)

CHAPTER II

LITERATURE REVIEW

In this chapter, discussion about the basic concept of inverted pendulum system and FLC used for inverted pendulum system will be presented. It will consist of detail explanation about the model, control approach, results and analysis.

2.1 Literature Review

The Switching Control for Inverted Pendulum System Based on Energy Modification. [1] It is based on a modified energy such that the potential energy is minimums in the upright position. This method of controlling the inverted pendulum system has been derived by paying attention to the energy of pendulum. The model of this inverted pendulum is proposed where there is a mass situated at the centre of the pendulum’s pole and the cart dose not has wheels. The equation of motion is derived by concerning the moment of inertia with respect to the pivot point, the mass of the pole, the distance from the pivot to the centre of mass, the acceleration of gravity, the acceleration of the pivot and the angle between the vertical and the pendulum.

(21)

6

Inverted pendulum system with the personified intelligent control which is not based on the accurate mathematical model is presented. [2] It used a method that can develop control laws directly by means of qualitative analysis and synthesis of the plant. The inverted pendulum system is a multi-input single-output control system consisting of four inputs; pole angle, change of the pole angle, cart position and change of cart position and single output; control action. The prerequisite of applying this control is to understand the physical structure and behaviour of the controlled object as fully as possible. The model for this control is the inverted cart-pendulum situated on a rail and driven by a single motor. The analysis done by reduction of primary problem until small problems that can be solve. Then, the equations obtained will be programmed in C language and the output can be seen from the graph obtained.

The fuzzy logic controller for an inverted pendulum system does not require a precise mathematical modelling of the system nor complex computations. [3] Fuzzy control provides an easy solution to this problem as it is shown by the derivation of the fuzzy linguistic rules and its function verified by computer simulations. From this model of inverted pendulum system, the pendulum’s cart receives an external force for balancing the pendulum provided by a permanent magnet servo-motor mounted on the cart. The fuzzy logic controller changes the human language to fuzzy language before it makes decision to control the system and back to human language for further control action.

(22)

7

of the neural controller for the inverted pendulum system is done on a DECstation using the software package Matlab.

Fuzzy Logic Controller for an Inverted Pendulum System was discussed about the designing Fuzzy Logic Controller for Inverted Pendulum System. [5] The case of fuzzy logic for the derivation of a practical control scheme for stabilizing the inverted pendulum was presented in this paper. The Fuzzy Logic Controller required only sensing the pole angular and cart position, and the implementation is simple. In addition, the comparison of Fuzzy Logic Controller and conventional controller (PID) was discussed too. In the end of this paper, the Fuzzy Logic Controller is ease for implementation of this type of system and the best performance compare the conventional controller (PID).

(23)

8

Fuzzy Control of Mechanical Vibrating System. Fuzzy logic is used to control active hydro pneumatic suspension. [7] The ability of fuzzy logic were discuss that could improve the reduction of the body acceleration caused by the car body with road disturbance from uneven surface, pavement point and etc which are act the tires of running cars. The Fuzzy Logic Controller used in this design has three inputs are body acceleration, body velocity and body deflection velocity and one output is desired actuator force. The simulation result is to compare the active and passive suspension system is proposed to achieve both ride comfort and good handling. Te aim was achieve by simulation result that the active suspension system based on fuzzy logic controller shows the improved stability of the one-quarter-car model.

Robust Speed Fuzzy Logic Controller for DC Drive was discussed the robust speed control for a DC drive is considered. [8] The basis of the heuristic reasoning the main features of the robust speed controller are supposed and the Fuzzy Logic Controller that can control the DC Drive was designed. The comparison between PI-controller and Fuzzy Logic Controller to control the DC Drive was approved. In the end of this paper, the robust fuzzy speed control for a DC Drive was examined. The Fuzzy Logic Controller is able to overcome the disadvantage of usual PI-controller in sensitiveness to inertia vibration and sensitiveness to the range of reference speed alteration.

2.2 Introduction to Inverted Pendulum System

In our daily life, at some time we may have tried to balance a brush, pen or other object on your index finger or the palm of our hand. We have to constantly adjust the position of the hand to keep the object upright. An inverted pendulum does basically the same thing. However, it is limited in that it only moves in one dimension, despite the fact that our hand could move up, down, sideways and other directions.

(24)

9

achieve this, proper control theory is required. The inverted pendulum is an invaluable tool for the effective evaluation and comparison various control theories.

An inverted pendulum system consists of a thin rod (pole) attached at its bottom of a moving cart. In a normal condition, a pendulum is stable when hanging downwards, a vertical inverted pendulum is naturally unstable, and must be actively balanced in order to remain upright, usually by moving the cart horizontally as part of a feedback system.

The inverted pendulum system is essential in the evaluation and comparison of various control theories. The inverted pendulum is used in simulations and experiments to show the performance of different controllers (e.g. PID, State Space and Fuzzy Controllers and else).

The inverted pendulum is a classic problem in dynamics and control theory and widely used as benchmark for testing control algorithms (PID controllers, neural networks, genetic algorithms and so on). Variations on this problem include multiple links, allowing the motion of the cart to be commanded while maintaining the pendulum, and balancing the cart-pendulum system. The inverted pendulum is related to rocket or missile guidance, where thrust is actuated at the bottom of a tall vehicle.

Another way that an inverted pendulum may be stabilized, without any feedback or control mechanism, is by oscillating the support rapidly up and down. If the oscillation is sufficiently strong in terms of its acceleration and amplitude, then the inverted pendulum can recover from perturbations in a strikingly counterintuitive manner.

Figure

Figure 1.1 Inverted Pendulum used in this project
Figure 1.2 A full view of an Inverted Pendulum

References

Related documents

A framework of self-organising Peircean semiotic processes is introduced and it is then applied to demonstrate the emergence of autonomous representational structures in

Of the games that the untransformed model predicted the home team to cover the spread, it was correct 45.45 percent of the time in 2003 and 52.76 percent of the time in 2004.. Over

with the LacZ control.To further evaluate whether the G2/M arrest in the BTG2 expresser is restricted only to cancer cells or not, we analyzed cell cycle progression of NIH3T3

Finally, the patient’s monocytes did not increase CD64 expression after stimulation with 1,000 IU of rhIFN- ␥ /ml (showing that unstimulated and stimulated patient monocytes

Communities of widely spaced low growing perennial grass es (les s than 80 cms. high) with abundant annuals and studded with widely spaced low growing trees and s hrubs often

Being able to access public funding remains vital for community education providers to be able to offer training opportunities for their learners that are relevant to the industries