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

by Nasser Abbasi

\clearpage


Introduction

Given the following system
diagram.png
Need to find control law $u\left( t\right) $ to stabilize the inverted pendulum. First we need to obtain the equations of motions.

Analysis

Let the Lagrangian coordinates be $\theta$ and $x$ as shown. Let $L$ be the Lagrangian. Let $T$ be the kinetic energy of the system and let $U$ be the potential energy. HenceMATH and MATH Where $v$ is the linear velocity of the blob $m$ relative to the inertial system.
blob.png
Hence, since $v=l\dot{\theta}$, we obtainMATH Hence $T$ becomesMATH And since the blob is losing potential energy as it move downwards, we obtain $U$ as (assuming zero potential energy is the ground level)MATH Therefore the Lagrangian isMATH To obtain the equation of motions, we need to evaluate MATH for each Lagrangian coordinate $q_{i}$ and $Q_{i}$ is the generalized force for that coordinate. Hence for $\theta$ we obtain MATH Hence EQM for $\theta$ isMATH Now we need to obtain $Q$ for the coordinate $\theta$. Apply a virtual displacement $\delta\theta$ and determine the work done by $u\left( t\right) $
virtual_work_theta.png
Hence the work done by $u$ is making virtual displacement $\delta\theta$ is zero, since $u$ is not in the line of force along this displacement. Therefore, the EQM for $\theta$ is from (1) aboveMATH Now we find EQM for coordinate $x$

MATHMATH Hence EQM for $x$ isMATH Now we need to find $Q$ for $x$. Apply virtual displacement in the $x$ direction, and find work done by $u$
virtual_work_x.png
MATH But MATH, hence we see that $Q=u$, therefore, the EQM becomesMATH

Conclusion
The 2 EQM found areMATH

Assume

small angle approximation
, we obtainMATH

Now, solve for $\ddot{x}$ and $\ddot{\theta}$ from (4) and (5). From the second equation above, eq (5) we findMATH Substitute the above into eq (4) we obtainMATH

Now, using result for $\ddot{\theta}$ found in (6), substitute into (5) we obtainMATH

Hence, to

summarize what we have so far
. We have obtained 2 linearized equations of motion for $\theta$ and $x$ and they are the following

MATH

Now convert to state space. Let MATH, hence MATHMATH Writing the above in the form $\dot{X}=AX+Bu$ we obtainMATH

Stability of open loop system

To determine the stability of the above system (it is a linear system now, since we have already linearized it), we first find the equilibrium point. This is found by setting MATH, and this results in MATH, i.e. MATH and $\dot{\theta}=0$. Notice that the value of $x$ is not important for the equilibrium point. Now we need to determine if this point is stable or not.

MATH

Hence

MATH

Since $M,l,m,g$ 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 $u$ to force the roots of the new $A$ matrix to be all in the LHS of the complex plane.

Let MATH

Hence (7) becomes

MATH

Therefore

MATH

Hence

MATH

We $\allowbreak$now need to determine $f_{1},f_{2},f_{3}$ and $f_{4}$. Assume we require that the closed loop poles be located at

MATH

Hence, the characteristic polynomial is

MATH

Compare (8) and (9) we obtain the following

MATH

or

MATH

Hence MATH

Therefore, given $M,m,g,l$ we can now find MATH which will generate force $u\left( t\right) $ 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 MATH, we obtain

MATH

Comparing solution with and without stabilizing control law

We will now generate the solution MATH for some initial conditions and plot these solutions against time. In the first case, we assume $u\left( t\right) $ is zero. Hence we will observe that the system is unstable, i.e. MATH will grow away from the marginally stable position which is $\theta=0^{0}$ and will not return back. Next, we will introduce $u\left( t\right) $ as determined in the previous section, and observe the new solution to see that it remains near or at the $\theta=0^{0}$ position.

First, we need to decide on some initial conditions. These must be such that MATH close to zero and for $x\left( 0\right) $ we can use $zero$. Hence, let MATH

To determine $\QTR{bf}{y}$, which is the solution of the system, we first must solve equation (7) and (8) for the above IC.

The solution to (7) is given by solution to MATH which is MATH

Where MATH and MATH

Taking Laplace transform of (10) we obtain

MATH

Hence

MATH

Therefore, the solution to

MATH

is

MATH

Therefore, the solution to MATH which is MATH is given by

MATH

Let MATH, we plot the above solution for $t=0$ up to $10$ seconds


unstable_theta.png

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

MATH

where

MATH

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

Hence

MATH

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

MATH

and

MATH

Hence

MATH

Using MATH and solving for MATH we obtain

MATH

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


stable_theta.png

Conclusion

We observe from the above plots and the plots shown in the computation section below, that with the control law derived to force the poles of the closed loop to be stable, the inverted pendulum has been stabilized and the final angle $\theta$ that the inverted pendulum makes with the vertical does go to zero. From the position $x(t)$ plot, we see that the cart move to the right away from the $x=0$ position, then it return back to $x=0$ position, while in the same time, the pendulum has swung back and forth about the$\theta=0$ position before it finally settles down the at the stable position. This shows the using pole placement will result in an effective control law which stabilized the system. We have assumed small angle approximation here, and the initial angle used was small.