Chapter 15 Swing Up

11
Chapter 15. Swing-Up Control of Pendulum 1. Objectives of Experiment • To put the pendulum in the pendant position as swinging it while hanging the pendulum of the system by the swing-up control method using the energy control. • To control the pendulum using LQ control method when the pendulum is near to the pendant position . 2. Swing-up Control Overview We will configure the swing-up algorithm in the high-speed design device and execute the experiment to put the pendulum in the pendant position as swinging it and to control it only by the control input that is generated by the high-speed design device differently from the experiments up to Chapter 14 that we raise the pendulum by hand The swing-up control that we used in this experiment is done by the energy control that is suggested by Wiklund et al [1 . This method is known to be effective and powerful for the uncertainty and the noise influence of the system. We use the method to accelerate the pendulum to reduce the total energy of the pendulum using new Lyapunov function that is suggested by Yusuke Otani and three other people 2] in order to vertically control the pendulum and to put the cart to the desired location. The total energy of the pendulum is maximized when it is in the pendant position. And it is minimized when we put the pendulum in the pendant position as swinging it. Lyapunov function consists of two parts that is the sum total of the mechanical total energy and the multiply of the speed and the location of the cart. Firstly, the mechanical total energy is as shown in the formula (15.1).

Transcript of Chapter 15 Swing Up

Page 1: Chapter 15 Swing Up

Chapter 15. Swing-Up Control of

Pendulum

1. Objectives of Experiment

• To put the pendulum in the pendant position as swinging it while hanging the

pendulum of the system by the swing-up control method using the energy

control.

• To control the pendulum using LQ control method when the pendulum is near

to the pendant position .

2. Swing-up Control Overview

We will configure the swing-up algorithm in the high-speed design device and

execute the experiment to put the pendulum in the pendant position as swinging

it and to control it only by the control input that is generated by the high-speed

design device differently from the experiments up to Chapter 14 that we raise the

pendulum by hand

The swing-up control that we used in this experiment is done by the energy

control that is suggested by Wiklund et al[1. This method is known to be effective

and powerful for the uncertainty and the noise influence of the system. We use

the method to accelerate the pendulum to reduce the total energy of the

pendulum using new Lyapunov function that is suggested by Yusuke Otani and

three other people2] in order to vertically control the pendulum and to put the cart

to the desired location. The total energy of the pendulum is maximized when it is

in the pendant position. And it is minimized when we put the pendulum in the

pendant position as swinging it.

Lyapunov function consists of two parts that is the sum total of the mechanical

total energy and the multiply of the speed and the location of the cart. Firstly, the

mechanical total energy is as shown in the formula (15.1).

Page 2: Chapter 15 Swing Up

(15.1)

The absolute value of this energy is the maximum value as 2mgl when it is on

the lowest point and it is the minimum value as 0 when it is on the highest point.

The multiple of the speed and the location of the cart is as shown in the formula

(15.2).

(15.2)

is the proportional constant and . Lyapunov function is as shown in the

formula (15.3).

(15.3)

This function always has the positive value except the highest point. When the

pendulum is in the pendant position, the energy has the minimum value.

Therefore, you shall control to make this function always have the negative value.

Then, the derivative is as shown in the formula (15.4).

(15.4)

In this formula,

sgn(Ep) means the sign of Ep and if Ep is 0, it occurs during the very short time.

Then, it can be dismissed. Therefore, we define the control input to make the

derivative always negative value as shown in the formula (15.5).

(15.5)

Page 3: Chapter 15 Swing Up

Except when the denominator is 0, the derivative is always the negative

number. When the denominator is 0, it occurs for a very short time, then it can

be dismissed. However, we redefine as the formula (15.5) using ε as considering

the operation.

(15.6)

Here, is a certain proportional constant.

Let's present the control input as the voltage to swing and accelerate the

pendulum using the nonlinear motion equation of the pendulum system that is

expressed as the formula (11.1), (11.2) and (11.3) in Chapter 11. You can

express the formula (15.7) and (15.8) as the nonlinear notion equation again

using the formula (11.1), (11.2) and (11.3).

(15.7)

(15.8)

As we swing the pendulum as accelerating the cart, when we suppose ,

the formula (15.8) is expressed as the formula (15.9).

(15.9)

In addition, the relation between F and the voltage that is entered into the

motor in the formula (15.7) is expressed as the formula (15.10).

(15.10)

Substitute the formula (15.9) and (15.10) and in the formula (15.7),

and you can get the relation between the motor input voltage and as shown

in the formula (15.11).

Page 4: Chapter 15 Swing Up

(15.11)

Here, is as shown in the formula (15.12).

(15.12)

In the formula above, is . This means the

maximum value of the cosine related to the angle from the moment that we

swing the pendulum up to now. From when this value exceeds 0.4, that is to say,

when the pendulum is over the specific angle near the maximum point more than

once, G becomes 0.21. Then, only 21% of the control signal that accelerates the

pendulum is applied to the original signal. Therefore, it goes to the stable linear

area.

References

[1] A. Kristenson, M. Wiklund and K.J.Astrom, "A New Strategy for Swing up an

Inverted Pendulum", Preprint of IFAC 18th world Congress, vol. 9, pp151-154,

1993

[2] Akira Inoue Yusuke Otani, Takuya Kurokami and Yoichi Hirashima, "A

swingup control of an inverted pendulum with cart position control", NTCC 2001,

2001.

3. Swing-up Algorithm Configuration

For the swing-up control of the pendulum that we will execute the experiment,

we will accelerate the pendulum that is in the pendant position by the linear

control method that we explained in the paragraph 2. If the pendulum is near to

the pendant position , we will control the pendulum using LQ controller that is the

linear controller that is designed in Chapter 14. Then, we will maintain the

pendulum in the pendant position . When the pendulum is near to the pendant

position as we swing it on the basis of the swing algorithm, the threshold value in

Page 5: Chapter 15 Swing Up

the section that LQ controller is used is judged by the output as considering the

cosine value of the pendulum angle. That is to say, if cos(θ) is 0.94, we will

maintain the pendulum angle as 0 degree using LQ controller. [Figure 15.1]

illustrates the concept of the swing-up that is used in this experiment. If

cos(θ) is 0.4 as we swing the pendulum with the swing algorithm and apply the

cosine to the pendulum angle on the condition that the pendulum is in the

pendant position as shown in [Figure 15.1], we apply only 21% of the initial input

force to swing and stably maintain the pendulum near to the pendant position. At

the moment when cos(θ) is over 0.94, we maintain the pendulum in the pendant

position using LQ controller.

[Figure 15.1] Swing-up Diagram

Page 6: Chapter 15 Swing Up

[Figure 15.2] Swing Algorithm Block Configuration

The swing-up algorithm to maintain the pendulum of [Figure 15.1] in the

pendant position can be configured as shown in [Figure 15.2] using the generate

function block in the operation block of SIMTool. [Figure 15.2] is the configuration

inside the swing block of the reference files pch15_1.blk. u value of the formula

(15.6) is calculated in the switch block that has the name u in [Figure 15.2]. G

value in the formula (16.12) is calculated from the switch block that has the

name G. of the formula (15.11) is calculated from the generation function

block Va. The blocks that are configured above are combined as the super block

and enter into the swing block of [Figure 15.3]. You can check the detailed

configuration as double clicking the generate function block inside the super block

that has the name swing in the reference file pch15_1.blk.

4. Experiment

We learned the algorithm that swings and maintains the pendulum in the

pendant position in the paragraph 2 and 3 and configured the blocks in SIMTool

as shown in [Figure 15.2]. When the pendulum is swung and is near to in the

Page 7: Chapter 15 Swing Up

pendant position, we will configure the algorithm to maintain the pendulum in the

pendant position using LQ controller and apply it to the pendulum system.

(Note) The pendulum can clash the objects and the person around the pendulum

when it is swung. Therefore, be careful to prevent objects or people from

approaching to the radius of the rotation while the pendulum is swung.

Reference Files : lq_control.m (X:\CEMTool\Experiment\Pendulum\lq_control.m)

pch15_1.blk (X:\CEMTool\Experiment\Pendulum\pch15_1.blk)

[Step 1] Power on and Initialization of Pendulum System Turn the power of the pendulum system on. Put the switch on Mode of the

electric part of the pendulum system to Manual Mode. Turn the power on. Put the

cart to the center as pressing INITIALIZE button of MOVE. In addition, check if

the pendulum is connected and if it is not connected, connect it. And fix the

pendulum while it is in the pendant position.

[Step 2] Experiment Block Configuration

[Figure 15.3] Swing-up Algorithm (Reference File pch15_1.blk)

Page 8: Chapter 15 Swing Up

Let's configure the experiment block for the configuration and the experiment

of the swing-up controller to swing and maintain the pendulum in the pendant

position. You can configure the swing-up control block file of the pendulum like

pch15_1.blk using the energy control algorithm that we configured in the

paragraph 3, LQ controller block that we used in Chapter 14 and the observer

block(it is in pch14_2.blk). LQ controller to maintain the pendulum in the pendant

position and the swing algorithm that we configured in the paragraph 3 require all

state variables of the pendulum. Therefore, we shall use the state

observer(observer block). We can configure as shown in [Figure 15.3]. The

algorithm conversion for LQ controller and the swing that we designed in Chapter

14 is processed in the switch block called switch as shown in the concept of

[Figure 15.1]. The super block that has the name cos_value generates the cos

value of the pendulum angle and determines the conversion of the swing

algorithm and LQ controller algorithm. The super block named Swing_initial has

the role to enter the initial value for the swing and consists of the step blocks as

shown in [Figure 15.4].

[Figure 15.4] Inside swing_initial Block

[Step 3] Block Setup After completing the experiment block configuration, configure each block. Set

up the encoder block to receive by four multiples through the channel number 0

and 1 on RG-DSPIO board as shown in [Figure 15.5] and [Figure 15.6]. The

encoder receives the pendulum angle and the location signal of the cart.

Page 9: Chapter 15 Swing Up

[Figure 15.5] Encoder Block Setup to receive Pendulum Angle Signal

[Figure 15.6] Encoder Block Setup to receive Cart Location Signal

In addition, execute the reference file lq_control.m in CEMTool command

window for the observer block and LQ controller block, and all variables are

loaded and set up. And the analogue output file is set up as shown in [Figure

15.7]. The parameters are loaded if the reference file lq_control.m is executed.

Set the scope block as -0.2~0.2 in Angle(rad) and as -15~15 in Position(cm) to

check the pendulum angle and the cart location in real time. Refer to the

contents inside the reference file pch15_1.blk for the configuration of other blocks.

Page 10: Chapter 15 Swing Up

[Figure 15.7] Analogue output Block Setup

[Step 4] Hardware Setup and C-Code Generation Check if the hardware is set up as RG-DSPIO01 in 'Hardware Interface' window

that is displayed as selecting 'AUTOTool- Parameter‘ in SIMTool menu. Set up the

execution time in the setup window that is displayed as pressing 'Parameter

Setup' button of the window above. Set up the starting time as 0 sec. the ending

time as 60 sec. and the execution time as 0.001 sec. After completing the

execution time setup, press 'C-Code Generation and Compile' in 'Hardware

Interface' window, and convert the block that is configured by SIMTool to C-Code.

Transfer it to DSP board. After transferring to DSP board, DOS window is

displayed.

Page 11: Chapter 15 Swing Up

[Figure 15.8] Execution Time Setup

[Step 5] Execution Close the graph window after the transfer to DSP board is completed. Click

'Execution' button in 'Hardware Interface Window', and the graph window is

displayed. Put the switch on MODE of the electric part of the pendulum system

to CEMTool mode within 5 seconds after the graph window is displayed, and the

pendulum is swung and the swing-up control is started. [Figure 15.8] is the graph

window that is displayed after the execution. As shown in the result of [Figure

15.9], we can check that the pendulum is maintained in the pendant position at

18 sec. The convergence time of the pendulum is not always constant in every

experiment.

[Figure 15.9] Swing-up Control Experiment Result of Pendulum System