1.
up
2.
3.
software
(a)
Mathematica notebook
(b)
Mathematica notebook in HTML
(c)
Mathematica notebook in PDF

## EGME 511 (Advanced Mechanical Vibration) Final Project Stabilization of an inverted pendulum on moving cart using feedback control

February 25, 2015

### 1 Introduction

Given the following system

Need to ๏ฌnd control law to stabilize the inverted pendulum. First we need to obtain the equations of motions.

### 2 Analysis

Let the Lagrangian coordinates be and as shown. Let be the Lagrangian. Let be the kinetic energy of the system and let be the potential energy. Hence

and

Where is the linear velocity of the blob relative to the inertial system.

Hence, since , we obtain

Hence becomes

And since the blob is losing potential energy as it move downwards, we obtain as (assuming zero potential energy is the ground level)

Therefore the Lagrangian is

To obtain the equation of motions, we need to evaluate for each Lagrangian coordinate and is the generalized force for that coordinate. Hence for we obtain

Hence EQMย for is

Now we need to obtain for the coordinate . Apply a virtual displacement and determine the work done by

Hence the work done by is making virtual displacement is zero, since is not in the line of force along this displacement. Therefore, the EQMย for is from Eq (1) above

 (2)

Now we ๏ฌnd EQMย for coordinate

Hence EQMย for is

Now we need to ๏ฌnd for . Apply virtual displacement in the direction, and ๏ฌnd work done by

But , hence we see that , therefore, the EQMย becomes

 (3)

Conclusion: The two equations of motion are

Assuming small angle approximation gives

Now we solve for ย  and from Eqs (4) and (5). From Eq (5)

Substituting the above into Eq (4) gives

Using result for found in Eq (6) and substituting into (5) gives

To summarize what we have so far. We have obtained two linearized equations of motion for and and they are the following

Now we convert the equations to state space. Let , hence

Writing the above in the form we obtain

#### 2.1 Stability of open loop system

To determine the stability of the above system (now that it is a linear system since we have linearized it), we ๏ฌrst ๏ฌnd the equilibrium point. This is found by setting , and this results in , i.e. and . Notice that the value of is not important for the equilibrium point. Now we need to determine if this point is stable or not.

Hence

Since are all positive, we see that one root will be in the RHSย of the complex plane. Therefore the open loop system is unstable.

To stabilize it, we need to supply a control law to force the roots of the new matrix to be all in the LHS of the complex plane.

Let

Hence Eq (7) becomes

Therefore

Hence

 (8)

We now need to determine and . Assume we require that the closed loop poles be located at

Hence, the characteristic polynomial is

Compare Eqs (8,9)ย we obtain the following

or

Hence

Therefore, given we can ๏ฌnd which will generate force which will keep the poles of the closed loop system in the LHSย of the complex plane, and keep the inverted pendulum stable. For example, for , we obtain

### 3 Comparing solution with and without stabilizing control law

We will now generate the solution for some initial conditions and plot these solutions against time. In the ๏ฌrst case, we assume is zero. Hence we will observe that the system is unstable, i.e. will grow away from the marginally stable position which is and will not return back. Next, we will introduce as determined in the previous section, and observe the new solution to see that it remains near or at the position.

First, we need to decide on some initial conditions. These must be such that close to zero and for we can use . Hence, let

To determine , which is the solution of the system, we ๏ฌrst must solve equation (7) and (8) for the above IC.

The solution to (7) is given by solution to

 (10)

which is

Where

and

Taking Laplace transform of (10) we obtain

Hence

Therefore, the solution to

is

Therefore, the solution to which is is given by

Let , we plot the above solution for up to seconds

We plot the solution to (8), which is the state space equation with the stabilizing control law derived above,which is the following

where

Where the above values determined to cause the closed loop poles to be located at

Hence

To make the computation easier, we now substitute numerical values for all the above parameters , which are , and we obtain

and

Hence

Using and solving for we obtain

Using CAS system to matrix inverse the above and obtain the inverse Laplace transform, and pick the solution and plot it, we observe that now the system becomes stable as expected.

### 4 Conclusion

We observe from the above plots and the plots shown in the computation section that with the control law derived to force the poles of the closed loop to be stable, the inverted pendulum has been stabilized.

The ๏ฌnal angle that the inverted pendulum makes with the vertical does go to zero.

From the plot of the position , we see that the cart moves to the right and away from the position, then it return back to position, while in the same time, the pendulum swings back and forth about the position before it ๏ฌnally settles down at the stable position.

This shows the using pole placement resulted in an e๏ฌective control law which stabilized the system. Small angle approximation was used and the initial angle used was also assumed to be small.