The objectives of this part of the laboratory experiment on the rotary inverted pendulum are as follows:
Use energy-based control schemes to develop a swing-up pendulum controller.
Implement the swing-up controller on the Quanser Rotary Pendulum plant and evaluate its performance.
In this section a nonlinear, energy-based control scheme is developed to swing the pendulum up from its hanging, downward position. The swing-up control described herein is based on the strategy outlined in [3]. Once upright, the control developed to balance the pendulum in the upright vertical position can be used.
The dynamics of the pendulum can be redefined in terms of pivot acceleration (see Figure 9) as
Given
sufficient condition for asymptotic stability is
Also, the reference energy of the pendulum in equilibrium in its fully upright position as compared to its fully downward position becomes
Taking the time derivative of Equation 35, we get
Taking the time derivative of Equation 38, we get
Now, we replace the bracketed term on the right-hand side of Equation 41 using the equation of motion of the pendulum obtained in Equation 31 to get
Substituting Equation 42 in Equation 38, the time rate of change of the selected Lyapunov equation becomes
With the above selection of control law for the pivot acceleration, Equation 43 becomes
Now, for the quickest change in energy, we may want to use the maximum controller input (acceleration of the pivot), i.e.,
but this controller can lead to chattering. Instead, we use
Recall that the acceleration of the pendulum pivot is related to the torque applied on the rotary arm
Additionally, from Equation 9 of the balance controller design section, we have
Then, the voltage supplied to the rotary base motor is obtained by combining Equations 48 and 49 as
The selected nonlinear control law will swing up the pendulum from the downward position towards the upright position. Once the pendulum is near the upright position, it is balanced around the fully upward position using the linear balance controller.
The energy-based swing-up control can be combined with the balancing control in Equation 29 to obtain a control law that performs the dual tasks of swinging up the pendulum and balancing it. This can be accomplished by switching between the two control systems.
Basically, the same switching implemented for the balance control in Equation 30 is used. Only instead of feeding 0 V when the balance control is not enabled, the swing-up control is engaged. The controller therefore becomes
Run the part2setup.m script extracted from the Part 2.zip file in the 'Balance Control' section.
Check if the correct gain K value is loaded onto the workspace.
Open q_rotpen_swingup_student_2 Simulink diagram.
After the link swings up and is balanced, wait for ~5 seconds and stop the SIMULINK.
OPTIONAL: Save the data_alpha, data_theta, and data_Vm. Ensure that the data variables have 10 seconds of data saved.
Briefly summarize the swing-up controller experiment and your observations. Did the swing-up control behave as you expected?
[3] K. J. Åström and K. Furuta. Swinging up a pendulum by energy control. 13th IFAC World Congress, 1996.
The pivot acceleration, , is the linear acceleration of the pendulum link base. The acceleration is proportional to the torque of the rotary arm and is expressed as
According to Lyapunov’s stability theory, a sufficient condition for asymptotic stability of a nonlinear system about an equilibrium point is that the first time derivative of a selected Lyapunov’s function () is negative, i.e.,
Let us select a candidate Lyapunov function for arriving at the control law as a quadratic function of the difference in total energy () and the reference energy () when the pendulum is in equilibrium in the upright position, i.e.,
where the total energy () is the sum of kinetic energy and potential energy .
Now, we need to select such that for asymptotic stability. This can easily be achieved by selecting as
which guarantees .
The selected control law (Equation 44) will continuously decrease the difference between current energy () and the energy of the pendulum in the vertically up position (). Note that the selected control law is nonlinear, it changes sign for and .
where is a tunable controller gain.
Where from Equation 47,
where
The parameter in Equation 51 is a user-selected range of over which the balance controller becomes active.
To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.
Press Connect button under Monitor & Tune and Press Start . The pendulum should be moving back and forth slowly. Gradually increase until the pendulum goes up. You may do this by increasing the gain slider. When the pendulum swings up to the vertical upright position, the balance controller should engage and balance the link.