6
Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329 324 S S S e e e n n n s s s o o o r r r s s s & & & T T T r r r a a a n n n s s s d d d u u u c c c e e e r r r s s s © 2013 by IFSA http://www.sensorsportal.com Digital Double-loop PID Controller for Inverted Pendulum Ming Li College of Mathematics & Computer Science, Wuhan Textile University, Wuhan, 430070, China Tel.: 0086-27-59367297 E-mail: [email protected] Received: 5 June 2013 /Accepted: 25 August 2013 /Published: 30 September 2013 Abstract: Inverted pendulum system is a complicated, unstable and multivariable nonlinear system. In order to control the angle and displacement of inverted pendulum system effectively, a novel double-loop digital PID control strategy is presented in this paper. Based on impulse transfer function, the model of the single linear inverted pendulum system is divided into two parts according to the controlled parameters. The inner control loop that is formed by the digital PID feedback control can control the angle of the pendulum, while in order to control the cart displacement, the digital PID series control is adopted to form the outer control loop. The simulation results show the digital control strategy is very effective to single inverted pendulum and when the sampling period is selected as 50 ms, the performance of the digital control system is similar to that of the analog control system. Copyright © 2013 IFSA. Keywords: Inverted pendulum, Double-loop PID control, Digital control, Sampling period. 1. Introduction In the development of control theory, the correctness and feasibility of the theory must be validated by a typical object. The inverted pendulum system, which can reflect some problems in control systems such as nonlinearity, robustness, stabilization, and following control, etc., is an ideal platform to carry out these experiments. The rocket's flight control can be simplified as an inverted pendulum system, so as the step robot control and the satellite attitude control. Therefore it has remarkably theoretical and practical significances to research how to control inverted pendulum systems. Inverted pendulum is a kind of complicated, unstable and multivariable nonlinear system. There are many types of inverted pendulum systems. According to the shapes of the inverted pendulum, there have linear type and ring type etc.; according to stage numbers, there have single, double and multi- stage inverted pendulum systems; but according to the types of control electric motor, there have single motor, multi motors etc. [1-3]. From 1960 s, there are increasingly interests to research inverted pendulum systems. L. F. Sun et al. [3] introduced some control methods for inverted pendulum and holded that intelligent control method is better than linear control method. Some researchers [4-8] have developed some control strategies for the cart-pole inverted pendulum system using fuzzy logic controller. Siuka et al. [9] deals with the application of energy based control methods for the inverted pendulum on a cart model and presented a swing up controller. There have been some studies [10-12] on PID methods for the purpose of balance control of inverted pendulum system. Also, some other people [13, 14] have researched the adaptive control problems of inverted pendulum systems. Aguilar-Ibanez et al. [15] present Article number P_1364

Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

  • Upload
    others

  • View
    17

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

324

SSSeeennnsssooorrrsss &&& TTTrrraaannnsssddduuuccceeerrrsss

© 2013 by IFSAhttp://www.sensorsportal.com

Digital Double-loop PID Controller for Inverted Pendulum

Ming Li

College of Mathematics & Computer Science, Wuhan Textile University, Wuhan, 430070, China Tel.: 0086-27-59367297

E-mail: [email protected]

Received: 5 June 2013 /Accepted: 25 August 2013 /Published: 30 September 2013 Abstract: Inverted pendulum system is a complicated, unstable and multivariable nonlinear system. In order to control the angle and displacement of inverted pendulum system effectively, a novel double-loop digital PID control strategy is presented in this paper. Based on impulse transfer function, the model of the single linear inverted pendulum system is divided into two parts according to the controlled parameters. The inner control loop that is formed by the digital PID feedback control can control the angle of the pendulum, while in order to control the cart displacement, the digital PID series control is adopted to form the outer control loop. The simulation results show the digital control strategy is very effective to single inverted pendulum and when the sampling period is selected as 50 ms, the performance of the digital control system is similar to that of the analog control system. Copyright © 2013 IFSA. Keywords: Inverted pendulum, Double-loop PID control, Digital control, Sampling period. 1. Introduction

In the development of control theory, the correctness and feasibility of the theory must be validated by a typical object. The inverted pendulum system, which can reflect some problems in control systems such as nonlinearity, robustness, stabilization, and following control, etc., is an ideal platform to carry out these experiments. The rocket's flight control can be simplified as an inverted pendulum system, so as the step robot control and the satellite attitude control. Therefore it has remarkably theoretical and practical significances to research how to control inverted pendulum systems.

Inverted pendulum is a kind of complicated, unstable and multivariable nonlinear system. There are many types of inverted pendulum systems. According to the shapes of the inverted pendulum, there have linear type and ring type etc.; according to

stage numbers, there have single, double and multi-stage inverted pendulum systems; but according to the types of control electric motor, there have single motor, multi motors etc. [1-3]. From 1960 s, there are increasingly interests to research inverted pendulum systems. L. F. Sun et al. [3] introduced some control methods for inverted pendulum and holded that intelligent control method is better than linear control method. Some researchers [4-8] have developed some control strategies for the cart-pole inverted pendulum system using fuzzy logic controller. Siuka et al. [9] deals with the application of energy based control methods for the inverted pendulum on a cart model and presented a swing up controller. There have been some studies [10-12] on PID methods for the purpose of balance control of inverted pendulum system. Also, some other people [13, 14] have researched the adaptive control problems of inverted pendulum systems. Aguilar-Ibanez et al. [15] present

Article number P_1364

Page 2: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

325

an output feedback stabilization method for the Inverted Pendulum Cart system around its unstable equilibrium point, and adapt an observer based controller devoted to render the closed-loop system to the origin. Mladenov [16] had used two Neural Network controllers to swing a pendulum attached to a cart from an initial downwards position to an upright position. But this works are based on state-space representation, were focused on the analog PID controller which can’t be implemented by the computer program easily.

In this paper, under considering there exits the cart’s friction, in order to control the displacement of the cart of the inverted pendulum system meanwhile guaranteeing the pendulum verticality, the model of the single inverted pendulum system is divided into two parts based on impulse transfer function. A novel double-loop digital PID control strategy and how to choose its sampling period are researched in this paper. Finally Use matlab/simulink to verify the performance of the presented control strategy.

2. Model of Linear Inverted Pendulum System The single inverted pendulum system consists of

a cart and a pendulum, as Fig. 1 (a) shows.

(a) (b)

Fig. 1. Single inverted pendulum system.

By ignoring the air fiction and some minor fictions, the force diagrams of the cart and the pendulum are shown as Fig. 1 (b), where M is the cart mass, x is the cart position, F is the force impacted on the cart, b is the cart friction coefficient, m is the pendulum mass, 2L is the pendulum length, is the included angle between the pendulum and the vertical direction, and I is the pendulum rotary inertia.

The dynamic models of the single inverted pendulum system are nonlinear differential equations. If selecting the working points 0 00, 0x and

linearizing the system, we have the simplified mathematical models of the inverted pendulum system. They are:

2( ) g

( )

I ml mlx ml

M m x bx ml F

(1)

The transfer function of the linear inverted pendulum is:

2 2

2 4 2 3 2

( )( )

( )

g ( )

( ) ( ) ( ) lg lg

X sG s

F s

ml I ml s

MI Mml mI s b I ml s M m m s bm s

(2)

The control goal of the linear inverted pendulum is to make the horizontal displacement of the cart controllable while guaranteeing the pendulum verticality. This problem is a type of classic control systems with one input (external force F) and two outputs (angle of pendulum and car displacement x). In order to control two output parameters effectively, we must establish the mathematical model of the linear inverted pendulum. According to formula (2), we can get two transfer functions for two controllable parameters.

1

2 3 2 2

( )( )

( )

( ) ( ) ( ) lg lg

sG s

F s

mls

MI Mml mI s b I ml s M m m s bm

(3)

2 2

2 2

( ) g ( )( )

( )

X s ml I ml sG s

s mls

(4)

3. PID Controller

The PID controller consists of three components that are proportion, integral and differential. The mathematical expressions are

1 ( )( ) ( ) ( )

( ) 1( ) (1 )

( )

P DI

IP D P D

I

de tu t K e t e t dt T

T dt

KU sD s K T s K K s

E s T s s

,(5)

where

,PI D P D

I

KK K K T

T (6)

If T denotes the sampling period, we can conclude

the positional PID controller as

' ' '

0

( ) ( ) ( ) ( ) ( 1)k

P I Dj

u k K e k K e j K e k e k

, (7)

where

' ' ', , D DP P I P I D P

I

T KTK K K K TK K K

T T T (8)

Page 3: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

326

According to Z transformation, we can get the impulse transfer function of the digital PID controller

' ' ' 2 ' ' '

2

( )( )

( )

( ) ( 2 )P I D P D D

U zD z

E z

K K K z K K z K

z z

(9)

The block diagram of single-loop analog PID

control system is shown in Fig. 2 that can only control the displacement x of the car.

Fig. 2. Single-loop PID control system for single inverted pendulum.

4. Double-loop Digital PID Controller

As to single-loop PID control system, three components, the proportion, integral, differential, are located in the forward channel of control system. But as to double-loop PID control system, a PID controller and the object can form an inner loop that can make the unstable object stable; in the forward channel of the control system, another PID controller and the object form an outer loop that can make the control system have the expected performance [17]. Because the single inverted pendulum has one input

and two outputs, we can divide the mathematical model into two parts, as shown in equations (3) and (4). When we use the double-loop PID controller, the inner loop controls the pendulum angle and the outer loop controls the cart horizontal position.

Fig. 3 shows the block diagram of the analog double-loop PID control system. In order to simplify the computation, two PID controllers are all designed as PD controllers. An amplifier G is placed in the inner loop in order to suppress interference and unit negative feedback is used in the outer loop in order to obtain better following performance.

Fig. 3. Analog double-loop PID control system for inverted pendulum.

Although the analog double-loop PID controllers can make the performance of the inverted pendulum system good, they can’t be implemented by computer easily and their development cost is very expensive. Therefore we must design a digital controller that can make the performance of the inverted pendulum control system meet the control requirements. Based on the analog double-loop PID control system, we can get the control strategy of the digital double-loop controller using sampling control theory that is illustrated in Fig. 4.

Fig. 4. Structure of digital double-loop PID control system for inverted pendulum.

The sampling period T is a very important

parameter in digital control system. We must choose the sampling period according to the performance requirements and the development cost of the digital control systems. When the sampling period is larger, the demands for the operation speed of computers are lower, so it is helpful to cut down the cost of digital controllers, but too large sampling period will degrade the performance of control systems. While the sampling period is smaller, the performance of

digital control systems will be improved, but the demands for the operation speed of computers are higher, which lead to increase the development cost of digital control systems. Furthermore, excessive sampling period has little help to improve the control performance. Therefore the sampling period T must be chosen correctly. In this paper, we suppose the inner loop and the outer loop in the digital double-loop control system have the same sampling period.

Digital PID1 Amplifier G G1(s) G2(s)

Digital PID2

Xr(s) X(s) ZOH

θ(s)

PID1 Amplifier G G1(s) G2(s)

PID2

Xr(s) X(s)θ(s)

PID controller

G1(s) Xr(s)

G2(2)

X(s)

θ(s)

Page 4: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

327

5. Simulation Analysis In order to compare and analyze the control

results of these control strategies for linear inverted pendulum, Matlab/Simulink [18] is used to simulate. Suppose the parameters of the linear inverted pendulum are: M=1 kg, m=1 kg, 2L=0.6 m, b=0.1 N/m.s, I=0.03 kg.m2. From equations (2), (3) and (4), we can get:

2

4 3 2

( ) 0.12 3( )

( ) 0.15 0.012 6 0.3

X s sG s

F s s s s s

1 3 2

( ) 0.3( )

( ) 0.15 0.012 6 0.3

s sG s

F s s s s

2

2 2

( ) 0.12 3( )

( ) 0.3

X s sG s

s s

The analog single-loop PID control system,

illustrated in Fig. 2, can be simulated by Simulink. The simulation results show that no matter how to modify the parameters KP, KI and KD of the controller, the control system is always unstable, which proves the single-loop PID controller isn’t fit for the control of this type of inverted pendulum system.

When simulation of analog double-loop PID control system for the linear inverted pendulum, we set the parameters of the control system as

1 10.12, 0.12p DK K , 2 21.625, 0.175p DK K and

G= -32. Then the step response of the control system can be get in Fig. 5, from which we can conclude that for the pendulum angle, the overshoot is 12.33 % and the setting time is 3.12 s ( 2 %); as to the cart position, the overshoot is 15.55 % and the setting time is 6.15 s ( 2 %). The results show the analog double-loop PID controller is effective to control the linear inverted pendulum system.

Fig. 5. Step response of analog double-loop PID control system.

In order to obtain the control results of digital double-loop PID control system, set the sampling period T as 100 ms, 90 ms, 80 ms, 50 ms, 10 ms and 5 ms respectively. According to equation (8), the parameters of the digital PID controller will be obtained directly from the analog PID controller. The results are shown in Table 1.

Table 1. Parameters of the digital PID controller.

Digital PID1 Digital PID2 Sampling period T KP1’ KD1’ KP2’ KD2’

100 ms 0.12 1.2 1.625 1.75

90 ms 0.12 1.33 1.625 1.94

80 ms 0.12 1.5 1.625 2.19

50 ms 0.12 2.4 1.625 3.5

10 ms 0.12 12 1.625 17.5

5 ms 0.12 24 1.625 35

When T is set as 100 ms, the simulation result is shown in Fig. 6 (a). While T is set as 90 ms and 80 ms, the results can be seen in Fig. 6 (b). The Fig. 6 (c) is the simulation results when T is set as 50 ms, 10 ms and 5 ms.

From the simulation results, we can get the performance indexes of the digital double-loop PID control system as Table 2 shows.

Table 2. Performance indexes of the digital double-loop control system.

Cart position x Pendulum angle Sampling period Over-

shoot Setting

time Over-shoot

Setting time

100 ms Unstable Unstable Unstable Unstable

90 ms 85.5 % 33.03 s 104.7 % 40.23 s

80 ms 50.6 % 5.92 s 103.02

% 4.64 s

50 ms 38.2 % 6.05 s 82.3 % 2.4 s

10 ms 38.5 % 6.13 s 60.7 % 2.46 s

5 ms 38.5 % 6.14 s 59 % 2.46 s

From Table 2, we can conclude that when T=100 ms the digital control system is unstable; When T=90 ms the control system become stable, but the performances are very bad which means the control system has little practical value; when T=80 ms, the system performances is improved greatly. When T is between 5 ms and 50 ms, we can see that the performances of the digital control system have little change and are very similar to those of the analog double-loop control system.

The simulation results further prove that when the analog control system is transformed into the digital control system, the system performances will degrade. So we must select the sampling time T correctly when we use digital control system. As to the single inverted pendulum, the controlled

Page 5: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

328

parameter changes very quickly, so it is better that the sampling time T is set as 50 ms. Finally we can conclude that the digital double-loop PID controller is a good solution to control the single inverted pendulum system.

(a)

(b)

(c)

Fig. 6. Step responses of digital PID controller.

6. Conclusions

The inverted pendulum system is a complicated, unstable and multivariable nonlinear system that can reflect many typical problems in control systems, so researching inverted pendulum control system has remarkably theoretical and practical significance. Because the digital controller can be easily implemented by the computer program, it is a cheap controller and has very high practical value. The research results in this paper show: the single-loop PID controller is not suitable to control the single inverted pendulum that is unstable and has one input and multiple outputs. As to this type of problems, the controlled objects can be divided into different parts according to the numbers of the controlled parameters and also different mathematical models should be established. The digital double-loop PID controller is a good solution for the single inverted pendulum with one input and two outputs. For the controlled parameter changes very quickly, it is a good way that the sampling time T is set as 50 ms in order that the digital control system has good performance and cheaper cost.

References [1]. H. M. Liu, C.-F. Zhang, Stability Control and

realization of single link rotary inverted pendulum on LQR controller, Journal of Central South University (Science and Technology), Vol. 43, Issue 9, 2012, pp. 3496-3501.

[2]. H. Ashrafiuon, A. M. Whitman, Closed-loop dynamic analysis of a rotary inverted pendulum for control design, Journal of Dynamic Systems, Measurement and Control, Transactions of the ASME, Vol. 134, Issue 2, 2012.

[3]. L. F. Sun, H. Kong, C. G. Liu, Overview of the control of the inverted pendulum system, Machine Tool & Hydraulics, Vol. 36, 2008, pp. 306-310, 313.

[4]. S. Kizir, Z. Bingul, C. Oysu, Fuzzy control of a real time inverted pendulum system, Journal of Intelligent & Fuzzy Systems, Vol. 21, 2010, pp. 121-133.

[5]. M. K. B. M., Nor, S. Okubo, Fuzzy servo control of an inverted pendulum system, Artificial Life and Robotics, Vol. 17, Issue 2, 2012, pp. 245-250.

[6]. C. H. Huang, W. J. Wang, C. H. Chiu, Design and implementation of fuzzy control on a two-wheel inverted pendulum, IEEE Transactions on Industrial Electronics, Vol. 58, Issue 7, 2011, pp. 2988-3001.

[7]. D. Wang, S. Wu, L. Zhang, et al., Study of inverted pendulum robot using fuzzy servo control method, International Journal of Advanced Robotic Systems, 2012.

[8]. H. L. Bui, D. T. Tran, N. L. Vu, Optimal fuzzy control of an inverted pendulum, Journal of Vibration and Control, Vol. 18, Issue 14, 2012, pp. 2097-2110.

[9]. A. Siuka, M. Schöberl, Applications of energy based control methods for the inverted pendulum on a cart, Robotics and Autonomous Systems, Vol. 57, 2009, pp. 1012-1017.

[10]. A. Ghosh, T. R. Krishnan, B. Subudhi, Robust proportional-integral-derivative compensation of an

Page 6: Digital Double-loop PID Controller for Inverted Pendulum€¦ · Single-loop PID control system for single inverted pendulum. 4. Double-loop Digital PID Controller As to single-loop

Sensors & Transducers, Vol. 156, Issue 9, September 2013, pp. 324-329

329

inverted cart-pendulum system: An experimental study, IET Control Theory and Applications, Vol. 6, Issue 8, 2012, pp. 1145-1152.

[11]. S. Y. Yang, L. P. Xu, P. J. Wang, Study on PID control of a single inverted pendulum system, Control Engineering of China, Vol. 14, 2007, pp. 23-24,53.

[12]. T. C. Kuo, Y. J. Huang, B. W. Hong, Adaptive PID with sliding mode control for the rotary inverted pendulum system, in Proceedings of the IEEE/ASME International Conference on Advanced Intelligent Mechatronics, Singapore, Singapore, 14-17 July 2009, pp. 1793-1798.

[13]. S. Rudra, R. K. Barai, Robust adaptive backstepping control of inverted pendulum on cart system, International Journal of Control and Automation, Vol. 5, Issue 1, 2012, pp. 13-26.

[14]. M. Fallahi, S. Azadi, Adaptive control of an inverted pendulum using adaptive PID neural network, in

Proceedings of International Conference on Signal Processing Systems, Singapore, Singapore, 15-17 May 2009, pp. 589-593.

[15]. C. Aguilar-Ibanez, M. S. Suarez-Castanon, N. Cruz-Cortes, Output feedback stabilization of the inverted pendulum system: a Lyapunov approach, Nonlinear Dynamics, Vol. 70, Issue 1, 2012, pp. 767-777.

[16]. V. Mladenov, Application of neural networks for control of inverted pendulum, WSEAS Transactions on Circuits and Systems, Vol. 10, Issue 2, 2011, pp. 49-58.

[17]. S. J. Song, J. L. Liu, Z. H. Zhang, A simple method for improving the performance of PID controller, Drive and Control, Issue 5, 2007, pp. 32-35.

[18]. J. J. Wang, Simulation studies of inverted pendulum based on PID controllers, Simulation Modelling Practice and Theory, Vol. 19, Issue 1, 2011, pp. 440-449.

___________________

2013 Copyright ©, International Frequency Sensor Association (IFSA). All rights reserved. (http://www.sensorsportal.com)