. .
.
Simple Inverted Pendulum System
.
.

Modeling

Click the RUN button and observe the graphs in the table below.

 For this example‚ let’s assume that
M,mass of the cart =0.5 kg
m,mass of the pendulum =0.5 kg
b, friction of the cart =0.1 N/m/sec
l, length to pendulum center of mass=0.3 m
I,inertia of the pendulum =0.006 kg*m2
F=force applied to the cart
x=cart position coordinate
Θ=pendulum angle from the vertical

 

The linear state space equation can be represented as follows:

After solving the value of these equations, the state space model gives the impulse response graph as shown below.

 

 

Impulse response of the pendulum. Impulse Response of the system

 The impulse response graph clearly shows that the system is unstable in open loop.

 

PID Controller

Click the RUN button and follow the steps mentioned below.


The Manual Tuning technique is used to derive the best tuning parameters to obtain stability for the system.The design criteria (with the pendulum receiving a 1N impulse force from the cart) are:


Settling time of less than 5 seconds.
Pendulum should not move more than 0.05 radians away from the vertical.


1. Setting kp=1, kd =1and k i =1 the following velocity response plot is obtained from the impulse disturbance.

Impulse response of the pendulum with kp=1, kd =1and k i =1

 This response is still not stable

2. So Increasing the proportional control oo the system and setting kp=100, kd =1and k i =1 the following velocity response plot is obtained.

 

Impulse response of the pendulum with kp=100, kd =1and k i =1

  3.The settling time is acceptable at about 2 seconds. Since the steady-state error has already been reduced to zero, no more integral control is needed. The integral gain constant can be removed to observe that the small integral control is needed. The overshoot is too high. To alleviate this problem, increase the kd variable. With kd=20,a satisfactory result is obtained and the following velocity response plot is observed:

 

Impulse response of the stable system (pendulum) with kp=100, kd =20and k i =1


As it is seen, the overshoot has been reduced so that the pendulum does not move more than 0.05 radians away from the vertical.

 

Using State Space Method

 Click the RUN Continously button and follow the steps mentioned below.

The design criteria for this system with the cart receiving a 0.2 m step input are as follows:


Settling time for x and Θ of less than 5 seconds.

Rise time for x of less than 1 second.

Overshoot of theta less than 20 degrees (0.35 radians).

Steady-state error within 2%.

 

1. Step response of the system using LQR controller with x=1, y=1 is shown in the figure below.

 

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 go down. The cart is not near the desired location but has in fact moved in the other direction.

2.Increasing x makes the settling and rise times go down, and lowers the angle the pendulum moves.Using x=5000 and y=100, the following and step response is obtained.
 

 

Step response of the system using LQR controller with x=5000, y=100.

 

By increasing the values of x and y the control effort used is more but the tracking error is less .It also improves the response. The system response has a settling time of under 2 seconds.

2. Adding Reference input

Step response of the system with LQR control adding the reference input with x=5000 and y=100


Now, the steady-state error is within the limits, the rise and settling times are met and the pendulum’s overshoot is within range of the design criteria.

3.Observer Design
Step response of the system from the observer point of view.

This response is about the same as before. All of the design requirements have been met with the minimum amount of control effort, so no more iteration is needed.

Using Frequency Response Method

Click the RUN button and observe the graphs in the table below. 

The design criteria (with the pendulum receiving a 1N impulse force from the cart) are:

  • Settling time of less than 5 seconds.
  • Pendulum should not move more than 0.05 radians away from the vertical.

Observe plots for various transfer functions.

 

1. For Transfer Function=1, enter 1 0 0 for numerator and 1 0 for denominator.

    The system is unstable in closed loop (no encirclements of -1).
2.Transfer function =(1/s);
   Gain……………1
   Here enter 1 0 0 for numerator and 0 1 for denominator and observe the response.

Notice that here the nyquist diagram encircles the -1 point in a clockwise fashion. Now we have two poles in the right-half plane

(Z= P + N = 1 + 1).

 

3. For Transfer Function=

Gain ........1

    Here enter 1 1 0 for numerator and 0 1 for denominator and observe the response.

 

    The encirclement around -1 is still clockwise. We are going to need to add a second zero.

Gain…………………..1;

 

Here enter 1 2 1 for numerator and 0 1 for denominator and observe the response.

 

We still have one clockwise encirclement of the -1 point.However, if we add some gain, we can make the system stable by shifting the nyquist plot to the left, moving the anti-clockwise circle around -1, so that N = -1.

 

5.Transfer function=

Gain……………..10

As you can see, the system is now stable.

 6. Try different combinations of poles and gains, a very reasonable response acn be obtained.
   Transfer Function=

Gain………………10

 

The response has met our design goals. Feel free to vary the parameters and observe what happens.

Thus, the cart moves in the negative direction and stabilizes at about -0.18 meters. This design might work pretty well for the actual controller, assuming that the cart had that much room to move. In this the cart’s position has also been stabilized .

Using Root Locus Method

The design criteria (with the pendulum receiving a 1N impulse force from the cart) are:

 

  • Settling time of less than 5 seconds.
  • Pendulum should not move more than 0.05 radians away from the vertical.

  

The open loop system is designed as discussed previously in theory of modeling of inverted pendulum.

  1.Root Locus

Root locus of the plant in unstable state.

  As we can see, one of the roots of the closed-loop transfer function is in the right-half-plane. This means that the system will be unstable. Part of the root locus lies between the origin and the pole in the right-half-plane. No matter what gain we chose, we will always have a closed-loop pole in this region, making the impulse response unstable. To solve this problem, we need to add another pole at the origin so all the zeros and poles at the origin will cancel each other out and multiple roots will be created in this right-half-plane region.

 2. Click the button below Root locus to obtain root locus with extra pole at the origin.


 We should get the following root locus plot with multiple roots in the right-half plane:

Root locus of the plant with extra pole at the origin.

 

3.Lead-lag controller

Now Select Lead-Lag controller from the combo box and observe the impulse response of the pendulum and cart’s position.

 
Impulse response of pendulum angle.
  Impulse response of cart position

 

  As observed, the cart moves at first, then is stabilized at near zero for almost five seconds, and then goes unstable. It is possible that friction (which was neglected in the modeling of this problem) will actually cause the cart’s position to be stabilized.

 

Using Digital Controller

Click the RUN button and follow the steps mentioned below.

 In this digital control version of the inverted pendulum problem, we will use the state-space method to design the digital controller.

 

The linear state space equation can be represented as follows:

 

where,

M

mass of the cart

0.5 kg

m

mass of the pendulum

0.5 kg

b

friction of the cart

0.1 N/m/sec

l

length to pendulum center of mass

0.3 m

I

inertia of the pendulum

0.006 kg*m2

u

step force applied to the cart

 

x

cart position coordinate

 

 Θ

pendulum angle from vertical

 

 

Outputs are the cart displacement (x in meters) and the pendulum deflection angle ( Θ in radians).
The design requirements are

 

  • Settling time for x and Θ less than 5 seconds
  • Rise time for x of less than 1 second
  • Overshoot of Θ less than 0.35 rad (20 deg)
  • Steady-state error of x and phi less than 2%

 

1.Setting x=1 and y=1,the following step response is obtained.

Step response of the system with LQR control setting x=1,y=1.

 

The pendulum’s and cart’s overshoot appear fine, but their settling times need improvement, and the cart’s rise time needs to be decreased. Also the cart has, in fact, moved in the opposite direction. For now, we will concentrate on improving the settling times and the rise times, and fix the steady-state error later.

 2.Setting the weighting factors x =5000 and y=100, the following step response graph is obtained.

Step response of the system with LQR control setting x=5000,y=100.

 

From this plot, all design requirements are satisfied except the steady-state error of the cart position (x).

 

Study the theory for more detailed understanding of the system.
3. With the previous values of x=5000 and y=100,select from the combo box, step response due to Reference input and Observer design .

 Both the reponse are identical since observer knows the plant exactly and has the same initial condition.

 

Cite this Simulator:

.....
..... .....

Copyright @ 2024 Under the NME ICT initiative of MHRD

 Powered by AmritaVirtual Lab Collaborative Platform [ Ver 00.13. ]