You are on page 1of 15

SINGLE INVERTED PENDULUM

Consider the inverted -pendulum control system shown in the figure-1. In this example, we are
concerned only with the motion of pendulum and the motion of the cart in the plane of the page.

It is desired to keep the inverted pendulum upright as much as possible and yet control the position
of the cart, we need to build a type 1 servo system. The inverted pendulum system mounted on a
cart does not have an integrator. Therefore, we feed the position signal y (which indicate the
position of the cart) back to the input and insert an integrator in the feedback path, as shown

Figure 1

Inverted-Pendulum Control System


Figure 2

Inverted-pendulum control system(Type 1 servo system when the plant has no integrator)

In figure 2 we assume that the pendulum angle θ and the angular velocity  are small ,so that sin θ

 θ,cos θ  1,  2  0. We also assume that the numerical values of M, m and l are given as
  
M = 2 Kg, m = 0.1 Kg, l = 0.5m

Earlier in examples we derived the equation for the inverted -pendulum system shown in figure,
which is same as that in Figure 3-6, which is same as that in Figure 10-8, Referring to Figure 3-6, we
started with the force balance and torque-balance equations and ended up with equation (3-20) and
(3-21) to model the inverted-pendulum system. Referring to equation (3-20) and (3-21), the
equation for the inverted-pendulum control system shown in Figure 10-8 are

Ml Ӫ=(M+m)g θ-u(10-43)

Mẍ=u-mg θ(10-44)

When the given numerical values are substituted, Equations (10-43) and (10-33) become

Ӫ=20.601 θ -u(10-45)

ẍ=0.5u-0.4905 θ (10-46)

Let us define the state variables x₁,x₂ ,x₃ ,and x₄ as

x₁= θ

x₂ = 

x₃=x
x₄=ẋ

Then, referring to equations (10-45)and (10-46) and figure 10-9 and considering the cart position x as
the output of the system ,we obtain the equations foe the system as follows:

ẋ=Ax + Bu (10-47)

y =Cx (10-48)

u=-Kx+k₁  (10-49)

 =r-y=r-Cx (10-50)

 0 1 0 0 0 
 20.601 0 0 0   1 
  
 0 0 0 1 0 
   
A= 
0.4905 0 0 0 0.5
B=   , C=
0 0 1 0

For the type 1 servo system, we have the state error equation as given by Equation (10-40):

ė =Âe+Buₑ(10-51)

where

 0 1 0 0 0 0 
 20.601 0 0 0 0  1 
   
 0 0 0 1 0 0 
   
 A 0   0.4905 0 0 0 0  B  0.5
 C 0   0 0 1 0 0  , 0  0 
Â=  = B=   =  

And the counted signal is given by the equation (10-41):

uₑ= - K̂ e 

where

K̂ =[K ⁞ -k]=[k₁ k₂ k₃ k₄ ⁞ -kI ]


To obtain a reasonable speed and damping in the response of the designed system(for example,the
setting time of approximately 4~5 sec and the maximum overshoot of 15% ~16% the step response
of the cart),let us choose the desired closed-loop poles at s=  ₐ(a=1,2,3,4,5),where
 ₁=-1+j 3 ,  ₂=-1-j 3 ,  ₃=-5,  ₄=-5,  ₅=-5

We shall determine the necessary state-feedback gain matrix by the use of MATLAB .

Before we proceed further, we must examine the rank of the matrix Where

 A B
 C 0 
P= 

Matrix P is given by

 0 1 0 0 0 
 20.601 0 0 0 1 
 
 0 0 0 1 0 
 
 A B   0.4905 0 0 0 0.5 
 C 0  =  0 0 1 0 0 
P=  (10-52)

The rank of this matrix can be found to be 5. Therefore, the system defined by Equation (10-51) is
completely state controllable, and arbitrary pole placement is possible. MATLAB Program 10-6
produces the state feedback gain matrix K̂ .

MATLAB PROGRAM
A=[0 1 0 0;20.601 0 0 0;0 0 0 1;-0.4905 0 0 0];
B=[0;-1;0;0.5];
C=[0 0 1 0];
Ahat=[A zeroes(4,1);-C 0];
Bhat=[B;0];
J=[-1+j*sqrt(3) -1-j*sqrt(3) -5 -5 -5];
Khat=acker(Ahat,Bhat,J)

Khat=

-157.6336 -35.3733 -56.0653 -36.7466 50.9684

Thus we get

K=[k₁ k₂ k₃ k₄ ]=[-157.6336 -35.3733 -56.0652 -36.7466]

And
k= -50.9684

Unit Step Response Characteristics of the Designed System. Once we determine the feedback gain
matrix K and the integral gain constant k, the step response in the cart position can be obtained by
solving the following equation, which is obtained by substituting Equations (10-49)into Equations
(10-35):

 x   A  BK Bk 1  x  0
   C 0    1 
 =  + r (10-35)

The output y(t) of the system is x₃(t), or

 x
y=
 0 0 1 0 0   +[0]r (10-45)

Define the state matrix, control matrix, output matrix, and direct transmission matrix of the system
given by equation (10-53) and(10-54) as AA,BB,CC and DD, respectively .MATLAB Program 10-7 may
be used to obtain the step-response ,we entered the command

[y, x,t]=step(AA,BB,CC,DD,1,t)

Figure 10-10 shows curve x₁ versus t, x₂ versus t, x₃(=output y)versus t, x₄ versus t, and x₅ (=  ) vesus
t. Notice that y(t)[=x₃(t)] has approximately 15% overshoot and the setting time is approximately 4.5
sec.  (t)[=x₅(t)] approaches 1.1.This result can be derived as follows:Since

x ()  0  Ax()  Bu()

0  0 1 0 0 0  0 
 0   20.601 0 0 0   0   1
      
0  0 0 0 1 r   r 
       
 0  =  0.4905 0 0 0  0  +  0  u(  )

MATLAB PROGRAM
%****The following program is to obtain the step response
% of the inverted pendulum system just designed ****

A=[0 1 0 0;20.601 0 0 0;0 0 0 1;-0.4905 0 0 0 ];


B=[0;-1;0;0.5];
C=[0 0 1 0];
D=[0];
K=[-157.6336 -35.3733 -56.062 -36.7466];
KI= -50.9684;
AA=[A -B*K B*KI;-C 0];
BB=[0;0;0;0;1];
CC=[C 0];
DD=[0];

%****TO obtain the curve response x1 versus t,x2 versus t,


%x3 versus t,x4 versus t,and x5 versus t,saperately, enter
% the following command****

T=0;0.02;6;
x1=[1 0 0 0 0]*x’;
x2=[0 1 0 0 0 ]*x’;
x3=[0 0 1 0 0]*x’;
x4=[0 0 0 1 0]*x’;
x5=[0 0 0 0 1]*x’;

subplot(3,2,1);
plot(t,x1);
grid
title(‘x1 vesus t’)
xlabel(‘t sec’);
ylabel(‘x1’)

subplot(3,2,2);
plot(t,x2);
grid
title(‘x2 vesus t’)
xlabel(‘t sec’);
ylabel(‘x2’)

subplot(3,2,3);
plot(t,x3);
grid
title(‘x3 vesus t’)
xlabel(‘t sec’);
ylabel(‘x3’)

subplot(3,2,4);
plot(t,x4);
grid
title(‘x4 vesus t’)
xlabel(‘t sec’);
ylabel(‘x4’)

subplot(3,2,5);
plot(t,x5);
grid
title(‘x5 vesus t’)
xlabel(‘t sec’);
ylabel(‘x5’)
Curves x₁ versus t , x₂ versus t , x₃(=output y ) versus t, and x₄ versus t , and x₅(=  ) versus t.

We get

u(  )=0

Since u(  )=0, we have from equation (10-33),

u(  )=0=-Kx (  )+K1  (  )

and so

 (  )= 1 [Kx(  )]= 1 k3x3(  )= −56.0652 r=1.1r


K k −50.9684
Hence , for r=1 ,we have

  
= 1.1

It is noticed that , as in any design problem , if the speed and damping are not quite satisfactory,

then we must modify the desired characteristics equation and determine a new matrix K .Computer
simulations must be repeated until a satisfactory result is obtained.
The Mathematic Model for The Double Inverted
Pendulum
-----Based on State Feedback and T-S Model

Abstract: This paper introduces the configuration of the double inverted pendulum and
establishes the mathematic model based on state feedback and T-S model. Based on these, we can
keep the double inverted pendulum stable through hardware, at the same time we performed the
control of the double inverted pendulum in the state and the fuzzy control based on T-S model using
computer.

Key Words: The double inverted pendulum, mathematic model, state feedback, T-S model,
stable control.
1 Introduction
The research on the inverted pendulum has been for many years. The double inverted
pendulum is a typical nonlinear, multivariable and absolutely unstable dynamic system. One
can not only solve the control theory problem, hut also put the mechanics, mathematics and
electrics together through studying the inverted pendulum. Also, the inverted pendulum
provides a bridge for the engineering science from the control theory to the practice. The
double inverted pendulum is consisted of the cart fixed on the track and two pendulums. The
cart can move on the track forth and back. The goal is to make the inverted pendulum
balance, then the inverted pendulum gets the dynamic balance. The track of the inverted
pendulum can he horizontal or gradient. There we establish the mathematic model based on
the horizontal track. In order to analyse and design the control system and get the stable term,
we first establish the mathematical model of the system. In this paper, we adopt the state
feedback model and fuzzy control based on the T-S model for the double inverted
pendulum. According these models the double inverted pendulum can keep its real-time
dynamic balance using computer. Establish the mathematical model of the double
inverted pendulum based on the following suppose:
I ) Every pendulum is rigid;
2) The length of the belt doesn’t change, at the same time
the belt has no relatively slippage,
3) The force directly works on the cart without delay and
its magnitude is direct ratio to the input of the power
amplifier;
4) The rub is direct ratio to the relative velocity.
In this experiment, the double inverted pendulum is consist of the following components: the
smooth track which length is 90cm, the cart can move on the track forth and back , the first
aluminium pendulum is linked with the cart, and the second pendulum is linked with the
first pendulum. The lengths of the two pendulums are all 525cm. They move in the vertical
plane. The double inverted pendulum device is Figure 1.
2 The model of the State Space
First, we can establish the state feedback model for the cart on the horizontal
plane. At the same time, we also establish the model for the first pendulum and
the second pendulum. (The force represents only magnitude, [ -d( J + sin ), i +
[-d(l t cos 8,)1 i +not the direction) . Fig 2, Fig 3 and Fig 4 give the force of
the cart, the first pendulum and the second pendulum.
In order to get the Langarange equation, at first we write as the
following:
dy  dy  1
1 1 1
m
1 (x  I 1 sin  1)   I 1 cos  1 
 2 2
L=T-V= 2 J1  12+ 2 J2  22+ 2 o x 2+ 2 m1{[ dt ]}+  dt }+ ¿ ¿ m2{[
dy
(x  l1 sin  1  l 2 sin  2)
dt dy
2 (L 1 cos  1  L 2 cos  2)
] }+[ dt ]2-(m₁gl₁cosθ)2-
m₂g(L₁cosθ₁+l₂cosθ₂)
Then we can get the Langarange expression is the following:

d L L
 u
dt  q j  q j j=1,2…….S

S is the number of the free port. For the double inverted pendulum, S=3
, that is x, θ₁ , θ₂. We can get the equation of the state feedback:

 r   r 
1   1   G (u, 1,  2)
   
2   1,  2,  1,  2  2 
M(θ₁,θ₂) +F( )
J=1,2,3…..s

There q= 
r  1  2 r

 m0  m1  m 2 (m 1 l 1  m 2 L) cos  2 m2l 2 cos  2 


 (m 1 l 1  m 2 L) cos  1 m1l1 ^ 2  m2 L ^ 2  J 1 m2 Ll 2 cos( 1   2) 
 
 m 2l 2 cos  2 m 2 Ll 2 cos( 1   2) m 2l 2 ^ 2  J 2 
M(θ₂,θ₁)=

0 (m 1 l 1  m 2 L) 1 sin  2 m 2l 2 2 sin  2 


 
F ( 1,  2,  1,  2)  0 0 m 2 Ll 2 2 sin( 1   2) 
0 m 2 Ll 2 1 sin( 1   2) 0 
 

Θ1 and θ2 are all small, then we suppose the following:


θ1≈ θ₂≈0,
Cosθ1≈ cosθ₂' ≈ 1;
sin θ1≈θ₁; sin θ₂≈θ₂;
θ₂-θ₁≈0 ;cos(θ₂-θ₁)≈ l;sin(θ₂-θ₁)1≈ θ₂-θ;
Then we get the linear equations:
(m0+m1 +m2)  +(m1l1 + m2 l1 ) 1 + m 2 l2 2
 =u
(m1l1+m2l2)  +(J1+m1l12+m2l12 )  1 +m2L1l2  2 =(m1l1+m2L1)gθ₁
 

There
m0: the equal quality of the cart and the driving force
m1: the quality of the first pendulum
m2: the quality of the second pendulum
L1: the length from the axes to the axes of the pendulum
L1: the full length from the center of mass to the axes of the first pendulum
l2: the full length from the center of mass to the axes of the second pendulum
u: the force working on the cart
r: the level displacement of the cart removing from the center
θ₁ ,: the angle ofthe first pendulum relative to the vertical
θ₂: the angle of the second pendulum relative to the vertical
J1,: the moment of inertia of the first pendulum
J2: the moment of inertia of the second pendulum
During the experiment. the moments of inertia of the first and the second pendulum are very
small, so we ignore them. Another values are the following: m0=2.3287kg2 ml=0.22kg,
m2=0.16kg, L1=0.5m, 11 =0.32m, 12=0.26m. Thus we can come to a conclusion:
in order to make the double inverted pendulum balance, the node collocation is: -12.6015,
12.3326, 4.4773,-4.3080, 0.0018+0.1214i, 0.0018 - 0.1214i, also we can
get the state feedback ma&
K=[0.3 50 1.5 35 0.5 5.01]
Under the guidance of the state space mathematic model we
performed the stable control using the computer.

The T-S model


We still obey the suppose when we establish the T-S model. First we
establish the equation regarding the placement, the angle of the first
pendulum and the and the angle of the second pendulum as the state
variables, we get
 x   F 
1   (m 1 l 1  m 2 L1) g  1
   
2   m 2l 2 g 2 
M(θ1,θ2) =
There M(θ₁,θ₂) is the same as the above. During establishing the T-S model, we adopt the
triangle membership function. as follows:

Then u=-Kx. We can perform the real-time stable control of the double inverted pendulum. We can
make local linearity and get the following fuzzy model:
R: : If θ₁ and θ₂ are about zero, then = A1  + B₁u
R2p: If θ₁ is about zero and θ₂ is about  100, then
 = A₂  + B₂u

R3p: If θ₁ is about  1 2 ' ,θ₂ is about zero, then


 = A ₃ X + B₃ u

R4p: if θ₁ is about 120and θ₂ is about 100 ,or θ₁ is about -120 and θ₂ is about -100, then,

 =A  +B u
4 4

R5p:if θ₁ is about 12 and θ₂


0
is about -100 ,or θ₁ is about -120 and θ₂ is about 100, then,

 =A  +B u
5 5
There
 =  r r  1  1  2  2  r , in this experiment , the value of the variables are the same as the
state equation. We can get the location equation of every subsystem:

K1=[0.3 50 1.5 35 0.5 5.0]


K2=[0.2 60 1.2 40 1.0 5.5]
K3=[0.4 60 1.0 38 0.9 4.0]
K4=[0.5 55 0.8 43 1.0 6.0]
K5=[0.2 65 0.7 38 1.0 6.0]

Then we can make the double inverted pendulum Balance using the computer, moreover ,control based on the T-S model
is better than the control on the mathematical model.

Conclusion
All in all, the control on the inverted pendulum is always an important research, which can
influence the theory and application of the automatic control. The deep study on the stability
of the inverted pendulum will be the long-period and more important work.

You might also like