up
PDF letter size
PDF legal size

EGME 511 (Advanced Mechanical Vibration) Final Project

Stabilization of an inverted pendulum on moving cart using feedback control

Nasser M. Abbasi

Spring 2009 compiled on — Monday January 01, 2018 at 11:28 PM

Contents

1 Introduction
2 Analysis
 2.1 Stability of open loop system
3 Comparing solution with and without stabilizing control law
4 Conclusion

1 Introduction

Given the following system

pict

Need to find control law u (t)  to stabilize the inverted pendulum. First we need to obtain the equations of motions.

2 Analysis

Let the Lagrangian coordinates be θ  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. Hence

L = T  − U

and

T =  1M x˙2 + 1-mv2
     2       2

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

pict

Hence, since v =  lθ˙  , we obtain

pict

Hence T  becomes

                 (                     )
     1-   2   1-    2   2 ˙2       ˙
T =  2M  ˙x +  2m   ˙x +  lθ  + 2x˙lθ cosθ

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

U = mgl cos θ

Therefore the Lagrangian is

pict

To obtain the equation of motions, we need to evaluate   (   )
d- -∂L-    ∂L-
dt ∂q˙i  − ∂qi = Qi  for each Lagrangian coordinate qi  and Qi  is the generalized force for that coordinate. Hence for θ  we obtain

pict

Hence EQM for θ  is

pict

Now we need to obtain Q  for the coordinate θ  . Apply a virtual displacement δθ  and determine the work done by u (t)

pict

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

ml¨θ + m ¨x cosθ − mg  sin θ = 0
(2)

Now we find EQM for coordinate x

pict

Hence EQM for x  is

pict

Now we need to find Q  for x  . Apply virtual displacement in the x  direction, and find work done by u

pict

δW  =  u(δx)

But      δW-
Q  =  δx  , hence we see that Q =  u  , therefore, the EQM becomes

(M  + m ) ¨x + ml ¨θ cosθ − mlθ˙2 sin θ = u
(3)

Conclusion: The two equations of motion are

pict

Assuming small angle approximation gives

pict

Now we solve for  ¨x  and ¨θ from Eqs (4) and (5). From Eq (5)

            ¨
x¨=  u-−--mlθ-
     (M  + m )

Substituting the above into Eq (4) gives

pict

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

pict

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

pict

Now we convert the equations to state space. Let x1 = x,x2 =  ˙x,x3 = θ,x4 = θ˙  , hence

        )                  )                       )
x1 =  x |      ˙x1 = ˙x = x2 |      ˙x1 = ˙x = x2      |
x  =  ˙x |}      ˙x =  ¨x      |}      ˙x  = −-gm-θ+  u-  |}
  2       →     2   ˙         →    2    ˙M     M
x3 =  θ ||)      ˙x3 = θ = x4 ||)      ˙x3 = θ = x4      ||)
x4 =  ˙θ        ˙x4 = ¨θ             ˙x4 = −-u+(M+Mml--)gθ

˙x1 =  x2
˙x2 =  −-gmx3-+  u-
˙x  =  x M      M
 3     4 g(M+m-)-  -u-
˙x4 =  x3   Ml   − Ml

Writing the above in the form X˙ = AX  +  Bu  we obtain

pict

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 first find the equilibrium point. This is found by setting ˙x = 0  , and this results in x2 = 0,x3 = 0, x4 = 0  , i.e. x˙=  0,θ = 0,  and ˙
θ = 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.

pict

Hence

     {      1 ∘  --------------   1 ∘  -------------}
λ =    0,0,----  M gl(M  + m ),− ----  M gl(M  + m )
           M l                   M  l

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

pict

Hence Eq (7) becomes

pict

Therefore

pict

Hence

 4    3(f4-−-l-f2)    2(f3 −-M--g −-g m-−-l-f1)    -g-f2   g-f1
λ  + λ    M   l   + λ            M  l          +  λM   l + M  l = 0
(8)

We now need to determine f1,f2,f3   and f4   . Assume we require that the closed loop poles be located at

λ = { − 1,− 2,− 1 + i,− 1 − i}

Hence, the characteristic polynomial is

pict

Compare Eqs (8,9) we obtain the following

pict

or

pict

Hence

pict

Therefore, given M, m, g, l  we can find f1,f2,f3,f4   which will generate force u (t)  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                                       2
M  =  1kg,m  = 0.1kg,l = 1,g = 10m  ∕s   , we obtain

pict

3 Comparing solution with and without stabilizing control law

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

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

pict

To determine 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

˙x =Ax
(10)

which is

             At
x(t) = x (0)e

Where

       (      )
         x1 (t)
       || x2 (t)||
x (t) = ( x3 (t))
         x  (t)
           4

and

        ( x (0))    (  0)
        |  1   |    |   |
x (0) = | x2(0)|  = | x˙0|
        ( x3(0))    ( θ0)
          x4(0)       θ˙0

Taking Laplace transform of (10) we obtain

pict

Hence

         −1[         −1]
x (t) = ℒ    (sI − A )   x (0)

Therefore, the solution to

(    )    (                 ) (   )
  x˙1        0  1     0    0     x1
|| x˙2 ||    || 0  0   −Mgm-   0 || || x2||
( x˙3 ) =  ( 0  0     0    1 ) ( x3)
  x˙        0  0  g(M+m--) 0     x
    4               Ml           4

is

pict

Therefore, the solution to x3 (t)  which is θ (t)  is given by

               ∘ ----------------         ∘ ---------------
                  1                  sinh t   1Ml (M g + gm )
θ(t) = θ0cosh t  ----(M g + gm ) + ˙θ0--∘-------------------
                 M l                      M1l-(M g + gm )

Let      π- ˙
θ0 = 10,θ0 = 1rad∕ sec  , we plot the above solution for t = 0  up to 10  seconds

pict

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

(   )    (                                              )  (   )
  ˙x1          0       1              0              0        x1
| ˙x2|    |  -1f1     1-f2       1-f3 − 1-gm        -1f4 |  | x2|
|( ˙x |)  = |(  M 0      M0         M    0 M           M1   |)  |( x |)
   3         -1-     -1-    1-g            -1-      1--       3
  ˙x4       − Mlf1  − Ml f2  M l (M +  m) − Ml f3  − Mlf4     x4

where

pict

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

{− 1,− 2,− 1 + i,− 1 − i}

Hence

pict

To make the computation easier, we now substitute numerical values for all the above parameters, which are M  = 1kg, m = 0.1kg, l = 1, g = 10m ∕s2   , and we obtain

           (                                  ) −1 (   )
              s     − 1         0          0         0
        − 1|| − f1  s − f2    1 − f3      − f4 ||    || ˙x0||
x(t) = ℒ   (  0      0          s         − 1 )    ( θ0)
              f1     f2   f3 − 10 (1.1 ) s + f4       ˙θ
                                                      0

and

pict

Hence

pict

Using      π- ˙
θ0 = 10,θ0 = 1rad∕ sec, ˙x0 = 1m ∕ sec,  and solving for θ(t)  we obtain

            (                                   ) −1(   )
               s     − 1         0           0         0
         −1 || − 0.4 s − 1      − 20.4       − 6 ||   ||  1||
x (t) = ℒ   (  0      0          s          − 1 )   (  π10)
              0.4     1    21.4 − 10(1.1)  s + 6       1

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

pict

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 final angle θ  that the inverted pendulum makes with the vertical does go to zero.

From the plot of the position x(t)  , we see that the cart moves to the right and away from the x = 0  position, then it return back to x = 0  position, while in the same time, the pendulum swings back and forth about the θ = 0  position before it finally settles down at the stable position.

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