plz can anybody see d below coding for economic load dispatch with the help of genetic alogorithem i have some error plz i tried a lot bt cant do ....this is my own code ....
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
clear
%This is a program of economic generation scheduling using genetic algorithm
%method with limits imposed on generators.
%This program calculates the values of generations for all the three
%generators for a given load demand. It loads the fuel cost characteristics
%as well the minimum and maximum limits of generators from fuelcost.m file.
%%%%%%%%%%%%%%ENTER ALL THE REQUIRED DATA%%%%%%%%%%%%%
load fuelcost.m
load losscoefficient1.m
for i=1:6
for j=1:6
B(i,j) = losscoefficient1(i,j);
end
end
af = fuelcost(:,1);
bf = fuelcost(:,2);
cf = fuelcost(:,3);
pgmin = fuelcost(:,4);
pgmax = fuelcost(:,5);
alpha = 1.0;
ITMAX = 50;
BIG = 1.0;
l = input ('Enter the length of string l= ');
L = input ('Enter the population size L = ');
pc= input ('Enter the probability of crossover pc = ');
pd= input ('Enter the value of load demand in MW = ');
%%%%%%GENERATE POPULATION OF RANDOM BINARY NUMBER ARRAY%%%%
for i=1:L
for j=1:l
a=rand(1);
if a > 0.5
b(i,j)=1;
else
b(i,j)=0;
end
end
end
it=1;
k=0;
j=0;
BIG = 1.0;
fmax=0.0;
fmin=1.0;
x=(L/6);
while (it<=ITMAX)
k=k+1;
j=0;
j=j+1;
end
%%%%%%%%%%%CONVERT POPULATION IN BINARY TO DECIMAL%%%%%%%%
while (j<=x)
if it==1
g=1;
d(g,j)=bi2de(b(j,:));
g=2;
d(g,j)=bi2de(b(j+x,:));
g=3;
d(g,j)=bi2de(b(j+(2*x),:));
g=4;
d(g,j)=bi2de(b(j+(3*x),:));
g=5;
d(g,j)=bi2de(b(j+(4*x),:));
g=6;
d(g,j)=bi2de(b(j+(5*x),:));
else
for i=1:n
g=1;
d(g,i)=bin2dec(c1(i,:));
d(g,n+i)=bin2dec(c1(n+i,:));
g=2;
d(g,i)=bin2dec(c2(i,:));
d(g,n+i)=bin2dec(c2(n+i,:));
g=3;
d(g,i)=bin2dec(c3(i,:));
d(g,n+i)=bin2dec(c3(n+i,:));
g=4;
d(g,j)=bi2de(b(j+(3*x),:));
g=5;
d(g,j)=bi2de(b(j+(4*x),:));
g=6;
d(g,j)=bi2de(b(j+(5*x),:));
end
end
%%%%%%%%%CALCULATING THE GENERATION POWER IN MW%%%%%%%%%%
for i=1:6
px(i)=(pgmax(i)-pgmin(i))/((2^(l))-1);
end
for i=1:6
pg(i,j)=pgmin(i)+(px(i)*d(i,j));
end
%%%%%%%%CALCULATING THE TOTAL GENERATION POWER IN MW%%%%%%
sum1=0;
for i =1:6
sum1 =sum1 + pg(i,j);
end
pge(j) = sum1;
%%%%%%%CALCULATING THE TRANSMISSION LINE LOSS IN MW%%%%%%%%%
sum=0;
for i=1:6
for k=1:3
sum = sum +(pg(i,j))*(B(i,k))*(pg(k,j));
end
end
pl = sum;
epsilon(j) = abs (pd + sum-sum1);
if epsilon(j)<BIG
BIG = epsilon(j);
end
%%%%%%%%%CALCULATION THE FITNESS FUNCITON%%%%%%%%%%%%%%
fitness(j)=1/(1+(epsilon(j)/pd));
if fitness(j)>fmax
fmax=fitness(j);
end
if fitness(j)<fmin
fmin=fitness(j);
end
if it==1
explode = zeros(size(fitness));
[c,offset]= max(fitness);
explode(offset) =1;
h = pie (fitness,explode);
pause;
end
j=j+1;
end
%%%%%%%%%CALCULATING MAXIMUM & AVERAGE FITNESS %%%%%%%%%%
fitnessmax= max(fitness);
sum=0;
for i=1:(L/6)
sum= sum + fitness(i);
end
average = (sum / (L/6));
%%%SELECT THE PARENT USING STOCHASTIC REMAINDER ROULETTE WHEEL SELECTION%%%
i=0;
j=0;
sum=average;
j=j+1;
while j<=(L/6)
y=fitness(j)/sum;
a=y/2;
if a>=(0.5)
I=1;
else
I=0;
end
F(j)=y-I;
while I>0
if I<0
if j<20
j=j+1;
else
break
end
else
i=i+1;
I=I-1;
sel(i)=j;
m(i)=sel(i);
end
end
if j<(L/6)
j=j+1;
else
break
end
end
i=(L/12);
n=i;
j=0;
while i<(L/6)
if i>20
break
else
j=j+1;
if j>20
j=1;
else
j=j;
end
if F(j)>0.0
a=rand();
if a>0.5
w=1;
else
w=0;
end
if w==1
i=i+1;
sel1(i)=j;
m1(i)=sel1(i);
F(j)=F(j)-1;
else
end
else
end
end
end
%%%%%%%PERFORM SINGLE POINT CROSSOVER FOR SELECTED PARENTS%%%
for i=1:n
s=m(i);
s1=m1(n+i);
cp=round(pc*l);
for k=1
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c1(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c1(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
end
for k=2
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c2(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c2(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
end
for k=3
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c3(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c3(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
for k=4
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c1(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c1(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
end
for k=5
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c2(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c2(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
end
for k=6
a1=d(k,s,:);
a2=d(k,s1,:);
bit1=dec2bin(a1,l);
bit2=dec2bin(a2,l);
c3(i,:)=[bit1(1:cp),bit2(cp+1:l)];
c3(n+i,:)=[bit2(1:cp),bit1(cp+1:l)];
end
end
it=it+1;
end
%%%%%%%%%%%%%COST OF GENERATION%%%%%%%%%%%%%%%%%%%
sum=0;
for i=1:6
sum=sum + (af(i)*(pg(i,j)^2)+ bf(i)*(pg(i,j))+ cf(i));
end
%%%GENERATING PIE CHART FOR GENERATION AT ALL GENERATOR BUSES%%
for i=1:6
x(i)=pg(i);
end
explode = zeros(size(x));
[c,offset]= max(x);
explode(offset) =1;
g = pie (x,explode);
title('\bfPERCENTAGE OF GENERATION AT GENERATOR BUSES FOR BEST RESULTS');
%%%%%%%%%%%%%%RESULT OF THE PROGRAM%%%%%%%%%%%%%%%%%
fprintf('fmax = %f \n',fmax)
pg1 = pg(1,j);
fprintf('pg1= %f MW \n',pg1);
pg2 = pg(2,j);
fprintf('pg2= %f MW \n',pg2);
pg3 = pg(3,j);
fprintf('pg3= %f MW \n',pg3);
total = pge(j);
fprintf('Total generation = %f MW \n',total);
pl = pl;
fprintf('Transmission losses are = %f MW \n',pl);
totalcost = sum;
fprintf('Total cost of generation are = %f Rs/h \n', sum)
%%%%%fuel cost%%%
0.007 7 240 100 500
0.0095 10 200 50 200
0.009 8.5 220 80 300
0.009 11 200 50 150
0.008 10.5 220 50 200
0.0075 12 120 50 120
%%%%%%%%%losscoefficient11%%%%%%%%%%%
0.000014 0.000017 0.000015 0.000019 0.000026 0.000022
0.000017 0.00006 0.000013 0.000016 0.000015 0.00002
0.000015 0.000013 0.000065 0.000017 0.000024 0.000019
0.000019 0.000016 0.000017 0.000071 0.00003 0.000025
0.000026 0.000015 0.000024 0.00003 0.000069 0.000032
0.000022 0.00002 0.000019 0.000025 0.000032 0.000085
16 Kommentare
radhe krishan
am 17 Apr. 2017
Bearbeitet: Walter Roberson
am 17 Apr. 2017
sir why here we take (L/6) in other loop in population size.
and how can add mutation code in programmed
Walter Roberson
am 17 Apr. 2017
I have no idea why L/6 was taken as the population size.
The author of the code, kishan bhayani, posted it in 2013, and is probably no longer available to ask questions of.
Antworten (3)
kishan bhayani
am 11 Mär. 2013
1 Kommentar
radhe krishan
am 14 Apr. 2017
sir you solved this problem if you solve this problem than guide me, am facing same problem in this program
Walter Roberson
am 11 Mär. 2013
Your while i<(L/6) loop can increments j until j > 20, controlled by i < (L/6), but i is only incremented if w==1. You need to trace further and determine whether possibly that conditional increment of i can lead to situations in which j is incremented past the point F(j) is defined to (which is (L/6))
radhe krishan
am 5 Mai 2017
Bearbeitet: Walter Roberson
am 5 Mai 2017
BIG = 1.0;
fmax=0.0;
fmin=1.0;
x=(L/6);
while (it<=ITMAX)
k=k+1;
j=0;
j=j+1;
end
sir
here why we take x=L/6 in binary to decimal conversion
1 Kommentar
Walter Roberson
am 5 Mai 2017
It appears to me that a 2D array with 6 rows (or 6 columns) is being emulated.
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!