inverted pendulum system a laboratory tool - akademik...

4
Inverted Pendulum System: a Laboratory Tool for Control Education Selçuk Kizir, Zafer Bingül, Cüneyt Oysu Department of Mechatronics Engineering, Kocaeli University, Turkey [email protected] [email protected] [email protected] Abstract— Inverted pendulum system (IPS) is a well known problem used in control education and control research because of its nonlinear and unstable characteristics. IPS appears with various forms and it covers some control problems such as swing-up, swing-down, stabilization-up and down. In this study, IPS as a laboratory tool was controlled in real-time for control education purposes. IP is dealing with two common control problems: swing-up and stabilization of the pendulum. The pendulum should be brought up from downward or any position to upright position with swing-up controller and it should be balanced around its unstable equilibrium point along a limited track with stabilization controller. In the swing-up routine, 3 different nonlinear control methods were applied. They are strategic cart movements based on rules from energy analysis of the system, fuzzy logic controller (FLC) and Lyapunov function based control algorithm. Proportional-Integral-Derivative (PID), full state feedback (SF) and FLC methods were applied for stabilization of IPS. Real-time control algorithms were embedded in a powerful dSPACE DS1103 controller board programmed in Matlab-Simulink environment. The intention of this study is to provide better understanding of the control tasks for students. Control training levels of the students were seen to increase with this experimental tool. This tool helps students to establish the link between control theory and practice and researchers to test new control algorithms. KeywordsControl education; inverted pendulum; swing-up; stabilization; PID; state feedback; fuzzy logic I. INTRODUCTION Inverted pendulum is a well known control problem which has nonlinear and unstable characteristics. This system is very common in the control education setup for developing and testing new control methods. IP is an under-actuated mechanical system which is defined as those that have fewer control inputs or actuators than its degrees of freedom. Its properties such as unstability, nonlinearity and underactuation make it an attractive and useful system for control research and education. In the control education, different topics of control theory such as system analysis, identification, stability and controller design can be taught to students using IPS with better understanding. For these reasons, it is preferred as an essential experimental kit in the control laboratories worldwide [1]. Control methods such as PID, state feedback and fuzzy logic are important topics in the control education. These topics take place an important part of course content in the relevant sections of associate degree, undergraduate, and graduate education programs. But, courses are passed on to students only in theoretically or simulations through various programs. Students may not fully comprehend the subject matter because of nonexistence of the experimental setups. Students may have insufficient knowledge how to transfer techniques they learned in theoretical lessons to engineering problems without experiences from real problems. Therefore, experimental setups are quite necessary tools for students to apply various techniques of control theory in control education. Learning by experience and practice in the education provides permanent learning. For these reasons, an IPS has been developed for control education which is an important part of mechatronics engineering. IP is ideally suited for educating mechatronics students at every level (from freshman to graduate students). Some good examples of IP experimental setup can be found in these universities: Heriot–Watt University, Edinburgh, Scotland, Oregon State University, Corvallis, University of Madrid, Spain, University of Zagreb, Croatia, Rice University, Houston, Arizona State University, Tempe, University of Missouri, Columbia, National University of Distance Education, Madrid, Spain, Nanyang University in Singapore, Lund Institute of Technology and so on [2]. Recently, popularity of web-based online control laboratories has been increased. Generally, these labs consist of different experimental sets, web servers, cameras and also simulation platforms. Students from all over the world may use such a control lab by watching camera, doing experiments, and analyzing results. Some good examples of universities having web-based learning environments are: University of Queensland, Brisbane, Australia [2], National University of Distance Education, Madrid, Spain [3], Stevens Institute of Technology, New Jersey [4] and University of Siena, Italy [5]. Reference [2] and [3] are related control of IPS. Conversely, reference [4] has rich contents and mostly remote and virtual such as industrial-emulator servo-trainer system, cantilever beam deflection system, mechanical vibration system, liquid level system and muffler system. Also, they analyzed statistically data for users and students. Reference [5] provides online experiments such as position and speed control of a DC motor, water level control, water flow control, magnetic levitation, helicopter simulator and LEGO mobile robot. IPS has a characteristic that it addresses a wide range of the control theory. IPS has been given as a main control problem

Upload: vuxuyen

Post on 21-May-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Inverted Pendulum System: a Laboratory Tool for Control Education

Selçuk Kizir, Zafer Bingül, Cüneyt Oysu Department of Mechatronics Engineering, Kocaeli University, Turkey

[email protected] [email protected] [email protected]

Abstract— Inverted pendulum system (IPS) is a well known problem used in control education and control research because of its nonlinear and unstable characteristics. IPS appears with various forms and it covers some control problems such as swing-up, swing-down, stabilization-up and down. In this study, IPS as a laboratory tool was controlled in real-time for control education purposes. IP is dealing with two common control problems: swing-up and stabilization of the pendulum. The pendulum should be brought up from downward or any position to upright position with swing-up controller and it should be balanced around its unstable equilibrium point along a limited track with stabilization controller. In the swing-up routine, 3 different nonlinear control methods were applied. They are strategic cart movements based on rules from energy analysis of the system, fuzzy logic controller (FLC) and Lyapunov function based control algorithm. Proportional-Integral-Derivative (PID), full state feedback (SF) and FLC methods were applied for stabilization of IPS. Real-time control algorithms were embedded in a powerful dSPACE DS1103 controller board programmed in Matlab-Simulink environment. The intention of this study is to provide better understanding of the control tasks for students. Control training levels of the students were seen to increase with this experimental tool. This tool helps students to establish the link between control theory and practice and researchers to test new control algorithms. Keywords— Control education; inverted pendulum; swing-up; stabilization; PID; state feedback; fuzzy logic

I. INTRODUCTION Inverted pendulum is a well known control problem which

has nonlinear and unstable characteristics. This system is very common in the control education setup for developing and testing new control methods. IP is an under-actuated mechanical system which is defined as those that have fewer control inputs or actuators than its degrees of freedom. Its properties such as unstability, nonlinearity and underactuation make it an attractive and useful system for control research and education. In the control education, different topics of control theory such as system analysis, identification, stability and controller design can be taught to students using IPS with better understanding. For these reasons, it is preferred as an essential experimental kit in the control laboratories worldwide [1].

Control methods such as PID, state feedback and fuzzy logic are important topics in the control education. These topics take place an important part of course content in the

relevant sections of associate degree, undergraduate, and graduate education programs. But, courses are passed on to students only in theoretically or simulations through various programs. Students may not fully comprehend the subject matter because of nonexistence of the experimental setups. Students may have insufficient knowledge how to transfer techniques they learned in theoretical lessons to engineering problems without experiences from real problems. Therefore, experimental setups are quite necessary tools for students to apply various techniques of control theory in control education. Learning by experience and practice in the education provides permanent learning. For these reasons, an IPS has been developed for control education which is an important part of mechatronics engineering. IP is ideally suited for educating mechatronics students at every level (from freshman to graduate students).

Some good examples of IP experimental setup can be found in these universities: Heriot–Watt University, Edinburgh, Scotland, Oregon State University, Corvallis, University of Madrid, Spain, University of Zagreb, Croatia, Rice University, Houston, Arizona State University, Tempe, University of Missouri, Columbia, National University of Distance Education, Madrid, Spain, Nanyang University in Singapore, Lund Institute of Technology and so on [2].

Recently, popularity of web-based online control laboratories has been increased. Generally, these labs consist of different experimental sets, web servers, cameras and also simulation platforms. Students from all over the world may use such a control lab by watching camera, doing experiments, and analyzing results. Some good examples of universities having web-based learning environments are: University of Queensland, Brisbane, Australia [2], National University of Distance Education, Madrid, Spain [3], Stevens Institute of Technology, New Jersey [4] and University of Siena, Italy [5]. Reference [2] and [3] are related control of IPS. Conversely, reference [4] has rich contents and mostly remote and virtual such as industrial-emulator servo-trainer system, cantilever beam deflection system, mechanical vibration system, liquid level system and muffler system. Also, they analyzed statistically data for users and students. Reference [5] provides online experiments such as position and speed control of a DC motor, water level control, water flow control, magnetic levitation, helicopter simulator and LEGO mobile robot.

IPS has a characteristic that it addresses a wide range of the control theory. IPS has been given as a main control problem

and example in these classical text books: Modern control engineering [6], automatic control systems [7], control systems engineering [8] and fuzzy control [9]. Table 2 summarizes contents of some fundamental books. Students can be learns main subjects of control theory with IPS experiments.

TABLE 1 CONTENTS OF FUNDAMENTAL CONTROL TEXTBOOKS

Laplace transform Stability Frequency response techniques

Modeling in the frequency domain Steady state errors Design via frequency

response Modeling in the time domain Root locus techniques Design via state

space

Time response PID control Digital control systems

Reduction of multiple subsystems Design via root locus

II. INVERTED PENDULUM SYSTEM In the single link cart driven IPS, an aluminum stick was

connected to a cart by an incremental encoder. Motion range of the cart was limited on a horizontal rail. Friction between stick and encoder was very small so it can rotate freely.

Developed IPS has several parts for providing cart motion and applying desired force to the system, measuring state variables pendulum angle ( ) and cart position ( x ) and performing control algorithms. These components are illustrated in Fig. 1. Control of IP was accomplished using a powerful dSPACE DS1103 real time controller and it was programmed in Matlab-Simulink environment. The cart was driven by a 400W servo motor and belt. Cart velocity ( x ) and angular velocity ( ) were differentiated from the measured variables.

Mathematical modeling of the dynamic systems is very important in control theory. It is the first step of the control to identify the system behavior in details. Students have to know mathematical and physical principles deeply to accomplish this stage. They also understand importance of the modeling when they observe the relation of the simulation and real-time responses of the system.

Equations of motion can be found using Lagrange’s Equation:

xctfmlmlxmM )(sincos)( 2 (1)

bmglxmlIml sincos)( 2

III. CONTROLLER DESIGN Generally, switching or hybrid control approach is used in

the control of IPS since it has two control problems. This can be achieved by using two routines: swing-up and stabilization. Pendulum should be delivered from downward position (θ = 0°) to upright position (θ = 180°) in swing-up step and should be balanced around θ = 180° in the stabilization step. In swing-up routine 3 different methods were applied and first of all is strategic cart movements based on energy of the system. Second method is a FLC that designed using the first method’s rules. The last one is a Lyapunov function based control algorithm that controls energy of the system. On the other hand, PID, SF and FLC methods were used in the stabilization. Also, setup has an important advantage that controller algorithms can be expanded to entire control theory just designing in Simulink simply. A. Swing-up control

1) Strategy based swing-up controller: Stimac [10] suggested an energy based swing-up method that needs a routine of cart motion according to pendulum angle in order to gradually add energy to the IPS. The swing-up problem is accomplished with the energy based rules in that study. The strategy can be defined as a cart trajectory that is driven according to the pendulum angle. Rules of the swing-up routines are as follows: cart should be accelerated when pendulum angle is ±90° in order to maximize positive work, should be decelerated when pendulum angle is 0° because of low work transfer and should be wait for other swing. This procedure is finished when pendulum reaches about its inverted position. According to these rules, this strategy produces zero output because pendulum may start swinging with zero initial angular velocity. So, this algorithm requires an additional rule that pendulum will begin to swing by a series of quick cart movements. Finally, cart velocity gain should be decreased relatively while pendulum raises higher in order to deliver the pendulum closely to its inverted position with smaller angular velocity.

2) Fuzzy logic based swing-up controller: Determined cart motion strategy according to work done on the pendulum was designed with FLC to deliver the pendulum to its upper equilibrium point [11]. This strategy has some rules that are very suitable for developing a FLC. So, these rules were written using if-else statements.

Swing-up regions were built with membership functions. Two input variables were used in proposed fuzzy controller: the pendulum angle and angular velocity.

Controller

Measurement & Filtering

- Input

dSPACE & Simulink

+ Sensors Servo Motor

Driver

Fig. 1 General block diagram of experimental IP system

3) Energy based swing-up controller: Swing-up control of the IP can be done setting the amount of energy in the system [12]. Energy in the system can be set to a desired value using feedback. Pendulum can be raised to the unstable upper equilibrium point with the addition of sufficient quantities of energy to system which corresponds to the upper equilibrium point.

Firstly, we should explore how we can control energy of the system. So, equation of motion for θ is found as follows when friction is neglected and total inertia is represented by J.

0sincos mglxmlJ (2)

Uncontrolled pendulum energy ( 0x ),

cos21 2 mglJE

(3) System energy is mgl and -mgl respectively when pendulum is upper and lower equilibrium point. Maximum acceleration of the cart as given in eqn (4) can be defined n times of gravity.

ngx max (4) Derivative of the energy is equal to cosxml term

expressed in eqn (2).

cossin xmlmglJdtdE

(5)

It is easy to control of the energy of the system as seen from eqn (5). Product of the cart's acceleration x and cos term shows that energy can be added to the system or removed from the system. It is sufficient that product of the two terms is positive in order to increase the energy of the system. Controllability is only lost when effect of the x is loss when 0 or 2/ . Other words, in cases when the pendulum is horizontal or pendulum is changed the direction of movement. Control effect is the highest level when pendulum angle is 0 or and pendulum angular velocity is high. A control strategy can be easily created by using Lyapunov method. Eqn (7) is obtained when control rule is selected as follows using 2/)( 2

0 EEV Lyapunov function.

cos)( 0 EEkx (6)

200 )cos)(())((2

21 EEmlkEEE

dtdV

(7)

Lyapunov function is reduced as long as 0 and 0cos . It is not possible to remain pendulum at the

position 2/ , the strategy given in eqn (6) reaches the system energy E to desired value E0. There are too many control strategies that may accomplish this. Control signal amplitude must be greater as possible to change the energy as possible as quickly. This can be achieved with the following control rule:

))cos()(( 0 signEEksatx ng (8)

Eqn (8) will reach energy of the system from E to the desired value E0. satng term is a linear saturation function at ng. Control function given in eqn (8) produces zero output because of sign function in case pendulum is at its pendant position and stable. So, this problem can be solved by defining + 1 of sign function output when its input is zero.

n is a critical parameter because it determines maximum control signal. This generates a maximum rate of energy change. So far summary of the method developed by Åström and Furuta [12] are given and they examined the system under three behaviors depending on the n parameter. In this study, energy was transferred to system based on that method. These behaviors are: single-swing double-switching, single-swing triple-switching and multi-swing. Pendulum reaches from initial position to upper equilibrium point only doing one swing in the single-swing double-switching behavior. In other words, pendulum will not change the direction of the angular velocity. Output signal will change its value twice in this behavior. n coefficient (cart acceleration / gravity) must be at least 2 in order to demonstrate this behavior. The pendulum swings again from initial to inverted position by drawing a single orbit in single-swing triple-switching behavior. Output signal will change its value three times. n coefficient must be greater than or equal to 4/3 in order to accomplish this behavior. If the maximum accelerations is less than 4/3 pendulum is required to swing a few or more. B. Stabilization control

1) PID control: PID control is one of the classical, simple and effective control methods and it is used widely in the control engineering education and also industrial applications. Simply PID controller has a form that as follows.

)()()()( tedtdKdtteKteKtu DIP

(9) A single PID controller can be used to control just one state

variable. So, it is a suitable control method for the single input single output (SISO) systems. But, the IPS is a single input multi output system (SIMO) since it is an under-actuated system. For this reason, PID controller was used to control only the pendulum angle in this study.

2) Full-state feedback controller: State space representation of a system is defined in eqn (16). In a typical feedback control system, output is directly sent to the comparison function. However, states are fed back in the SF control instead of the output. This gives rise to a change on the original system poles. The method is also known as pole placement technique. In order to tune the desired closed loop pole placement of the system, product of the state variables and ki gain matrix are sent back to the u control signal.

CxyBuAxx

(10)

CxyBrxBKArKxBAxBuAxx

)()(

(11) ].....[

21 nkkkK (12)

State space representation of the closed loop system can be rewritten as eqn (10) [8]. Thus, actual system poles given by the eigenvalues of A matrix are now computed from the A - BK matrix. So, closed-loop system poles now can be adjusted in order to fulfill desired control performance.

Theoretically, system poles can be put to any desired location with suitable gain matrix, but practically not. Because, real performance is restricted by the physical setup. Best results can be accomplished using optimization techniques between control effort and output response. Linear quadratic regulator (LQR) method was developed to find optimum gain matrix using a cost function.

3) Fuzzy logic controller: Pendulum must be balanced after swing-up routine controlling pendulum angle and cart position. 49 rules based a fuzzy controller designed using pendulum angle and angular velocity, cart position and velocity variables.

Only two of the experimental results are given in Fig. 2 as a sample (time and phase plots). Plots are related to the swing-up & stabilization of the IP with energy based & SF controllers.

0 5 10 15 20 25 30 -4

-2

0

2

4

Sar

kaç

Açı

sı (R

adya

n)

0 5 10 15 20 25 30 -0.4

-0.2

0

0.2

0.4

Ara

ba K

onum

u (M

etre

)

0 5 10 15 20 25 30

-2

0

2

4

6

Zaman (Saniye)

Kon

trol S

inya

li

0 5 10 15 20 25 30 -1

-0.5

0

0.5

1

Zaman (Saniye)

Pot

ansi

yel E

nerji

-10 -5 0 5 10-3

-2

-1

0

1

2

3

4

Angular Velocity

Ang

le

k=1.5

Fig. 2 Sample experimental results

IV. GUI FOR THE CONTROLLERS GUIs for all experiments were designed in order to do

experiments in the laboratory. Students can do experiments easily using experimental setup and GUIs after simulations. They would derive the IP model and the controllers in simulation environment (Simulink) and compare the behavior of the controllers. Fig. 3 shows the GUI window frames for different control experiments. Students can enter controller gains, capture data for plotting and analysis in Matlab and observe the effects. Also, low level details of the controllers are transparent to the students. Therefore, they can learn other aspects of designing and implementing such as servo systems, encoder, DAC and ADC interfaces covered in other courses.

Fig. 3 GUI window frames for experiments

Following statements about the interactive tool can be

expressed based on our 10-year control teaching experience. Firstly, the IPS has improved student’s problem solving skills and made them to cope with much more sophisticated with control problems. It decreased the student’s frustration about control problems and it was also enhanced student’s motivation to control courses and projects. Finally, interactive IPS has provided students to establish relationship between the theoretical knowledge and practical control applications.

V. CONCLUSIONS In this study, an interactive IPS was developed as a

laboratory tool that is one of the benchmark problems in the control theory. This equipment is indispensable for control and robot laboratories. This low-cost educational system will be an effective way to university students to learn and test the basics of control. Control rules developed based on system energy, Lyapunov function based energy function, PID, SF and FLC methods were developed for the swing-up and stabilization of the IPS. These control algorithms were simulated in the Simulink environment. Several simulation and experimental results were obtained for each method. These results are very satisfactory in terms of control aspects. Developed IPS can be used to examine and/or to test new control methods for research purposes. Also, this system can be used as a supplement for courses (feedback control, robotics, linear and nonlinear state space control), as a laboratory manual and as a reference for research in linear and nonlinear control. This system was tested by the bachelor, master students and researchers in our control laboratory. This test showed that the control learning and researching capacity of them was improved dramatically.

REFERENCES [1] S. Kizir, Z. Bingul, C. Oysu, “Swing-up and stabilization of the

inverted pendulum problem with PID and full state feedback control methods”, 9th International Workshop on Research and Education in Mechatronics, Bergamo, Italy, 2008.

[2] G. Hovland, “Evaluation of an online inverted pendulum control experiment”, IEEE Transactions on Education, vol. 51, pp. 114-122, 2008.

[3] J. Sanchéz, S. Dormido, R. Pastor, F. Morilla, “A Java/Matlab based environment for remote control system laboratories: Illustrated with an inverted pendulum”, IEEE Trans. Educ., vol. 47, pp. 321–329, 2004.

[4] E.S. Aziz, S.K. Esche, C. Chassapis, “Content-rich, interactive online laboratory systems”, Computer Applications in Engineering Education, Vol. 17, pp. 61-79, 2009.

[5] M. Casini, D. Prattichizzo, A. Vicino, “The automatic control Telelab”, IEEE Control Syst. Mag., vol. 24, pp. 36–44, 2004.

[6] K. OGATA, Modern Control Engineering, New Jersey, Prentice Hall, 1997.

[7] В.С. Kuo, Automatic Control Systems, New Jersey, Prentice Hall, 1982.

[8] N.S. Nise, Control Systems Engineering, Wiley, 2004. [9] K.M. Passino, S. Yurkovich, Fuzzy control, Boston, Addison-Wesley,

1998. [10] A.K. Stimac, “Standup and stabilization of the inverted pendulum”,

Bachelor thesis, Massachusetts Institute of Technology, 1999. [11] S. Kizir, Z. Bingul, C. Oysu, “Fuzzy control of a real time inverted

pendulum system”, Journal of Intelligent & Fuzzy Systems, Volume 21, pp. 121-133, 2010.

[12] K.J. Astrom, K. Furuta, “Swinging up a pendulum by energy control”, Automatica, Vol. 36, pp. 287-295, 2000.