Uploaded by benjaminaidoo1997

Optimal Speed Control of BLDC Motor

advertisement
UNIVERSITY OF MINES AND TECHNOLOGY
TARKWA
FACULTY OF ENGINEERING
DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING
A PROJECT ENTITLED
OPTIMAL SPEED CONTROL OF BRUSHLESS DC MOTOR USING
ARTIFICIAL INTELLIGENCE TECHNIQUES
BY
ADJEI OWUSU JUSTICE
SUBMITTED IN PARTIAL FULFILLMENET OF THE REQUIREMENTS
FOR THE AWARD OF THE DEGREE OF BACHELOR OF SCIENCE IN
ELECTRICAL AND ELECTRONIC ENGINEERING
PROJECT SUPERVISOR
……………………………..
MR ERWIN NORMANYO
TARKWA, GHANA
APRIL 2019
1
DECLARATION
I declare that this project work is my own work. It is being submitted for the degree of
Bachelor of Science in Electrical and Electronic Engineering in the University of Mines and
Technology (UMaT), Tarkwa. It has not been submitted for any degree or examination in
any other University.
………………………………..
(Signature of Candidate)
…… day of April, 2018
2
ABSTRACT
Brushless DC motors are widely used for many industrial applications because of their
higher efficiency, high torque and low volume. This project proposed an adaptive neurofuzzy inference system and fuzzy proportional integral derivative controllers to control the
speed of brushless DC motor. The controllers were further optimised with three optimisers:
ant colony optimisation algorithm, particle swarm optimisation algorithm and gravitational
search algorithm. Difficulties in satisfying control characteristics by using normal
conventional proportional integral derivative controllers have necessitated these artificial
intelligence techniques. The fuzzy logic controller deals with complicated, non-linear and
sophisticated systems. Artificial neural network has powerful capability for learning,
adaptation, robustness and rapidity. Adaptive neuro-fuzzy inference system has advantages
of both fuzzy logic controller and artificial neural network. The simulation results for a
nominal speed of 700 rpm verify that adaptive neuro-fuzzy inference system controller has
better control performance characteristics than the fuzzy PID controller as it exhibited no
overshoot and gave the least settling time of 21 ms when it was optimised with gravitational
search algorithm for loadings at 1.5 times the nominal load. The gravitational search and
particle swarm optimisation algorithms optimised the controllers better than the ant colony
optimisation algorithm. The modelling, control, and simulation of the brushless DC motor,
controllers and the optimisers were done using the MATLAB/Simulink software. For speed
control of the brushless DC motor, a particle swarm optimised adaptive neuro-fuzzy
inference system controller is strongly recommended.
3
DEDICATION
I dedicate this work to my mum
Mrs Margaret Osei
4
ACKNOWLEDGEMENTS
I would like to express my deepest thanks to God Almighty for his strength, protection,
wisdom and guidance throughout my stay in school. I extend my profound gratitude and
appreciation to my project supervisor, Mr. Erwin Normanyo for his understanding,
invaluable motivation and advice throughout this project work as well as my stay in this
school as whole.
Special thanks to all lecturers in UMaT especially those of the Electrical and Electronic
Engineering Department for the enormous support they rendered throughout my entire
study.
Finally, my appreciation goes to my parents, siblings and special friends, Ned and Helina
for their continuous support and encouragement.
5
TABLE OF CONTENTS
Contents
Page
DECLARATION
i
ABSTRACT
ii
DEDICATION
iii
ACKNOWLEDGMENTS
iv
TABLE OF CONTENTS
v
LIST OF FIGURES
vii
LIST OF TABLES
viii
LIST OF ABBREVIATIONS
ix
LIST OF SYMBOLS
x
INTERNATIONAL SYSTEM OF UNITS (SI UNITS)
xii
CHAPTER 1 GENERAL INTRODUCTION
1
1.1
Problem Definition
1
1.2
Project Objectives
1
1.3
Methods Used
2
1.4
Work Organisation
2
CHAPTER 2 LITERATURE REVIEW
3
2.1
Brushless DC Motors
3
2.1.1
Classification of Brushless DC Motor
3
2.1.2
Principle of Operation of Brushless DC Motor
5
2.1.3
Advantages and Disadvantages of Brushless DC Motor
5
2.1.4
Application Areas of Brushless DC Motor
6
2.2
Control of Brushless DC Motors
6
2.3
Fuzzy-PID Control of Brushless DC Motor
7
2.4
Adaptive Neuro-Fuzzy Inference System
7
2.5
Optimal Speed Control of Brushless DC Motor
8
2.6
Artificial Intelligence-Based Techniques of Speed Control of the Brushless
8
DC Motor
2.6.1
Ant Colony Optimisation Algorithm
8
2.6.2
Particle Swamp Optimisation Algorithm
9
2.6.3
Gravitational Search Algorithm
9
6
2.7
Review of Related Works on Artificial Intelligence-based Optimal Speed
10
Control of Brushless DC Motor
2.8
2.7.1
Use of Ant Colony Optimisation Algorithm
10
2.7.2
Use of Particle Swarm Optimisation Algorithm
11
2.7.3
Use of Gravitational Search Algorithm
11
Summary
12
CHAPTER 3 METHODS USED
13
3.1
Introduction
13
3.2
System Development
13
3.3
Mathematical Modelling
14
3.3.1
Modelling of BLDC Motor
14
3.3.1
Back EMF Zero Crossing Detection and Converter Circuit
16
3.3.1
Modelling of Gate Circuit
17
3.4
3.5
Design of Controllers
18
3.4.1
Design of the Fuzzy PID Controllers
18
3.4.2
Design of the Adaptive Neuro-Fuzzy Inference System Controller
20
Optimisation of the Controllers
23
3.5.1
Optimisation Using Ant Colony Optimisation Algorithm
23
3.5.2
Optimisation Using Particle Swarm Optimisation Algorithm
25
3.5.3
Optimisation Using Gravitational Search Algorithm
27
3.6
Computer Simulations
31
3.7
Summary
33
CHAPTER 4 RESULTS AND DISCUSSIONS
34
4.1
Introduction
34
4.2
Simulation Results
34
4.3
Discussion of Simulation Results
37
4.4
Summary of Findings
39
CHAPTER 5 CONCLUSIONS AND RECOMMENDATIONS
41
5.1
Conclusions
41
5.2
Recommendations
41
REFERENCES
42
APPENDIX
46
7
LIST OF FIGURES
Fig.
Title
Page
2.1
Brushless DC Motor
3
2.2
Inner Rotor Design of the BLDC Motor
4
2.3
Outer Rotor Design of the BLDC Motor
4
3.1
Block Diagram of Proposed System
13
3.2
Equivalent Circuit of a 3-Phase BLDC Motor
14
3.3
Back EMF Zero Crossing Detection Block
16
3.4
Gate Circuit Block
17
3.5
Fuzzy PID Block
18
3.6
Membership Functions of Inputs
19
3.7
Membership Functions of Output
19
3.8
Adaptive Neuro-Fuzzy Inference System
20
3.9
ANFIS Layer
22
3.10
Proposed ANFIS System
22
3.11
Membership Function for Speed Error
23
3.12
Flowchart of Ant Colony Optimisation Algorithm
24
3.13
Flowchart of Particle Swarm Optimisation Algorithm
26
3.14
Flowchart of Gravitational Search Algorithm
30
3.15
Simulink Model of the Speed Control of Brushless DC Motor
31
4.1
Responses of Fuzzy PID Controller-based Speed Control of BLDC
Motor
Responses of ACO Optimised Fuzzy PID Controller-based Speed
Control of BLDC
Responses of PSO Optimised Fuzzy PID Controller-based Speed
Control of BLDC
Responses of GSA Optimised Fuzzy PID Controller-based Speed
Control of BLDC
Responses of ANFIS Controller-based Speed Control of BLDC
Motor
Responses of ACO Optimised ANFIS Controller-based Speed
Control of BLDC
Responses of PSO Optimised Fuzzy PID Controller-based Speed
Control of BLDC
Responses of PSO Optimised Fuzzy PID Controller-based Speed
34
4.2
4.3
4.4
4.5
4.6
4.7
4.8
Control of BLDC
8
34
35
35
35
36
36
36
LIST OF TABLES
Table
Title
Page
2.1
Merits and Demerits of Brushless DC Motor
6
3.1
Rule Base for the Fuzzy Logic Controller
19
3.2
BLDC Motor Specifications
32
3.3
Scenarios Considered in the Simulations
33
4.1
Results of Simulations
37
9
LIST OF ABBREVIATIONS
Abbreviation
Meaning
ABC
Artificial Bee Colony
AC
Alternating Current
ACO
Ant Colony Optimisation
AI
Artificial Intelligence
ANFIS
Adaptive Neuro-Fuzzy Inference System
ANN
Artificial Neural Network
BLDC
Brushless Direct Current
CD
Compact Disc
DC
Direct Current
DSP
Digital Signal Processor
DVD
Digital Video Disc
emf
Electromotive Force
ESC
Electronic Speed Controller
FIS
Fuzzy Inference System
FLC
Fuzzy Logic Controller
GA
Genetic Algorithm
GSA
Gravitational Search Algorithm
IAE
Integral of Absolute Error
IGBT
Insulated Gate Bipolar Transistor
IM
Induction Motor
ISE
Integral of the Square of the Error
ITE
Integral of Time multiplied Absolute Error
MATLAB
Matrix Laboratory
PID
Proportional Integral Derivative
PSO
Particle Swarm Optimisation
PV
Photovoltaic
RMSE
Root Mean Square Error
VCD
Visual Compact Disc
10
LIST OF SYMBOLS
Actuating signal
u (t)
Error signal
e (t)
Proportional gain constant
Kp
Integral time constant
Ti
Derivative time constant
Td
Amount of pheromone on edge i, j
τi,j
A parameter to the influence of τi,j
α
The desirability of edge i, j
ηi,j
A parameter to control the influence of ηi,j
β
Probability that an ant will move from node i to node j
Pi,j
Velocity of the particle
Vi
Position of particle
zi
Inertia weight
ω
Global best position found by the swarm
pg
Best position found so far by a particle
pi
Stator resistance
R
Phase current
i
Stator inductance
L
Back emf
e
Laplace transform variable
s
Phase voltage
V
Back emf constant
k
Electrical rotor angle
θ
Mechanical speed of the rotor
ω
Frequency
f
Rotor inertia
J
Damping constant
B
Load torque
TL
Electromagnetic torque
Te
Negative big
NB
Negative medium
NM
Negative small
NS
11
Zero
Z
Positive small
PS
Positive medium
PM
Positive big
PB
Coefficients of input x
p (x)
Coefficients of input y
q (y)
Membership function of set Ai
μAi
Membership function of set Bi
μBi
Outputs of the fourth layer
ω
̅
Fitness value of the object i
Mass
fit i (t)
m
A very small constant
Ԑ
Universal gravitational constant
G
The euclidean distance between object i and object j
R ij
Position of object j in the k-th dimension
xjk (t)
Position of object j in the k-th dimension
xik (t)
Gravity of the j-th object acting on the i-th object in the k-th dimension space Fijk (t)
Acceleration of the i-th particle in the k-th dimension at the moment
12
aki (t)
INTERNATIONAL SYSTEM OF UNITS (SI UNITS)
Quantity
Unit of Measurement
Symbol
Angular velocity
revolutions per minute
rpm
Voltage
volts
V
Resistance
ohms
Ω
Inductance
henry
H
Current
ampere
A
Force
newton
N
Inertia
kilogram per square meter
Kg/m2
Torque
newton meter
Nm
Back emf
volts
V
13
CHAPTER 1
GENERAL INTRODUCTION
1.1
Problem Definition
Many industrial applications employ electric motors in their day to day processes of which
the DC motor is of no exception. DC electric motors have gained popularity in industrial
controls due to their numerous characteristics such as high starting torque, wide speed range
and good speed control all implying that they can be easily controlled as compared to AC
motors. Machines are easily damaged without control implementation in their operation.
In the early days of control applications, relays were used to control most systems but with
globalisation, digital electronics and Artificial Intelligence (AI) have been incorporated into
these systems to enhance their performance and efficiency. Different AI techniques have
been employed in the control performance of DC motors of which the Proportional Integral
Derivative (PID), Particle Swarm Optimisation (PSO) algorithms, Artificial Neural
Network (ANN), Gravitational Search Algorithm (GSA) and Ant Colony Optimisation
(ACO) algorithms have not been left out but have not been very efficient either depending
on how they are employed.
This work will focus on controlling the Brushless DC (BLDC) motor with Fuzzy PID and
Adaptive Neuro-Fuzzy Inference System (ANFIS) controllers, optimise these controllers
with GSA under given load conditions. The results will be compared with other optimisation
algorithms such as the ACO and PSO to make a comparative analysis.
1.2
Project Objectives
The objectives of this project work are:
i.
To investigate the speed performance of the BLDC motor when it is controlled with
Fuzzy PID and ANFIS controllers;
ii.
To ascertain which optimisation algorithm will best optimise the controllers under
given load conditions; and
iii. To implement the controllers using MATLAB-Simulink software.
14
1.3
Methods Used
The methods employed include:
i.
Review of relevant literature;
ii.
Mathematical Modelling; and
iii. Computer simulations using MATLAB-Simulink software.
1.4
Work Organisation
The project work comprises five chapters. Chapter 1 introduces the entire project
emphasising on the problem definition, project objectives, methods used and work
organisation. Chapter 2 presents a review of the literature relevant to the topic. Chapter 3
elaborates on the methods employed. Chapter 4 presents the results and discussions and the
summary of findings. Chapter 5 ends with conclusions and recommendations.
15
CHAPTER 2
LITERATURE REVIEW
2.1
Brushless DC Motors
Electrical motors convert electrical energy into mechanical energy. Electrical motors can be
classified into DC and AC motors. DC motors convert dc electrical energy to mechanical
energy. DC motors are in two types: the brushed dc motors and the brushless dc motors.
The brushless dc motor is an electronically commutated motor which does not employ
brushes. Fig. 2.1 (Anon., 2018a) shows a diagram of the BLDC motor.
Fig. 2.1 Brushless DC Motor
2.1.1 Classification of Brushless DC Motors
BLDCs can be classified into two categories. The inner rotor and the outer rotor design
types. They differ only in their design but the mode of operation changes not.
Inner rotor design
In the inner rotor BLDC motor design, the stator winding surrounds the rotor and the rotor
is located at the center of the motor. Heat is dissipated easily as the rotor is located in the
core and rotor magnets do not insulate heat inside. This type is validly used as a result of
16
the large amount of torque it produces. Fig. 2.2 (Anon., 2018b) shows a diagram of the inner
rotor design type.
Fig. 2.2 Inner Rotor Design of the BLDC Motor
Outer rotor design
In the outer rotor type of BLDC motor design, the winding which is located in the core of
the motor is surrounded by the rotor. The heat inside the motor is trapped by the magnets in
the rotor and does not allow it to dissipate from the motor. Such type of designed motor
operates at lower rated current and has low cogging torque. However, the advantages of this
type of construction are: higher inertia, maximum output torque, stable low speed
performance without feedback, lower audible noise etc. Fig. 2.3 (Anon., 2018b) shows a
diagram of the outer rotor design type.
Fig. 2.3 Outer Rotor Design of the BLDC Motor
17
2.1.2 Principle of Operation of Brushless DC Motors
The BLDC motor comprises two main parts: the motor (the stator, rotor and the motor body)
and the control thus, the detection device which detects the rotor’s position and the
electronic phase change device.
The rotating rotor located on the rotor core is a four-pole sensor magnet. This provides
excitation to the second part, which is an array of Hall effect transistors. The stator is the
part that holds the windings. North and south poles that attract the magnet are created when
current is supplied to the coils made of a well-placed three phase windings (Anon., 2015).
An interaction between the magnetic field generated by the stator and rotor windings causes
the position sensor of the rotor to convert the mechanical signal into an electrical signal.
This also controls the frequency converter so that the stator windings of each phase changes
according to a certain number of turns. The order of direction of the rotor position is
dependent on the stator current (Yu, 2014).
The correct commutation from the windings makes the motor to rotate continuously. Some
position sensors available are the electromagnetic, photoelectric and magnetic sensors. Due
to space, economics and sound operations issues, the Hall sensor is mostly used because of
its compact size, low price and the convenience in its operation. It is a type of magnetic
sensor (Anon., 2018c).
2.1.3 Advantages and Disadvantages of BLDC Motors
The BLDC motor compares same with the Induction Motor (IM), considered as the
workhorse of industry in terms of low maintenance and low electrical noise. The two motors
however, differ in certain respects. Permanent magnets serve as the field magnets for the
BLDC motor whilst stator and rotor windings usually made of copper or aluminum are
required by the IM. The BLDC motor records a high for efficiency, speed range and system
cost as against low for the IM. The BLDC motor has a flat speed-torque characteristic at all
speeds with rated loads, uses solid state switches for commutation, reverses the switching
sequence for the reversal of direction and also requires a controller for the sequencing of
commutation. The IM on the other hand, has a nonlinear speed-torque curve that droops
with loading, it requires a special starting circuit, reverses direction by interchanging two
phases to the stator input terminal and demands a controller for variable speed operation
(but not for fixed speed). Sensors are required to detect rotor position of the BLDC motor
18
and this feature is not applicable to the IM. The merits and demerits of the BLDC motor are
summarised into Table 2.1.
Table 2.1 Merits and Demerits of Brushless DC Motors
SN
Merits
Demerits
Torque ripple exists in its operation
Simple
structure
due
to
the
absence
of
which greatly limits its servo
1.
brush and commutator.
applications.
2.
Need for an Electronic Speed Controller
Reliable operation: Low maintenance (ESC) for commutation. Additional
costs, and long service life due to equipment is required to provide the
absence of brushes.
throttle signal to the ESC.
3.
High power density and high torque For a sensorless ESC, very little starting
relative to motor size.
torque is available.
Good speed performance, high
efficiency and wide speed range.
and
frictionless
5. Noise-free
commutation.
Sparkless operation amenable to motor
6. usage in hazardous areas.
(Source: Yu, 2014)
4.
Rotor position sensor wiring to the ESC
is often unreliable.
There is temperature limitation on rotor
due to the permanent magnet.
Demagnetisation possibility limits the
input current.
2.1.4 Application Areas of BLDC Motors
Due to its numerous characteristics and advantages, BLDC motors find applications in the
automotive industry, aerospace industry, gyroscopic systems and robotic arms, high speed
centrifugal pumps, high speed cameras, high power amplifiers, household appliances like
vacuum cleaner, agitator, hair drier, cameras, electric fans etc., as spindle motor drive in
Visual Compact Disc (VCD), Digital Video Disc (DVD) and Compact Disc (CD) players
(Yu, 2014). Nevertheless, BLDC motor applications span special situations having the
following requirements: Single speed variable load, adjustable speed, position control and
low noise drives (Pushek, 2013).
2.2
Control of BLDC Motors
The PID controller is standard and it is widely applied in industrial control. It can be easily
implemented and its control results are effective. The conventional PID speed controller is
sensitive to system parameters and excellent performance can only be achieved when the
control parameter is matched well with the system. It is difficult to obtain an excellent
dynamic and static performance when using the conventional PID controller, where
19
dynamic performance falls short in its slow response, large overshoot and oscillations (Jing,
2016). The proportional, integral, and derivative terms are computed to calculate the output
of the PID controller. A non-conventional PID controller has characteristics that can
accelerate the rise time, reduce the steady state error in the system, and also reduce the
oscillations. The control algorithm of the PID controller is expressed by Equation (2.1) (Jaya
et al., 2017).
u  t  = K p [e  t  +
1
d
e(t) dt+Td e(t)]

Ti
dt
(2.1)
where, u (t) = actuating signal
e (t) = error signal
Kp = proportional gain constant
Ti = integral time constant
Td = derivative time constant
2.3
Fuzzy PID Control of the Brushless DC Motor
The drawback of conventional PID control has resulted in an increased demand for
intelligent control like fuzzy control, neural network control and adaptive control (Jing,
2016). Fuzzy logic is an extension of the classical proposition and predicate logic that rests
on the principles of the binary truth functionality. Fuzzy logic is a multi-valued logic. A
non-linear fuzzy PID control method can stably improve the transient responses of systems
disturbed by nonlinearities or unknown mathematical characteristics. Although the
derivation of the control law is based on the design procedure for a general Fuzzy Logic
Controller (FLC), the resultant control algorithm has an analytical form with time varying
PID gains rather than linguistic form. This means the implementation of the proposed
method can be easily and effectively applied to real time control situations.
2.4
Adaptive Neuro-Fuzzy Inference System
ANN has strong learning capabilities at the numerical level. Fuzzy logic has a good
capability of interpretability and can also integrate expert's knowledge. The advantage of a
neural network is that it can be trained and so can self-learn and self-improve (Akhila, 2016).
The idea behind neural network and fuzzy inference combination is to design a system that
uses a fuzzy system to represent knowledge in an interpretable manner. ANN can be used
to learn the membership values for fuzzy systems to construct decision logic. The
20
hybridisation of both paradigms yields the capabilities of learning, good interpretation and
incorporating prior knowledge (Premkumar and Manikandan, 2015).
2.5
Optimal Speed Control of BLDC Motors
Apparently, AI techniques have taken the centre stage in relation to speed control of BLDC
motors but other techniques cannot be overlooked. Other methods of speed control of the
BLDC motor are the sliding mode speed control, speed control using digital controllers,
sensorless speed control and speed control using Zeta converter.
Sliding mode control is a nonlinear control technique featuring remarkable properties of
accuracy, robustness, and easy tuning and implementation (Anon., 2018e). In control
systems, sliding mode control is a nonlinear control method that alters the dynamics of a
nonlinear system by application of a discontinuous control signal that forces the system to
slide along a cross-section of the system's normal behaviour. The state-feedback control law
is not a continuous function of time (Anon., 2018f). The control system of BLDC motor
using the sliding mode control method has better speed performance and adaptability to load
variations (Yubin, 2015). Other areas of application of the sliding mode speed control are
overhead cranes, marine vehicles, electrohydraulic valve actuator, combined cycle plants
etc.
2.6
Artificial Intelligence-based Techniques of Speed Control of the BLDC Motor
2.6.1
Ant Colony Optimisation Algorithm
Ant Colony Optimisation (ACO) is a metaheuristic algorithm for solving hard combinatorial
optimisation problems. The inspiring source of ACO is the pheromone trail laying and
following the behaviour of real ants, which use pheromones as a communication medium.
The more time it takes an ant to travel down the path and back again, the more time the
pheromones have to evaporate. A short path is marched over more frequently, and thus the
pheromone density becomes higher on shorter paths than longer ones. This methodology
allows ants to converge, hence finding the optimum path. An ant will move from node i to
node j with probability given by Equation (2.2) (Sandoval, 2015).
Pi,j =
(τi,jα )(ηβi,j )
 (τ
where, τi,j = the amount of pheromone on edge i,j
α = a parameter to the influence of τi,j
21
α
i,j
)(ηβi,j )
(2.2)
ηi,j = the desirability of edge i,j
β = a parameter to control the influence of ηi,j
2.6.2
Particle Swarm Optimisation Algorithm
PSO was developed from swarm intelligence and it is based on the research of bird and fish
flock movement behaviours. While searching for food, the birds are either scattered or go
together before they locate the place where they can find the food. Like other swarm-based
techniques, PSO consists of a number of individuals refining their knowledge of the given
search space. The individuals in a PSO have position and velocity denoted as particles (Bai,
2010). PSO has a fitness evaluation function that takes each particle’s position and assigns
it a fitness value. The position of highest fitness value visited by the swarm is called the
global best. Each particle remembers the global best, and the position of highest fitness
value that has been personally visited is called the local best. The canonical PSO with inertia
weight has become very popular and widely used in solving many science and engineering
problems (Wang, 2015). In the canonical PSO, each particle i has position zi and velocity vi
that is updated at each iteration according to Equation (2.3) (Wang, 2015).



Vi = vi +C1 r1i pi -zi +C2 r2i pg -zi

(2.3)
where, Vi = velocity of the particle
zi = position of particle
ω = inertia weight
C1 and C2 are positive constant parameters called acceleration coefficients (which
control the maximum step size the particle can achieve).
p g = global best position found by the swarm
p i = best position found so far by a particle
2.6.3
Gravitational Search Algorithm
GSA is a newly developed stochastic search algorithm based on the law of gravity and mass
interactions. In this approach, the search agents are a collection of masses which interact
with each other based on Newtonian gravity and the laws of motion. The method is
completely different from other well-known population-based optimisation methods
inspired by the swarm behaviors. In GSA, performance is measured by masses of agents
considered as objects. All of the objects attract each other by the gravity force, while this
22
force causes a global movement of all objects towards the objects with heavier masses
(Kumar, 2014). In GSA, each particle is associated with four specifications: particle
position, its inertial mass, active gravitational mass and passive gravitational mass. The
position of particles provides the solution of the problem while fitness function is used to
calculate the gravitational and inertial masses (Khajehzadeh and Eslami, 2012).
2.7
Review of Related Works on Artificial Intelligence-based Optimal Speed
Control of BLDC Motors
2.7.1
Use of Ant Colony Optimisation Algorithm
Ebrahim (2016) employed ACO algorithm to search for the optimal PID parameters of
designed speed and current controllers of a BLDC motor to drive a hybrid electric-bike by
minimising the time domain of the objective function. The design of the controllers was
formulated as an optimisation problem to overcome the most static and dynamic fluctuations
of the system. The system was fed from two hybrid sources for driving the motor and
charging of storage elements; one was a solar photovoltaic (PV) generator as a green and
neat source and the other was a human-powered pedal dc-generator. The performance of the
system was analysed when using the proposed controller with and without storage elements.
The obtained results confirm the better performance of the system for several speed
trajectories of the drive compared to the classical PID-controllers.
Xia et al. (2006) presented an auto-tuning method for FLC based on ACO algorithm. The
controller was applied to control the BLDC motor. The operating system included a current
loop and a speed loop. The speed loop used the FLC whose control rules were optimised
off-line and parameters were adjusted on-line based on ACO algorithm. At last, a Digital
Signal Processor (DSP) was used to fully prove the flexibility of the control scheme in real
time. Excellent flexibility and adaptability, as well as high precision and good robustness,
were obtained by the proposed strategy. By comparison with the traditional PID controller
and a Genetic Algorithm (GA)-based FLC, it was not only robust but can also achieve better
static and dynamic performances of the system.
Sandoval et al. (2015) proposed ACO algorithm as a tuning mechanism for the PID
controller of a DC motor driving a robotic arm. It was observed that the values under the
ACO method tend to have a response similar to values obtained under manual tuning. The
simulation results indicated that the number of iterations is a determining variable for the
results. It was also seen that the increment of the number of ants simulated for the solution
23
search gave optimal solutions. Nevertheless, this value was not as significant as the iteration
number, since there is no ultimate method for PID tuning. The ACO algorithm provided
consistent results.
2.7.2
Use of Particle Swarm Optimisation Algorithm
In order to overcome the deficiency of the PID controller whose parameters are difficult to
adjust, Wang et al. (2015) proposed two swarm intelligence algorithms: Artificial Bee
Colony (ABC) and PSO to estimate the optimal parameters of PID controller for speed
control. The results showed that ABC and PSO algorithms have stable convergence
characteristics and good computational ability, and they stand as effective and easily
implemented methods for optimal tuning of PID parameters. Furthermore, it was observed
that the rise time and settling time corresponding to ABC algorithm was less than that of the
PSO and the steady state error was larger than PSO’s.
Shen et al. (2018) applied Fractional Order PID (FOPID) controller in order to promote the
control performance and at the same time, keep the convenience of the traditional PID
controller. A precise mathematical model was built and the stability analysis was made
based on the mathematical model. The FOPID controller was designed and its five
parameters were tuned by adopting a PSO algorithm. Simulation results showed the
effectiveness and better performance of the FOPID controller. The controller was based on
the precise mathematical model.
Wang et al. (2016) simulated a double closed loop speed regulation system of BLDC motor
including the speed loop with PI control, fuzzy adaptive PID control simulation, and
disadvantages analysis. PSO algorithm was applied to identify the optimal scaling factor. A
simulation model of the motor speed regulation system was built using MATLAB. Real
experiments showed that the proposed control scheme in BLDC motor control had good
dynamic and stable performances.
2.7.3
Use of Gravitational Search Algorithm
Duman et al. (2013) used GSA, a new search heuristic to determine the optimal PID
controller parameters in the speed and position control of a DC motor. The model of the DC
motor was considered as second and third order systems. Results obtained were compared
to others reported in the literature for position control and compared with Ziegler-Nichols
tuning for speed control of the DC motor. The designed PID controller with GSA was much
24
better which presented satisfactory performances and good robustness in terms of the rise
time, settling time and maximum overshoot.
Khajehzadeh and Eslami (2012) presented the newly developed heuristic global
optimisation algorithm GSA, for the optimisation of retaining structures. The optimisation
procedure controlled all geotechnical and structural design constraints while reducing the
overall cost of the retaining wall. It was found that GSA is a suitable technique for the
optimisation of retaining structures and the method is able to find a better optimal solution
compared with PSO and GA.
2.8
Summary
Upon review, work has not been done on BLDC motor control using very recent algorithms
such as the GSA. The purpose of this research therefore, is to investigate the performance
of the BLDC motor when controlled with Fuzzy-PID and ANFIS controllers. The
controllers will further be optimised with GSA under varying load conditions to make
comparative analysis in terms of dynamic and static responses with other optimisation
algorithms such as the ACO and PSO.
25
CHAPTER 3
METHODS USED
3.1
Introduction
This chapter delves into the system development the project which entails mathematical
modelling of all blocks in the design, the design of the controllers used, details of the
optimisation algorithm and the computer simulations which also include all assumptions
made, various loads and the scenarios considered in implementing this design.
3.2
System Development
Operation of motor-controlled systems such as industrial plants, industrial drives, escalators,
travellators etc. require the smooth adjustment of motors when disturbances such as
overvoltage, over frequency and sudden change of load occur. It therefore makes it
imperative that various control mechanisms are put in place such that when there is
emergence of any disturbance in the daily operation of systems, the impact will not lead to
destruction of an ongoing operation and personnel will least recognise these disturbances
especially in the case of escalators.
The design of the project is based on controlling the speed of BLDC motor using AI
techniques which is in three main parts. They are the BLDC motor block, the controller
block and the optimiser block. The BLDC motor block comprises the motor itself, the gate
circuit, back emf zero crossing detection block and the converter circuit. Fig. 3.1 shows the
block diagram of the proposed system.
Objective Function
(ITAE, ISE)
Optimiser
(ACO/ PSO/GSA
d/dt
ωre(s)
ref
e(s)
Fuzzy PID/ u(s)
ANFIS
Zero
Crossing
Detector
w(s)
Converter
q(s)
r(s)
Gate
Circuit
Fig. 3.1 Block Diagram of Proposed System
26
BLDC
Motor
ω(s)
3.3
Mathematical Modelling
3.3.1 Modelling of BLDC Motor
In order to deduce the governing mathematical equations of the BLDC motor, Fig. 3.1
(Mondal et al., 2015) represents an equivalent circuit of a 3-phase BLDC motor.
where, Ra, Rb and Rc = stator resistances of phase A, phase B and phase C, respectively
ia, ib and ic = currents of phase A, phase B and phase C, respectively
La, Lb and Lc = stator inductances of phase A, phase B and phase C, respectively
ea, eb and ec = back emf of phase A, phase B and phase C, respectively
Fig. 3.2 Equivalent Circuit of a 3-Phase BLDC Motor
From the equivalent circuit in Fig. 3.2, the model of the armature winding of the BLDC
motor is expressed as in Equations (3.1), (3.2) and (3.3) ( (Mondal et al., 2015).
d
Va = Ria + L ia + ea
dt
(3.1)
d
Vb = Rib + L ib + eb
dt
(3.2)
d
Vc = Ric + L ic + ec
dt
(3.3)
Converting to Laplace transform, these equations can be written as in Equations (3.4), (3.5)
and (3.6) (Mondal et al., 2015).
27
Va  s  = Ria + sLia + ea
(3.4)
Vb  s  = Rib + sLib + eb
(3.5)
Vc  s  =Ric + sLic +ec
(3.6)
The matrix form then becomes as given by Equation (3.7) (Mondal et al., 2015).
0
0   ia   ea 
 Va   R+sL
  
   
R+sL
0   i b  +  eb 
 Vb  =  0
V   0
0
R+sL   ic   ec 
 c 
(3.7)
When BLDC motor rotates, each winding generates a voltage known as back electromotive
force (emf), which opposes the main voltage supplied to the winding according to Lenz's
law. The polarity of the back emf is opposite in direction to the source voltage. It is related
to the function of rotor position and each phase has 120o phase difference. The back emf
depends mainly on three factors namely, angular velocity of the rotor, magnetic field
generated by the rotor magnets and the number of turns in the stator windings as shown in
Equations (3.8), (3.9) and (3.10) (Mondal et al., 2015).
ea = k ω f  θ 
(3.8)
2π 

eb = k ω f  θ –

3 

(3.9)
2π 

ec = k ω f  θ +

3 

(3.10)
where, k = the back emf constant
θ = the electrical rotor angle
ω = the mechanical speed of the rotor
f = frequency
Moreover, the generation of electromagnetic torque can be written as presented in Equation
(3.11) (Mondal et al., 2015).
Te = J
dω
+TL + Bω
dt
28
(3.11)
where, J = rotor inertia
B = damping constant
TL = load torque
Te = electromagnetic torque
The resultant torque is as given by Equation (3.12) (Mondal et al., 2015).
Te – TL = J
dω
+ Bω
dt
(3.12)
Equation (3.12) is treated to the Laplace transformation and reorganised to get the transfer
function presented in Equation (3.13) (Mondal et al., 2015).
ω(s)
1
=
Te (s) - TL (s) Js + B
(3.13)
3.3.2 Back EMF Zero Crossing Detection and the Converter Circuit
Matlab Simulink model for back emf zero crossing detection technique for speed control of
BLDC motor is illustrated in Fig. 3.3 (Singh and Singh, 2016).
Fig. 3.3 Back EMF Zero Crossing Detection Block
In this model, rotor position is detected by using three Hall sensors which are displaced by
120o on rotor shaft. The Hall signal from these sensors is fed to the back emf zero crossing
29
detection block. This block extracts the back emf zero crossing points from the Hall signals.
The operation of this detector is such that, an Analogue to Digital Converter (ADC) converts
the signals sent by the Hall sensors which is in analogue form into a digital format. The
AND gate will only give a high output when both incoming signals are high. This helps to
determine the actual position of the rotor since not all the gates conduct at same time. The
zero crossing points in this format when detected are converted into a form agreeable with
the gate circuit block with the help of the ‘convert’ block.
3.3.3 Modelling of the Gate Circuit
When the zero crossing points are detected, they are fed to the gate circuit presented in Fig.
3.4 (Hameed, 2018). In this block, pulses are generated with logic control circuit reference
to detect zero crossing points. These trigger pulses give gate signals to turn ON the six IGBT
switches of the inverter in a sequence.
Fig. 3.4 Gate Circuit Block
3.4
Design of the Controllers
3.4.1 Design of the Fuzzy PID Controller
BLDC motor suffers from cogging torque and load disturbances. According to Goswami
and Joshi (2018), use of FLC resulted in reduced starting torque but increased steady state
error. To overcome the controller limitations, efforts have been made by various researchers
to combine the FLC with PID controller for so many applications. Fuzzy PID controller
used in this work is based on two-input FLC structures with coupled rules. The overall
30
structure of the controller is shown in Fig. 3.5 (Jaya et al., 2017). Unlike the PID, the FLC
has set range for its Kp , Ki and Kd meaning no value outside these ranges can be assigned
to these gains hence increasing stability in its performance. The equation for the output of
the Fuzzy PID is no different from that of Equation 2.1. These rules are written in a rule
base look-up table which is shown in Table 3.1.
Fig. 3.5 Fuzzy PID Block
The rule base structure is Mamdani type. The FLC has two inputs and one output. These are
error (e), change of error (ce) and control signal (u), respectively. A linguistic variable which
implies inputs and outputs have been classified is as shown in Table 3.1.
where, NB = negative big
NM = negative medium
NS = negative small
Z = zero
PS = positive small
PM = positive medium
PB = positive big
31
Table 3.1 Rule Base for the Fuzzy Logic Controller
Inputs and the output are all normalised in the interval of [-3, 3] as shown in Fig. 3.6 and
Fig. 3.7.
a. Change in Error
b. Error
Fig. 3.6 Membership Functions of Inputs
Fig. 3.7 Membership Functions of Output
32
3.4.2 Design of the Adaptive Neuro-Fuzzy Inference System Controller
In ANFIS, Takagi-Sugeno type Fuzzy Inference System (FIS) is used. The output of each
rule can be a linear combination of input variables plus a constant term or can be only a
constant term. The final output is the weighted average of each rule’s output. Basic ANFIS
architecture that has two inputs, x and y and one output z is as shown in Fig. 3.8 (Sivarani
et al., 2016). The rule base contains two Takagi-Sugeno IF-THEN rules which are given as
follows:
i.
If x is A1 and y is B1 , then f1 = p1 (x) + q1 (y) + r1
ii.
If x is A2 and y is B2 , then f2 = p2 (x) + q2 (y) + r2
where, f1, f2 = outputs of (i) and (ii) respectively
p1 (x), p2 (x) = coefficients of input x of (i) and (ii) respectively
q1 (y), q2 (y) = coefficients of input y of (i) and (ii) respectively
r1, r2 = constant terms of (i) and (ii) respectively
FLC is a great tool to deal with complicated, non-linear and sophisticated systems. ANN
has the powerful capability for learning, adaptation, robustness and rapidity. ANFIS has
advantage of both FLC and ANN. ANFIS is a class of adaptive networks that is functionally
equivalent to FIS. This control methodology solves the problem of non-linearity and
parameter variations of BLDC drive. The adaptive neural network is a multilayer feed
forward network in which each node performs a particular function (node function) on
incoming signals as well as a set of parameters pertaining to this node (Kavathe et al., 2018).
The formulae for the node function may vary from node to node.
Fig. 3.8 Adaptive Neuro-Fuzzy Inference System
33
If the triggering strengths of the rule are ω1 and ω2 respectively, for the particular values of
Ai and integral of Bi , then the output is computed as weighted average as given in Equation
(3.14) (Kavathe et al., 2018).
f=
ω1 f1 + ω2 f2
ω1 + ω2
(3.14)
Let the membership function of fuzzy sets Ai , Bi , i = 1, 2, be 𝜇Ai and 𝜇Bi .
Layer 1: Each neuron “i” in Layer 1 is adaptive with a parametric activation function. Its
output is the grade of membership functions given by Equation (3.15) (Kavathe et al., 2018).
μ(x) =
1
1+[
x - c 2b
]
a
(3.15)
where, [a, b, c] = the parameter set.
As the values of the parameters change, the shape of the bell-shape function varies.
Layer 2: Every node in Layer 2 is a fixed node, whose output is the product of all incoming
signals as presented by Equation (3.16) (Kavathe et al., 2018).
ωi = μAi (x)μBi (y), i = 1,2
(3.16)
where, μAi (x) = membership function of set Ai
μBi (y) = membership function of set Bi
Layer 3: This layer normalises each input with respect to the others (the ith node output is
the ith input divided by the sum of all the other inputs) and the outcome is given by Equation
(3.17) and Equation (3.18) (Kavathe et al., 2018).
ω1 =
̅̅̅̅
ω2 =
̅̅̅̅
ω1
ω1 + ω2
ω2
ω1 + ω2
(3.17)
(3.18)
Layer 4: Fourth layer‘s ith node output is a linear function of third layer‘s ith node output
and the ANFIS input signals. The fourth layer output is given by Equation (3.19) and
Equation (3.20) (Kavathe et al., 2018).
ω
̅ f1 = ω
̅ 1 (p1 x + q1 y + r1 )
(3.19)
ω
̅ f2 = ω
̅ 2 (p2 x + q 2 y + r2 )
34
(3.20)
where, ω
̅ 1, ω
̅ 2 = outputs of the fourth layer’s node 1 and node 2 respectively
p1 , p2 = coefficients of input x of node 1 and node 2 respectively
q1 , q 2 = coefficients of input y of node 1 and node 2 respectively
r1 , r2 = constant terms of (i) and (ii) respectively
f1 , f2 = output signals of the ANFIS node 1 and node 2
Layer 5: This layer sums all the incoming signals according to Equation (3.21) (Kavathe et
al., 2018). Fig. 3.9 gives a diagram of the ANFIS layer.
f = f1 ω
̅ 1 + f2 ω
̅2
(3.21)
where, f1 , f2 = output signals of the ANFIS’s node 1 and node 2, respectively
ω
̅ 1, ω
̅ 2 = outputs of the fourth layer’s node 1 and node 2, respectively
Fig. 3.9 ANFIS Layer
Fig. 3.10 and Fig. 3.11 show proposed Sugeno FIS designed with 49 fuzzy rules with 7
linguistic variables.
Fig. 3.10 Proposed ANFIS System
35
Fig. 3.11 Membership Function for Speed Error
3.5
Optimisation of the Controllers
3.5.1 Optimisation Using Ant Colony Optimisation Algorithm
Initially, all ants are positioned on randomly generated starting nodes and initial values for
trail intensity are set for each edge. Each ant then chooses the next node to move,
considering the trail intensity and distance. After all ants have finished a tour, the fitness of
each ant is evaluated. Usually, fitness function is defined to evaluate the performance of
each ant. The pheromone intensity of edges between each stage is then updated according
to these fitness values. The pheromone intensity of each edge will evaporate over time. For
the edges that ants travelled in this iteration, their pheromone intensity can be updated by
the state transition rule according to Equation (3.22) (Sandoval, 2015).
τ (i, j) = ρ τ(i, j) + m f(sbest )
(3.22)
where, τ(i,j) = sum of pheromone between item of size i and j
ρ = evaporation parameter
sbest = global best ant
m = number of times the pheromone has been updated
Global pheromone updating rule and local pheromone updating rule are generally used to
update the pheromone trail. Global updating is carried out after all ants have finished their
tours. Fig. 3.12 (Anon., 2018c) represents the flowchart of ACO.
36
Fig. 3.12 Flowchart of Ant Colony Optimisation Algorithm
The steps followed in the ACO algorithm as elaborated in the flowchart of Fig 3.12 are:
Step 1: Start to initialise MATLAB software.
Step 2: Initialise parameters such as control limits, number of ants, number of iterations,
pheromone concentration etc.
Step 3: Randomly, generate the initial position of all ants.
Step 4: An appropriate representation of the problem, which allows the ants to incrementally
construct/modify solutions through the use of a transition rule based on the amount
of pheromone in the trail and on a local heuristic is applied.
Step 5: A probabilistic rule based on the heuristic function for updating the pheromone trail
is applied to increase the concentration of the pheromone trails.
37
Step 6: Evaluate the fitness function for least possible cost values.
Step 7: A heuristic function that measures the quality of items that can be added to the
current partial solution is applied (Global pheromone).
Step 8: Has maximum number of iterations reached? If yes, end, otherwise go back to Step
4 and apply the state transition rule.
Step 9: End.
3.5.2 Optimisation Using Particle Swarm Optimisation Algorithm
PSO algorithm maintains the best fitness value achieved among all particles in the swarm
called global best fitness and the candidate solution that achieved this fitness is called the
global best position or global best candidate solution. A population of agents (called
particles) uniformly distributed is created. Each particle’s position according to the objective
function is evaluated and if a particle’s current position is better than its previous best
position, it is updated. The best particle according to the particle’s previous best positions
is determined and updated according to Equation (3.23) (Premkumar and Manikandan,
2016).



Vi t+1 = vi t  +c1 r1 pi t  - xi t  + c2 r2 pg  t  - xi  t 

(3.23)
More particles are moved to their new position until stopping criteria are satisfied according
to Equation (3.24) (Premkumar and Manikandan, 2016).
Xi t+1 = xi t  + vi t+1
(3.24)
Fig. 3.13 (Premkumar and Manikandan, 2016) represents the flowchart of PSO algorithm.
38
Fig. 3.13 Flowchart of Particle Swarm Optimisation Algorithm
The steps followed in the PSO algorithm as elaborated in the flowchart of Fig 3.13 are:
Step 1: Start to initialise MATLAB software.
Step 2: Initialise the PSO parameters such as control limits, number of swarms, number of
iterations, position of particles etc.
Step 3: Randomly, generate the first swarm.
Step 4: Each particle’s position according to the objective function is evaluated.
Step 5: After evaluating the fitness of each particle, the personal best fitness for all the
particles are recorded.
Step 6: If a particle’s current position is better than its previous best position, it is updated.
The best particle according to the particle’s previous best position is determined and
updated.
39
Step 7: A heuristic function that measures the quality of items that can be added to the
current partial solution is applied (Global best particle).
Step 8: Did the swarm meet the termination criteria? If yes, end, otherwise update the
velocity and position of all particles and go back to Step 4 and evaluate the fitness
of all particles.
Step 9: End.
3.5.3 Optimisation Using Gravitational Search Algorithm (GSA)
Basic principle of GSA
Because there is no need to consider the environmental impact, the position of a particle is
initialised as Xi. Then in the case of the gravitational interaction between the particles, the
gravitational and inertial forces are calculated. This involves continuously updating the
location of the objects and obtaining the optimal value based on the GSA (Wang and Song,
2015). The basic principle of GSA is described in detail as follows:
Initialise the locations
Firstly, randomly generate the positions X1i , Xi2 , … , Xik , … , Xid of N objects, and then the
positions of N objects are brought into the function, where the position of the i th object is
defined by Equation (3.25) (Wang and Song, 2015):
Xi = (X1i , Xi2 , … , Xik , … , Xid )
(3.25)
Calculate the inertia mass
Each particle with certain mass has inertia. The greater the mass, the greater the inertia. The
inertia mass of the particles is related to the self-adaptation degree according to its position.
So the inertia mass can be calculated according to the self-adaptation degree. The bigger the
inertial mass, the greater the attraction. This point means that the optimal solution can be
obtained. At the moment, the mass of the particle Xi is represented as Mi (t). Mass Mi (t)
can be calculated using Equations (3.26) and (3.27) (Wang and Song, 2015).
mi (t) =
fiti (t) - worst(t)
best(t) - worst(t)
Mi (t) =
where, i = 1, 2,…, N
40
mi (t)
∑ mj (t)
(3.26)
(3.27)
mi (t) = mass of object i at the moment, t
fit i (t) = the fitness value of the object i
best (t) = the optimal solution
worst (t) = the worst solution
Mi (t) = mass of the particle Xi at the moment, t
For solving the maximum value problem, Equations (3.28) and (3.29) (Wang and Song,
2015) are employed.
max
best(t) j={1,2,…,N}
fit j (t)
(3.28)
min
worst (t) j={1,2,…,N}
fit j (t)
(3.29)
For solving the minimum value problem Equations (3.30) and (3.31) (Wang and Song,
2015) are used.
min
best(t) j={1,2,…,N}
fit j (t)
(3.30)
min
worst (t) j={1,2,…,N}
fit j (t)
(3.31)
Calculate gravitational force
At the moment, the calculation formula for the gravitational force of object j to object i is
according to Equation (3.32) (Wang and Song, 2015):
Fijk = G(t)
mpi (t).maj (t)
Rij (t)+Ԑ
(xjk (t) − xik (t))
(3.32)
where, Fijk = gravitational force of object j to object i in the k-th dimension
Ԑ = a very small constant
maj (t) = the inertial mass of the object itself
mpi (t) = the inertial mass of an object i
G(t) = the universal gravitational constant at the moment t, which is determined by
the age of the universe
R ij = the euclidean distance between object i and object j
xjk (t) = position of object j in the k-th dimension
xik (t) = position of object i in the k-th dimension
The greater the age of the universe, the smaller G(t). The inner relationship is described by
Equation (3.33) (Wang and Song, 2015).
41
G(t) = Go . e−αt⁄T
(3.33)
where, Go = the universal gravitational constant of the universe at the initial time to,
generally it is set as 100 years
α = 20
t = number of years
T = the maximum number of iterations
The euclidean distance between objects i and j, R ij is defined as given by Equation (3.34)
(Wang and Song, 2015).
Rij = ||Xi (t)-Xj (t)||
(3.34)
where, Xi (t) = current position of object i
Xj (t) = current position of object j
In GSA, the sum Fik (t) of the forces acting on the Xi in the k-th dimension is equal to the
sum of all the forces acting on this object and it is expressed by Equation (3.35) (Wang and
Song, 2015).
Fik (t) = ∑j=1,j≠i rank j Fijk (t)
(3.35)
where, Fik (t) = forces acting on the Xi in the k-th dimension
rank j = the random number in the range [0,1]
Fijk (t) = the gravity of the j-th object acting on the i-th object in the k-th dimension
space.
According to Newton's second law, the acceleration of the i-th particle in the k-th dimension
at the moment, t is defined as given by Equation (3.36) (Wang and Song, 2015).
aki (t) =
Fk
i (t)
M(t)
(3.36)
Change the positions
In each iteration, the object’s position can be changed by calculating the acceleration, using
Equations (3.37) and (3.38) (Wang and Song, 2015).
vik (t + 1) = rank i × vik (t) + aki (t)
(3.37)
xik (t + 1) = xik (t) + vik (t + 1)
(3.38)
Fig. 3.14 (Wang and Song, 2015) gives the flowchart of GSA.
42
Fig. 3.14 Flowchart of Gravitational Search Algorithm
The steps followed in the GSA algorithm as elaborated in the flowchart of Fig 3.14 are:
Step 1: Start to initialise MATLAB software.
Step 2: Generate initial population specifying parameters such as mass of agents, number of
iterations, position of agents etc.
Step3: Fitness function for each agent is evaluated according to the objective function.
Step 4: After evaluating the fitness of each agent, the global best and worst of the population
are updated. The best agent according to the agent’s previous best positions is
determined and updated.
Step 5: Mass and Acceleration for each agent is calculated.
Step 6: The velocity and position of the agents are updated.
43
Step 7: Has the swarm met the ending criteria? If yes, return best solution, otherwise, go
back to step 3 and evaluate the fitness of each agent.
Step 8: End.
3.6
Computer Simulations
The computer simulations are based on assumptions in modelling the BLDC motor, motor
data, objective function and the simulation scenarios. Fig. 3.15 shows the simulink model
of the speed control of BLDC motor.
Fig. 3.15 Simulink Model of the Speed Control of Brushless DC Motor
Simulations were conducted taking into consideration the following assumptions regarding
the modelling of the BLDC motor.
i.
The motor is not saturated and should be operated with the rated current;
ii.
The resistances of the three stator phase windings are equal;
iii. Self-inductance and mutual inductance are constant;
iv. Iron and stray losses are negligible;
v.
Hysteresis and eddy current losses are not considered; and
vi. All semiconductor switches are ideal.
The data used is extracted from the BLDC motor specifications. The specifications of the
motor are summarised into Table 3.2.
44
Table 3.2 BLDC Motor Specifications
SN
Parameter
Value
1.
Rated Speed (rpm)
700
2.
Resistance/Phase (Ohm)
3.
Pole Pair
4.
Inductance/Phase (H)
6.85e-3
5.
Moment of Inertia (kg/m2)
0.0008
6.
Voltage Constant (V_ peak L-L/ rpm)
65.48
0.045
13
7.
Torque Constant (Nm/A)
(Source: Jaya et al., 2017)
1.3
A system is considered an optimal control system when the system parameters are adjusted
so that the performance index reaches a minimum value. The best system is delineated as
the system that minimises an index. Four commonly used performance indices for designing
single loop control algorithms are the Root-Mean-Square Error (RMSE), Integral of
Absolute Error (IAE), Integral of Time multiplied Absolute Error (ITAE) and the Integral
of the Square of the Error (ISE). These performance indices are considered as the objective
functions used for the controller tuning to ensure stability and attain superior damping to
sudden load disturbances and set speed changes.
The objective functions to be considered in this project are the ITAE and ISE. The ITAE is
a very useful criterion that penalises long duration transient. The ITAE criterion tries to
minimise time multiplied absolute error of the control system. The time multiplication term
penalises the error more at the later stages than at the start and therefore effectively reduces
the settling time (Premkumar and Manikandan, 2015). It is expressed by Equation (3.39)
(Premkumar and Manikandan, 2015).
T
J = ∫0 t (|ω(t)ref - ω(t)act |) dt
(3.39)
Another useful performance index is the ISE criterion. The focus is on the square of the
error function. It penalises positive and negative values of the error and it is expressed using
Equation (3.40) (Premkumar and Manikandan, 2015) as:
T
2
J = ∫0 (|ω(t)ref - ω(t)act |) dt
(3.40)
Finally, each controller was optimised with all the three optimisers under three loading
conditions as summarised into Table 3.3.
45
Table 3.3 Scenarios Considered in the Simulations
SN
1.
2.
3.7
Controller
Optimiser
Load
ACO
(0.8, 1, 1.5) x Nominal
PSO
(0.8, 1, 1.5) x Nominal
GSA
(0.8, 1, 1.5) x Nominal
ACO
(0.8, 1, 1.5) x Nominal
PSO
(0.8, 1, 1.5) x Nominal
GSA
(0.8, 1, 1.5) x Nominal
Fuzzy PID
ANFIS
Summary
A schematic diagram of a BLDC motor with back emf zero crossing detector, gate circuit,
Fuzzy PID and ANFIS controllers and the ACO, PSO, GSA algorithms was systematically
analysed and a corresponding mathematical model was derived. The mathematical model
obtained was transformed into Laplace domain and transfer functions were established for
modelling and simulations in MATLAB and Simulink software environment. Eighteen
scenarios were considered in the simulations of the control system and response
characteristics for each were established. The aim is to effectively control the speed of
BLDC motor using the AI techniques.
46
CHAPTER 4
RESULTS AND DISCUSSIONS
4.1
Introduction
The results of the simulations of the various scenarios are presented and discussed in this
chapter. Two main controllers: Fuzzy PID and ANFIS are paramount in the discussion of
the results. Each controller was utilised in the speed control of BLDC motor. Furthermore,
the controllers were optimised with ACO, PSO and GSA at load torques of 4 Nm, 5 Nm and
7.5 Nm.
4.2
Simulation Results
The simulation results are presented in Fig. 4.1 to Fig. 4.8.
Fig. 4.1 Responses of Fuzzy PID Controller-based Speed Control of BLDC Motor
Fig. 4.2 Responses of ACO Optimised Fuzzy PID Controller-based Speed Control of
BLDC Motor
47
Fig. 4.3 Responses of PSO Optimised Fuzzy PID Controller-based Speed Control of
BLDC Motor
Fig. 4.4 Responses of GSA Optimised Fuzzy PID Controller-based Speed Control of
BLDC Motor
Fig. 4.5 Responses of ANFIS Controller-based Speed Control of BLDC Motor
48
Fig. 4.6 Responses of ACO Optimised ANFIS Controller-based Speed Control of
BLDC Motor
Fig. 4.7 Responses of PSO Optimised ANFIS Controller-based Speed Control of
BLDC Motor
Fig. 4.8 Responses of GSA Optimised ANFIS Controller-based Speed Control of
BLDC Motor
To compare system performance on ANFIS and Fuzzy-PID, measurement of speed response
performance on the BLDC motor at different load torque is shown in Table 4.1
where, tr = rise time (ms)
ts = settling time (ms)
Mp = overshoot (%)
TL = load torque (Nm)
49
Table 4.1 Results of the Simulations
Controller Optimiser
TL (Nm)
tr (ms)
Mp (%)
ts (ms)
0.8 × TL
5.3600
14.773
48.9520
1.0 × TL
4.5360
7.4470
60.3430
1.5 × TL
1.000
2.996
93.9900
0.8 × TL
4.5560
15.5571
41.6092
1.0 × TL
3.8102
6.4044
50.0847
1.5 × TL
0.8700
2.4268
77.0718
0.8 × TL
3.8056
10.7843
34.2664
1.0 × TL
3.0845
5.1384
43.4470
1.5 × TL
0.6400
2.0972
68.6127
0.8 × TL
3.3768
11.8184
35.2454
1.0 × TL
3.6448
5.3618
38.0161
1.5 × TL
0.7200
1.8875
75.1920
0.8 × TL
2.5170
-
81.0140
1.0 × TL
2.9290
-
58.7500
1.5 × TL
7.6800
-
28.9050
0.8 × TL
2.1898
-
68.8619
1.0 × TL
2.5189
-
49.3500
1.5 × TL
6.5280
-
24.8583
0.8 × TL
1.8122
-
56.7098
1.0 × TL
2.0796
-
41.7125
1.5 × TL
5.3760
-
21.6788
0.8 × TL
1.8878
-
59.1402
1.0 × TL
2.1089
-
44.6500
1.5 × TL
5.5296
-
21.0065
None
ACO
FUZZY PID
PSO
GSA
None
ACO
ANFIS
PSO
GSA
4.3
Discussions of Simulation Results
The simulations were performed for a nominal speed of 700 rpm. Fig. 4.1, Fig. 4.2, Fig. 4.3
and Fig. 4.4 are the output responses for Fuzzy PID with a nominal load of 5 Nm, a load of
4 Nm and a load of 7.5 Nm without optimiser, with ACO algorithm, PSO algorithm and
GSA, respectively. Fig. 4.5, Fig. 4.6, Fig. 4.7 and Fig. 4.8 are the output responses for
ANFIS with a load torque of 5 Nm, 4 Nm and 7.5 Nm without optimiser, with ACO
algorithm, PSO algorithm and GSA, respectively.
50
Fuzzy PID response at the set point of 700 rpm with a nominal load of 5 Nm achieved a rise
time of 4.536 ms, an overshoot of 7.447% and a settling time of 60.343 ms. ANFIS response
had a rise time of 2.929 ms, no overshoot and a settling time of 58.75 ms at the same set
point and nominal load. When the load torque was reduced to 0.8 of the nominal load, thus,
to 4 Nm, Fuzzy PID response gave a rise time of 5.36 ms with an overshoot of 14.773% and
a settling time of 48.952 ms. ANFIS response had a rise time of 2.517 ms, no overshoot and
a settling time of 81.0140 ms at the same set point and load. At 1.5 times increase in load
torque (7.5 Nm), Fuzzy PID response had a rise time of 1.00 ms, an overshoot of 2.996%
and a settling time of 93.99 ms. ANFIS response gave a rise time of 7.68 ms, no overshoot
and a settling time of 28.9050 ms. The good performance of the ANFIS is because of its
powerful capability for learning, adaptation, robustness and rapidity.
ACO optimised Fuzzy PID response at the set point of 700 rpm with a nominal load of 5
Nm gave a rise time of 3.8102 ms, an overshoot of 6.4044% and a settling time of 50.0847
ms. ACO optimised ANFIS response had a rise time of 2.5189 ms, no overshoot and a
settling time of 49.350 ms at the same set point and nominal load. When the load torque was
reduced to 0.8 of the nominal, thus, to 4 Nm, ACO optimised Fuzzy PID response had a rise
time of 4.556 ms with an overshoot of 15.5571% and a settling time of 41.6092 ms. ACO
optimised ANFIS response gave a rise time of 2.1898 ms, no overshoot and a settling time
of 68.8619 ms at the same set point and load. At 1.5 times increase in load torque (7.5 Nm),
ACO optimised Fuzzy PID response had a rise time of 0.87 ms, an overshoot of 2.4268%
and a settling time of 77.0718 ms. ACO optimised ANFIS response had a rise time of 6.5280
ms, no overshoot and a settling time of 24.8583 ms. Superior performance of ANFIS
controller is attributed to its powerful capability for learning and its advantage of both FLC
and ANN.
PSO optimised Fuzzy PID response at the set point of 700 rpm with a nominal load of 5 Nm
had a rise time of 3.0845 ms, an overshoot of 5.1384% and a settling time of 43.447 ms.
PSO optimised ANFIS response had a rise time of 2.0796 ms, no overshoot and a settling
time of 41.7125 ms at the same set point and nominal load. When the load torque was
reduced to 0.8 of the nominal, thus, to 4 Nm, PSO optimised Fuzzy PID response had a rise
time of 3.8056 ms with an overshoot of 10.7843% and a settling time of 34.2664 ms. ANFIS
optimised response had a rise time of 1.8122 ms, no overshoot and a settling time of 56.7098
ms at the same set point and load. At 1.5 times increase in load torque (7.5 Nm), PSO
optimised Fuzzy PID response had a rise time of 0.64 ms, an overshoot of 2.0972% and a
51
settling time of 68.6127 ms. PSO optimised ANFIS response gave a rise time of 5.376 ms,
no overshoot and a settling time of 21.6788 ms. The relatively better performance of the
ANFIS controller was due to its powerful capability for learning, robustness and rapidity.
GSA optimised Fuzzy PID response at the set point of 700 rpm with a nominal load of 5
Nm had a rise time of 3.6448 ms, an overshoot of 5.3618% and a settling time of 38.0161
ms. GSA optimised ANFIS response achieved a rise time of 2.1089 ms, no overshoot and a
settling time of 44.65 ms at the same set point and nominal load. When the load torque was
reduced to 0.8 of the nominal, thus, to 4 Nm, GSA optimised Fuzzy PID response had a rise
time of 3.3768 ms with an overshoot of 11.8184% and a settling time of 35.2454 ms. GSA
optimised ANFIS response gave a rise time of 1.8878 ms, no overshoot and a settling time
of 59.1402 ms at the same set point and load. At 1.5 times increase in load torque (7.5 Nm),
GSA optimised Fuzzy PID response had a rise time of 0.72 ms, an overshoot of 1.8875%
and a settling time of 75.1920 ms. GSA optimised ANFIS response offered a rise time of
5.5296 ms, no overshoot and a settling time of 21.0065 ms. Again the ANFIS controller
performance was better due to its advantages of both FLC and ANN, capability for
adaptation, learning and robustness.
Both the ACO and PSO algorithms are data clustering algorithms by implementing swarm
behaviour. The ACO is more applicable to problems where source and destination are
predefined and specific. PSO is a clustering algorithm in the areas of multi-objective, and
dynamic optimisation. GSA is a clustering algorithm in the areas of multi-objective and
constraint handling. PSO is applicable to problems that are fuzzy in nature. These
characteristics of the optimisers were implicitly evident in the simulations.
4.4
Summary of Findings
Based on the results discussed, the following findings can be established:
i.
The speed performance of the BLDC motor had a better output response with the
ANFIS controller as compared to the Fuzzy PID controller. At all load torques
considered, the rise time, overshoot and settling time of the ANFIS controller was
better than that of the Fuzzy PID as it had no overshoot in its output response and
took very little time to settle to steady state.
ii.
Varying the load torque to 0.8 times and 1.5 times the nominal do not really affect
the speed regulation of the BLDC motor as the output responses show that the
controllers can adjust under these loading conditions.
52
iii. For an increased load torque, the rise time of Fuzzy PID speed control decreases
whilst that of ANFIS-based control increases, all irrespective of the AI-based
optimisation.
iv. ANFIS-based speed control exhibits no overshoot whilst the Fuzzy PID-based speed
control suffers overshoot which reduces with an increase in load, irrespective of
optimisation.
v.
The settling time of the Fuzzy PID-based control system increases with increased
load whilst that of ANFIS control decreases with increase in load, irrespective of
optimisation of the controllers.
vi. PSO is more efficient in reducing the rise time, settling time and overshoot followed
by GSA and ACO for a Fuzzy PID-based speed control system.
vii. For an ANFIS controller, PSO followed by GSA and ACO gives both improved rise
time and settling time.
viii. An ANFIS controller-based speed control system is more capable than the Fuzzy
PID controller-based system in handling load disturbances above nominal value
53
CHAPTER 5
CONCLUSIONS AND RECOMMENDATIONS
5.1
Conclusions
Based on the findings of this research, the following conclusions can be made:
i.
ANFIS controller performs better than Fuzzy PID controller under all loading
conditions;
ii.
Both the Fuzzy PID and ANFIS controllers show improvement when they are
optimised with regard to the transient characteristics of the motor and control
responses;
iii. Optimising of controllers does not guarantee good control responses at all times;
iv. PSO algorithm and GSA optimised the controllers better than the ACO algorithm;
and
v.
In the analysis of control performances of the BLDC motor, a very low settling time
which comparatively favours the ANFIS controller over the Fuzzy PID controller,
is of great importance.
5.2
Recommendations
The following are recommended:
i.
To obtain good control responses and hence performance of the BLDC motor, it is
prudent not to tolerate more than 1.5 times the nominal load torque as it greatly
affects the output response of the controllers; and
ii.
Future work should focus on hybridising the optimisers to further improve on the
control performances.
54
REFERENCES
Ahmed, A. M., Ali-Eldin, A., Elksasy, M. S. and Areed, F. F. (2015), "Brushless DC Motor
Speed Control Using both PI Controller and Fuzzy PI Controller", International
Journal of Computer Applications, Vol. 109, No. 10, pp. 29 - 35.
Akhila, M., and Ratnan, P. (2016), "Brushless DC Motor Drive with Regenerative Braking
Using Adaptive Neuro-based Fuzzy Inference System", Proceedings of the IEEE
International Conference on Electrical, Electronics and Optimisation Techniques,
Thrissur, India, pp. 748 - 751.
Anon. (2015), “Brushless DC Motor Basics”, www.groschopp.com. Accessed: November
18, 2018.
Anon. (2018a), “Img Brushless”, www.nidec.com. Accessed: November 18, 2018.
Anon. (2018b), “Interior and Exterior Air Gap”, www.google.com. Accessed: November 18,
2018.
Anon. (2018c), “The Construction and Principle of Operation of BLDC Motor”,
www.shodhganga.inflibnet.ac.in/bitstream. Accessed: November 18, 2018.
Anon. (2018d), “PID Controller”, http://engineering.ju.edu.jo/Laboratories/07-PID.
Accessed: December 13, 2018.
Anon. (2018e), “Sliding Mode Control”, www.researchgate.net. Accessed: December 16,
2018.
Anon. (2018f), “Sliding Mode Control”, www.wikipedia.org. Accessed: December 16,
2018.
Bai, Q. (2010), “Analysis of Particle Swarm Optimisation Algorithm”, Computer and
Information Science, Vol. 3, No. 1, pp. 1 – 5.
Duman, S., Maden, D. and Guvenc, U. (2013) ‘Determination of the PID Controller
Parameters for Speed and Position Control of DC Motor using Gravitational Search
Algorithm’, Proceedings of the IEEE International Conference on Electrical and
Electronics Engineering, Duzce, Turkey, pp. 225 – 259.
55
Ebrahim, E. A. (2016), “Ant-Colony Optimisation Control of Brushless-DC Motor Driving
a Hybrid Electric-Bike and Fed from Photovoltaic Generator”, Proceedings of the IEEE
Congress on Evolutionary Computation, Cairo, Egypt, pp. 4221 – 4228.
Goswamai, R. and Joshi, D. (2018), “Performance Review of Fuzzy Logic-based Controllers
Employed in Brushless DC Motor”, Proceedings of the International Conference on
Computational Intelligence and Data Science, Delhi, India, pp. 623 – 631.
Hameed, H. S. (2018), “Brushless DC Motor Controller Design Using Matlab Applications”,
Proceedings of the IEEE International Scientific Conference of Engineering Sciences,
Diyala, Iraq, pp. 44 – 49.
Jaya, A., Fauziah, M. D., Murdianto, F. D., Purwanto, E., Prabowo, G. and Rusli, M. R.
(2017), “Design of PID-fuzzy for Speed Control of Brushless DC Motor in Dynamic
Electric Vehicle to Improve Steady-State Performance”, International Electronics
Symposium on Engineering Technology and Applications, Surabaya, Indonesia, pp. 179
– 184.
Jing, J., Wang, Y. and Huang, Y. (2016), “The Fuzzy-PID Control of Brushless DC Motor”,
Proceedings of the IEEE International Conference on Mechatronics and Automation,
Bengbu, China, pp. 1440 – 1444.
Kaur, M. (2017), “Literature Review of PID Controller based on Various Soft Computing
Techniques”, International Journal on Recent Innovation Trends in Computing and
Communication, Vol. 5, No. 6, pp. 1375 – 1378.
Kavathe, R., Chandle, J. O., Patil, N. and Kokare, M. (2018), “ANFIS based Speed Control
of BLDC Motor with Bidirectional DC-DC Converter” International Journal of
Research and Scientific Innovation, Vol. 5, No.6, pp. 153 – 159.
Khajehzadeh, M. and Eslami, M. (2012), “Gravitational Search Algorithm for Optimisation
of Retaining Structures”, Indian Journal of Science and Technology, Vol. 5, No. 1, pp.
1821 – 1827.
Kumar, Y. and Sahoo, G. (2014), “A Review on Gravitational Search Algorithm and its
Applications to Data Clustering and Classification”, International Journal of Intelligent
Systems and Applications, Vol. 6, No. 6, pp. 79 – 83.
56
Mondal, S., Mitra, A. and Chattopadhyay, M. (2015), “Mathematical Modelling and
Simulation of Brushless DC Motor with Ideal Back Emf for a Precision Speed Control”,
Proceedings of the IEEE International Conference on Electrical, Computer and
Communication Technologies, Coimbatore, India, pp. 1 – 5.
Premkumar, K. and Manikandan, B. V. (2015), “Speed Control of Brushless DC Motor
Using Bat Algorithm Optimised Adaptive Neuro-Fuzzy Inference System”,
International Journal of Applied Soft Computing, Vol. 32, No. 5, pp. 403 - 419.
Premkumar, K. and Manikandan B. V. (2016), “Bat Algorithm Optimised Fuzzy PD-Based
Speed Controller for Brushless Direct Current Motor”, International Journal of
Engineering Science and Technology, Vol. 19, No. 2, pp. 818 - 840.
Pushek, M. (2013), "Brushless DC Motors: Construction and Operating Principles",
www.edn.com. Accessed: November 17, 2018.
Sandoval, D., Soto, I. and Adasme, P. (2015), “Control of Direct Current Motor Using Ant
Colony Optimisation”, Proceedings of the Conference on Information and
Communication Technologies, Santiago, Chile, pp. 79 – 82.
Shen, S., Chu, H., Shao, Y. and Ning, J. (2018), “An Investigation of Advanced Permanent
Magnetic Brushless DC Motor Using FOPID Controller”, Proceedings of the 33rd
Youth Academic Annual Conference of Chinese Association of Automation, Nanjing
JianSun, China, pp. 1156 – 1159.
Singh, J. and Singh, M. (2016), “Comparison and Analysis of Different Techniques for
Speed Control of Brushless DC Motor Using MATLAB Simulink”, International
Journal of Engineering Trends and Technology, Vol. 38, No. 3, pp. 372 – 379.
Sivarani, T. S., Jawhar, S. J. and Kumar, C. A. (2018), “Novel Bacteria Foraging-based
ANFIS for Speed Control of Matrix Converter-fed Industrial BLDC Motors under Low
Speed and High Torque”, International Journal of Neural Computing and
Applications, Vol. 29, No. 12, pp. 1411 - 1434.
Wang, H., Hu, Y., Liao, W. and Yan T. (2015), “Optimal PID Control of DC Motor with
ABC and PSO Algorithms”, International Journal of Advanced Mechatronic Systems,
Zhengzhou, China, Vol. 6, No. 5, pp. 196 - 199.
57
Wang, J. S. and Song, J. D. (2015), “Function Optimisation and Parameter Performance
Analysis based on Gravitational Search Algorithm”, International Journal of
Algorithms, Vol. 9, No. 1, pp. 1 - 13.
Wang, Z., Liu, C., Song, X., Song, Z. and Yang, Z. (2016), “Improved Variable Universe
Fuzzy PID Application in Brushless DC Motor Speed Regulation System”,
Proceedings of the IEEE International Conference on Machine Learning and
Cybernetics, Shijiazhaung, China, Vol. 1, No. 3, pp. 459 – 463.
Xia, C., Fang, H., Chen, W., Xiu, J. and Shi, T. (2006), “Ant Colony Algorithm-based Fuzzy
Control for a Brushless DC Motor”, Proceedings of the 6th World Congress on
Intelligent Control and Automation, Dalian, China, Vol. 2, No. 1, pp. 6498 – 6502.
Yu, Y. and Yunfei, F. (2014), “Applications of Brushless DC Motor in the Production
Delivery System”, The Open and Automation Control Systems Journal, Vol. 6, No. 1,
pp. 1832 – 1836.
Yunbin, S., Rongrong, Y., Jianwen, G. and Yongling, F. (2015), “Sliding Mode Speed
Control for Brushless DC Motor based on Sliding Mode Torque Observer”,
Proceedings of the IEEE International Conference on Information and Automation,
Beijing, China, pp. 2466 – 2470.
58
APPENDIX
CODES FOR OPTIMISERS
%=======================================================================
%Codes for Optimisers
%***********************************************************************
Obj_fcn
function cost_value=cost_func(k,plotfig)
assignin('base', 'Kp',k(1))
assignin('base', 'Ki',k(2))
assignin('base', 'Kd',k(3))
sim('Back_Emf.slx')
err = reference-output;
[n,~] = size(err);
cost_value=0;
for i=1:n
% cost_value=cost_value+(err(i))^2 ; % ISE
cost_value=cost_value+t(i)*abs(err(i)); % ITAE
end
%-----------------------------------------------------------------------
% Particle Swarm Optimisation Algorithm
%-----------------------------------------------------------------------
Main_codes
clc
clear all
close all
rng default
LB=[0 0 0 0 0 0 0]; %lower bounds of variables
UB=[0.04667 0.05333 0.06 0.0667 0.7333 0.08 0.08669]; %upper bounds of variables
% pso parameters values
m=7; % number of variables
n=100; % population size
wmax=0.9; % inertia weight
wmin=0.4; % inertia weight
c1=2; % acceleration factor
c2=2; % acceleration factor
% pso main program----------------------------------------------------start
maxite=1000; % set maximum number of iteration ResearchGate, March 2016 2
maxrun=10; % set maximum number of runs need to be
for run=1:maxrun
run
% pso initialization----------------------------------------------start
for i=1:n
for j=1:m
x0(i,j)=round(LB(j)+rand()*(UB(j)-LB(j)));
end
end
x=x0; % initial population
v=0.1*x0; % initial velocity
for i=1:n
59
f0(i,1)=ofun(x0(i,:));
end
[fmin0,index0]=min(f0);
pbest=x0; % initial pbest
gbest=x0(index0,:); % initial gbest
% pso initialization------------------------------------------------end
% pso algorithm---------------------------------------------------start
ite=1;
tolerance=1;
while ite<=maxite && tolerance>10^-12
w=wmax-(wmax-wmin)*ite/maxite; % update inertial weight
% pso velocity updates
for i=1:n
for j=1:m
v(i,j)=w*v(i,j)+c1*rand()*(pbest(i,j)-x(i,j))...
+c2*rand()*(gbest(1,j)-x(i,j));
end
end
% pso position update
for i=1:n
for j=1:m
x(i,j)=x(i,j)+v(i,j);
end
end
% handling boundary violations
for i=1:n
for j=1:m
if x(i,j)<LB(j)
x(i,j)=LB(j);
elseif x(i,j)>UB(j)
x(i,j)=UB(j);
end
end
end
% evaluating fitness
for i=1:n
f(i,1)=ofun(x(i,:));
end
% updating pbest and fitness
for i=1:n
if f(i,1)<f0(i,1)
pbest(i,:)=x(i,:);
f0(i,1)=f(i,1);
end
end
[fmin,index]=min(f0); % finding out the best particle
ffmin(ite,run)=fmin; % storing best fitness
ffite(run)=ite; % storing iteration count
% updating gbest and best fitness
if fmin<fmin0
gbest=pbest(index,:);
fmin0=fmin;
60
end
% calculating tolerance
if ite>100;
tolerance=abs(ffmin(ite-100,run)-fmin0);
end
% displaying iterative results
if ite==1
disp(sprintf('Iteration Best particle Objective fun'));
end
disp(sprintf('%8g %8g %8.4f',ite,index,fmin0));
ite=ite+1;
end
% pso algorithm-----------------------------------------------------end
gbest;
fvalue=10*(gbest(1)-1)^2+20*(gbest(2)-2)^2+30*(gbest(3)-3)^2;
fff(run)=fvalue;
rgbest(run,:)=gbest;
disp(sprintf('--------------------------------------'));
end
% pso main program------------------------------------------------------end
disp(sprintf('\n'));
disp(sprintf('*********************************************************'));
disp(sprintf('Final Results-----------------------------'));
[bestfun,bestrun]=min(fff)
best_variables=rgbest(bestrun,:)
%----------------------------------------------------------------------%
%Ant Colony Optimisation Algorithm
%-----------------------------------------------------------------------
clc
close all
clear all
%% ACO paramters
n_iter=50; %number of iteration
NA=5; % Number of Ants
alpha=0.8; % alpha
beta=0.2; % beta
roh=0.7; % Evaporation rate
n_param=3; % Number of paramters
LB=(0.01).*ones(1,27); % lower bound
UB=10.*ones(1,27); % upper bound
n_node=10000; % number of nodes for each param
cost_best_prev=inf;
%% Generating Nodes
T=ones(n_node,n_param).*eps; % Phormone Matrix
dT=zeros(n_node,n_param); % Change of Phormone
for i=1:n_param
Nodes(:,i) =linspace(LB(i),UB(i),n_node); % Node generation at equal spaced points
end
%% Iteration loop
for iter=1:n_iter
61
for tour_i=1:n_param
prob(:,tour_i)= (T(:,tour_i).^alpha) .* ((1./Nodes(:,tour_i)).^beta);
prob(:,tour_i)=prob(:,tour_i)./sum(prob(:,tour_i));
end
for A=1:NA
for tour_i=1:n_param
node_sel=rand;
node_ind=1;
prob_sum=0;
for j=1:n_node
prob_sum=prob_sum+prob(j,tour_i);
if prob_sum>=node_sel
node_ind=j;
break
end
end
ant(A,tour_i)=node_ind;
end
cost(A)=cost_func(Nodes(ant(A,:)),0);
clc
disp(['Ant number: ' num2str(A)])
disp(['Ant Cost: ' num2str(cost(A))])
disp(['Ant Paramters: ' num2str(Nodes(ant(A,:)))])
if iter~=1
disp(['iteration: ' num2str(iter)])
disp('_________________')
disp(['Best cost: ' num2str(cost_best)])
disp(['Best paramters: ' num2str(Nodes(ant(cost_best_ind,:)))])
end
end
[cost_best,cost_best_ind]=min(cost);
% Elitsem
if (cost_best>cost_best_prev) && (iter~=1)
[cost_worst,cost_worst_ind]=max(cost);
ant(cost_worst_ind,:)=best_prev_ant;
cost_best=cost_best_prev;
cost_best_ind=cost_worst_ind;
else
cost_best_prev=cost_best;
best_prev_ant=ant(cost_best_ind,:)
end
dT=zeros(n_node,n_param); % Change of Phormone
for tour_i=1:n_param
for A=1:NA dT(ant(A,tour_i),tour_i)=dT(ant(A,tour_i),tour_i)+cost_best/cost(A);
end
end
T= roh.*T + dT;
62
%-----------------------------------------------------------------------
%Gravitational Search Algorithm
%-----------------------------------------------------------------------
EvaluateF
%This function Evaluates the agents.
function fitness=evaluateF(X,F_index);
[N,dim]=size(X);
for i=1:N
%L is the location of agent number 'i'
L=X(i,:);
%calculation of objective function for agent number 'i'
fitness(i)=test_functions(L,F_index,dim);
end
Main.m
N=50; max_it=1000; ElitistCheck=1; Rpower=1; min_flag=1; % 1: minimization,0:
maximization
F_index=1
[Fbest,Lbest,BestChart,MeanChart]=GSA(F_index,N,max_it,ElitistCheck,min_flag,Rpow
er);
Gconstant.m
% This function calculates Gravitational constant
function G=Gconstant(iteration,max_it)
alfa=20;G0=100;
G=G0*exp(-alfa*iteration/max_it);
GFIED.M
%This function calculates the accelaration of each agent in gravitational field
function a=Gfield(M,X,G,Rnorm,Rpower,ElitistCheck,iteration,max_it);
[N,dim]=size(X);
final_per=2; %In the last iteration, only 2 percent of agents apply force to the others.
%%%%total force calculation
if ElitistCheck==1
kbest=final_per+(1-iteration/max_it)*(100-final_per); %kbest
kbest=round(N*kbest/100);
else
kbest=N;
end
[Ms ds]=sort(M,'descend')
for i=1:N
E(i,:)=zeros(1,dim);
for ii=1:kbest
j=ds(ii);
if j~=i
R=norm(X(i,:)-X(j,:),Rnorm); %Euclidian distanse.
for k=1:dim
E(i,k)=E(i,k)+rand*(M(j))*((X(j,k)-X(i,k))/(R^Rpower+eps));
%note that Mp(i)/Mi(i)=1
end
end
end
end
%%acceleration
63
a=E.*G; %note that Mp(i)/Mi(i)=1
GSA.m
function
[Fbest,Lbest,BestChart,MeanChart]=GSA(F_index,N,max_it,ElitistCheck,min_flag,Rpow
er)
Rnorm=2;
%get allowable range and dimension of the test function.
[low,up,dim]=test_functions_range(F_index);
%random initialization for agents.
X=initialization(dim,N,up,low);
%create the best so far chart and average fitnesses chart.
BestChart=[];MeanChart=[];
V=zeros(N,dim);
for iteration=1:max_it
% iteration, Checking allowable range.
X=space_bound(X,up,low);
%Evaluation of agents.
fitness=evaluateF(X,F_index);
if min_flag==1
[best best_X]=min(fitness); %minimization.
else
[best best_X]=max(fitness); %maximization.
end
if iteration==1
Fbest=best;Lbest=X(best_X,:);
end
if min_flag==1
if best<Fbest %minimization.
Fbest=best;Lbest=X(best_X,:);
end
else
if best>Fbest %maximization
Fbest=best;Lbest=X(best_X,:);
end
end
BestChart=[BestChart Fbest]; MeanChart=[MeanChart mean(fitness)];
[M]=massCalculation(fitness,min_flag); %Calculation of M
G=Gconstant(iteration,max_it); %Calculation of Gravitational constant
%Calculation of accelaration in gravitational field
a=Gfield(M,X,G,Rnorm,Rpower,ElitistCheck,iteration,max_it);
[X,V]=move(X,a,V); %Agent movement
end %iteration
Initialisation.m
%This function initializes the position of the agents in the search space, %randomly
function [X]=initialization(dim,N,up,down)
if size(up,2)==1
X=rand(N,dim).*(up-down)+down;
end
if size(up,2)>1
for i=1:dim
high=up(i);low=down(i);
X(:,i)=rand(N,1).*(high-low)+low;
64
end
end
masscalculation.m
%This function calculates the mass of each agent.
function [M]=massCalculation(fit,min_flag);
%%%%here, make your own function of 'mass calculation'
Fmax=max(fit); Fmin=min(fit); Fmean=mean(fit);
[i N]=size(fit);
if Fmax==Fmin
M=ones(N,1);
else
if min_flag==1 %for minimization
best=Fmin;worst=Fmax;
else %for maximization
best=Fmax;worst=Fmin;
end
M=(fit-worst)./(best-worst);
end
M=M./sum(M);
Move.m
%This function updates the velocity and position of agents.
function [X,V]=move(X,a,V)
%movement
[N,dim]=size(X); V=rand(N,dim).*V+a; X=X+V;
Spacebound.m
%This function checks the search space boundaries for agents.
function X=space_bound(X,up,low);
[N,dim]=size(X);
for i=1:N
% %%Agents that go out of the search space, are reinitialized randomly .
Tp=X(i,:)>up;Tm=X(i,:)<low;X(i,:)=(X(i,:).*(~(Tp+Tm)))+((rand(1,dim).*(uplow)+low).*(Tp+Tm));
end
test_function.m
% This function calculates the value of the objective function.
function fit=test_functions(L,F_index,dim)
%Insert your own objective function with a new F_index.
if F_index==1
fit=sum(L.^2);
end
if F_index==2
fit=sum(abs(L))+prod(abs(L));
end
if F_index==3
fit=0;
for i=1:dim
fit=fit+sum(L(1:i))^2;
end
end
if F_index==4
fit=max(abs(L));
65
end
if F_index==5
fit=sum(100*(L(2:dim)-(L(1:dim-1).^2)).^2+(L(1:dim-1)-1).^2);
end
if F_index==6
fit=sum(floor((L+.5)).^2);
end
if F_index==7
fit=sum([1:dim].*(L.^4))+rand;
end
if F_index==8
fit=sum(-L.*sin(sqrt(abs(L))));
end
if F_index==9
fit=sum(L.^2-10*cos(2*pi.*L))+10*dim;
end
if F_index==10
fit=-20*exp(-.2*sqrt(sum(L.^2)/dim))-exp(sum(cos(2*pi.*L))/dim)+20+exp(1);
end
test_function_range
function [down,up,dim]=test_functions_range(F_index)
dim=10;
if F_index==1
down=-100;up=100;
end
if F_index==2
down=-10;up=10;
end
if F_index==3
down=-100;up=100;
end
if F_index==4
down=-100;up=100;
end
if F_index==5
down=-30;up=30;
end
if F_index==6
down=-100;up=100;
end
if F_index==7
down=-1.28;up=1.28;
end
if F_index==8
down=-500;up=500;
end
if F_index==9
down=-5.12;up=5.12;
end
if F_index==10
down=-32;up=32;
end
66
Download