Program and Output
-
Upload
dhamo-daran -
Category
Documents
-
view
273 -
download
0
Transcript of Program and Output
-
7/28/2019 Program and Output
1/38
SINGLE PHASE TWO WIRE SYSTEM
clc;clear all;D=input('Enter the Distance');
d=input('Enter the Diameter');R=d/2;Rm=0.7788*R;L=4e-4*log(D/Rm);c=(pi*(8.854e-9))/log(D/R);Xl=2*pi*50*L;Xc=1/(2*pi*50*c);fprintf('\t Inductive reactance is=%d Ohm/km \n',Xl);fprintf('\t Capacitive reactance is=%d Ohm/km \n',Xc);
-
7/28/2019 Program and Output
2/38
OUTPUT
Enter the Distance 2Enter the Diameter 5.789e-2Inductive reactance is=5.636653e-001 Ohm/km
Capacitive reactance is=4.846921e+005 Ohm/km
-
7/28/2019 Program and Output
3/38
SYMMETRICAL AND UNSYMMTERICAL SYSTEM
clc;clear all;d=input('Enter the diameter');
R=d/2;Rm=0.7788*R;c=input('Enter case number');if c==1
D=input('Enter distance');else
Dab=input('Enter distance between a,b');Dbc=input('Enter distance between b,c');Dca=input('Enter distance between c,a');D=(Dab*Dbc*Dca)^(1/3);
end
L=2e-4*log(D/Rm);C=2*pi*8.854e-9/log(D/R);XL=2*pi*50*L;XC=1/(2*pi*50*C);fprintf('Inductive Reactance %d\n',XL);fprintf('Capacitive Reactance %d\n',XC);
-
7/28/2019 Program and Output
4/38
OUTPUT
Enter the diameter 5.64e-2Enter case number 1Enter distance 2
Inductive Reactance 2.834710e-001 Ohm/kmCapacitive Reactance 2.438380e+005 Ohm/kmEnter case number 2Enter distance between a,b 2Enter distance between b,c 4Enter distance between c,a 3Inductive Reactance 3.064803e-001 Ohm/kmCapacitive Reactance 2.647914e+005 Ohm/km
-
7/28/2019 Program and Output
5/38
THREE PHASE HORIZONTAL CONDUCTOR
clc;clear all;d=input('Enter diameter');
R=d/2Dab=input('Enter distance between a, b');Dbc=input('Enter distance between b, c');Dca=input('Enter distance between c, a');Ds=input('Enter GMR value');Dm=(Dab*Dbc*Dca)^(1/3);L=0.2*log(Dm/Ds)C=0.056/log(Dm/R)XL=2*pi*50*LXC=1/(2*pi*50*C)fprintf('Inductive reactance% d Ohm/km', XL);
fprintf('capacitive reactance %d Ohm/km', XC);
-
7/28/2019 Program and Output
6/38
OUTPUT
Enter diameter. 037R =
0.0185
Enter distance between a, b 15Enter distance between b, c 15Enter distance between c, a 30Enter GMR value .015L =
1.4278C =
0.0081Inductive reactance 4.485443e+002 Ohm/kmcapacitive reactance 3.938564e-001 Ohm/km
-
7/28/2019 Program and Output
7/38
-
7/28/2019 Program and Output
8/38
OUTPUT
Enter diameter 0.035R =
0.0175
Enter bundle space.045enter distance between a, b14Enter distance between b, c14Enter distance between c, a;28Enter GMR value.01417Inductive 1.234781e+000 HCapacitance 9.148627e-003 FInductive reactance 3.879179e+002 Ohm/kmCapactive reactance 3.479319e-001 Ohm/km
-
7/28/2019 Program and Output
9/38
FORMATION OF Y-BUS ADMITTANCE MATRIX
clear all;clc;n=input('enter the no of buses');
for i=1:nfor j=1:nfprintf('enter the impedance value between %d & %dis',i,j);z(i,j)=input('=');y(i,j)=1/z(i,j);
endendzyYB(n,n)=0;for i=1:n
for j=1:nif i==jfor k=1:n
YB(i,j)=YB(i,j)+y(i,k);end
elseYB(i,j)=-y(i,j);
endend
enddisp('Bus Admittance Matrix is::');
YB
-
7/28/2019 Program and Output
10/38
-
7/28/2019 Program and Output
11/38
-
7/28/2019 Program and Output
12/38
OUTPUT
two area system caseenter the rated capacity of unit 1 1500enter the operating unit load 1 750
normal frequency 50speed regulation droop unit1 3enter the rated capacity of unit 2 1500enter the operating unit load 2 750speed regulation droop unit1 3change in demand on unit1 30change in demand on unit2 0
generator output at station1 is -15change in frequency=-1.477833e-0.002operating frequency=4.998522e001
-
7/28/2019 Program and Output
13/38
UNIT COMMITMENT
clc;clear all;n=input(Enter the number of units:);
for i=1:nfor j=1:nn(i,j)=input(Enter the heat rate characteristics value:);
endendfor i=1:nipgmin(i)=input(Enter the minimum generating limit:);pgmax(i)=input(Enter the maximum generating limit:);fuelcost(i)=input(Enter the fuel cost:);end
pd=input(Enter the load demand:);for i=1:nfor j=1:n
f(i,j)=h(i,j)*fuelcost(i);end
endf for i=1:n
prodcost(i)=((F(i,1)*pgmax(i)^2)+(f(I,2)*pgmax(i)+f(i,3));endprodcost
for i=1:navg prodcost(i)=prodcost(i)/pgmax(i);endavg prodcostsortlist=sort(avg prodcost)for i=1:n
for j=1:nif sortlist(i)==avg prodcost(j)k(i)=j;
endend
endkm=n;for i=1:n
maxprodlist(i)=sum(pgmax(k(1:m)));m=m-1;
endmaxprodlist
-
7/28/2019 Program and Output
14/38
z=n;for i=1:n
if pd>max prodlist(z)z=z-1;
end
enddisp(The units committed to satisfy the demand are:);k(1:z)
-
7/28/2019 Program and Output
15/38
OUTPUT:
Enter the num of units: 3Enter the heat rate char value: 0.006Enter the heat rate char value: 7
Enter the heat rate char value: 600Enter the heat rate char value: 0.01Enter the heat rate char value: 8Enter the heat rate char value: 400Enter the heat rate char value: 0.008Enter the heat rate char value: 6Enter the heat rate char value: 500
i=1Enter the minimum generating limit: 100Enter the maximum generating limit: 400
Enter the fuel cost: 1.1
i=2Enter the minimum generating limit: 50Enter the maximum generating limit: 300Enter the fuel cost: 1.2
i=3Enter the minimum generating limit: 150Enter the maximum generating limit: 500Enter the fuel cost: 1.0Enter the fuel demand: 800
f= 0.0066 7.7000 660.00000.0120 9.6000 480.00000.0080 6.0000 500.0000
prodcost= 1.0e+0.03*4.7960 4.4400 5.500
avg prodcost= 11.9900 14.8000 11.0000
Sortlist = 11.0000 11.9900 14.80000
k= 3 1 2max prodlist = 1200 900 500
The unit committed to satisfy the demand are
ans 3 1
-
7/28/2019 Program and Output
16/38
ECONOMIC LOAD DISPATCH
clc;clear all;n= input (Enter the number of units:);
pd= input (Enter the load demand:);for i=1:na(i)= input(Enter the coefficient of Pgi^2:);b(i)= input (Enter the coefficient of Pgi:);c(i)= input(Enter the constant coefficient :);pgmax(i)= input (Enter the maximum generating limit:);pgmin(i)= input (Enter the minimum generating limit:);endx=0; y=0;for i= 1:n
x= x+(b(i)/(2*a(i)));
y=y+(1/(2*a(i)));endlambda= (pd+x)/y;for i=1:npg(i)= (lambda-b(i))/(2*a(i));endpgk(n)=0;for i=1:n
if (pg(i)pgmax(i))k(i)=1;pg(i)=pg max(i);
endendkfor j=1:n
pd= pd-k(j)* pg(j);endpd
x1=0; y1=0;for i=1:nif(1~=k(i))x1= x1+(b(i)/2*a(i)));y1= y1+(1/(2*a(i)));endendlambda new=(pd+x1)/y1;
-
7/28/2019 Program and Output
17/38
for i=1:nif (1~= k(i))pg(i)= (lambda new-b(i))/(2*a(i));endend
fprinf(The economic dispatch values:);pg
-
7/28/2019 Program and Output
18/38
OUTPUT
Enter the number of units: 3Enter the load demand 1100i=1
Enter the coefficient of Pgi^2: 0.0085Enter the coefficient of Pgi= 7.5Enter the constant coefficient: 700.2Enter the max generating limit: 600Enter the min generating limit: 250i=2Enter the coefficient of Pgi^2: 0.009Enter the coefficient of Pgi= 9.4Enter the constant coefficient: 850Enter the max generating limit: 300Enter the min generating limit: 100
i=3Enter the coefficient of Pgi^2: 0.015Enter the coefficient of Pgi= 7.5Enter the constant coefficient: 600Enter the max generating limit: 750Enter the min generating limit: 150
Pg = 480.0885 347.8614 272.0501
K= 0 1 0
Pd = 800
The economic dispatch value:Pg = 510.6383 300.0000 289.3617
-
7/28/2019 Program and Output
19/38
GAUSS SEIDEL
clear all;clc;n=input('num of buses');
alpha=input('enter the acceleration factor alpha');for i=1:nfor j=1:n
fprintf('enter the admittance between %d & %d',i,j);y(i,j)=input('=');
endendYB(n,n)=0;for i=1:n
for j=1:nif i==j
for k=1:nYB(i,j)=YB(i,j)+y(i,k);end
elseYB(i,j)=-y(i,j);
endend
endfor i=1:n
Bus=ia(i)=input('enter the slackbus:0,loadbus=1,gen.bus=-1');
v(i)=input('enter the voltage');th(i)=input('enter the theta value');p(i)=input('enter the real power');q(i)=input('enter the reactive power');if a(i)==-1
d(i)=v(i);ql(i)=input('enter the lower limit');qu(i)=input('enter the upper limit');
endendfor m=1:5
iter=mfor i=1:nv(i)=v(i)*complex(cos(th(i)),sin(th(i)));vl(i)=v(i);
endfor i=1:n
if a(i)==-1b=0;
-
7/28/2019 Program and Output
20/38
c=0;for j=1:i-1
b=b+YB(i,j)*v(j);endfor j=1:n
c=c+YB(i,j)+v(j);endq(i)=-imag(v(i)*(b+c));if q(i)qu(i)q(i)=qu(i);a(i)=1;
endfprintf('reactive power value of bus %d is %d',i,q(i))
endendfor i=2:n
b=0;c=0;for j=1:i-1
b=b+YB(i,j)*v(j);endfor j=i+1:n
c=c+YB(i,j)*v(j);endv(i)=((complex(p(i),-q(i))/v(i)-b-c))/YB(i,i);if a(i)==-1
v(i)=d(i)*complex(cos(th(i)),sin(th(i)));endv(i)=vl(i)+alpha*(v(i)-vl(i));th(i)=angle(v(i));
endfor i=1:n
if a(i)==-1v(i)=d(i);
elsev(i)=abs(v(i));
endendvth*180/piend
-
7/28/2019 Program and Output
21/38
OUTPUT:
num of buses 4enter the acceleration factor alpha 1.6enter the admittance between 1 & 1= 0
enter the admittance between 1 & 2= 2-8jenter the admittance between 1 & 3= 1-4jenter the admittance between 1 & 4= 0enter the admittance between 2 & 1= 2-8jenter the admittance between 2 & 2=0enter the admittance between 2 & 3=0.66-2.664jenter the admittance between 2 & 4=1-4jenter the admittance between 3 & 1=1-4jenter the admittance between 3 & 2=0.66-2.664jenter the admittance between 3 & 3=0enter the admittance between 3 & 4=2-8j
enter the admittance between 4 & 1=0enter the admittance between 4 & 2=1-4jenter the admittance between 4 & 3=2-8jenter the admittance between 4 & 4=0
Bus = 1
enter the slackbus:0,loadbus=1,gen.bus=-1 0enter the voltage 1.06enter the theta value 0enter the real power 0
enter the reactive power 0
Bus =2
enter the slackbus:0,loadbus=1,gen.bus=-1 1enter the voltage 1enter the theta value 0enter the real power -0.5enter the reactive power -0.2
Bus =3
enter the slackbus:0,loadbus=1,gen.bus=-1 1enter the voltage 1enter the theta value 0enter the real power -0.4enter the reactive power -0.3
-
7/28/2019 Program and Output
22/38
Bus =4
enter the slackbus:0,loadbus=1,gen.bus=-1 1enter the voltage 1enter the theta value 0
enter the real power -0.3enter the reactive power -0.1
iter = 1v =
1.0600 1.0201 0.9917 0.9842theta =
0 -2.5964 -2.7059 -6.3638
-
7/28/2019 Program and Output
23/38
NEWTON RAPHSON
clear all;clc;n=input('Enter the number of buses');
for i=1:nfor j=1:n
y(i,j)=input('Enter the admittance value:');end
endYB (n,n)=0;for i=1:n
for j=1:nif i==j
for k=1:nYB(i,j)= YB (i,j)+y(i,k);
endelse
YB (i,j)=-y(i,j);end
endendmag(1)=1.05;for i=2:n
mag(i)=1;endth(1:n)=0;
for i=1:nacp(i)=input('enter real power value:');
endfor i=1:n
acq(i)=input('enter reactive power value:');endmy=abs(YB);an=angle(YB);g=real(YB);b=imag(YB);YBmagth
acpacqPp(n)=0;Qq(n)=0;for i=2:n
for j=1:nPp(i)=Pp(i)+mag(i)*my(i,j)*mag(j)*cos(an(i,j)-th(i)+th(j));Qq(i)=Qq(i)-mag(i)*my(i,j)*mag(j)*sin(an(i,j)-th(i)+th(j));
end
-
7/28/2019 Program and Output
24/38
endPpQqfor i=2:n
for j=2:n
if i~=jj1(i,j)=mag(i)*mag(j)*(g(i,j)*sin(th(i)-th(j))-b(i,j)*cos(th(i)-th(j)));j3(i,j)=-mag(i)*mag(j)*(g(i,j)*cos(th(i)-th(j))+b(i,j)*sin(th(i)-th(j)));j2(i,j)=-j3(i,j);j4(i,j)=j1(i,j);
elsej1(i,j)=-Qq(i)-b(i,j)*(mag(i)^2);j2(i,j)=Pp(i)+g(i,j)*(mag(i)^2);j3(i,j)=Pp(i)-g(i,j)*(mag(i)^2);j4(i,j)=Qq(i)-b(i,j)*(mag(i)^2);
end
endend ja1(1:n-1,1:n-1)=j1(2:n,2:n); ja2(1:n-1,1:n-1)=j2(2:n,2:n); ja3(1:n-1,1:n-1)=j3(2:n,2:n); ja4(1:n-1,1:n-1)=j4(2:n,2:n); jacob=[ja1 ja2;ja3 ja4]delp(1:n-1)=acp(2:n)-Pp(2:n);delq(1:n-1)=acq(2)-Qq(2);Char=inv(jacob)*[delp delq]';Chth(2:n)=Char(1:n-1);Chmag(2:n)=Char(n:2*n-2);mag=mag+Chmag;th=th+Chth;fprintf('the voltage values for buses');magfprintf('The angle values for buses');th
-
7/28/2019 Program and Output
25/38
OUTPUT
Enter the number of buses 4Enter the admittance value:0Enter the admittance value:2-8j
Enter the admittance value:1-4jEnter the admittance value:0Enter the admittance value:2-8jEnter the admittance value:0Enter the admittance value:0.66-2.664jEnter the admittance value:1-4jEnter the admittance value:1-4jEnter the admittance value:0.66-2.664jEnter the admittance value:0Enter the admittance value:2-8jEnter the admittance value:0
Enter the admittance value:1-4jEnter the admittance value:2-8jEnter the admittance value:0enter real power value:0enter real power value:-0.5enter real power value:-0.4enter real power value:-0.3enter reactive power value:0enter reactive power value:-0.2enter reactive power value:-0.3enter reactive power value:-0.1
YB =
3.0000 -12.0000i -2.0000 + 8.0000i -1.0000 + 4.0000i 0-2.0000 + 8.0000i 3.6600 -14.6640i -0.6600 + 2.6640i -1.0000 + 4.0000i-1.0000 + 4.0000i -0.6600 + 2.6640i 3.6600 -14.6640i -2.0000 + 8.0000i
0 -1.0000 + 4.0000i -2.0000 + 8.0000i 3.0000 -12.0000i
jacob =
15.0640 -2.6640 -4.0000 3.5600 -0.6600 -1.0000-2.6640 14.8640 -8.0000 -0.6600 3.6100 -2.0000-4.0000 -8.0000 12.0000 -1.0000 -2.0000 3.0000-3.7600 0.6600 1.0000 14.2640 -2.6640 -4.00000.6600 -3.7100 2.0000 -2.6640 14.4640 -8.00001.0000 2.0000 -3.0000 -4.0000 -8.0000 12.0000
-
7/28/2019 Program and Output
26/38
the voltage values for busesmag =
1.0500 1.0245 1.0345 1.0410
The angle values for buses
th = 0 -0.0806 -0.1076 -0.1261
th*180/pi
ans =
0 -4.6199 -6.1674 -7.2244
-
7/28/2019 Program and Output
27/38
FAST DECOUPLED
clear all;clc;n=input('enter the number of buses:');
for i=1:nfor j=1:ny(i,j)=input('Enter the admittance value:');
endendYB (n,n)=0;for i=1:n
for j=1:nif i==j
for k=1:nYB (i,j)= YB (i,j)+y(i,k);
endelseYB (i,j)= -y(i,j);
endend
endth(n)=0;for i=1:n
Bus=imag(i)=input('Enter the voltage value:');acp(i)=input('Enter real power value:');
acq(i)=input('Enter reactive power');end j=1;for i=1:n
if(mag(i)==1)k(j)=i;j=j+1;
endendmy=abs(YB);an=angle(YB);g=real(YB);b=imag(YB);YB
magthacpacqChmag(n)=0;Chth(n)=0;Pp(n)=0;Qq(n)=0;for i=1:n
for j=1:nPp(i)=Pp(i)+mag(i)*my(i,j)*mag(j)*cos(an(i,j)-th(i)+th(j));
-
7/28/2019 Program and Output
28/38
Qq(i)=Qq(i)-mag(i)*my(i,j)*mag(j)*sin(an(i,j)-th(i)+th(j));endPpQq
end
for i=2:nfor j=2:nif i~=j
j1(i,j)=mag(i)*mag(j)*(g(i,j)*sin(th(i)-th(j))-b(i,j)*cos(th(i)-th(j)));j3(i,j)=0;j2(i,j)=0;j4(i,j)=j1(i,j);
elsej1(i,j)=-Qq(i)-b(i,j)*(mag(i)^2);j2(i,j)=0;j3(i,j)=0;
j4(i,j)=Qq(i)-b(i,j)*(mag(i)^2);endend
end ja1(1:n-1,1:n-1)=j1(2:n,2:n); ja2(1:n-1,1:n-1)=j2(2:n,2:n); ja3(1:n-1,1:n-1)=j3(2:n,2:n); ja4(1:n-1,1:n-1)=j4(2:n,2:n); jacob=[ja1 ja2;ja3 ja4]bb(1:n-1, 1:n-1)=b(2:n,2:n)for i=2:n
j=1;if(i==k(j))
bbb(j,:)=b(i,i);j=j+1;
endendbbbdelp(2:n)=acp(2:n)-Pp(2:n)delq(2:n)=acq(2:n)-Qq(2:n)for i=2:n
x(i)=delp(i)/abs(mag(i));y(i)=delq(i)/abs(mag(i));
endChth(2:n)=-inv(bb)*x(2:n)';for i=2:n
j=1;if(i==k(j))
Chmag(i)=-inv(bbb)*y(i)';end
-
7/28/2019 Program and Output
29/38
endmag=mag+Chmag;th=th+Chth;fprintf('the voltage value for buses');mag
fprintf('the angle values for buses');th
-
7/28/2019 Program and Output
30/38
OUTPUT
enter the number of buses:4Enter the admittance value:0Enter the admittance value:2-8j
Enter the admittance value:1-4jEnter the admittance value:0Enter the admittance value:2-8jEnter the admittance value:0Enter the admittance value:0.66-2.664jEnter the admittance value:1-4jEnter the admittance value:1-4jEnter the admittance value:0.66-2.664jEnter the admittance value:0Enter the admittance value:2-8jEnter the admittance value:0
Enter the admittance value:1-4jEnter the admittance value:2-8jEnter the admittance value:0
Bus =1
Enter the voltage value:1.06Enter real power value:0Enter reactive power0
Bus =
2Enter the voltage value:1Enter real power value:-0.5Enter reactive power-0.2
Bus =3
Enter the voltage value:1Enter real power value:-0.4Enter reactive power-0.3
Bus =4Enter the voltage value:1Enter real power value:-0.3Enter reactive power-0.1
-
7/28/2019 Program and Output
31/38
YB =3.0000 -12.0000i -2.0000 + 8.0000i -1.0000 + 4.0000i 0
-2.0000 + 8.0000i 3.6600 -14.6640i -0.6600 + 2.6640i -1.0000 + 4.0000i-1.0000 + 4.0000i -0.6600 + 2.6640i 3.6600 -14.6640i -2.0000 + 8.0000i
0 -1.0000 + 4.0000i -2.0000 + 8.0000i 3.0000 -12.0000i
jacob =
15.1440 -2.6640 -4.0000 0 0 0-2.6640 14.9040 -8.0000 0 0 0-4.0000 -8.0000 12.0000 0 0 0
0 0 0 14.1840 -2.6640 -4.00000 0 0 -2.6640 14.4240 -8.00000 0 0 -4.0000 -8.0000 12.0000
the voltage value for buses
mag =
1.0600 1.0191 1.0000 1.0000
the angle values for busesth =
0 -0.0767 -0.1017 -0.1183
-
7/28/2019 Program and Output
32/38
SHORT CIRCUIT FAULT
clc;clear all;g1=[.2j .2j .04j .5j];
g2=g1;t1=[.08j .08j .08j 0];t2=t1;l1=[.15j .15j .5j];l2=l1;v=1;sysv=20;bmva=100;a0=(l1(1)*l2(1))/(l1(1)+l2(1));a1=(l1(3)*l2(3))/(l1(3)+l2(3));b=3*g1(4)+g1(3);
z0=((t1(3)+b+a1+t2(3))*b)/(t1(3)+b+a1+t2(3)+b);z1=((g1(1)+t1(1)+a0+t2(1))*g2(1))/(g1(1)+t1(1)+a0+t2(1)+g2(1));z2=z1;A=menu('enter the type of fault','symmetrical fault','L-G fault','L-L fault','L-L-G fault');ib=bmva/(sqrt(3)*sysv);a=1*cosd(120)+1*sind(120)*j;if A==1
ifpu=v/z1;ifa1=ifpu*ib;
elseif A==2ia1=v/(z0+z1+z2);
ifpu=3*ia1;ifa1=ifpu*ib;elseif A==3
ia1=v/(z1+z2);ia2=-ia1;ib0=(a*a*ia1)+(a*ia2);ifa1=abs(ib0)*ib;
elseif A==4z=(z0*z2)/(z0+z2);ia1=v/(z+z1);ia2=(-v/z2)+((ia1*z1)/z2);
ia0=-(ia1+ia2);ib1=ia0+(a*a*ia1)+(a*ia2);ic1=ia0+(a*ia1)+(a*a*ia2);ifpu=ib1+ic1;ifa1=ifpu*ib;
endifa1=abs(ifa1);fmva=sqrt(3)*sysv*ifa1;
-
7/28/2019 Program and Output
33/38
fprintf('fault current %d KA\n',ifa1);fprintf('fault MVA is %d MVA \n',fmva);
-
7/28/2019 Program and Output
34/38
OUTPUT
enter the type of fault
symmetrical fault
fault current 2.106997e+001 KAfault MVA is 7.298851e+002 MVA
L-G faultfault current 7.633716e+000 KAfault MVA is 2.644397e+002 MVA
L-L faultfault current 1.824713e+001 KA
fault MVA is 6.320990e+002 MVA
L-L-G faultfault current 4.661251e+000 KAfault MVA is 1.614705e+002 MVA
-
7/28/2019 Program and Output
35/38
TRANSIENT STABILITY ANALYSIS OF SMIB
clc;clear all;pm=input('generator output power in pu MW:');
E=input('generator emf in pu v:');v=input('infinite bus bar voltage in pu V:');x1=input('reactance before fault in pu x1:');x2=input('reactance during fault in pu x2:');x3=input('reactance after fault is cleared in pu x3:');pe1max=E*v/x1;pe2max=E*v/x2;pe3max=E*v/x3;delta=0:0.01:pi;pe1=pe1max*sin(delta);pe2=pe2max*sin(delta);
pe3=pe3max*sin(delta);d0=asin(pm/pe1max);dmax=pi-asin(pm/pe3max);cosdc=(pm*(dmax-d0)+pe3max*cos(dmax)-pe2max*cos(d0))/(pe3max-pe2max);if abs(cosdc)>1
fprintf('No critical clearing could be found\n');fprintf('system can remain stable during this disturbance \n\n');return
elseenddc=acos(cosdc);
if dc>dmaxfprintf('No critical clearing could be found\n');
fprintf('system can remain stable during this disturbance \n\n');return
elseendd0=d0*180/pi;dmax=dmax*180/pi;dc=dc*180/pi;if x2==inf
fprintf('For this case tc can be found from analytical formula\n');
H=input('To find tc enter Inertia constant H,(or 0 to skip)H:');if H~=0d0r=d0*pi/180;dcr=dc*pi/180;tc=sqrt(2*H*(dcr-d0r)/(pi*60*pm));
elseend
else
-
7/28/2019 Program and Output
36/38
endfprintf('\n Initial power angle=%7.3f\n',d0);fprintf('\n maximum angle swing=%7.3f\n',dmax);fprintf('\n Critical clearing angle=%7.3f\n\n',dc);if x2==inf&H~=0
fprintf('\n Critical clearing time=%7.3fsec \n\n',tc);elseendpmx=[0 pi-d0]*180/pi;pmy=[pm pm];x0=[d0 d0]*180/pi;y0=[0 pm];xc=[dc dc]*180/pi;yc=[0 pe3max*sin(dmax)];xm=[dmax dmax]*180/pi;ym=[0 pe3max*sin(dmax)];
x=(d0:0.1:dc);y=pe2max*sin(x*pi/180);y1=pe2max*sin(d0*pi/180);y2=pe2max*sin(d0*pi/180);x=[d0 x dc];y=[pm y pm];xx=dc:0.1:dmax;h=pe3max*sin(xx*pi/180);xx=[dc xx dmax];hh=[pm h pm];delta=delta*180/pi;h=figure;figure(h);fill(x,y,'m')hold;fill(xx,hh,'c')plot(delta,pe1,'-',delta,pe2,'r-',delta,pe3,'g-',pmx,pmy,'b-',x0,y0,xc,yc,xm,ym),gridTitle('Application of equal area criterion to a critically cleared system')xlabel('Power angle,degree'),ylabel('Power,perunit')text(5,1.07*pm,'pm')text(50,1.05*pe1max,['Critical clearing angle=',num2str(dc)])axis([0 180 0 1.1*pe1max])hold off;
-
7/28/2019 Program and Output
37/38
OUTPUT
(A)
generator output power in pu MW: 0.8
generator emf in pu v:1.17infinite bus bar voltage in pu V:1reactance before fault in pu x1:0.65reactance during fault in pu x2:inf reactance after fault is cleared in pu x3:0.65For this case tc can be found from analytical formulaTo find tc enter Inertia constant H,(or 0 to skip)H:5
Initial power angle= 26.388maximum angle swing=153.612Critical clearing angle= 84.775
Critical clearing time= 0.260secCurrent plot held
-
7/28/2019 Program and Output
38/38
(B)
generator output power in pu MW: 0.8generator emf in pu v:1.17infinite bus bar voltage in pu V:1
reactance before fault in pu x1:0.65reactance during fault in pu x2:1.8reactance after fault is cleared in pu x3:0.8
Initial power angle= 26.388maximum angle swing=146.838Critical clearing angle= 98.834
Current plot held