Content uploaded by Arpit Jain

Author content

All content in this area was uploaded by Arpit Jain on Jun 07, 2021

Content may be subject to copyright.

Available via license: CC BY 4.0

Content may be subject to copyright.

Received January 27, 2021, accepted February 8, 2021, date of publication February 11, 2021, date of current version April 7, 2021.

Digital Object Identifier 10.1109/ACCESS.2021.3058645

Real-Time Swing-Up Control of Non-Linear

Inverted Pendulum Using Lyapunov Based

Optimized Fuzzy Logic Control

ARPIT JAIN 1, ABHINAV SHARMA 1, VIBHU JATELY 2,

BRIAN AZZOPARDI 2, (Senior Member, IEEE),

AND SUSHABHAN CHOUDHURY1

1Department of Electrical and Electronics Engineering, University of Petroleum and Energy Studies, Dehradun 248007, India

2MCAST Energy Research Group, Institute of Engineering and Transport, Malta College of Arts, Science and Technology, 9032 Paola, Malta.

Corresponding author: Abhinav Sharma (abhinav.sharma@ddn.upes.ac.in)

This work was supported in part by the European Commission H2020 TWINNING Networking for Excellence in Electric Mobility

Operations (NEEMO) Project under Grant 857484.

ABSTRACT This paper investigates the efﬁcacy of an optimized fuzzy logic controller for real-time

swing-up control and stabilization to a rigidly coupled twin-arm inverted pendulum system. The proposed

fuzzy controller utilizes Lyapunov criteria for controller design to ensure system stability. The membership

functions are further optimized based on the entropy function. The controller design is based on the black-box

approach, eliminating the need for an accurate mathematical model of the system. The experimental results

shows an improvement in the transient and steady-state response of the controlled system as compared to

other state-of-the-art controllers. The proposed controller exhibits a small settling time of 4.0 s and reaches

the stable swing-up position within 5 oscillations. Various error indices are evaluated that validates an overall

improvement in the performance of the system.

INDEX TERMS Fuzzy entropy, real-time control, twin-arm inverted pendulum, fuzzy membership function

optimization.

I. INTRODUCTION

Inverted pendulum (IP) system has always attracted control

system engineers due to its wide range of applications. The

inverted pendulum ﬁnds direct application in segway and the

extended system is also applicable in designing and modeling

complex systems like, bipedal walking, robotic manipulator

systems, missile control among many others [1], [2]. Being

a non-linear underactuated system, the control of inverted

pendulum is typically considered as a benchmark to test the

efﬁcacy of new control algorithms [3]. Researchers have

applied several control strategies for the control and stabi-

lization of the inverted pendulum system. In [4], the authors

developed a feedback linearization control to stabilize the

inverted pendulum system. The authors added adaptive fuzzy

control to ensure asymptotic stability. The control system

was applied on a real-time cart-position tracking by keeping

The associate editor coordinating the review of this manuscript and

approving it for publication was Xiaojie Su.

the pendulum angle at its equilibrium position. In [5], the

authors proposed a fuzzy logic controller for swing up con-

trol of a real-time pendulum. The authors designed a fuzzy

separate fuzzy controller for cart position control and the

pendulum angle stabilization was achieved in 10 seconds.

In [6], the authors proposed an optimized fuzzy controller

for an inverted pendulum system based on the minimization

of an objective function which is dependent on the mean

square error. The Gaussian membership function for the

fuzzy controller was optimized using an objective function

deﬁned with the help of mean square error. The developed

controller is used to track the pendulum angle trajectory.

In [7], authors proposed a Takagi-Sugeno based fuzzy logic

controller for swing-up control of inverted pendulum. The

rule base for the controller is designed using Lyapunov’s

direct method, which ensures the stability of the system.

In [8], the authors proposed an artiﬁcial neural network based

controller to stabilize an inverted pendulum for a segway.

The authors developed the controller of this mobile inverted

VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ 50715

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

pendulum by using radial basis function to independently

determine the gains of the PID controller for both pendulum

angle and position control. The real-time implementation of

the controller on the mobile inverted pendulum showed the

movement of the platform while maintaining the pendulum

at an erected position. In [9], the authors used cascaded fuzzy

controllers for a ﬂexible joint robot manipulator. The cascade

controller employs 3 fuzzy controllers out of which 2 con-

trollers are used to control the motor rotation, and deﬂection

angle. The output of these two fuzzy controllers is then fed to

the third controller which produces the ﬁnal control signal.

The cascaded controller approach results in the reduction

of link vibrations and achieves faster tracking and reduces

the settling time. In [10], authors develoepd a vision based

feedback controller for stabilization of inverted pendulum.

The authors deployed vision based pendulum angle measure-

ment for feedback in place of encoders which are used in

a majority of applications that require angle measurement.

The vision based feedback control loop had a maximum time

delay of about 35 ms, and a resolution of 0.1o. The proposed

controller demonstrated a satisfactory stabilization and a high

disturbance rejection with an accuracy of ±0.2◦. In [11],

authors designed a linear quadratic regulator for swing-up

stabilization of a real-time inverted pendulum system. The

authors used the Lagrangian method for parameter identiﬁ-

cation and the total energy at the upright position was forced

to zero, thereby obtaining the optimal control signal. In [12],

authors developed a swing up and stabilization controller for

a real-time rotatory inverted pendulum system. The control

action is obtained by switching the control objective between

two separately designed controllers for swing-up and sta-

bilization action, respectively.. In [13], authors deployed a

hybrid self-tuning Fuzzy based adaptive PID controller for

swing-up control for a real-time inverted pendulum system.

The authors designed two separate adaptive PID controllers

to control the cart position and to provide stabilization of

the pendulum angle.. In [14], the authors developed a fuzzy

based virtual model control (VMC) for stabilization of the

pendulum angle under parametric uncertainty. The proposed

controller is essentially divided into three steps: (a) imagine

and attach virtual components to the system followed by, (b)

obtain the virtual forces and torques and ﬁnally (c) feeding

these values to the real system to realize the virtual forces and

torques. The performance of VMC controller was found out

to be superior as compared to the linear quadratic regulator.

In [15], the authors developed a fuzzy-based linear quadratic

regulator to control a double link rotatory inverted pendulum.

The authors employed the Mamdani type fuzzy model to

adjust the linear state feedback controller gains. The con-

troller gain matrix was further optimized by adding Kalman

ﬁlter. In [16], authors developed a fuzzy controller based on

a guaranteed cost control objective function for swing up

control of the inverted pendulum system. The controller is

built around the linearized model of the inverted pendulum

system. The stability of the controller is analyzed using the

Lyapunov method. The proposed cost controller ensured the

stability of the system and aids in disturbance rejection..

In [17], the authors developed a self-tuning linear-quadratic

regulator for swing-up control and stabilization of an inverted

pendulum system. The authors developed a cognitive model

of the inverted pendulum system based on which the actuator

dynamics and the controller has been designed.

A. FUZZY LOGIC OPTIMIZATION

The fuzzy logic system is usually used to design controllers

for non-linear systems due to its inherent characteristic to

handle the system without a need for an accurate math-

ematical model [18], [19]. Fuzzy logic systems are also

advantageous where the control signal is to be generated in

presence of vague/noisy measurement data [20]. Fuzzy-logic

based systems are beneﬁcial in a wide range of applica-

tions which has already been tested and proved by multiple

sources [21]–[24]. The selection of the correct membership

function has been amongst the most researched area for

optimizing the performance of fuzzy controllers. In [25],

the authors used s-function for deﬁning membership func-

tion (MF) and maximizing fuzzy entropy corresponding to

the MF. The performance of the developed method had been

evaluated for image processing applications. In [26], the

authors proposed the tuning of the gains of a fuzzy type PID

controller by applying particle swarm optimization (PSO)

technique. The proposed algorithm was implemented to con-

trol an industrial DC drive. The simulation and experimental

results indicates an improved performance and robustness of

the controller. In [27], the authors proposed the optimiza-

tion of a fuzzy system using cross-mutated operation using

PSO. The robust performance of the proposed algorithm is

evaluated for: (a) the economic load dispatch system and (b)

self-provisioning system used in communication network ser-

vices. Results indicate an improved system efﬁciency and

better robustness as compared to the hybrid PSO technique.

In [28], the authors investigated the application of PD type

fuzzy logic controller in trajectory tracking of differential

drive mobile bot. The authors used a Takagi-Sugeno based

fuzzy controller having 7 sets in each variable. The per-

formance of the controller has been compared with PID

and PD controllers. The results indicate a superior perfor-

mance of PD type fuzzy logic controller as compared to

conventional controllers. In [18], the authors investigated a

statistical-based optimization approach for ﬁnding the opti-

mum support in a fuzzy logic system using fuzzy entropy

measures.

This paper proposes an algorithm to optimize the mem-

bership function for designing a fuzzy logic controller. The

proposed algorithm is tested for real-time swing-up control

and stabilization of the inverted pendulum system and per-

formance indices for the proposed controller are compared

with state-of-the-art controllers. The key novelty features of

the proposed work are:

1. Designed an optimal fuzzy controller based on a novel

objective function which comprises of fuzzy entropy.

50716 VOLUME 9, 2021

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

2. Developed a fuzzy controller based on Lyapunov stabil-

ity criteria to ensure asymptotic stability of the devel-

oped controller.

3. The developed controller is deployed for real-time

swing up stabilization of a rigidly coupled twin-arm

inverted pendulum system.

4. To compare the performance of the proposed controller

with other state-f-the-art controllers based on some

key parameters to validate the efﬁcacy of the proposed

controller.

The rest of the paper layout is: Section 2 illustrates the digital

pendulum model. Section 3 describes the proposed fuzzy

logic controller (FLC) developed for the system. In section 4

the objective function and the optimization technique used to

optimise the fuzzy set (FS) is discussed in detail. Section 5

explains the experimental results of a swing-up control for

a real-time inverted pendulum system. In section 6, robust-

ness of the proposed algorithm is analyzed. In section 7,

the proposed controller is compared with state-of-the-art

controllers based on certain key performance parameters..

Finally, Section 7 discusses the salient ﬁndings of the study.

II. REAL-TIME DIGITAL CONTROL OF TWIN-ARM

INVERTED PENDULUM MODEL

The ﬁgure of the rigidly coupled twin-arm digital pendulum

with the cart system is illustrated in Figure 1.

FIGURE 1. Cart driven twin-arm inverted pendulum [29].

Mathematically the forces acting on the system can be

summarized as:

F=mp+Mc¨x+b˙x+mpl¨

θcosθ−mpl˙

θ2sinθ(1)

I+mpl2¨

θ−mpglsinθ+mpl¨xcosθ+d˙

θ=0

(2)

¨

θ=mglsinθ−m2l2a˙

θ2sinθcosθ−mal cosθF

I−m2l2acos2θ+ml2(3)

where, a=1

mp+Mc

Assuming the state variables: x1=θ,x2=˙

θ,x3=x,

x4= ˙x. Then:

˙x1=x2(4)

TABLE 1. Parameters for real-time model.

˙x2=gsinx1−mplax2

2sinx1cosx1

4l3−mpla cos2x1

(5)

˙x3=x4(6)

˙x4=−mpag sin x1cos x1+4mpla

3x2

2sinx1+4aF3

4

3−mpa cos2x1

(7)

To design a PID controller a linearized model is obtained.

The equations are linearized around the inverted position,

i.e. θ=0 (operating point).

˙x1

˙x2

˙x3

˙x4

=

0 1 0 0

3g

4l−3mpla 0 0 0

0 0 1 0

−3mpag

4−3mpa0 0 0

·

x1

x2

x3

x4

+

0

3a

3mpla −4l

0

4a

4−3mpa

u

(8)

Table 1 shows the parameters for the real-time model

used in the experiment setup, manufactured by ‘‘Feedback

instruments the digital pendulum system: 33-936S’’ [29].

By substituting the value from Table 1 in(8), the following

eigenvalues are obtained:

e1=0,e2=4.43,e3= −4.43,e4=1

As evident from the eigen values, we can conclude that

the system is unstable. The criteria for controller design is

to make the eigenvalues negative and in turn, stabilize the

system.

Figure 2 illustrates the control block diagram for the same.

The computer is connected to a data acquisition (DAQ) card

which is an interface between the analog pendulum system

and the digital computer. The control signal is generated

by MATLAB – Simulinkrand is a digital signal, which is

then converted to an analog signal of ±5 volts by the DAQ

interface, which is converted to ±24 volts for motor operation

by DC motor interface. The position of the cart and the angle

of the pendulum are measured using encoders. The ﬁrst is

attached to the DC motor and the latter to the cart-pendulum

for respective angular measurements. These encoders give

analog signals for real-time measurement which are again

converted to digital values via DAQ card.

VOLUME 9, 2021 50717

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

FIGURE 2. Digital control block diagram [29].

III. FUZZY LOGIC CONTROLLER

For designing an FLC precise mathematical model of the

system is not mandatory, however expert knowledge of the

system under study is required, as FLCs are primarily inspired

by the decision-making process of human beings. These can

infer linear or nonlinear complex relationships between the

input and output variable(s) [30]. The controller architecture

designed for IP consists of a PD (proportional-derivative)

type FLC designed to control the cart for driving the pendu-

lum to an inverted position. The architecture of the PD type

fuzzy logic controller used is depicted in Figure 3.

FIGURE 3. FLC architecture for the digital pendulum.

A. PREDEFINED MEMBERSHIP FUNCTIONS

For control applications, FS are commonly named concerning

their relevant position with reference to error. As for any

control system, the desired error is always ‘zero’, hence FS

associated around ‘zero error’ is named as ‘zero’. Moving

on to the positive x-axis the FS which are associated with

the positive error is named ‘positive’ and for the negative

x-axis the FS which is associated with the negative error is

named ‘negative’, respectively [31]. Initially, the MFs are

distributed uniformly around the universe of discourse and

Gaussian fuzzy MFs are chosen. The proposed controller

is a two-input one output system; having (i) error in angle

(1θ), and (ii) rate of change for error in angle (d(1θ )dt)

as input variables and (iii) control signal (u) for DC motor,

acting as an output variable. Fuzzy sets for error in pendulum

angle are given in Figure 4. Here three overlapping normal

(i.e. µmax =1) Gaussian FS are deﬁned which are distributed

uniformly across the universe of discourse. For example, the

equation for set zero ‘‘ZE’’ can be written as:

µz(x)=e−x2(9)

FIGURE 4. Predefined membership function.

B. STABILITY ANALYSIS USING LYAPUNOV TECHNIQUE

The system dynamics can be represented as:

˙x=f(x)+g(x)u+d(x)w(10)

The linguistic control rules will be formed without know-

ing the terms f(x),g(x),d(x) and w(disturbance) consid-

ering the pendulum as a black box system. The linguistic

control rules are:

•R1: State variables of the system: x1=θ,x2=˙

θ,

x3=x,x4= ˙x

•R2: ˙x2is proportional to the control input u

•R3: ˙x4is proportional to −x3

The statements R1, R2 and R3 ensure the stability of the

system. The controller design objective is to ﬁnd a u(control

force) at which the system is stable, considering the operating

point as [x1x2x3x4]T=0.

Let V=1

2[x2

1+x2

2+x2

3+x2

4] be the Lyapunov function,

hence as per the state variables deﬁned for the system we can

write:

˙

V=x1x2+x2˙x2+x3x4+x4˙x4(11)

Using the control rules R2 and R3

˙

V≈x1x2+x2u(12)

As per classical Lyapunov synthesis, the control input uthat

ensures ˙

V<0, can be formed using the following rule base:

•If x1is negative AND x2is negative, THEN uis positive

•If x1is negative AND x2is positive, THEN uis zero

•If x1is positive AND x2is positive, THEN uis negative

•If x1is positive AND x2is negative, THEN uis zero

Using the product operator for inference and centre of grav-

ity as the defuzziﬁcation process, the control signal can be

depicted as (13), as shown at the bottom of the next page.

To analyse control law and we assume µp(x)=

e−(x−ax)2, µn(x)=e−(x+ax)2, µz(x)=e−x2, (14), as shown

at the bottom of the next page.

Simplifying equation (14) we have, u, as shown at the bottom

of the next page.

50718 VOLUME 9, 2021

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

Or

u= − au

2tanh 2ax1x1+tanh(2ax2x2)(15)

The fuzzy set design parameters ax1,ax2and auare computed

using the maximum entropy principle for the fuzzy system.

The following section discusses the optimization principle

used.

IV. OBJECTIVE FUNCTION AND OPTIMIZATION

TECHNIQUE

The proposed optimization principle is based on the maxi-

mization of entropy of MF displaced by standard deviation

data obtained from the system [32].

The mathematical expression for probability measures of

FS according to which fuzzy entropy can be written as [29]:

H(A)= − Z∞

−∞

{µilog µi+(1−µi) log(1 −µi)}(16)

For example, fuzzy entropy for positive MF can be calculated

as:

Hµp(x)= − Z∞

−∞

f(e−(x−ax)2)dx (17)

As previously discussed in section III. The standard Gaus-

sian fuzzy sets is used for representing the fuzzy variables,

namely: error,change in error, and control output. The

control signal expressed in equation (15) depends on the

membership function parameters which are optimized using

the maximum entropy principle with stopping criteria of a

minimum optimal control cost function which is deﬁned as:

J=Zt

0xT(τ)x(τ)+u2(τ)dτ(18)

Hence, for obtaining the optimized membership function the

optimization problem is deﬁned as:

maximize:H(A)= − Z∞

−∞

{µilog µi+(1−µi) log(1 −µi)}

subject to:min (J) (19)

The optimization process is carried out on the membership

function by displacing the standard Gaussian membership

function using standard deviation for individual fuzzy sets

which are to be optimized. For instance, considering the input

variable error in pendulum angle 3 membership functions

are deﬁned: zero, positive and negative. The membership

function zero can be deﬁned as:

µz=e−x2(20)

By displacing the set one can obtain the new fuzzy set µ∗

z

which can be written as:

µ∗

z=e−(x−σe)2(21)

where, σeis the standard deviation obtained for the error

in pendulum angle. The graphical depiction of a displaced

membership function is represented in Figure 5. The ﬁgure

depicts a few intermediate sets for the fuzzy set ‘‘zero’ when

it is displaced. During the optimization process, the algorithm

is supplied with the value of the standard deviation for each

of the fuzzy variables which is then optimized using (15),

(18) and (19). The standard deviation is obtained through

stabilization of the IP system using PID controller:

σe=1.6752 σ˙e=3.57 σc=0.3248

u=µn(x1)µn(x2) (au)+µp(x1)µp(x2) (−au)

µn(x1)µn(x2)+µp(x1)µp(x2)+µn(x1)µp(x2)+µp(x1)µn(x2)(13)

u=e−(x1+ax1)2e−(x2+ax2)2(au)−e−(x1−ax1)2e−(x2−ax2)2(au)

e−(x1+ax1)2e−(x2+ax2)2+e−(x1−ax1)2e−(x2−ax2)2+e−(x1+ax1)2e−(x1−ax1)2+e−(x1−ax1)2e−(x2+ax2)2(14)

u=

(au)he−(x2

1+a2

x1+x2

2+a2

x2)i[e−2ax1x1e−2ax2x2−e2ax1x1e2ax2x2]

e−(x2

1+a2

x1+x2

2+a2

x2)[e−2ax1x1e−2ax2x2+e2ax2x2+e2ax1x1(e−2ax2x2+e2ax2x2)

u=au[e−2ax1x1e−2ax2x2−e2ax1x1e2ax2x2]

(e−2ax1x1+e2ax1x1)e−2ax2x2+e2ax2x2

u= − au

2"e−(x1−ax1)2−e−(x1+ax1)2

e−(x1−ax1)2+e−(x1+ax1)2+e−(x2−ax2)2−e−(x2+ax2)2

e−(x2−ax2)2+e−(x2+ax2)2#

u= − au

2"e2ax1x1−e−2ax1x1

e2ax1x1+e−2ax1x1+e2ax2x2−e−2ax2x2

e2ax2x2+e−2ax2x2#

VOLUME 9, 2021 50719

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

Using the displaced fuzzy sets, the optimization problem can

now be deﬁned as:

maximize:H(A)= − Z∞

−∞

{µ∗

ilog µ∗

i+(1−µ∗

i)

×log(1 −µ∗

i)}

subject to:min (J) (22)

Here µ∗

idepicts the corresponding displaced fuzzy sets. The

objective function is optimized using genetic algorithm.

FIGURE 5. Displaced fuzzy set ‘‘zero’’.

TABLE 2. GA parameters.

The parameters used for genetic algorithm (GA) is given

in Table 2.. Using the GA based optimization of the objective

function, the resultant optimized FS is used to replace prede-

ﬁned MFs and is thus used for designing optimized FLC. The

same method is utilized to obtain optimized MFs for the rate

of change of error in angle, and the control signal of the DC

motor.

V. REAL-TIME DIGITAL PENDULUM SWING-UP CONTROL

Figure 6 depicts the real-time hardware in action and indicates

the stabilized inverted position achieved during experiments.

In swing up stabilization, the pendulum system is at an

initial angle of θ=180o(the natural equilibrium of a

simple pendulum). The control philosophy for the inverted

pendulum is fairly simple: here the controller’s target is to

swing upright and maintain the position of the pendulum to

FIGURE 6. Experimental setup indicating pendulum in a stable inverted

position.

an inverted position by counteracting the earth’s gravitational

force. To generate this counteractive force, the cart is moved

back and forth, due to which the pendulum gains inertia

leading to an oscillatory motion. Once the pendulum reaches

the desired inverted position the cart tries to maintain the

inverted position [33].

A. PID CONTROLLER

The PID control algorithm consists of two controllers with

only one being active at a time. One is designed for swing-

ing up the pendulum pole and the other for stabilization of

pendulum as it reaches the inverted position. The control

algorithm for pendulum swing up is designed to regulate the

force applied to the cart in such a way that the pendulum

starts to oscillate with a successive increase in the oscilla-

tion magnitude. When the pendulum reaches the inverted

position the stabilization algorithm then tries to maintain the

inverted position with minimal control effort applied to the

cart.Here, the PID settings have been optimized for minimum

ISE (Integral square error)once the values are obtained using

the Ziegler-Nichols method [29]. Pendulum angle stabiliza-

tion using a PID controller is shown in Figure 7. The con-

troller performance parameters are observed as: (a) Settling

time – ts=18 seconds (b) Peak value – Mp=6.01 radians.

B. FUZZY LOGIC CONTROLLER AND NOVEL OPTIMIZED

FLC

The PID control is now replaced by the fuzzy logic controller

as illustrated in Figure 3. Pendulum angle stabilization con-

trol using FLC is given in Figure 8. With this result, the con-

troller performance parameters are observed as (a) Settling

time – ts=8.4 seconds (b) Peak value – Mp=4.9 radians.

This indicates an improvement over PID control, with the set-

tling time being reduced by 53.33% and peak value by 18%.

50720 VOLUME 9, 2021

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

FIGURE 7. Pendulum angle for PID controller.

FIGURE 8. Pendulum angle for FLC.

The predeﬁned MFs used in FLC are replaced by opti-

mized MFs obtained from the proposed algorithm and opti-

mized FLC is used to control the digital pendulum. The

pendulum angle stabilization using optimized FLC is given

in Figure 9.

With this result the controller performance parameters are

observed as: (a) Settling time – ts=4.0 seconds (b) Peak

value – Mp=5.52 radians. These values indicate an improve-

ment over PID control, with the settling time being reduced

by 77.78% and peak value by 8.2%. However, the comparison

of these parameters over FLC indicates a reduction of settling

time by 52.38% but an increase in peak value by 12.6%. One

of the biggest improvements exhibited by the proposed con-

troller is the reduction in oscillations, as the pendulum angle

gets stabilized in 5 oscillations, while it took 26 oscillations

for PID and 9 oscillations for FLC to stabilize the pendulum

angle.

FIGURE 9. Pendulum angle for optimized FLC.

Figure 10 delineates the cart position for PID, fuzzy, and

optimized fuzzy controller. The back and forth movement of

the cart provides inertia to the pendulum and is responsible for

maintaining the inverted position of the pendulum. The cart

movements are random until the pendulum angle is stabilized

and are periodic once the inverted position is obtained.

FIGURE 10. Cart position comparison for PID, FLC, novel FLC.

Figure 11 depicts the control forces (u) generated by the

respective controllers. The back and forth cart movements can

be associated with crisp control forces generated before the

sudden spike in the control force where the spike is generated

while the pendulum is being balanced to stabilize it to an

VOLUME 9, 2021 50721

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

inverted position. After which the motor continuously tries

to counter the effect of gravity on the pendulum.

FIGURE 11. Control force comparison for PID, FLC, novel FLC.

C. COMPARATIVE ANALYSIS OF RESULTS OBTAINED FOR

PENDULUM STABILIZATION

Comparison of performance (pendulum angle stabilization)

in swing up mode for PID control, FLC, and optimized FLC

are given in Figure 12. Pendulum angle stabilization compar-

ison indicates that steady-state error for all the controllers

is ‘‘0’’. It can, however, be concluded that the pendulum

angle is stabilized within a shorter duration for optimized

FLC as compared to PID control or FLC. Table 3 summarizes

‘‘Settling time (ts)’’, ‘‘Peak Value (Mp)’’ and the oscillations

exhibited by the pendulum to be stabilized by the three dis-

tinct controllers.

TABLE 3. Settling time and peak value comparison for pendulum angle

stabilization.

Table 4 summarizes error indices (error in pendulum angle)

for PID, FLC, and proposed controller; these indices include:

root mean square error (RMSE), integral square error (ISE),

integral time multiplied square error (ITSE), integral absolute

error (IAE), integral time multiplied square error (ITAE) [34]:

FIGURE 12. Comparison of performance for PID, FLC, novel FLC.

TABLE 4. Performance indices.

As the steady-state error for the (PID, FLC, and novel

FLC) controllers is: ‘‘0’’, the comparisons have been carried

out for: Settling time, Peak value, and error indices. The

proposed ‘optimized FLC’ exhibits minimum settling time

(fast convergence) among the three controllers. The peak

value is however only marginally different between the three

controllers, which is an unavoidable phenomenon in swing

up angle stabilization of an inverted pendulum. Further, the

minimum values of the performance indices are demonstrated

by optimized FLC. Hence it is innocuous to say that the pro-

posed optimized FLC is an efﬁcient and effective controller,

and shows an improvement over benchmark PID control and

conventional FLC.

VI. ROBUSTNESS ANALYSIS

In this section, the authors have examined the robustness of

the proposed algorithm. The robust analysis is carried out

under small disturbances within: (a) the system parameters

and (b) the measurement unit by adding external noise. The

block diagram illustrating both internal and external distur-

bances that are added to the system is shown in Figure 13.

A. SYSTEM PARAMETERS VARIATION

For robustness analysis the ﬁrst step is to vary system parame-

ters to evaluate the robustness of the proposed controller. The

parameters chosen for this investigation are: (a) mass of cart,

(b) combined mass of pendulum. Both the parameter values

50722 VOLUME 9, 2021

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

FIGURE 13. System block diagram subjected to internal and external

disturbances.

are varied with a deviation of 10% and the proposed entropy

based fuzzy controller is tested to determine the robustness of

the system.

In the ﬁrst case, the controller response is tested under cart

mass variation of 10% as compared to the default parameters

value. The result validates the robustness of the proposed con-

troller as the controller successfully stabilizes the system with

a slight increase in the settling time as shown in Figure 14.

FIGURE 14. System performance under variation in cart mass.

In the second case, the controller response is observed

under a 10% variation in pendulum mass when compared

with the default system parameters. The result obtain indi-

cates the robustness of the proposed controller as the con-

troller aids in stabilizing the system. The controller response

shows that the pendulum stabilizes at 360◦(equivalent to

inverted position) with a minor effect in the settling time as

depicted in Figure 15.

In the last case, the response of the controller is observed

when there is 10% variation in both pendulum and cart mass.

The response under twin parameter variation validates the

robustness of the proposed controller as the overall system

remain stable with a marginal increase in settling time as

shown in Figure 16.

B. EXTERNAL DISTURBANCE

To check the robustness under external disturbance, the

authors included a random noise generator which is added

to the measurement unit as shown in Figure 13. The peak-

to-peak amplitude of the external noise is kept at 10% of

FIGURE 15. System performance under variation in pendulum mass.

FIGURE 16. System performance under twin parameter variation.

the controller signal, which is 0.5 V. Figure 17 shows the

comparison of controller response to the system subjected

to the external noise condition. The results obtain indicate

the robustness of the proposed controller as it helps in sta-

bilizing the system and the performance indices observed

remains fairly unchanged with a small increase in the system

overshoot. It is important to point out that the noise signal

frequency is kept same as the transients observed by the

controller.

VII. COMPARISON OF PROPOSED CONTROLLER WITH

STATE-OF-THE-ART REFERENCE CONTROLLERS

The performance parameters for the proposed novel

controller algorithm are compared with state-of-the-art con-

trollers. It is well-known that the steady-state error for efﬁ-

cient controllers is 0. Hence, the comparison between the

controllers is based on transient performance parameters.

For performance evaluation the state-of-the-art work has

been selected based on the similarity of either or all of

the following parameters: (a), controller algorithm used,

(b) simulation and (c) real-time experimental deployment.

VOLUME 9, 2021 50723

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

FIGURE 17. System performance under noise.

For steady-state performance evaluation, the settling times

are compared and to determine the transient performance,

the number of oscillations exhibited by the system to reach

steady-state are observed.

In [13], the authors developed Fuzzy logic based adap-

tive PID controller for swing-up stabilization of pendulum

angle. The hardware platform used for validating the exper-

iment results by authors is the same as used to validate this

research work. The authors used the fuzzy logic system to

optimize the gains of the PID controller and hence it uti-

lizes the principle of adaptive PID controller. The authors

reported a settling time of 5 seconds. In [16], the authors

utilized a hybrid controller approach using fuzzy logic con-

trol for swing up controller, switching to state feedback

control for stabilization, and using LQR (guaranteed cost

control) for uncertainty handling. The authors reported a

settling time of 7.7 seconds. In [17], the authors developed a

self-tuning regulator based on a precise actuator model. The

controller achieved a settling time of 8 seconds. In [7], the

authors developed a FLC based on Lyapunov’s direct method

to achieve swing-up stabilization of an inverted pendulum

system. The authors didn’t compute the optimized fuzzy logic

system and the controller is designed using Lyapunov stabil-

ity criteria. In contrast, the algorithm proposed in this paper

utilizes the Lyapunov method and the fuzzy sets are further

optimized to compute the optimum controller. The authors

reported a settling time of 8.7 seconds. In [35], the authors

deployed a Takagi-Sugeno based fuzzy controller, state feed-

back controller, and sliding mode controller strategies for

swing-up stabilization of an inverted pendulum system. The

controller had four input variables. The authors deployed

Takagi-Sugeno based controller and didn’t compute the opti-

mum membership functions, although the authors compared

the performance of three different controllers. The proposed

controller in this paper is based on the Mamdani method and

hence optimization of fuzzy sets becomes an integral part of

controller implementation. The author reported a settling time

of 12.8 seconds. Table 5 summarizes the comparison of the

proposed controller with other benchmark control algorithms.

TABLE 5. Settling time and oscillation comparison of the proposed

controller with reference controller.

Figure 18 depicts the comparison of the settling time of the

proposed controller with few benchmarked controllers.

FIGURE 18. Comparison of settling time with state-of-the-art controllers.

It is observed that the proposed controller exhibits the

fastest settling time along with minimum oscillations when

compared with benchmarked controllers. This proves the

efﬁcacy of the proposed optimization algorithm in ﬁnding

the optimal membership function for a fuzzy logic controller

design problem.

VIII. CONCLUSION

In this work, a novel optimization method has been proposed

to ﬁnd the membership function for fuzzy controller based

on the ‘‘Fuzzy Entropy’’ function. The proposed method

uses predeﬁned fuzzy sets and optimizes the support of the

set by evaluating the objective function. The fuzzy sets are

optimized using genetic algorithms with stopping criteria as

minimizing the optimal control cost function.

The proposed algorithm is applied for the swing-up sta-

bilization for a real-time inverted pendulum system. A PD

type fuzzy logic controller is designed based on the Lyapunov

method which ensures asymptotic stability. Furthermore, the

membership functions of the FLC are optimized based on

50724 VOLUME 9, 2021

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

the data obtained from the real-time PID swing-up control

of the pendulum. The control objective of the experiment is

to achieve swing-up stabilization in an inverted pendulum

system. The results depict an improvement in system per-

formance parameters (like ts, Mp,etc.) for optimized-FLC

as compared to FLC or PID. The performance of the pro-

posed controller is also compared with other state-of-the-

art controllers present in the literature that adopted similar

hardware/controller principle. The experimental results indi-

cate an improvement in the performance parameters of the

proposed controller.

In the current research work, the proposed methodology is

used to optimize FS having Gaussian MF. In the future the

authors intend to develop the same optimization technique

for fuzzy-logic based systems having different membership

functions like triangular, trapezoidal, s-function, etc. The

applicability of this technique is limited to systems having the

availability of reference data as a constrained requirement.

For the majority of practical systems data is available as a

reference set or can be determined with the help of simula-

tion/experimental analysis, therefore availability of data will

not be a major constraint for applicability of the proposed

technique.

REFERENCES

[1] T. Gurriet, M. Mote, A. Singletary, P. Nilsson, E. Feron, and A. D. Ames,

‘‘A scalable safety critical control framework for nonlinear systems,’’ IEEE

Access, vol. 8, pp. 187249–187275, 2020.

[2] N. Minorsky, ‘‘Control problems,’’ J. Franklin Inst., vol. 232, no. 6,

pp. 519–551, 1941.

[3] O. Boubaker, ‘‘The inverted pendulum benchmark in nonlinear control

theory: A survey,’’ Int. J. Adv. Robotic Syst., vol. 10, no. 5, pp. 1–9, 2013.

[4] M. I. El-Hawwary, A. L. Elshafei, H. M. Emara, and H. A. A. Fattah,

‘‘Adaptive fuzzy control of the inverted pendulum problem,’’ IEEE Trans.

Control Syst. Technol., vol. 14, no. 6, pp. 1135–1144, Nov. 2006.

[5] S. Kizir, Z. Bingul, and C. Oysu, ‘‘Fuzzy control of a real time inverted

pendulum system,’’ in Knowledge-Based Intelligent Information and Engi-

neering Systems (Lecture Notes in Computer Science), I. Lovrek, R. J.

Howlett, and L. C. Jain, Eds. U.K.: Springer, 2008.

[6] A. Joldiş, ‘‘An optimized design of fuzzy logic controllers. A case

study: Supported inverted pendulum,’’ Acta Electrotehnica, vol. 49, no. 3,

pp. 377–384, 2008.

[7] R.-E. Precup, M.-L. Tomescu, and S. Preitl, ‘‘Fuzzy logic control system

stability analysis based on Lyapunov’s direct method,’’ Int. J. Comput.,

Commun. Control, vol. 4, pp. 415–426, Jan. 2009.

[8] J. S. Noh, G. H. Lee, and S. Jung, ‘‘Position control of a mobile inverted

pendulum system using radial basis function network,’’ Int. J. Control,

Autom. Syst., vol. 8, no. 1, pp. 157–162, Feb. 2010.

[9] I. H. Akyuz, Z. Bingul, and S. Kizir, ‘‘Cascade fuzzy logic control of

a single-link ﬂexible-joint manipulator,’’ Turksih J. Electr. Eng. Comput.

Sci., vol. 20, no. 5, pp. 713–726, 2012.

[10] S. Kizir, H. Ocak, Z. Bingul, and C. Oysu, ‘‘Time dealy compensated vision

based stabilization control of an inverted pendulum,’’ Int. J. Inovative

Comput., Inf. Control, vol. 8, no. 12, pp. 8133–8145, 2012.

[11] M. Razban, A. Hooshiar, N. M. Bandari, C. Y. Su, and J. Dargahi, ‘‘Wing

up and transition to optimal control for a single inverted pendulum,’’ Int.

J. Mech. Prod. Eng., vol. 4, no. 10, pp. 84–89, 2016.

[12] X. Yang and X. Zheng, ‘‘Swing-up and stabilization control design for an

underactuated rotary inverted pendulum system: Theory and experiments,’’

IEEE Trans. Ind. Electron., vol. 65, no. 9, pp. 7229–7238, Sep. 2018.

[13] T. Abut and S. Soyguder, ‘‘Real-time control and application with self-

tuning PID-type fuzzy adaptive controller of an inverted pendulum,’’ Ind.

Robot, Int. J. Robot. Res. Appl., vol. 46, no. 1, pp. 159–170, Jan. 2019.

[14] S. Bicakci, ‘‘On the implementation of fuzzy VMC for an under actuated

system,’’ IEEE Access, vol. 7, pp. 163578–163588, 2019.

[15] Z. B. Hazem, M. J. Fotuhi, and Z. Bingül, ‘‘Development of a fuzzy-

LQR and fuzzy-LQG stability control for a double link rotary inverted

pendulum,’’ J. Franklin Inst., vol. 357, no. 15, pp. 10529–10556, Oct. 2020.

[16] E. Susanto, A. S. Wibowo, and E. G. Rachman, ‘‘Fuzzy swing up control

and optimal state feedback stabilization for self-erecting inverted pendu-

lum,’’ IEEE Access, vol. 8, pp. 6496–6504, 2020.

[17] M. Waszak and R. Langowski, ‘‘An automatic self-tuning control system

design for an inverted pendulum,’’ IEEE Access, vol. 8, pp. 26726–26738,

2020.

[18] A. Jain, S. Sheel, and P. Kuchhal, ‘‘Fuzzy logic-based real-time control for

a twin-rotor MIMO system using GA-based optimization,’’ World J. Eng.,

vol. 15, no. 2, pp. 192–204, Apr. 2018.

[19] T. J. Ross, Fuzzy Logic With Engineering Applications. New Delhi, India:

Wiley, 2015.

[20] L. A. Zadeh, ‘‘Fuzzy sets,’’ Inf. Control, vol. 8, no. 3, pp. 338–353,

Jun. 1965.

[21] A. Jain and A. Sharma, ‘‘Membership function formulation methods for

fuzzy logic systems: A comprehensive review,’’ J. Crit. Rev., vol. 7, no. 19,

pp. 8717–8733, 2020.

[22] D. Dubois and H. Prade, ‘‘The legacy of 50 years of fuzzy sets: A discus-

sion,’’ Fuzzy Sets Syst., vol. 281, pp. 21–31, Dec. 2015.

[23] T. M. Guerra, A. Sala, and K. Tanaka, ‘‘Fuzzy control turns 50: 10 years

later,’’ Fuzzy Sets Syst., vol. 281, pp. 168–182, Dec. 2015.

[24] L. A. Zadeh, ‘‘Fuzzy logic—A personal perspective,’’ Fuzzy Sets Syst.,

vol. 281, pp. 4–20, Dec. 2015.

[25] H. D. Cheng and J.-R. Chen, ‘‘Automatically determine the membership

function based on the maximum entropy principle,’’ Inf. Sci., vol. 96,

nos. 3–4, pp. 163–182, Feb. 1997.

[26] S. Bouallègue, J. Haggège, M. Ayadi, and M. Benrejeb, ‘‘PID-type fuzzy

logic controller tuning based on particle swarm optimization,’’ Eng. Appl.

Artif. Intell., vol. 25, no. 3, pp. 484–493, Apr. 2012.

[27] S. H. Ling, K. Y. Chan, F. H. F. Leung, F. Jiang, and H. Nguyen, ‘‘Quality

and robustness improvement for real world industrial systems using a fuzzy

particle swarm optimization,’’ Eng. Appl. Artif. Intell., vol. 47, pp. 68–80,

Jan. 2016.

[28] A. Alouache and Q. Wu, ‘‘Fuzzy logic PD controller for trajectory tracking

of an autonomous differential drive mobile robot (i.E. quanser Qbot),’’ Ind.

Robot, Int. J., vol. 45, no. 1, pp. 23–33, Jan. 2018.

[29] Digital Pendulum Control Experiments, L. Feedback Instrum.,

Crowborough, U.K., 2013.

[30] J. M. Mendel and G. C. Mouzouris, ‘‘Designing fuzzy logic systems,’’

IEEE Trans. Circuits Syst. II, Analog Digit. Signal Process., vol. 44, no. 11,

pp. 885–895, Nov. 1997.

[31] C. C. Lee, ‘‘Fuzzy logic in control systems: Fuzzy logic controller—

Part I,’’ IEEE Trans. Syst., Man, Cybern., vol. 20, no. 2, pp. 404–418,

Mar. 1990.

[32] A. Jain, S. Sheel, and K. Bansal, ‘‘Constructingfuzzy membership function

subjected to GA based constrained optimization of fuzzy entropy func-

tion,’’ Indian J. Sci. Technol., vol. 9, no. 43, pp. 1–10, Nov. 2016.

[33] L. B. Prasad, H. O. Gupta, and B. Tyagi, ‘‘Intelligent control of nonlinear

inverted pendulum dynamical system with disturbance input using fuzzy

logic systems,’’ in Proc. Int. Conf. Recent Advancements Elect., Electron.

Control Eng. (ICONRAEeCE), Sivakasi, India, 2012, pp. 136–141.

[34] I. Nagrath and M. Gopal, Control Systems Engineering, 5th ed. New Delhi,

India: New Age International Publishers, 2012.

[35] S. Ochoa, F. Peralta, and D. Patiño, ‘‘Comparison of control techniques in

an inverted pendulum,’’ in Proc. IFAC 15th Congreso Latino Americano

de Control Automatica, Lima, Peru, 2012.

[36] L. A. Zadeh, ‘‘Probability measures of fuzzy events,’’ J. Math. Anal. Appl.,

vol. 23, no. 2, pp. 421–427, Aug. 1968.

ARPIT JAIN received the B.Eng. degree from

SVITS, Indore, India, in 2007, the M.Eng. degree

from Thapar University, Patiala, India, in 2009,

and the Ph.D. degree from UPES, Dehradun, India,

in 2018. He is currently working as an Assistant

Professor (Selection Grade) with the Department

of Electrical and Electronics Engineering, Uni-

versity of Petroleum and Energy Studies (UPES).

He has over ten years of teaching and research

experience and a rich experience in curriculum

design. His research interests include real-time control systems, fuzzy logic,

machine learning, and neural networks.

VOLUME 9, 2021 50725

A. Jain et al.: Real-Time Swing-Up Control of Non-Linear IP

ABHINAV SHARMA received the B.Tech. degree

from H. N. B. Garhwal University, Srinagar, India,

in 2009, and the M.Tech. and Ph.D. degrees from

the Govind Ballabh Pant University of Agriculture

and Technology, Pantnagar, India, in 2011 and

2016, respectively. He is currently working as an

Assistant Professor (Senior Scale) with the Depart-

ment of Electrical and Electronics Engineering,

University of Petroleum and Energy Studies,

Dehradun. He has published number of research

papers in journals and conferences. His research interests include adaptive

array signal processing, smart antennas, artiﬁcial intelligence, and machine

learning.

VIBHU JATELY received the Ph.D. degree in elec-

trical engineering from the College of Technology,

G. B. Pant University, Pantnagar, India, in 2017.

Since July 2019, he has been working as a Postdoc-

toral Fellow with the MCAST Energy Research

Group, MCAST, Malta. He has over four years

of teaching experience during which he has also

worked under United Nations Development Pro-

gramme in Ethiopia. His research interests include

control in photovoltaic systems, control in power

electronics, and grid-connected photovoltaic systems.

BRIAN AZZOPARDI (Senior Member, IEEE)

received the B.Eng. degree from the University of

Malta, in 2002, and the Ph.D. degree from The

University of Manchester, U.K., in 2011. He is

currently a Senior Academic with the Malta Col-

lege of Arts, Science and Technology (MCAST),

where he leads the Energy Research Group. He is

also a Visiting Senior Lecturer with the University

of Malta. His research interests include photo-

voltaics and electric mobility network integration

and future urban low-carbon society.

SUSHABHAN CHOUDHURY received the B.E.

degree from NIT Silchar, the M.Tech. degree

from Tezpur University, and the Ph.D. degree

from UPES, Dehradun. He has rich teaching and

industry experience. He is currently working as

a Professor and the Head of the Department of

Electrical and Electronics Engineering, School

of Engineering, UPES. He has published more

than 50 research papers in international/national

journals and conferences. He has ﬁled 13 patents

and authored several books. He is selected as an outstanding scientist of

the twenty-ﬁrst century by Cambridge Biographical Centre. His research

interests include wireless sensor networks, embedded systems, robotics,

automation and control, the IoT (Node-MCU, ESP8266), nanotechnology,

artiﬁcial intelligence, and machine learning.

50726 VOLUME 9, 2021