The Reaction Wheel Pendulum: An Interactive Virtual Laboratory for Control Education

—This paper describes a virtual laboratory which illustrates a real-world application of fundamental control principles: the Reaction Wheel Pendulum. The goal of the paper is to motivate students to learn in a practical way different fundamental aspects of control processes. The laboratory has been developed using the programming support provided by Easy Java Simulations, an open-source tool for teachers with limited programming skills who want to create Java applications and applets


INTRODUCTION
The role of computer technology in education is increasing at a tremendous rate. The effectiveness of interactive learning environments in the educational processes has deeply modified the teaching methods and the notion of education itself. In engineering education integration of new technologies in the classroom has changed the approach of control learning [1]. Theoretical knowledge is transmitted to the students mostly in classrooms but practical skills in engineering requires hours of work in a laboratory [2].
In a virtual laboratory [3], [4], [5] users can perform experiments on simulated systems by means of special software. Using it, the student has an excellent opportunity to "experiment" with his or her own ideas in terms of engineering design by simple interaction with the tool. With respect to a conventional laboratory, an interactive virtual laboratory allows more efficient management of the resources (in terms of space and time) available for students [6], [7].
In this context, the Reaction Wheel Pendulum [8] has received a great attention because it presents interesting properties in both control education and research. The pendulum is a very relevant non-linear system. Many systems have a similar behavior, for instance: in the Ballistic Walking model, the Stance Leg in contact with the ground or the Swing Leg as a freely swinging pendulum, suspended from the hip.
This work describes a virtual control laboratory developed for this system. This laboratory has been developed using Easy Java Simulation, Ejs in short [9]. Its objective is to allow the execution of control experiments of educational and research interest. It provides interactive experiences aimed that increase students' understanding of the general principles involved in the experiments. For instance, students can easily simulate and study the behavior of the system when disturbances are applied.
The paper is organized as follows. In Section II the system is described. Section III shows the virtual laboratory developed in Ejs. Section IV presents the validation of the mathematical model. Section V illustrates some typical control experiences with the laboratory. And finally some conclusive remarks are presented.

A. Description of the system
The Reaction Wheel Pendulum system has been described by Prof. Aström et al. in [8]. Fig. 1 shows the real plant of this system.
This system (see Fig. 2) consists in a simple pendulum with a rotating wheel. The wheel is actuated by a 24-Volt permanent magnet DC-motor and the coupling torque between the wheel and the pendulum can be used to control the motion of the system. The Pendulum may be thought as a simple pendulum in parallel with a torque controlled lumped inertia. To this end, the system is provided with two optical encoders: The first is attached to the fixed mounting bracket with its rotor shaft attached to the pendulum link. In Fig. 2 it is designed by θ, the angle from the vertical to the pendulum measured counterclockwise.
The second encoder is attached to the motor fixed at the end of the pendulum. Its rotor shaft is attached to the rotating wheel and thus provides the rotation angle between the pendulum and the wheel. In Fig. 2 this angle is φ r .
With these two angles the Reaction Wheel Pendulum has two degrees of freedom There is a relation between both angles, given by where θ r is the whole angle of the rotation from the vertical line.
The model of the system is described in details in [8]. Using the Lagrangian method the equations of the system are: These equations are characterized by three fundamental parameters: ω p 2 = (mgl)/J, k/J and k/J r . Where ω p is the frequency of small oscillations around the hanging position, m is the combined mass of rotor and pendulum, g presents the gravity, l is the distance from the pivot to the center of mass of the pendulum and rotor, J is the moment of inertia of the system, k is the torque constant of the motor and I is the motor current and J r is the moment of inertia of the rotor about its center of mass.

B. Control strategy
The principal control objective for this system is to stabilize the pendulum in the inverted position (when θ = π). A second goal is to control the wheel velocity through the control of the wheel angle (θ r ) A proportional -derivative (PD) control [10] is used for these purposes.
As [8] shows, this control strategy is defined by Where the parameters of the controller, k pp , k dp , k pr and k dr , are the proportional and derivative constants for the control of the pendulum and the wheel respectively. These parameters are dependent on the damping factors (ζ 1 , ζ 2 ) and on the characteristics frequencies of the output (ω 1 , ω 2 ), see [8] for details. Subscript 1 refers to the pendulum and subscript 2 to the wheel. θ 0 represents the angle of the initial position of the pendulum.

III. DESCRIPTION OF THE VIRTUAL LABORATORY
The laboratory has been developed using Ejs (Easy Java Simulations) [9]. Ejs simulations are created by specifying a model to be run by the Ejs simulation engine and by building a view to visualize the model state that readily responds to user interactions. To create a Ejs laboratory are necessary three steps.
The first step in the design of the laboratory using this tool is to define the necessary variables and constants to model and to simulate the system. The second step is to build the mathematical model. This tool requires the model of the system to be defined by differential equations (see Section II).
The third step is to make the view. To this end it is very important to design a nice interface to facilitate the student the understanding of the virtual laboratory. In Fig. 3 the main window of the simulation is shown. It has two main parts: one represents the system with the buttons to manage it, and the other the graphics which show its evolution.
On the left the movement of the pendulum and the rotor is shown. The black stick represents the pendulum and the black disc with a white line (to simulate the rotation) represents the wheel. Moreover there are three buttons to Play, Stop and Reset the simulation and four displays to show and modify the controller parameters (see (3)).
Below the pendulum five displays are also available to change the damping factors (ζ 1 , ζ 2 ), the frequencies (ω 1 , ω 2 ) and the initial position for the pendulum θ 0 . By modifying the value of these parameters the desired response can be obtained.
The evolution of the system is displayed in four different graphics. The one located below the displays show the angular velocity of the wheel. The other three, on the right, represent the principal angle of the system (θ, φ r and θ r ).

IV. VALIDATION OF THE MODELED SYSTEM
To validate the model, several experiments have been carried out and then compared with the behavior of the real plant The first experiment is to consider that there is no control torque, so (2) can be changed by the following: Notice that if the pendulum is initialized at an angle θ 0 it will oscillate with constant amplitude. The second equation in (4) is a double integrator, so if the angle θ r and its derivative are zero the angle will remain zero for all times.
iJOE -Volume 6, Issue 3, August 2010   Fig. 4 is shown the motion for the pendulum when θ 0 = 0.5 and there is no control applied. Fig. 5 shows the real plant results for this experiment. As it was expected the behaviors of the pendulum angles of the simulated system and the real model are both unstable.
The rotor angle, however, is nearly identical to the pendulum angle, which is not predicted by the model. The reason is the friction between the pendulum and the rotor. The second experiment to validate the model is based in the energy balance which is defined as follows: In this case, after introducing the friction torques to the system and approximating θ = θ r , the obtained results are shown in Fig. 6 and Fig. 7. With these experiments the validity of the model has been checked and it can be concluded that it is suitable for the plant.
V. CONTROL EXPERIENCES This section describes some control experiments the our students need to complete using the virtual laboratory described in this paper.

A. Disturbance Rejection
The first experience is proposed to analyze how the system works when a disturbance occurs.
When student induces a small deviation, for instance, 0.02 radians, the system becomes stable and the angle of the pendulum returns to the upright position in 2 or 3 seconds. If the induced deviation is bigger, for example 0.04 radians, the system is still able to achieve the stabilization. Fig. 8 shows these results. So that, the aim of control proposed is obtained.

B. Limitations system analysis
Student can also check which is the maximum disturbance that the system is able to reject. To this end, the student can progressively increase the disturbance value until the system becomes unstable.
The maximum motor speed is 822 rad/s, which means that it can not reject disturbances over 0.16 radians. When this value is exceeded the simulation is stopped and a failure message is shown. It is possible to reinitialize the system again by pressing the Reset button.
VI. CONCLUSIONS Control education is going through a period of rapid transition. In most of the classical courses on control engineering, has been mainly conducted by using basic theoretical tutorials. Nevertheless, laboratory practices are essential in control engineering education. To this end, traditional laboratories have been complemented by virtual and remote laboratories [12]. This paper has presented a virtual laboratory with the Reaction Wheel Pendulum. It has been implemented using Ejs [10], which does not require high programming skills. This system is interesting because many systems can be modeled in a similar way [4]. As it is shown in the paper, the system modeled in our laboratory reflects faithfully the behavior of the real plant. Using it students can analyze, design and control the system in an interactive way. Experimentation with this laboratory provides a key educational feature: students can observe the resulting dynamics on-the-fly and be aware of some physical phenomena that are tricky to explain from just a theoretical point of view.
Current and further work is the generation of the remote laboratory using the real plant, and also the incorporation of this new laboratory to the remote laboratory [13] of the Department of Informatica and Automatica in the UNED.