Electric Power Distribution Handbook
Electric Power Distribution Handbook
Electric Power Distribution Handbook
2
Bio-inspired algorithms
Bio-inspired algorithms are search methods that simulate the
natural biological evolution or the behaviour of biological entities
[1].
Bio inspired algorithms has a wide range of applications covering all
most all areas including:
– Computer networks
– Security
– Robotics
– Bio medical engineering
– Control systems
– Parallel processing
– Data mining
– Power systems
– Production engineering and many more.
Swarm
Evolutionary Ecological
Intelligence
GA
GP PSO BBO
ES
ACO AWC
DE
ABC PS2O
PFA
BFA
GSO
FA
SFLA
FSA
[2] Yang, Xin-She, Zhihua Cui, Renbin Xiao, Amir Hossein Gandomi, and
Mehmet Karamanoglu, eds. Swarm intelligence and bio-inspired
computation: theory and applications. Newnes, 2013. 6
SI Applications
U.S. Military is investigating swarm
techniques for controlling unmanned
vehicles.
7
6
PSO (1/2)
First described in 1995 [2].
By James Kennedy and Russel
C. Eberhert.
Inspired by social behavior of
birds and fishes.
8
7
PSO (2/2)
Combines self-experience with social experience.
Population-based optimization.
Find approximate solutions
of problems.
Easy to implement.
Few parameters to adjust.
10
Concept (2/2)
In PSO, each single solution is a "bird" in the search
space. We call it "particle".
All the particles have fitness values which are evaluated
by the fitness function.
All particles have velocities, which direct the flying of the
particles.
The particles fly through the problem space by following
the current optimum particles.
11
How does it Work? (1/2)
Initialized with a group of random particles [4].
Searches for optimal by updating generations.
Particles move through the solution space, and are evaluated
according to some fitness criterion.
In every iteration, each particle is updated by following
“best” values.
– Pbest
– Gbest
13
PSO-Algorithm
• For each particle
– Initialize particle with random number
End
DO
– For each particle
• Calculate the fitness value
• If fitness values at time t is better than the its
previous best fitness value (Pbest) at time (t-1)
• Set current value as the new Pbest
END
– Choose the particle with the best fitness value of all
the particles as the gbest
– For each particle
• Update velocity
• Update position
– While maximum iterations not reached.
14
Algorithm-Example (1/8)
15
Algorithm-Example (2/8)
16
Algorithm-Example (3/8)
17
Algorithm-Example (4/8)
18
Algorithm-Example (5/8)
19
Algorithm-Example (6/8)
20
Algorithm-Example (7/8)
21
Algorithm-Example (8/8)
22
PSO Characteristics
Pros [5]
– Simple implementation
– Suitable for concurrent processing
– Derivative free
– Very few algorithm parameters
– Very efficient global search algorithm
Cons [5]
– Premature convergence in mid optimum points
– Slow convergence in refined search stage (weak local search ability)
24
How does it work? (1/2)
In BPSO, population has a set of particles.
Each individual particle represents a binary decision.
This decision can be represented by either YES/TRUE=1 or
NO/FALSE=0.
All particles represent their positions through binary values
which are 0 or 1.
Velocity is restricted within the range {0,1}
25
How does it work? (2/2)
The velocity vector equation and position vector equation are
defined as [5]:
– velocity vector equation:
1
Vi (t 1)
n
vin ( t )
1 e
– position vector equation:
1 if r Vi n
xin (t 1)
0 otherwise
26
BPSO-Example 1 (1/4)
0 1 0 1 1
1 1 1 0 0
Particle 2 0 1 1 0 1
28
BPSO-Example 1 (3/4)
v 23 (t 1) 0.25 Velocity of bit
x23 (t 1) 0 Position of bit
p 23 1 Pbest
Pg 3 1 gbest
c1 2.5
c2 1.5
vid (t ) vid (t 1) c1 ( pid xid (t 1)) c2 ( p gd xid (t 1))
vid (t ) 0.25 (0.25 )(1 0) (1.5)(1 0) 4.43
1
f (v23 (t )) 4.43
0.89
1 e
29
BPSO-Example 1 (4/4)
30
Energy Optimization by BPSO (1/10) [6]
No of Homes 1
No of Appliances 13
Timeslots 24 hours.
[6]. Rahim, Sahar, Nadeem Javaid, Ashfaq Ahmad, Shahid Ahmed Khan, Zahoor Ali Khan, Nabil
Alrajeh, and Umar Qasim. "Exploiting heuristic algorithms to efficiently utilize energy management
controllers with renewable energy sources." Energy and Buildings 129 (2016): 452-470. 31
Energy Optimization by BPSO (2/10)
Appliances
Lighting
Fan, Iron, Microwave over, Washing machine, Dish
Toaster, Cofee maker washer, Clothes dryer Air conditioner, water
heater, space heater
32
Energy Optimization by BPSO (3/10)
33
Energy Optimization by BPSO (4/10)
BPSO Parameters
Swarm size 200
Vmax (maximum velocity) 4 m/s
Vmin (minimum velocity) -4 m/s
Max iterations 600
C1 2
C2 2
34
Energy Optimization by BPSO (5/10)
Key terms corresponding to Smart grid optimization
PSO Role in HEM General use
Parameters
Particle A timeslot (One possible Possible solution in search area
solution)
swarm Set of possible solutions a set of particles
Particle best Local best values for state array Evaluated fitness function
(Pbest) that satisfy objective function . answer
Global best Globally best solution that Evaluated fitness function
(Gbest) satisfy all constraints (A answer
timeslot)
35
Energy Optimization by BPSO (6/10)
• Step1:
– Initialize Particles with random number (randomly generate population)
– Set initial position of particles as Pbest.
Code to randomly generate population
for j=1:swarm
for i=1:n WM DW CD AC WH SP
if rand(1)>0.5 0 1 1 1 1 1
X=1;
1 1 1 0 0 0
else
X=0; 0 1 1 1 0 0
end :
x1(j,i)=X; :
end :
end
0 0 1 0 0 1
36
Energy Optimization by BPSO (7/10)
• Step 2:
– For Each Particle
WM DW CD AC WH SP Fitness
• Calculate the fitness
0 0 1 1 0 1 2.4894
Fitness Function:
1. function [FF]=obj(electricity_cost,
0 1 1 0 1 0 2.4916
power rating,x1,swarm,d) 0 1 1 1 0 0 2.4956
1. for i=1:swarm :
2. FF(i,1)=electricity_cost*x1(i,:)'; :
3. err=c_electricity_cost*x1(i,:)'-d; :
4. FF(i,1)=FF(i,1)+1000*abs(err); 0 1 0 1 1 0 2.4888
5. end
37
Energy Optimization by BPSO (8/10)
• Step 3:
– Choose the Timeslot (solution) with the best fitness value among all possible
solutions as the gbest.
0 1 0 1 1 0
WM DW CD AC WH SP Fitness
0 0 1 1 0 1 2.4894
0 1 1 0 1 0 2.4916
0 1 1 1 0 0 2.4956
Gbest solution
:
:
:
0 1 0 1 1 0 2.4888
38
Energy Optimization by BPSO (9/10)
• Step 4:
– For each Particle
• Update its velocity.
1
Vi n (t 1)
vin (t )
1 e
• Update its position.
1 if r Vi n
xin (t 1)
0 otherwise
• Step 5:
– While maximum iterations not reached.
Note: Repeat this process 24 times to get the most optimal solution
for each timeslot.
39
Energy Optimization by BPSO (10/10)
MATLAB CODE:
1. for i = 1:swarm
2. for j = 1:n
3. v(i,j) = v(i,j)+c1*rand(1)*(pbest(i,j)-x_BP(i,j))+c2*rand(1)*(gbestt_BP(1,j)-x_BP(i,j));
4. if ( (v(i,j) <= vmax) && (v(i,j)>=vmin) )
5. v(i,j) = v(i,j);
6. elseif ( v(i,j) < vmin )
7. v(i,j) = vmin;
8. elseif ( v(i,j) > vmax )
9. v(i,j) = vmax;
10. end
This shows the velocity of the
11. sig(i,j) = 1/(1+exp(-v(i,j)));
12. particle should stay in a limit
13. if rand(1) < sig(i,j)
14. x_BP(i,j) = 1; Apply sigmoidal function on
15. else
the velocity
16. x_BP(i,j) = 0;
17. end
18. end
19. end
40
Any questions?
41