Sunteți pe pagina 1din 14

Project Topic : Inverted Pendulum

Submitted by Muhammad AbdulRehman


CMS # 14141
MS-EE
Instructor : Dr Zeeshan Khan

Problem and design requirement :


A Cart with an inverted pendulum hinged on the top of it . The Cart and the
pendulum are assumed to move in plane and the friction the mass of the stick and
the gist of wind are disregarded. The problem is to maintain the pendulum at the
vertical position for example if the inverted pendulum is falling in the direction
shown . The Cart moves to right and exerts a force through the hinge to push the
pendulum back to the vertical position

For this example, let's assume the following quantities:


(M)

mass of the cart

(m)

mass of the pendulum

(b)

coefficient of friction for cart

0.9 kg
0.1 kg
0 N/m/sec

(l)

length to pendulum center of mass

23.5

(I)

mass moment of inertia of the pendulum 5.3 gm.m^2

Transfer function
P_cart = (((I+m*l^2)/q)*s^2 - (m*g*l/q))/(s^4 + (b*(I + m*l^2))*s^3/q - ((M +
m)*m*g*l)*s^2/q - b*m*g*l*s/q)
P_pend = (m*l*s/q)/(s^3 + (b*(I + m*l^2))*s^2/q - ((M + m)*m*g*l)*s/q b*m*g*l/q)

State-Space
A = [0
1
0
0;
0 -(I+m*l^2)*b/p (m^2*g*l^2)/p 0;
0
0
0
1;
0 -(m*l*b)/p
m*g*l*(M+m)/p 0];
B=[
0;
(I+m*l^2)/p;
0;
m*l/p];
C = [1 0 0 0;
0 0 1 0];
D = [0;
0];

Open loop impulse response


Open-Loop Impulse Response
From: u

1.5

T o: x

Am plitude

0.5

0
0.05

T o: phi

0.04
0.03
0.02
0.01
0

0.1

0.2

0.3

0.4

0.5

0.6

Time (seconds)

0.7

0.8

0.9

Step responce Open Loop


We can now examine the open-loop impulse response of the system. Specifically,
we will examine how the system responds to an impulsive force applied to the cart
employing the MATLAB command impulse.

Open-Loop Step Response

50

x
phi

45

40

35

30

25

20

15

10

0.5

1.5

2.5

Pid control
An impulse response of the PID compensated system is shown in following figure.
The
impulse response of the compensated system is shown in the figure. when

Kp = 1
Ki = 1
Kd = 1
C = pid(Kp,Ki,Kd)
T = feedback(P_pend,C)

As it is cleared from both the Matlab and simulink waveforms that it is exponential
growing function, so which means that the system is unstable
An impulse response of the PID compensated system is shown in following figure.
The
impulse response of the compensated system is shown in the figure. when
Kp = 22;
Ki = 0.01;
Kd = 30;
C = pid(Kp,Ki,Kd);
T = feedback(P_pend,C);
t=0:0.01:10;

Response of Pendulum Position to an Impulse Disturbance under PID Control: Kp = 22, Ki = 0.01, Kd = 30
0.025

0.02

Amplitude

0.015

0.01

0.005

-0.005

10

Time (seconds)

As it is cleared from both the waveforms that the system is now stable having
settling time less than 9sec and overshoot less than 5%, means that our required
design criteria is achieved.

Root Locus Controller Design :


We will now begin to design a controller for our system employing a root locus
design method

Root Locus of Plant (under Proportional Control)

0.4
0.3

Imaginary Axis (seconds-1)

0.2
0.1
0
-0.1
-0.2
-0.3
-0.4
-0.8

-0.6

-0.4

-0.2

0.2

0.4

0.6

0.8

Real Axis (seconds -1)

After simulation, selecting a Point on Root Locus waveform to find the value of k
which appears in the command window. After Selection of a point on root locus
waveform, Step response waveform and pole-zero map waveform of the
compensated system will appear.

Roor locus with Integral controller :


Here we show Root Locus with Integral Control.

Root Locus w ith Integral Control

4
3

Imaginary Axis (seconds-1)

2
1
0
-1
-2
-3
-4
-5

-4

-3

-2

-1

Real Axis (seconds -1)

Let's also examine the locations of the system's open-loop poles and zeros so that
we may begin to think about how to draw the root locus branches into the left-half
plane.

Root Locus with Pid Controller :


Here we show Root locus with pid control .

Root Locus w ith PID Controller

8
6

Imaginary Axis (seconds-1)

4
2
0
-2
-4
-6
-8
-20

-15

-10

-5

-1

Real Axis (seconds )

Examining the above root locus helps us to determine whether or not our given
requirements can be met. Specifically, since it is desired that the settling time of the
system be less than 5 seconds

The cart position:

-3
x 10 Response of Pendulum Angle to an Impulse Disturbance under PID Control

Amplitude

-1

-2

-3

0.5

1.5

2.5

Time (seconds)

Here we examine thar the cart become stable in 2sec but over shoot is very high .

Response of Cart Position to an Impulse Disturbance under PID Control

25

20

Amplitude

15

10

-5

-10

Time (seconds)

Here we examine that the pendulum become unstable .

LQR controller :

-3

Step Response with LQR Control

-0.1

cart position (m)

-0.2

0.5

1.5

2.5

3.5

4.5

pendulum angle (radians)

0.1

x 10
4

-2
5

The curve in green represents the pendulum's angle in radians, and the curve in
blue represents the cart's position in meters. As we see, this plot is not satisfactory.
The pendulum and cart's overshoot appear fine, but their settling times need
improvement and the cart's rise time needs to be reduced.

cart position (m)

-5

Step Response with LQR Control

x 10
10

-1

-2

-3

0.5

1.5

2.5

3.5

4.5

The above result has become find after changing the values of Q

-2
5

pendulum angle (radians)

-3

x 10

-3

Step Response with LQR Control

-0.05

cart position (m)

-0.1

0.5

1.5

2.5

3.5

4.5

pendulum angle (radians)

0.05

x 10
2

-1
5

Conclusion:
Although an inverted pendulum model is simple to design and run simulation in
theory, practical implementation of the real circuit was difficult to match to the
simulation results, since most of the time simulations are related to near ideal
situations.
There were many non-idealities that had to be considered when
implementing the actual circuit, such as by-passing, noise reduction and oscillations
etc. Without correcting these problems, it would not be possible to build a circuit
that satisfies specific controlling needs.

S-ar putea să vă placă și