APPLICATION OF FUZZY CONTROL

144 views 9:32 am 0 Comments June 2, 2023

APPLICATION OF

APPLICATION OF FUZZY CONTROL TO AN INVERTED

PENDULUM

JIA JIUN CHONG

STUDENT ID: 14016910

SUPERVISOR: PROFESSOR QUAN MIN ZHU

THESIS FOR BEng INDIVIDUAL PROJECT

(UFMFX8-30-3)

AWARD: BEng (Hons) ELECTRICAL & ELECTRONIC ENGINEERING

ACADEMIC YEAR 2015/2016

14 APRIL 2016

ABSTRACT

The balancing of an inverted pendulum by moving a cart along a horizontal track is a classic problem in the area of control. Recent years, a number of scholars have been focusing on the studies of Inverted Pendulum using different kind of control methods such as PID, Neural Networks, Genetic Algorithms and Fuzzy Control.Supply Chain and Operations Management Assignment

In this thesis, modelling and simulation study of two control strategies of an Inverted Pendulum system are presented. The goal is to determine which control strategy is able to deliver a better performance with respect to the pendulum’s angle. It’s widely known that, inverted pendulum system is unstable without control. It will simply fall over if the cart is not moved to balance it and will naturally fall down due to gravity. Therefore a force must be properly applied to keep the system intact.

Since Inverted Pendulum is a non-linearized model system, in order to stabilize the pendulum rod and keeping the cart in desired position, fuzzy logic controller has been chosen to perform this task. Both the modelling and analysis for the fuzzy logic controller will be done in MATLAB and Simulink. The main reason that fuzzy logic control systems has been chosen because of its intuitive nature and ability to deal with nonlinear systems.

One unique features of fuzzy logic controller is that it is able to utilize the expertise of humans to control the physical system, so that complex system can be controlled without extensive modelling of the relationship between input and output of the system. Two types of fuzzy model will be presented in this thesis namely Mamdani Fuzzy model and Takagi-Sugeno (T-S) Fuzzy model. Both our fuzzy logic controller will be based on two sets of rules which is used for swinging up the pendulum and also for balancing the pendulum in vertical position. We will be combining our Fuzzy Logic Controller with PID controller in order to achieve the best results to control the Inverted Pendulum system.

Another type of controller which is the PID controllers were also implemented to control the angle of the pendulum. Results of these simulation will be compared between PID controllers and Fuzzy Controllers to determine the performance and stability.

Keywords: Inverted Pendulum, Non-Linear, Fuzzy Logic Control, Mamdani fuzzy model, Takagi Sugeno (T-S) fuzzy model, PID, MATLAB, Simulink

ACKNOWLEDGEMENT

First of all, I would like to express my deepest appreciation to my supervisor, Professor Quan Min Zhu for the continuous guidance, enthusiasm and support given to me throughout the progress of this project. Professor Quan have given me many variable instructions and encouraged me to learn for myself. Throughout this encouragement, I learn not only the knowledge for this project, but also the skills of solving problems independently.

A special note of thanks to the following PhD student Miss Wang Yi Zhi and Mr Liu Xing for their kind advice and guidance during the project. I have received much benefits from their suggestions and discussions.

I would also like to thank my colleague Miss Yun Zhong who has helped me a lot throughout my studies and project by motivating me and discuss with me whenever I encountered a problem.

Not to forget, I would also like to take this opportunity to thank University of the West of England and all my lecturers; Dr Mokhtar Nibouche, Dr Sabir Ghauri, Dr Brian Carse, Dr Steve Wright and many more to mention, without their help I wouldn’t be able to pass all my exams and focus on my dissertation.

Last but not least, I would like to sincerely thank my parents who has been so tolerant and supporting me all these years. Without their support and care, I wouldn’t had the chance to come all the way to UK for further studies.

CONTENTS

ABSTRACT 1

ACKNOWLEDGEMENT 2

CONTENTS 3

LIST OF TABLES 5

LIST OF FIGURES 5

LIST OF ABBREVIATIONS 7

CHAPTER 1: INTRODUCTION 8

1.1. Project Background 8

1.2. Aim of the Project 8

1.3. Objective of the Project 9

1.4. Outline of the Report 9

CHAPTER 2: LITERATURE SURVEY 10

2.1 Inverted Pendulum Systems 10

2.2 Previous Studies of Inverted Pendulum 10

2.2.1 Trial-and-Error Correlation Learning to Control an Inverted Pendulum 10

2.2.2 Stabilization Fuzzy Control of Inverted Pendulum Systems 10

2.2.3 Nonlinear Control of Cart Pendulum System 10

2.2.4 Switching Control for Inverted Pendulum Based Energy Modification 11

2.3 Application of Inverted Pendulum 11

2.3.1 Segway 11

2.3.2 Rocket Navigation 11

2.3.3 Crane 12

CHAPTER 3: SYSTEM MODELLING OF INVERTED PENDULUM 13

3.1 Inverted Pendulum Modelling 13

3.2 Linear Equation of Inverted Pendulum 14

3.3 Laplace Transfer Function of System Equations 15

CHAPTER 4: THEORY OF FUZZY LOGIC 16

4.1 Fuzzy Set and Membership Function 16

4.2 Rule-Base (If-Then rule) 17

4.3 Fuzzy Inference Process 17

4.4 Fuzzy Control Theory 19

4.5 Advantages and Disadvantages of Fuzzy Control 19

4.6 Mamdani FLC vs Takagi Sugeno FLC 20

CHAPTER 5: DESIGN OF INVERTED PENDULUM 21

5.1 System Parameters for Inverted Pendulum 21

5.2 Physical Setup and System Equation of Inverted Pendulum 21

5.3 Block Diagram of Inverted Pendulum in Simulink 22

CHAPTER 6: DESIGN OF FUZZY CONTROL FOR IP SYSTEM 29

6.1 Mamdani Fuzzy Logic Controller 29

6.1.1 Mamdani Modelling 30

6.1.2 Fuzzy Control Rules 31

6.1.3 Overview of Fuzzy Controller 33

6.2 Takagi Sugeno (T-S) Fuzzy Logic Controller 34

6.2.1 T-S Modelling 35

6.2.2 Fuzzy Control Rules 37

6.2.3 Overview of Fuzzy Controller 38

CHAPTER 7: SIMULATION OF INVERTED PENDULUM 40

7.1 Inverted Pendulum with PID Controller 40

7.1.1 PID Controller Design 40

7.1.2 PID Simulation Results 41

7.2 Inverted Pendulum with Mamdani Fuzzy Logic Controller 43

7.2.1 Mamdani FLC design 43

7.2.2 Mamdani Simulation Results 44

7.3 Inverted Pendulum with T-S Fuzzy Logic Controller 45

7.3.1 T-S FLC design 45

7.3.2 T-S Simulation Results 46

7.4 Results and Comparison of the Inverted Pendulum with various controllers 47

CHAPTER 8: CONCLUSION 48

8.1 Conclusion 48

8.2 Suggestion of Future Works 48

REFERENCING 50

APPENDIX 1: GENERATING FUZZY IN MATLAB 52

APPENDIX 2: PROJECT GANTT CHART 54

APPENDIX 3: PROJECT TASK BREAKDOWN 55

LIST OF TABLES

LIST OF FIGURES

Figure 1 Example of an Inverted Pendulum 8

Figure 2 Segway Human Transporter 11

Figure 3 Example of a Rocket Launch 12

Figure 4 Example of a Crane 12

Figure 5 Modelling of Inverted Pendulum 13

Figure 6 Cart’s stress analysis 13

Figure 7 Force analysis of swing pole 13

Figure 8 Membership Function 1 16

Figure 9 Membership Function 2 17

Figure 10 Fuzzy Inference Process 17

Figure 11 Fuzzification for Membership Function A1, A2, B1 and B2 18

Figure 12 Rule Evaluation 18

Figure 13 Centre of Gravity method 18

Figure 14 Fuzzy Logic Controller Architecture 19

Figure 15 Subsystem block of Inverted Pendulum 22

Figure 16 Input and Output ports 23

Figure 17 Function Blocks 23

Figure 18 “xddot” Function Block 23

Figure 19 “thetaddot” Function Block 24

Figure 20 “N” Function Block 24

Figure 21 “P” Function Block 25

Figure 22 Integrator Blocks 25

Figure 23 Mux Blocks 25

Figure 24 Connections of various blocks 26

Figure 25 Completed subsystem of Inverted Pendulum 26

Figure 26 Parameters and Dialog 27

Figure 27 Function Block Parameters 27

Figure 28 Inverted Pendulum Subsystem block 28

Figure 29 a two-dimensional Mamdani fuzzy controller 30

Figure 30 Membership Function for theta 30

Figure 31 Membership Function for thetadot 31

Figure 32 Membership Function for F 31

Figure 33 Outlook of Rule Editor 32

Figure 34 Fuzzy Rules 32

Figure 35 Rule Viewer for Mamdani FLC 33

Figure 36 Surface Viewer for Mamdani FLC 33

Figure 37 Subsystem of Mamdani FIS Wizard 34

Figure 38 a two-dimensional Sugeno fuzzy controller 35

Figure 39 T-S Membership Function for theta 36

Figure 40 T-S Membership Function for thetadot 36

Figure 41 T-S Membership function for F 37

Figure 42 Rule Editor for Sugeno FLC 38

Figure 43 Rule Viewer for Sugeno FLC 38

Figure 44 Surface Viewer for Sugeno FLC 39

Figure 45 Subsystem of Sugeno FIS Wizard 39

Figure 46 Block diagram for PID Controller 40

Figure 47 Simulink of PID controller 40

Figure 48 , = 1, = 1 41

Figure 49 , = 1, = 5 41

Figure 50 , = 1, = 10 42

Figure 51 Output curve of cart’s position and velocity of position 42

Figure 52 PID + Mamdani FLC Block Diagram 43

Figure 53 PID + Mamdani FLC in Simulink 43

Figure 54 Saturation Mamdani 43

Figure 55 Output response for theta using Mamdani FLC 44

Figure 56 Output response for thetadot using Mamdani FLC 44

Figure 57 PID + Sugeno FLC block diagram 45

Figure 58 PID + Sugeno FLC in Simulink 45

Figure 59 Saturation T-S 45

Figure 60 Output response for theta using Sugeno FLC 46

Figure 61 Output response for thetadot using Sugeno FLC 46

Figure 62 Comparison of 3 controllers in Simulink 47

LIST OF ABBREVIATIONS

IP – Inverted Pendulum

FLC – Fuzzy Logic Controller

PID – Proportional Integral Derivatives

Cart – Carriage

MF – Membership Function

F – Force applied to cart

X – Displacement for cart

m – Mass of the pendulum

M – Mass of the cart

l – Length of pendulum

– Angle between pole and vertical upward position

– Angle between pole and vertical downward position

N – Interactive force’s components for cart and pole on horizontal

P – Interactive force’s components for cart and pole on vertical

b – Coefficient of friction for cart

g – Gravitational Force

I – Inertia of the pendulum

Kg – kilogram

m – Metre

cm – Centimetre

N/kg – Newton per kilogram

– Velocity

– Angular Velocity

TS – Takagi Sugeno

CHAPTER 1: INTRODUCTION

Project Background

In this thesis, we will be presenting an experimental study based on the application of fuzzy control to an Inverted Pendulum. The control of Inverted Pendulum has been a very interesting and important topic in control systems. The reasons why inverted pendulum are more likely to be use as a control simulation tool are because the mathematical model is a nonlinear system and as well the inverted pendulum is a perfectly unstable model for some control systems such as aircraft, launching of rocket, and many other more applications that required a great balancing for nonlinear systems. A one-dimensional inverted pendulum is a nonlinear problem, that has been considered by many researchers, Omatu and Yashioka, 1998 [2] and Magana and Holzapfel, 1998 [3], in which most of them have used linearization theory in their control schemes.

Inverted Pendulum is a system that has a cart which will be programmed to control the pendulum. This system is inherently unstable and is actively balanced by moving the pivot point back and forth along the track which serves as a feedback to the system. Therefore, in order to maintain a balanced pendulum, some sort of control are required to performing the task. However, it is not easy to control and maintain the pendulum in the upright position while the cart is placed at the desired position. Thus designing a controller that is close to this ideal situation is a very challenging design problem.

Figure 1 Example of an Inverted Pendulum [1]

Therefore, the introducing of fuzzy control techniques can provide a good solution for this problem. Fuzzy logic control system is widely known for its ability to deal with nonlinear systems and as well as its intuitive nature. Apart from that, it is true that most of the control problems are able to solve by mathematical methods, however there are certain complex systems where accurate mathematical methods are not available, in this case, fuzzy control techniques will come in handy for these problems.

Aim of the Project

The aim of this project is to control the stabilization of the inverted pendulum in a way that the position of the cart on the track is properly controlled so that the pendulum is always erected in upright position. The control method chosen for the inverted pendulum modelling is fuzzy logic control method.

Objective of the Project

The primary task of this project is to develop a model for Inverted Pendulum and balance the pendulum in upright position on a cart by using Fuzzy control approach. The main objectives of this project are:

To research and understand the concept of the Inverted Pendulum.

Derive the mathematical model of the Inverted Pendulum system created by Ogata (1978).

Select the appropriate Fuzzy Inference Systems – Mamdani and Sugeno type models.

Develop the model of Inverted Pendulum in MATLAB Simulink.

Design fuzzy control system of Inverted Pendulum using Simulink – Fuzzy Logic Toolbox.

Compare the results with various controllers being implemented and conclude the difference using different kind of controllers.

Prepare user manual for MATLAB Simulink and as well Fuzzy Logic Toolbox.

Suggest possible recommendations for future development of the systems.

Outline of the Report

This thesis basically consists of eight chapters and the brief summary will be described as follows:

Chapter 1 is about the introduction of the whole projects. It provides an overview of the project which includes the background of the project, the aim and as well objectives of this project.

Chapter 2 is about literature survey. It explains about the theory and concept of an inverted pendulum which discuss the mathematical models of an inverted pendulum system with its development and application of inverted pendulum. It also consists of the theory and concept of fuzzy logic control, the application of fuzzy logic control in real world and as well discussing about the advantages and disadvantages

Chapter 3 discuss about the modelling of an inverted pendulum system. It consists of a modelling of the inverted pendulum system that we will be used to derive the mathematical model. We will be showing the linearization of the inverted pendulum and also in Laplace transfer function.

Chapter 4 is about the theory of fuzzy logic. In this section we will be talking about the introduction of fuzzy logic such as fuzzy set and membership function used for creating fuzzy. We will also show some example of Rule-Base and also discussion about the fuzzy inference process. The advantages and disadvantages are also presented here. Lastly, a comparison of Mamdani FLC and Takagi Sugeno FLC is being made.

Chapter 5 will be about the designing of inverted pendulum in Simulink. In this section, we will shows how to derive the physical setup and system equation of the nonlinear inverted pendulum equation. Based on the nonlinear equation, we will develop the block diagram of inverted pendulum system in Simulink.

Chapter 6 presents about the fuzzy control method of inverted pendulum. Two types of fuzzy logic controller will be apply here which is the Mamdani Fuzzy Logic Controller and Takagi Sugeno (T-S) Fuzzy Logic Controller. The membership function and fuzzy control rules will be shown accordingly. Step by step of creating a FLC will be shown here.

Chapter 7 is about the simulation of inverted pendulum using various controllers. In this section, we will be showing the inverted pendulum system controlled by three types of controllers which is PID controller, Mamdani Fuzzy Logic Controller and Takagi Sugeno (T-S) Fuzzy Logic Controller. The results of the controller will be compared and discuss about the performance of three type controllers.

Chapter 8 is the last chapter which makes a conclusion for this project. Some recommendations and suggestion for future works have been listed out to other potential students or researcher on how to improve the efficiency and accuracy of this system.

CHAPTER 2: LITERATURE SURVEY

In this report, the literature survey mainly focused on the discussion about the findings from previous successful examples, research of inverted pendulum systems, the mathematical modelling, and the types of control methods, mechanical design aspects and studies of other related successful projects.

Inverted Pendulum Systems

Inverted Pendulum is a good example of non-linear control topic that is commonly being study and researched for different kind of control methods. It has been widely used by universities as teaching aids and research experiments for control system students. As a typical unstable nonlinear system, inverted pendulum is often used for verifying the performance and stability of new control method due to it simplicities structure.

Previous Studies of Inverted Pendulum

Before discussing in detail about this thesis, it’s important to provide some previous examples and work that have been done by other researcher in order to assist both the student and readers to familiarise about this project. Therefore, in this section we will be discussing some of the previous examples that have been done and introducing fuzzy control systems.

Trial-and-Error Correlation Learning to Control an Inverted Pendulum

A neural network approach for Inverted Pendulum was presented by Osamu Fujita and Kuniharu Uchimura [4]. In their research, they have proposed a method of Trial-and-error correlation (TEC) learning to train a 4-input neural controller with 2 hidden neurons. This method will show how the small neural controller of IP systems can be obtained by TEC learning. The controller will be used to optimize the performance by using TEC learning. The advantage of this method is that there is no need to analyse and model the plant and controller exactly. Although this method could be used for different types of controllers such as Fuzzy Logic Controller, however it’s proved that the Neural Network is much more suitable for an Inverted Pendulum controller as it’s simpler and easily constructed.

Stabilization Fuzzy Control of Inverted Pendulum Systems

A new fuzzy controller for stabilization control of Inverted Pendulum systems based on the Single Input Rule Modules (SIRMs) dynamically connected fuzzy inference model was presented by J.YI and N.Yubazaki [5]. This fuzzy controller consists of 4 input each with a SIRM and a dynamic importance degree. It’s being proposed that the fuzzy controller performs the pendulum angular control and the cart positon control in parallel since the SIRMs and the dynamic importance degrees are designed such that the pendulum angular control has priority over cart position control. The fuzzy controller will automatically do the switching between the two controls when the dynamic importance degrees automatically tuning according to the control situation. Based on the simulation results, it shows that the proposed fuzzy controller has a high generalization ability to do the stabilization completely over a wide range of the Inverted Pendulum systems within 9.0s for an initial angle up to 30.0degrees.

Nonlinear Control of Cart Pendulum System

A method of using a stable adaptive fuzzy controller with application to Inverted Pendulum tracking was investigated by Li-Xin Wang [6]. In this paper, he shows how an adaptive fuzzy controller is capable of incorporating a set of fuzzy IF-THEN rules which describe the systems are being used to control the plant directly and have proven that the final closed-loop system is globally stable in the sense that all signals involved such as states, controls, parameters, etc. are uniformly bounded and also making sure that the tracking errors converge to zero under mild conditions. Based on the simulation results, he has also proven that the adaptive fuzzy controllers are able to perform successful tracking without using any linguistic information and after incorporating some linguistic fuzzy rules into the controllers, the adaption speed became faster and tracking error becomes smaller.

Switching Control for Inverted Pendulum Based Energy Modification

A method of controlling and stabilizing inverted pendulum systems based on a switching control law has been proposed by Atsushi Yamada, Satoko Yamakawa and Hideo Fujimoto [7]. In this paper, they had presented the Switching Control for Inverted Pendulum System Based on Energy Modification. It is based on a modified energy such that the potential energy is minimum in upright position. The control of inverted pendulum system has been derived by paying attention to the energy of pendulum. They have proposed the model of inverted pendulum where the mass is situated at the centre of the pendulum’s pole and the cart does not has wheels. The proposed method will dealt with the swing up and stabilizing problem for inverted system. By paying attention to the transition of the modified energy, the stability of the switching controlled system was ensured. Based on the simulation result, the switching conditions were lead successfully.

Application of Inverted Pendulum

In this section, we will be presenting some practical applications of inverted pendulum that is commonly being used in our daily life which significantly contribute to the whole society.

Segway

An inverted pendulum is present in devices such as a unicycle and a Segway Human Transporter [8]. In these devices, the pivot of the pendulum is the axle of a wheel or pair of wheels. In a unicycle the wheel is powered by the rider. In a Segway Human Transporter, the wheel is powered by an electric motor. Motion of the wheel, or pair of wheel, is controlled so that the pendulum is dynamically balanced. (Segway webpage, 2006).

Figure 2 Segway Human Transporter

Rocket Navigation

The inverted pendulum control [10] model is similar to the rocket launch (Ogata, 2002). It was believed that, in flight, the rocket would “hang” from the engine like a pendulum hanging from a pivot. The weight of the fuel tank would keep the rocket flying straight up as long as the fuel lasted. However, this belief is incorrect, such a rocket will never fly in a straight line and will always turn and crash into the ground soon after launch. In the present work, the pendulum is free to move in plane xy and the cart is able to slide across x axle only. Nowadays, Rockets use Inertial Navigation [11] to solve this problem. Inertial navigation employs accelerometers and gyroscopes to determine speed and position. (Japan Aerospace Exploration Agency (JAXA), 2006).

Figure 3 Example of a Rocket Launch

Crane

The control of crane is one of the largest implementation that requires the model of inverted pendulum to demonstrate the working principles [13]. When moving the shipping containers back and forth, the cranes move the box accordingly so that it never swings or sways. It will stays perfectly positioned under the operator even when moving or stopping quickly.

Figure 4 Example of a Crane [14]

CHAPTER 3: SYSTEM MODELLING OF INVERTED PENDULUM

Inverted Pendulum Modelling

In this section, we will be considering a one stage inverted pendulum where the pendulum is constrained to move in the vertical plane as shown in Figure 5. The resistance and all kinds of friction will be ignored.

Figure 5 Modelling of Inverted Pendulum

Figure 6 Cart’s stress analysis

Figure 7 Force analysis of swing pole

Displacement for cart

Force applied the cart

Mass of the pendulum

Mass of the cart

Length of the pole

Angle between pole and vertical upward position

Angle between pole and vertical downward position

Interactive force’s components for cart and pole on horizontal position

Interactive force’s components for cart and pole on vertical position

Coefficient of friction for cart

Gravitational force

Table 1 Abbreviation for Inverted Pendulum

Linear Equation of Inverted Pendulum

As shown in Figure 5 is the Inverted Pendulum model with the cart’s stress analysis and Force analysis of the swing pole. Based on the force analysis on horizontal direction of the cart for Figure 7 we can derive the following equation:

(a)

Whereas based on the level of stress analysis Figure 6, the following expression is being showed.

(b)

By substituting (b) into (a), we will be getting the equation as shown below:

First equation for the motion can be simplified as shown below:

(c)

To get the second equation of motion, sum the forces perpendicular to the pendulum

(d)

To get rid of and terms in the equation above, sum the moments around the centroid of the pendulum to get the following equation:

(e)

By substituting (e) into (d)

(f)

Motion Equation (1)

(g)

Motion Equation (2)

(h)

It can be mention that the system only employs to linear control system. In order to linearize the equation, we can assume that ( is a small angle from the vertical upward direction) is very small and therefore. We can use the following small angle approximations of non-linear functions in our system equations:

(i)

(j)

(k)

After substituting (i), (j) & (k) to equation (g) and (h), we can finally conclude the below 2 linearized equations of motion. u is being use to represent the input force F.

(1a)

(1b)

Laplace Transfer Function of System Equations

By applying Laplace Transform to equation (1a) and (1b), we will be able to obtain the transfer functions of the linearized system equations as shown below:

(l)

(m)

By simplify equation (l), we are able to derive the first equation for as shown below:

(2a)

By substituting equation (n) to equation (m), the second equation for U(s) will be as shown below:

(2b)

After rearranging Equation (2b), we will have the transfer function of the Pendulum as shown below:

(3a)

Where

By solving Equation (2a) & (2b), we will be able to achieve the transfer function of the Cart accordingly:

(3b)

CHAPTER 4: THEORY OF FUZZY LOGIC

Fuzzy in dictionary is defined as “not clear, blurred”. Therefore, in control system it is a way to represent imprecision or inaccuracy in logic. It was specifically designed to represent uncertainty and vagueness and also provide formalized tools for dealing with imprecision intrinsic to a lot of problems.

The concept of Fuzzy Logic was first proposed by Lofti Zadeh, a professor at the University of California at Berkeley. He presented his method as a way of processing data by allowing partial set membership rather than crisp set of membership or non-membership. The application of fuzzy logic in control application includes the definition of fuzzy sets, membership function of fuzzy sets, the fuzzy inference process and fuzzy logic controller.

Fuzzy Set and Membership Function

The concept of the fuzzy set came from the spirit of human operation, where human judges many things in life based on their knowledge and experiences. Here we will look into one example which is the set of tall men. We will set the height of taller than or equal to 180cm are tall.

In a crisp set, binary set elements are defined as either a member of a given set or not (1 or 0). The definition of tall as can be presented as in Figure 8 by using the crisp set [15]. However, the crisp set cannot fairly reflect the meaning of tall, because two people with 230cm and 180cm in height are described with the same definition tall, but a person with 179.9cm is defined as not tall and this is illogically.

Figure 8 Membership Function 1

The theory of fuzzy set has a different approach to define the vague description of the term tall in the example. The definition of fuzzy set has membership interval values going by degrees between 0 and 1. As the value approaches the value of 1, higher is the rank corresponding to the definition of the label. Therefore, a fuzzy set A is characterized by a membership function, which can be written as:

Where U is a universe of discourse and u is a generic element of U.

The example of that which consider as tall by using the fuzzy set can be more precise represented by a crisp set in Figure 9. For example, we can define the two people with heights 175cm and 180cm in heights may be defined as “average tall” with membership degree of 0.39 and 0.40 respectively. A person with height 210cm and above is “very tall” with membership degree of 0.8 [15].

Figure 9 Membership Function 2

Rule-Base (If-Then rule)

The concept of the fuzzy control is based on human fuzzy descriptions. Human being tend to use their knowledge, experience and intuition to control the physical system in the real practical world. Here we will consider an example of tipping service with a single input and single output (SISO) by using the IF-THEN rules in Table 2.

Rule 1: IF the service is poor THEN tip is none.
Rule 2: IF the service is good THEN tip is good
Rule 3: IF service is excellent THEN tip is generous

Table 2 IF-THEN rules

The operation for an IF-THEN rule is that if the conditions of the antecedent parts are satisfied, then the condition of the consequent part will be active. Mamdani is the first researcher introducing the ideal of IF-THEN rules into the real world applications [16]. The method developed by Mamdani is Mamdani Fuzzy Logic Controller. The other widely known model which is the Sugeno Fuzzy Model or TSK Fuzzy Model was proposed by Takagi, Sugeno, and Kang. This method is known as Sugeno Fuzzy Logic Controller.

Fuzzy Inference Process

The fuzzy inference system (FIS) is a way to map from a given input to an output using fuzzy logic. The fuzzy inference process basically consists of 3 steps: Fuzzification, Rule Evaluation, and Defuzzification as shown in Figure 10.

Figure 10 Fuzzy Inference Process

The 3 steps of Fuzzy Inference Process are described as below:

Fuzzification: Fuzzification is the first step during the fuzzy inferencing process. It transforms the crisp inputs into the grades of the membership function. Figure 11 shows the membership function where are the fuzzification values based on input crisp values and the membership functions respectively.

Figure 11 Fuzzification for Membership Function A1, A2, B1 and B2

Rule Evaluation: The rule evaluation process consists of a series of IF-THEN rules. Figure 12 shows a single rule evaluation process, where the IF-THEN rule is “If x is and y is then z is”. The AND operation in the rule refers to an intersection which is described as. The intersection between the membership function and can be interpreted as a minimum of these two membership functions. We can defined minimum as :

The next step now is apply the implication method to the rule evaluation result, which is to perform another intersection operation between the membership functions of and. The results of implication processes can be evaluated by another minimum operation as described below:

Figure 12 Rule Evaluation

Defuzzification: The process of converting the fuzzy output values into a crisp value is called Defuzzification [17]. There are several different strategies for this process such as the maximum criterion method, the mean of the maximum method and the centre of gravity. The most common strategies is the centre of gravity method which calculates the centre of the gravity. The crisp output is the result and is passed out of the fuzzy inferencing system for processing.

Figure 13 Centre of Gravity method

Fuzzy Control Theory

Fuzzy control system is a control system that is based on the fuzzy logic which don’t require a precise mathematical modelling of the system nor complex computations. Fuzzy control system have been proved that its ability to solve non-linear problems which conventional control could not be solved easily.

A Fuzzy Logic Controller contains of 4 elements which is:

1) Rule-Base – Using a set of if-then rules which contains a fuzzy logic quantification of the expert’s linguistic description of how to achieve good control;

2) Inference Mechanism – Emulates the expert’s decision making in interpreting and applying knowledge about how efficiently to control the plant. A set of the ‘IF-THEN’ rules are loaded into the rule-base, and an inference strategy is chosen, then the system is ready to be tested, and the closed-loop specifications are needed;

3) ‘Fuzzification’ – It converts ‘crisp’ inputs into ‘fuzzy’ information, in which the inference mechanism can be interpreted and compared to the rules in the rule-base;

4) ‘Defuzzification’ – It converts the conclusions by the inference mechanism into the FLC crisp (actual) outputs as the control inputs for the plant.

Figure 14 Fuzzy Logic Controller Architecture [20]

Advantages and Disadvantages of Fuzzy Control

Advantages

It is very useful when the process model are unsure

It allows the use of vague linguistic terms in the rules

It doesn’t require a precise mathematical model.

The rule base of fuzzy sets can be easily modified.

It can be easily design with human intuition

It has a faster response and smoother controlling

It can be customizable according to operator’s requirement.

It is cheaper to develop compare than model based or other controller with comparable performance.

Disadvantages

It is very difficult to estimate the membership functions.

It is not easy to do tuning as operator’s experience are required.

It has a fairly complex system compare to conventional control.

Mamdani FLC vs Takagi Sugeno FLC

In this section, we will be discussing about the main difference between Mamdani type fuzzy logic controller and Takagi Sugeno (T-S) fuzzy logic controller.

The advantages of using Mamdani method:

Easy formalization and interpretability

It is well suited to human input.

The output can either be fuzzy or a crisp output.

It is suitable for both Multi Input Single Output (MISO) and Multi Input Multi Output (MIMO) systems.

It is intuitive and interpretable nature of the rule base which makes it widely used in particular for decision support application.

The advantages of using Sugeno method:

It works well with linear techniques (e.g. PID)

It is more computation efficiency and accuracy.

It has a better processing time since the weighted average replace the time consuming Defuzzification process.

It is well suited to mathematical analysis.

It works well with optimization and adaptive techniques such as ANFIS.

CHAPTER 5: DESIGN OF INVERTED PENDULUM

In this section, we will be discussing about the designing of Inverted Pendulum in Simulink, MATLAB. We will be employing the non-linear equation to set up or inverted pendulum block diagram. A mathematical equation will be shown in the following sections as well based on the model in Figure 5.

System Parameters for Inverted Pendulum

In this thesis, we will be considering a two-dimensional version of the inverted pendulum system with cart in which the pendulum is constrained to move in the vertical plane. The control input is the force that moves the cart horizontally and outputs are the angular position and the displacement for cart.

c

Mass of the pendulum

M

Mass of the cart

l

Length of the pole

Inertia of the pendulum

b

Coefficient of friction for cart

g

Gravitational force

Angle between pole and vertical downward position

N

Interactive force’s components for cart and pole on horizontal position

P

Interactive force’s components for cart and pole on vertical position

x

Displacement for cart

F

Force applied to the cart

Table 3 Parameters for Inverted Pendulum

Physical Setup and System Equation of Inverted Pendulum

(5.2)

(5.1)

Due to the physical constraint between the cart and pendulum which reduces the degrees of freedom in the system, the modelling of this system in Simulink have made this simulation very challenging. Given that the cart and pendulum have one degree of freedom which is x and respectively, we will be applying Newton’s second law which is to generate the differential equations for these degrees of freedom.

(5.4)

(5.3)

It is necessary to include interaction forces N and P between the cart and pendulum to fully model the system’s dynamic. Modelling of and components of the translation of the pendulum’s centre of mass are required due to the inclusion of these interaction forces as an additional to its rotational dynamics. The equations for additional x- and y-component for the pendulum is shown as below:

Since and are exact functions of, hence we can represent their derivatives in terms of derivatives of The and component equations will be as shown below:

(5.5)

For component:

(5.6)

For component:

(5.8)

(5.7)

Finally, we will substitute the Equation (5.5) and Equation (5.6) into the expression for and Equation (5.3) and Equation (5.4) as shown below:

Since Simulink can deal with non-linear equations directly, hence it is unnecessary to linearize these equations as shown in Chapter 3.

Block Diagram of Inverted Pendulum in Simulink

In this section, we will be showing step by step of generating the block of inverted pendulum in Simulink. We will be using these non-linear equations as shown in Chapter 5.2. The main reason we choose to work with non-linear equations are because fuzzy logic control is a nonlinear control method which provides better control performance than other conventional control. Hence, we will not be employing the linear equations that we have derived earlier in Chapter 3.

A step-by-step guidelines on how to build an inverted pendulum with the non-linear equations that we have derived will be demonstrate as shown below:

Step 1: First, we will select the “Subsystem” block from the Ports & Subsystems categories in Simulink Library Browser. Rename it as Inverted Pendulum.

Figure 15 Subsystem block of Inverted Pendulum

Step 2: Double click on the subsytem block, set up one “input” port and four output ports , , and .

Figure 16 Input and Output ports

Step 3: Set up four “Function” block from the User-Defined Functions categories in Simulink Library Browser. Rename the four block as , thetaddot, and accordingly.

Figure 17 Function Blocks

Step 4:

a) For Function block, we will enter the Equation (5.1) into it. Given that this equation requires three inputs: Type in the equation into the first Function block as shown in Figure 18:

Figure 18 “xddot” Function Block

b) For Function block we will enter the Equation (5.2) into it. Given that this equation requires three inputs:.Type the equation into the second function block as shown in Figure 19:

Figure 19 “thetaddot” Function Block

c) For Function block, we will enter Equation (5.7) into it. Given that this equation requires four inputs: .Type the equation into the third function block as shown in Figure 20:

Figure 20 “N” Function Block

d) For Function block, we will enter the Equation (5.8) into it. Given that this equation requires three inputs: .Type the equation into the forth function block as shown in Figure 21:

Figure 21 “P” Function Block

Step 5: Set up four “Integrator” blocks from the Continuous categories in Simulink Library Browser. The output of each Integrator blocks represents the state variable of the system: accordingly.

Figure 22 Integrator Blocks

Step 6: Insert four “Mux” blocks from the Signal Routing categories from Simulink Library Browser, change the input of the mux according to the number of inputs required for the equation in each Function block and connect to each Function block accordingly.

Figure 23 Mux Blocks

Step 7: Connect the output of the and Function blocks to the integrators that we have created earlier to generate the cart’s position, cart’s velocity, pendulum’s angle and angular velocity respectively.

Figure 24 Connections of various blocks

Step 8: Finally, link the right Function block to the Mux block in the correct order in respect to the equations of each blocks. The completed subsystem model of our inverted pendulum should appear as shown in Figure 25.

Figure 25 Completed subsystem of Inverted Pendulum

Step 9: In order for us to input or change the parameters of our system easily, we will create a subsystem parameter block to perform this tasks. Right click on our subsystem block and select Mask > Create Mask. Click on the Parameters & Dialog and input the parameters accordingly as shown in Figure 26:

Figure 26 Parameters and Dialog

Step 10: Double click on our Inverted Pendulum subsystem block to input the parameters that we have specified in Table 3 into our Function Block Parameters Figure 27.

Figure 27 Function Block Parameters

Finally, the complete subsystem block of our inverted pendulum will be as shown in Figure 28:

Figure 28 Inverted Pendulum Subsystem block

A step by step guidelines on how to create a block diagram of our inverted pendulum system have been presented in this section to allow the reader or future students have a better understanding of how we input the nonlinear equation and map into our system accordingly. By creating a mask of the subsystem, we can modify the parameters at any time according to our specification required for the inverted pendulum systems.

CHAPTER 6: DESIGN OF FUZZY CONTROL FOR IP SYSTEM

In order to stabilize the inverted pendulum systems, the fuzzy logic controller is designed to perform this task. The fuzzy logic controller will be constructed by considering the angle and velocity of the pendulum’s angle as conditional variables and the force as reaction variable. Here, two types of fuzzy logic controller will be demonstrated which is the Mamdani type and Sugeno type Fuzzy Logic Controller. As Mamdani Fuzzy Logic Controller is not our main controller to be demonstrate in this project, hence we will be showing just a simple example of how to implement Mamdani Fuzzy Logic Controller whereas a more detailed type of Sugeno Fuzzy Logic Controller will be presented in the following sections.

In order to process the input to get the output, these 6 steps [21] are essential required to create a rule based fuzzy system:

Identify the inputs and ranges.

Identify the outputs and ranges.

Create the degree of fuzzy membership function for each input and output.

Construct the rule base that the system will operate with.

Decide how the action will be executed by assigning strengths to the rules.

Combine the rules and defuzzify the output.

Mamdani Fuzzy Logic Controller

In order to construct a fuzzy logic controller, first we need to consider the input and output of the plant systems. As mentioned earlier on, we will be focusing on the balancing of swing, hence for this designed, we will take the pendulum’s angle and velocity of the pendulum’s angle as the input and force as output.

For input, the controller will be applying 3 linguistic values to describe them which is:

Where N: Negative, Z: Zero and P: Positive.

For output, the controller will be applying 5 linguistic values which is:

Where NB: Negative Big, N: Negative, Z: Zero, P: Positive and PB: Positive Big.

By applying the input and outputs into the membership function, we are able to plot the membership functions and create rules for the fuzzy logic controller.

Mamdani Modelling

In order to create a Mamdani Fuzzy Logic Controller, we required two input and one output variable. Rename the two input as theta and thetadot whereas the output as F, a two-dimensional fuzzy controller as shown in Figure 29 has been established.

Figure 29 a two-dimensional Mamdani fuzzy controller

The next step is to set the range of inputs and outputs of the Fuzzy Logic Controller, double click on the variables and set the range of theta as [-1,1], range of thetadot as [-2,2] and range of F as [-50,50]. We will be using “trimf” as our membership function. The definition for the coordinates is indicated in Figure 30, Figure 31 and Figure 32.

Figure 30 Membership Function for theta

Figure 31 Membership Function for thetadot

Figure 32 Membership Function for F

Fuzzy Control Rules

The main core of fuzzy logic controller are the control rules as the rules directly affect the performance of the controller. The control performance will be greatly improved if the suitable rule base have been created. In this design, since this is just a simple Mamdani Fuzzy Logic Controller, we will have only 3 x 3 = 9 fuzzy rules. Table 4 shows the 9 fuzzy rules that we will be using in our Mamdani fuzzy logic controller.

N

Z

P

N

NB

N

Z

Z

N

Z

P

P

Z

P

PB

Table 4 Fuzzy rules for Mamdani FLC

In order to add rules in Fuzzy Logic Designer, go to Edit > Rules, the outlook of the rule editor should appear as Figure 33:

Figure 33 Outlook of Rule Editor

Based on the rules that we have created in Table 4, the following rule base is formed for the fuzzy controllers to control the inverted pendulum.

Figure 34 Fuzzy Rules

Once the complete system has been set up from defining the linguistic terms to creating the rules, we can now start to process the input. Note that for this rules, we are using “and” as our connection between the 3 variables to link them together forming our rules.

Overview of Fuzzy Controller

Once the complete system has been set up from defining the linguistic terms to creating the rules, we are able to view the fuzzy controller that we have just created to cross check the rules of inference. This will provide an overview of how our rules that we have created in Section 6.1.2 works. By selecting View > Rules, the rule viewer is available as shown in Figure 35.

Figure 35 Rule Viewer for Mamdani FLC

By selecting View > Surface, the output will appear on a 3D map which can be vary to view the input and output surfaces of fuzzy inference system (Figure 36).

Figure 36 Surface Viewer for Mamdani FLC

Lastly, the completed implementation of FIS can be seen by right click on FIS Wizard block and select Mask > Look under Mask. This will shows our completed process of fuzzy logic controller from defining the number of inputs, output and how these inputs and output will be connected to our rules based on what we have created and lastly defuzzification will be carried out internally without users required to do manual calculation which is very convenience.

Figure 37 Subsystem of Mamdani FIS Wizard

Takagi Sugeno (T-S) Fuzzy Logic Controller

In the previous Chapter 6.1, we have manage to construct a basic Mamdani Fuzzy Logic Controller. We will now build another type of Fuzzy Logic Controller namely Sugeno Fuzzy Logic Controller. For this controller, the objective will be the same as Mamdani FLC which is to control the pendulum’s swinging angle. Therefore our input will be pendulum’s angle (theta) and velocity of the pendulum’s angle whereas force as output of the systems.

For both the input and output, the controller will be applying 7 linguistic values which is:

Where NB: Negative Big, NM = Negative Medium, NS = Negative Small, ZO = Zero, PS = Positive Small, PM = Positive Medium and PB = Positive Big.

T-S Modelling

The steps to create our Sugeno Fuzzy Logic Controller is the same as Mamdani Fuzzy Logic Controller. In order to create a Sugeno FLC, select File > New FIS > Sugeno. We required two input and name them as theta and thetadot, one output which we will name it as which is Force.

Figure 38 a two-dimensional Sugeno fuzzy controller

The next step is to set the range for both inputs and output respectively. Here we have set the range of theta as [-6, 6], range of thetadot as [-pi/2, pi/2] and select output type of F as constant. The main difference between Mamdani Fuzzy Logic Controller and Sugeno Fuzzy Logic Controller is the way the crisp output is being generated from the fuzzy inputs. For our output, we will assigned every linguistic values a constant value as shown in Table 5.

NB

NM

NS

ZO

PB

PM

PS

Table 5 constant values for output F

Once we have decided on the range of inputs and outputs for the controller, the next step is to design the membership function. For the membership type of our Sugeno FLC, we will be selecting “trimf” which is same as our membership type for Mamdani FLC. The membership functions and range for the inputs and output will be shown in Figure 39, Figure 40 and Figure 41.

Figure 39 T-S Membership Function for theta

Figure 40 T-S Membership Function for thetadot

Figure 41 T-S Membership function for F

Fuzzy Control Rules

As mention in Chapter 6.1.2, the fuzzy control rules plays an important roles in controlling the systems. Hence in this system, we will be setting 49 rules as we have 2 inputs each with 7 linguistic variables, therefore rules. The rules will be presented in Table 6.

NB

NM

NS

ZO

PS

PM

PB

NB

NB

NB

NB

NB

NM

NM

NS

NM

NB

NB

NM

NM

NS

ZO

ZO

NS

NB

NM

NS

NS

ZO

PS

PM

ZO

NB

NM

NS

ZO

PS

PM

PB

PS

NM

NS

ZO

PS

PS

PM

PB

PM

ZO

ZO

PS

PM

PM

PB

PB

PB

PS

PM

PM

PB

PB

PB

PB

Table 6 Fuzzy rules for Sugeno FLC

After we have decided on the rules as shown in Table 6, we can now input the rules accordingly in Fuzzy Logic Designer. The connection type for the inputs and output will be “and”. The outcome will be as shown in Figure 42.

Figure 42 Rule Editor for Sugeno FLC

Overview of Fuzzy Controller

The Sugeno FLC’s rule can be view under rule viewer as shown in Figure 43.

Figure 43 Rule Viewer for Sugeno FLC

The surface represents the information about the output F based on theta and thetadot in the fuzzy controller is shown in Figure 44.

Figure 44 Surface Viewer for Sugeno FLC

The completed implementation of FIS will be as shown below in Figure 45.

Figure 45 Subsystem of Sugeno FIS Wizard

CHAPTER 7: SIMULATION OF INVERTED PENDULUM

Inverted Pendulum with PID Controller

In this section, we will design a PID controller for the inverted pendulum system as shown below in Figure 46. We will be employing PID controller to compare with our Fuzzy Logic Controller as PID is a classic control method that is widely being implemented both in industrial process control and also as a teaching aid due to its simple algorithm, robustness and high reliability. The equation can be expressed as:

Where is the proportional terms, is the integral and is the derivative.

Figure 46 Block diagram for PID Controller

PID Controller Design

Based on the general block diagram as shown in Figure 46, we managed to construct the block diagram of inverted pendulum based on what we have created in Section 5.3 which will be control by PID controller in Simulink. The overview of the block diagram is shown below in Figure 47.

Figure 47 Simulink of PID controller

PID Simulation Results

In order to achieve the best result, several parameters have been tested for PID. After some trial and error, the output response of inverted pendulum with PID controller is as shown in Figure 48, Figure 49 and Figure 50.

Figure 48 , = 1, = 1

Figure 49 , = 1, = 5

Figure 50 , = 1, = 10

From the responses for both the pendulum’s angle and velocity of pendulum’s angle, we can see that the PID controller is doing a great job in controlling both the pendulum’s angle and velocity of angle. The greater, the response speed will be faster, the bigger will helps to reduce the oscillation becomes smaller. Based on our trial and error results, we have derived that the best PID controller parameters are. However, in our design, the absence of control on the location of the cart results in the cart not able to back to origin position. Based on our parameters of, our simulation of the cart’s position x and velocity of position is shown below in Figure 51.

Figure 51 Output curve of cart’s position and velocity of position

Inverted Pendulum with Mamdani Fuzzy Logic Controller

Mamdani Fuzzy Logic Controller was known as the first control systems that applied fuzzy set theory which was proposed in 1975 by Ebrahim Mamdani. In this section, we will be showing the control of inverted pendulum using Mamdani fuzzy controller and PID link together which will results in a more stable system with at the anticipant position. A simple structure of the block diagram has been presented as below:

Figure 52 PID + Mamdani FLC Block Diagram

Mamdani FLC design

Based on the general block diagram shown in Figure 52, we have construct the block diagram of inverted pendulum control by the Mamdani Fuzzy Logic Controller that we have built in Chapter 6.1 together link with PID controller in Simulink as shown in Figure 53.

Figure 53 PID + Mamdani FLC in Simulink

In this design, a saturation block have been added to limit the range of Force which we have set in Section 6.1.1. The upper limit is 50 whereas lower limit is -50 as shown in Figure 54.

Figure 54 Saturation Mamdani

Mamdani Simulation Results

Based on the block diagram that we have built in Figure 53, the simulation result for the output response of inverted pendulum controlled by Mamdani Fuzzy Logic Controller with PID is shown below:

Figure 55 Output response for theta using Mamdani FLC

Figure 56 Output response for thetadot using Mamdani FLC

Based on the output curves shown in Figure 55 and Figure 56, we can see that the Mamdani Fuzzy Logic Controller is doing a great job in controlling the non linear control system for inverted pendulum. Roughly after about , the system quickly reaches equilibrium. The pendulum’s angle was managed to controlled and balanced even when a disturbance or force was being exert to the systems.

Inverted Pendulum with T-S Fuzzy Logic Controller

Sugeno type is another type of fuzzy inference method which was first introduced by Takagi-Sugeno-Kang in 1985. It is quite similar to Mamdani FLC in many ways, however the main difference between Mamdani and Sugeno is that the output membership functions of T-S fuzzy logic controller is either a constant or linear outputs. In this section, we will demonstrate the controlling of inverted pendulum system using Sugeno FLC with PID controller. A basic block diagram of our system is shown below:

Figure 57 PID + Sugeno FLC block diagram

T-S FLC design

We have constructed the design of our block diagram in Simulink based on Figure 57. The design of inverted pendulum with T-S FLC controller which we have built in Chapter 6.2 link with PID controller is present as shown below:

Figure 58 PID + Sugeno FLC in Simulink

A saturation block have also been added to limit the range of Force which we have set in Section 6.2.1 where the upper limit is 3 and lower limit is -3 as shown in Figure 59.

Figure 59 Saturation T-S

T-S Simulation Results

The output response of inverted pendulum with T-S Fuzzy Logic Controller link with PID controller will show in below:

Figure 60 Output response for theta using Sugeno FLC

Figure 61 Output response for thetadot using Sugeno FLC

From the output response shown in Figure 60 and Figure 61, we can see that our T-S Fuzzy Logic controller is also able to achieve a relatively good control effect in controlling our nonlinear inverted pendulum systems. After about, the pendulum’s angle is able to balance and stay upright to maintain a dynamic equilibrium even with a presence of disturbance of force to the systems.

Results and Comparison of the Inverted Pendulum with various controllers

After we have successfully implementing various controllers (PID, Mamdani fuzzy logic controller and Sugeno fuzzy logic controller) to control the inverted pendulum’s angle, we will be comparing between their performance and stability. As we can see from the output response that we have generated for the three controllers in Figure 62, it is very obvious that the employing of Fuzzy Logic Controller (Mamdani and T-S) in controlling inverted pendulum has helped to improve the performance of the system in stabilizing pendulum’s angle within the shortest time and minimum overshoot to stay at the upright position.

Figure 62 Comparison of 3 controllers in Simulink

Table 7 shows the comparison for three types of controllers in controlling the pendulums.

Types of Controller

Maximum Overshoot (%)

Settling Time (seconds)

Steady State

Error (%)

PID

Mamdani FLC

Sugeno FLC

Table 7 Comparison for controllers (PID, Mamdani and Sugeno)

From the comparison shows in Table 7, we can see that both Mamdani and Sugeno Fuzzy Logic Controller have obviously help to improve the overall performance of the inverted pendulum systems. The maximum overshoot is found out to be for PID controller whereas it’s only and for Mamdani and Sugeno FLC respectively. For the settling time, PID controller requires to perform the settling down task whereas Mamdani FLC and Sugeno FLC only requires and to settle down which is a significantly fast response compare to the PID controller.

CHAPTER 8: CONCLUSION

Conclusion

The inverted pendulum is a classical system that is widely being used to control in control system. The pendulum is known to be extremely unstable and will fall over whenever there is any external disturbances or force being exerted to the system. Therefore in this thesis, our main objective is to build a model of nonlinear inverted pendulum system with the help of fuzzy logic controller to stabilize the systems.

At the initial stage of this project, a nonlinear model of the inverted pendulum-cart system was being researched and then developed in MATLAB – Simulink. Model of fuzzy logic controller was then being built and designed using the Fuzzy Logic Toolbox in MATLAB. Two types of fuzzy controller was designed which is the Mamdani FLC and Sugeno FLC to perform the tasks. The fuzzy rules are being designed distinctively for the FLC based on the inverted pendulum’s control system features. In order to be more precise in controlling the pendulum’s swinging angle, the fuzzy recognition theory is being employed to perform the tasks. A conventional type controller; PID was also designed to control the inverted pendulum system.

The performance of three types of controller (PID, Mamdani and Sugeno) was being compared. Based on the performance that we have achieved, we are able to verify that the Fuzzy Logic Controller (Mamdani type and Sugeno type) were able to achieve better performance. The fuzzy controller is able to stabilise the system in a much lesser time and maximum overshoot has also decreased accordingly when compared to the PID controller. The results of the comparison between the various controllers can be observed from Table 7. Hence it is clear that from the simulation studies, Fuzzy Logic Controller works more efficiently and effectively when compared to the PID controller. Moreover, the stabilization is robust and able to withstand and overcome any external disturbances which is essential.

Apart from that, fuzzy logic controller has found out to be easier to implement as it doesn’t require complicated mathematical modelling process. It applies a set of control rules and memberships instead to do the controlling which is very different from the conventional control theory such as PID controller. By manually tuning fuzzy logic controllers can effectively controlled the inverted pendulum systems. Regardless the pendulum has faced various deviations, the fuzzy logic controllers were able to assist the system to recover quickly and stabilize the pendulum within the required control. It is to be mention that fuzzy logic controller are able to applied to other nonlinear system as well.

At the end of this project, we can conclude that the objective being set in Chapter 1.3 have been met accordingly. However, there is still some further work that can be done in the future which will helps to improve the systems using different kind of control method. More information about this will be discuss in Chapter 8.2.

Suggestion of Future Works

As tuning of Fuzzy Logic Controller is consider a very challenging tasks since it requires an expert’s knowledge and experience, in which the tuning process of the modification of fuzzy sets and fuzzy rule base may affect the overall systems. Hence in future, students or researchers might consider experimenting with different fuzzy implications and operators for such applications. Different parameters for the inverted pendulum system can also be changed to experience a different and better performance.

For this project, our main objective is only to control the pendulum’s swinging angle in which the cart is stable at a fixed position. Therefore in future, the control of cart’s position can be taken into consideration as well with the control of pendulum’s swinging angle.

Although by observing from the graph shown in Figure 62, the pendulum’s angle is able to controlled and stabilized within a very short time. However, in real world practical implementation, conditions may vary as more considerations such as materials used, floor roughness and air resistance etc. might need to take into consideration. Therefore in future we can also look into the implementation of a simple robotics system to verify our simulation results.

For this thesis, Mamdani and Sugeno fuzzy logic controller have been introduced and implemented to control the inverted pendulum system, and the outcome is relatively satisfying in terms of stability and performance. However, another type of fuzzy logic controller using the Adaptive Neuro-Fuzzy Inference System or adaptive network-based fuzzy inference system (ANFIS) may be developed to control the cart and pendulum of an inverted pendulum systems. ANFIS is based on a neuro-fuzzy hybrid approach that is based on Takagi-Sugeno fuzzy inference system. Results from such controller could be made compared with what we have done so far.

REFERENCING

[1] Carlitoscontraptions.com, (2015) Robot | Carlitos’ Contraptions. [online] Available From: http://www.carlitoscontraptions.com/tag/robot/ [Accessed 15 Nov. 2015]

[2] Rowell, D. and David, N. W. (1996) System Dynamics: An Introduction. United States, Upper Saddle River, New Jersey: Prentice-Hall publishing.

[3] Magana, M.E. and Holzapfel, F. (1998) Fuzzy-logic control of an inverterd pendulum with vision feedback. IEEE Transactions on Education. 41(2), pp.165-170.

[4] Fujita, O. and Uchimura, K. (1994) Trial-and-Error Conrrelation Learning to Control an Inverted Pendulum. The 3rd International Conference on Fuzzy Logic, Neural Nets and Soft Computing. pp.271-272.

[5] Yi, J. and Yubazaki, N. (2000) Stabilization fuzzy control of inverted pendulum systems. Artificial Intelligence in Engineering, 14(2), pp.153-163.

[6] Wang, Y. (2011) Nonlinear Control of cart pendulum system. International Review on Modelling and Simulations, 4 (3), pp.22-28.

[7] Yamada, A., Yamakawa, S. and Fujimoto, H. (2004) Switching Control for Inverted Pendulum System Based on Energy Modification. SICE Annual Conference in Sapporo. 3, pp.2316-2321.

[8] Segway (2016) Simply. Robotics. Available from: http://www.segway.com [Accessed 22 March 2016].

[9] XPATNATION (2016) Europe Launches IXV Rocket to Acquire Spaceplane Technology. Available from: https://www.xpatnation.co/europe-launches-ixv-rocket-to-acquire-spaceplane-technology/#.n11I46z0t [Accessed 10 March 2016]

[10] Ogata, K. (2002) Modern Control Engineering. 4th ed. United States, Upper Saddle River, New Jersey: Prentice-Hall publishing.

[11] Japan Aerospace Exploration Agency (JAXA) (2006) Space Information Centre. Available from: http://spaceinfo.jaxa.jp/ [Accessed 10 March 2016].

[12] Lima, J. L., Goncalves, J. C., Costa, P. G. and Moreira A. P. (2006) Inverted Pendulum Virtual Control Laboratory. The 7th Portuguese Conference on Automatic Control, Lisboa.

[13] Mladenov, V. (2011) Application of Neural Networks for Control of Inverted Pendulum. Wseas Transactions on Circuits and Systems. 10(2).

[14] Courtesy Liebherr International (c. 2006) Tower Crane [Figure in essay]. At: Washington [online]. Available from: http://www.historylink.org/index.cfm?DisplayPage=output.cfm&file_id=8164 [Accessed 12 March 2016].

[15] Chou, C. S. (1998) An experimental investigation of the fuzzy logic control of an inverted pendulum. Theses and Dissertations of Lehigh University. pp.558

[16] Mamdani, E. H. (1974) Applications of fuzzy algorithms for a simple dynamic plants. IET Journals & Magazines. 121(12), pp.1585-1588.

[17] Kharagpu, CSE IIT NPTEL (2016) Module 11: Reasoning with uncertainty-Fuzzy Reasoning. Available from: http://nptel.ac.in/courses/106105078/pdf/Lesson%2032.pdf [Accessed 2 February 2016].

[18] Passino, K.M.; Yurkovich, S. (1998) Fuzzy Control. United States, California, Menlo Park: Addison-Wesley publishing.

[19] Pitalúa-Díaz, N., Herrera-López E. J., Valencia-Palomo, G., González-Angeles, A., Ricardo, Rodríguez-Carvajal, R. A. and Cazarez-Castro, N. R. (2015) Comparative Analysis between Conventional PI and Fuzzy Logic PI Controllers for Indoor Benzene Concentrations. Sustainability. 7(5), pp. 5398-5412.

[20] Pitalúa-Díaz, N., Herrera-López E. J., Valencia-Palomo, G., González-Angeles, A., Ricardo, Rodríguez-Carvajal, R. A. and Cazarez-Castro, N. R. (2015) Scheme of a fuzzy logic controller [Figure in paper]. At: Switzerland: MDPI Headquarters, Basel [online]. Available from: http://www.mdpi.com/2071-1050/7/5/5398/htm#B32-sustainability-07-05398 [Accessed 2 February 2016].

[21] Sumathi, S. and Paneerselvam, S. (2010) Computational Intelligence Paradigms: Theory& Applications using MATLAB [online]. Untied States: CRC publishing. [Accessed 15 January 2016].

[22] Jain, A., Tayal, D. and Sehgal, N. (2013) Control of Non-linear Inverted Pendulum using Fuzzy Logic Controller. International Journal of Computer Applications. 69(27).

[23] Khosla, A., Leena, G. and Soni, M. K. (2013) Performance Evaluation of various Control Techniques for Inverted Pendulum. International Journal of Engineering Research and Applications (IJERA). 3(4), pp.1096-1102.

[24] Arshdeep, K. and Amrit, K. (2012) Comparison of Mamdani-Type and Sugeno-Type Fuzzy Interface Systems for Air Conditioning System. International Journal of Soft Computing and Engineering (IJSCE). 2(2). pp.2231-2307.

[25] Yi, J. Q. and Yubazaki, N. (2000) Stabilization fuzzy control of inverted pendulum systems. Artificial Intelligence in Engineering. 14(2000), pp.153-163

[26] Mehran, K. (2008) Takagi-Sugeno Fuzzy Modeling for Process Control. Industrial Automation, Robotics and Artificial Intelligence (EEE 8005).

[27] Hussian, K. and Kand, A. A. (2012) Comparative Performance Analysis between Fuzzy Logic Controller (FLC) and PID Controller for an Inverted Pendulum System. International Journal of Electrical, Electronics and Computer System (IJEECS). 10(2).

[28] Radahamohan, S.V., MONA, S. A. and Nigam, M. J. (2010) Fuzzy Swing-up and Stabilization of Real Inverted Pendulum Single Rulebase. Theoretical and Applied Information Technology. 6(4).

[29] Holden, T. and Screaruno, M. (2000) Controlling the Inverted Pendulum using Pulse-Trains and Fuzzy Logic. Department of Cambridge, University of Cambridge.

[30] Roshdy, A. A., Lin, Y. Z., Mokble, H.F. and Wang, T. Y. (2012) Stabilization of Real Inverted Pendulum Using Pole Separation Factor. International Conference on Mechanical Engineering and Material Science. 107(2012).

[31] Ding, Z. and Li, Z. (2014) A Cascade Fuzzy Control System for Inverted Pendulum based on Mamdani-Sugeno type. Industrial Electronics and Applications (ICIEA), IEEE 9th Conference. pp. 792-797.

[32] Chakraborty, K., Mahato, J. and Mukherjee, R. R. (2013) Tuning of PID Controller of Inverted Pendulum Using Genetic Algorithm. International Journal of Electronics & Communication Technology. 4(1), pp. 393.

[33] Arda, M. and Kuscu, H. (2012) Modelling of Two dimensional Inverted Pendulum in MATLAB/Simulink. The 5th International Mechanical Engineering Forum. 80(2), pp.116-126.

APPENDIX 1: GENERATING FUZZY IN MATLAB

In the previous section, we have shown all the steps required to construct a fuzzy logic controller from scratch. However, it is necessary to import the FIS file that we have created into Simulink every time when we open our systems. Here we will be demonstrating the steps to import FIS file into Simulink.

Step 1: First, we type ‘fuzzy’ in the command box from MATLAB to open up the Fuzzy Logic Designer as shown in Figure 1 & Figure 2.

Figure 1

Figure 2

Step 2: The next step is to import the files. Select File > Import > From File > choose location of our files.

Figure 3

Step 3: After we have import the files as shown in Step 2, we will export the files that we have opened to Workspace so our Fuzzy Logic Controller is able to read it. Select File > Export > To Workspace as shown in Figure 4 and Figure 5.

Figure 5

Figure 4

Step 4: After we have perform step 3, our files will be successfully export to the workspace. To double check we can see from the Workspace in MATLAB as shown in Figure 6. Now our Fuzzy Logic Controller is ready and simulation for our Inverted Pendulum system can be run.

Figure 6

APPENDIX 2: PROJECT GANTT CHART

APPENDIX 3: PROJECT TASK BREAKDOWN

Task Name

Begin Date

End

Date

Duration

1.0 Selection of Projects
1.1 Project Selection & Registration

21/09/15

28/09/15

7 days

2.0 Project Research
2.1 Study on Previous Projects

29/09/15

13/10/15

14 days

2.2 Research on Inverted Pendulum modelling

14/10/15

04/11/15

21 days

2.3 Research on Fuzzy Logic Controller

05/11/15

26/11/15

21 days

2.4 Review current project & examples

27/11/15

05/12/15

8 days

2.5 Further studies on MATLAB toolbox

06/12/15

13/12/15

7 days

3.0 Modelling Design
3.1 Create a model for Inverted Pendulum

14/12/15

21/12/15

7 days

3.2 Derive Mathematical Equations

22/12/15

28/12/15

6 days

3.3 Design model for Inverted Pendulum in Simulink

29/12/15

12/01/16

14 days

4.0 Design of Controllers
4.1 Build Mamdani Fuzzy Logic Controller

13/01/16

01/02/16

19 days

4.2 Build Sugeno Fuzzy Logic Controller

02/02/16

22/02/16

20 days

4.3 Build PID controller

23/02/16

29/02/16

6 days

5.0 Bench Test & Collecting Results
5.1 Simulation of controllers

01/03/16

12/03/16

11 days

5.1.1 Mamdani with Inverted Pendulum

01/03/16

05/03/16

4 days

5.1.2 Sugeno with Inverted Pendulum

05/03/16

09/03/16

4 days

5.1.3 PID with Inverted Pendulum

09/03/16

12/03/16

3 days

5.2 Compare & discuss results

13/03/16

16/03/16

4 days

6.0 Project Completion
6.1 Construct report

17/03/16

31/03/16

14 days

6.2 Submission of draft report for review

01/04/16

07/04/16

6 days

6.3 Final report submission

08/04/16

14/04/16

6 days

Tags: , , , , , , , , , , , , , , , , , , ,