Printer Friendly

PSO based neuro sliding mode controller for an inverted pendulum system.


The inverted pendulum is a highly nonlinear and open-loop unstable system. When the system is activated by a small force, the pendulum falls over quickly. Hence, the characteristics of an inverted pendulum make the identification and control more challenging. To develop an accurate model of the inverted pendulum, different linear and nonlinear methods of identification will be used. However, one of the problem encountered during modeling is collection of experimental data from the inverted pendulum system. Since the output data from the unstable system does not show enough information or dynamics of the system. The quality of a control algorithm is tested and demonstrated on the inverted pendulum problem due to its inherent instability and dynamic characteristics. The mathematical modeling of inverted pendulum system is derived based on Lagrange equations. Lagrange equation uses Kinetic and potential energies of mass stored in the pendulum [1,2].

The potential of SMC methodology was demonstrated for versatility for electric drives and functional goals of control [3]. Weibing Gao. et al., [4] addressed a general approach for the design and response control of variable structure control of a class of non-linear plants. Wong et al., [11] designed a sliding mode controller with boundary layer for an inverted pendulum system. Gasimov et al., [12] proposed the feedback coefficients in the sliding mode control of an inverted pendulum, as well as any other dynamic system, can be expressed as a non-linear programming problem with appropriately selected objective function and constraints. They used the modified subgradient algorithm to solve this non-linear programming problem.

However, SMC produces chattering in control variable. A Fuzzy Sliding Mode Control (FSMC) can be proposed based on Lyapunov's stability, which can assure both stability and robustness. It can provide continuous change of control gain so that chattering phenomenon can be attenuated [8].

Wu et al., [5] proposed a multilayer neural network to control the balancing of a base-excited inverted pendulum. They used neural inverse model for on-line estimation of the accelerations of the pendulum's base point. This neuro controller was tested through simulations. It was shown that it outperforms the previously Liapunov based controller.

Xiaogang ruan et al., [6] proposed a on-line adaptive control scheme based on feedback-error-learning applied to inverted pendulum balancing. The adaptive controller for balancing consists of a conventional feedback controller and a neural network feed forward controller. In this work, the nonlinearity of the controlled object was compensated by the neural network that was stimulated by previous feedback error signals.

In this study Sliding Mode Controller (SMC), Neuro Sliding Mode controller (NSMC) and PSO based NSMC are applied to an inverted pendulum system. The cost function is derived from Lyapunov stability criteria. As the cost function becomes smaller, outputs tend to the desired values and weights updating decreases. Simulation results are presented and discussed.

2 In-verted Pendulum System:

Very often the quality of a control algorithm is tested and demonstrated on the inverted pendulum problem due to its inherent instability and dynamic characteristics. Fig. 1 shows the free-bodied diagram of the inverted pendulum system. It is the problem of learning, how to balance an upright pole. Its solution consists of finding the horizontal force to be applied to the cart in order to balance the pole. The cart is moving on the track with no friction. Also, the pole is tied up to the cart by a frictionless hinge. Both the cart and the pole have only one degree of freedom, i.e. each of them can move in vertical plane only. Lagrange equations can be used to derive dynamical system equations for a complicated mechanical system such as the inverted pendulum. The Lagrange equations use the kinetic and potential energy in the system to determine the dynamical equations of the inverted pendulum system.


[theta]--Angle of the pole with respect to the vertical axis [??]--Angular velocity of the pole with respect to the vertical axis F--Force applied to the cart M--Mass of the cart m--Mass of the pole X--Position of the cart [??]--Velocity of the cart

The kinetic energy of the system is the sum of the kinetic energies of each mass. The kinetic energy Ec of the cart is

[E.sub.c] = 1 / 2 M [[??].sup.2] (1)

The pole can move in both the horizontal and vertical directions. So the pole kinetic energy is


From the free bodied diagram x2 and z2 are equal to

[x.sub.2] = x + L(sin [theta]) (3)

[z.sub.2] = L(cox [theta]) (4)

[[??].sub.2] = L(sin [theta])[??] (5)

[[??].sub.2] = [??] + L(cos [theta])[??] (6)

The total kinetic energy, E of the system is equal to

E = [E.sub.c] + [E.sub.p] (7)

Substitute Eq. (3),(4), (5)and (6) in (7)


The potential energy, V of the system is stored in the pendulum so

V = [mgz.sub.2] (9)

Substitute equation (4) in (9)

V = mgL(cos [theta]) (10)

The Lagrangian function is

P = E - V


The state-space variables of the system are x and [theta], so the lagrange equations are

d / dt ([partial derivative]P / [partial derivative][??]) - [partial derivative]P / [partial derivative]x = F (12)

d / dt ([partial derivative]P / [partial derivative][??]) - [partial derivative]P / [partial derivative][theta] = 0 (13)

Solving equation (12) and (13) the dynamic equations of the inverted pendulum is obtained given below

[[??].sub.1] = [x.sub.2] (14)

[[??].sub.2] = ((M + m)g(sin[x.sub.1]) - mL(sin[x.sub.1])(cos[x.sub.1])[x.sup.2.sub.2] - (cos[x.sub.1])F) (15)

[[??].sub.3] = [x.sub.4]

[[??].sub.4] = mL(sin[x.sub.1][x.sup.2.sub.2] - mg(sin[x.sub.1])(cos[x.sub.1] / ((M + m) - m[cos.sup.2][x.sub.1]) + F / ((M + m) - m[cos.sup.2][x.sub.1]

Let the state variables

[x.sub.1] = [theta]; Angle of the pole with respect to the vertical axis [x.sub.2] = [??]; Angular velocity of the pole with respect to the vertical axis [x.sub.3] = x; Position of the cart [x.sub.4] = [??]; Velocity of the cart To simulate the above equations, the mass of the cart, M is set to 1.2 kg, mass of the pendulum is set to 0.1 kg, length of the pendulum is 0.4 meters, gravitational force, g is set to 9.81 m/s. The above state equations are simulated using SIMULINK software. It is observed that the angle of the inverted pendulum shown in Fig. 2 does not give us enough information on the inverted pendulum system. The pendulum falls over quickly and it found to be unstable. One of the requirements in system identification is the collection of 'information rich' input-output data. In order to adequately model the inverted pendulum it is necessary to stabilize it using a nonlinear feedback controller.

3 Control Design:

Control law is derived from SMC structure. First, an appropriate sliding mode is selected to ensure dynamics' convergence to desired values. Control signal should be derived such that Lyapunov conditions are satisfied. Selecting the Lyapunov function using sliding mode is a natural and reasonable approach to get to the desired control goals that is tracking desired trajectory.

3.1 Design Of Sliding Mode Controller:

Sliding mode control (SMC) has been known for its capabilities in accounting for modeling imprecision, large signal stability, good dynamic response and simple implementation. It achieves robust control by adding a discontinuous control signal across the sliding surface, satisfying the sliding condition. However, the sliding mode control system has a particularly high control gain due to the non-linear compensation and can suffer from the effects of actuator chattering due to the switching and imperfect implementations. To design a sliding mode control [3,4], the time varying sliding surface is defined as

S = [c.sub.1] [theta] + [??]; [c.sub.1] > 0 (18)

Let the Lyapunov function is defined as

v = 1 / 2 [s.sup.2]

If [MATHEMATICAL EXPRESSION NOT REPRODUCIBLE IN ASCII] is satisfied, the state trajectory of the system will be forced to approach the sliding surface. Hence, the control law for sliding mode control is derived as follows: From eqn. (15)

[[??].sub.2] = ((M + m)g(sin[x.sub.1]) - mL(sin[x.sub.1])(cos[ x.sub.1])[x.sup.2.sub.2] / L((M + m) - m[cos.sub.2][x.sub.1] - (cos[x.sub.1]) / L((M + m) - m[cos.sup.2][x.sub.1] (20)

[[??].sub.2] - ((M + m)g(sin[x.sub.1]) - mL (sin[x.sub.1])[x.sup.2.sub.2] / L((M + m) - m[cos.sup.2][x.sub.1] = - (cos[x.sub.1]) / L((M + m) - m[cos.sup.2][x.sub.1] (21)

From eqn.(18)

[??] = s - [c.sub.1][theta] (22)

Substitute [X.sub.2] = [??] and sliding surface s=0 in eqn. (22)

[x.sub.2] = -[c.sub.1][theta] (23)

[[??].sub.2] = -[c.sub.1][??] (24)

Substitute eqn. (5.51) in eqn. (5.48)





The control input u is chosen as u = F - K*sign(s) (29)

where, K is control gain and


The graphical representation of sgn function is presented in Fig.3. The correct magnitude and force to keep the pendulum stable is calculated by the control law. If the control law 'u' as given in eqn. (29) is chosen, then negative v is guaranteed, and the system state will approach the sliding surface gradually. Although the control law as eqn. (29) can force state to the sliding surface, chattering phenomena will occur after the first time state hits the sliding surface [3]. It is a drawback in the sliding mode control behavior, and will lead to an unstable condition of the controlled system. This is owing to the discontinuous of 'sgn' function in eqn (30).

3.2 Design of Neuro Sliding Mode Controller (NSMC):

In most of the works in literature which are combined Neural Networks with SMC, derived from a neural network. Though, here we use a back propagation neural network to get the whole control signal. According to equation 29, to construct the equivalent controller, the thorough knowledge of the plant dynamics are required. Mostly, such information is difficult to obtain or it may be unknown. Therefore, in order to avoid the computational burden, we use a neural network to estimate the equivalent control uequ in SMC to organize a NSMC.

Figure 4 shows system configuration of input-output relation of the NN. The NN consists of three layers: an input layer, an output layer and a hidden layer. The neural architecture with 5 input neurons, 10 hidden neurons and one output neuron (5-10-1) gives satisfactoiy performance to meet the error goal of le-08.

3.2 Design of PSO based Neuro Sliding Mode Controller (NSMC):

Particle Swarm Optimization proposed by Eberhart and James Kennedy [7]. This method is dependent on simulation of social behavior and universal optimization technique. Exchange of data in individuals called particles in swarm is the base for PSO. According to the neighboring particle, which attains the best, an individual particle modifies its trajectory to reach its own best position. Later the best position among the population is identified and particle moves towards the global best and in such a case entire swarm is considered as neighborhood. N particles form a swarm and working in D-dimensional search space. The random velocity may be assigned to each particle. Each particle will modifies its flying speed based on its own and companion's experience at every iteration.

On account of multivariable optimization, the swarm is thought to be of a predefined or constant size with every particle found at first at arbitrary areas in the multidimensional outline space. Every particle at first accepted to have two attributes: a position and a velocity.

Every particle meanders around in the space and recalls the best position (as far as the nourishment source or target or objective function values) which is found by it. The particles convey data or great positions to each others and as needs to be conform their individual positions and velocities depends on the data got about the best positions.

Let us analyze the behavior of birds in a flock. Though each one has a restricted intelligence by itself, the following rules are to be considered:

> The bird is attempting to not be near different birds.

> The bird is attempting to head towards the normal course of other birds.

> It tries to fit the "normal position" among birds with no huge holes in the run.

Hence, the conduct of the flock or swarm depends on the three variables such as cohesion, separation and alignment The block diagram of PSO based NSMC for inverted pendulum system is shown in Figure 6. The observation time is Tob=20 Sec, the step size of the simulation is Hs = 0.001 Sec, the average generations is 150, the number of particles is 10. The PSO setting parameters are C1 = C2 = 1.5.


The simulated servo response of inverted pendulum with SMC, NSMC and PSO based NSMC are shown in Fig.7 and the corresponding controller output is shown in Fig. 8. It is observed that the NSMC and PSO based NSMC reduces the oscillations when compared to SMC and also track the setpoint [[theta].sub.d] - 0[degrees]. The weakness of SMC can be seen in Fig. 7. The results reveal that PSO based NSMC controller gives better result for open-loop unstable inverted pendulum system.. It is clear that PSO based NSMC is accurate enough to control the desired operating point. The performance measures for servo response of inverted pendulum using SMC, NSMC and PSO based NSMC are given in Table1. It reveals that PSO based NSMC gives superior result for inverted pendulum system.


In this paper, SMC, NSMC and PSO based NSMC are designed and implemented for an open loop unstable inverted pendulum system. The servo response of inverted pendulum system shows that the PSO based NSMC produces better result in terms of lesser ISE value and faster settling time when compared with those of SMC and NSMC.


[1.] Mohand Mokhtari and Michel Marie, 2000. Engineering Applications of MATLAB 5.3 and SIMULINK 3.

[2.] Tim Callinan, 2003. Artificial Neural Network Identification and Control of the Inverted Pendulum, M.S. Thesis.

[3.] Utkin, V.I., 1978. "liding Modes and Their Application in Variable Structure Systems, MIR, Moscow.

[4.] Weibing Gao Hung J.C., 1993. "Variable Structure Control of Nonlinear Systems: a New Approach", IEEE Transactions on Industrial Electronics, 40(1): 44-55.

[5.] Wu, Q., N. Sepehri and S. He, 2002. "Neural Inverse Modeling and Control of a Base-Excited Inverted Pendulum", Journal on Engineering Applications of Artificial Intelligence, 15: 261-272.

[6.] Xiaogang Ruan, Mingxiao Ding, Daoxiong Gong and Junfei Qiao, 2007. "On-line Adaptive Control for Inverted Pendulum Balancing based on Feedback-Error-Learning", Elsevier Science Publishers, 70(4-6): 770-776.

[7.] Eberhart, R. and J. Kennedy, 1995. A new optimizer using particle swarm theory. In Micro Machine and Human Science, 1995. MHS'95., Proceedings of the Sixth International Symposium on (pp. 39-43). IEEE.

[8.] Ishigame, A., T. Furukawa, S. Kawamoto and T. Taniguchi, 1993. Sliding mode controller design based on fuzzy inference for nonlinear systems (power systems). IEEE transactions on industrial Electronics, 40(1): 64-70.

[9.] Mokhtari, Mohand and Michel Marie. 2000. "Cart with inverted pendulum." Engineering Applications of MATLAB[R] 5.3 and SIMULINK[R] 3. Springer London, pp: 303-346.

[10.] Callinan, T., 2003. Artificial Neural Network identification and control of the inverted pendulum. MEng Project Reports, School of Electronic Engineering Dublin City University.

[11.] Wang, J., A.B. Rad and P.T. Chan, 2001. Indirect adaptive fuzzy sliding mode control: Part I: fuzzy switching. Fuzzy sets and Systems, 122(1): 21-30.

[12.] Gasimov, R.N., A. Karamancioglu and A.Y azici, 2005. A nonlinear programming approach for the sliding mode control design. Applied mathematical modelling, 29(11): 1135-1148.

(1) Geethanjali Karuppaiyan and (2) S. Srinivasan

(1) Research scholar, Electronics and Instrumentation Engg., Annamalai University, lndia-608002

(2) Associate Professor, Electronics and Instrumentation Engg., AnnamalaiUniversity, India-608002

Received 18 December 2016; Accepted 12 February 2017; Available online 20 February 2017 Address For Correspondence:

Geethanjali Karuppaiyan, Department of Electronics and Instrumentation Engineering, Annamalai University, Annamalai nagar, Tamil nadu, India-608002

Caption: Fig. 1: Inverted pendulum

Caption: Fig. 2: Open loop response of the inverted pendulum.

Caption: Fig. 3: Sgn function with respect to s.

Caption: Fig. 4: Neural network architecture of a forward neural model for an inverted pendulum. The structure of NSMC is given in figure 5.

Caption: Fig. 5: Structure of NSMC for an inverted pendulum system.

Caption: Fig. 2.5: Flowchart of PSO algorithm.

Caption: Fig. 6: Structure of PSO based NSMC for an inverted pendulum system.

Caption: Fig. 7: The time response of angle obtained by implementing SMC, NSMC and PSO based NSMC.

Caption: Fig. 8: The time response of force applied to the cart obtained by Implementing SMC, NSMC and PSO based NSMC.
Table 1: Performance measures of inverted pendulum system with SMC,
NSMC and PSO based NSMC.

Type of controller   Integral square error   Settling time (seconds)
SMC                  2.54                    12
NSMC                 1.26                    15
PSO based NSMC       0.152                   5
COPYRIGHT 2017 American-Eurasian Network for Scientific Information
Copyright 2017 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Author:Karuppaiyan, Geethanjali; Srinivasan, S.
Publication:Advances in Natural and Applied Sciences
Geographic Code:1USA
Date:Feb 1, 2017
Previous Article:Experimental study on promoting the thermal performance of a forced draft counter flow evaporative cooling tower.
Next Article:Study addition double inhibitor consist of MgO and Si[O.sub.2] to residual oil to prevent hot corrosion of stainless steel (304 L) of boilers pipes...
