You are on page 1of 155

FUZZY LOGIC PD CONTROL OF A NON-LINEAR INVERTED

FLEXIBLE PENDULUM
____________
A Project
Presented
to the Faculty of
California State University, Chico
____________
In Partial Fulfillment
of the Requirement for the Degree
Master of Science
in
Electrical and Computer Engineering
Electronic Engineering Option
____________
by
Kou A. Kong
Summer 2009

FUZZY LOGIC PD CONTROL OF A NON-LINEAR INVERTED


FLEXIBLE PENDULUM

A Project
by
Kou A. Kong
Summer 2009

APPROVED BY THE INTERIM DEAN OF THE SCHOOL OF


GRADUATE, INTERNATIONAL, AND INTERDISCIPLINARY STUDIES:

_________________________________
Mark J. Morlock, Ph.D.

APPROVED BY THE GRADUATE ADVISORY COMMITTEE:

_________________________________
Adel A. Ghandakly, Ph.D.
Graduate Coordinator

_________________________________
Adel A. Ghandakly, Ph.D., Chair

_________________________________
Ben-Dau Tseng, Ph.D.

DEDICATION

This is dedicated to my loving wife and son, Cindy and Acesen, for their love,
support and strength. This is also dedicated to my parents and grandparents for their
guidance throughout my life.

iii

ACKNOWLEDGMENTS

This project was made possible by the guidance of Dr. Adel Ghandakly and
assistance of my good friends (Rostan, Wilfred, and Tien) at California State University,
Chico. I would like to give many thanks to instructor Dale Word for giving me a chance
to attend the graduate school, Dr. Uma Balaji for believing and supporting me, Kathy
Leduc for making my years at Chico State comfortable, Dr. Ben-Dau Tseng for helping,
and Trish for being my lab companion for the summer.

iv

TABLE OF CONTENTS

PAGE

Dedication...................................................................................................................

iii

Acknowledgments ......................................................................................................

iv

List of Tables..............................................................................................................

vii

List of Figures.............................................................................................................

viii

List of Nomenclature..................................................................................................

xi

Abstract.......................................................................................................................

xiv

CHAPTER
I.

II.

III.

Introduction ..............................................................................................

Current Use of Inverted Pendulum...............................................


Control Techniques ......................................................................
Layout of the Project Report ........................................................

1
4
4

Flexible Inverted Pendulum System.........................................................

System Model...............................................................................
Kinetic Energy of the System.......................................................
Potential Energy of the System ....................................................
Euler-Lagrange Differential Equation of Motions .......................

6
9
15
18

Classical Proportional-Derivative (PD) Controller ..................................

27

Introduction ..................................................................................
PD Control....................................................................................

27
29

CHAPTER
IV.

PAGE

Fuzzy Proportional-Derivative (PD) Controller.......................................

33

An Overview ................................................................................
Fuzzy ............................................................................................
Current Use of Fuzzy PID Controller Technologies ....................
Fuzzy PD Controller.....................................................................

33
35
45
50

Simulation.................................................................................................

57

Parameters of the Flexible Inverted Pendulum ............................


Simulation of the PD Control .......................................................
Simulation of the Fuzzy PD Control ............................................

58
59
61

Results ......................................................................................................

62

PD Control....................................................................................
Linear Flexible Inverted Pendulum ..............................................
Non-Linear Flexible Inverted Pendulum......................................
Fuzzy PD Control .........................................................................

62
63
71
80

Conclusion................................................................................................

90

References ..................................................................................................................

92

V.

VI.

VII.

Appendices
A.
B.
C.
D.
E.

Simulink Model of the Linear and Non-Linear System ...........................


Matlab Fuzzy Logic System.....................................................................
Flexible Inverted Pendulum Model ..........................................................
Matlab Parameter Codes...........................................................................
Read Me Instructions................................................................................

vi

95
98
102
132
137

LIST OF TABLES

TABLE

PAGE

1.

Coordinate Transformation Table.............................................................

19

2.

Criteria for Linearization ..........................................................................

24

3.

Gain Values of the Classical PD for the Linear Flexible


Inverted Pendulum ............................................................................

32

4.

AND Operation Truth Table.....................................................................

42

5.

OR Operation Truth Table ........................................................................

43

6.

NOT Operation Truth Table .....................................................................

43

7.

Complete Fuzzy Rules ..............................................................................

55

8.

Parameters of Linear Flexible Inverted Pendulum ...................................

59

9.

Parameters of Non-linear Flexible Inverted Pendulum ............................

59

vii

LIST OF FIGURES

FIGURE

PAGE

1.

Flexible Inverted Pendulum......................................................................

2.

Disturbed Flexible Inverted Pendulum .....................................................

3.

Pendulum Segment Discretization............................................................

4.

Potential Energy Diagram of the system ..................................................

16

5.

Close Loop Control System Schematic ....................................................

28

6.

Nonlinear Flexible Inverted Pendulum with PD Control .........................

31

7.

Overview Fuzzy PD Control System........................................................

35

8.

Three Steps of Fuzzy Logic Controller.....................................................

36

9.

Classical Set for Spring Season ................................................................

37

10.

Fuzzy Set for Spring Season .....................................................................

38

11.

Triangle and Trapezoidal Membership Functions ....................................

38

12.

Gaussian Membership Function ...............................................................

39

13.

Bell Shape Membership Function.............................................................

39

14.

Sigmoidal Membership Function..............................................................

40

15.

The Results for AND, OR and NOT Operation with Two


Values Logic Membership ................................................................

44

The Results for AND, OR and NOT Operation with Partial


Membership Values...........................................................................

44

16.

viii

FIGURE
17.

18.

19.

PAGE
The Membership Functions for Memberships of Input
Variable Error ( e(t ) ) .........................................................................
The Membership Functions for Memberships of Input Variable
d
Derivative of the Error ( e(t ) ) .......................................................
dt

52

52

The Membership Functions for Memberships of Output Variable


Normalized Proportional Gain (KPn)................................................

53

The Membership Functions for Memberships of Output Variable


Normalized Derivative Gain (KDn) ..................................................

53

21.

Case 1 Classical PD Control for Linear Flexible Inverted Pendulum ......

64

22.

Case 2 Classical PD Control for Linear Flexible Inverted Pendulum ......

66

23.

Case 3 Classical PD Control for Linear Flexible Inverted Pendulum ......

67

24.

Case 4 Classical PD Control for Linear Flexible Inverted Pendulum ......

69

25.

Case 5 Classical PD Control for Linear Flexible Inverted Pendulum ......

70

26.

Case 6 Classical PD Control for Linear Flexible Inverted Pendulum ......

72

27.

Case 1 Classical PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

74

Case 2 Classical PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

75

Case 3 Classical PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

76

Case 4 Classical PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

78

Case 5 Classical PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

79

20.

28.

29.

30.

31.

ix

FIGURE
32.

33.

34.

35.

36.

37.

38.

PAGE
Case 6 Classical PD Control for Nonlinear Flexible Inverted
Pendulum...........................................................................................

81

Case 1 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

82

Case 2 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

84

Case 3 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

85

Case 4 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

87

Case 5 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

88

Case 6 Fuzzy PD Control for Nonlinear Flexible Inverted


Pendulum...........................................................................................

89

LIST OF NOMENCLATURE

Lagrangian

Reactionary term of Euler-Lagrange differential equation

Fexternal

External Force

qi

Generalized Coordinate

qi

Time derivative of Generalized Coordinate

KE

Kinetic energy of the flexible inverted pendulum system


Mass of the flexible inverted pendulum system

v Velocity of the flexible inverted pendulum system


PE Potential energy of the flexible inverted pendulum system
g

Gravitational constant

Height above a datum

dm Mass of differential beam segment

Pendulums material linear density

VN _ C

Cart velocity

VN _ P

Discrete particle (P) velocity

VN _ W

Added mass velocity

bi

Moving reference frame

xi

ni

Fixed reference frame


Discretized particle

Po _ p
z

Perpendicular distance from the particle P to the b frame of reference

Variable output

y( z, t )

Deflected Distance between the flexed beam and the rigid beam orientation

y ( z , t ) Flexed beam deflection velocity

Angle position of the pendulum

i z
Vp

Pendulum rotational velocity


Cart velocity
Assumed mode shape of the pendulum
Velocity of particle P in n reference and b reference frame

VB _ p

Velocity of particle P in b reference frame

VN _ p

Velocity of particle P in n reference frame

VN _ W

Velocity of added mass

rw

Distance between the added mass and pivot point

KE p

Kinetic Energy of the pendulum

KE pendulum Total Kinetic Energy of the pendulum

Length of the pendulum

Term used to determined the vibration frequency of the pendulum


xii

i ( z )
Hi

Flexing beam mode shape


Final motion of equation reduction term

xiii

ABSTRACT

FUZZY LOGIC PD CONTROL OF A NON-LINEAR INVERTED


FLEXIBLE PENDULUM
by
Kou A. Kong
Master of Science in Electrical and Computer Engineering
Electronic Engineering Option
California State University, Chico
Summer 2009

In automatic control systems, an inverted pendulum is a classical system to


be controlled. The inverted pendulum is more complex and complicated to control when
flexibility is present in the pendulum. Flexibility in the system can cause a system to be
unstable. In this project, an intelligent fuzzy proportional-derivative (PD) control is proposed to control the flexible inverted pendulum. The flexible inverted pendulum is
modeled in non-linearity using Euler-Lagrange energy method. The fuzzy proportionalderivative (PD) control is compared with the classical PD control in this system. Even
though the classical PID control is widely used in industrial control systems, it will
break down in most non-linear systems.

xiv

The simulations of the flexible inverted pendulum are done in Simulink and
Matlab. The linear and nonlinear flexible inverted pendulums are simulated for six different cases. The simulation results demonstrate the performance differences between the
classical PD control and fuzzy PD control. The classical PD control works for the linear
system in terms of oscillations and settling time for all step inputs and cases. On the
nonlinear system, the classical PD control has more oscillations in all three modes of vibrations for the second and third step inputs. The fuzzy PD controller shows better system
responses and steady-state performances for the nonlinear system. The second and third
step inputs have fewer oscillations for all three modes of vibrations. The fuzzy PD controller has a better overall performance because it has the ability to adjust the gain values
according to the system output response. On the other hand, the conventional PD controls
have a constant gain value for different system output responses. These results are integrated in Chapter VI. It can also be seen by running the programs on the CD included
with this report. The instructions to simulate the programs on the CD are in the Read Me
Instructions in Appendix E.

xv

CHAPTER I

INTRODUCTION

Control systems are found virtually in every modern machine. Modern


machines use controllers to enhance their performances. As the machine requirements
and complexity increase rapidly, intelligent controllers become an increasingly important
topic. In this project, an intelligent fuzzy proportional-derivative (PD) controller is
proposed to control the flexible inverted pendulum.
The inverted pendulum is a classical problem in control system. It is a system
that is inherently unstable. The pendulum is mounted onto a non-stationary cart in the
vertical position or at equilibrium position. The pendulum is unstable and free to fall over
if there are any disturbances. On the other hand, if the pendulum is too thin and the cart is
move by a force, it can flex and cause vibrations. These vibrations can cause an error in
detecting the angle of the pendulum. Vibrations are one of the major concerns in industry
machineries because it can cause instabilities and break down the equipments. A flexible
inverted pendulum diagram is shown in Figure 1.

Current Use of Inverted Pendulum


Inverted pendulum is a system that highly motivates applications with
complex mathematical model, have uncertainties and flexibilities in the systems. Inverted
pendulum is a popular system that is used to approximate highly complex models and

Fig. 1. Flexible inverted pendulum.


Source: Adapted from J.T. Smalley, Control of an Inverted Flexible
Pendulum with Experimental Verification, Thesis, California State
University of Chico, Spring 1992.

their parameters in the industry. It is also a popular system inside the classroom, using the
system to design various control theories and techniques.
Pratt and Drakunov [6] used the inverted pendulum system to model the
bipedal walking. The bipedal walking have a difficult mathematic model due to the
nonlinearity in the equation of motion, high dimensional, combination of discrete and
continuous dynamics. Therefore, the inverted pendulum model is used to approximate the
biped as a point mass with point feet and constrained to a line for walking that is
trajectory from a Center of Mass. The inverted pendulum energy can be derived to
determine the orbital energy. This expression of the inverted pendulum energy can
determine the location and velocity of the next step for the bipedal walking system. The
inverted pendulum theory can be used for robot with two wheels as describe by Akesson,

3
Blomdell and Braun [7]. This robot can be described as an inverted pendulum mounted
onto two wheels. The positions of the rotational wheels control the balance of the
pendulum and velocity of the robot. The inverted pendulum is also used to approximate
mechanical robotic arms. Robotic arms are used widely in the assembly industries from
heavy products in automotive to microchips in integrated circuits. The inverted pendulum
theory is used to estimate the position or the arm movement distance, balance of the arm
and vibrations of the system.
The theories and applications of inverted pendulum are not limited to robotics.
It can be applied to rockets, aircrafts, spacecrafts and satellites when flexibilities are
considered in the design. Chye and Sang [8] states the similarities between an inverted
pendulum and rocket. The rocket is highly unstable at the instance of time during launch.
The rocket requires continuous control to stay upright similar to the inverted pendulum.
Therefore, the rocket boosters are control in a manner where it can maintain the rocket in
the vertical position. Flexibilities become an issue when the system gets more complex
and large. Smalley [1] described the failure of space vehicles due to vibration cause be
flexibility. Systems fail because the control system is inadequate to the physical system
vibrations. Spacecraft and large satellites have a growing concern of flexibility due to the
size of the systems. Some of the early spacecraft failed due to structural flexibility are
Explorer I, Ranger, Alouette I and Apollo CSM/LM just to name a few. Smalley
suggested that the spacecraft be modified structurally or modified the control system to
consider the unnecessary flexibility.

4
Control Techniques
The inverted pendulum is a classical system to be control in automation
control system. It is a popular system to illustrate various control techniques because the
system can be model in nonlinear or linear forms. It is also conceptually easy to
understand the system functions. Different types of controller techniques have been used
to control the inverted pendulum. Smalley [1] used the state space approach to
determined the control gain matrix K for a linear system. Fennich [2] used the fuzzy
clustering method to designed the fuzzy rules for the inverted pendulum. Sazonov,
Klinkhachorn and Klein [3] combined LQG with Neural to control the inverted pendulum
system. Saifizul, Dainon, Abu Osman, Azlan and Ibrahim [4] incorporated neural
network into fuzzy controller. The Fuzzy rule base is derived from neural network. These
are small examples of the many different techniques used for inverted pendulum.

Layout of the Project Report


The purpose of this project is to focus on the comparison between classical
PD controllers and adaptive fuzzy PD controllers on the nonlinear flexible inverted
pendulum. The nonlinearity and flexibility of the inverted pendulum makes it
complicated to control using standard linear controllers. Therefore, adaptive controllers
must be considered as a control. The flexibility problem can be stabilized if flexibility is
considered in the design of the system and controller. There have been several controllers
develop to control nonlinearity, flexibility and uncertainty such as adaptive control
method, nonlinear control method and combination of different control techniques. The
controls develop in this project is the classical PD and adaptive fuzzy PD. Adaptive fuzzy

5
PD controller is the combination of fuzzy logic and Proportional-Derivative (PD)
controller. This project used adaptive fuzzy PD control to stabilize the pendulum and its
vibrations. This work can be used as a demonstration of intelligent controllers on
complex system with vibrations.
Before any controllers can be developed, a model of the system must be
determined. Chapter II shows the deviation of the flexible inverted pendulum system. The
flexible inverted pendulum system model is borrowed from Smalley [1]. The system
model is broken down into two parts, linear system and nonlinear system. The systems
are control by the classical proportional-derivative (PD) controllers described in Chapter
III and the adaptive fuzzy PD controllers in Chapter IV. The simulations are done in
Matlab and Simulink which are shown in chapter V. The results of each control
techniques in six different cases are shown in Chapter VI. Chapter VII concludes the
project.

CHAPTER II

FLEXIBLE INVERTED PENDULUM


SYSTEM

System Model
Before a control system can be developed, there must be a system to be
controlled. The system in this paper is a flexible inverted pendulum (Figure 1) which is
obtains by the equations of motion. These equations of motion are developed using the
Euler-Lagrange method. The Euler-Lagrange differential equation is shown in Equation
1.

d L L R

Fexternal

dt qi qi qi

(1)

(i 1, 2,..., n)
Where Fexternal is the external forces acting on the system and R is the absorbed energy
caused by reactionary forces. The generalized coordinates are qi and qi . The lagrangian
( L ) is the difference between kinetic energy and potential energy. The kinetic energy
1
equation is given as KE * m * v 2
2

(2)

and the potential energy equation is


PE m * g * h

(3)

where:
6

7
m = system mass
v = system velocity
g = gravity constant
h = height of the system above a datum
The pendulum can bend in either the vectors n1 and n 2 plane depending on
the direction of the applied external force. The angle of the pendulum and the position of
the mass can be in opposite direction as illustrated in Figure 2. This flexibility to bend
can cause the pendulum to vibrate before and during the controllers stabilization
processes. The vibrations can lead to instability if flexibilities are not included in the
design of the system and the controller.

Fig. 2. Disturbed flexible inverted pendulum.

The feedback loop is the loop that provides the output information to the
controller to determine the errors. These errors are processed into the controller to
enhance performance for the system output(s). The feedback information regarding;
angle position, cart position, and vibrations are required for the controller to stabilize the

8
flexible inverted pendulum. Therefore, to achieve a stable system, the total feedback
loops have to equal the total of motion equations in the system.
To obtain these motion equations, the velocity components of the pendulum
for both kinetic energy and potential energy must be derived. The velocity components
could be achieved by separating the beam or pendulum into individual segments. These
individual segments are also known as differential beam segments which has a mass of
dm dz , where is the material linear density and dz is the particle P differential

length. See Figure 3. The pendulum kinetic energy and potential energy are achieved by
integrating the individual segments over the total length of the pendulum. The pendulum
kinetic energy and potential energy are then derived into the motion equations of the
flexible inverted pendulum system. The rest of this chapter will demonstrate these
procedures.

Fig. 3. Pendulum segment discretization.

9
Kinetic Energy of the System
There are three parts of the system that contribute to the total kinetic energy of
the system. The first part of kinetic energy is from the moving cart, the second is from the
flexible pendulum and the last part is from the added mass on top of the pendulum.
L

1
1
1
KE * mc *VN2 _ C * [VN2 _ P ]dz * mw *VN2 _ W
2
2
2
0

(4)

where:

VN _ C = cart velocity
VN _ P = discrete particle (P) velocity
VN _ W = added mass velocity
The kinetic energies of the flexible pendulum and added mass to the
pendulum or second and third part of equation 4 respectively, a new coordinate system
were added to derive the energy equations. This new coordinate system is indicated as
unit vectors b1 , b 2 and b 3 . It rotates with the flexibility of the pendulum and translates
along with the cart. There is also a fixed coordinate system unit vectors n1 , n 2 and n 3 .
See Figure 3 for details.
To derive the equations of motion from the Euler-Lagrange method, the
pendulum must be discretize first. A coordinate z is measured along the pendulum axis in
the b1 direction. In the b 2 direction, coordinate y ( z , t ) is used to describe the deflection
of the pendulum. This coordinate is a function of coordinate z and t , where z is the
length along the pendulum and t is time. The position of the cart is in the x direction
from an initial position is measured in meter. The angle of the pendulum rotation is ,

10
which is measured in radian. The discretized particle Po _ p is the location along the
pendulum. The

o_ p

indicate the distance between the pivot point O and the particle P .

See Figure 3.
The dimension y ( z , t ) in equation 2.5 described the function of the mode
shape and modal coordinate. This equation represents deflection of the pendulum using
assumed mode shapes. The assumed mode shapes are an approximation of the deflection
of the pendulum.
n

y ( z , t ) i z * qi t

(5)

i 1

where:

i z = assumed mode shape of the pendulum


qi t = modal coordinate of the pendulum
Po _ p is the postion vector to the discrete particle, therefore

Po _ p z * b1 y * b 2

(6)

The particle velocity with respect to the fixed frame of reference can be found as

Vp x * n 2 * b3 XPo _ p VB _ p

(7)

The particle velocity with respect to the rotating and translating reference frame is found
as

VB _ p y * b 2

(8)

By performing the cross product to reduce VB _ p and putting all the coordinate system in
the same reference frame will give the particle P velocity in the b reference frame as:

11

n2 cos * b 2 *sin * b1

(9)

where the derivative of y also known as y is obtain using equation 2.5 as


n

y ( z , t ) i z * qi t

(10)

i 1

The velocity of the particle can be expressed into the fixed frame of reference,
n1 , n 2 and n 3 through an axis transformation. The transformed velocity of particle P is

expressed as
VN _ p x sin y b1 x cos z y b 2

(11)

Now the velocity of the particle is derived, the next step is to derive the
velocity of the added mass on top of the pendulum. This mass velocity, mw can be
derived in a similar fashion as the velocity of the particle using equation 7, equation 8,
and equation 9. The velocity of the mass in the z coordinate position rw is expressed as
VN _ W x sin y b1 x cos rw y b 2

(12)

Lastly, the cart velocity can be expressed as

VN _ C x * n 2

(13)

VN _ p x sin q y b1 x cos q z y b 2

(14)

Once all the velocities have been determined, the total kinetic energy of the
inverted pendulum can be derived. As mentioned earlier, the total kinetic energy of the
system has three parts. The total kinetic energy is the sum of the kinetic energy of the
pendulum, the kinetic energy of the added mass and the kinetic energy of the cart. These
three kinetic energies will be derived separately in three parts.

12
The first kinetic energy to be derived is the pendulum, it can be determined as
KE p

1
dm *VN2 _ p
2

(15)

where

VN _ p *VN _ p becomes a scalar as shown below


VN _ p *VN _ p x sin y x cos q z y
2

(16)

and
dm dz

The kinetic energy of the pendulum can be determined by integrating over the
total length of the pendulum.
L

KE pendulum

1
[VN2 _ P ]dz
2 0

(17)

Substituting equation 15 and 16 into equation 17, the kinetic energy of the
pendulum becomes
L

KE pendulum

2
2
1
[ x sin y x cos z y ]dz
2 0

(18)

To make it easier to integrate, equation 2.18 can be simplified as follow


L

1
KEpendulum [x2 2yx sin 2 y2 2 z2 y2 2x z cos 2x y cos 2y z]dz (19)
2 0

Each of the kinetic energy of the pendulum can be simplified using


Hi

[(1)i i2 1 i2 1

(20)

13
Therefore, all eight integral of the kinetic energy for the pendulum becomes
KE pendulum1

1
L( x )2
2

(21)
n

KE pendulum 2 x sin ( H i * qi (t ))

(22)

i 1

KE pendulum 3

n
1
L 2 [ qi2 (t )]
2
i 1

(23)

KE pendulum 4

1 3 2
L
6

(24)

KE pendulum 5

n
1
L[ q i2 (t )]
2
i 1

(25)

1
KE pendulum 6 L2 x cos
2

(26)

KE pendulum 7 x cos H i * qi (t )

(27)

i 1

KE pendulum8 L H i q i (t )

(28)

i 1

See Appendix C for more details.


The next step in determining the total kinetic energy of the system is to
determine the kinetic energy by the added mass along the length of the pendulum. rw is
measured from the pivot point to the added mass along the pendulum. Equation 29 is the
kinetic energy for the added mass.
KEmass

1
mw *VN _ w *VN _ w
2

where the velocity of the mass mw is noted as VN _ w .

(29)

14
VN _ W x sin q y b1 x cos q rw y b 2

VN _ w *VN _ w x sin y x cos q rw y


2

(30)
2

[ x 2 2 yx sin 2 y 2 2 rw2 y 2 2 x rw cos 2 x y cos 2 y rw ] (31)


Therefore
1
mw [ x 2 2 yx sin 2 y 2
2
2 2
rw y 2 2 x rw cos 2 x y cos 2 y rw ]
KEmass

(32)

The kinetic energy of the mass can be broken into individual components to
be solved, where y ( z , t ) and y ( z , t ) is i z . See Appendix C for more details.
The last part to the total kinetic energy of the system is the kinetic energy of
the cart. The kinetic energy of the cart can be derived as follow.
KEcart

1
mc VN _ c * VN _ c
2

(33)

where

VN _ c x b 2
Therefore the kinetic energy from the cart is
KEcart

1
mc x 2
2

(34)

The total kinetic energy of the system is the sum of all three previously
derived kinetic energies; pendulum, added mass and cart.
KEsystem KE pendulum KEmass KEcart

Therefore the total kinetic energy is

(35)

15
1
n
1
n

KEsystem Lx 2 x sin Hi * qi (t ) L 2 qi2 (t )


2
i 1
2
i 1

1
1 n
1
n

L3 2 L q 2i (t ) L2 x cos x cos Hi * qi (t )
6
2 i 1
2
i 1

n
1
L Hi * qi (t ) mw x 2 mw x sin i ( z)* qi (t )
i 1

i 1
2
2

(36)

1
1 n
n
1

mw 2 i ( z)* qi (t ) mw 2 rw2 mw i ( z )* qi (t ) mw rw x cos


2
2
2
i 1

i 1

n
1
mw x cos i ( z)* qi (t ) mw rw i ( z )* qi (t ) mc x 2
i 1

i 1
2

Potential Energy of the System


Since the total kinetic energy of the system has been derived, the next step is
to derive the total potential energy of the system. Figure 4 shows the potential energy of
the system. The total potential energy of the system is made up of three components:
1. Gravitational forces effects on the pendulum.
2. Elasticity of the flexing pendulum.
3. Gravitational forces effects on the added mass.
The first potential energy of the system is described as follows:
PE1 dm * g * u

where
dm * dz as described earlier, g is the gravity and u is the location of the particle

distance above the datum as u z cos y sin .


L

PE1 g z cos y sin dz


0

g cos z dz g sin y dy

(37)

16

Fig. 4. Potential energy diagram of the system.

Using the method from Blevins [19] and simplification H i ,


L

i 1

[ y ]dz (
Hi

[(1)i i2 1 i2 1]) * q i (t )

[(1)i i2 1 i2 1

Therefore the first potential energy of the system becomes


PE1

1
n

gL2 cos g sin H i * qi (t )


2
i 1

(38)

The potential energy due to the elasticity of the flexing pendulum can be
derived in the following manner using the classical pendulum theory.
2

L
2y
1
PE2 EI 2 dz
2 0z

y ( z , t ) i z * qi t
i 1

(39)

17
Therefore,
PE2

n
1
EIL( i4 * qi2 (t ))
2
i 1

(40)

(see Appendix C for more details).


The last part of the potential energy of the system is from the gravitational
force effects on the added mass. This potential energy can be derived as follows:
PE3 m

(41)

gh

where

h rw c o s y s in
y (z,t)

z * q t
i 1

Therefore
n

PE3 mw grw cos mw g sin i z * qi t


i 1

(42)

The total potential energy is the sum of all the potential energy from the
system.
PEsystem PE1 PE2 PE3

Therefore
PEsystem

1
n

gL2 cos g sin H i * qi (t )


2
i 1

n
1
n

EIL( i4 * qi2 (t )) mw grw cos mw g sin i z * qi t


2
i 1
i 1

(43)

18
Euler-Lagrange Differential Equation of
Motions
Now the motion of equations describing the flexible inverted pendulum can be
derived since the kinetic energy and the potential energy have been determined. The
motion equations are derived using Euler-Lagrange differential equation as described
earlier.
L L R

Fexternal

qi qi qi
( i 1, 2, ..., n )
d
dt

The Lagrange is the difference between the kinetic energy and potential
energy.
L K E s y s te m P E s y s te m

The generalized coordinated system used for the Euler-Lagrange equation is


in Table 1.
The model coordinate terms from the flexing pendulum coordinate is related
to the new generalized coordinate through the bracket terms. Note that qi is not equal to

qi t .
The Lagrange can be form by substituting these generalized coordinate to the
kinetic and potential energies.
The model will be designed with three modes of vibration; therefore, model
coordinate will be expanded for three coordinates. The expansion is done with EulerLagrange equation as described in equations 45 49.

19
TABLE 1
COORDINATE TRANSFORMATION TABLE
q1 x

q 1 x

q 1 x

q2

q 2

q 2

q3 q1 (t )

q 3 q 1 (t )

q 3 q 1 (t )

q4 q2 (t )

q 4 q 2 (t )

q 4 q 2 (t )

q5 q3 (t )

q 5 q 3 (t )

q 5 q 3 (t )

1
n
1
n

L Lq12 q1 q 2 sin q 2 Hi * qi 2 (t ) Lq 22 qi22 (t )


2
i 1
2
i 1

n
n
1
1
1

L3q22 L qi22 (t ) L2q1 q2 cos q2 q1 cos q2 Hi * qi 2 (t )


6
2 i 1
2
i1

n
1
L q 2 Hi * qi2 (t ) mwq22 mwq1 q 2 sin q2 i ( z)* qi 2 (t )
i 1

i 1
2
2

1
1 n
n
1

mwq22 i ( z)* qi 2 (t ) mwq 22rw2 mw i ( z)* qi2 (t ) mwq1 q 2rw cos q2


2
2 i 1
i1
2

(44)

n
1
mwq1 cos q2 i ( z)* qi2 (t ) mwq2rw i ( z)* qi2 (t ) mc q12
i 1

i 1
2
1
n

gL2 cos q2 g sin q2 Hi * qi 2 (t )


2
i1

n
1
n

EIL( i4 * qi22 (t )) mw grw cos q2 mw g sin q2 i z * qi 2 t


2
i 1
i1

The first and second terms of Euler-Lagrange equations can be differentiated


with respect to their respective coordinates in the above equations as described in
Appendix C.

20

L
( L m w m c ) q1 q 2 sin q 2 [ H 1 q3 H 2 q 4 H 3 q5 ]
q1
1
L2 q 2 cos q 2 cos q 2 [ H 1 q3 H 2 q 4 H 3 q5 ]
2
m w q 2 sin q 2 [1 ( z ) q3 2 ( z ) q 4 3 ( z ) q5 ]

(45)

m w q 2 rw cos q 2 m w cos q 2 [1 ( z ) q3 2 ( z ) q 4 3 ( z ) q5 ]

L
1
( L3 mw rw2 ) q 2 q 1 sin q

3
q2

[ H q

1 3

H 2 q4 H 3 q5 ]

1 2
L q 1 cos q2 L [ H 1q3 H 2 q4 H 3 q5 ]
2

mw q 1 sin q2 [1 ( z ) q3 2 ( z ) q4 3 ( z ) q5 ] mw [12 ( z ) q 32 22 ( z ) q 24
Lq 2 [ q32 q42 q52 ]

(46)

32 ( z ) q 52 21 ( z )2 ( z ) q3 q4 21 ( z )3 ( z ) q3 q5 22 ( z )3 ( z ) q4 q5 ]
mw q 1 rw cos q2 mw rw [1 ( z ) q 3 2 ( z ) q 4 3 ( z ) q 5 ]

L
L q 3 L H 1 q 2 q 1 H 1 co s q 2
q 3
m w [ ( z ) q
2
1

1 ( z ) 2 ( z ) q

(47)

1 ( z ) 3 ( z ) q 5 ]

m w q 1 co s q 2 1 m w rw 1 q 2

L
L q 4 L H 2 q 2 q 1 H 2 co s q 2

q4
m w [ 22 ( z ) q 4 1 ( z ) 2 ( z ) q 3 2 ( z ) 3 ( z ) q 5 ]

(48)

m w q 1 co s q 2 2 m w rw 2 q 2

L
L q 5 L H 3 q 2 q 1 H 3 c o s q 2

q5
m w [ 32 ( z ) q 5 1 ( z ) 3 ( z ) q 3 2 ( z ) 3 ( z ) q 4 ]
m w q 1 c o s q 2 3 m w rw 3 q 2

(49)

21
The third term in the Euler-Lagrange equation is the reactionary of the motion
for the system. The reactionary forces consider in this system are the friction in the
pendulum pivot point and friction between the cart and surface. The reactionary initial
equations and its partials are described in equations 50 52.
R cart

1
c
2

R
q 1

R
c
q 2

p e n d u lu m

c a r t

1
c ca rt q
2

2
1

p e n d u lu m

2
2

(51)

(50)

(52)

The last term of the Euler-Lagrange equation is the external forces. There are
two external forces; the disturbance force and the control force.
Nonlinear System
The motion of equations is achieved by combining all the derived equations
with their respective terms in the above sections. This combination will give non-linear
motion equations. The final non-linear equations of motion for the inverted flexible
pendulum system are indicated in equations 53 57.
The nonlinear flexible inverted pendulum equations of motion coordinates are
changed back to xn and for the purpose of solving for their derivatives to build in
Simulink. The non-linear motion equations derivative are shown in equations 58 62.
These differential equations are used to build the flexible inverted pendulum system
model in Simulink. See Appendix A for more details.

22
1
( L mw mc )q1 [ sin q2 [ H1q3 H2q4 H3q5 ] L2 cos q2 mwrw cos q2 ]q2
2

[2( sin q2 [ H1q3 H2q4 H3q5 ]) 2(mw sin q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ])]q2
1
cos q2 [ H1q3 H2q4 H3q5 ] L2 sin q2 mwrw sin q2
2
mw cos q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ] cos q2 [ H1q3 H2q4 H3q5 ]

(53)

mw cos q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ] ccart q1 F

1
[ sin q2 [H1q3 H2q4 H3q5 ] L2 cos q2 mw sin q2 [H1q3 H2q4 H3q5 ] mwrw cos q2 ]q1
2
1 3
[( L mwrw2 ) L[q32 q42 q52 ] mw[12 (z)q32 22 (z)q42 32 (z)q52 ] 21 (z)2 (z)q3q4 21 (z)3 (z)q3q5
3
23 (z)2 (z)q5 q4 ]q2 [LH1 mwrw1(z)]q3 [LH2 mwrw2 (z)]q4 [LH3 mwrw3 (z)]q5
2( sin q2 [H1q3 H2q4 H3q5 ])q1 2[L[q3q3 q4q4 q5q5 ]

(54)

2mw[12 (z)q3q3 22 (z)q4q4 32 (z)q5q5 1 2 (z)q4q3 1 2 (z)q3q4


1 3 (z)q5q3 1 3 (z)q3q5 32 (z)q5q4 32 (z)q4q5 ] cpendulum ]q2
[g cos q2 [H1 mw1(z)]]q3 [g cos q2 [H2 mw2 (z)]]q4 [g cos q2 [H3 mw3 (z)]]q5
1
[sin q2 [ gL2 mwrwg]] Td * L
2

[ H1 cos q2 mw1(z)cos q2 ]q1 [ LH1 mwrw1(z)]q2 [ L mw12 ( z)]q3 [mw1(z)2 (z)]q4


[mw1(z)3 (z)]q5 [ Lq3 ](q1 )2 [mw[12 (z)q3 1 (z)2 (z)q4 1 (z)3 (z)q5 ]](q2 )2

(55)

[EIL14 ]q3 [mw1(z)sin q2 H1 sin q2 ]q1q2 [mw g1(z)sin q2 gH1 sin q2 ] Td * L

[H2 cos q2 mw2 (z)cos q2 ]q1 [LH2 mwrw2 (z)]q2 [mw1(z)2(z)]q3 [L mw22(z)]q4
[mw2 (z)3(z)]q5 [Lq4 ](q1 )2 [mw[22 (z)q4 1 (z)2 (z)q3 2 (z)3 (z)q5 ]](q2 )2
[EIL24 ]q4 [H2 sin q2 ]q1q2 [mwg2 (z)sin q2 gH2 sin q2 ] Td *L

(56)

[ H 3 cos q2 mw3 ( z ) cos q2 ]q 1 [ LH 3 mw rw3 ( z )]q 2 [ mw1 ( z )2 ( z )]q 3


[ mw1 ( z )3 ( z )]q 4 [ L mw32 ( z )]q 5 [ Lq5 ](q 1 ) 2

(57)

[ mw [32 ( z )q5 1 ( z )3 ( z )q3 2 ( z )3 ( z )q4 ]](q 2 ) 2


[ EIL 34 ]q5 [ mw g3 ( z ) sin q2 gH 3 sin q2 ] Td * L

23
d 2 x1
1 2
d 2

([

sin

[
H
x
H
x
H
x
]

L
cos

m
r
cos

]
13 24 35
ww 2
dt 2
2
dt
dx
dx
dx
dx d
dx
dx
[2( sin [H1 3 H2 4 H3 5 ]) 2(mw sin [1(z) 3 2 (z) 4 3 (z) 5 ])]
dt
dt
dt
dt
dt
dt dt
1
cos [H1x3 H2 x4 H3x5 ] L2 sin mwrw sin
(58)
2
d2x
d2x
d2x
mw cos [1(z)x3 2 (z)x4 3 (z)x5 ] cos [H1 23 H2 24 H3 25 ]
dt
dt
dt
2
2
2
dx
dx
dx
dx
mw cos [1(z) 23 2 (z) 24 3 (z) 25 ] ccart 1 F)/(L mw mc )
dt
dt
dt
dt

d2
1 2
d2x1
([

sin

[
H
x
H
x
H
x
]

L
cos

m
sin

[
H
x
H
x
H
x
]
m
r
cos

w
w
w
1
3
2
4
3
5
1
3
2
4
3
5
dt2
2
dt 2
2
2
2
dx
dx
dx
[LH1 mwrw1(z)] 23 [LH2 mwrw2 (z)] 24 [LH3 mwrw3 (z)] 25
dt
dt
dt
dx
dx
dx
dx dx
dx
dx
2( sin [H1 3 H2 4 H3 5 ]) 1 2[L[x3 3 x4 4 x5 5 ]
dt
dt
dt
dt
dt
dt dt
dx
dx
dx
dx
dx
2mw[12 (z)x3 3 22 (z)x4 4 32 (z)x5 5 1 2 (z)x4 3 1 2 (z)x3 4
dt
dt
dt
dt
dt
dx
dx
dx
dx
d
1 3 (z)x5 3 1 3 (z)x3 5 32 (z)x5 4 32 (z)x4 5 ] cpendulum ]
dt
dt
dt
dt
dt
[g cos [H1 mw1(z)]]x3 [g cos [H2 mw2 (z)]]x4 [g cos [H3 mw3(z)]]x5

(59)

1
1
[sin [ gL2 mwrwg] (Td * L)]/[( L3 mwrw2 ) L[x32 x42 x52 ]
2
3
2
2
2
2
2
2
mw[1 (z)x3 2 (z)x4 3 (z)x5 ] 21 (z)2 (z)x3 x4 21 (z)3 (z)x3 x5
23 (z)2 (z)x5 x4 ]

d2x3
d2x1
d2
d2x4
H
m
z
LH
m
r
z
m
z
z

cos

(
)cos
]

(
)]

[
(
)
(
)]

w1
2
ww 1
w 1
1
1
2
dt2
dt
dt2
dt2
d2 x
dx
d
(60)
[mw1(z)3(z)] 25 [Lx3]( 1 )2 [mw[12 (z)x3 1 (z)2 (z)x4 1 (z)3 (z)x5 ]]( 2 )2
dt
dt
dt
dx d
[EIL14 ]x3 [mw1(z)sin H1 sin ] 1 [mwg1(z)sin gH1 sin ] (Td *L)]/[L mw12 (z)]
dt dt

24
d 2 x3
d 2 x4
d 2 x1
d 2
([H2 cos mw2 (z)cos ] 2 [LH2 mwrw2 (z)] 2 [mw1(z)2 (z)] 2
dt 2
dt
dt
dt
2
dx
dx
d
(61)
[mw2 (z)3 (z)] 25 [Lx4 ]( 1 )2 [mw[22 (z)x4 1 (z)2 (z)x3 2 (z)3 (z)x5 ]]( 2 )2
dt
dt
dt
dx d
[EIL24 ]x4 [H2 sin ] 1 [mwg2 (z)sin gH2 sin ] (Td * L)]/[L mw22 (z)]
dt dt

d 2 x5
d 2 x3
d 2 x1
d 2

cos

(
)cos
]

(
)]

[
(
)
(
)]

H
m
z
LH
m
r
z
m
z
z

w 3
w w 3
w 1
3
3
2
dt 2
dt 2
dt 2
dt 2
d 2 x4
dx
d
[mw1(z)3 (z)] 2 [Lx5 ]( 1 )2 [mw[32 (z)x5 1 (z)3 (z)x3 2 (z)3 (z)x4 ]]( 2 )2
dt
dt
dt
4
2
[EIL3 ]x5 [mw g3 (z)sin gH3 sin ] (Td * L)]/[L mw3 (z)]

(62)

Linear System
To use the linear control theory proportional-derivative (PD) control, the
equations are linearized by the criteria in Table 2.

TABLE 2
CRITERIA FOR LINEARIZATION
sin(q2 ) q2

cos(q2 ) 1

q i *q i 0

q i * q i 0

q i * q i 0

q i * q i 0

q i *q j 0

q i * q j 0

q i * q j 0

q i * q j 0

qi * q j 0

q i * q i 0

25
The final linearized equations for the flexible inverted pendulum are described
in equations 63 67).
The linear motion equations are derived into second order differential
equations described in equations 68 72.
These differential equations of motion are used to model the flexible inverted
pendulum system in simulink. See Appendix A for more details.

1
( L mw mc )q 1 ( L2 mw rw )q 2 ( H1 mw1 ( z ))q 3
2

( H 2 mw2 ( z ))q 4 ( H 3 mw3 ( z ))q 5 F

1
1
( L2 mw rw )q 1 ( L3 mw rw 2 )q 2 ( L H1 mw rw1 ( z ))q 3
2
3
( L H 2 mw rw2 ( z ))q 4 ( L H 3 mw rw3 ( z ))q 5
1
( gL mw rw g )q1 ( gH1 mw g1 ( z ))q3 ( gH 2 mw g2 ( z ))q4
2
( gH 3 mw g3 ( z ))q5 c pendulum q2 Td * L

(63)

(64)

( H1 mw1 ( z ))q 1 ( L H1 mw rw1 ( z ))q 2 ( L mw12 ( z ))q 3


(mw1 ( z )2 ( z ))q 4 (mw1 ( z )3 ( z ))q 5 ( gH1 mw g1 ( z ))q2

(65)

EIL12 q3 Td * L

( H 2 mw2 ( z ))q 1 ( L H 2 mw rw2 ( z ))q 2 (mw1 ( z )2 ( z ))q 3


( L mw2 2 ( z ))q 4 (mw2 ( z )3 ( z ))q 5 ( gH 2 mw g2 ( z ))q2

(66)

EIL 2 q4 Td * L
4

( H 3 mw3 ( z ))q 1 ( L H 3 mw rw3 ( z ))q 2 (mw1 ( z )3 ( z ))q 3


(mw2 ( z )3 ( z ))q 4 ( L mw3 ( z ))q 5 ( gH 3 mw g3 ( z ))q2
EIL34 q5 Td * L

(67)

26
d 2 x3
d 2 x1
1 2
d 2
[( L mw rw ) 2 ( H1 mw1 ( z )) 2
2
dt 2
dt
dt
2
2
d x
d x
( H 2 mw2 ( z )) 24 ( H 3 mw3 ( z )) 25 F]/( L mw mc )
dt
dt

(68)

d 2 x3
d 2 x1
1 2
d 2
(

)
(

(
))

L
m
r
L
H
m
r
z
w w
w w 1
1
2
dt 2
dt 2
dt 2
d 2 x5
d 2 x4
( L H 2 mw rw2 ( z )) 2 ( L H 3 mw rw3 ( z )) 2
dt
dt
1
( gL mw rw g ) x1 ( gH1 mw g1 ( z )) x3 ( gH 2 mw g2 ( z )) x4
2
1
dx
( gH 3 mw g3 ( z )) x5 c pendulum 2 Td * L] /( L3 mw rw 2 )
3
dt

(69)

d 2 x3
d 2 x1
d 2

[(

(
))

(
))
H
m
z
L
H
m
r
z
w 1
w w 1
1
1
dt 2
dt 2
dt 2
d 2x
d 2x
(mw1 ( z )2 ( z )) 24 (mw1 ( z )3 ( z )) 25 ( gH1 mw g1 ( z ))
dt
dt
2
2
EIL1 x3 Td * L] /( L mw1 ( z ))
d 2 x3
d 2 x4
d 2 x1
d 2

[(

(
))

(
))

(
(
)
(
))
H
m
z
L
H
m
r
z
m
z
z
w 2
w w 2
w 1
2
2
2
dt 2
dt 2
dt 2
dt 2
d 2 x5
(mw2 ( z )3 ( z )) 2 ( gH 2 mw g2 ( z ))
dt
4
EIL 2 x4 Td * L]/( L mw2 2 ( z ))
d 2 x5
d 2 x3
d 2 x1
d 2
[( H 3 mw3 ( z )) 2 ( L H 3 mw rw3 ( z )) 2 (mw1 ( z )3 ( z )) 2
dt 2
dt
dt
dt
2
d x
(mw2 ( z )3 ( z )) 24 ( gH 3 mw g3 ( z ))
dt
4
EIL3 x5 Td * L]/( L mw3 ( z ))

(70)

(71)

(72)

CHAPTER III

CLASSICAL PROPORTIONALDERIVATIVE (PD)


CONTROLLER

Introduction
The classical PD controller in this report is done in a close-loop control
system. A close-loop control is different from an open-loop control system because it has
the ability to control the output of the system by using a feedback loop. A feedback loop
is used as a negative loop to transfer output(s) from the system to the summing junction
with the desired output or reference input. This produces the errors between the desired
output and output of the system. This error signal causes the controller to instruct the
system to behavior appropriately to obtain the desired output. A schematic of the closeloop control system is shown in Figure 5.
The classical PD controller is a combination of three types of control laws.
The control laws are Proportional-Integral-Derivative (PID). These control laws can be
combined together as PID, PI, PD and ID or as P, I or D. Three types of classical control
laws can be expressed as:

u k p ( t ) k p ( e ( t ))

(73)

u k d ( t ) k d ( e ( t ) e ( t 1) )

(74)

27

28

Fig. 5. Close loop control system schematic.

ki

(t ) k i

(e (i))

(75)

i1

Combining equations 73-75 gives a class controller as


k

u ( t ) k p ( e ( t )) k i ( e ( i )) k d ( e ( t ) e ( t 1))

(76)

i 1

where
k p = proportional gain value

ki = integral gain value


k d = derivative gain value
t = sampling time
e(t ) = error between the reference input and the output of the system at time t
e(t 1) = error between the reference input and the output of the system at time t 1
u (t ) = output of the controller at time t

29
In equation 3.4, the control laws are combined together to form one classical
PD controller. The input of the PD controller is the error signals between the reference
input and measured signal of feedback loop. The error signal is multiply by the
appropriate gain values to produce an adequate signal for the system input. This in turn
will attempt to produce a stable system.

PD Control
The PD controller is widely used in automatic control system because it is
easy to comprehend, cheap to acquired and effective. The proportional-derivative control
theory and techniques are very popular in the classroom and is widely used in the
industry. This control serves as a fundamental base for any linear system because it is
easy to design. Designers usually convert nonlinear system to linear whenever it is
possible to limit the complication of designing a controller.
The control gains of the controller can be estimated by either method; Root
Locus or trial and error. Trial and error method was used in this project. Trial and error
method is a simple technique of manually tuning the gain values of the controller to
acquire a stable system. This method was done in Simulink. The system to be used for
this method is the linear flexible inverted pendulum which is built in Simulink. The
method is tested on the linear flexible inverted pendulum to acquired gain values for the
classical PD controller. These gain values are later used for the nonlinear flexible
inverted pendulum for comparison.
Through this trial and error method, the integral gain ( ki ) was discovery to
cause the system to oscillate. Therefore, the integral gain will be excluded in the control

30
design. The proportional gain ( k p ) and derivative gain ( k d ) was found for the linear
flexible inverted pendulum using the trial and error method. The gain values are listed in
Table 3. Figure 6 shows the linear flexible inverted pendulum control by the classical PD
controllers. And Figure 7 shows the non-linear flexible inverted pendulum control by the
classical PD controllers.

31

Fig. 6. Linear flexible inverted pendulum in simulink. See Appendix A for more information.

32
TABLE 3
GAIN VALUES OF THE CLASSICAL PD CONTROLLER FOR THE LINEAR
FLEXIBLE INVERTED PENDULUM

Cart
positio
n
kp

Cart
positio
n
kd

Angle of
Pendulu
m
kp

Angle of
Pendulu
m
kd

1st
mode
vibratio
n
kp

1st
mode
vibratio
n
kd

2nd
mode
vibratio
n
kp

2nd
mode
vibratio
n
kd

3rd
mode
vibratio
n
kp

3rd
mode
vibratio
n
kd

250

40

300

20

100

100

100

CHAPTER IV

FUZZY PROPORTIONAL-DERIVATIVE
(PD) CONTROLLER

An Overview
In the past few years, many artificial intelligent control techniques have been
developed due to the rapid increases of complex and highly non-linear systems. Fuzzy
logic is one of the emerging artificial intelligent control techniques. The increases of
complex and highly non-linear systems has led to more difficulties and sometime
impossible to describe a system in mathematical forms. Fuzzy logic is very useful in
complex and highly non-linear systems because it does not require a mathematical model
to describe the systems. Therefore, the use of fuzzy logic in applications has increased
rapidly. The application ranges from house hold appliances such as washing machine and
microwave to industrial products and machines. In Japan, fuzzy logic controller is
implemented into washing machines to give it intelligence. The washing machine can
determine the amount of detergent and time to wash the load of cloth depending on the
weight and dirt type. This is only a small example of the many applications using fuzzy
logic control in Japan.
Interest in fuzzy logic control is increasing in Japan and the rest of the world
because Fuzzy logic has many advantages over the other intelligent controllers:

33

34

It is conceptually easy to understand.

It lets the designer design a fuzzy system to match any set of input-output data

for complex system using its own common knowledge and expertise.

The idea of fuzzy sets is similar to the way humans think and solve problems

in the form of IF this AND that happen THEN take this action.

It is flexible because new functions can be added on top of the existing

functions without starting over.

It can be combined with classical control techniques such as PID and

intelligent control techniques such as neuro network and genetic algorithm.


Japan is also replacing and combining classical controllers with fuzzy logic.
Classical PD controller becomes an intelligent controller when the gain values are tuned
by fuzzy logic. This controller is called fuzzy PD and is used in this project to stabilize
the non-linear flexible inverted pendulum. The fuzzy logic toolbox in Matlab and
simulink is used to build the fuzzy system. The toolboxes in Simulink are also used to
build the classical PD controller. An overview schematic of the fuzzy PD control is
shown in Figure 7.
The classical gain control method is very effective for linear systems but in
the case of nonlinear complicated systems with uncertainties in the system dynamics it
can not guarantee good control responses. Therefore, improvements on the classical
control are necessary to achieve good performances. This paper used a fuzzy logic
controller to auto tune the gain values of the classical PD controller. The hybrid
controller is called fuzzy PD control.

35

Fig. 7. Overview fuzzy PD control system.

Before fuzzy logic can be combined with the classical PD controller, an


understanding of both the controllers fundamental is important. The classical PD
controller is described in Chapter III, the input of classical PD is the errors between the
system output and reference input. The fuzzy inference is used to tune the PD parameters
to provide a nonlinear mapping between the error and derivative of error to the PD
parameters. The parameters are tuned between the initial parameter boundaries. The PD
boundary ranges are determined by the trial and error method as described in Chapter III.

Fuzzy
The fuzzy logic theory in this project is borrowed from the Matlab fuzzy logic
[20] since fuzzy logic in this project is built in Matlab and Simulink. Fuzzy logic is a
suitable way to map input data to output data. Fuzzy logic consists of three steps:
fuzzification, rule evaluation and deffuzzification. The input data is acquired and fed to

36
the steps of fuzzy logic as seen on Figure 8. Fuzzification turns the input real world
numerical values

Fig. 8. Three steps of fuzzy logic controller.

into fuzzy numerical values. The rule evaluation is the brain of fuzzy control; it makes
the decision according to the rules assigned. Defuzzification transforms fuzzy numerical
values back to real world values.
Fuzzification
An understanding of a fuzzy set concept will make it easier to understand
fuzzy logic. A fuzzy set is a set that can contain partial degree of membership unlike a
classical set. A classical set is a container that either includes (yes) or excludes (no) the
elements. There are no gray areas in between, only black or white. A fuzzy set allows
gray areas in the set, meaning an element can partially belong in the set and partially
dont belong in the set. The fuzzy set can be expressed as

A {x, A ( x)}
x X

(77)

37
where
X = the universe of discourse

x = elements or variables in the universe of discourse

A ( x) = membership function
As an example, consider the spring season. In a classical set, the months
March, April and May are considered spring and any other months are not. For the fuzzy
set, March and June are only a partial membership of spring because spring season begin
on March twenty and end on the first day of summer June twenty. These two months are
only considered to be spring for half of the month. That makes these months a partial
membership of spring. See Figure 9 for the classical set and Figure 10 for the fuzzy set.

Fig. 9. Classical set for spring season.

The membership function is the curve that maps each variable in the input
space (universe of discourse) to a value between 0 and 1. The value between 0 and 1 is a
conditional requirement for a membership function. The function can be any curve that
satisfies the criteria of a design. The Fuzzy Logic Toolbox in Matlab have eleven built-in

38

Fig. 10. Fuzzy set for spring season.

functions that includes piecewise linear functions, Gaussian distribution function,


sigmoid curve and quadratic and cubic polynomial curves. All of these curves have their
own advantage over the others.
The simplest membership functions are the linear functions; triangle and
trapezoidal curve. These functions have an advantage over the other functions because of
its simplicity. The triangle curve only requires three points to form a triangle and the
trapezoidal is similar to the triangle except for the flat top. Figure 11 shows the triangle
and trapezoidal (truncated triangle) curve.

Fig. 11. Triangle and trapezoidal membership functions.

39
The linear functions are simpler but it is not always a popular choice.
Gaussian distribution curves and bell curve are a popular choice to a certain extent
because it is smooth and nonzero at all points. The smoothness of the curve allows more
flexibility for the membership values. Figure 12 and Figure 13 shows the Gaussian curves

Fig. 12. Gaussian membership function.

Fig. 13. Bell Shape membership function.

40
and bell curve. The sigmoidal curves have an advantage over the Gaussian and bell
curves because it can deal with specific asymmetric membership functions. The
sigmoidal curve is shown in Figure 14.

Fig. 14. Sigmoidal membership function.

The sigmoidal curve takes the shape similar to the s shape but more flat on the
top. The product between the two sigmoidal curves takes the shape similar to the s shape
with the exception of steeper slope on the right side.
The polynomial curves consist of curve shapes that are in the form of Z, S and
Pi. The Z curve takes the shape of a z, starting from coordinate (0,1) to coordinate (10,0).
The pi shape curve takes the shape of a pi symbol with the exception of steeper slope on
the left side. The S curve takes the shape of a s, starting from coordinate (0,0) to
coordinate (10,1).
Rule Evaluation
The rules evaluation step is the logic of fuzzy logic. It makes decision base on
logical reasoning of the rules. Therefore, it is also important to understand the logic of

41
fuzzy logic. The logics of fuzzy is similar to the standard Boolean logic if the fuzzy
values are keep at 1 being true and 0 being false. The truth table of three different
operations AND, OR, and NOT are shown in the tables below. The AND operation is
also known as the fuzzy intersection or conjunction, the OR operation are called fuzzy
union or disjunction and the NOT operation is known as the fuzzy complement.
The fuzzy intersection of two fuzzy sets A and B can be represent as

A B ( x) T ( A ( x), B ( x))

(78)

where
T is the binary mapping

and it meets the following requirements:


Boundary: T (0, 0) 0, T ( a,1) T (1, a ) a ---imposes the correct generalization to crisp
sets
Monotonicity: T ( a, b) T (c, d ) if a c and b d --membership value in A intersection
B is not affected by the decrease in the membership values in A or B.
Commutativity: T ( a, b) T (b, a ) --order of the operator doesnt affect the fuzzy set to be
combined.
Associativity: T ( a, T (b, c)) T (T ( a, b), c ) --the number of sets in the intersection can be
arranged in any order of grouping.
The fuzzy union is similar to the fuzzy intersection with the exception of
binary mapping specified by S. This is represented by the following expression,

A B ( x) S ( A ( x), B ( x))

(79)

42
where

S = binary mapping
And its requirements is similar to the fuzzy intersection
S (1,1) 1, S ( a, 0) S (0, a ) a
S ( a, b) S (c, d ) if a c and b d

S ( a , b ) S (b , a )
S ( a, S (b, c )) S ( S ( a, b), c )

As described earlier, fuzzy logic is not just a matter of 1 and 0 but between the
membership values of 1 and 0. Meaning a membership value could be any value between
1 and 0, not just strictly to 1 or 0. The following tables show the fuzzy logic operation
results for the operations AND, OR, and NOT. In fuzzy logic, the AND operation is
considered to be minimum, the OR operation is considered to be maximum and the NOT
operation is considered to be 1-A. The standard Boolean operations are similar to the
fuzzy logic operations if the membership values are kept strictly to 1 and 0, in truth table
(Tables 4, 5, and 6).

TABLE 4
AND OPERATION TRUTH TABLE
A
0
0
1
1

B
0
1
0
1

A and B
0
0
0
1

The following example shows the difference between a standard Boolean


operations and fuzzy logic operations. First lets consider the logic value to be strictly 1

43

A
0
0
1
1

TABLE 5
OR OPERATION TRUTH TABLE

B
0
1
0
1

A or B
0
1
1
1

TABLE 6
NOT OPERATION TRUTH TABLE

A
A not B
0
1
1
0

and 0 as seen on the truth table. The truth table can be converted into a graph that
described two fuzzy sets that are combined to form one fuzzy set. Figure 15 shows the
combination results. Now consider the logic value to be any values between 1 and 0.
Figure 16 shows the combination of two logics if its values can vary between 1 and 0.
The conditional statements of fuzzy logic are defined by the if-then rule
statements. A fuzzy if-then rule statement can be represent in the form, If x is A then y is
B.
The fuzzy sets on the universes of discourse X and Y define the linguistic
values A and B, respectively. The term antecedent is used to represent the if-part of the
rule x is A. The antecedent returns a single number between 0 and 1 because A is
represented by a number between 0 and 1. The y is B of the then-part is called the

44

Fig. 15. The results for AND, OR and NOT operation with two values logic membership.

Fig. 16. The results for AND, OR and NOT operation with partial membership values.

consequent. The consequent assigns the entire fuzzy set of B to the output variable y. The
word is in the if-then rule have two different meaning depending if it is used in the
antecedent or consequent part of the rule. The is in the antecedent is a distinction
between a relational test and the is in the consequent is a variable assignment. The
antecedent and consequent can have multiple parts as, If x is A and y is B then w is C and
z is D.
The if-then rule can be interpreted into three parts: fuzzify inputs, fuzzy
operator to multiple part antecedents, and implication method. The fuzzify inputs assign a

45
degree of membership between 0 and 1 to all fuzzy statement in the antecedent where the
antecedent only have one part. If the antecedent has multiple parts then the fuzzy operator
applies the fuzzy logic operators and assigns a single number between 0 and 1 to the
antecedent. These two steps are known as the degree of support for the rule. In the
implication method, the degree of support for the entire rule is used to shape the output
fuzzy set. The fuzzy set is assigns to the output by the consequent. Therefore the qualities
of the consequent are indicated by a fuzzy set which is represented by a membership
function.
The if-then rules can be interpreted in three parts. The first part is the fuzzy
set. The fuzzy set is the output of each rule. Therefore, the amount of fuzzy sets depends
on the rules. The second part is the aggregation. The fuzzy sets are aggregated into one
output fuzzy set. Finally, this aggregated output fuzzy set is defuzzified to a single
number. The defuzzified process will be covered later.
Defuzzification
In the defuzzification process, the aggregated fuzzy set is converted to a single
output value. A triangle membership function is used for the input signals, so there are a
maximum of four rules involved in the decision making process.

Current Use of Fuzzy PID Controller


Technologies
Complex systems with no exact mathematical models are hard and sometime
not possible to used one type of adaptive controller to stabilize the system. In this case,
two or more adaptive controllers are combined together to form one adaptive controller.
Hybrid controllers are becoming an increasing topic due to the increase in complexities

46
of system with advance technologies. There are studies of hybrid controllers such as:
neuro PID [9], neuro fuzzy logic [10], genetic algorithm (GA) fuzzy [11], GA neuro [12]
and many others. Fuzzy PID [15] controller is one among the many hybrid controllers.
Fuzzy PID is a controller that consists of the classical proportional-integralderivative (PID) controller and fuzzy logic controller. This combination is unique
because it turns a linear controller, PID controller, into an adaptive and suitable controller
for nonlinear system. The fuzzy logic controller is used to adjust the gain values of the
PID controller over time. This turns the classical PID controller into an adaptive PID
controller.
Tian [13] used fuzzy PID to control the position of an industrial robotic
system to study the movements; extension, lateral bending and axial rotation of human
functional spinal unit. Cetin and Demir [14] improve the comfort of car ride and handling
control by implying fuzzy PID to car suspension. Controlling the car suspension to
stabilized the vibrations of the vehicle. Puntunan and Parnichkun [15] used fuzzy PID to
control a flying robot while Pal and Mudi [17] used fuzzy to tuned only the proportional
and integral (PI) gain to control a Heating, Ventilation and Air-Conditioning (HVAC)
system. Ahn and Nguyen [18] used a fuzzy PID controller to control the position of the
shape memory alloy.
Tians [13] method of designing the fuzzy PID is similar to Ahn and
Nguyen[18]. This method is used in this project to design the controllers for nonlinear
flexible inverted pendulum system. Tian [13] used a fuzzy logic controller to tune the
gain values of the classical PID controller in a close loop system. The force error and the
derivative of the error are the input of the fuzzy logic control. The rules are base on the

47
designers experience and knowledge of the dynamic system. The output of the fuzzy
logic controller is the tuned gain values of the classical PID controller.
The parameters of the PID controller are tuned in a range of
[ K p min , K p max ],[ K d min , K d max ] and [ K i min , Ki max ]. These parameters are tuned with the
following expression

K p K p min K p ( EF , ECF )( K p max K p min )

(80)

K d K d min K d ( EF , EC F )( K d max K d min )

(81)

K i K i min K i ( E F , EC F )( K i max K i min )

(82)

where the subscripts min indicate the minimum values and subscripts max indicate the
maximum values of PID parameters. is the adjustment coefficients, EF is the force
error and ECF is the derivative of the error.
The above equations show that the adjustment coefficients determined the
values of the PID parameters between the ranges. The fuzzy logic controller determined
the values of the adjustment coefficients of the PID parameters. According to Tian Fuzzy
logic has four components: fuzzification, knowledge base, decision, and defuzzification.
In the fuzzification step, the input; error and change of error (derivative of the
error) are normalized in the following equations in the domain range of [-1, 1].
NE EF / K e

(83)

NEC ECF / K c

(84)

NK Dis / K k

(85)

48
where D is the output of the fuzzy logic controller and K e , K c and K k are the inputs and
outputs scaling factors. The relationship between the inputs of the fuzzy logic controller
and their membership degrees are described using the triangle membership function. The
fuzzy input variables are described below as
NE=NEC=[NB,NM,NS,ZE,PS,PM,PB]
where NB=negative big, NM=negative medium, NS=negative small, ZE=zero,
PS=positive small, PM=positive medium and PB=positive big. The fuzzy output variable
is described below as
NK=[ZE, VS, S, SB, MB, B, VB]
where ZE=zero, VS=very small, S=small, SB=small big, MB=medium big, B=big and
VB=very big.
In the knowledge base and decision steps, the PID parameters tuning principle
is used to build the rules. The proportional gain K p should be larger at the beginning of
the control process to reduce the rise time and speed up the control process. K p should
gradually decrease to a smaller value to reduce steady state error. Since the overshoot of
the control system and change of force error can be suppress by the derivative gain K d .
K d should be larger at the beginning and decrease as the change of force error gets
smaller. Finally, steady state accuracy is improve by the integral gain K i . Therefore, K i
should be smaller in the beginning to improve the response speed of the control system.
K i should increase over the period to reduce steady state error and develop better control
accuracy. The rules of fuzzy logic are developed using these principles.

49
In the final step, defuzzification, a triangle membership function is used for
the input signal. The triangle membership function has a maximum of four rules in the
decision making process. Take an example from Tian[13] , if the force error eF and the
change in force error ecF
(1)
Rule 1: IF eF is PB( E(1),PB ) and ecF is PM ( EC
, PM ) , THEN K p is B, K i is VS,

and K d is B
(2)
Rule 2: IF eF is PB( E(2),PB ) and ecF is PS ( EC
, PS ) , THEN K p is MB, K i is VS,

and Kd is SB
(3)
Rule 3: IF eF is PM ( E(3),PM ) and ecF is PM ( EC
, PM ) , THEN K p is MB, K i is S,

and Kd is SB
(4)
Rule 4: IF eF is PM ( E(4),PM ) and ecF is PS ( EC
, PS ) , THEN K p is SB, K i is SB,

and K d is S
The weighted average of the below expressions are used to determined the
output of the fuzzy logic.

kp

ki

(1)
(2)
(2)
(3)
(3)
(4)
(4)
(min{E(1),PB, EC
,PM}*B min{E,PB , EC,PS }*MB min{E,PM , EC,PM}*MB min{E,PM , EC,PS }*SB
(1)
(2)
(2)
(3)
(3)
(4)
(4)
min{E(1),PB, EC
,PM} min{E,PB, EC,PS } min{E,PM , EC,PM} min{E,PM , EC,PS }

(86)

(1)
(2)
(2)
(3)
(3)
(4)
(4)
(min{E(1),PB, EC
,PM }*VS min{E,PB , EC,PS }*VS min{E,PM , EC,PM }*S min{E,PM , EC,PS }*SB

kd

(1)
(2)
(2)
(3)
(3)
(4)
(4)
min{E(1),PB, EC
,PM } min{E,PB , EC,PS } min{E,PM , EC,PM } min{E,PM , EC,PS }

(1)
(2)
(2)
(3)
(3)
(4)
(4)
(min{E(1),PB, EC
,PM }* B min{E,PB , EC,PS }*SB min{E,PM , EC,PM }*SB min{E,PM , EC,PS }*S
(1)
(2)
(2)
(3)
(3)
(4)
(4)
min{E(1),PB, EC
,PM } min{E,PB , EC,PS } min{E,PM , EC,PM } min{E,PM , EC,PS }

(87)

(88)

50
where the membership function for the force error and change in force error is represent
(n)
by E( n,()m ) and EC
,( m ) , respectively. The nth rule involved is indicated by n and m

represents the functions {NB, NM, NS, AZ, PS, PM, PB}.

Fuzzy PD Controller
In this section, the fuzzy PD controller is designed for the flexible inverted
pendulum system. The fuzzy PD controller design method is borrowed from Tian [13]
and Ahn and Nguyen [18] fuzzy PID control method. The principles of tuning PID
parameters are borrowed from Tian [13] to design the fuzzy rules. The membership
functions are also borrowed from Tian [13]. The normalize factor scale equations are
borrowed from Ahn and Nguyen [18].
The hybrid controller will be designed in similar method as Tian[13] with the
exception of the integral gain of the classical PID controller. Through the trail and error
method in the previous section, the integral gain was discovered to cause oscillations.
Therefore, the hybrid controller used for this project will exclude the integral gain. This
hybrid controller is called fuzzy PD control. The fuzzy PD controller is designed in the
following fashion with three components of the fuzzy logic controller: fuzzyfication, rule
evaluations and defuzzyfication.
Fuzzy PD Control Design
Fuzzy logic control is used to auto tune the gain values of the classical PD
control. Fuzzy logic consists of three steps: fuzzification, rule evaluation and
defuzzification as seen on Figure 8. The fuzzification step turns the input real world
numerical values into fuzzy numerical values. The rule evaluation step is the brain of

51
fuzzy control; it makes the decision according to the rules assigned. The defuzzification
step transforms the fuzzy numerical values back into real world values.
Fuzzyfication. The variables of the input space, also known as universe of
discourse, used for the non-linear flexible inverted pendulum fuzzy set are the error
( e(t ) ) and its derivative (

d
e(t ) ) or the change of error. Each variable have seven
dt

memberships similar to Tian [13]: NB is negative big, NM is negative medium, NS is


negative small, ZE is zero error, PS is positive small, PM is positive medium, and PB is
positive big. But the ranges of the membership are different. The triangle shape
membership function with the range from -0.5 to 0.5 is associated with memberships of
the error. And the triangle shape membership function with the range from -0.1 to 0.1 is
associated with memberships of the derivative of the error. All the membership functions
are separated in a uniform distance. The following figures show the membership
functions for the error ( e(t ) ) in Figure 17 and its derivative (

d
e(t ) ) in Figure 18.
dt

The variables of the output space used for the non-linear flexible inverted
pendulum fuzzy set are normalized proportional gain KPn and normalized derivative gain
KDn. Each variable and its range are also similar to Tian [13] which have seven
memberships: VB is very big, B is big, MB is medium big, ZE is zero error, SB is small
big, S is small, and VS is very small. The membership function used for these
memberships are triangle shape and have a range from 0 to 1. Figures 19 and 20 show the

52

Fig. 17. The membership functions for memberships of input variable error ( e(t ) ).

Fig. 18. The membership functions for memberships of input variable derivative of the
d
error ( e(t ) ).
dt

53

Fig. 19. The membership functions for memberships of output variable


normalized proportional gain (KPn).

Fig. 20. The membership functions for memberships of output variable normalized
derivative gain (KDn).

54
membership functions for the normalized proportional gain (KPn) and normalized
derivative gain (KDn) respectively.
Rule Evaluation. The PD parameters tuning principle are used to develop the
fuzzy rules for the fuzzy inference. The proportional gain ( k p ) can reduce the rise time
and speed up the control process with a large k p value. Therefore k p should be large at
the beginning of the control process and slowly decrease to a smaller value in order to
reduce steady-state error. The overshoot of the control system and the derivative of the
error (

d
e(t ) ) can be controlled by the derivative gain ( k d ). The derivative gain k d value
dt

is depended on the derivative of the error. If the derivative of the error is small then
k d should be small. If the derivative of the error is large then k d should be large.
Therefore, the derivative gain should be larger at the beginning of the control process and
gradually decrease according the change of error.
Usually in the beginning of the period, the error and derivative of error are
positively large and negatively large, respectively. So k p and k d should be large, therefore
the fuzzy rule is designed as
IF e(t ) is PB and

d
e(t ) is NB, THEN k p is VB, k d is B
dt

The complete fuzzy rules are shown below in Table 7.


Defuzzification. In the defuzzification process, the aggregated fuzzy set is
converted to a single output value. A triangle membership function is used for the input
signals, so there are a maximum of four rules involved in the decision making process.

55
TABLE 7
COMPLETE FUZZY RULES (NOTE: MEMBERSHIP GAIN VALUES
ARE INDICATED AS k p / k d )
e(t )
d
e(t )
dt
NB
NM
NS
AZ
PS
PM
PB

NB

NM

NS

AZ

PS

PM

PB

VB/VB
B/B
MB/SB
SB/VS
SB/S
MB/MB
B/B

B/B
MB/SB
SB/S
S/S
SB/VS
MB/S
MB/SB

SB/MB
SB/SB
S/S
VS/VS
S/VS
SB/S
SB/SB

S/SB
S/VS
VS/VS
ZE/ZE
VS/VS
S/SB
S/MB

SB/SB
SB/S
S/VS
VS/VS
S/S
SB/SB
SB/MB

MB/SB
MB/S
SB/VS
S/S
SB/S
MB/SB
B/B

B/B
MB/MB
SB/S
SB/VS
MB/SB
B/B
VB/VB

For example:
Rule 1: IF e(t ) is PB and

d
e(t ) is PM THEN k p is B, k d is B
dt

Rule 2: IF e(t ) is PB and

d
e(t ) is PS THEN k p is MB, k d is SB
dt

Rule 3: IF e(t ) is PM and

d
e(t ) is PM THEN k p is MB, k d is SB
dt

Rule 4: IF e(t ) is PM and

d
e(t ) is PS THEN k p is SB, k d is S
dt

The following expression is the weighted average borrowed from Tian [13] to
determine each output gain values for the classical PD control:
Weight average of k p for the above rules
kp

(min{PB, PM }* B min{PB, PS}* MB min{PM , PM }* MB min{PM , PS}* SB


(89)
min{PB, PM } min{PB, PS} min{PM , PM } min{PM , PS}

56
Weight average of k d for the above rules:
kd

(min{PB, PM }* B min{PB, PS}* SB min{PM , PM }* SB min{PM , PS}* S


(90)
min{PB, PM } min{PB, PS} min{PM , PM } min{PM , PS}

These output gain values are normalized over the interval [0,1] to obtain efficiency. The
normalized gain values expression are borrowed from Ahn and Nguyyen[18] as
KPn

KDn

K p K p min

(91)

K p max K p min

K d K d min
K d max K d min

(92)

where KPn and KDn are the normalized proportional and derivative gain, respectively.
Therefore, the converted output gain values from the fuzzy inference are the tuned PD
parameters for the classical PD controller. This can be expressed as
K p KPn( K p max K p min ) K p min

(93)

K d KDn( K d max K d min ) K d min

(94)

The K p and K d gain values are within the boundaries of each parameter indicated below.
These parameter ranges are found using the trial and error method.
The experimental PD parameter ranges are:
Cart position: [ k p min , k p max ] = [400,650]

[ kd min , kd max ] = [50,100]

Angle of Pendulum: [ k p min , k p max ] = [500,650]

[ kd min , kd max ] = [20,50]

1st mode vibration: [ k p min , k p max ] = [300,450]

[ kd min , kd max ] = [10,40]

2nd mode vibration: [ k p min , k p max ] = [300,500]

[ kd min , kd max ] = [10,40]

3rd mode vibration: [ k p min , k p max ] = [200,400]

[ kd min , kd max ] = [50,25]

CHAPTER V

SIMULATION

The simulations are done in Matlab and Simulink for the linear and nonlinear
flexible inverted pendulum in six different cases. Matlab is used to run the parameter
values for both linear and non-linear flexible inverted pendulum. The models are built in
Simulink using the differential motion of equations developed in Chapter II. The tool
boxes in Simulink are used to build each differential equation for both linear and
nonlinear flexible inverted pendulum model. There are two different control methods to
control the flexible inverted pendulum: classical PD control and fuzzy PD control. The
PID tool box is used as the classical PID controller to control the linear and nonlinear
models. The fuzzy logic tool box is used to tune the parameters of the classical PD
controller for the nonlinear model. Each model is evaluated for six different cases. The
step inputs are used as the applied force and the scopes are used to view the results.
Case 1: Using the applied force to disturb the car in a small distance of 0.04 m =
1.575 inches to the right.
Case 2: Using the applied force to disturb the car in a distance of 0.08 m = 3.150
inches to the right.
Case 3: Using the applied force to disturb the car in a distance of 0.15 m = 5.91
inches to the right. Since the first three cases involved the car being pushed to the right,

57

58
the next three cases will include the car being pushed to the left and right to pass its
origin.
Case 4: Using the applied force to disturb the car in a distance of -0.04 m = 1.575
inches to the left and push the car back to the right pass its origin to 0.04 m with a total
distance of 0.08 m.
Case 5: Using the applied force to disturb the car in a distance of -0.15 m = 5.91
inches to the left and push the car back to the right pass its origin to 0.15 m with a total
distance of 0.3 m.
Case 6: Using the applied force to disturb the car in a distance of 0.15 m = 5.91
inches to the right and push the car back to the left pass its origin to 0.15 m and then push
the car back to the right pass its origin to 0.15 m.
The programs are included with this report on a CD. Therefore, all of the
following simulations can be simulated using the programs on the CD. The instructions to
simulate the programs are briefly described in their appropriate sections. A more detail
instructions are described in the Read Me Instructions in Appendix E.

Parameters of the Flexible Inverted


Pendulum
The parameters of the linear and nonlinear flexible inverted pendulum systems
are borrowed from Smalley [1] since the motion of equations are also borrowed from
him. Matlab is used to run the parameter values for both linear and non-linear flexible
inverted pendulum. Table 8 shows the parameter values for the linear flexible inverted
pendulum and Table 9 shows the parameter values for the non-linear flexible inverted
pendulum.

59
TABLE 8
PARAMETERS OF LINEAR FLEXIBLE INVERTED PENDULUM
mc 0.420kg

I 0.01156kgm2

m p 0.186kg

L 0.8636m

mw 0.149kg

b 0.4318m

g 9.81

s2

c pendulum 0.05
ccart 0.5

kgm2

kg

TABLE 9
PARAMETERS OF NON-LINEAR FLEXIBLE INVERTED PENDULUM
mc 0.420kg

I 4.069 *10 12 m 4

mw 0.21kg

L 1m

kg

s2
H1 0.3703m

rw 0.5m

ccart 0.5

kg

c pendulum 0.05

kgm2

H 2 0.1998m

s2
H 3 0.1385m

1 ( z ) 1.921*10

2 ( z ) 2.8734*106

3 ( z ) 3.6788*10 5

1 3.9266m 1

2 7.0686m 1

3 10.2102m 1

0.188

E 69 *109 Pa

g 9.81

Simulation of the PD Control


The models are built in Simulink using the differential motion of equations
developed in Chapter II. And Matlab is used to run the parameter values for both linear
and non-linear flexible inverted pendulum. The simulations of the PD control are broken
into two parts: linear flexible inverted pendulum and nonlinear flexible inverted

60
pendulum. Each part is evaluated with six different cases as mention earlier. The PID tool
box is used as the classical PID controller. The classical PD control is a widely used,
cheap, simple and effective controller for most linear systems. Therefore, the classical PD
controls are used to control both the linear and nonlinear flexible inverted pendulum
simulations. The same classical PD control gains are used for both linear and nonlinear
model so the results can be compared.
Linear Flexible Inverted Pendulum
The linear flexible inverted pendulum model is derived from the linear
differential motion of equations developed in Chapter II. The model is built in Simulink
and the model parameters are run in Matlab. The parameters file
flex_pend_linear_par1.m in Matlab have to be run first to load the values to the variables
of the model in Simulink (flex_pend_linear.mdl). The classical PD controllers are used to
control this system. The gain values of the classical PD controllers are changed using the
PID toolbox. The gain values of the proportional gain K p and derivative gain K d are
found using the trial and error method. Table 3 shows the classical PD control gain
values. And the step inputs are the input force. Figure 6 shows the linear flexible inverted
pendulum that is being controlled by the classical PD controllers.
Nonlinear Flexible Inverted Pendulum
The nonlinear flexible inverted pendulum is also built in Simulink using the
nonlinear differential motion of equations developed in Chapter II. The parameters are
also run in Matlab. The parameters file parameters_nl_flex.m in Matlab has to be run first
to load the values to the variables of the model in Simulink (flex_pend1a_pd.mdl). This
system is also controlled by the classical PD controllers. The same gain values from

61
Table 3 are used for this system for comparison. And the step inputs are the input force.
Figure 7 shows the nonlinear flexible inverted pendulum that is being control by the
classical PD controllers.

Simulation of the Fuzzy PD Control


Non-Linear Flexible Inverted Pendulum
The same nonlinear flexible inverted pendulum model and parameters from
the above section are used for this section. The parameters file parameters_nl_flex.m in
Matlab has to run first to load the values to the variables of the model in Simulink
(flex_pend1a.mdl). This system is control by the hybrid controllers, fuzzy PD. The fuzzy
logic control is designed using fuzzy logic toolbox in Matlab and Simulink. The fuzzy
inference systems (fis) file fuzzy_fisnish.fis content the fuzzy logic information. It has to
be loaded in the workspace before fuzzy logic can be run in Simulink. Workspace is the
information link between Matlab and Simulink. The fuzzy inference system is open by
typing fuzzy fuzzy_fisnish on the Matlab command window. On the fuzzy inference
system window, export the information to workspace. Now with all the information
loaded, the model with the hybrid controllers (flex_pend1a.mdl) can be run in Simulink.
The step inputs are the input force. The same six different cases mentioned earlier are
used to evaluate this controller.

CHAPTER VI

RESULTS

This chapter shows the simulation results for the simulations done in Chapter
V. As mention in Chapter V, the simulations are broken into three parts with two control
methods, classical PD and fuzzy PD. The classical PD control method is used to control
both linear and nonlinear flexible inverted pendulum for six different cases. The fuzzy
PD controllers control the nonlinear flexible inverted pendulum in six different cases.
These cases are mentioned earlier in Chapter V.

PD Control
The classical PD control has two parts: linear and nonlinear flexible inverted
pendulum system. Each part of the classical PD control will be evaluated with six
different cases. In each case the result shows the classical PD controllers work better for
the linear system. All five outputs: cart position, angle of the pendulum (theta), first mode
of vibration, second mode of vibration, and third mode of vibration have better response,
settling time and less oscillation for the second and third step input. Meanwhile the
classical PD controllers have a better response and settling time for the first step input on
the nonlinear system. The nonlinear system has more vibrations for the second and third
step. The linear and nonlinear flexible inverted pendulum results are shown in this
chapter.

62

63
Linear Flexible Inverted Pendulum
The classical PD controls show good stabilities time for the linear flexible
inverted pendulum system. The best stabilities time is for the second and third mode of
vibrations for the second step input in all cases. The first step input responses for all cases
have a bigger over shoot then the second step input responses. The results for all six cases
are shown below.
Case 1
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 0.647 second compared to the second step input 0.38 second.
The pendulum angle response for the first step has a settling time of 0.58 second while
there was no disturbance for the second step input. The first mode of vibrations have a
better settling time and less overshoot for the second step input compared to the first step
input. The settling time for the first step input of the mode of vibration is 0.765 second,
while the settling time for the second step input of the modes of vibration is 0.259
second. The second and third modes of vibrations are only disturbed for the first step
input and not for the second step input. The second and third modes of vibrations have a
settling time of 0.538 second and 0.559 second respectfully. These results are shown in
Figure 21.
Case 2
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 0.63 second compared to the second step input 0.545 second.
The pendulum angle response for the first step has a settling time of 0.61 second while
the second step input settling time is 0.072 second. The first mode of vibrations

64

Fig. 21. Case 1 classical PD control for linear flexible inverted pendulum.

65
have a better settling time and less overshoot for the second step input compared to the
first step input. The settling time for the first step input of the mode of vibration is 0.78
second while the settling time for the second step input of the modes of vibration is 0.245
second. The second and third modes of vibrations are only disturbed for the first step
input and not for the second step input. The second and third modes of vibrations have a
settling time of 0.549 second and 0.553 second respectfully. These results are shown in
Figure 22.
Case 3
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 1.25 second compared to the second step input 0.555 second.
The pendulum angle response for the first step has a settling time of 0.615 second while
the second step input settling time is 0.28 second. The first mode of vibrations have a
better settling time and less overshoot for the second step input compared to the first step
input. The settling time for the first step input of the mode of vibration is 0.84 second,
while the settling time for the second step input of the modes of vibration is 0.38 second.
The second and third modes of vibrations are only disturbed for the first step input and
not for the second step input. The second and third modes of vibrations have a settling
time of 0.525 second and 0.59 second respectfully. These results are shown in Figure 23.
Case 4
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 0.71 second compared to the second step input 0.556 second.
The pendulum angle response for the first step has a settling time of 0.64 second while
the second step input settling time is 0.13 second. The first mode of vibrations have a

66

Fig. 22. Case 2 classical PD control for linear flexible inverted pendulum.

67

Fig. 23. Case 3 classical PD control for linear flexible inverted pendulum.

68
better settling time and less overshoot for the second step input compared to the first step
input. The settling time for the first step input of the mode of vibration is 0.805 second,
while the settling time for the second step input of the modes of vibration is 0.22 second.
The second and third modes of vibrations are only disturbed for the first step input and
not for the second step input. The second and third modes of vibrations have a settling
time of 0.555 second and 0.59 second respectfully. These results are shown in Figure 24.
Case 5
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 0.845 second compared to the second step input 0.825
second. The pendulum angle response for the first step has a settling time of 0.625 second
while the second step input settling time is 0.42 second. The first mode of vibrations have
a better settling time and less overshoot for the second step input compared to the first
step input. The settling time for the first step input of the mode of vibration is 0.733
second, while the settling time for the second step input of the modes of vibration is 0.33
second. The second and third modes of vibrations are only disturbed for the first step
input and not for the second step input. The second and third modes of vibrations have a
settling time of 0.555 second and 0.59 second respectfully. These results are shown in
Figure 25.
Case 6
The cart position response for the first step input has a bigger over shoot and
settling time is slower with 1.25 second compared to the second and third step input 0.63
second and 0.65 second respectfully. The pendulum angle response for the first step has a
settling time of 0.61 second while the second and third step input settling time of 0.457

69

Fig. 24. Case 4 classical PD control for linear flexible inverted pendulum.

70

Fig. 25. Case 5 classical PD control for linear flexible inverted pendulum.

71
second and 0.455 second. The first mode of vibrations have a better settling time and less
overshoot for the second and third step input compared to the first step input. The settling
time for the first step input of the mode of vibration is 0.59 second, while the settling
time for the second and third step input of the modes of vibration are 0.3 second and 0.25
second. The second and third modes of vibrations are only disturbed for the first step
input and not for the second step input. The second and third modes of vibrations have a
settling time of 0.53 second and 0.50 second respectfully. These results are shown in
Figure 26.

Non-linear Flexible Inverted Pendulum


The nonlinear flexible inverted pendulum vibrations output responses are
better for the first step input then the second step input. The cart position and pendulum
angle (theta) output response varies for both step inputs depending on the case.
Therefore, the vibrations have a better settling time and less oscillation for the first step
input. These results are shown below with six different cases.
Case 1
The cart position responses for both first and second step inputs are similar
with a settling time of 0.75 second. The pendulum angle response for the first step is
worse than the second step with 0.85 second to 0.71 second respectfully. The first, second
and third mode of vibrations have a better settling time and less oscillation for the first
step input compared to the second step input. The settling time for the first step input of
the three modes of vibration are 0.51 sec, 0.452 sec and 0.459 sec, while the settling time

72

Fig. 26. Case 6 classical PD control for linear flexible inverted pendulum.

73
for the second step input of the three modes of vibration are 0.72 sec, 0.62 sec and 0.79
sec. These results are shown in Figure 27.
Case 2
The cart position responses for the first step input settle slower then the
second step input with a 0.85 second. The second step inputs settle with a time of 0.66
second. The pendulum angle response for the first step is worse than the second step with
0.85 second to 0.66 second respectfully. The first, second and third mode of vibrations
have a better settling time and less oscillation for the first step input compared to the
second step input. The settling time for the first step input of the three modes of vibration
are 0.525 sec, 0.449 sec and 0.370 sec, while the settling time for the second step input of
the three modes of vibration are 0.645 sec, 0.643 sec and 0.79 sec. These results are
shown in Figure 28.
Case 3
The cart position responses for the first step input settle slower then the
second step input with a 0.81 second. The second step inputs settle with a time of 0.70
second. The pendulum angle response for the first step is worse than the second step with
0.71 second to 0.655 second respectfully. The first, second and third mode of vibrations
have a better settling time and less oscillation for the first step input compared to the
second step input. The settling time for the first step input of the three modes of vibration
are 0.750 sec, 0.50 sec and 0.356 sec, while the settling time for the second step input of
the three modes of vibration are 0.50 sec, 0.62 sec and 0.79 sec. These results are shown
in Figure 29.

74

Fig. 27. Case 1 classical PD control for nonlinear flexible inverted pendulum.

75

Fig. 28. Case 2 classical PD control for nonlinear flexible inverted pendulum.

76

Fig. 29. Case 3 classical PD control for nonlinear flexible inverted pendulum.

77
Case 4
The cart position responses for the first step input settle a slower then the
second step input with a 0.85 second. The second step inputs settle with a time of 0.75
second. The pendulum angle response for the first step is worse than the second step with
0.85 second to 0.66 second respectfully. The first, second and third mode of vibrations
have a better settling time and less oscillation for the first step input compared to the
second step input. The settling time for the first step input of the three modes of vibration
are 0.525 sec, 0.449 sec and 0.370 sec, while the settling time for the second step input of
the three modes of vibration are 0.645 sec, 0.643 sec and 0.79 sec. These results are
shown in Figure 30.
Case 5
The cart position responses for both first and second step inputs settling time
are similar at 0.825 second. The pendulum angle response for the first step is worse than
the second step with 0.71 second to 0.655 second respectfully. The first and second
modes of vibrations are slightly slower for the first step input compared to the second
step. The first step has a settling time of 0.57 second and the second step has a settling
time of 0.525 second with more oscillations. Third mode of vibration has a better settling
time and less oscillation for the first step input (0.355 second) compared to the second
step input (0.79 second). These results are shown in Figure 31.
Case 6
The cart position responses for the first and third step input settle a slower
then the second step input with a 0.84 second and 0.851 second. The second step inputs
settle with a time of 0.80 second. The pendulum angle responses for the first and third

78

Fig. 30. Case 4 classical PD control for nonlinear flexible inverted pendulum.

79

Fig. 31. Case 5 classical PD control for nonlinear flexible inverted pendulum.

80
step input are worse than the second step with 0.61 second, 0.59 second and 0.749 second
respectfully. The first mode of vibration settling time is similar at 0.45 second for all
three step inputs. The second and third mode of vibrations have a better settling time and
less oscillation for the first step input compared to the second and third step inputs. The
settling time for all three step inputs for the second mode of vibration are 0.35 second,
0.63 second and 0.62 second. The third modes of vibration settling time for all three step
inputs are 0.355 second, 0.7 second and 0.73 second. Results are shown in Figure 32.

Fuzzy PD Control
Non-Linear Flexible Inverted Pendulum
The non-linear flexible inverted pendulum output responses for the fuzzy PD
control are more stable and less oscillations. The second and third step inputs have a
better settling time compared to the classical PD control for the non-linear flexible
inverted pendulum. The results for all six cases are shown below.
Case 1. The cart position responses for the first step input settle is slightly
slower then the second step input with a 0.86 second. The second step inputs settle with a
time of 0.849 second. The pendulum angle response for the first step is better then the
second step with 0.549 second to 0.627 second respectfully. The first, second and third
mode of vibrations have a better settling time for the first step input compared to the
second step input. The settling time for the first step input of the three modes of vibration
are 0.60 sec, 0.43 sec and 0.41 sec, while the settling time for the second step input of the
three modes of vibration are 0.64 sec, 0.51 sec and 0.357 sec. These results are shown in
Figure 33.

81

Fig. 32. Case 6 classical PD control for nonlinear flexible inverted pendulum.

82

Fig. 33. Case 1 fuzzy PD control for nonlinear flexible inverted pendulum.

83
Case 2. The cart position responses for both first and second step inputs have
a similar settle time with a 0.8 second. The pendulum angle response for the first step is
better than the second step with 0.57 second to 0.65 second respectfully. The first and
second modes of vibrations have a similar settling time for both step inputs. The first
mode of vibration has a settling time of 0.63 second and the second mode of vibration
0.54 second. Third mode of vibration has a better settling time for the first step input
compared to the second step input. The settling time for the first step input of the third
mode of vibration is 0.43 second, while the settling time for the second step input is 0.52
second. These results are shown in Figure 34.
Case 3. The cart position responses for the first step input settle faster than the
second step input with a 0.66 second. The second step inputs settle with a time of 0.9
second. The pendulum angle response for the first step is better than the second step with
0.545 second to 0.71 second respectfully. The first and second modes of vibrations have a
better settling time for the first step input compared to the second step input. The first
step input has a settling time of 0.54 second and the second step input with a time of 0.73
second. Third mode of vibration has a better settling time and less oscillation for the
second step input compared to the first step input. The settling time for the first step input
of the third mode of vibration is 0.5 sec, while the settling time for the first step input of
the third mode of vibration is 0.35 sec. These results are shown in Figure 35.
Case 4. The cart position responses for the first and second step input settling
time are similar with a 0.77 second. The pendulum angle response for the first step is
worse than the second step with 0.665 second to 0.55 second respectfully. The first,
second and third modes of vibrations have a worst settling time for the first step input

84

Fig. 34. Case 2 fuzzy PD control for nonlinear flexible inverted pendulum.

85

Fig. 35. Case 3 fuzzy PD control for nonlinear flexible inverted pendulum.

86
compared to the second step input. The first step input for all three modes of vibrations
have a settling time of 0.64 second, 0.61 second and 0.42 second respectfully. The second
step input with a time of 0.559 second, 0.54 second and 0.458 second. These results are
shown in Figure 36.
Case 5. The cart position responses for the first step input settle slower than
the second step input with a 0.95 second. The second step inputs settle with a time of 0.83
second. The pendulum angle response for the first step is worse than the second step with
0.66 second to 0.59 second respectfully. The first, second and third modes of vibrations
have a better settling time for the first step input compared to the second step input. The
first, second and third modes of vibrations step inputs have a settling time of 0.69 second,
0.65 second and 0.51 second respectively. The second step input with a time of 0.559
second, 0.54 second and 0.458 second. These results are shown in Figure 37.
Case 6. The cart position responses for the first and third step inputs settling
time is similar and faster than the second step input with a 0.65 second. The second step
input settle with a time of 0.83 second. The pendulum angle responses for the second and
third step inputs are better than the first step with 0.48 second and 0.42 second
respectfully. The first step has a settling time of 0.555 second. The second and third step
inputs for all three modes of vibrations also have a better settling time then the first step
input. The first, second and third step for the first mode of vibration has a settling time of
0.51 second, 0.47 second and 0.43 second. The second mode of vibration has a settling
time for all three step inputs as 0.43 second, 0.27 second and 0.33 second in order from
first to third. Third mode of vibration has a settling time for all three inputs as 0.246
second, 0.319 second and 0.249 second in order. These results are shown in Figure 38.

87

Fig. 36. Case 4 fuzzy PD control for nonlinear flexible inverted pendulum.

88

Fig. 37. Case 5 fuzzy PD control for nonlinear flexible inverted pendulum.

89

Fig. 38. Case 6 fuzzy PD control for nonlinear flexible inverted pendulum

CHAPTER VII

CONCLUSION

In automatic control systems, an inverted pendulum is a classical system to be


controlled. The inverted pendulum system is a pendulum mounted onto a non-stationary
cart in the vertical position or at equilibrium position. The pendulum is unstable and free
to fall over if there are any disturbances. On the other hand, if the pendulum is too thin or
the cart is moved by a force, it can flex and cause vibrations. The inverted pendulum
becomes complex and complicated to control when vibrations are present in the
pendulum. These vibrations can cause an error in any systems if it is not included in the
design. Vibrations are one of the major concerns in industry machineries because it can
cause instabilities and break down the equipment.
An intelligent fuzzy proportional-derivative (PD) control is proposed to
control the non-linear flexible inverted pendulum. The fuzzy proportional-derivative (PD)
control is compared with the classical PD control in this system. Even though the
classical PID control is widely used in industrial control systems, it will break down in
most non-linear systems. This is seen on Figure 27 to Figure 32 for the second step input
as the oscillation for the vibrations increases. These oscillations can cause damage to
most industry systems.
The simulation results for the nonlinear flexible inverted pendulum
demonstrated the performance differences between the classical PD control and fuzzy PD
90

91
control. The classical PD controller has a better vibrations settling time for the first input
step as seen on the results. In terms of overall performance, the fuzzy PD controller
shows better system responses and steady-state performances for the second step input
and majority of the first step input for all variables and cases. This is show on Figure 33
to Figure 38. The fuzzy PD controller has a better overall performance because it has the
ability to adjust the gain values according to the system output response, while the
classical PD controls have a constant gain value for different system output responses.
The simulation results show that tuning the classical PD gain using fuzzy
logic will gain a better system response and decrease steady-state error. Therefore, the
classical PD control can be used to control non-linear system with the help of fuzzy logic.
This combination of the two controllers makes the classical PD controller very adaptable
to any systems and save a lot of time in determining the correct PD gain values.

REFERENCES

REFERENCES

[1]

J.T. Smalley, Control of an inverted flexible pendulum with experimental


verification, Thesis, California State University, Chico, CA, Spring 1992.

[2]

M. Fennich, Design, optimization and stability and analysis of a fuzzy logic


controller, Thesis, California State University, Chico, CA Spring 1994.

[3]

E.S. Sazonov, P. Klinkhachorn, and R.L. Klein, Hybrid LQG-neural controller


for inverted pendulum system, Proceedings of the 35th Southeastern Symposium
on System Theory, 2003, pp. 206-210.

[4]

A.A. Saifizul, Z. Zainon, N.A. Abu Osman, C.A. Azlan, and U.F.S. Ungku
Ibrahim, Intelligent control for self-erecting inverted pendulum via adaptive
neuro-fuzzy inference system, American Journal of Applied Sciences, 2006, pp.
1795-1802.

[5]

D. Maravall, C. Zhou, and J. Alonso, Hybrid fuzzy control of the inverted


pendulum via vertical forces, International Journal of Intelligent System, vol. 20,
2005, pp. 195-211.

[6]

J.E. Pratt and S.V. Drakunov, Derivation and Application of a Conserved Orbital
Energy for the Inverted Pendulum Bipedal Walking Model, Florida Institute for
Human and Machine Cognition.

[7]

J. Akesson, A.Blomdell and R. Braun, Design and Control of YAIP-an Inverted


Pendulum on Two Wheels Robot, Proceedings of the IEEE International
Conference on Control Applications, 2006. Retrieved June 6, 2009 from the
World Wide Web: http://www.control.lth.se/documents/2006/ake+06cca.pdf

[8]

T.K. Chye and T.C. Sang, Rotary Inverted Pendulum, Technical Report, School
of Electrical and Electronic Engineering Nanyang Technological University,
1999.

[9]

C. Lazar, S. Carari, D. Vrabie and M. Kloetzer, Neuro-predictive control based


self-tuning of PID controllers, European Symposium on Artificial Neural
Networks Brugs, 2004, pp. 391-396.

[10]

T.CT. Du and P.M. Wolfe, Implementation of fuzzy logic systems and neural
networks in industry, Computers in Industry, vol. 32, no. 3, 1997, pp. 261-272.
93

94
[11]

S. Khan, S.F. Abdulazee, L.W. Adetunji, A.Z. Alam, M.J.E. Salami, S.A.
Hameed, A.H. Abdalla and M.R. Islam, Design and Implementation of an
Optimal Fuzzy Logic Controller Using Genetic Algorithm, Journal of Computer
Science 4, 2008, pp 799-806.

[12]

C.W. Sit, Application of artificial neural network-genetic algorithm in inferential


estimation and control of a distillation column, Thesis, Universiti Teknologie
Malaysia, 2005.

[13]

L. Tian, Intelligent Self-Tuning of PID Control for the Robotic Testing System
for Human Musculoskeletal Joints Test, Annals of Biomedical Engineering, vol.
32, June 2004, pp. 899-909.

[14]

S. etin and O. Demir, Fuzzy PID controller with coupled rules for a nonlinear
quarter car model, Proceedings of World Academy of Science, Engineering and
Technology, vol. 41, May 2008, pp. 238-243. Retrieved June 6, 2009 from the
World Wide Web: http://www.waset.org/journals/waset/v41/v41-41.pdf

[15]

S. Puntunan and M. Parnichkun, Online self-tuning precompensation for a PID


heading control of a flying robot, International Journal of Advanced Robotic
Systems, vol. 4, 2006, pp. 323-330.

[16]

I. Erenoglu, I. Eksin, E. Yesil, and M. Guzelkaya, An intelligent hybrid fuzzy


pid controller, Proceeding 20th European Conference on Modelling and
Simulation, 2006. Retrieved June 6, 2009 from the World Wide Web:
http://www.scs-europe.net/services/ecms2006/ecms2006%20pdf/114-is.pdf

[17]

A.K. Pal and R.K. Mudi, Self-tuning fuzzy PI controller and its application to
HVAC systems, International Journal of Computational Cognition, vol. 6, no. 1,
2008, pp. 25-30. Retrieved June 6, 2009 from the World Wide Web:
http://www.yangsky.com/ijcc/pdf/ijcc615.pdf

[18]

K.K. Ahn and B.K. Nguyen, Position control of shape memory alloy actuators
using self tuning fuzzy PID controller, International Journal of Control,
Automation, and Systems, vol. 4, December 2006, pp. 756-762.

[19]

R.D. Blevins, Formulas for natural frequencies and mode shapes. New York:
Van Nostrand Reinhold, 1979.

[20]

The MathWorks, Inc. Fuzzy Logic ToolboxTM 2 Users Guide. Natick, MA:
The MathWorks, Inc., 2009.

APPENDIX A

SIMULINK MODEL OF THE LINEAR


AND NON-LINEAR SYSTEM

Linear Flexible Inverted Pendulum Model in Simulink

Fig. A.1. Linear flexible inverted pendulum with classical PD controllers.

96

97
Non-Linear Flexible Inverted Pendulum with Classical Pd Controllers

Fig. A.2. Fuzzy PD Controller.

APPENDIX B

MATLAB FUZZY LOGIC SYSTEM

Figure B.1. Fuzzy Logic Inference window.

99

100

Fig. B.2. Rule evaluations window.

101

Fig. B.3. Membership function window.

APPENDIX C

FLEXIBLE INVERTED PENDULUM MODAL

Section I: Introduction
Before a control system can be develop, there must be a system to be control. The
system in this paper is a flexible inverted pendulum adopted from Smalley [1], (Figure 2)
which is obtains by the equations of motion. These equations of motion are developed
using the Euler-Lagrange method. The Euler-Lagrange differential equation is as follow.

d L L R

Fexternal

dt qi qi qi

(C.1)

(i 1, 2,..., n)
Where Fe is the external forces acting on the system and R is the absorbed energy cause
by reactionary forces. The generalized coordinates are qi and qi . The lagrangian ( L ) is
the difference between kinetic energy and potential energy. The kinetic energy equation
1
is given as KE * m * v 2
2

(C.2)

and the potential energy equation is


PE m * g * h

(C.3)

where:
m = system mass
v = system velocity

103

104
g = gravity constant
h = height of the system above a datum
The pendulum can bend in either the vectors n1 and n 2 plane depending on the
direction of the applied external force. The angle of the pendulum and the position of the
mass can be in opposite direction as illustrated in Figure C.1. This flexibility to bend can
cause the pendulum to vibrate before and during the controllers stabilization processes.
The vibrations can lead to instability if flexibilities are not included in the design of the
system and the controller.

Fig. C.1. Disturbed Flexible Inverted Pendulum.

The feedback loop is the loop that provides the output information to the
controller to determine the errors. These errors are process into the controller to enhance
performance for the system output(s). The feedback information regarding; angle
position, cart position, and vibrations are required for the controller to stabilize the
flexible inverted pendulum. Therefore, to achieve a stable system, the total feedback
loops have to equal the total of motion equations in the system.

105
To obtain these motion equations, the velocity components of the pendulum for
both kinetic energy and potential energy must be derived. The velocity components could
be achieved by separating the beam or pendulum into individual segments. These
individual segments also know as differential beam segments which has a mass of
dm dz . Where is the material linear density and dz is the particle P differential

length. See Figure C.2. The pendulum kinetic energy and potential energy are achieved
by integrating the individual segments over the total length of the pendulum. The
pendulum kinetic energy and potential energy are then derived into the motion equations
of the flexible inverted pendulum system. The rest of this appendix will demonstrate
these procedures.

Fig. C.2. Pendulum Segment Discretization.


Source: Adapted from J.T. Smalley, Control of an Inverted
Flexible Pendulum with Experimental Verification, Thesis,
California State University of Chico, Spring 1992.

106

Section II: Kinetic Energy of the system


There are three parts of the system that contribute to the total kinetic energy of the
system. The first parts of kinetic energy are from the moving cart, the second is from the
flexible pendulum and the last part is from the added mass on top of the pendulum.
L

1
1
1
KE * mc *VN2 _ C * [VN2 _ P ]dz * mw *VN2 _ W
2
2
2
0

(C.4)

where:

VN _ C = cart velocity
VN _ P = discrete particle (P) velocity
VN _ W = added mass velocity
The kinetic energies of the flexible pendulum and added mass to the pendulum or
second and third part of equation C.4 respectively, a new coordinate system were added
to derive the energy equations. This new coordinate system is indicated as unit vectors
b1 , b 2 and b 3 . It rotates with the flexibility of the pendulum and translates along with

the cart. There is also a fixed coordinate system unit vectors n1 , n 2 and n 3 . See Figure
C.2 for details.
To derive the equations of motion from the Euler-Lagrange method, the pendulum
must be discretize first. A coordinate z is measure along the pendulum axis in the b1
direction. In the b 2 direction, coordinate y ( z , t ) is used to describe the deflection of the
pendulum. This coordinate is a function of coordinate z and t , where z is the length
along the pendulum and t is time. The position of the cart is in the x direction from an

107
initial position is measure in meter. The angle of the pendulum rotation is , which is
measure in radian. The discretized particle Po _ p is the location along the pendulum. The
o_ p

indicate the distance between the pivot point O and the particle P . See Figure C.2.
The dimension y ( z , t ) in equation C.5 described the function of the mode shape

and modal coordinate. This equation is form to represent the deflection of the pendulum
using assumed mode shapes. The assumed mode shapes are an approximation of the
deflection of the pendulum.
n

y ( z , t ) i z * qi t

(C.5)

i 1

where:

i z = assumed mode shape of the pendulum


qi t = modal coordinate of the pendulum
Po _ p is the postion vector to the discrete particle, therefore
Po _ p z * b1 y * b 2

(C.6)

The particle velocity with respect to the fixed frame of reference can be found as

Vp x * n 2 * b3 XPo _ p VB _ p

(C.7)

The particle velocity with respect to the rotating and translating reference frame is found
as

VB _ p y * b 2

(C.8)

By performing the cross product to reduce VB _ p and putting the all the coordinate system
in the same reference frame will give the particle P velocity in the b reference frame as:

108

n2 cos * b 2 *sin * b1

(C.9)

where the derivative of y also know as y is obtain using equation C.5 as


n

y ( z , t ) i z * qi t

(C.10)

i 1

The velocity of the particle can be express into the fixed frame of reference,
n1 , n 2 and n 3 through an axis transformation. The transformed velocity of particle P is

expressed as
VN _ p x sin y b1 x cos z y b 2

(C.11)

Now the velocity of the particle is derived, the next step is to derive the velocity
of the added mass on top of the pendulum. This mass velocity, mw can be derived in a
similar fashion as the velocity of the particle using equation C.7, equation C.8, and
equation C.9. The velocity of the mass in the z coordinate position rw is express as
VN _ W x sin y b1 x cos rw y b 2

(C.12)

Lastly, the cart velocity can be express as

VN _ C x * n 2

(C.13)

VN _ p x sin q y b1 x cos q z y b 2

(C.14)

Since all the velocities have been determined, the total kinetic energy of the
inverted pendulum can be derived. As mention earlier, the total kinetic energy of the
system has three parts. The total kinetic energy is the sum of the kinetic energy of the
pendulum, the kinetic energy of the added mass and the kinetic energy of the cart. These
three kinetic energies will be derived individually in three parts.

109
The first kinetic energy to be derived is the pendulum, it can be determined as
KE p

1
dm *VN2 _ p
2

(C.15)

Where

VN _ p *VN _ p becomes a scalar as shown below


VN _ p *VN _ p x sin y x cos q z y
2

(C.16)

and
dm dz

The kinetic energy of the pendulum can be determined by integrating over the total length
of the pendulum.
L

KE pendulum

1
[VN2 _ P ]dz
2 0

(C.17)

Substituting equation C.15 and C.16 into equation C.17, the kinetic energy of the
pendulum becomes
L

KE pendulum

2
2
1
[ x sin y x cos z y ]dz
2 0

(C.18)

To make it easier to integrate, equation C.18 can be simplified as follow


L

1
KEpendulum [x2 2yx sin 2 y2 2z2 y2 2x z cos 2x y cos 2y z]dz (C.19)
2 0

Now the integration can be broken into eight parts.


L

KE pendulum1

1
[ x 2 ]dz
2 0

(C.20)

110
L

KE pendulum 2 [ yx sin ]dz

C.21)

KE pendulum 3

1
[ 2 y 2 ]dz
2 0

(C.22)

KE pendulum 4

1
[ 2 z 2 ]dz
2 0

KE pendulum 5

1
[ y 2 ]dz
2 0

(C.23)

(C.24)

KE pendulum 6 [ x z cos ]dz

(C.25)

KE pendulum 7 [ x y cos ]dz

(C.26)

KE pendulum8 [ y z ]dz

(C.27)

Each of the eight integral are integrated in the following steps.


KE pendulum1

1
L( x )2
2

(C.28)
L

KE pendulum 2 x sin [ y ]dz

(C.29)

To integrate the deflection coordinate y ( z , t ) , the method provided by Blevins [2] on


mode shape is used.
L

i 1

[ y]dz (
0

[(1)i i2 1 i2 1]) * qi (t )

where

111

n
L

now
n

i 1

KE pendulum 2 x sin (

[(1)i i2 1 i2 1]) * qi (t )

(C.30)

KE pendulum 3 can be derived in a similar fashion using the method provided by Blevins [2].
L

KE pendulum3

1 2
[ y 2 ]dz
2
0

(C.31)

L
n

2
q
(
t
)

[
y
]
dz

(
z
)
*
q
(
t
)
dz

i [i ( z )i ( z )]dz

i
i

0
0
i 1
i 1

[ ( z )

( z )]dz 0, n m

( z )]dz L, n m

[ ( z)
n

i 1

2
2
[ y ]dz L * qi (t )

Therefore
KE pendulum3

n
1
L 2 [ qi2 (t )]
2
i 1

KE pendulum 4

1 2
1
[ z 2 ]dz L3 2
2
6
0

C.32)

(C.33)

KE pendulum 5 is derived using the method provided by Blevins [2].


L

KE pendulum 5

1
[ y 2 ]dz
2 0

(C.34)

112
L
n

q
(
t
)
[
y
]
dz

(
z
)
*
q
(
t
)
dz

i [i ( z )i ( z )]dz

i
i

0
0
i 1
i 1

[ ( z)
n

( z )]dz L, n m

[ ( z)
n

( z )]dz L, n m

Therefore
KE pendulum 5

n
1
L[ q i2 (t )]
2
i 1

C.35)

1
KE pendulum 6 x cos [ z ]dz L2 x cos
2
0

(C.36)

KE pendulum 7 and KE pendulum8 are also derived using the method proved by Blevins [2].
L

KE pendulum 7 x cos [ y ]dz

i 1

[ y ]dz (
0

[(1)i i2 1 i2 1]) * q i (t )

Therefore
n

i 1

KE pendulum 7 x cos (

[(1)i i2 1 i2 1]) * qi (t )

(C.37)

KE pendulum8 [ zy ]dz

(C.38)

n
n

[
zy
]
dz
z

(
z
)
*
q
(
t
)
dz

qi (t ) zi ( z ) dz

i
i

0
0
i 1
i 1

0
L

113
L

i 1

zi ( z ) dz (

[(1)i i2 1 i2 1])

Therefore
n

i 1

KE pendulum8 L (

[(1)i i2 1 i2 1]q i (t ))

(C.39)

Each of the kinetic energy of the pendulum can be simplified using


Hi

[(1)i i2 1 i2 1

(C.40)

Therefore all eight integral of the kinetic energy for the pendulum becomes
KE pendulum1

1
L( x )2
2

(C.41)
n

KE pendulum 2 x sin ( H i * qi (t ))

(C.42)

i 1

KE pendulum3

n
1
L 2 [ qi2 (t )]
2
i 1

(C.43)

KE pendulum 4

1 3 2
L
6

(C.44)

KE pendulum 5

n
1
L[ q i2 (t )]
2
i 1

(C.45)

1
KE pendulum 6 L2 x cos
2

(C.46)

KE pendulum 7 x cos H i * qi (t )

(C.47)

i 1

KE pendulum8 L H i q i (t )

(C.48)

i 1

114
The next step in determining the total kinetic energy of the system is to determine
the kinetic energy by the added mass along the length of the pendulum. rw is measured
from the pivot point to the added mass along the pendulum. Equation C.49 is the kinetic
energy for the added mass.
KEmass

1
mw *VN _ w *VN _ w
2

(C.49)

where the velocity of the mass mw is noted as VN _ w .


VN _ W x sin q y b1 x cos q rw y b 2

VN _ w *VN _ w x sin y x cos q rw y


2

(C.50)
2

[ x 2 2 yx sin 2 y 2 2 rw 2 y 2 2 x rw cos 2 x y cos 2 y rw ]


(equation C.51)
Therefore
1
mw [ x 2 2 yx sin 2 y 2
2
2 rw 2 y 2 2 x rw cos 2 x y cos 2 y rw ]
KEmass

(C.52)

The kinetic energy of the mass can be broken into individual components to be
solved, where y ( z , t ) and y ( z , t ) is i z . The following equations show the individual
components of the kinetic energy of the mass.

i x
x
x
x
cos i i sinh i sin i

L
L
L
L

i ( z ) cosh
KEmass1

1
mw x 2
2

(C.53)

(C.54)

115
KEmass 2 mw yx sin

(C.55)

y ( z , t ) ( i z * qi t )
i 1

KEmass 3

1
mw y 2 2
2

(C.56)

y ( z , t ) ( i z * qi t )

i 1

KEmass 4

1
mw rw 2 2
2

KEmass 5

1
mw y 2
2
n

y ( z , t ) ( i z * q i t )

(C.57)

(C.58)
2

i 1

KEmass 6 mw x rw cos

(C.59)

KEmass 7 mw x y cos

(C.60)

y ( z , t ) ( i z * q i t )
i 1

KEmass 8 mw rw y

(C.61)

y ( z , t ) ( i z * q i t )
i 1

The last part to the total kinetic energy of the system is the kinetic energy of the
cart. The kinetic energy of the cart can be derived as follow.
KEcart

1
mc VN _ c * VN _ c
2

(C.62)

Where

VN _ c x b 2

116
Therefore the kinetic energy from the cart is
KEcart

1
mc x 2
2

(C.63)

The total kinetic energy of the system is the sum of all three previously derived
kinetic energies; pendulum, added mass and cart.
KEsystem KE pendulum KEmass KEcart

C.64)

Therefore the total kinetic energy is

KEsystem

n
1
n
1

2

2
sin
*
(
)
Lx x
Hi qi t L qi2 (t )
2
i 1
2
i 1

1
1 n
1
n

L3 2 L q 2i (t ) L2 x cos x cos Hi * qi (t )
6
2 i 1
2
i 1

n
1
n

L Hi * qi (t ) mw x 2 mw x sin i ( z)* qi (t )
i 1
2
i 1

(C.65)

1
1 n
n
1

mw 2 i ( z)* qi (t ) mw 2 rw2 mw i ( z )* qi (t ) mw rw x cos


2
2 i 1
i 1
2

n
1
mw x cos i ( z)* qi (t ) mw rw i ( z)* qi (t ) mc x 2
i 1

i 1
2

Section III: Potential Energy of the system


Since the total kinetic energy of the system has been derived, the next step is to
derive the total potential energy of the system. Figure C.3 shows the potential energy of
the system. The total potential energy of the system is made up of three components:
1. Gravitational forces effects on the pendulum.
2. Elasticity of the flexing pendulum.
3. Gravitational forces effects on the added mass.

117

Fig. C.3. Potential energy diagram of the system.

The first potential energy of the system is describe as follow


PE1 dm * g * u

Where
dm * dz as describe earlier, g is the gravity and u is the location of the particle

distance above the datum as u z cos y sin .


L

PE1 g z cos y sin dz


0

(C.66)

g cos z dz g sin y dy

Using the method from Blevins, 1979 and simplification H i ,


L

i 1

[ y ]dz (
0

Hi

[(1)i i2 1 i2 1]) * q i (t )

[(1)i i2 1 i2 1

118
Therefore the first potential energy of the system becomes
1
n

2
PE1 gL cos g sin H i * qi (t )
2
i 1

(C.67)

The potential energy due to the elasticity of the flexing pendulum can be derived
in the following manner using the classical pendulum theory.
2

L
2y
1
PE2 EI 2 dz
2 0z

(C.68)

y ( z , t ) i z * qi t
i 1

z
y

z2
2

i ( z )
z

* qi (t )

2 i ( z )

* qi (t )
2
z


i 1
n

i 1

L
n 2 i ( z )
1
PE2 EI
2
z2
0 i 1

(C.69)
2

* qi (t ) d z

Using Blevins, 1979


n ( z ) m ( z )
4
i * L, n m
z
z

n ( z ) m ( z )
0, n m
z
z

Therefore
PE2

n
1
EIL( i4 * qi2 (t ))
2
i 1

(C.70)

The last part of the potential energy of the system is from the gravitational force
effects on the added mass. This potential energy can be derived as follow.

119
PE3 m

(C.71)

gh

Where

h rw c o s y s in
y (z,t)

z * q t
i 1

Therefore
n

PE3 mw grw cos mw g sin i z * qi t


i 1

(C.72)

The total potential energy is the sum of all the potential energy from the system.
PEsystem PE1 PE2 PE3

PEsystem

1
n

gL2 cos g sin H i * qi (t )


2
i 1

n
1
n

EIL( i4 * qi2 (t )) mw grw cos mw g sin i z * qi t


2
i 1
i 1

(C.73)

Section IV: Euler-Lagrange differential equation of motions


Now the motion of equations describing the flexible inverted pendulum can be
derived since the kinetic energy and the potential energy have been determined. The
motion equation is derived using Euler-Lagrange differential equation as described
earlier.
d L L R

Fexternal

dt q i q i q i
( i 1, 2, ..., n )

The Lagrange is the difference between the kinetic energy and potential energy.
L K E s y s te m P E s y s te m

120
The generalized coordinated system used for the Euler-Lagrange equation is in Table C.1.

TABLE C.1
COORDINATE TRANSFORMATION TABLE
q1 x

q 1 x

q 1 x

q2

q 2

q 2

q3 q1 (t )

q 3 q 1 (t )

q 3 q 1 (t )

q4 q2 (t )

q 4 q 2 (t )

q 4 q 2 (t )

q5 q3 (t )

q 5 q 3 (t )

q 5 q 3 (t )

The modal coordinate terms from the flexing pendulum coordinate is related to the new
generalized coordinate through the bracket terms. And qi is not equal to qi t .
The Lagrange can be form by substituting these generalized coordinate to the kinetic and
potential energies.

121
1
n
1
n

L Lq12 q1 q 2 sin q 2 Hi * qi 2 (t ) Lq 22 qi22 (t )


2
i 1
2
i 1

1
1 n
1
n

L3q22 L qi22 (t ) L2q1 q2 cos q2 q1 cos q2 Hi * qi 2 (t )


6
2 i 1
2
i 1

n
1
n

L q 2 Hi * qi2 (t ) mwq 22 mwq1 q 2 sin q2 i ( z)* qi 2 (t )


i 1
2
i 1

1
1 n
n
1

mwq 22 i ( z)* qi 2 (t ) mwq 22rw2 mw i ( z)* qi2 (t ) mwq1 q 2rw cos q2 (C.74)
2
2 i 1
i 1
2

n
1
mwq1 cos q2 i ( z)* qi2 (t ) mwq 2rw i ( z)* qi2 (t ) mc q12
i 1

i 1
2
1
n

gL2 cos q2 g sin q2 Hi * qi 2 (t )


2
i 1

n
1
n

EIL( i4 * qi22 (t )) mw grw cos q2 mw g sin q2 i z * qi 2 t


2
i 1
i 1

The model will be design with three modes of vibration; therefore modal
coordinate will be expanded for three coordinates. The expansion is done with EulerLagrange equation as describe below.

L
( L m w m c ) q1 q 2 sin q 2 [ H 1 q3 H 2 q 4 H 3 q5 ]
q1
1
L2 q 2 cos q 2 cos q 2 [ H 1q3 H 2 q 4 H 3 q5 ]
2
m w q 2 sin q 2 [1 ( z ) q3 2 ( z ) q 4 3 ( z ) q5 ]

m w q 2 rw cos q 2 m w cos q 2 [1 ( z ) q3 2 ( z ) q 4 3 ( z ) q5 ]

(C.75)

122

L
1
( L3 mw rw2 ) q 2 q 1 sin q

3
q2

[ H q

1 3

H 2 q4 H 3 q5 ]

1 2
L q 1 cos q2 L [ H 1q3 H 2 q4 H 3 q5 ]
2
mw q 1 sin q2 [1 ( z ) q3 2 ( z ) q4 3 ( z ) q5 ] mw [12 ( z ) q 32 22 ( z ) q 24
Lq 2 [ q32 q42 q52 ]

(C.76)

32 ( z ) q 52 21 ( z )2 ( z ) q3 q4 21 ( z )3 ( z ) q3 q5 22 ( z )3 ( z ) q4 q5 ]
mw q 1 rw cos q2 mw rw [1 ( z ) q 3 2 ( z ) q 4 3 ( z ) q 5 ]

L
L q 3 L H 1 q 2 q 1 H 1 co s q 2

q3
m w [ ( z ) q
2
1

mwq

1 ( z ) 2 ( z ) q

co s q 2 1 m w rw 1 q

(C.77)

1 ( z ) 3 ( z ) q 5 ]

L
L q 4 L H 2 q 2 q 1 H 2 co s q 2
q 4
m w [ 22 ( z ) q 4 1 ( z ) 2 ( z ) q 3 2 ( z ) 3 ( z ) q 5 ]

(C.78)

m w q 1 co s q 2 2 m w rw 2 q 2

L
L q 5 L H 3 q 2 q 1 H 3 c o s q 2

q5
m w [ 32 ( z ) q 5 1 ( z ) 3 ( z ) q 3 2 ( z ) 3 ( z ) q 4 ]

(C.79)

m w q 1 c o s q 2 3 m w rw 3 q 2

The first term of Euler-Lagrange equation can be differentiated with respect to their
respective coordinates in the above equations as indicated below.

123
d L
( L mw mc )q 1 q 2 sin q2 [ H1q3 H 2 q4 H 3q5 ]

dt q1

q 2 cos q2 [ H1q3 H 2 q4 H 3q5 ] q 2 sin q2 [ H1q3 H 2 q4 H 3q5 ]


1
1
L2 q 2 cos q2 L2 q 22 sin q2 q 2 sin q2 [ H1q3 H 2 q4 H 3q5 ]
2
2

cos q2 [ H1q 3 H 2 q 4 H 3q 5 ] mw q 2 rw cos q2

(C.80)

mw q 2 sin q [1 ( z )q3 2 ( z )q4 3 ( z )q5 ] mw q 2 rw sin q2


mw q 22 cos q2 [1 ( z )q3 2 ( z )q4 3 ( z )q5 ]
mw q 2 sin q2 [1 ( z )q 3 2 ( z )q 4 3 ( z )q 5 ]
mw cos q2 [1 ( z )q 3 2 ( z )q 4 3 ( z )q 5 ]

d L 1 3
( L mwrw2 )q2 q1 sin q 2 [H1q3 H2q4 H3q5 ]
dt q2 3

q1 q2 cos q2 [H1q3 H2q4 H3q5 ] q1 sin q2 [H1q3 H2q4 H3q5 ]


1
Lq2[q32 q42 q52 ] Lq2[2q3 q3 2q4 q4 2q5 q5 ] L2q1 cos q2
2
1
L2q1 q2 sin q2 L [H1q3 H2q4 H3q5 ]
2
mwq1 sin q2 [1(z)q3 2 (z)q4 3 (z)q5 ] mwq1q2 sin q2 [1(z)q3 2 (z)q4 3 (z)q5 ]
mwq1 sin q2 [1(z)q3 2 (z)q4 3 (z)q5 ]

(C.81)

mwq2[12 (z)q 32 22 (z)q 24 32 (z)q 52 21(z)2 (z)q3q4


21(z)3 (z)q3q5 22 (z)3 (z)q4q5 ]
mwq2[212 (z)q3 q3 222 (z)q4 q4 232 (z)q5 q5 21(z)2 (z)q3q4 21(z)2 (z)q3q4
21(z)3 (z)q3q5 21(z)3 (z)q3q5 22 (z)3 (z)q4q5 22 (z)3 (z)q4q5 ]
mwq1rw cos q2 mwq1 q2rw sin q2 mwrw [1(z)q3 2 (z)q4 3 (z)q5 ]

d L
Lq 3 LH1q 2 q 1H1 cos q2 q 1 q 2 H1 sin q2
dt q3

mw [12 ( z )q 3 1 ( z )2 ( z )q 4 1 ( z )3 ( z )q 5 ] mw1 ( z )q 1 cos q2


mw1 ( z )q 1 q 2 sin q2 mw rw1 q 2

(C.82)

124
d L
Lq 4 LH 2 q 2 q 1 H 2 cos q2 q 1 q 2 H 2 sin q2
dt q4

mw [22 ( z )q 4 1 ( z )2 ( z )q 3 2 ( z )3 ( z )q 5 ] mw2 ( z )q 1 cos q2

(C.83)

mw2 ( z )q 1 q 2 sin q2 mw rw2 q 2

d L
Lq 5 LH 3q 2 q 1H 3 cos q2 q 1 q 2 H 3 sin q2

dt q5

mw [32 ( z )q 5 1 ( z )3 ( z )q 3 2 ( z )3 ( z )q 4 ] mw3 ( z )q 1 cos q2

(C.84)

mw3 ( z )q 1 q 2 sin q2 mw rw3 q 2


Equations C.85-C.89 satisfied the second term of Euler-Lagrange equation with respect
to their coordinate.

L
[0]
q1

(C.85)

L
1
q 1 q 2 cos q2 [ H1q3 H 2 q4 H 3q5 ] L2 q 1 q 2 sin q2
q2
2
q 1 sin q2 [ H1q3 H 2 q4 H 3q5 ]
mw q 1 q 2 cos q2 [1 ( z )q3 2 ( z )q4 3 ( z )q5 ] mw rw q 1 q 2 sin q2
1
m q sin q2 [1 ( z )q 2 ( z )q 3 ( z )q ] gL2 sin q2
2

g cos q2 [ H1q3 H 2 q4 H 3q5 ] mw rw g sin q2

w 1

(C.86)

mw g cos q2 [1 ( z )q3 2 ( z )q4 3 ( z )q5 ]

L
q 1 q 2 H1 sin q2 Lq 12 q3 mw1 ( z )q 1 q 2 sin q2
q3

mw q 22 [12 ( z )q3 1 ( z )2 ( z )q4 1 ( z )3 ( z )q5 ] gH1 sin q2


EIL14 q3 mw g1 ( z ) sin q2

(C.87)

125

L
q 1 q 2 H 2 sin q2 Lq 12 q4 mw1 ( z )q 1 q 2 sin q2
q4

mw q 22 [22 ( z )q4 1 ( z )2 ( z )q3 2 ( z )3 ( z )q5 ] gH 2 sin q2

(C.88)

EIL 24 q4 mw g2 ( z ) sin q2

L
q 1 q 2 H 3 sin q2 Lq 12 q5 mw3 ( z )q 1 q 2 sin q2
q5

mw q 22 [32 ( z )q5 1 ( z )2 ( z )q3 2 ( z )3 ( z )q4 ] gH 3 sin q2

(C.89)

EIL34 q5 mw g3 ( z ) sin q2
The third term in the Euler-Lagrange equation is the reactionary of the motion for
the system. The reactionary forces consider in this system are the friction in the
pendulum pivot point and friction between the cart and surface. The reactionary initial
equations its partials are described below.
R cart

1
c
2

R
q 1

R
c
q 2

p e n d u lu m

c a r t

1
c ca rt q
2

2
1

(C.90)

p e n d u lu m

2
2

(C.91)

(C.92)

The last term of the Euler-Lagrange equation is the external forces. There are two
external forces; the disturbance force and the control force. The motion of equations is
achieved by combining the above derived equations with their respective terms. This
combination will give non-linear motion equations. The final non-linear equations of
motion for the inverted flexible pendulum system are indicated below.

126
1
( L mw mc )q1 [ sin q2 [ H1q3 H2q4 H3q5 ] L2 cos q2 mwrw cos q2 ]q2
2

[2( sin q2 [ H1q3 H2q4 H3q5 ]) 2(mw sin q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ])]q2
1
cos q2 [ H1q3 H2q4 H3q5 ] L2 sin q2 mwrw sin q2
2
mw cos q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ] cos q2 [ H1q3 H2q4 H3q5 ]

(C.93)

mw cos q2 [1 ( z)q3 2 ( z)q4 3 ( z)q5 ] ccart q1 F

1
[ sin q2 [H1q3 H2q4 H3q5 ] L2 cos q2 mw sin q2 [H1q3 H2q4 H3q5 ] mwrw cos q2 ]q1
2
1
[( L3 mwrw2 ) L[q32 q42 q52 ] mw[12 (z)q32 22 (z)q42 32 (z)q52 ] 21 (z)2 (z)q3 q4 21 (z)3 (z)q3 q5
3
23 (z)2 (z)q5q4 ]q2 [LH1 mwrw1(z)]q3 [LH2 mwrw2 (z)]q4 [LH3 mwrw3 (z)]q5
2( sin q2 [H1q3 H2q4 H3q5 ])q1 2[L[q3q3 q4q4 q5q5 ]

(C.94)

2mw[12 (z)q3q3 22 (z)q4q4 32 (z)q5q5 1 2 (z)q4q3 1 2 (z)q3q4


1 3 (z)q5q3 1 3 (z)q3q5 32 (z)q5q4 32 (z)q4q5 ] cpendulum ]q2
[g cos q2 [H1 mw1(z)]]q3 [g cos q2 [H2 mw2 (z)]]q4 [g cos q2 [H3 mw3 (z)]]q5
1
[sin q2 [ gL2 mwrwg]] Td * L
2

[ H1 cos q2 mw1 ( z)cos q2 ]q1 [ LH1 mwrw1 ( z)]q2 [ L mw12 ( z)]q3 [mw1 ( z)2 ( z)]q4
[mw1 ( z)3 ( z)]q5 [ Lq3 ](q1 )2 [mw[12 ( z)q3 1 ( z)2 ( z)q4 1 ( z)3 ( z)q5 ]](q2 )2

(C.95)

[EIL14 ]q3 [mw1 ( z)sin q2 H1 sin q2 ]q1q2 [mw g1 ( z)sin q2 gH1 sin q2 ] Td * L

[H2 cos q2 mw2 (z)cos q2 ]q1 [LH2 mwrw2 (z)]q2 [mw1(z)2 (z)]q3 [L mw22 (z)]q4
[mw2 (z)3(z)]q5 [Lq4 ](q1 )2 [mw[22 (z)q4 1 (z)2 (z)q3 2 (z)3 (z)q5 ]](q2 )2
[EIL24 ]q4 [H2 sin q2 ]q1q2 [mwg2 (z)sin q2 gH2 sin q2 ] Td *L

(C.96)

127
[ H 3 cos q2 mw3 ( z ) cos q2 ]q 1 [ LH 3 mw rw3 ( z )]q 2 [ mw1 ( z )2 ( z )]q 3
[ mw1 ( z )3 ( z )]q 4 [ L mw3 2 ( z )]q 5 [ Lq5 ]( q 1 ) 2
[ mw [3 2 ( z ) q5 1 ( z )3 ( z ) q3 2 ( z )3 ( z )q4 ]]( q 2 ) 2

(C.97)

[ EIL 34 ]q5 [ mw g3 ( z ) sin q2 gH 3 sin q2 ] Td * L


To use the linear control theory proportional-derivative (PD) control, the equations are
linearized by the criteria in Table C.2.

Table C.2
CRITERIA FOR LINEARIZATION
sin(q2 ) q2

cos(q2 ) 1

q i *q i 0

q i * q i 0

q i * q i 0

q i * q i 0

q i *q j 0

q i * q j 0

q i * q j 0

q i * q j 0

qi * q j 0

q i * q i 0

Source: Adapted from J.T. Smalley, Control of an Inverted Flexible Pendulum with
Experimental Verification, Thesis, California State University of Chico, Spring 1992.

The final linearized equations for the flexible inverted pendulum are described below.

1
( L mw mc )q 1 ( L2 mw rw )q 2 ( H1 mw1 ( z ))q 3
2

( H 2 mw2 ( z ))q 4 ( H 3 mw3 ( z ))q 5 F

(C.98)

128

1
1
( L2 mw rw )q 1 ( L3 mw rw 2 )q 2 ( L H1 mw rw1 ( z ))q 3
2
3
( L H 2 mw rw2 ( z ))q 4 ( L H 3 mw rw3 ( z ))q 5
1
( gL mw rw g )q1 ( gH1 mw g1 ( z ))q3 ( gH 2 mw g2 ( z ))q4
2
( gH 3 mw g3 ( z ))q5 c pendulum q2 Td * L

(C.99)

( H1 mw1 ( z )) q 1 ( L H1 mw rw1 ( z )) q 2 ( L mw12 ( z )) q 3


( mw1 ( z )2 ( z )) q 4 ( mw1 ( z )3 ( z ))q 5 ( gH1 mw g1 ( z ))q2

(C.100)

EIL 12 q3 Td * L
( H 2 mw2 ( z )) q 1 ( L H 2 mw rw2 ( z )) q 2 (mw1 ( z )2 ( z )) q 3
( L mw2 2 ( z ))q 4 ( mw2 ( z )3 ( z )) q 5 ( gH 2 mw g2 ( z ))q2

(C.101)

EIL 2 4 q4 Td * L

( H 3 mw3 ( z ))q 1 ( L H 3 mw rw3 ( z ))q 2 (mw1 ( z )3 ( z ))q 3


( mw2 ( z )3 ( z ))q 4 ( L mw3 ( z ))q 5 ( gH 3 mw g3 ( z ))q2

C.102)

EIL 3 q5 Td * L
4

The flexible inverted pendulum non-linear and linear equations of motion coordinates are
change back to xn and for the purpose of solving for their derivatives. These equations
are used to build the system in simulink.
The non-linear motion equations derivative is described below.
d 2 x1
1 2
d 2
([

sin

[
H
x
H
x
H
x
]

L
cos

m
r
cos

w w
1 3
2 4
3 5
dt 2
2
dt 2
dx
dx
dx
dx d
dx
dx
[2( sin [H1 3 H2 4 H3 5 ]) 2(mw sin [1 ( z) 3 2 ( z) 4 3 ( z) 5 ])]
dt
dt
dt
dt
dt
dt
dt
1 2
(C.103)
cos [ H1x3 H2 x4 H3 x5 ] L sin mwrw sin
2
d 2x
d2x
d2x
mw cos [1 ( z) x3 2 ( z) x4 3 ( z) x5 ] cos [H1 23 H2 24 H3 25 ]
dt
dt
dt
2
2
2
d x
d x
d x
dx
mw cos [1 ( z) 23 2 ( z) 24 3 ( z) 25 ] ccart 1 F) /( L mw mc )
dt
dt
dt
dt

129

d2
1 2
d2x1

([

sin

[
H
x
H
x
H
x
]

L
cos

m
sin

[
H
x
H
x
H
x
]
m
r
cos

1 3
2 4
3 5
1 3
2 4
3 5
w
ww
dt2
2
dt2
d2 x
d2x
d 2x
[LH1 mwrw1(z)] 23 [LH2 mwrw2(z)] 24 [LH3 mwrw3(z)] 25
dt
dt
dt
dx3
dx4
dx5
dx3
dx4
dx5 dx1
2( sin [H1 H2 H3 ]) 2[L[x3 x4 x5 ]
dt
dt
dt
dt
dt
dt dt
dx
dx
dx
dx
dx
2mw[12 (z)x3 3 22(z)x4 4 32(z)x5 5 1 2 (z)x4 3 12 (z)x3 4
dt
dt
dt
dt
dt
dx
dx
dx
dx
d
13 (z)x5 3 13 (z)x3 5 32 (z)x5 4 32 (z)x4 5 ] cpendulum]
dt
dt
dt
dt
dt
[g cos [H1 mw1(z)]]x3 [g cos [H2 mw2(z)]]x4 [g cos [H3 mw3(z)]]x5

(C.104)

1
1
[sin [ gL2 mwrwg] (Td * L)]/[( L3 mwrw2 ) L[x32 x42 x52 ]
2
3
2
2
2
2
2
2
mw[1 (z)x3 2 (z)x4 3 (z)x5 ] 21 (z)2 (z)x3 x4 21 (z)3 (z)x3 x5
23 (z)2 (z)x5 x4 ]

d2x3
d2x1
d2
d2x4
H
m
z
LH
m
r
z
m
z
z

cos

(
)cos
]

(
)]

[
(
)
(
)]

w
w
w
w
1
1
1
1
1
2
dt2
dt2
dt2
dt2
2
dx
dx
d
(C.105)
[mw1(z)3(z)] 25 [Lx3]( 1 )2 [mw[12(z)x3 1 (z)2 (z)x4 1 (z)3 (z)x5 ]]( 2 )2
dt
dt
dt
dx d
[EIL14]x3 [mw1(z)sin H1 sin ] 1 [mwg1(z)sin gH1 sin ](Td *L)]/[L mw12(z)]
dt dt

d2x3
d2 x4
d2 x1
d2

cos

(
)cos
]

(
)]

[
(
)
(
)]
H
m
z
LH
m
r
z
m
z
z

w 2
ww 2
w 1
2
2
2
dt2
dt2
dt2
dt2
d2x5
dx
d
[mw2 (z)3(z)] 2 [Lx4 ]( 1 )2 [mw[22 (z)x4 1 (z)2 (z)x3 2 (z)3 (z)x5 ]]( 2 )2
(C.106)
dt
dt
dt
dx d
[EIL24 ]x4 [H2 sin ] 1 [mwg2 (z)sin gH2 sin ] (Td * L)]/[L mw22 (z)]
dt dt

130
d 2 x5
d 2 x3
d 2 x1
d 2
([H3 cos mw3 (z)cos ] 2 [LH3 mwrw3 (z)] 2 [mw1(z)2 (z)] 2
dt 2
dt
dt
dt
2
dx
dx
d
(C.107)
[mw1(z)3 (z)] 24 [Lx5 ]( 1 )2 [mw[32 (z)x5 1 (z)3 (z)x3 2 (z)3 (z)x4 ]]( 2 )2
dt
dt
dt
[EIL34 ]x5 [mwg3 (z)sin gH3 sin ] (Td * L)]/[L mw32 (z)]

The linear motion equations derivative is described below.


d 2 x3
d 2 x1
1 2
d 2
[(

)
(

(
))

L
m
r
H
m
z
w w
w 1
1
2
dt 2
dt 2
dt 2
d 2 x5
d 2 x4
( H 2 mw2 ( z )) 2 ( H 3 mw3 ( z )) 2 F]/( L mw mc )
dt
dt

(C.108)

d 2 x3
d 2 x1
1 2
d 2
(

)
(

(
))

L
m
r
L
H
m
r
z
w w
w w 1
1
2
dt 2
dt 2
dt 2
d 2 x5
d 2 x4
( L H 2 mw rw2 ( z )) 2 ( L H 3 mw rw3 ( z )) 2
dt
dt
1
( gL mw rw g ) x1 ( gH1 mw g1 ( z )) x3 ( gH 2 mw g2 ( z )) x4
2
1
dx
( gH 3 mw g3 ( z )) x5 c pendulum 2 Td * L] /( L3 mw rw 2 )
3
dt

(C.109)

d 2 x3
d 2 x1
d 2
[( H1 mw1 ( z )) 2 ( L H1 mw rw1 ( z )) 2
dt 2
dt
dt
2
2
d x
d x
(mw1 ( z )2 ( z )) 24 (mw1 ( z )3 ( z )) 25 ( gH1 mw g1 ( z ))
dt
dt
2
2
EIL1 x3 Td * L] /( L mw1 ( z ))
d 2 x3
d 2 x4
d 2 x1
d 2

[(

(
))

(
))

(
(
)
(
))
H
m
z
L
H
m
r
z
m
z
z
w 2
w w 2
w 1
2
2
2
dt 2
dt 2
dt 2
dt 2
d 2x
(mw2 ( z )3 ( z )) 25 ( gH 2 mw g2 ( z ))
dt
4
EIL 2 x4 Td * L]/( L mw2 2 ( z ))

(C.110)

(C.111)

131
d 2 x5
d 2 x3
d 2 x1
d 2
[( H 3 mw3 ( z )) 2 ( L H 3 mw rw3 ( z )) 2 (mw1 ( z )3 ( z )) 2
dt 2
dt
dt
dt
2
d x
(mw2 ( z )3 ( z )) 24 ( gH 3 mw g3 ( z ))
dt
4
EIL3 x5 Td * L]/( L mw3 ( z ))

(C.112)

REFERENCES

[1]
J.T. Smalley, Control of an Inverted Flexible Pendulum with Experimental
Verification, Thesis, California State University of Chico, Spring 1992.
[2] R.D. Blevins, Formulas for Natural Frequencies and Mode Shapes. Van Nostrand
Reinhold, 1979.

APPENDIX D

MATLAB PARAMETER CODES

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% These are the parameters for the linear flexible inverted pendulum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%% note: run this matlab program before the simulink program %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mc=0.420; % mass of the cart (kg)


mw=0.21; % mass of the end weight (kg)
L=1; % length of the pendulum (m)
rw=0.5; % distance to the location of end weight (m)
rho=0.188; % linear density of the pendulum
g=9.81; % gravitational constant
ccart=0.5; % friction constant between the cart and the rail
cpend=0.05; %friction constant at the pivot point for the pendulum
H1=-0.3703 %Reduction term used in the final equation
H2=0.1998 %Reduction term used in the final equation
H3=-0.1385 %Reduction term used in the final equation
phi1=1.921e-7 %mode shape of the flexing beam
133

134
phi2=2.8734e-6 %mode shape of the flexing beam
phi3=3.6788e-5 %mode shape of the flexing beam
beta1=3.9266 %frequency of the vibrating pendulum
beta2=7.0686 %frequency of the vibrating pendulum
beta3=10.2102 %frequency of the vibrating pendulum
E=69e9; %Young's modulus for beam material
I=4.069e-12; %moment of inertia for the beam

A1=(rho*L)+mw+mc;
A2=(0.5*rho*L^2)+(mw*rw);
A3=(rho*H1)+(mw*phi1);
A4=(rho*H2)+(mw*phi2);
A5=(rho*H3)+(mw*phi3);

B1=((1/3)*rho*L^3)+(mw*rw^2);
B2=(rho*L*H1)+(mw*rw*phi1);
B3=(rho*L*H2)+(mw*rw*phi2);
B4=(rho*L*H3)+(mw*rw*phi3);
B5=(0.5*rho*g*L^2)+(mw*rw*g)

E3=(rho*L)+(mw*phi1^2);
E4=(rho*L)+(mw*phi2^2);
E5=(rho*L)+(mw*phi3^2);

135
C1=mw*phi1*phi2;
C2=mw*phi1*phi3;
D1=mw*phi2*phi3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% These are the parameters for the non-linear flexible inverted pendulum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%%%%% note: run this matlab program before the simulink program %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

mc=0.420; % mass of the cart (kg)


mw=0.21; % mass of the end weight (kg)
L=1; % length of the pendulum (m)
rw=0.5; % distance to the location of end weight (m)
Rho=0.188; % linear density of the pendulum
g=9.81; % gravitational constant
ccart=0.5; % friction constant between the cart and the rail
Cpend=0.05; %friction constant at the pivot point for the pendulum
H1=-0.3703 %Reduction term used in the final equation
H2=0.1998 %Reduction term used in the final equation
H3=-0.1385 %Reduction term used in the final equation
phi1=1.921e-7 %mode shape of the flexing beam

136
phi2=2.8734e-6 %mode shape of the flexing beam
phi3=3.6788e-5 %mode shape of the flexing beam
beta1=3.9266 %frequency of the vibrating pendulum
beta2=7.0686 %frequency of the vibrating pendulum
beta3=10.2102 %frequency of the vibrating pendulum
E=69e9; %Young's modulus for beam material
I=4.069e-12; %moment of inertia for the beam

APPENDIX E

READ ME INSTRUCTIONS

Read this file first before running the programs. There are three main programs to be run.
1.

Linear flexible inverted pendulum with PD control

2. Non-linear flexible inverted pendulum with same PD control as linear flexible


inverted pendulum
3. Non-linear flexible inverted pendulum with Fuzzy PD control
All of these programs are simulate in Matlab and Simulink for six different cases.
Case 1: Using the applied force to disturbed the car in a small distance of 0.04 m = 1.575
inches to the right. This is done in the Simulink model using the three step input blocks.
Double click on the blocks to open the block parameters. Inside the block Step set: Step
time = 0, Initial value = 0, Final Value = 0.04. Inside the block Step1 set: Step time =
2, Initial value = 0, Final Value = -0.04. Inside the block Step2 set: Step time = 4,
Initial value = 0, Final Value = 0.
Case 2: Using the applied force to disturbed the car in a distance of 0.08 m = 3.150 inches
to the right. This is done in the Simulink model using the three step input blocks. Double
click on the blocks to open the block parameters. Inside the block Step set: Step time =
0, Initial value = 0, Final Value = 0.08. Inside the block Step1 set: Step time = 2, Initial
value = 0, Final Value = -0.08. Inside the block Step2 set: Step time = 4, Initial value =
0, Final Value = 0.
Case 3: Using the applied force to disturbed the car in a distance of 0.15 m = 5.91 inches
to the right. This is done in the Simulink model using the three step input blocks. Double
click on the blocks to open the block parameters. Inside the block Step set: Step time =
0, Initial value = 0, Final Value = 0.15. Inside the block Step1 set: Step time = 2, Initial
value = 0, Final Value = -0.15. Inside the block Step2 set: Step time = 4, Initial value =
0, Final Value = 0.
Case 4: Using the applied force to disturbed the car in a distance of -0.04 m = 1.575
inches to the left and pushed the car back to the right pass its origin to 0.04 m with a total
distance of 0.08 m. This is done in the Simulink model using the three step input blocks.
Double click on the blocks to open the block parameters. Inside the block Step set: Step
time = 0, Initial value = 0, Final Value = -0.04. Inside the block Step1 set: Step time =
2, Initial value = 0, Final Value = 0.08. Inside the block Step2 set: Step time = 4, Initial
value = 0, Final Value = 0.
138

139
Case 5: Using the applied force to disturbed the car in a distance of -0.15 m = 5.91 inches
to the left and pushed the car back to the right pass its origin to 0.15 m with a total
distance of 0.3 m. This is done in the Simulink model using the three step input blocks.
Double click on the blocks to open the block parameters. Inside the block Step set: Step
time = 0, Initial value = 0, Final Value = -0.15. Inside the block Step1 set: Step time =
2, Initial value = 0, Final Value = 0.3. Inside the block Step2 set: Step time = 4, Initial
value = 0, Final Value = 0.
Case 6: Using the applied force to disturbed the car in a distance of 0.15 m = 5.91 inches
to the right and pushed the car back to the left pass its origin to 0.15 m and then pushed
the car back to the right pass its origin to 0.15 m. This is done in the Simulink model
using the three step input blocks. Double click on the blocks to open the block
parameters. Inside the block Step set: Step time = 0, Initial value = 0, Final Value =
0.15. Inside the block Step1 set: Step time = 2, Initial value = 0, Final Value = -0.3.
Inside the block Step2 set: Step time = 4, Initial value = 0, Final Value = 0.3.
LINEAR FLEXIBLE INVERTED PENDULUM W/PD CONTROL
The following steps are required to simulate the linear flexible inverted pendulum.
Steps: These steps assumed that the individual knows how to open and run files in matlab
and simulink.
1. It is important to open and run the Matlab parameter file
(flex_pend_linear_par1.m) first.
2. Once the parameter file has been successfully run, open the Simulink file
containing the system (flex_pend_linear.mdl).
3. Go to the debug tap in Simulink and click the run tap to simulate this program or
press F5 key. Double click on the scope to view the results. Run this file for six
different cases; follow the case steps mention earlier.
NON-LINEAR FLEXIBLE INVERTED PEND. W/SAME PD CONTROL AS LINEAR
FLEXIBLE INVERTED PEND.
The following steps are required to simulate the non-linear flexible inverted pendulum.
Steps: These steps assumed that the individual knows how to open and run files in matlab
and simulink.
1. It is important to open and run the Matlab parameter file (parameters_nl_flex.m)
first.
2. Once the parameter file has been successfully run, open the Simulink file
containing the system (flex_pend1a_pd.mdl).

140
3. Go to the debug tap in Simulink and click the run tap to simulate this program or
press F5 key. Double click on the scope to view the results. Run this file for six
different cases; follow the case steps mention earlier.
NON-LINEAR FLEXIBLE INVERTED PENDULUM W/FUZZY PD CONTROL
The following steps are required to simulate the non-linear flexible inverted pendulum.
Steps: These steps assumed that the individual knows how to open and run files in matlab
and simulink.
1. It is important to open and run the Matlab parameter file (parameters_nl_flex.m)
first.
2. Make sure the fuzzy inference systems file (fuzzy_fisnish.fis) is in the same
directory as Matlab (parameters_nl_flex.m) and Simulink files (flex_pend1a.mdl).
3. Go to the matlab command window and open the fuzzy inference systems (fis)
editor window by typing fuzzy fuzzy_fisnish. This command fuzzy open the fis
editor window and fuzzy_fisnish open the fuzzy system that was build for this
system.
4. On the fis editor window, click on the file tap and go to export. Export this
control to workspace.
5. Once the parameter file and fis editor file has been successfully run and load,
open and run the Simulink file containing the system (flex_pend1a.mdl).
6. Go to the debug tap in Simulink and click the run tap to simulate this program or
press F5 key. Run this file for six different cases; follow the case steps mention
earlier. Each simulation made take five or more minutes depending if its run
from a laptop or desktop. Double click on the scope to view the results.

You might also like