Simulationandmodeling
Simulationandmodeling
net/publication/343152347
CITATIONS READS
0 1,125
1 author:
Firmansyah David
Institut Teknologi Padang
18 PUBLICATIONS 48 CITATIONS
SEE PROFILE
All content following this page was uploaded by Firmansyah David on 23 July 2020.
Hayfa Press
Padang
ACKNOWLEGMENT .......................................................... vi
INTRODUCTION................................................................. 1
REFERENCES.................................................................. 77
ii
LIST OF FIGURES
Figure 7 : the block representation of pulleys, cart and belt conveyor ..... 13
Figure 16: the angle (deg) vs. time(s) on simple pendulum oscillation .... 27
iii
Figure 17: dialog box of pendulum.mdl ............................. 33
Figure 24: the inverted pendulum model with Equivalent Ellipsoid .......... 61
Figure 27: Input signal and Cart Position with Ko = 40, K i = 0.06 ..... 64
Figure 28: Input signal and Pendulum angle with Ko = 40, K i = 0.06. 66
Figure 29: Input signal and Cart Position with Ko = 60, K i = 0.06 ...... 67
Figure 30: Input signal and Pendulum Angle with Ko = 60, K i = 0.06 68
Figure 31: Input signal and Cart Position with Ko = 98, K i = 2,7 ........ 69
Figure 32: Input signal and Pendulum Angle with Ko = 98, K i = 2.7 .. 70
Figure 33: The noise block on the inverted pendulum model .................. 71
Figure 35: Input signal and Cart Position with noise .......... 73
iv
Figure 36: Input signal and Pendulum Angle with noise .... 74
v
LIST OF TABLES
vi
ACKNOWLEGMENT
vi
CHAPTER 1
INTRODUCTION
2
CHAPTER 2
MODEL DEVELOPMENT
bx
x
x
2
I
x
y
bx
x
x
4
Figure 2 : Force analysis of an inverted pendulum
To make clearer with the equation above, sum all the moments
around the center of the pendulum and get the following
equation:
5
2.1 The Simulink model of an Inverted Pendulum
&x& F
m
g sin cos
l& 2 sin
M sin 2 (10)
m
7
2.2 The physical model of an Inverted Pendulum
9
The four major steps to build and run a model
representation of a mechanical system, with more detailed
explanations [2]:
10
In SimMechanics, the Coordinate System (CS) is called
World CS. The World CS has a position at (0, 0, 0) and a
principle of right-handed triad, orthogonal coordinate axes [2].
The World coordinate axes are determined as +x points right,
+y points up (gravity vector g in -y direction points downward)
and +z points out of the screen. The vertical direction or
upward and downward are defined by the gravity vector
direction relative to the frame of World axes. User can modify
the gravity g properties before starting the simulation; however
it does not dynamically change during a simulation.
11
The development of model will follow the World CS and
starts with CS (0, 0, 0) along x – axis. The model will be built
step by step with following process:
12
block should be connected to Ground block before continuing
build the mechanical block system. Each machine must have
one or more Ground blocks [2]. At Ground block the reference
coordinate of the system starts at position (x, y, z) = (0.8, 0, 0).
14
All the block coordinates are showing in Table 1. The values of
r1a, l2a and l3a are determined at initial file (init.m).
Center
Translate
Coordinate of Base Follower
Parts origin
System (CS) Gravity (B) (F)
from
(CG)
CS1 [0 0 0}
Adjoining,
Pulley A CS2 [0.02 0 [0 0 0] - -
CS1
0]
Belt
Conveyor [0 0
- - [1.6 0 0] World
from A to 0.02]
Cart
CS1 [0.075 0
0}
Cart [0 0 0] - - World
CS2 [-0.075
0 0]
Belt
Conveyor [1.6 0 Adjoining,
- - [0 0 0.02]
from Cart 0] CS1
to B
15
CS2 [0 l3a 0]
16
The pendulum set is consist of three different parts; axis
(part 1), rod (part 2), and cylinder (part 3). The mechanical
properties of the bodies would define as m1a, m2a and m3a as
masses and J1a, J2a and J3a as inertia tensor I . Last
properties are radius r and length of body l. The Weld joint
connect a body to another body without Degree of Freedom
(DoF); bodies will standstill, three parts of body are connected
with two Weld joints and those are assumed as one rigid body.
The block representation of pendulum set is shown in Figure 8.
18
2.5 Actuate the Model
19
Figure 9: the input force representation to pulley A
20
Figure 10: the friction representation on a cart
21
Figure 11 : the sensor representation on a pendulum Joint
22
Figure 13 : the sensor representation at the pendulum Joint
23
The belt tension is measured at Base (B), and the value will be
shown on x axis; because the belt is sliding along x axis.
24
Figure 14 : the two main parts of an inverted pendulum
25
are resulted from measurement. Table 2 contains the inverted
pendulum data.
26
Figure 16: the angle (deg) vs. time(s) on simple pendulum oscillation
based on SimMechanics Model
27
Figure 17: the angle (deg) vs. time(s) on simple pendulum oscillation
based on lab experiment
3000 rotation 60 mm
v (max rpm ) xratio x 3m / s
60 s rotation
28
joint. Using the DC motor model from Matlab (3000 rpm; 50 V)
the speed of cart was measured as 3.5 m/s.
CHAPTER 3
29
CONTROLLER DESIGN
( M m ) X ( s ) s 2 bX ( s ) s ml ( s ) s 2 U ( s ) (3.1)
30
( I ml 2 ) g
X (s) 2 ( s ) (3.3)
ml s
( I ml 2 ) g (I ml 2 ) g
(M m) 2 (s)s 2 b 2 (s)s ml(s)s 2 U (s)
ml s ml s
(3.4)
ml 2
s
(s) q
(3.5)
U ( s) 4 b( I ml 2 ) 3 ( M m)mgl 2 bmgl
s s s s
q q q
q (M m)(I ml 2 ) (ml) 2 (3.6)
ml
s
( s) q
(3.7)
U ( s) 3 b( I ml 2 ) 2 (M m)mgl bmgl
s s s
q q q
mlX ( s ) s 2
( s) (3.9)
( I ml 2 ) s 2 mgl
X ( s) ( I ml 2 ) s 2 mgl
(3.10)
U (s) b( I ml 2 ) 3 ( M m)mgl 2 bmgl
s4 s s s
q q q
32
Figure 17: dialog box of pendulum.mdl
[A,B,C,D]=linmod('pendulum');
Gss= ss(A,B,C,D)
Gtf=tf(Gss)
33
command tf converts the state model into transfer function.
After executing the command, the results will be:
-2.098
#2: --------------------------
s^2 - 8.882e-016 s - 38.15
( s) 2,09s 2
(3.11)
U ( s) s 4 38s 2
34
( s) 2,09s 2,09
(3.12)
U ( s) s 3 38s s 2 38
X ( s) 0.6s 2 20
(3.13)
U ( s) s 4 38s 2
3.2 State-Space
x& Ax Bu (3.14)
y Cx Du (3.15)
0 1 0 0 0
x& (I ml2 )b m gl2 2
x I ml2
&x& 0 2
0
I (M m) Mml I (M m) Mml2 x& 2
I (M m) Mml u
& 0 0 0 1 0
&& mlb mgl(M m) ml
0 0 &
I (M m) Mml
2
I (M m) Mml2 I (M m) Mml2
(3.16)
x
1 0 0 0 x& 0
y 0 u (3.17)
0 0 1 0
&
0 0 0 1 0
x& 0 0
1 0 x 0
& mgl ( M m) I ml 2
0 0 0 u
&& I ( M m) Mml 2 & I ( M m) Mml 2
m 2 gl 2 ml
&x& 0 0 0 x&
I ( M m) Mml 2 I ( M m) Mml 2
(3.19)
[A,B,C,D]=linmod('pendulum');
37
Gpend=ss(A,B,C,D)
a = x1 x2 x3 x4
x1 0 0 0 1
x2 0 0 1 0
x3 0 38.15 0 0
x4 0 -1.636 0 0
b = u1
x1 0
x2 0
x3 -2.098
x4 0.6293
c = x1 x2 x3 x4
y1 1 0 0 0
y2 0 1 0 0
d = u1
y1 0
y2 0
39
Consider the Equation 3.8 with the numerator and
denumerator as [0 0 -2.09 0 0] and [1 0 -38 0 0], the Matlab
commands to define the open-loop zero poles are described
below:
The tf2zp means convert the transfer function into zero pole,
and the result will be:
z = 0
0
p = 0
0
6.1644
-6.1644
40
Figure 18: Pole-zero Map
x (t ) Ax (t ) Bu (t ) (3.20)
lim (t ) 0 (3.21)
det( sI A) 0 (3.23)
p = eig (A)
p = 0
0
6.1768
-6.1768
42
plane pole at 6.1768. So, the system will be unstable at open
loop.
0 0 0 1
1 0 0 0 0
0 1 0
0 1 0 0 mgl ( M m )
det s 0 2
0 0 0
0 I ( M m ) Mml
0 0 1
0 m 2 gl 2
0 0 1 0
2
0 0
I ( M m ) Mml
(3.24)
43
s 0 0 1
0 s 1 0
mgl ( M m)
det 0 s 0 0 (3.25)
I ( M m) Mml 2
0 m 2 gl 2
0 s
I ( M m) Mml 2
s 4 a 3 s 3 a 2 s 2 a1 s a 0 0 (3.26)
1 2 j 2 , 2 2 j 2 , 3 16 , 4 20
( s 1 )( s 2 )( s 3 )( s 4 ) 0
pNeuK= 4*[-0.5+i/2,-0.5-i/2,-4,-5]
44
The result will be:
u Kx (3.27)
x ( A BK ) x (3.29)
K = place(Gpend.a,Gpend.b,pNeuK)
Gpend_reg=ss(Gpend.a-
Gpend.b*K,Gpend.b,Gpend.c,Gpend.d)
a = x1 x2 x3 x4
x1 0 0 0 1
x2 0 0 1 0
x3 -261 -550.3 -87.95 -159.8
x4 78.29 174.9 26.39 47.95
b = u1
46
x1 0
x2 0
x3 -2.098
x4 0.6293
c = x1 x2 x3 x4
y1 1 0 0 0
y2 0 1 0 0
d = u1
y1 0
y2 0
47
y Cx Dw (3.31)
The estim command will derive the plant output y and
state estimated x as given by the following model [3]:
x A x L ( y C x) (3.32)
x A x L Cx Ly (3.33)
x ( A L C ) x Ly (3.34)
pNeuL= 20*pNeuK
L = place(Gpend.a',Gpend.c',pNeuL)
48
The result will be:
pNeuL = 1.0e+002 *
-0.4000 + 0.4000i -0.4000 - 0.4000i -3.2000 -
4.0000
L = 1.0e+005 *
0.0001 -0.0031 -0.4244 0.1764
0.0019 0.0079 1.0344 -0.3334
Gest=estim(Gpend,L',[1,2],[1])
a =
x1 x2 x3
x4
x1 -9.788 -190.6 0
1
x2 314.9 -790.2 1
0
x3 4.244e+004 -1.034e+005 0
0
x4 -1.764e+004 3.333e+004 0
0
b = u1 u2 u3
49
x1 0 9.788 190.6
x2 0 -314.9 790.2
x3 -2.098 -4.244e+004 1.034e+005
x4 0.6293 1.764e+004 -3.334e+004
c = x1 x2 x3 x4
y1 1 0 0 0
y2 0 1 0 0
y3 1 0 0 0
y4 0 1 0 0
y5 0 0 1 0
y6 0 0 0 1
d = u1 u2 u3
y1 0 0 0
y2 0 0 0
y3 0 0 0
y4 0 0 0
y5 0 0 0
y6 0 0 0
Input groups:
Name Channels
KnownInput 1
Measurement 2,3
Output groups:
Name Channels
OutputEstimate 1,2
StateEstimate 3,4,5,6
Continuous-time model.
50
3.5 Construct Complete Regulator from State Estimator
plus Feedback Gain K
x
51
x Ax Bu (3.35)
y Cx Du (3.36)
x Ax LC ( B LD ) K x Ly (3.37)
u K x (3.38)
Greg = reg(Gpend,K,L')
a = x1 x2 x3
x4
x1 -9.788 -190.6 0
1
x2 314.9 -790.2 1
0
52
x4 -1.757e+004 3.351e+004 26.39
47.95
b = u1 u2
x1 9.788 190.6
x2 -314.9 790.2
x3 -4.244e+004 1.034e+005
x4 1.764e+004 -3.334e+004
c = x1 x2 x3 x4
d = u1 u2
y1 0 0
Input groups:
Name Channels
Measurement 1,2
Output groups:
Name Channels
Controls 1
Continuous-time model.
54
cart and the angel and angular velocity of the pendulum. The
output y contains both position of the cart and the angle of the
pendulum. With adding the reference point R, the cart should
move to the new position as stated in reference point; with the
condition initial angle of pendulum is zero. The R also can be
replaced by other signals and then the dynamical characteristic
of model will be evaluated.
x
55
on Figure 15 (SimMechanics model). The init (initial) block is
creating based on init files as described on sec 2.4.3. At the
Scope block; respectively; the cart position, the pendulum
angle and the force will be displayed. The reference block set
the orientation of direction of cart movement and the saturation
block defines limit of lower and upper of input signal.
56
(IC). After all the values are set; and all the files in the same
directory, the steps to run the simulation are; click on init; wait
until all the values are calculated and click on Start Simulation.
The animation window will be shown automatically on X – Y
axis.
K i K o (s )
Gc ( s) K o (3.39)
s s
Ki
(3.40)
Ko
57
Block is considered as input signal. After running the
simulation, the cart movement is projected to follow the sin
wave; sliding back and forth.
58
CHAPTER 4
59
Figure 23: the SimMechanics model of inverted pendulum in XY axis
60
Figure 24: the inverted pendulum model with Equivalent Ellipsoid
62
Figure 26: the SimMechanics model of inverted pendulum in XYZ axis
63
1 0,8
0,8
0,6
0,6
0,4
0,4
0 0
-0,2
-0,2
-0,4
-0,4
-0,6
-0,6
-0,8
-1 -0,8
0 50 100 150 200 250 300 350 400
Time (s)
Figure 27: Input signal and Cart Position with Ko = 40, K i = 0.06
64
The angle of pendulum is also observed at this K o and
65
1 0,1
0,8
0,6 0,06
0,4
P en d u lu m A n g le (d eg )
In p u t S ig n als (N m ) 0,2 0,02
-0,2 -0,02
-0,4
-0,6 -0,06
-0,8
-1 -0,1
0 50 100 150 200 250 300 350 400
Time (s)
Figure 28: Input signal and Pendulum angle with Ko = 40, K i = 0.06
66
1 0,8
0,8
0,6
0,6
0,4
0,4
In p ut S ig n als (N m )
0,2
C art P os itio n (m )
0,2
0 0
-0,2
-0,2
-0,4
-0,4
-0,6
-0,6
-0,8
-1 -0,8
0 50 100 150 200 250 300 350 400
Time (s)
Figure 29: Input signal and Cart Position with Ko = 60, K i = 0.06
67
1 0,2
0,8 0,16
0,6 0,12
0,4 0,08
0 0
-0,2 -0,04
-0,4 -0,08
-0,6 -0,12
-0,8 -0,16
-1 -0,2
0 50 100 150 200 250 300 350 400
Time (s)
Figure 30: Input signal and Pendulum Angle with Ko = 60, K i = 0.06
1 0,8
0,8
0,6
0,6
0,4
0,4
Input S ignals (N m)
0,2
0 0
-0,2
-0,2
-0,4
-0,4
-0,6
-0,6
-0,8
-1 -0,8
0 50 100 150 200 250 300 350 400
Time (s)
Figure 31: Input signal and Cart Position with Ko = 98, K i = 2,7
69
1 0,3
0,8
0,6
0,4
Input Signals (N m)
0,2
-0,2
-0,1
-0,4
-0,6
-0,8
-1 -0,3
0 50 100 150 200 250 300 350 400
Time (s)
Figure 32: Input signal and Pendulum Angle with Ko = 98, K i = 2.7
make the pendulum system will slide farther and faster. Further
condition is addition of disturbances to model system. The
disturbances are represented by Simulink block Band – limited
White Noise. This high frequency noise has power 2 and at
sample time 0,1 s. Figure 31 shows the implementation of
noise on the model. Furthermore, Figure 32 shows the noise
signal block is adding as the disturbances for pendulum. After
70
fixing the block, the influence of disturbances to pendulum
characteristic (position and angle) will be observed.
71
20
15
10
5
Noise Power
0
-5
-10
-15
-20
0 50 100 150 200 250 300 350
Time (s)
that the cart position would remain in range 0,8 and -0,8 m.
Hence, the noise does not affect to cart position. In the other
way, the pendulum angle with small vibration regard to the
frequency of noise in range ~0,2 and -0,2 degrees. However,
the system is still stabile within the disturbance.
72
1 0,8
0,8
0,6
0,6
0,4
0,4
In pu t S ig nals (N m )
0,2
C art P os itio n (m )
0,2
0 0
-0,2 -0,2
-0,4
-0,4
-0,6
-0,8 -0,6
-1 -0,8
0 50 100 150 200 250 300 350
Time (s)
73
1 0,3
0,8
0,6
0,4
P en d u lu m A n g le (d eg )
0,1
In p u t S ig n als (N m ) 0,2
-0,2
-0,1
-0,4
-0,6
-0,8
-1 -0,3
0 50 100 150 200 250 300 350
Time (s)
74
CHAPTER 5
CONCLUSIONS
76
REFERENCES
student_projects /Johnny_Lam_report_238.pdf.
Accessed on February 14th, 2008.
77
[5] Yang Chang, Lewis Paul. Basic Control Systems
Engineering. Prentice-Hall, Inc. New Jersey. 1997.
78
Firmansyah David, ST, M.Eng was born on 3rd
August 1982 in Sei.Geringging, Pariaman,
Indonesia. He received Master degree in
Technical Management from Fachhochschule
Oldenburg/Ostfriesland/Wilhemshaven,Germa
ny (2008) and finished Bachelor degree in
Electrical Engineering at Andalas University,
Indonesia (2005). He follows several
researches in electrical engineering
particularly on Power System and High
Voltage Engineering.
One of the international publication which entitled “The
Leakage Current Analysis on Porcelain Suspension Insulator
Contamined by Salt and Cement Dust” had been presented
in Bali, Indonesia (2006).
79
SIMULATION OF AN INVERTED PENDULUM
Cetakan ke – 1
Juli, 2008
1. Pendidikan i. Judul
2. Firmansyah David ii. Nama
3. Keteknikan iii. Kelompok
80
81