Can I get the code for Economic Load Dispatch using Gradient Descent (matlab)?

I'm not getting how to proceed after this!!
clc
a=[500;400;200];
b=[5.31;5.5;5.8];
g=[0.004;0.005;0.009];
lambda=input('enter vvalue of lambda');
iter=0;
Pd=800;
n=length(a);
delP=5;tcost=0;
tolerance=0.0001;
while abs(delP)>tolerance
iter=iter+1;
x=0;
for i=1:n
p(i)=(lambda-b(i))/(2*g(i));
x=x+(1/(2*g(i)));
cost=(a(i)+(b(i)*p(i))+(g(i)*p(i)*p(i)));

11 件のコメント

Suzzane M
Suzzane M 2020 年 6 月 24 日
Let's assume F1= 561+7.92P1+0001562P1*P1
F2= 310+7.85P2+0.00194P2*P2
F3=78+7.97P3+0.00482P3*P3
Total load demand=850MW
P1=400MW
P2=300MW
P3=150MW
Ploss=0.00003P1*P1+0.00009P2*P2+0.00012P3*P3
mahesh kumar
mahesh kumar 2020 年 6 月 24 日
編集済み: mahesh kumar 2020 年 6 月 24 日
HI! which paper/text are you following..for gradient descent algr..
(other than allen j. wood??)
Suzzane M
Suzzane M 2020 年 6 月 24 日
Hi, I am basically following allen.J wood along with this-http://home.iitk.ac.in/~saikatc/EE632_files/chap2.pdf
I've made some progress in code but I still don't know how to include loss?
clear all
clc
linedata=[ 0.001562 7.92 561 400;
0.00194 7.85 310 300;
0.00482 7.97 78 150; ]
a = linedata(:,1);
b = linedata(:,2);
c = linedata(:,3);
p = linedata(:,4);
for iter = 1:9
for i = 1:3
df(i) = b(i)+(2*a(i)*p(i));
end
lamda = sum(df)/3;
lamda
iter
for i = 1:3
pn(i) = p(i)-(df(i)-lamda);
end
pn
pt=sum(pn)
for i = 1:3
fc(i) = c(i)+b(i)*p(i)+(a(i)*(p(i)^2));
end
fulcost = sum(fc)
for i = 1:3;
p(i) = pn(i)
end
end
mahesh kumar
mahesh kumar 2020 年 6 月 24 日
nice sister, did you get your answer?
mahesh kumar
mahesh kumar 2020 年 6 月 24 日
編集済み: mahesh kumar 2020 年 6 月 25 日
you seem to have bn using too many for loops; try this..
clc
clear
linedata=[ 0.001562 7.92 561 400;
0.00194 7.85 310 300;
0.00482 7.97 78 150; ];
dP=1;
a = linedata(:,1);
b = linedata(:,2);
c = linedata(:,3);
p = linedata(:,4);
while abs(dP)>0.001
df=b+2*a.*p;
lamda = sum(df)/3;
disp(lamda)
pn=p-df+lamda;
disp(pn)
% pt=sum(pn)
% for i = 1:3
% fc(i) = c(i)+b(i)*p(i)+(a(i)*(p(i)^2));
% end
dP=p-pn
p=pn; disp(p); disp(sum(p))
end
fc=c+b.*p+a.*p.*p;
fuelcost = sum(fc);
disp(fuelcost)
Suzzane M
Suzzane M 2020 年 6 月 25 日
Hi. Yes it runs perfectly. But how to include losses in the above code ?
mahesh kumar
mahesh kumar 2020 年 6 月 25 日
編集済み: mahesh kumar 2020 年 6 月 25 日
I'll send something today,by evening,ok?
Suzzane M
Suzzane M 2020 年 6 月 25 日
Yes. Thankyou so much!
Suzzane M
Suzzane M 2020 年 6 月 25 日
Ploss=0.00003P1*P1+0.00009P2*P2+0.00012P3*P3 This is the loss equation to be incorporated in the above code.
mahesh kumar
mahesh kumar 2020 年 6 月 27 日
編集済み: mahesh kumar 2020 年 6 月 27 日
try this::
B = [.00003 0 0;0 .00009 0 ; 0 0 .00012]; dB=diag(B); load=850;
x=max(b); dP=1;i=0;
z=randperm(10000,length(b))'; P=load*z/sum(z);
while abs(dP)>0.000001
i=i+1; disp(i);
dP=load+P'*B*P-sum(P); % loss=P'*B*P;
x=x+dP*2/(sum(1./a));
P=(x-b-2*(B*P-dB.*P))./(2*a+2*x*dB);
% plot(x,P,'x'); hold on; pause(1);
% C=c+b.*P+a.*P.*P;
% plot(x,sum(C)/100,'o');
end
Suzzane M
Suzzane M 2020 年 6 月 28 日
Yes, it solves my problem. Thankyou so much for the help. Was badly stuck in for days. Fianlly got some clarity. Thankyou again

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangePower and Energy Systems についてさらに検索

質問済み:

2020 年 6 月 23 日

編集済み:

2020 年 6 月 29 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by