0% found this document useful (0 votes)
38 views4 pages

Inputdata3.m: While For If If Else End End End For End

The document contains MATLAB code and data files for economic dispatch of generators without and with losses. It includes: 1) An input data file with generation costs and limits for 3 generators without losses. The code performs economic dispatch to minimize total generation costs for different demand levels. 2) Additional input files including generation cost and loss coefficients. The code is modified to include losses in economic dispatch calculations. Results are shown for two demand levels. 3) Code to simulate generator angle dynamics during a 3-phase fault cleared after 0.2 seconds, showing the angle response.

Uploaded by

nandigamchandu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

Inputdata3.m: While For If If Else End End End For End

The document contains MATLAB code and data files for economic dispatch of generators without and with losses. It includes: 1) An input data file with generation costs and limits for 3 generators without losses. The code performs economic dispatch to minimize total generation costs for different demand levels. 2) Additional input files including generation cost and loss coefficients. The code is modified to include losses in economic dispatch calculations. Results are shown for two demand levels. 3) Code to simulate generator angle dynamics during a 3-phase fault cleared after 0.2 seconds, showing the angle response.

Uploaded by

nandigamchandu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Inputdata3.

m file
% gno
1
2
3

c
400
600
650

b
8.4
8.93
6.78

a
0.006
0.0042
0.004

pmin
100
60
300

pmax
600
300
650

Economic displatch with out losses


load inputdata3.m
A=inputdata3
n=length(A(:,1))
dellambda=0.0001
pd=input('total demand=')
lambda=2*a(1)*(pd/3)+b(1)
u=ones(n,1);delp=0.1;a=A(:,4);b=A(:,3);c=A(:,2);pmin=A(:,5);pmax=A(:,6);
iter=0;
while abs(delp)>=0.01
p=(lambda-b)./(2*a)
for i=1:n
if (p(i)<=pmin(i)|p(i)>=pmax(i))
if p(i)>=pmax(i)
p(i)=pmax(i)
else
p(i)=pmin(i)
end
end
end
pg=0
for i=1:n
pg=pg+p(i)
end
delp=pd-pg
x=sign(delp)
lambda=lambda+x*dellambda
iter=iter+1
end
p
y=pg
pd=820MW
lambda =10.4790
iter =12012
p =
173.2417
184.3929
462.3625
y =819.9970MW
Pd=1500MW
lambda =
15.0000
iter = 6000
p =
549.9917
300.0000
650.0000
y =1.5000e+03

Inputdata.m file
%

uno
1
2

c
420
350

b
9.2
8.5

a
0.004
0.0029

pmin
100
150

pmax
200
500

B_coefficients.m file
% b coefficients
0.000346
0
0
0.0000643

Economic displatch with losses

load inputdata.m
load B_coefficients.m
A=inputdata
B=B_coefficients
n=length(A(:,1))
dellambda=0.0001
p=zeros(n,1)
pd=input('total demand=')
lambda=input('enter initial lambda value=')
u=ones(n,1);delp=0.1;a=A(:,4);b=A(:,3);c=A(:,2);pmin=A(:,5);pmax=A(:,6);
iter=0;
while abs(delp)>=0.01
for i=1:n
sum=0
for j=1:n
if i~=j
sum=sum+B(i,j)*p(j)
end
end
p(i)=(lambda-2*lambda*sum-b(i))/(2*(a(i)+B(i,i)*lambda))
end
for i=1:n
if (p(i)<=pmin(i)|p(i)>=pmax(i))
if p(i)>=pmax(i)
p(i)=pmax(i)
else
p(i)=pmin(i)
end
end
end
pl=p'*B*p
pg=0
for i=1:n
pg=pg+p(i)
end
delp=pd+pl-pg
x=sign(delp)
lambda=lambda+x*dellambda
iter=iter+1
end
p
pg
pl
pd=pg-pl

pd=640.82
lambda =12.1033
iter = 1035
p=
177.3009
489.8255
pg =667.1264
pl =26.3042
pd =640.8222
pd=250
lambda =9.5901
iter =15903
p=
100.0000
155.0055
pg =255.0055
pl =5.0049
pd =250.0006

f=50
t=0
h=8
delt=0.00001
delw=0
pm=1
fault_time=0
fault_clearing_time=0.2
angle=25*pi/180
while (t<=1)
t=t+delt
if t<=fault_time
pe=2.5*sin(angle)
else
if t<=fault_clearing_time
pe=0.6*sin(angle)
else
pe=1.5*sin(angle)
end
end
alpha=(pi*f/h)*(pm-pe)
delw=delw+alpha*delt
angle=angle+delw*delt
hold on
plot(t,angle,'.')
end
hold off

You might also like