Documente Academic
Documente Profesional
Documente Cultură
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);
OUTPUT
Enter the Distance 2 Enter the Diameter 5.789e-2 Inductive reactance is=5.636653e-001 Ohm/km Capacitive reactance is=4.846921e+005 Ohm/km
OUTPUT
Enter the diameter 5.64e-2 Enter case number 1 Enter distance 2 Inductive Reactance 2.834710e-001 Ohm/km Capacitive Reactance 2.438380e+005 Ohm/km Enter case number 2 Enter distance between a,b 2 Enter distance between b,c 4 Enter distance between c,a 3 Inductive Reactance 3.064803e-001 Ohm/km Capacitive Reactance 2.647914e+005 Ohm/km
OUTPUT
Enter diameter. 037 R= 0.0185 Enter distance between a, b 15 Enter distance between b, c 15 Enter distance between c, a 30 Enter GMR value .015 L= 1.4278 C= 0.0081 Inductive reactance 4.485443e+002 Ohm/km capacitive reactance 3.938564e-001 Ohm/km
OUTPUT
Enter diameter 0.035 R= 0.0175 Enter bundle space.045 enter distance between a, b14 Enter distance between b, c14 Enter distance between c, a;28 Enter GMR value.01417 Inductive 1.234781e+000 H Capacitance 9.148627e-003 F Inductive reactance 3.879179e+002 Ohm/km Capactive reactance 3.479319e-001 Ohm/km
OUTPUT
enter the no of buses 4 enter the impedance value between 1 & 1 is=inf enter the impedance value between 1 & 2 is=.02+.04j enter the impedance value between 1 & 3 is=inf enter the impedance value between 1 & 4 is=.03+.05j enter the impedance value between 2 & 1 is=.02+.04j enter the impedance value between 2 & 2 is=inf enter the impedance value between 2 & 3 is=.01+.005j enter the impedance value between 2 & 4 is=inf enter the impedance value between 3 & 1 is=inf enter the impedance value between 3 & 2 is=.01+.005j enter the impedance value between 3 & 3 is=inf enter the impedance value between 3 & 4 is=.0125+.025j enter the impedance value between 4 & 1 is=.03+.05j enter the impedance value between 4 & 2 is=inf enter the impedance value between 4 & 3 is=.0125+.025j enter the impedance value between 4 & 4 is=inf z= Inf 0.0200 + 0.0400i Inf 0.0300 + 0.0500i y= 0 10.0000 -20.0000i 0 8.8235 -14.7059i 10.0000 -20.0000i 0 80.0000 -40.0000i 0 0 80.0000 -40.0000i 0 0.1995 - 3.9900i 8.8235 -14.7059i 0 16.0000 -32.0000i 0 0.0200 + 0.0400i Inf 0.0100 + 0.0050i Inf Inf 0.0100 + 0.0050i Inf 0.0125 + 0.0250i 0.0300 + 0.0500i Inf 0.0125 + 0.0250i Inf
YB = 18.8235 -34.7059i -10.0000 +20.0000i 0 -8.8235 +14.7059i -10.0000 +20.0000i 90.0000 -60.0000i -80.0000 +40.0000i 0 0 -80.0000 +40.0000i 80.1995 -43.9900i -16.0000 +32.0000i -8.8235 +14.7059i 0 -0.1995 + 3.9900i 24.8235 -46.7059i
OUTPUT two area system case enter the rated capacity of unit 1 1500 enter the operating unit load 1 750 normal frequency 50 speed regulation droop unit1 3 enter the rated capacity of unit 2 1500 enter the operating unit load 2 750 speed regulation droop unit1 3 change in demand on unit1 30 change in demand on unit2 0 generator output at station1 is -15 change in frequency=-1.477833e-0.002 operating frequency=4.998522e001
UNIT COMMITMENT
clc; clear all; n=input(Enter the number of units:); for i=1:n for j=1:n n(i,j)=input(Enter the heat rate characteristics value:); end end for i=1:n i pgmin(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:n for j=1:n f(i,j)=h(i,j)*fuelcost(i); end end f for i=1:n prodcost(i)=((F(i,1)*pgmax(i)^2)+(f(I,2)*pgmax(i)+f(i,3)); end prodcost for i=1:n avg prodcost(i)=prodcost(i)/pgmax(i); end avg prodcost sortlist=sort(avg prodcost) for i=1:n for j=1:n if sortlist(i)==avg prodcost(j) k(i)=j; end end end k m=n; for i=1:n maxprodlist(i)=sum(pgmax(k(1:m))); m=m-1; end maxprodlist
z=n; for i=1:n if pd>max prodlist(z) z=z-1; end end disp(The units committed to satisfy the demand are:); k(1:z)
OUTPUT: Enter the num of units: 3 Enter the heat rate char value: 0.006 Enter the heat rate char value: 7 Enter the heat rate char value: 600 Enter the heat rate char value: 0.01 Enter the heat rate char value: 8 Enter the heat rate char value: 400 Enter the heat rate char value: 0.008 Enter the heat rate char value: 6 Enter the heat rate char value: 500 i=1 Enter the minimum generating limit: 100 Enter the maximum generating limit: 400 Enter the fuel cost: 1.1 i=2 Enter the minimum generating limit: 50 Enter the maximum generating limit: 300 Enter the fuel cost: 1.2 i=3 Enter the minimum generating limit: 150 Enter the maximum generating limit: 500 Enter the fuel cost: 1.0 Enter the fuel demand: 800 f= 0.0066 0.0120 0.0080 7.7000 9.6000 6.0000 660.0000 480.0000 500.0000
11.9900
900
500
for i=1:n if (1~= k(i)) pg(i)= (lambda new-b(i))/(2*a(i)); end end fprinf(The economic dispatch values:); pg
OUTPUT
Enter the number of units: 3 Enter the load demand 1100 i=1 Enter the coefficient of Pgi^2: 0.0085 Enter the coefficient of Pgi= 7.5 Enter the constant coefficient: 700.2 Enter the max generating limit: 600 Enter the min generating limit: 250 i=2 Enter the coefficient of Pgi^2: 0.009 Enter the coefficient of Pgi= 9.4 Enter the constant coefficient: 850 Enter the max generating limit: 300 Enter the min generating limit: 100 i=3 Enter the coefficient of Pgi^2: 0.015 Enter the coefficient of Pgi= 7.5 Enter the constant coefficient: 600 Enter the max generating limit: 750 Enter the min generating limit: 150 Pg = 480.0885 K= 0 Pd = 800 The economic dispatch value: Pg = 510.6383 300.0000 1 0 347.8614 272.0501
289.3617
GAUSS SEIDEL
clear all; clc; n=input('num of buses'); alpha=input('enter the acceleration factor alpha'); for i=1:n for j=1:n fprintf('enter the admittance between %d & %d',i,j); y(i,j)=input('='); end end YB(n,n)=0; for i=1:n for j=1:n if i==j for k=1:n YB(i,j)=YB(i,j)+y(i,k); end else YB(i,j)=-y(i,j); end end end for i=1:n Bus=i a(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'); end end for m=1:5 iter=m for i=1:n v(i)=v(i)*complex(cos(th(i)),sin(th(i))); vl(i)=v(i); end for i=1:n if a(i)==-1 b=0;
c=0; for j=1:i-1 b=b+YB(i,j)*v(j); end for j=1:n c=c+YB(i,j)+v(j); end q(i)=-imag(v(i)*(b+c)); if q(i)<ql(i) q(i)=ql(i); a(i)=1; elseif q(i)>qu(i) q(i)=qu(i); a(i)=1; end fprintf('reactive power value of bus %d is %d',i,q(i)) end end for i=2:n b=0; c=0; for j=1:i-1 b=b+YB(i,j)*v(j); end for j=i+1:n c=c+YB(i,j)*v(j); end v(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))); end v(i)=vl(i)+alpha*(v(i)-vl(i)); th(i)=angle(v(i)); end for i=1:n if a(i)==-1 v(i)=d(i); else v(i)=abs(v(i)); end end v th*180/pi end
OUTPUT:
num of buses 4 enter the acceleration factor alpha 1.6 enter the admittance between 1 & 1= 0 enter the admittance between 1 & 2= 2-8j enter the admittance between 1 & 3= 1-4j enter the admittance between 1 & 4= 0 enter the admittance between 2 & 1= 2-8j enter the admittance between 2 & 2=0 enter the admittance between 2 & 3=0.66-2.664j enter the admittance between 2 & 4=1-4j enter the admittance between 3 & 1=1-4j enter the admittance between 3 & 2=0.66-2.664j enter the admittance between 3 & 3=0 enter the admittance between 3 & 4=2-8j enter the admittance between 4 & 1=0 enter the admittance between 4 & 2=1-4j enter the admittance between 4 & 3=2-8j enter the admittance between 4 & 4=0 Bus = 1 enter the slackbus:0,loadbus=1,gen.bus=-1 0 enter the voltage 1.06 enter the theta value 0 enter the real power 0 enter the reactive power 0 Bus =2 enter the slackbus:0,loadbus=1,gen.bus=-1 1 enter the voltage 1 enter the theta value 0 enter the real power -0.5 enter the reactive power -0.2 Bus =3 enter the slackbus:0,loadbus=1,gen.bus=-1 1 enter the voltage 1 enter the theta value 0 enter the real power -0.4 enter the reactive power -0.3
Bus =4 enter the slackbus:0,loadbus=1,gen.bus=-1 1 enter the voltage 1 enter the theta value 0 enter the real power -0.3 enter the reactive power -0.1 iter = 1 v= 1.0600 1.0201 0.9917 0.9842 theta = 0 -2.5964 -2.7059 -6.3638
NEWTON RAPHSON
clear all; clc; n=input('Enter the number of buses'); for i=1:n for j=1:n y(i,j)=input('Enter the admittance value:'); end end YB (n,n)=0; for i=1:n for j=1:n if i==j for k=1:n YB(i,j)= YB (i,j)+y(i,k); end else YB (i,j)=-y(i,j); end end end mag(1)=1.05; for i=2:n mag(i)=1; end th(1:n)=0; for i=1:n acp(i)=input('enter real power value:'); end for i=1:n acq(i)=input('enter reactive power value:'); end my=abs(YB);an=angle(YB); g=real(YB);b=imag(YB); YB mag th acp acq Pp(n)=0;Qq(n)=0; for i=2:n for j=1:n Pp(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
end Pp Qq for i=2:n for j=2:n if 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)=-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); else j1(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 end 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] 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'); mag fprintf('The angle values for buses'); th
OUTPUT
Enter the number of buses 4 Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:1-4j Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:0 Enter the admittance value:0.66-2.664j Enter the admittance value:1-4j Enter the admittance value:1-4j Enter the admittance value:0.66-2.664j Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:0 Enter the admittance value:1-4j Enter the admittance value:2-8j Enter the admittance value:0 enter real power value:0 enter real power value:-0.5 enter real power value:-0.4 enter real power value:-0.3 enter reactive power value:0 enter reactive power value:-0.2 enter reactive power value:-0.3 enter 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.7600 0.6600 1.0000 -2.6640 14.8640 -8.0000 0.6600 -3.7100 2.0000 -4.0000 -8.0000 12.0000 1.0000 2.0000 -3.0000 3.5600 -0.6600 -1.0000 14.2640 -2.6640 -4.0000 -0.6600 3.6100 -2.0000 -2.6640 14.4640 -8.0000 -1.0000 -2.0000 3.0000 -4.0000 -8.0000 12.0000
the voltage values for buses mag = 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
FAST DECOUPLED
clear all; clc; n=input('enter the number of buses:'); for i=1:n for j=1:n y(i,j)=input('Enter the admittance value:'); end end YB (n,n)=0; for i=1:n for j=1:n if i==j for k=1:n YB (i,j)= YB (i,j)+y(i,k); end else YB (i,j)= -y(i,j); end end end th(n)=0; for i=1:n Bus=i mag(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; end end my=abs(YB);an=angle(YB);g=real(YB);b=imag(YB); YB mag th acp acq Chmag(n)=0;Chth(n)=0;Pp(n)=0;Qq(n)=0; for i=1:n for j=1:n Pp(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 Pp Qq end for i=2:n for j=2:n if 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); else j1(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); end end 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; end end bbb delp(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)); end Chth(2:n)=-inv(bb)*x(2:n)'; for i=2:n j=1; if(i==k(j)) Chmag(i)=-inv(bbb)*y(i)'; end
end mag=mag+Chmag; th=th+Chth; fprintf('the voltage value for buses'); mag fprintf('the angle values for buses'); th
OUTPUT
enter the number of buses:4 Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:1-4j Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:0 Enter the admittance value:0.66-2.664j Enter the admittance value:1-4j Enter the admittance value:1-4j Enter the admittance value:0.66-2.664j Enter the admittance value:0 Enter the admittance value:2-8j Enter the admittance value:0 Enter the admittance value:1-4j Enter the admittance value:2-8j Enter the admittance value:0 Bus = 1 Enter the voltage value:1.06 Enter real power value:0 Enter reactive power0 Bus = 2 Enter the voltage value:1 Enter real power value:-0.5 Enter reactive power-0.2 Bus = 3 Enter the voltage value:1 Enter real power value:-0.4 Enter reactive power-0.3 Bus = 4 Enter the voltage value:1 Enter real power value:-0.3 Enter reactive power-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.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.0000 0 0 0 -2.6640 14.4240 -8.0000 0 0 0 -4.0000 -8.0000 12.0000
the voltage value for buses mag = 1.0600 1.0191 1.0000 1.0000
OUTPUT
enter the type of fault symmetrical fault fault current 2.106997e+001 KA fault MVA is 7.298851e+002 MVA
end fprintf('\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); else end pmx=[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),grid Title('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;
OUTPUT
(A) generator output power in pu MW: 0.8 generator emf in pu v:1.17 infinite bus bar voltage in pu V:1 reactance before fault in pu x1:0.65 reactance during fault in pu x2:inf reactance after fault is cleared in pu x3:0.65 For this case tc can be found from analytical formula To find tc enter Inertia constant H,(or 0 to skip)H:5 Initial power angle= 26.388 maximum angle swing=153.612 Critical clearing angle= 84.775 Critical clearing time= 0.260sec Current plot held
(B) generator output power in pu MW: 0.8 generator emf in pu v:1.17 infinite bus bar voltage in pu V:1 reactance before fault in pu x1:0.65 reactance during fault in pu x2:1.8 reactance after fault is cleared in pu x3:0.8 Initial power angle= 26.388 maximum angle swing=146.838 Critical clearing angle= 98.834 Current plot held