TELKOM
NIKA Indonesia
n
Journal of
Electrical En
gineering
Vol.12, No.7, July 201
4, pp
. 5225 ~ 52
3
4
DOI: 10.115
9
1
/telkomni
ka.
v
12i7.535
8
5225
Re
cei
v
ed
No
vem
ber 2
1
, 2013; Re
vi
sed
Febr
uary 18,
2014; Accept
ed March 6, 2
014
Simplifications The Rule Base f
o
r Stabilization of
Inverted Pendulum System
Thar
w
a
t
O. S. Hanafy
*
1
, M
.
K. Met
w
all
y
2
1
Computers a
n
d
S
y
stems En
g
i
ne
erin
g De
par
tment, Al
_Azha
r
Universit
y
, F
a
cult
y
of Engin
e
erin
g,
Cairo, Eg
ypt
2
Departem
ent of Electrical En
gin
eeri
ng, Men
oufi
y
a U
n
ivers
i
t
y
, F
a
cult
y
of Engi
neer
in
g,
Meno
ufi
y
a, Eg
ypt
*Corres
p
o
ndi
n
g
author, e-ma
i
l
: thar
w
a
t.han
a
f
y
@
ya
ho
o.com
1
, mohkamel2
0
07@
ya
ho
o.co
m
2
A
b
st
r
a
ct
Contro
l of
an
i
n
verted
pe
nd
ul
um o
n
a
carri
a
ge w
h
ic
h
mov
e
s in
a
hor
i
z
o
n
tal
path, is
o
ne
of th
e
classic pr
obl
e
m
s i
n
the ar
ea
of control. T
h
e basic
ai
m of
our w
o
rk w
a
s to desi
gn
appr
o
p
riate c
ontrol
l
e
r
to
control th
e a
n
g
l
e of th
e p
e
n
d
u
lu
m
an
d
the positi
on of
the cart
in
order t
o
stabil
i
z
e
th
e i
n
verted
pe
nd
ul
u
m
system. The
main
obj
ective of
this pa
per to
keep th
e stab
ili
z
a
ti
on
of the in
verted p
e
n
dul
u
m
b
a
se
d on th
e
simplific
atio
n o
f
rule b
a
se. Th
e pro
pos
ed fu
zz
y
co
ntro
l sc
he
me s
u
ccessf
ully fu
lfills th
e
control
obj
ectiv
e
s
and
als
o
has
an
excel
l
e
n
t s
t
abili
z
i
n
g
abi
lit
y to ov
erco
me
the
extern
al
i
m
p
a
ct acti
ng
on th
e
pe
ndu
l
u
m
system. This p
aper pr
esents
an ap
plic
atio
n of how
to des
ig
n and va
lid
ate
a real ti
me n
e
u
r
o fu
z
z
y
co
ntrol
l
er
of complex
a
nonlinear dy
nam
i
c syst
em
us
ing the Matlab-Simulink Re
al-Tim
e Workshop environm
ent.
Once the contr
o
ller is o
b
tai
n
e
d
and va
lid
ate
d
by simu
l
a
tion
, it
’
s
i
m
pl
e
m
ent
ed to control th
e pen
dul
u
m
-ca
r
t
system
. The design and
optim
i
z
at
ion pr
ocess of neuro f
u
z
z
y
c
ontroller
ar
e bas
ed on an
ex
tended learning
technique deriv
ed from
adaptive n
euro fu
z
z
y
inference system (ANFIS).
The design and im
plementation of
this pe
ndu
lu
m-cart control
system h
a
s b
een r
eal
i
z
e
d
und
er MATLA
B
/SIMULINK envir
on
me
nt. Th
e
exper
imenta
l
r
e
sults d
e
m
o
n
strate the
efficie
n
cy of t
he s
i
mplifie
d d
e
si
gn
p
r
oced
ure
and
e
n
sure
d stab
ility
of
this system
.
Ke
y
w
ords
:
ne
uro fu
z
z
y
co
ntrollers, ad
aptiv
e
neuro fu
z
z
y
in
f
e
renc
e system
(ANFIS), pend
ulu
m
-cart contr
o
l
system
Copy
right
©
2014 In
stitu
t
e o
f
Ad
van
ced
En
g
i
n
eerin
g and
Scien
ce. All
rig
h
t
s reser
ve
d
.
1. Introduc
tion
The inverted pendulum system is closely link
ed to research areas such as
robotics,
digital control, and
control techniques,
among others.
The study of
this system
is related
with
other
common problems within
the control area
such
as the
choice of the
direction of a missile,
because the center
of gravity lies
in a part
other
than the
section in charge
of the
movement,
thus causing a
possible aerodynamic
instability.
This keeps
a relationship
with the
inverted
pendulum system
in the
approach
of the
problem
. Fuzzy
controllers have been
widely used in
many control
systems applications.
Besides bei
ng convenient
for qualitat
ive system
modeling,
they are very simple conceptually [1]. They
consist
of an input stage, a processing stage,
and
an
output stage. The input stage maps
sensor
or other inputs, su
ch as switches, thumbwheels,
and
so on,
to the
appropriate membership functions.
The processing
stage invokes each
appropriate
rule and generates
a result for
each, t
hen combines
the results of
the rules. Finally,
the output stage converts
the comb
ined result
back into a specific
control output value.
The
most common shapes of membership functions
are triangular, trapezoidal and bell curves. From
three to
seven curves
are generally
appropriate to
cover
the required
range of
an input
value, or
the "universe of discourse" in fuzzy jargon.
The shape is generally less important than the
number of curves and their placement. Design
of a fuzzy controller requires more
design
decisions
than usual, for
example regarding rule
base,
inference engine, defuzzification, and
data
pre- and post processing [2]. This paper descr
ibes the design decisions related to closed-
loop neuro fuzzy controller of
the pendulum-cart
system. The
main problems in neuro
fuzzy
controller design are the
inference of an
initial
rule base
and in particular
the optimization of
an
existing rule
base. Many
researchers addressed
the design
problem of
neuro fuzzy controller.
Nauck et al
introduced the
design of neuro
fu
zzy controller
using backpropagation
algorithm
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NI
KA
Vol. 12, No. 7, July 201
4: 5225 – 52
34
5226
[11]. They also, presented
their learning al
gorithm for
neuro fuzzy
environment NEFCON-I
under matlab/simulink [22]. The pendulum-cart sy
stem is an interesting nonlinear
dynamic
model
which has been
extensively studied by
cont
rol community. It
represents many real world
systems, such as crane at shipping port and
spac
e mission launchers. The selection of a control
strategy for
stabilization of
such
systems
is a
difficult design
task. Optimality
of the
control
strategy
and its robustness are t
he
main design criteria to be
considered. However, due to the
presence
of disturbances and model parameter
uncertainties, a robust behavior is more
important than the optimal char
acter of the control strategy
. The efficiency of neuro
fuzzy
techniques to
reduce disturbances
makes it
an
excellent candidate
to design
a closed loop
controller. With an
efficient learning
method, t
he
parameters of the
neuro fuzzy
controller can
be
optimally designed. The
design and validation
of
a neuro
fuzzy controller should
be assisted
by
a software environment that can provide the desi
gner with functions of
fuzzy logic systems
and
targeting a real time application.
The
Fuzzy Logic Toolbox of the
MATLAB
technical computing environment is an
efficient
tool for designing
syst
ems based on
fuzzy logic. The
tool
box provides many functions
which allow
control engineers
to develop
and anal
yze fuzzy
inference systems,
to develop
adaptive inference systems, and perform
fuzzy
clustering [3]. Its Graphical User
Interfaces
(GUIs)
simplifies the steps of neuro fuzzy infe
rence system design. Alternatively, Simulink
provides fuzzy inference blocks
in order to
si
mulate the fuzzy
systems within a
comprehensive
model of
the entire
dynamic system
[7].
From
Simulink, C
code can
be automatically generated
for use in embedded applications that include
neur
o fuzzy logic [4]. This paper describes
the
design
decisions related to closed-loop
neuro fu
zzy controller of
the pendulum-cart model. We
propose an efficient design and rule learning procedur
e of the neuro fuzzy controller. We
also
present the experimental result
s on the design and implementati
on of real time neuro
fuzzy
control system
under matlab/simulink
computat
ion environment.
This paper
is organized as
follows. Section 1
is this
introduction. In
Section
2, we
present an
analysis
of the
control system
development under Matlab/Simulink Environment.
Section
3 describes the pendulum-cart
set-
up. Section 4 presents the contro
l algorithm,
the rule base learni
ng and its optimization.
Section
5 evaluates the implementation
and presents the experimental resu
lts of neuro fuzzy algorithm.
Finally, our conclusions are drawn in Section 6.
2.
Con
t
rol Sy
st
em Dev
e
lop
m
ent unde
r Matlab/Simulink En
v
i
ron
m
ent
This
wo
rk h
a
s
be
en devel
oped
usin
g the Math
wo
rks tool
s. The
s
e tool
s a
r
e i
n
varying
wide
sp
rea
d
u
s
e a
c
ro
ss a
numbe
r of in
dustri
e
s fo
r control sy
stem
developme
n
t [3]. Figure
1
sho
w
s h
o
w th
e vario
u
s ele
m
ents of the
MATLAB env
ironm
ent
can
be lin
ke
d tog
e
ther to p
r
ovi
d
e
an integ
r
ated
set of tools f
o
r control system des
i
gn a
nd expe
rimen
t
al validation
[3]. The use
of
these
sta
nda
rd softwa
r
e to
ols
mean
s th
at, duri
ng t
h
e
co
ntrolle
r
de
sign
sta
ge, th
e de
sig
ner o
n
ly
need
s to m
o
del the p
r
o
c
ess u
s
ing th
e graphi
cs
tools
availabl
e in Simulin
k with
out be
ing
con
c
e
r
ne
d wi
th the mecha
n
ics of comm
unication to a
nd from the d
e
vice un
der t
e
st.
Figure 1. Con
t
rol System Developme
n
t Flow Di
agram
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
Sim
p
lifications The
Rule B
a
se for Stabili
zation
of Inve
rted Pend
ulu
m
… (Tharwat
O. S. Hanafy)
5227
A
brief description of
these tools and their
use
in control system
dev
elopment is given in
next paragraphs. Real-Time
Workshop -RTW
generat
es optimized,
portable, and
customizable
code from Simulink models. Real time works
hop automatically builds a C++ source program
from the Simulink model.
C++ Compile
r com
p
ile
s an
d links the co
de create
d
b
y
Real Time
worksho
p
to prod
uce
an executa
b
l
e
prog
ram. T
he pro
g
ra
m interfaces to
the outsid
e
en
vironme
n
t via a "Target", in our
ca
se Real Ti
me Wind
ows
Targ
et.
Real Time Windo
ws Targe
t
comm
unicates with
the
e
x
ecutabl
e
p
r
o
g
ram actin
g
as
th
e
control program, and inte
rface
s
with the hardw
are
device thro
ugh an I/O b
oard.
Real T
i
me
Wind
ows Ta
rget controls t
he two-way d
a
ta or si
g
nal flow to and fro
m
the model, and to and from
the I/O Board. When the p
r
og
ram is run
n
ing, the
use
r
may chan
g
e
certai
n of the paramete
r
s in
the Simulink model, whi
c
h a
r
e then
passed, vi
a
Real Time
Wo
rksho
p
, to the execut
able
prog
ram
3.
Pendulum Cart Setup Description
One of the si
mplest p
r
obl
e
m
s in robotics is t
hat of co
ntrolling the
p
o
sition of a
si
ngle lin
k
usin
g a stee
ri
ng force appli
ed at the end
. Pole-
balan
ci
ng system
s a
r
e impr
essive
demon
stratio
n
model
s of missil
e
stabili
za
tion probl
em
s [3-7]. The
crane u
s
ed at shippin
g
port
s
is an exampl
e of
non-li
nea
r el
ectro
m
e
c
ha
ni
cal sy
stems havi
ng a complex dyna
mic beh
avior and creatin
g
chall
engin
g
control p
r
obl
e
m
s. Mathem
atically eithe
r
is just a p
e
n
dulum in a
st
able o
r
un
sta
b
le
positio
n. The
pend
ulum
-ca
r
t set-u
p
con
s
i
s
ts of
a
pole
mounted
on
a ca
rt in
su
ch
a way that th
e
pole ca
n swi
ng free only in vertical pla
ne. The
ca
rt is derive
d
by DC motor. T
o
swin
g and
to
balan
ce the
pole the
cart
is pu
she
d
b
a
ck and fo
rth on a rail o
f
limited leng
th. The vertical
stationa
ry po
sition
s of the
pend
ulum
(up
r
ight a
nd d
o
wn) a
r
e
equilib
rium p
o
sitio
n
s
when
no fo
rce
is bei
ng
appli
ed. In the
up
right p
o
sitio
n
a sm
all
devia
tion from it
re
sults in a
n
u
n
stabl
e motio
n
.
Generally the pendulum
control
problem is to brin
g
the pol
e to
one of th
e equilibrium
positions
and preferabl
y to do so as fast as po
ssi
ble, wi
th few oscillation
s, and witho
u
t letting the angl
e
and velo
city
become to
o l
a
rge. After th
e de
sired
po
sition is
re
ach
ed, we would
like to
keep
th
e
system i
n
thi
s
state
de
spi
t
e ra
n
dom p
e
rturbation
s
.
Manual
co
ntro
l of the
cart
-pole
sy
stem
is
possibl
e only
for sim
p
le ta
sks
e.g. for m
o
ving the
cart
from on
e pla
c
e o
n
the rail
to anothe
r. F
o
r
more
com
p
licated tasks
(such a
s
sta
b
ili
zing the p
o
le
in an upri
ght
position
)
a feedb
ack cont
rol
system m
u
st
be implem
ent
ed Figu
re 2.
The pu
rp
os
e
of the inverte
d
pen
dulum
control al
gorith
m
is to
apply
a
seq
uen
ce
of f
o
rces of
con
s
trained
ma
gni
tude to th
e
cart, such that
the p
o
le
starts
to
swi
ng with increa
sing a
m
plitude with
out
the
cart
o
v
erridi
ng the
end
s of the
ra
il. Firstly the
pole
is swu
ng up t
o
the vicinity of its upri
ght
posit
io
n and t
hen, on
ce thi
s
ha
s b
een a
c
compli
she
d
, the
controlle
r mai
n
tains th
e pol
e vertically a
nd at the sa
m
e
time brin
gs
the ca
rt ba
ck
to the ce
nter
of
the rail.
Figure 2. Pendulum Contro
l System
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NI
KA
Vol. 12, No. 7, July 201
4: 5225 – 52
34
5228
Figure 3. Act
i
vity Cones of
Two Control
Algorithm
s
The swin
ging
control algo
ri
thm is a heu
ri
stic
on
e, ba
sed on en
ergy rule
s. The al
gorithm
steers th
e p
o
l
e up th
us in
cre
a
si
ng it
s t
o
tal ene
rgy [
3
-4], [19]. Th
ere i
s
a
tra
d
e
-
off between
tw
o
tasks: to swin
g the pend
ulu
m
to the upri
ght positio
n a
nd to cente
r
the ca
rt on th
e rail. Du
e to the
pre
s
en
ce
of d
i
sturb
a
n
c
e
s
a
nd pa
ram
e
ter uncertai
n
ties, a rob
u
st
be
havior i
s
mo
re impo
rtant th
an
the optimal chara
c
te
r of the control strategy. T
he swit
chin
g mome
n
t
s are calcula
t
ed according
to
a si
mple
rul
e
. The
cha
r
a
c
teristi
c
fe
ature
of
control i
s
i
t
s “ban
g b
a
n
g
”
ch
ara
c
te
r.
Swingin
g
u
p
t
h
e
pole may re
sult in ove
r
-reaching the
uppe
r un
st
ab
le equilib
riu
m
point. To
achi
eve a “soft”
landin
g
in
the
vicinity of th
e up
rig
h
t po
si
tion (“st
a
b
ilization
zon
e
” in
Figu
re
3, a
routine
call
ed
the
“soft landi
ng
arbite
r” che
c
ks wh
ether the
kinetic e
ner
g
y
of the pole,
minus the e
n
ergy loss du
e
to
friction, is sufficient to rai
s
e
the
center of
gravity of the
pole to it
s upright positio
n. If the conditio
n
is sati
sfied then the co
ntrol is set to zero
and the
"bang-bang"
characte
r of
the control
is
finis
h
ed. After the pole has
entered the s
t
abiliz
a
tio
n
zon
e
the
sy
stem
can
be
treated
as line
a
r
and the
control is switch
e
d
to the stabi
lizing al
gor
ith
m
. Due to th
e limited len
g
th of the rai
l
a
routine
call
ed
“lengt
h control” i
s
intro
d
u
c
ed, to
rei
n
force cente
r
ing
of
t
he ca
rt an
d prevent ov
er-
runni
ng the e
dge
s of the rail. The rule i
s
very
simpl
e
. When the p
o
sition give
n by the param
eter
"length" is
re
ach
ed, then t
he maximal f
o
rce i
s
ap
p
lie
d to the
cart
steeri
ng it b
a
ck
away from
this
positio
n.
3.1. Sy
stem
Model
The s
t
ate of the s
y
s
t
em is
the
vec
t
or x =
[ x1, x2, x3,
x4]t, where x1 is
the c
a
rt
pos
ition
(distance from the centre
of the rail),
x2 is
the angle
between the upward
vertical and the
ray
pointing at the centre of
mass, measured counter-clockwise from
the cart ( x2 = 0 for the
upright
position of
the pendulum),
x3 is
the cart
velo
city, and
x4 is
the pendulum
angular velocity. The
pendulum rotates
in a
vertical plane
around an
axis
located
on a
cart [23].
The cart
can
move
along
a horizontal rail, lying in the plane of rotati
on.
A control force u, parallel to the rail, is
applied
to the cart.
The mass of
the cart is
denoted by mc
and the mass
of the pendulum, by
mp. l is the distance from the axis of
rotation
to the centre of mass of
the pendulum-cart
system.
J
is the moment
of inertia of
the pendulum-cart sy
stem with
respect to the
centre of mass. Tc
denotes the friction in the
motion of the cart,
and
Dp is the moment
of friction in the
angular
motion of the pendulum, proportional to the angular velo
city: Dp = fp x4. The force of reaction of
the
rail V
acts vertically on
the cart.
As the horiz
ontal co-ordinate
of the
centre of
mass is equal
to x1 - lsin x2 and the vertical to l
cos x2, the motion equations are as follows:
(mc+mp)(x
1-
l
sin
x
2
)"=F-Tc,
(1)
(mc+mp)(
l
cos
x
2
)"=V-(
mc+mp)
g,
(2)
Jx
2"=(u-Tc) l cos x
2
+ V
I
sin x
2
– Dp,
(3)
(.)" denotes the second derivat
ive with respect to time t and (.)’ denotes the first
derivative
with respect to time t.
The first two
equations describe
the translation of the centre of
mass, while
the third
describes the
rotation of
the
whole system
around
the
centre of mass.
After the elimination of V and simple calculati
ons we obtain the state equations (for t >= 0).
x
'
1
=
x
3
(
4
)
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
Sim
p
lifications The
Rule B
a
se for Stabili
zation
of Inve
rted Pend
ulu
m
… (Tharwat
O. S. Hanafy)
5229
x'3=
2
2
4
2
2
2
2
4
sin
)
sin
(
cos
)
sin
(
x
l
J
x
f
x
g
x
l
x
x
Tc
u
a
p
(5)
x
'
2
=
x
4
,
(
6
)
x'4=
2
2
4
2
2
2
4
2
sin
sin
)
sin
(
cos
x
l
J
x
f
x
g
x
x
Tc
u
x
l
p
(
7
)
Where,
a=
l
m
m
m
m
J
l
p
c
p
c
)
(
,
2
The admissible controls are bounded such that:
M
t
u
)
(
The cart friction Tc in the
model is a non-li
near function of
the cart velocity x3. As
an
approximation
one can assume Tc =
fcx3. The
rail has a
finite length and hence the cart
position x1 is bounded: The typical parameters of
the cart-pole set-up are given in Table 1.
Table 1. Para
meters of the Pendulu
m
Ca
rt Set Up
Name of pa
rame
ter
Value of parameter
T
r
ack limits
±0.5 m
Gravit
y
g
9.81 m/s
2
Distance betwee
n
mass centre an
d axis of rotation
L
0.017 m
Mass of cart mc
1.12 kg
Mass of pole mp
0.11 kg
Magnitude of con
t
rol force M
17.0 N
Moment of inerti
a of s
y
stem J
0.0136 kgm
2
Friction coefficie
n
t of pole rotatio
n
f
p
negligible
Friction coefficie
n
t of cart f
c
0.05
Ns/m
The model of
the pendulum-cart set-up
is
an example
of a SIMO
system: a
single
control input
and multi
outputs (states)
and
can
be used
to demonstrate
the advantages of
closed-loop control.
3.2. Real Time Compu
t
er
Con
t
rol
One of the main obje
c
tives of this work i
s
the dire
ct impleme
n
tatio
n
of design
e
d
neru
r
o
fuzzy
co
ntroll
er i
n
a
real ti
me p
r
o
c
e
ss.
Comp
uter
co
ntrol
of a
re
al
time p
r
o
c
e
ss is presented
in
this se
ction.
A block di
ag
ram of a comp
uter-co
n
trolle
d pro
c
e
ss i
s
given in Figu
re 4.
The
system
contai
ns six
blo
c
ks: the
pro
c
e
s
s, s
e
nso
r
s
(S
), D
/
A conv
e
r
ter,
co
ntrol
algorith
m
, an
d a clo
c
k. T
he software
clo
ck
cont
ro
l
s
the op
eration of the co
nverters a
n
d
th
e
control algo
rithm. The time betwe
en successive co
nv
ersion
s of the si
gnal to digital
form is calle
d
the
samplin
g perio
d (T0
)
. The clo
c
k
su
pplie
s
a
pul
se
every T0 seco
nd
s,
an
d the
DI su
ppli
e
s a
numbe
r to th
e com
puter
every time a
n
interrupt
arrives. The
co
ntrol alg
o
rith
m comp
utes
the
value of th
e
control va
riab
le an
d
sen
d
s it as a
numb
e
r to
the
D/A co
nverte
r. It is a
s
sume
d t
hat
the D/A
con
v
erter
hold t
he si
gnal
co
nstant
over
t
he sampli
ng
peri
od; pe
ri
odic
sa
mplin
g is
norm
a
lly use
d
[3]. An applicatio
n of the gen
eral
di
gital cont
rol
system
sche
ma for pe
nd
ulum
control is
given in blo
c
k di
agra
m
form i
n
Figu
re
5. T
w
o p
r
o
c
e
ss
states are me
asu
r
ed: the
cart
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NI
KA
Vol. 12, No. 7, July 201
4: 5225 – 52
34
5230
positio
n x1 a
nd the p
end
ul
um angl
e x2.
Process
st
ate
s
a
r
e me
asured a
s
continu
ous
sig
nal
s a
n
d
conve
r
ted to
digital by opti
c
al e
n
code
rs
(se
n
sors
S1
S2). The
refe
ren
c
e in
put (desi
r
ed val
u
e
of
the ca
rt positi
on x1) ca
n b
e
gene
rated i
n
a digi
tal form using a d
e
s
ire
d
po
sition
generator. T
h
e
softwa
r
e tim
e
r is u
s
ed
to
supply inte
rru
p
t
s for th
e
syst
em: The
ba
si
c
clo
c
k a
c
tivates the
pe
riod
ic
sampli
ng of o
p
tical de
co
de
rs o
u
tputs a
n
d
synchr
oni
zes the
comp
u
t
ation of controller o
u
tputs
(u)
and pe
riodi
c
digital-to
-anal
og (D/A
) conv
ersi
on.
Figure 4. Co
mputer
Controlled Pro
c
e
ss
Figur
e 5. Digi
tal Control of
the Pendulu
m
-Cart
System (ba
s
i
c
blo
ck di
agram)
The pen
dulu
m
-cart sy
ste
m
is cont
rolle
d in real
-tim
e
.
The term "real-time" is o
ften used
but seldom
defined.
One
po
ssi
ble d
e
f
inition is
[4]:
"Real
-time i
s
the
op
erati
ng mo
de
of
a
comp
uter sy
stem in
whi
c
h
the p
r
og
ram
s
for th
e
pro
c
e
ssi
ng
of dat
a
arrivin
g
from
the out
side
a
r
e
perm
ane
ntly ready,
so th
a
t
their
results will b
e
avail
able within predetermine
d perio
ds
of
ti
me;
the arrival tim
e
s of the data
can b
e
ra
nd
omly
distrib
u
ted or b
e
alre
ady determi
n
ed dep
endi
ng
on
the differe
nt
appli
c
ation
s
”.
The
real
-tim
e softwar
e f
o
r p
end
ulum
co
ntrol i
s
st
ructu
r
e
d
a
r
o
und
particula
r int
e
rnal
sig
nal
s (events) int
o
a set of tasks. Ea
ch ta
sk im
plem
ent
s the p
r
o
c
e
s
sing
requi
re
d by
a corre
s
po
nd
ing eve
n
t. A task sch
edul
er
re
cog
n
ize
s
the
event
s and
a
c
tivates o
r
su
spe
n
d
s
th
e tasks. In t
he
simple
st
ca
se,
whe
n
all tasks req
u
ire
processi
ng at th
e
sa
me
freque
ncy,
a
seq
uential
organi
zation
of
the ta
sks ca
n be
impl
em
ented [1
4]. T
he time
fram
e of
each task is fixed. It is assumed that the
longe
st task
job take
s no l
onge
r than th
e perio
d of time
gene
rated by
the softwa
r
e t
i
mer.
4. Contr
o
l Algorithm
The
controlle
r in thi
s
exp
e
rime
ntal setup is ba
sed
on a
neu
ro f
u
zzy algo
rith
m. The
inputs of th
e
neuro fu
zzy
system
are
p
endul
um a
ngl
e, ca
rt p
o
siti
on, an
d the
outputs a
r
e
cart
velocity, pen
dulum vel
o
cit
y
as
sh
own
in Figu
re
6.
Figure 7
Sh
ows the
initi
a
l mem
bersh
ip
function for in
puts.
4.1. Rule Ba
se Learnin
g
The learning
pro
c
e
ss of the ANFIS model can be divi
ded into two main pha
se
s.
The first
pha
se is d
e
signed to lea
r
n an initial rule ba
se, if no prio
r kno
w
led
ge ab
ou
t the system
is
available. F
u
rthermo
re it
can be
u
s
ed t
o
co
mp
lete
a
manu
ally de
fined rule b
a
s
e. Th
e
se
co
nd
pha
se
optimi
z
e
s
the
rule
s
by shifting
o
r
modifying th
e
fuzzy
sets of
the
rule
s. Bo
th pha
se
s u
s
e a
fuzzy e
r
ror, E
,
which de
scri
bes th
e qu
ality of the
curre
n
t system
sta
t
e, to learn o
r
to optimize t
he
rule
base. In
this work, we used the
‘
A
NFIS Lea
rni
ng`-Algo
r
ithm
[9, 10]. This algo
rithm st
arts
with an empt
y rule base.
An initial fuzzy partiti
oning of the input
and output intervals m
u
st
be
given. The al
gorithm
ca
n
be divided i
n
to two p
a
rt
s.
Duri
ng the first part, the
ru
les' a
n
tecede
nts
are d
e
termi
n
ed by cla
s
sifying the inpu
t values,
i.e. finding that
membe
r
ship
function fo
r e
a
ch
variable
that
yields th
e hi
g
hest
memb
ership
valu
e fo
r th
e
r
e
s
p
ec
tive
in
pu
t value [13, 14]. Then
the alg
o
rithm
tries to ‘g
ue
sse
s
the
o
u
tpu
t
value
by de
riving it fro
m
t
he
cu
rre
nt fu
zzy e
rro
r.
Du
ri
n
g
the second
part, the
rul
e
ba
se
is o
p
timized
by
cha
ngin
g
the
co
nsequ
ent
to a
n
a
d
ja
cent
membe
r
ship functio
n
, if it is ne
ce
ssary [15-
1
6
], [19].
Figure 8 Sho
w
s the vie
w
in
g rule
s betwe
en
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
Sim
p
lifications The
Rule B
a
se for Stabili
zation
of Inve
rted Pend
ulu
m
… (Tharwat
O. S. Hanafy)
5231
inputs-outp
u
ts. The
relations amo
ng
cart vel
o
city, ca
rt po
sitio
n
, and
pen
d
u
lum a
ngle
are
introdu
ce
d as sho
w
n in Fig
u
re 9.
4.2 Simplific
ations of the
Rule Base (I
mplementation)
The aim of th
e impleme
n
ta
tion unde
r M
A
TLAB/
SIMULINK wa
s to
develop a
n
in
teractive
tool for the
con
s
tructio
n
and
optimi
z
ation
of a
fuzzy
cont
rol
l
er. Thi
s
fre
e
s the
u
s
er of
prog
ram
m
ing
and su
ppo
rts him to conce
n
trate on cont
rolle
r de
sign.
It is possi
ble to inclu
de pri
o
r
kno
w
le
dge i
n
to the
syste
m
, to stop
a
nd to
re
su
m
e
the l
earnin
g
process
at any time, a
nd to
modify the rul
e
ba
se a
nd th
e opt
imizatio
n paramete
r
s intera
ctively.
To optimi
z
e t
he rul
e
ba
se
we
cho
o
se the
optimizatio
n
algorith
m
ANFIS [10-12
].
This
algorithm is
motivated by the back
-
prop
agatio
n
algorith
m
for the multilay
e
r p
r
e
c
ept
ro
n [8]. It optimize
s
the
rul
e
ba
se
by b
a
ck-
prop
agatio
n of erro
r. A rule is ‘reward
ed’ by
shifting its con
s
eq
uent to a higher value an
d by
wide
ning th
e
sup
port
of the ante
c
ed
ent
s, if it's
curre
n
t output ha
s the same
sig
n
as the o
p
timal
output [20, 21]. Otherwis
e
, the ru
le is
‘punished’ by shifting its
c
o
ns
equent to a lower value and
by redu
cin
g
the supp
ort of
the ante
c
ed
ents. Th
e inf
e
rred rule b
a
s
e of the
system unde
r
study
has 2
7
rule
s.
Figure 6. Rel
a
tion betwee
n
Inputs-Outp
uts
Fi
gure 7. Initial Membe
r
shi
p
Functio
n
for
Inputs
The Simplifie
d rule ba
se i
s
presented b
e
l
ow:
1- IF (PendA
ngle is
N) a
n
d
(Ca
r
tPo
s
tion is N)
then (CartVel
ocity is N)(Pe
ndVel
ocity is
N)
(F
is N)
2- IF
(PendA
ngle i
s
P)
an
d (CartPo
s
tio
n
is P
)
the
n
(CartVel
ocity i
s
p
)(Pe
ndVel
ocity is
p)(F is p)
3- IF
(PendA
ngle i
s
Ze
)
a
nd (Ca
r
tPosti
on is
Ze
) the
n
(CartVel
ocit
y is Ze
)(Pe
n
d
V
elocity
is Ze)(F is Z
e
)
Figure 8. Visualization of Ru
le
s bet
wee
n
Inputs-outp
u
ts
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NI
KA
Vol. 12, No. 7, July 201
4: 5225 – 52
34
5232
Figure 9. The
Relation
s am
ong Cart Velo
city, Cart Position, and Pen
dulum Angl
e
5.
Experimental Results
To test ou
r approa
ch
we
con
d
u
c
te
d experi
m
en
ts on a
ca
rt-pend
ulum
hard
w
a
r
e
interfaced
with a neuro fuzzy control
l
er impl
em
en
ted in Matla
b
/Simulink e
n
vironm
ent as
previou
s
ly in
dicate
d in Fig
u
re 5. In the
s
e exper
im
ent
s, the ca
rt is
driven by DC motor. To swing
and to bal
an
ce the pole th
e ca
rt is p
u
sh
ed ba
ck and
forth on a
rail
of limited len
g
th. The ne
uro
fuzzy
system
is u
s
ed
to st
abilize the p
e
ndulum.
Fi
gu
re 1
0
sho
w
s
the structu
r
e
of neu
ro fu
zzy
system
u
s
ed
in the
imple
m
entation. T
he result
for
this
simulation of A
N
FIS controller
syst
em
with real time
inverted
pen
dulum
syste
m
is
sho
w
n i
n
followi
ng fi
gure
s
. Fig
u
re 11
Rep
r
e
s
ents
the chan
ge
of ca
rt p
o
siti
on
with time
, in an
othe
r mea
n
ing
thi
s
figu
re
sho
w
s the i
n
verse
relation
shi
p
b
e
twee
n the force a
nd sta
b
il
ity" T
he higher the force the lowe
r the stability". Figure
12
sho
w
s the
ch
ang
e of
p
endul
um a
ngl
e with
time
, i
n
an
other me
aning
this fig
u
re
sh
ows th
e
dire
ct relation
ship
bet
wee
n
the fo
rce an
d
the a
ngle
of
pend
ulum" T
he hi
ghe
r the
force
the
high
er
the an
gle". T
he
cha
nge
of
ca
rt velo
city
and
pen
dul
u
m
velo
city wit
h
time i
s
sh
o
w
n i
n
Fi
gure
13
and
Figu
re
1
4
respe
c
tively. Due
to the
high
force
g
enerated
fro
m
the i
n
itial
movement it
take
s
few seconds to reach
the st
ability level.
Figure 10. Th
e Structu
r
e of
Neuro Fu
zzy
Si
mulink System used in t
he implem
ent
ation
Figure 11. Th
e Cha
nge of
Cart Po
sition
with Time
Figure 12. Th
e Cha
nge of
Pendulu
m
Angle with
Time
C
a
rt
pos
i
t
i
o
n
C
a
r
t
Ve
l
o
c
i
ty
pe
ndul
u
m
A
ngl
e
A
n
g
u
la
r
V
e
lo
c
i
t
y
u
=
O
u
t
P
ut
C
ont
rol
M
e
as
ure
S
y
s
t
em
S
t
at
es
S
c
ope
P
endul
um
A
ngl
e
read a
ngl
e
s
i
gna
l
f
r
om
proc
es
s
a
N
euro F
u
z
z
y
S
y
s
t
e
m
In
1
In
2
Ou
t
1
Ou
t
2
Ou
t
3
si
g
n
a
si
g
n
a
si
g
n
a
si
g
n
a
Ga
i
n
3
1
Ga
i
n
1
DA
C
D
i
gi
t
a
l
_
t
o
_
a
nal
o
g
e
_
C
onv
ert
e
r
C
a
r
t
Po
s
i
ti
o
n
read
pos
i
t
i
on s
i
gnal
f
r
om
p
r
oc
es
s
k
Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM
NIKA
ISSN:
2302-4
046
Sim
p
lifications The
Rule B
a
se for Stabili
zation
of Inve
rted Pend
ulu
m
… (Tharwat
O. S. Hanafy)
5233
Figure 13. Th
e Cha
nge of
Cart Velo
city with
Time
F
i
gure 1
4
.
The Chan
ge of Pendul
um Velo
city with
Time
Figure 15. Th
e Output of DTAC and Inp
u
ts to
Process with
Time
Figure 17. Th
e Relatio
n
ship betwe
en Cart
Position an
d Pendulu
m
Velocity
Figure 16. Th
e Relatio
n
ship betwe
en Cart
Position an
d Cart Velo
city
Figure 18. Th
e Relatio
n
ship betwe
en Pe
ndulum
Angle and Pe
ndulum Vel
o
city
Then after few
seconds the stab
ility tends to be lost, at thi
s
mom
ent we
shoul
d
give
anothe
r fo
rce
in o
r
de
r to
keep th
e
stabil
i
ty of pend
ulu
m
at the
re
qu
ired l
e
vel. Fig
u
re
15
displa
ys
the digital
o
u
tput from
the
comp
uter whi
c
h
wa
s conve
r
ted by
the
di
gital sign
al
to an
alog
conve
r
ter (DTAC) u
s
ing
d
a
ta a
c
qui
sitio
n
card a
nd
sendin
g
thi
s
si
gnal
as inp
u
ts to
the
pro
c
ess
with time. Figure 16 to Fig
u
re 18
sho
w
the relation
sh
ip among in
p
u
ts and outp
u
ts. We noti
c
e
from the
s
e fi
gure
s
th
at the high vel
o
ci
ty generated
from force l
ead to hi
gh
cha
nge i
n
th
e
pend
ulum an
gle and this
chang
e tend to be less
whe
n
t
he velocity is red
u
ced wh
ich is a po
siti
ve
relation
shi
p
b
e
twee
n the velocity and th
e pend
ulum a
ngle, and force.
6. Conclusio
n
The basic aim of the work was to design appr
opriate controller to control the angle of
the
pendulum and
the position of
the cart in
or
der to
stabilize the
inverted pendulum system.
Experimental
results show that
the pendulum can be swung-up very
conveniently by controlling
its
energy. In
this paper
the design and
optimizat
ion process
of neuro
fuzzy controller supported
by learning
techniques derived
from neural
netwo
rks (ANFIS)
was present
ed.
The generation of
rule base has been done from input output
data. T
he implementation of this controller has
been
realized
under the MATLAB/SIMULINK. This impl
ementation supports the
development of real
time process in an easy way. One of
the important
conclusions in this model is that the
stability
of
the pendulum is negatively
related with t
he force, velocity,
and angle. The design and
implementation of this
pendulum-cart contro
l
system has been
done under
MATLAB/SIMULINK
environment. The experimental
results demonstrat
ed the
efficiency of
this design
procedure and
the ensured stability of the system.
Evaluation Warning : The document was created with Spire.PDF for Python.
ISSN: 23
02-4
046
TELKOM
NI
KA
Vol. 12, No. 7, July 201
4: 5225 – 52
34
5234
References
[1]
Barto AG, Bra
d
tke SJ, Sin
g
h
SP. Le
arn
i
n
g
to act
usin
g
real-tim
e d
y
n
a
mic pr
ogram
ming.
Artificial
Intelli
genc
e, Speci
a
l Vo
lu
me:
Co
mput
ation
a
l
Rese
arch o
n
Interaction
an
d Age
n
cy.
199
5; 72(1): 8
1
-
138.
[2]
Selcuk Kizir, Z
a
fer Bingul, C
une
yt O
y
s
u
. F
u
zz
y
C
ontro
l o
f
a Real T
i
me
Inverted Pen
d
u
lum S
y
stem.
Sprin
ger-Ver
la
g Berli
n
Hei
del
berg
. 20
08; 51
77: 674-
68
1.
[3]
Nürn
berg
e
r A, Nauck D, Kru
s
e R, Merz L.
A Neuro-F
u
zz
y
Devel
o
p
m
e
n
t T
ool for F
u
zz
y
Controll
er
s
under MATLAB/SIMULINK
. Proc. of the 5
t
h Europ
e
a
n
Con
g
ress o
n
Intelli
ge
nt T
e
chniq
ues & Soft
Comp
uting (E
UF
IT
’97), Aachen, German
y
.
2012.
[4]
Mamda
n
i EH,
Assilia
n S. An Experim
ent in Li
ngu
istic Synt
hesis
w
i
t
h
a Fuzz
y
L
ogic
Control
l
er
,
Internatio
na
l Journ
a
l of M
an-
Machi
ne Studi
es. 1973; 1-
13
.
[5]
Barto AG, Sutt
on RS, Anderson CW
.,Neuro
n
like a
d
a
p
tive
eleme
n
ts that can solve d
i
fficult lear
nin
g
control pr
obl
e
m
s.
IEEE
Transactions on System
s, Man and Cyber
netics
. 198
3; 834-
846.
[6] Lin
CT
.
Neural F
u
zz
y
Co
ntrol Systems w
i
t
h structure and Para
meter
Learn
i
ng.
W
o
rld Scientifi
c
Publ
ishi
ng, Sin
gap
ore. 19
94.
[7]
Knap
pe, He
iko
.
Comparis
on o
f
Conventi
o
n
a
l
and F
u
zz
y-C
o
n
t
rol of Non-L
i
n
ear S
y
stems. 1994.
[8]
DA Sofge, DA
Publ. Ha
nd
bo
ok of Intell
ige
n
t
Control. Ne
ur
al, F
u
zz
y
an
d
Adaptiv
e Ap
proach
e
s, Va
n
Nostran
d
Rei
n
hol
d, Ne
w
York
. 1992:
[9] Nauck
Detlef
.
A F
u
zz
y
Perc
e
p
tron
as a
Gen
e
ric Mo
de
l for
Neur
o-F
u
zz
y
A
ppro
a
ches.
Pr
o
c
. of the
2n
d
German GI-W
o
rkshop F
u
zz
y-
S
y
steme '
9
4, Münch
en. 19
9
4
.
[10] Nauck
Detl
ef,
Kruse, R
udo
lf.
A F
u
zz
y
Ne
ura
l
Netw
ork L
ear
nin
g
F
u
zz
y
C
o
ntrol R
u
l
e
s a
n
d
Me
mbers
h
i
p
F
unctions
by F
u
zz
y
Err
o
r Bac
k
prop
agati
on.
Proc. IEEE Int. Conf. on
Neur
al Net
w
orks, S
an Franc
isco.
199
3.
[11]
Nauck D
e
tlef, Kruse, Rud
o
lf.
Desig
n
in
g ne
uro-
fuzz
y s
y
stems throug
h
backpr
opa
gati
on, In W
i
tol
d
Pedr
yz, e
d
itor,
F
u
zz
y Mod
e
l
i
ng: Par
adi
gms
an
d Pr
actic
e
. Klu
w
e
r
Ac
ad
emic Pu
bl
ishe
rs, Boston,
Dordrec
h
t, Lon
don. 19
96: 20
3
-
228.
[12] Lin
CT
.
Neural F
u
zz
y
Co
ntrol Systems w
i
t
h structure and Para
meter
Learn
i
ng
. W
o
rld Scientifi
c
Publ
ishi
ng, Sin
gap
ore. 19
94.
[13]
Nauck Detl
ef, Kruse Rud
o
lf
, Stellmach R
o
la
nd.
New
Learn
i
ng Al
gorit
hms for the
Neur
o-F
u
zzy
Environm
ent NEFCON-I.
Proceed
ings of
Neu
r
o-F
u
zz
y
-
S
y
st
e
m
e '
95, Darmstadt. 199
5: 357-
364.
[14]
Kruse, Rud
o
lf; Gebhardt, Jörg; Palm, Rai
ner (E
ds.) F
u
zz
y
S
y
stems in
Computer Sci
ence, F
r
ie
d
r
.
Vie
w
e
g
& Soh
n
Verla
g
sg
esel
lschaft mbH, Braunsc
h
w
e
ig, W
i
esba
den. 1
9
94:
[15] Riedm
ill
er
Mart
in
,
Janusz B
a
r
bara
.
Usi
ng N
e
ural R
e
inf
o
rce
m
ent Contro
ll
e
r
s in Rob
o
tics, In Xi
an Ya
o,
editor, Proc
ee
din
g
s of the 8
t
h.
Australia
n
Confer
ence
o
n
Artificial Inte
llig
enc
e, Sing
a
pore. Worl
d
Scientific Pu
bli
s
hin
g
, Sing
apo
re. 1995.
[16]
Ahmed
a
MA, S
a
liu
MO, AlGh
amdi J. A
d
a
p
ti
ve fuzz
y l
o
g
i
c-
base
d
frame
w
ork for soft
w
a
r
e
d
e
vel
opm
ent
effort predictio
n”, Information
and Soft
w
a
r
e
T
e
chn
o
lo
g
y
. 200
5; 47: 31–
48.
[17]
T
schichold-Gür
m
an, Na
din
e
. Rule
Net - A ne
w
K
n
o
w
l
e
dge-
base
d
Artificia
l
Neura
l
Net
w
o
r
k Model
w
i
t
h
Appl
icatio
n Exampl
es in Ro
b
o
tics, Di
ssertati
ona
l T
hesis, ET
H
Z
ü
rich. 199
5
[18]
Muluk
u
tla Ve
n
k
ata Subram
a
n
y
am, PVN Prasad, G Poorn
a
cha
ndra
Rao.
F
u
zz
y
Lo
gic
Close
d Lo
o
p
Contro
l of 5 le
vel MLI Drive
n
T
h
ree phase In
ductio
n
motor.
Internatio
na
l Journ
a
l of Pow
e
r Electronic
s
and Dr
ive System (IJPEDS)
. 201
3; 3(2): 200
-208.
[19]
D Len
ine, C
h
Sai Bab
u
, G Shank
arai
ah. Pe
rform
ance Eva
l
uatio
n of F
u
zzy a
nd PI Contr
o
ller for Bo
ost
Converter
w
i
th Active PFC.
Internati
o
n
a
l Jo
urna
l of Pow
e
r
Elec
tron
ics a
nd Driv
e Syste
m
(IJPEDS).
201
2; 2(4): 445
-453.
[20]
Nauck
D. A F
u
zz
y
P
e
rceptr
o
n
as a
Gen
e
ric
Mode
l for N
eur
o-F
u
zz
y Ap
pro
a
ches, Pr
ocee
din
g
s of th
e
2nd Germa
n GI-W
o
rkshop F
u
zz
y
-
S
y
stems ’9
4, Münche
n, German
y
. 19
94.
[21]
Nauck D, Kla
w
onn F
,
Kruse
R.
F
oundati
o
n
s
of Neuro-F
u
z
z
y
S
y
stems, John W
i
l
e
y
& Sons, Inc., N
e
w
York, Chich
e
ster. 1997.
[22]
Nauck D, Kru
s
e R, Stellma
c
h R.
New
Learn
i
ng A
l
gor
i
t
hms for the
Neur
o-F
u
zz
y
Enviro
n
m
en
t
NEFCON-I
. Procee
din
g
s of
the 3rd Germ
an GI-W
o
rks
hop F
u
zz
y-Ne
u
r
o-S
y
stem
’95,
Darmstadt,
German
y
. 199
5;
357-3
64.
[23]
Mridul
Jha
SP
Dub
e
y
.
Ne
ur
o-F
u
zz
y bas
ed
Contro
ller
for
a T
h
ree- Ph
a
s
e F
our-W
ire
Shunt Activ
e
Po
w
e
r Filter.
In
ternatio
nal J
o
u
r
nal of Pow
e
r
Electron
ics an
d Drive Syste
m
(IJPEDS)
. 2
011; 1(
2): 148-
155.
Evaluation Warning : The document was created with Spire.PDF for Python.