0% found this document useful (0 votes)
21 views5 pages

Paper 3-Linear Quadratic Regulator Design

This document describes research into using a linear quadratic regulator (LQR) optimized by the grey wolf optimizer algorithm to control the position of an inverted pendulum. The LQR controller parameters Q and R are optimized to minimize a performance index. Two objective functions are tested: the performance index alone and the index plus additional terms for settling time and error. Simulation results show the controller successfully stabilizes the inverted pendulum using the optimized parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

Paper 3-Linear Quadratic Regulator Design

This document describes research into using a linear quadratic regulator (LQR) optimized by the grey wolf optimizer algorithm to control the position of an inverted pendulum. The LQR controller parameters Q and R are optimized to minimize a performance index. Two objective functions are tested: the performance index alone and the index plus additional terms for settling time and error. Simulation results show the controller successfully stabilizes the inverted pendulum using the optimized parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/324966895

Linear Quadratic Regulator Design for Position Control of an Inverted Pendulum


by Grey Wolf Optimizer

Article  in  International Journal of Advanced Computer Science and Applications · January 2018


DOI: 10.14569/IJACSA.2018.090403

CITATIONS READS

5 1,175

1 author:

Hüseyin Oktay Erkol


Louisiana State University
19 PUBLICATIONS   83 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

A VHDL application for kinematic equation solutions of multi-degree-of-freedom systems View project

All content following this page was uploaded by Hüseyin Oktay Erkol on 18 May 2018.

The user has requested enhancement of the downloaded file.


(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 9, No. 4, 2018

Linear Quadratic Regulator Design for Position


Control of an Inverted Pendulum by Grey Wolf
Optimizer
Hüseyin Oktay ERKOL
Department of Mechatronics Engineering
Faculty of Technology, University of Karabuk
Karabuk, Turkey

Abstract—In this study, a linear quadratic regulator (LQR) Another popular system for control theory applications is
based position controller is designed and optimized for an inverted pendulum. Kumar et al. designed an LQR based
inverted pendulum system. Two parameters, vertical pendulum controller for balance and trajectory tracking problem of a Self-
angle and horizontal cart position, must be controlled together to Erecting Single Inverted Pendulum [4]. They reported that
move a pendulum to desired position. PID controllers are LQR based system had faster and smooth stabilizing process
conventionally used for this purpose and two different PID compared to Full State Feedback controller designed by pole
controllers must be used to move the pendulum. LQR is an placement. Prasad et al. made a study to analyze and compare
alternative method. Angle and position of inverted pendulum can the PID and LQR controlled system under disturbance [5]. The
be controlled using only one LQR. Determination of Q and R
results was justified that the advantages of the LQR controller.
matrices is the main problem when designing an LQR and they
must be minimized a defined performance index. Determination Trial and error method is widely used method to determine
of the Q and R matrices is generally made by trial and error the elements of the Q and R matrices of an LQR controller [6].
method but finding the optimum parameters using this method is However there are many study shows the optimization
difficult and not guaranty. An optimization algorithm can be algorithms help to determine the optimum parameters for the
used for this purpose and in this way; it is possible to obtain controller. Ata et al. designed an LQR based controller for an
optimum controller parameters and high performance. That’s inverted pendulum on a cart. In the study, elements of the Q
why an optimization method, grey wolf optimizer, is used to tune and the R matrices of the controller were selected by Artificial
controller parameters in this study.
Bee Colony Algorithm to achieve the optimum performance.
Keywords—Grey wolf optimizer; inverted pendulum; position Optimization process was made on a nonlinear model and the
controller; linear quadratic regulator; optimized controller design results showed the ABC optimized system had good
performance [7].
I. INTRODUCTION
In another study, an unmanned rotorcraft pendulum was
Linear Quadratic Regulator (LQR) is one of the optimum controlled using LQR optimized by ABC and Particle Swarm
control methods and it is successfully applied to many systems. Optimization algorithm [8]. The designed system was also
Selection of the controller parameters is the main problem tested under disturbance and the results showed that the ABC
when designing an LQR controller. The selected parameters optimized system had better performance than the PSO
must minimize a performance index. The selection process is optimized system. Çatalbaş et al. was designed an LQR
conventionally made by trial and error method and it makes the controller for a Boeing 707 flight model and the unstable
process difficult, not guarantees finding the optimum model was controlled successfully by the LQR controller [9].
parameters and may take long time. Optimization algorithms
help designers to overcome these problems and guarantee In this study, an inverted pendulum system is modeled and
finding one of the optimum solutions. controlled by LQR. Q and R matrices of the LQR are
optimized by Grey Wolf Optimizer (GWO). All the study is
One of the basic systems for control theory is DC motor made by simulation using Matlab program. Two different
and LQR controller is one of the methods to control its speed objective functions are used for the optimization process:
and position. Ruderman et al. designed an LQR based speed firstly performance index of the LQR is used and then an
controller for a DC motor [1]. Abut compared the PID improved objective function obtained adding settling time and
controlled DC motor and the LQR controlled DC motor under total absolute error to the performance index is used. The
disturbance and the results showed the LQR based system has controller is successfully optimized using both of the objective
better performance than PID based one [2]. Haron deigned functions.
speed and position controllers for a DC motor in his study. In
the study, PID and LQR controllers was used and made a II. LINEAR QUADRATIC REGULATOR
performance comparison. The results show again the LQR LQR is one of the optimal control methods and widely used
controller has better performance than PID controller [3]. in the optimal control problems. The LQR method is used to
control of complex systems that needs high performance. A

13 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 9, No. 4, 2018

system described by linear differential equations can be shown axis. The position control of the cart is also possible using an
in steady-state form given in (1) and (2). A is system matrix, B extra controller.
is input matrix, C is output matrix and D is feed forward
matrix. “x” is the state vector, “y” is the output vector and “v”
is the input vector. A conventional LQR problem is to find the
Q an R matrix which minimizes the cost function (performance
index) based on the input “v” [10]. Performance index “J” is
defined as given in (3). The control energy is represented by
v(t)TRv(t), while the transient energy is expressed as x(t)TQx(t)
[11]. Q is symmetric positive semi definite matrix and R is
symmetric positive definite matrix.
Fig. 1. Structure of inverted pendulum on a cart.
 ̇( ) ( ) ( ) 
The differential equations of the system can be derived
using Euler-Lagrange method. The equations of the system
 ( ) ( ) ( ) 
given in Fig. 1 are given in (7) and (8) [15], [16]. “I” is the
moment of inertia of the pendulum, “m” is the mass of the
 ∫ [ ( ) ( ) ( ) ( )]   pendulum, “M” is the mass of the cart, “l” is the length of the
pendulum, “x” is the cart position, “θ” is the angle between the
Designing a LQR controller consists of the following steps: pendulum and the vertical axis, “F” is the input force.
Step 1: Q and R matrix, minimizing J, must be chosen.
 ( ) ̈ ̈  
Step 2: Then the algebraic Riccati equation, given in (4), is
solved to obtain P using Q and R.
 ( ) ̈ ̇ ̈ ̇  
Step 3: Optimum feedback gain matrix “K” is calculated
using (5).
When the “θ” is enough small, the equations can be
Step 4: System response is checked. If the system response is
linearized and steady-space equations (given in (9)) of the
not met the required specifications, repeat all steps
system can be obtained. “a” used in (9) is given in (10). The
again.
system parameters are given in Table I.
  
̇
   ̇
 ( )
[ ] [ ] 
̇ ̈
A pre-compensation factor must be used when the system ( ) ̇ ̈
has a bigger steady-state error than expected. Pre- [ ] [ ]
compensation factor calculation can be made by the equation
given in (6).  ( )  

TABLE I. SYSTEM PARAMETERS


 ( ( ) )  
Symbol Value
As seen as, the system must be well modeled to design an M 0.5Kg
LQR controller. The system must be linearized if the system is
not linear. All states of the system must also be measurable or m 0.2Kg
observable. Therefore, LQR design has a complex procedure l 0.3m
but it has an important advantage. Controlling the all system
states is possible with one LQR controller. In this study, g 9.81m/s2
pendulum position and vertical angle of the pendulum are I 0.006kg.m2
controlled by one LQR controller.
b 0.1N/m.s-1
III. INVERTED PENDULUM ON A CART F -N
Inverted pendulum is a popular system, which is naturally
θ -°
nonlinear and unstable, in control theory. Inverted pendulum
balance research is classically based on an inverted pendulum
on a cart and the aim is balancing the pendulum by moving the IV. GREY WOLF OPTIMIZER
cart [12]–[14]. The basic system is given in Fig. 1. Invers An optimization algorithm minimizes (or maximizes) a
pendulum is fixed on the cart by a rotating joint. “θ” angle function called objective function. The objective function is a
changes when an enough amount of force applied to the cart. special function defined for a system (or for a problem). It is
The aim of the system is balancing the pendulum on vertical affected by the parameters of the system. The optimization
algorithms minimize the objective function by changing the

14 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 9, No. 4, 2018

function variables in a special way. This special way is inspired


from the creatures in nature in some algorithms like Artificial
Bee Colony Algorithm, Particle Swarm Algorithm or Grey
Wolf Optimizer.
Grey Wolf Optimizer algorithm is inspired from the Grey
Wolfs in nature. They are social animals and live in groups Fig. 2. Structure of LQR controlled system.
which size is generally 5-12. There are four levels in a group
called as alpha, beta, delta and omega. The group leaders called The system outputs are given in Fig. 3 when only J is used
alpha make important decisions like about hunting, sleeping as objective function. The settling time of the position output is
and etc. The alphas are the most dominant wolves in the group. 14.18s with 2% tolerance. The settling time of the θ output is
The alphas may not be the most powerful member of the group 19.36s. Maximum error of θ is 0.04° and performance index J
but they are best in managing. Beta wolves help alpha wolves is 0.141.
for everything. When the alphas get away, ill or very old, betas
do coordination and decision making processes for the group.
They are under control of the alpha wolves but they can
command the other wolves in the group. They also give
feedback to alphas about the other wolves and works. There are
omega wolves at the end of the hierarchy. They always do
what the dominant wolves want. They are the last wolves
allowed to eat. It seems like omega wolves do not have an
important role in the group but it is observed that the group has
some problems like internal fighting in the absence of omegas
[17], [18].
The delta wolves are another type and they are responsible
of hunting, scouting, sentineling, and some of them may be
caretakers or elders. Hunters help the alphas and betas.
Sentinels protect the group, scouts watches around and warns
the group if there is any danger. Caretakers care the weak or ill
wolves.
Fig. 3. System outputs 1 (J is used as objective function).
They have also a special hunting strategy. They track and
approach the prey. Then they encircle, pursue and harass the As seen as, the controller works good but the settling time
prey until it stops moving. Finally they attack the prey. is very long. That means, the results may not meet design
Detailed information of the mathematical model of the requirements. In this case, an improved objective function is
algorithm can be found in [17]. needed. The used objective function to meet the design
requirements is given in (11). ST denotes the settling time and
V. EXPERIMENTAL STUDY Z1,2 is a coefficient to increase the effect of ST and integral of
In this study, an inverted pendulum model is designed, and absolute error on objective function. Z1,2 is selected as 1x108.
controlled by an LQR controller. All study is made by
simulations using Matlab program. Q and R matrices of the  ∫ ( ) 
LQR controller are optimized by GWO algorithm. General
block diagram of the LQR controlled system is given in Fig. 2. At the end of the optimization process, Q and R matrices
A, B and C are system matrices; K is feedback gain matrix and optimized as given in equation 12 and equation 13. The value
N is pre-compensation factor. of the performance index J is 3.195x105 for the given Q and R
matrices. Pre-compensation factor, N is calculated as -19.884.
Solution of the differential equation in the simulation is The system outputs are given in Fig. 4. The settling time of the
made by the four steps Runge-Kutta method and the used time system for position control is 1.26s with 2% tolerance and it is
step is 0.001s. Total simulation time is 10s. Number of Search 2.06s for θ control. Maximum error of the θ angle is 1.77°.
agents (individuals in the group) is selected as 30 and the
iteration number is selected as 50 for the GWO algorithm. Q
and R matrices are defined as diagonal matrices and the range
of the each element is 1.10-4-1.1010.  [ ]  
An objective function is needed to tune the Q and R
matrices when used an optimization algorithm. The main
objective function is the performance index J, given in (3), for   
LQR design. Optimum controller design is possible when J is
used as an objective function.

15 | P a g e
www.ijacsa.thesai.org
(IJACSA) International Journal of Advanced Computer Science and Applications,
Vol. 9, No. 4, 2018

outputs which must be meet design requirements. Settling time


and integral absolute error may be added to the objective
function to obtain shorter settling time.
As a result, GWO algorithm successfully optimizes the
LQR controller. The settling time of the position controller is
1.26s and maximum error of θ angle is 1.77°. GWO reaches
the optimum results at the 35th iteration.
REFERENCES
[1] M. Ruderman, J. Krettek, F. Hoffmann, and T. Bertram, “Optimal State
Space Control of DC Motor,” Proc. 17th World Congr. Int. Fed. Autom.
Control, vol. 17, no. 1, pp. 5796–5801, 2008.
[2] T. Abut, “Modeling and Optimal Control of a DC Motor,” Int. J. Eng.
Trends Technol., vol. 32, no. 3, pp. 146–150, 2016.
[3] U. Tun and H. Onn, “Linear Quadratic Regulator ( Lqr ) Controller
Design for Dc Servo Motor,” no. July, 2013.
[4] E. Vinodh Kumar and J. Jerome, “Robust LQR controller design for
Fig. 4. Sytem outputs 2 (equation 11 is used as objective function). stabilizing and trajectory tracking of inverted pendulum,” Procedia Eng.,
vol. 64, pp. 169–178, 2013.
As seen as, the settling time is shorted using the improved [5] L. B. Prasad, B. Tyagi, and H. O. Gupta, “Optimal control of nonlinear
objective function but error of θ angle is increased. As a result, inverted pendulum system using PID controller and LQR: Performance
analysis without and with disturbance input,” Int. J. Autom. Comput., vol.
both of (3) and (11) are successful with GWO and selection of 11, no. 6, pp. 661–670, 2014.
the objective function is depended on the design requirements.
[6] H. Wang, H. Dong, L. He, Y. Shi, and Y. Zhang, “Design and simulation
of LQR controller with the linear inverted pendulum,” Proc. - Int. Conf.
Electr. Control Eng. ICECE 2010, pp. 699–702, 2010.
[7] B. Ata and R. Çoban, “Linear Quadratic Optimal Control of an Inverted
Pendulum on a Cart using Artificial Bee Colony Algorithm : An
Experimental Study Yapay Arı Kolonisi Algoritması ile Bir Arabalı Ters
Sarkacın Lineer Kuadratik Kontrolü : Deneysel Bir Çalışma,” vol. 32, no.
June, pp. 109–123, 2017.
[8] S. Changhao and H. Duan, “Artificial bee colony optimized controller for
unmanned rotorcraft pendulum,” Aircr. Eng. Aerosp. Technol., vol. 85,
no. 2, pp. 104–114, 2013.
[9] M. C. Çatalbaş, Z. U. Bayrak, and A. Gülten, “Hava Ta şı tlar ı n ın Uçuş
Kontrolü i ç in Do ğ rusal Kuadratik Regülator Yöntemi ile Optimal
Kontrol ör Tasar ı m ı OPTIMAL CONTROLLER DESIGN VIA
LINEER QUADRATIC,” vol. 27, no. 2, pp. 1–9, 2015.
[10] A. Salehahmadi and A. Farmanbordar, “Modeling Linear Quadratic
Regulator LQR / LQT / LQGT for,” vol. 5, pp. 1–11, 2015.
[11] A. Al-mahturi and H. Wahid, “Optimal Tuning of Linear Quadratic
Regulator Controller Using a Particle Swarm Optimization for Two-Rotor
Fig. 5. Objective function value vs. Iteration number.
Aerodynamical System,” vol. 11, no. 2, pp. 184–190, 2017.
[12] H. O. Erkol, “Ters Sarkaç Sisteminin Yapay Arı Kolonisi Algoritması ile
The speed of the algorithm is another important parameter. Optimizasyonu,” J. Polytech., vol. 900, no. 4, pp. 863–868, 2017.
Objective function output vs. number of iteration graph is
[13] S. K. Mishra and D. Chandra, “Stabilization and Tracking Control of
given in Fig. 5. GWO reaches the best solution at 35th iteration. Inverted Pendulum Using Fractional Order PID Controllers,” J. Eng., vol.
2014, pp. 1–9, 2014.
VI. CONCLUSION [14] H. Niemann and J. K. Poulsen, “Analysis and design of controllers for a
In this study, an LQR based position controller is designed double inverted pendulum,” Proc. 2003 Am. Control Conf. 2003., vol. 4,
using GWO algorithm. Determination of Q and R matrices, pp. 2803–2808, 2003.
minimizing the performance index, is the main problem when [15] A. Poorhossein and A. Vahidian-Kamyad, “Design and implementation
of Sugeno controller for inverted pendulum on a cart system,” SIISY
designing an LQR controller. Minimizing the performance 2010 - 8th IEEE Int. Symp. Intell. Syst. Informatics, pp. 641–646, 2010.
index using Q and R matrices is an optimization problem and [16] A. Patnaik and L. Behera, “Evolutionary Multiobjective Optimization
GWO is successfully used to obtain optimum Q and R Based Control Strategies For An Inverted Pendulum On A Cart,” IEEE
matrices. World Congr. Comput. Intell., pp. 3141–3147, 2008.
[17] S. Mirjalili, S. M. Mirjalili, and A. Lewis, “Grey Wolf Optimizer,” Adv.
Using only performance index J helps to design optimum Eng. Softw., vol. 69, pp. 46–61, Mar. 2014.
controller but it may not meet the design requirements like [18] S. K. Verma, S. Yadav, and S. K. Nagar, “Optimization of Fractional
settling time or maximum overshoot. In this case, the objective Order PID Controller Using Grey Wolf Optimizer,” J. Control. Autom.
function must be improved using the effect of the system Electr. Syst., vol. 28, no. 3, pp. 314–322, 2017.

16 | P a g e
www.ijacsa.thesai.org
View publication stats

You might also like