 Open Access
 Total Downloads : 1120
 Authors : N. Prem Kumar Reddy, Dr. M. Siva Kumar, D. Srinivasa Rao
 Paper ID : IJERTV3IS100948
 Volume & Issue : Volume 03, Issue 10 (October 2014)
 Published (First Online): 28102014
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
Control of Nonlinear Inverted Pendulum System using Pid and Fast Output Sampling Based Discrete Sliding Mode Controller

Prem Kumar Reddy
PG Student, Department of Electrical and
Electronics Engineering Gudlavalleru Engineering College, Gudlavalleru, AP, India
Dr. M.Siva Kumar Professor & Head of the Department,
Department of Electrical and Electronics Engineering Gudlavalleru Engineering College, Gudlavalleru, AP, India

Srinivasa Rao
Associate Professor, Department of Electrical and Electronics Engineering, Gudlavalleru
Engineering College, Gudlavalleru, AP, India.
Abstract – The nonlinear inverted pendulum system is a classical control problem in control theory and robotics. It is used as a bench mark control problem to test various control techniques. In this paper a controller is proposed based on proportionalintegralderivative control and .discrete sliding mode (DSM) controller based on fast output sampling (FOS) to control the nonlinear inverted pendulum system. FOS is kind of Multirate output feedback (MROF), which samples the control input and sensor output of the system at different rates. Here the controller aim is to move the cart to a desired position and balancing the pendulum in upright position. Here the modeling and simulation of the controller are carried out using MATLABSIMULINK and simulation results are compared with two PID and linear quadratic regulator control schemes.
Key Words: Inverted pendulum, nonlinear system, PID control, sliding mode controller, Fast Output Sampling.

INTRODUCTION
The inverted pendulum is a highly nonlinear unstable system, which is termed as bench mark control problem by the international federation of automatic control theory committee. The simplest case of this system is cartsingle inverted pendulum system. It has very good practical applications like missile launchers and segways,human walking etc.Here the system dynamics resembles the missile launcher or rocket launcher dynamics hence it is an area of interest for the control engineers. Since the system is unstable and nonlinear the controller design is challenging.
Here the aim of this paper is to design a controller such that the controller moves the cart to a desired position and pendulum stabilizes in upright equilibrium position [1 4]. There are so many control techniques available in the literature to control the inverted pendulum based on Fuzzy logic, Artificial Neural Networks, PSO and Genetic algorithm and artificial intelligence [57]. This paper
investigates a controller based on PID control and FOS based DSMC.PID control is the simplest yet very efficient controller used to control the cart position .FOS is a kind of multirate output feedback (MROF) technique in which control input and system outputs are samples at different rates. In this approach system output is sampled at a faster rate hence it is called as fast output sampling. In recent years DSMC based on FOS gained much attention DSMC is a counter part of continuous sliding mode control. In this approach control law is designed based on FOS used to stabilize the pendulum position. Here DSMC ensure a sliding behavior if there is a motion confined to a sliding manifold which is reached in finite time.
This paper is organized in 5 sections. Section 1 about introduction of the paper. Section 2 deals with the mathematical model of the inverted cartpendulum system. In section 3 the control method of PID and DSM based on FOS has been discussed briefly. Section 4 deals with modeling of system with MATLABSIMULINK, and simulation results. In section 5 conclusions . Brief list of references is given at last.

MATHEMATICAL MODELING



Inverted pendulum system equations
The free body diagram of an inverted pendulum system is shown in Fig. 1.Here the pendulum is mounted on the dc motor driven cart [14]. The system dynamics of this nonlinear system can be derived as follows [1, 2]. Since the pendulum rod has negligible mass it is assumed mass less, and is assumed as the hinge is friction free. The cart mass denoted as M and the ball point mass at the upper end of the inverted pendulum is denoted as m. Here an external force u (t) acted in xdirection on the cart, and a gravity force acts on the point mass in downwards. A coordinate
system considered as shown in Fig.1, with x (t) as the cart position and (t) as the pendulum tilt angle referenced to the vertically upward direction. By Newtons law a force balance equation in the xdirection can be written as
The resultant torque balance can be written as
cos sin = ( sin ) (4)
Where, = 2 , = 2 are the force
2
2
2
2
2 +m 2 = (1)
Here the center of gravity (COG) of the point mass is time dependent and given by the coordinates, ( xG , yG ). For pendulum, the location of the center of gravity of the point mass is written as
= + sin = cos (2)
Where l is the pendulum rod length
components in x and y directions respectively. After manipulation (4) is written as
cos + = sin (5)
Equations (3) and (5) are the defining equations for this system. By manipulating these two equations to have only a single second derivative term in each equation. We get the cart position dynamics and the pendulum angle dynamics respectively as
2
= + sin 2 cos sin
+
=
cos + sin + (cos sin ) 2
2 +
(6)
(7)
The above equations (6) and (7) represent a nonlinear inverted pendulum system in mathematical form.
Inverted Pendulum – Cart System Substitution of eqn. (2) into (1) gives
+ sin 2 + cos = (3)
Similarly, a torque balance on the system is performed. Fig. 2 shows the force components acting

Nonlinear system state space equations of inverted pendulum
To find the numerical solution of the nonlinear inverted pendulum model, we need to represent the nonlinear equations (6) and (7) into standard state space form as,
= (, , ) (8)
The state variables are considered as
1 = ,2 = = 1 ,3 = ,4 = = 3 (9)
Then, the inverted pendulum system in state space form can be written as
On the system
1
= 2 =
1
2
(10)
3
= 3
Where
4
4
1 = 2 (11)
cos 1 + sin 1+ (cos 1 sin 1 ) 2
4 =
2 1 +
2 (12)
3 = 4 (13)
+ (sin 1) 2 cos 1 sin 1
2 =
2
+
2 1
(14)
Fig. 2 Vector diagram for force components in torque balance
Here both the pendulum angle and the cart position x are the variables of interest, hence the output equation can be written as
y =
1 0 0 0
Finally, after all these manipulations (16) may be Written explicitly as
= Cx =
0 0 1
0 (15)
0 0
Equations (10) and (15) give a complete state space representation of the nonlinear inverted pendulumcart
0 1
= 0 0
0 1
0 + (19)
dynamic system.

Linear system state space equations of Inverted pendulum
0 0
0
0
0 1
0
p> +
0
1
.
Since our goal is to maintain the inverted pendulum at zero angle ( = 0) or upright equilibrium position, hence the linearization is considered about this upright equilibrium point and the linear model for the system is derived by simply linearization of the nonlinear system given in (10). Since the system matrices (A, B) are zero for this case; and so every term is put into the nonlinear vector function, f (x, u, t), then the linearized form for the system becomes
= , + ( , ) (16)
This is the open loop linearized model for the Inverted pendulum with a cart force, u (t). Thus, LTI system is in standard state space form. The equation (19) may be written in general as
= + (20)
Equation (20) along with the output equation (15)represents the final linear model of the inverted Pendulumcart system. This is the simplified model which
is used to study the system behavior in general and to design DSMC.
Where, the reference state is defined with the Pendulum stationary and upright with no input force. Then the initial conditions are, 0 = 0 0 = 0. Since the nonlinear vector function is rather complicated, the components of the Jacobin Matrices are determined systemically, term by term. The elements of the first second, third, and fourth
columns of 0, 0 are given by

PID and Fast Output Sampling Feedback Based DiscreteTime Sliding Mode Control

PID control
To stabilize the inverted pendulum in upright Position and to control the cart at desired position using PID and FOS

1 0 0
, 
2 00
, 
3 0 0
and 
4 0 0
respectively.
based DiscreteTime Sliding Mode Control, a single PID controller is used.
Thus, combining all these separate terms gives
0
The control loop of the system and the equation of PID control are given as
0 1
= 0 0
0
0
(17)
= + () + ()
(21)
0 0
0 0
0
0
0 1
0
+
Where () is cart position error. Since the pendulum angle dynamics and cart position dynamics are coupled to
For the derivative of the nonlinear terms with respect to u,
we have
1
2
3
0, 0 =
4
0 ,0
0 0
1 1
each other so the change in any controller parameters affects both the pendulum angle and cart position hence makes the tuning tedious. Here tuning of controller parameters is carried using trial & error method by observing the responses of SIMULINK model to be the optimal.

Fast Output Sampling
In FOS, the state information of the system is computed from the output of the system by multirate observation of the output signal. The control signal is held constant during
=
+ 2 1
0
cos 1
2 1 + 0,0
=
0
1
(18)
each sampling interval {1718]. As illustrated in Fig.3, Consider the system
= + (22)
= (23)
Linear time invariant, controllable and observable continuous system. Where is state is
output and is control.Matrices A, B, C are system matrices.
Fig.3 visualization of fast output sampling feedback
When the system (22)(23) is sampled at the rate of 1/
,the equivalent discretetime system is
+1 = + uk (24)
= (25)
0
Where = and = , also let
+1 = + uk (26)
be the discrete time system corresponding to the system
(22) sampled at the rate of 1/, where = , Let denotes the observability index [27] of
(, ) and > in FOS output measurements are taken at time instants t= , = 0,1, 1.The control signal which is applied during the interval < < ( + 1) is then contrructed as a linear combination of the last output observations, then the fictitious lifted system can be
The control law is of the form
= < < ( + 1) (32) For L to realize the effect of F it must satisfy
+1 = ( + ) = ( + ) (33) That is = (34)
For N , the matrix C has full rank and that for N= .L is uniquely determined from (34).However, if N> ,L thus obtained is not unique. Whatever is the case, L obtained from (34) realizes the state feedback gain [19] at time t=0, the control signal uk =u0 for 0 < .Cannot be computed from (32) as the output measurements are not available for t<0.Howerever u0 can be arbitrarily selected if the eigen values of (LD0 F) , are in unit circle in Z plane since under this condition, the initial error in input will slowly vanish.

A Modified Approach for Fast Output Sampling Feedback
Consider the lifted system in (27) and (28), since the system is assumed to be observable the lifted output matrix
0 is of rank n.if the value of N is chosen as greater than the observability index [27] of the system then for a p output matrix necessarily and 0 would be of dimensions Ã— .Thus from (27) and (28) the state vector
can be obtained in terms of 1 as
= L + L uk1 (35)
constructed as
Where L
= ( )1 (36)
0 0
0 0 0
+1 = + uk (27)
+1 = 0 + 0uk (28)
L =
( 0)1 0
(37)
Where 0 0 are given by
0
It is evident from (35) that the state of the system (22) can be determined exactly from the past measurements of the output and input. Now state feedback control, designed in
3.2.1 can be converted into an output feedback based
= 2
,
= +
(29)
control by simply substituting for (35) as
0 . 0
.
.
uk = FL + FL uk1 (38)
C1
2
=0
Let F be an initial state feedback gain such that the closed loop system ( + ) has no eigen values at the origin.Then for this state feedback one can define a fictitious measurement matrix
= 0 + 0 ( + )1 (30) Which satisfies the fictitious measurement equation
= (31)
3.1.4 Discrete sliding mode control

Overview of DiscreteTime Sliding Mode Control Discretetime sliding mode control (DSMC) is discrete time counter part of continuoustime sliding mode control (SMC).For DSMC the structures of the control are similar to that of continuoustime SMC.

Design of sliding surface: If M<n, there exist a transformation Ã— for system (24) such that
= 0
2
Under this transformation, the system (24) is transformed into regular form given as
Where is determined using (48).similarly sliding surface
(44) can be expressed in terms of multirate output observations and past input as
= + L 1 (50)
1 +1 = 11 12 1 + 0
(39)




SIMULATION & RESULTS
2 +1
31
22
2
2
The MATLABSIMULINK models for the simulation of
Where [ , ] =
=
(40)
modeling, analysis, and control of nonlinear inverted
1
2
pendulumcart dynamical system has been developed. The parameters of the cart inverted pendulum system setup are
Where 1 and 2 .Let us define a sliding
function [24] for the system (39) of the form
= With the sliding fuction parameter be of the form = [, ] (41)
Where k is mx (nm) matrix and is identity matrix of order m.The system dynamics during sliding mode is characterized by the sliding surface. Then the sliding
surface is given by
selected as [1,2,3,]: the cart mass (M): 2.4 kg, and mass of the pendulum (m): 0.23 kg, the pendulum length(l )as:0.36 m, the cart track length (L): Â± 0.5 m, the cart & pole rotation friction coefficient is assumed negligible.
After linearization the system matrices are computed as below:
0 1 0 0 0
2 = 1 (42)
= 0 0 0.9401 0 (51) = 0.4167 (52)
Where
constitutes the last m states of .Then, the
0 0 0 1
0 0 29.8615 0
0
1.1574
2
= 1 0 0 0 = 0
sliding mode dynamics of 1 can be represented as
0 0 1 0 0
1+1 = 11 1 12 1
= (11 12 ) 1 (43)
From (43) one can observe that if K is so designed that the
eigenvalues of(11 12 ) are assigned within the unit circle then 1 is stabilized during sliding phase. Consequently from (42) 2 , is also stable confined to the sliding surface. Thus the stability requirement of the sliding surface is achieved. Now the sliding surface for original system (27) can be expressed as
= = = 0 (44)

Sliding mode control law design: The discretetime sliding mode control law can be obtained by satisfying the reacting law [23]
+1 = 0 (45)
Now from (27), (44) and (45) one can get
+1 = + = 0 (46) Resulting in equivalent DSMC law as
= (47)
Where
= ( )1 (48)

Fast output Sampling Based DiscreteTime Sliding Mode Control
The above discretetime sliding mode control law (47) is combined with fast output sampling feedback control using as
= + 1 (49)
And for FOS based Discrete sliding mode controller the eigenvalues of A are (0, 0, 5.4646,5.4646).Two eigenvalues are at origin and one is in the right half of s plane. Hence, the system is fully controllable and observable, the observability index being 4.
Assume the sampling period = 0.068 . Thus,=
0.017 .The system(51)(52) is dicretized with sampling period and state feedback gain matrix F is calculated using Q=0.1E and R=1 as
F= [0.3162 1.4440 56.5926 10.4016].
Using this state feedback gain matrix, closed loop eigenvalus of the discrete system are observed to be (0.6810, 0.6980, 0.9828Â±i0.0159) i.e. within the unit circle in Zplane. Now 0 and 0 are determined using (29) for computing C from (30) and hence L from (34).Which is found to be
L = [4.5953 111.6394 5.00771 21.1767 0.2141
53.6600 9.9734 114.4196]. (53)
Since the system has only one input, it is verified that the eigenvalue of (LD0 F) is in unit circle. Hence,0 is selected as zero for >0.068 s, this condition is violated and for < 0.068 ,magnitude of fast output sampling gain increases. Hence, is taken as 0.068 s.
Further, for a modified approach of FOS, Lu and Ly are found from (36) and (37) as
= 17.5231 176.8662 5.8085
49.0201 5.9197 78.4026 17.6265 206.5024 .(54)
= 0.4483. (55)
And control law given by (38), based on output observations and past input is applied to IP system.
For FOS feedback based DSMC, discretetime system is transformed into regular form and sliding surface parameters are determined using same values of Q and R as, = 1.2224 1.8016 6.8178 1.4815 . (56)
Finally, control law (49) and sliding surface (50) are formulated and the controller based on PID and FOS based DSMC is implemented and the tuned PID controller parameters of the control scheme is given as in Table 1 below
Table 1 PID controller parameters of control scheme
Control method 
Cart PID Control 

PID+SLIDING MODE 
9 
10 
9 
The SIMULINK model for control of nonlinear inverted pendulum system for PID and FOS based DSM Controller shown on Fig.4 and result in Fig.5 and comparison of results shown in Fig 6.
Figure.4 PID AND FOS based DSM controller
Figure.5 PID AND DSMC RESULT
Figure 6 Comparision of Results
The SIMULATION model for control of nonlinear inverted pendulum system based on PID and FOS based DSMC is shown in Fig.4 and. In this approach output along with the input are considered for sampling for FOS feedback to DSMC. The simulation results are shown in Fig.5 and observed that pendulum and cart stabilizes very quickly and cart reaches the desired position quickly compared to both cases of two PID [26] and two PID and LQR Methods [26] shown in Fig 6.
5. CONCLUSION
In this paper control technique based on PID and fast output sampling feedback based Discrete sliding mode controller is investigated using nonlinear model of inverted pendulum system. The control laws are designed and simulated and results are obtained. The PID and modified FOS feedback based DSM controller simulation shows better result compared with two PID controller[26] and two PID and LQR[26] controller .
REFERENCE

K. Ogata, Modern Control Engineering, 4th ed, Pearson Education (Singapore) Pvt. Ltd., New Delhi, 2005, chapter 12.

J. R. White, System Dynamics: Introduction to the Design and Simulation of Controlled Systems, the online literature available at: http://www. profjrwhite.com/system dynamics/sdyn/s7/s7invpc3/s7invp c3.html

Ajit K. Mandal, Introduction to Control Engineering, New Age International Pub., New Delhi, 2000, Chapter 13.

F. L. Lewis, Optimal Control, John Wiley & Sons Inc., New York, 1986.

M. N. Bandyopadhyay, Control Engineering: Theory and Practice, Prentice Hall of India Pvt. Ltd., New Delhi, 2004, Chapter 13.

Roland S. Burns, Advanced Control Engineering, Elsevier – Butterworth Heinemann, 2001, Chapters 9 & 10.

Astrom K. J., and McAvoy Thomas J., "Intelligent control", J. Proc. Cont. 1992, Vol. 2, No 3, pp 115127.

T. I. Liu, E. J. Ko, and J. Lee, "Intelligent Control of Dynamic Systems", Journal of the Franklin Institute, Vol. 330, No. 3, pp. 491503,1993.

Yasar Becerikli, Ahmet Ferit Konar, and Tariq Samad, "Intelligent optimal control with dynamic neural networks", Elsevier Journal of Neural Networks, Vol. 16, 2003, pp251 259.

Kevin M. Passino, and Stephen Yurkovich, Fuzzy Control, Addison Wesley Longman, Inc., California, 1998.

M. A. Abido, "Optimal Design of PowerSystem Stabilizers using Particle Swarm Optimization", IEEE Transactions on Energy Conversion,Vol.17,No. 3, September 2002, pp. 406 413.

James Fisher, and Raktim Bhattacharya, "Linear quadratic regulation of systems with stochastic parameter uncertainties", Elsevier Journal of Automatica, vol. 45, 2009, pp. 28312841.

M.A. Denai, F. Palis, and A. Zeghbib, "Modeling and control of nonlinear systems using soft computing techniques", Elsevier Journal of Applied Soft Computing, vol. 7, 2007,pp728738.

G. Ray, S. K. Das, and B. Tyagi, "Stabilization of Inverted Pendulum via Fuzzy Control", IE(I) JournalEL, vol. 88, Sept. 2007, pp. 5862.

C. W. Tao, J. S. Taur, C. M. Wang, and U. S. Chen, " Fuzzy hierarchical swingup and sliding position controller for the inverted pendulumcart system", Elsevier Journal: Fuzzy Sets and Systems, vol. 159, 2008, pp. 27632784.

. J. Astrom, and K. Furuta, "Swinging up a pendulum by energy control", ElsevierPergamon Journal: Automatica, vol. 36, 2000,pp.287295.

H. Werner and K. Furuta, "Simultaneous Stabilization based on Output Measurement," Kybernetica, vol. 31, no. 4, pp. 395414, 1995.

P. Tiwari, G. D. Reddy, and B. Bandyopadhayay, "Design of Periodic Output Feedback and Fast Output Sampling based Controllers for Systems with Slow and Fast Modes," Asian Journal of Control, vol.14,pp.271277,January2012.

S. Janardhanan and B. Bandyopadhyay, "A New Approach for Designing Fast Output Sampling Feedback Controller," Proc. of Natioanl Conf. on Instrumentation and Control, NIT, Trichy, December 2003.

Bandyopadhyay, Y. J. Park, and O. Kang, "A New Formulation of DiscreteTime Sliding Mode Control using Multirate Output Feedback," Proc. of IEEE Intr. Conf. on Control, Automation and Systems, pp. 170175, October

G. Reddy, B. Bandyopadhyay, and A. P. Tiwari, "Discrete Time Sliding Mode Control for TwoTimeScale Systems," Proc. of IEEE Intr. Conf. on Industrial Electronics, pp. 170 175, November 2008.

G. Bartolini, A. Ferrara, and A. Utkin, "Adaptive Sliding Mode Control in DiscreteTime Systems," Automatic, vol. 31, no. 5, pp. 769773, 1995.

Edwards and S. K. Spurgeon, Sliding Mode Control: Theory and Applications. Bristol, PA: Taylor and Francies, 1998.

J. Y. Hung, W. Gao, and J. C. Hung, "Variable Structure Control: A Survey," IEEE Transactions on Industrial Electronics, vol. 40, pp. 222, February 1993.

L. B. Prasad, B. Tyagi, and H. O. Gupta, "Optimal Control of Nonlinear Inverted Pendulum Dynamical System with Disturbance Input using PID Controller and LQR," Proc. of IEEE Intr. Conf. on Control System, Computing and Engineering, pp. 540544, November 2011.

T. Chen, Linear System Theory and Design. New York: Oxford University Press, 1999.

Mat Lab/Simulink, Control System Toolbox. Version 2012a
V. L. Syrmos, C. T. Abdallah, P. Dorato, and K. Grigoriadis, "Static Output FeedbackA Survey," Automatica, vol. 33, pp.125137,1997.