All 'Calculation of Inductance and Capacitance of 1 Phase Line' 'Enter Diameter in CM:'

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

(a) CALCULATION OF INDUCTANCE AND CAPACITANCE OF SINGLE PHASE LINE

PROGRAM:

clc;
clear ​all​;

disp(​'CALCULATION OF INDUCTANCE AND CAPACITANCE OF 1 PHASE LINE'​);


d=input(​'Enter diameter in cm:'​);
r=d/2;
rad=r*10^(-2);

D=input(​'Enter distance between conductors in​ ​m:'​);


r1=rad*0.7788;
L=4*10^(-7)*log(D/r1);
C=(pi*8.854*10^(-12))/(log(D/rad));

disp(​'INDUCTANCE(in H/m):'​);
disp(L);
disp(​'CAPACITANCE(in F/m):'​);
disp(C);

OUTPUT:

CALCULATION OF INDUCTANCE AND CAPACITANCE OF 1 PHASE LINE

Enter diameter in cm: 1.5

Enter distance between conductors in m: 3.5

INDUCTANCE (in H/m): 2.5582e-006

CAPACITANCE (in F/m): 4.5261e-012


(b) CALCULATION OF INDUCTANCE AND CAPACITANCE OF THREE PHASE
SYMMETRIC LINE

PROGRAM:

clc;

clear ​all​;

disp(​'CALCULATION OF INDUCTANCE AND CAPACITANCE OF 3 PHASE


SYMMETRIC​ ​LINE'​);

d=input(​'Enter diameter in cm:'​);


r=d/2;
rad=r*10^(-2);

D=input(​'Enter distance between conductors in


m:'​); r1=rad*0.7788; L=2*10^(-

7)*log(D/r1); C=(2*pi*8.854*10^(-
12))/(log(D/rad));
disp(​'INDUCTANCE(in H/m):'​);
disp(L);
disp(​'CAPACITANCE(in F/m):'​);
disp(C);

OUTPUT:

CALCULATION OF INDUCTANCE AND CAPACITANCE OF 3 PHASE SYMMETRIC LINE

Enter diameter in cm: 1.2

Enter distance between conductors in m: 1.5

INDUCTANCE (in H/m): 1.1543e-006

CAPACITANCE (in F/m): 1.0075e-011


(c) CALCULATION OF INDUCTANCE AND CAPACITANCE OF THREE PHASE
UNSYMMETRIC TRANSPOSED LINE

PROGRAM:

clc;

clear ​all​;
disp(​'CALCULATION OF INDUCTANCE AND CAPACITANCE OF 3 PHASE
UNSYMMETRIC LINE - TRANSPOSED'​);
d=input(​'Enter diameter in cm:'​);
r=d/2;
rad=r*10^(-2);
Dab=input(​'Enter distance between conductors A & B in m:'​);
Dbc=input(​'Enter distance between conductors B & C in m:'​);

Dca=input(​'Enter distance between conductors C & A in m:'​);


f=input(​'Enter Frequency'​);

Deq=(Dab*Dbc*Dca)^(1/3);
r1=rad*0.7788;

L=2*10^(-7)*log(Deq/r1);
C=(2*pi*8.854*10^(-12))/(log(Deq/rad));
disp(​'INDUCTANCE(in H/m):'​);
disp(L);
disp(​'CAPACITANCE(in F/m):'​);
disp(C);
XL=2*pi*f*L;
XC=1/(2*pi*f*C);

disp(​'INDUCTIVER REACTANCE(in ohm/m):'​);


disp(XL);
disp(​'CAPACITIVE REACTANCE(in ohm/m):'​);

disp(XC);
OUTPUT:

CALCULATION OF INDUCTANCE AND CAPACITANCE OF 3 PHASE UNSYMMETRIC


LINE - TRANSPOSED

Enter diameter in cm: 2.5

Enter distance between conductors A & B in m: 5

Enter distance between conductors B & C in m: 4

Enter distance between conductors C & A in m: 3

Enter Frequency50

INDUCTANCE (in H/m):

1.1994e-006

CAPACITANCE (in F/m):

9.6804e-012

INDUCTIVER REACTANCE (in ohm/m):

3.7679e-004

CAPACITIVE REACTANCE (in ohm/m):


3.2882e+008

(d) PROGRAM:

clc;
clear ​all​;
disp(​'CALCULATION OF INDUCTANCE AND CAPACITANCE'​);

D=input(​'Enter the diameter'​);

Dab=input(​'Dab='​);

Dbc=input(​'Dbc='​);
Dca=input(​'Dca='​);
d=input(​'Enter the spacing'​);
r=d/2;
GMD=[Dab*Dbc*Dca]^(1/3);
disp(GMD);

GMR=(D*d^3)^(1/4);
GMR1=1.09*GMR;
disp(GMR1);
C=0.0556/log(GMD/GMR);
L=0.2*log(GMD/GMR);
disp(​'INDUCTANCE VALUE IN HENRY'​);
disp(L);

disp(​'CAPACITANCE VALUE IN FARAD'​);

disp(C);
OUTPUT:

CALCULATION OF INDUCTANCE AND CAPACITANCE


Enter the diameter.03625
Dab=11
Dbc=11

Dca=22
Enter the spacing0.045
13.8591
0.0465

INDUCTANCE VALUE IN HENRY 1.1568

CAPACITANCE VALUE IN FARAD 0.0096

SHORT TRANSMISSION LINE

PROGRAM:

clc;
clear ​all​;
R=input(​'Resistance :'​);
XL=input(​'Inductive Reactance :'​);
XC=input(​'Capacitive Reactance :'​);
G=input(​'Conductance :'​);
length=input(​'Length of Transmission Line :'​);
f=input(​'Frequency :'​);
Z1= (R+j*XL)*length;
Y1= (G+j*XC)*length;
A = 1;
B = Z1;
C = 0;
D
=1;
TM = [ A B; C D ];
VRL=input(​'ENTER RECEIVEING END VOLTAGE :'​);
VRP=VRL/(sqrt(3));
PR = input(​'ENTER RECEIVING END LOAD IN MW :'​);
Pf=input(​'ENTER THE RECEIVING END LOAD POWER FACTOR :'​);
h=acos(Pf);
SR=PR/Pf;
SR=SR*(cos(h)+j*sin(h));
QR=imag(SR);
IR=conj(SR)/(3*conj(VRP));
SM=TM*[VRP;IR];
VS=SM(1,1);
IS=SM(2,1);
Pfs=cos(angle(VS)-angle(IS));
SS=3*VS*conj(IS);
VSA=angle(VS)*(180/pi);
ISA=angle(IS)*(180/pi);
VS=sqrt(3)*abs(VS);
IS=abs(IS)*1000;
VREG=((VS/(abs(TM(1,1)))-VRL)/VRL)*100;
PS= real(SS);
QS= imag(SS);
eff=PR/PS*100;
PL=PS-PR;
QL=QS-QR;
Z1 Y1
TM
fprintf(​'SENDING END LINE VOLTAGE %g at %g degrees \n'​,VS,VSA);

fprintf(​'SENDING END LINE CURRENT %g at %g degrees \n'​,IS,ISA);


fprintf(​'SENDING END POWER FACTOR %g\n'​,Pfs);
fprintf(​'SENDING END REAL POWER %g\n'​,PS);
fprintf(​'SENDING END REACTIVE POWER %g\n'​,QS);
fprintf(​'PERCENTAGE VOLTAGE REGULATION %g\n'​,VREG);
fprintf(​'REAL POWER LOSS %g\n'​,PL);
fprintf(​'REACTIVE POWER LOSS %g\n'​,QL);
fprintf(​'EFFICIENCY %G'​, eff);

OUTPUT:

Resistance : 1.5
Inductive Reactance :4
Capacitive Reactance :0
Conductance :0
Length of Transmission Line :1
Frequency : 50
ENTER RECEIVEING END VOLTAGE : 11
ENTER RECEIVING END LOAD IN MW :4
ENTER THE RECEIVING END LOAD POWER FACTOR : 0.8

Z1 =
1.5000 + 4.0000i
Y1 =
0
TM =

1.0000 1.5000 + 4.0000i


0 1.0000

SENDING END LINE VOLTAGE 12.6795 at 4.72953 degrees


SENDING END LINE CURRENT 262.432 at -36.8699 degrees
SENDING END POWER FACTOR 0.747805

SENDING END REAL POWER 4.30992


SENDING END REACTIVE POWER 3.82645
PERCENTAGE VOLTAGE REGULATION 15.2685

REAL POWER LOSS 0.309917


REACTIVE POWER LOSS 0.826446

EFFICIENCY 92.8092

MEDIUM TRANSMISSION LINE

PROGRAM:

clc;
clear ​all​;

R=input(​'Resistance :'​);
XL=input(​'Inductive Reactance :'​);
XC=input(​'Capacitive Reactance :'​);
G=input(​'Conductance :'​);
length=input(​'Length of Transmission Line :'​);
f=input(​'Frequency :'​);

Z1= (R+j*XL)*length;

Y1= (G+j*XC)*length;

m=menu(​'ENTER THE TYPE OF NETWORK'​,​'NOMINAL T'​, ​'NOMINAL


PI'​); ​switch ​m
case ​{1}

A = 1+(Z1*Y1/2);
B=Z1*(1+(Z1*Y1/4));
C=Y1;
D=A;
otherwise
A = 1+(Z1*Y1/2);
B=Z1;

C=Y1*(1+(Z1*Y1/4));
D=A;
end
TM = [ A B; C D ];
VRL=input(​'ENTER RECEIVEING END VOLTAGE :'​);
VRP=VRL/(sqrt(3));
PR = input(​'ENTER RECEIVING END LOAD IN MW :'​);
Pf=input(​'ENTER THE RECEIVING END LOAD POWER FACTOR :'​);
h=acos(Pf);
SR=PR/Pf;
SR=SR*(cos(h)+j*sin(h));
QR=imag(SR);
IR=conj(SR)/(3*conj(VRP));
SM=TM*[VRP;IR];
VS=SM(1,1);
IS=SM(2,1);
Pfs=cos(angle(VS)-angle(IS));
SS=3*VS*conj(IS);
VSA=angle(VS)*(180/pi);
ISA=angle(IS)*(180/pi);

VS=sqrt(3)*abs(VS);
IS=abs(IS)*1000;

VREG=((VS/(abs(TM(1,1)))-VRL)/VRL)*100;
PS=real(SS);
QS=imag(SS);
eff=PR/PS*100;
PL=PS-PR;
QL=QS-QR;
Z1
Y1
TM

fprintf(​'SENDING END LINE VOLTAGE %g at %g degrees \n'​,VS,VSA);


fprintf(​'SENDING END LINE CURRENT %g at %g degrees \n'​,IS,ISA);
fprintf(​'SENDING END POWER FACTOR %g\n'​,Pfs);
fprintf(​'SENDING END REAL POWER %g\n'​,PS);
fprintf(​'SENDING END REACTIVE POWER %g\n'​,QS);
fprintf(​'PERCENTAGE VOLTAGE REGULATION %g\n'​,VREG);
fprintf(​'REAL POWER LOSS %g\n'​,PL);
fprintf(​'REACTIVE POWER LOSS %g\n'​,QL);

fprintf(​'EFFICIENCY %G'​, eff);

NOMINAL T

OUTPUT:

Resistance : 20
Inductive Reactance : 52
Capacitive Reactance : 315*10^(-6)
Conductance :0
Length of Transmission Line :1
Frequency : 50
ENTER RECEIVEING END VOLTAGE : 132
ENTER RECEIVING END LOAD IN MW : 30

ENTER THE RECEIVING END LOAD POWER FACTOR : 0.85


Z1 =

20.0000 +52.0000i
Y1 =
1 +3.1500e-004i
TM =
0.9918 + 0.0031i 19.8362 +51.8186i
1 + 0.0003i 0.9918 + 0.0031i

SENDING END LINE VOLTAGE 143.035 at 3.76761 degrees


SENDING END LINE CURRENT 142.007 at -23.3284
degrees SENDING END POWER FACTOR 0.890244

SENDING END REAL POWER 31.3199 SENDING


END REACTIVE POWER 16.0245 PERCENTAGE
VOLTAGE REGULATION 9.25407 REAL POWER
LOSS 1.31989

REACTIVE POWER LOSS -2.56785


EFFICIENCY 95.7858
FORMATION OF Y-BUS BY THE METHOD OF INSPECTION

PROGRAM:

clc;

clear ​all​;
n=input(​'Enter number of buses'​);
l=input(​'Number of lines'​);
s=input(​'1.Impedance or 2:Admittance'​);
ybus=zeros(n,n);
lc=zeros(n,n);

for ​i=1:l

a=input(​'Starting bus:'​);

b=input(​'Ending bus:'​);

t=input(​'Admittance or Impedance of
line:'​); lca=input(​'Line charging
admittance:'​); ​if​(s==1)

y(a,b)=1/t;

else
y(a,b)=t;

end

y(b,a)=y(a,b);
lc(a,b)=lca;
lc(b,a)=lc(a,b);
end

for ​i=1:n
for ​j=1:n
if ​i==j

for ​k=1:n

ybus(i,j)=ybus(i,j)+y(i,k)+lc(i,k)/2;

end
else
ybus(i,j)=-y(i,j);
end

ybus(j,i)=ybus(i,j);

end

end
ybus

OUTPUT:

Enter number of buses4

Number of lines5

1. Impedance or

2:Admittance1 Starting bus: 1

Ending bus: 2

Admittance or Impedance of line: 0.1+0.4i

Line charging admittance: 0.015i

Starting bus: 2

Ending bus: 3

Admittance or Impedance of line: 0.15+0.6i

Line charging admittance: 0.02i

Starting bus: 3

Ending bus: 4
Admittance or Impedance of line: 0.18+0.55i

Line charging admittance: 0.018i

Starting bus: 4

Ending bus: 1

Admittance or Impedance of line: 0.1+0.35i

Line charging admittance: 0.012i

Starting bus: 4

Ending bus: 2

Admittance or Impedance of line: 0.25+0.2i

Line charging admittance: 0.03i

ybus
1.3430 - 4.9810i -0.5882 + 2.3529i 0 -0.7547 + 2.6415i

-0.5882 + 2.3529i 3.4194 - 5.8403i -0.3922 + 1.5686i -2.4390 + 1.9512i

0 -0.3922 + 1.5686i 0.9296 - 3.1919i -0.5375 + 1.6423i

-0.7547 + 2.6415i -2.4390 + 1.9512i -0.5375 + 1.6423i 3.7312 - 6.2050i

LOAD FLOW ANALYSIS BY GAUSS –​SEIDAL METHOD

PROGRAM
clc;
clear all;
n=input ('no of buses');

l=input ('no of lines');


s=input ('impedance 1 or admittance 2');
for i=1:l
a=input ('starting bus');
b=input ('ending bus');
t=input ('admittance or impedance value');
if s==1
y(a,b)=1/t;

else
y(a,b)=t;
end
y(b,a)=y(a,b);
end
ybus=zeros(n,n);
for i=1:n
for j=1:n
if i==j
for k=1:n
ybus(i,j)=ybus(i,j)+y(i,k);

end

else
ybus(i,j)=-y(i,j);
end
ybus(j,i)=ybus(i,j);
end
end

ybus
p=zeros(1,n);
q=zeros(1,n);
v=zeros(1,n);
pv=input ('no of pv buses');
pq=input('no of pq buses');
s=input ('slack bus number');
v(s)=input ('slack bus voltage');
acc=input ('accleration factor');
for i=1:pv
b(i)=input('pv bus number');

p(b(i))=input('real power');
v(b(i))=input ('voltage value');
qmin(b(i))=input ('min value of q');
qmax(b(i))=input ('max value of q');
end
for i=1:pq
c(i)=input('pq bus number');
p(c(i))=input('real power');
p(c(i))=-p(c(i));
q(c(i))=input ('reactive power');

q(c(i))=-q(c(i));
v(c(i))=1+0i;
end
e=v;
e
enew(s)=v(s);
it=0;
yy=zeros(1,n);

for ii=1:n
ypq(ii)=0;

if ii~=s
flag=0;
gen=0;
for j=1:pv
if ii==b(j)
flag=1;
end
end
if flag==1
for k=1:n
yy(ii)=yy(ii)+ybus(ii,k)*v(k);
end
qcal(ii)=-imag(conj(v(ii))*yy(ii));
if qcal(ii)<qmin(ii)
qcal(ii)=qmin(ii);
elseif qcal(ii)>qmax(ii)
qcal(ii)=qmax(ii);
else
qcal(ii)=qcal(ii);
gen=1;
end
else
qcal(ii)=q(ii);

end
qcal(ii)=qcal(ii)*sqrt(-1);
for k=1:n

if k~=ii
ypq(ii)=ypq(ii)+ybus(ii,k)*e(k);
end
end
enew(ii)=(((p(ii)-qcal(ii))/conj(e(ii)))-ypq(ii))/ybus(ii,ii);
dele(ii)=enew(ii)-e(ii);
enew(ii)=e(ii)+acc*dele(ii);

if gen==1 ang=angle(enew(ii));
enew(ii)=v(ii)*cos(ang)+v(ii)*sin(ang)*sqrt(-1);
end
e(ii)=enew(ii);
end

end
disp('voltages');
enew

OUTPUT:

no of buses4
no of lines5
impedance 1 or admittance 22

starting bus1
ending bus2
admittance or impedance value2-8i
starting bus1

ending bus3
admittance or impedance value1-4i
starting bus2
ending bus3
admittance or impedance value0.666-2.664i
starting bus2
ending bus4
admittance or impedance value1-4i
starting bus3
ending bus4
admittance or impedance value2-8i

ybus =

3.0000 -12.0000i -2.0000 + 8.0000i -1.0000 + 4.0000i 0


-2.0000 + 8.0000i 3.6660 -14.6640i -0.6660 + 2.6640i-1.0000 + 4.0000i
-1.0000 + 4.0000i -0.6660 + 2.6640i 3.6660 -14.6640i-2.0000 + 8.0000i
0 -1.0000 + 4.0000i -2.0000 + 8.0000i 3.0000 -12.0000i

no of pv buses0 no
of pq buses3 slack
bus number1
slack bus voltage1.06
accleration factor1
pq bus number2
real power0.5
reactive power0.2
pq bus number3
real power0.4
reactive power0.3
pq bus number4
real power0.3
reactive power0.1

e=

1.0600 1.0000 1.0000 1.0000

voltages

enew =

1.0600 1.0119 - 0.0289i 0.9929 - 0.0261i 0.9855 - 0.0486i

LOAD FLOW ANALYSIS BY NEWTON - RAPHSON METHOD


PROGRAM:

clc;
basemva=100;
accuracy=0.001;
accel=1.8;
maxiter=100;
busdata=[1 1 1.04 0 0 0 0 0 0 0 0
2 0 1 0 0.5 1 0 0 0 0 0
3 2 1.04 0 0 0 1.5 0.6 0 0 0 ];
linedata=[ 1 2 0.02 0.080.01 1
1 3 0.02 0.08 0.01 1
2 3 0.02 0.08 0.01 1];
lfybus
lfnewton
busout
lineflow

lfybus

j=sqrt(-1); i = sqrt(-1);

nl = linedata(:,1); nr = linedata(:,2); R =
linedata(:,3); X = linedata(:,4); Bc =
j*linedata(:,5); a = linedata(:, 6);
nbr=length(linedata(:,1)); nbus = max(max(nl),
max(nr));
Z = R + j*X; y= ones(nbr,1)./Z; %branch admittance
for ​n = 1:nbr
if ​a(n) <= 0 a(n) = 1; ​else end

Ybus=zeros(nbus,nbus); % initialize Ybus to zero


% formation of the off diagonal elements

for ​k=1:nbr;

Ybus(nl(k),nr(k))=Ybus(nl(k),nr(k))-y(k)/a(k);

Ybus(nr(k),nl(k))=Ybus(nl(k),nr(k));
end

end
% formation of the diagonal elements

for n=1:nbus
for ​k=1:nbr
if ​nl(k)==n

Ybus(n,n) = Ybus(n,n)+y(k)/(a(k)^2) +
Bc(k); ​elseif ​nr(k)==n
Ybus(n,n) = Ybus(n,n)+y(k) +Bc(k);
else​,​ end

end
end
clear ​Pgg
lfnewton

ns=0; ng=0; Vm=0; delta=0; yload=0;


deltad=0; nbus =

length(busdata(:,1));
for ​k=1:nbus

n=busdata(k,1);

kb(n)=busdata(k,2); Vm(n)=busdata(k,3); delta(n)=busdata(k, 4);


Pd(n)=busdata(k,5); Qd(n)=busdata(k,6); Pg(n)=busdata(k,7); Qg(n)
= busdata(k,8); Qmin(n)=busdata(k, 9); Qmax(n)=busdata(k, 10);
Qsh(n)=busdata(k, 11);

if ​Vm(n) <= 0 Vm(n) = 1.0; V(n) = 1 +


j*0;​ else ​delta(n) =
pi/180*delta(n);

V(n) = Vm(n)*(cos(delta(n)) +
j*sin(delta(n)));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n)+ Qsh(n))/basemva;

S(n) = P(n) + j*Q(n);

end
end

for ​k=1:nbus

if ​kb(k) == 1, ns = ns+1;​ else​,​ end

if ​kb(k) == 2 ng = ng+1;​ else​,​ end


ngs(k) = ng;
nss(k) = ns;

end
Ym=abs(Ybus); t = angle(Ybus);

m=2*nbus-ng-2*ns;
maxerror = 1; converge=1;

iter = 0;

% Start of
iterations ​clear
A DC J DX
​ axerror >= accuracy & iter <= maxiter​ ​% Test for max.
while m
power mismatch​ for ​i=1:m

for ​k=1:m
A(i,k)=0; %Initializing Jacobian matrix
end​,​ end

iter = iter+1;
for ​n=1:nbus
nn=n-nss(n);
lm=nbus+n-ngs(n)-nss(n)-ns;
J11=0; J22=0; J33=0; J44=0;

for ​i=1:nbr
if ​nl(i) == n | nr(i) == n

if ​nl(i) == n, l = nr(i); ​end

if ​nr(i) == n, l = nl(i); ​end

J11=J11+ Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n) +


delta(l)); J33=J33+ Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)-
delta(n) + delta(l)); ​if ​kb(n)~=1

J22=J22+ Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n) +


delta(l)); J44=J44+ Vm(l)*Ym(n,l)*sin(t(n,l)-
delta(n) + delta(l)); ​else​,​ end
if ​kb(n) ~= 1 & kb(l) ~=1

lk = nbus+l-ngs(l)-nss(l)-ns;
ll = l -nss(l);

% off diagonalelements of J1

A(nn, ll) =-Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n)


+ delta(l)); ​if ​kb(l) == 0​ ​% off diagonal
elements of J2
A(nn, lk) =Vm(n)*Ym(n,l)*cos(t(n,l)- delta(n) + delta(l));​end
if ​kb(n) == 0​ ​% off diagonal elements of J3

A(lm, ll) =-Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n)+delta(l));


end
if ​kb(n) == 0 & kb(l) == 0 % off diagonal elements of
J4
A(lm, lk) =-Vm(n)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));​end

else end

else ​,​ end


end
Pk = Vm(n)^2*Ym(n,n)*cos(t(n,n))+J33;

Qk = -Vm(n)^2*Ym(n,n)*sin(t(n,n))-J11;

if ​kb(n) == 1 P(n)=Pk; Q(n) = Qk;​ end % Swing bus P

​ b(n) == 2
if k Q(n)=Qk;
if Q​ max(n) ~= 0

Qgc = Q(n)*basemva + Qd(n) - Qsh(n);


if ​iter <= 7 % Between the 2th & 6th
iterations

​ ter > 2 % the Mvar of generator buses are


if i
if Q​ gc < Qmin(n), % tested. If not within limits
Vm(n)
Vm(n) = Vm(n) + 0.01; % is changed in steps of 0.01 pu
to
elseif ​Qgc > Qmax(n), % bring the generator Mvar within
Vm(n) = Vm(n) - 0.01;​end​ ​% the specified limits.
else​,​ end

else​,​end
else​,​end

end
if ​kb(n) ~= 1

A(nn,nn) = J11; %​ diagonal elements of


J1​ DC(nn) = P(n)-Pk;
end

if ​kb(n) == 0
A(nn,lm) = 2*Vm(n)*Ym(n,n)*cos(t(n,n))+J22; ​%diagonal elements of
J2

A(lm,nn)= J33; %diagonal elements of J3

A(lm,lm) =-2*Vm(n)*Ym(n,n)*sin(t(n,n))-J44; ​%diagonal of


elements of J4​ DC(lm) = Q(n)-Qk;

end
end

DX=A\DC';

for ​n=1:nbus
nn=n-nss(n);

lm=nbus+n-ngs(n)-nss(n)-ns;
if ​kb(n) ~= 1

delta(n) = delta(n)+DX(nn); ​end


if ​kb(n) == 0
Vm(n)=Vm(n)+DX(lm); ​end

end

maxerror=max(abs(DC));

if ​iter == maxiter & maxerror > accuracy

fprintf(​'\nWARNING: Iterative solution did not converged after '​)


fprintf(​'%g'​, iter), fprintf(​' iterations.\n\n'​)

fprintf(​'Press Enter to terminate the iterations and print the


results \n'​) converge = 0; pause, ​else​, ​end
end

if c​ onverge ~= 1​ ​tech= (​'​ tech=(​'ITERATIVE SOLUTION DID NOT


CONVERGE'​);​ ​else​,​ Power Flow Solution by Newton-Raphson
Method'​);
end

V =
Vm.*cos(delta)+j*Vm.*sin(delt
a); deltad=180/pi*delta;

i=sqrt(-
1); k=0;

for ​n = 1:nbus

if ​kb(n) == 1
k=k+1;

S(n)= P(n)+j*Q(n);
Pg(n) = P(n)*basemva + Pd(n);

Qg(n) = Q(n)*basemva + Qd(n) -


Qsh(n); Pgg(k)=Pg(n);

Qgg(k)=Qg(n);
elseif ​kb(n)
==2​ ​k=k+1;
S(n)=P(n)+j*Q
(n);

Qg(n) = Q(n)*basemva + Qd(n) -


Qsh(n); Pgg(k)=Pg(n);

Qgg(k)=Qg(n);
end
yload(n) = (Pd(n)- j*Qd(n)+j*Qsh(n))/(basemva*Vm(n)^2);

end
busdata(:,3)=Vm'; busdata(:,4)=deltad';

Pgt = sum(Pg); Qgt = sum(Qg); Pdt = sum(Pd); Qdt = sum(Qd); Qsht


= sum(Qsh);

busout

disp(tech)
fprintf(​'Maximum Power Mismatch = %g \n'​, maxerror)

fprintf(​'No. of Iterations = %g \n\n'​, iter)


head =[​'Bus Voltage Angle ------Load---------Generation---
Injected''No. Mag. Degree​ ​MW Mva MW​ ​Mvar Mvar'''​];

disp(head)

for ​n=1:nbus

fprintf(​' %5g'​, n), fprintf(​' %7.3f'​, Vm(n)),

fprintf(​' %8.3f'​, deltad(n)), fprintf(​' %9.3f'​,


Pd(n)), fprintf(​' %9.3f'​, Qd(n)), fprintf(​'
%9.3f'​, Pg(n)), fprintf(​' %9.3f '​, Qg(n)),
fprintf(​' %8.3f\n'​, Qsh(n))
end
fprintf(​' \n'​), fprintf(​' Total '​)
fprintf(​' %9.3f'​, Pdt), fprintf(​' %9.3f'​, Qdt),
fprintf(​' %9.3f'​, Pgt), fprintf(​' %9.3f'​, Qgt), fprintf(​'
%9.3f\n\n'​, Qsht)

lineflow

SLT = 0;
fprintf(​'\n'​)
fprintf(​'Line Flow and Losses \n\n'​)
fprintf(​' --Line--Power at bus & line flow --Line
loss-- Transformer\n'​)
fprintf(​' from to MW Mvar MVA MW Mvar tap\n'​)

for ​n = 1:nbus
busprt = 0;

for ​L = 1:nbr;
if ​busprt == 0
fprintf(​' \n'​), fprintf(​'%6g'​, n), fprintf(​' %9.3f'​,
P(n)*basemva)

fprintf(​'%9.3f'​, Q(n)*basemva), fprintf(​'%9.3f\n'​,


abs(S(n)*basemva))

busprt = 1;
else​,​ end
if ​nl(L)==n k = nr(L);

In = (V(n) - a(L)*V(k))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(n);


Ik = (V(k) - V(n)/a(L))*y(L) + Bc(L)*V(k);
Snk = V(n)*conj(In)*basemva;

Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;

elseif ​nr(L)==n k = nl(L);


In = (V(n) - V(k)/a(L))*y(L) + Bc(L)*V(n);

Ik = (V(k) - a(L)*V(n))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(k);


Snk = V(n)*conj(In)*basemva;

Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;

else​,​ end
if ​nl(L)==n | nr(L)==n

fprintf(​'%12g'​, k),

fprintf(​'%9.3f'​, real(Snk)), fprintf(​'%9.3f'​, imag(Snk))


fprintf(​'%9.3f'​, abs(Snk)),

fprintf(​'%9.3f'​, real(SL)),

if ​nl(L) ==n & a(L) ~= 1

fprintf(​'%9.3f'​, imag(SL)), fprintf(​'%9.3f\n'​, a(L))

else​, fprintf(​'%9.3f\n'​, imag(SL))


end

else​,​ end

end
end
SLT = SLT/2;

fprintf(​' \n'​), fprintf(​' Total loss '​)

fprintf(​'%9.3f'​, real(SLT)), fprintf(​'%9.3f\n'​, imag(SLT))


clear ​Ik In SL SLT Skn Snk

ITERATIVE SOLUTION DID NOT CONVERGE'​);​ ​else​,​ Power Flow


Solution by Newton-Raphson Method'​);

OUTPUT:

Power Flow Solution by Newton-Raphson Method

Maximum Power Mismatch = 6.82452e-005


No. of Iterations = 3

Bus Voltage Angle ------Load---------Generation--- Injected


No. Mag. Degree MW MvarMW Mvar Mvar

1 1.040 0.000 0.000 0.000 -1.002 -2.436 0.000


2 1.040 0.002 0.500 1.000 0.000 0.000 0.000
3 1.040 0.038 0.000 0.000 1.500 -3.061 0.000

Total 0.500 1.000 0.498 -5.497 0.000

Line Flow and Losses

--Line-- Power at bus & line flow --Line loss-- Transformer


from to MW Mvar MVA MW Mvar tap

1 -1.002 -2.436 2.634


2 -0.167 -1.560 1.568 0.000 -2.164
3 -0.833 -0.873 1.207 0.000 -2.163

2 -0.500 -1.000 1.118


1 0.167 -0.604 0.627 0.000 -2.164
3 -0.667 -0.396 0.775 0.000 -2.163

3 1.500 -3.061 3.409


1 0.833 -1.290 1.535 0.000 -2.163
2 0.667 -1.768 1.889 0.000 -2.163

Total loss 0.000 -6.490


SHORT CIRCUIT ANALYSIS

OUTPUT:

Enter Faulted Bus No. -> 3

Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = j*0.1

Balanced three-phase fault at bus No. 3

Total fault current = 3.1250 per unit

Bus Voltages during fault in per unit

Bus Voltage Angle

No. Magnitude degrees

1 0.5938 0.0000

2 0.6250 0.0000

3 0.3125 0.0000

Line currents for fault at bus No. 3

From To Current Angle

Bus Bus Magnitude degrees

G 1 1.6250 -90.0000

1 3 1.8750 -90.0000

G 2 1.5000 -90.0000

2 1 0.2500 -90.0000

2 3 1.2500 -90.0000

3 F 3.1250 -90.0000

Another fault location? Enter 'y' or 'n' within single quote ​-> 'n'

Line-to-ground fault analysis

Enter Faulted Bus No. -> 3


Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = j*0.1

Single line to-ground fault at bus No. 3

Total fault current = 2.7523 per unit

Bus Voltages during the fault in per unit

Bus -------Voltage Magnitude-------

No. Phase a Phase b Phase c

1 0.6330 1.0046 1.0046

2 0.7202 0.9757 0.9757

3 0.2752 1.0647 1.0647

Line currents for fault at bus No. 3

From To -----Line Current Magnitude----

Bus Bus Phase a Phase b Phase c


1 3 1.6514 0.0000 0.0000

2 1 0.3761 0.1560 0.1560

2 3 1.1009 0.0000 0.0000

3 F 2.7523 0.0000 0.0000

Another fault location? Enter 'y' or 'n' within single quote -> 'n'

Line-to-line fault analysis

Enter Faulted Bus No. -> 3

Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf =

j*0.1 Line-to-line fault at bus No. 3

Total fault current = 3.2075 per unit

Bus Voltages during the fault in per unit

Bus -------Voltage Magnitude-------


No. Phase a Phase b Phase c

1 1.0000 0.6720 0.6720

2 1.0000 0.6939 0.6939

3 1.0000 0.5251 0.5251

Line currents for fault at bus No. 3

From To -----Line Current Magnitude----

Bus Bus Phase a Phase b Phase c

1 3 0.0000 1.9245 1.9245

2 1 0.0000 0.2566 0.2566

2 3 0.0000 1.2830 1.2830

3 F 0.0000 3.2075 3.2075

Another fault location? Enter 'y' or 'n' within single quote -> 'n'

Double line-to-ground fault analysis


Enter Faulted Bus No. -> 3

Enter Fault Impedance Zf = R + j*X in complex form (for bolted fault enter 0). Zf = j*0.1

Double line-to-ground fault at bus No. 3

Total fault current = 1.9737 per unit

Bus Voltages during the fault in per unit

Bus -------Voltage Magnitude-------

No. Phase a Phase b Phase c

1 1.0066 0.5088 0.5088

2 0.9638 0.5740 0.5740

3 1.0855 0.1974 0.1974

Line currents for fault at bus No. 3

From To -----Line Current Magnitude----

Bus Bus Phase a Phase b Phase c


1 3 0.0000 2.4350 2.4350

2 1 0.1118 0.3682 0.3682

2 3 0.0000 1.6233 1.6233

3 F 0.0000 4.0583 4.0583

Another fault location? Enter 'y' or 'n' within single quote -> 'n'
TRANSIENT AND SMALL SIGNAL STABILITY ANALYSIS – SINGLE

MACHINE INFINITE BUS SYSTEM

PROGRAM :

a)Pm = 0.8; E = 1.17; V = 1.0;

X1 = 0.65; X2 = inf; X3 =

0.65; eacfault(Pm, E, V, X1,

X2, X3)

b) Pm = 0.8; E = 1.17; V =

1.0; X1 = 0.65; X2 = 1.8; X3

= 0.8; eacfault(Pm, E, V, X1,

X2, X3)

eacfault

function ​eacfault(Pm, E, V, X1, X2, X3)

if ​exist(​'Pm'​)~=1

Pm = input(​'Generator output power in p.u. Pm =


'​); ​else​, ​end​ ​if ​exist(​'E'​)~=1

E = input(​'Generator e.m.f. in p.u. E


= '​); ​else​, ​end​ ​if ​exist(​'V'​)~=1

V = input(​'Infinite bus-bar voltage in p.u. V =


'​); ​else​, e
​ nd​ ​if ​exist(​'X1'​)~=1

X1 = input(​'Reactance before Fault in p.u. X1 =


'​); ​else​, ​end​ ​if ​exist(​'X2'​)~=1

​ lse​, e
X2 = input(​'Reactance during Fault in p.u. X2 = '​); e ​ nd
if ​exist(​'X3'​)~=1
X3 = input(​'Reactance aftere Fault in p.u. X3 = '​); e​ lse​, e​ nd
Pe1max = E*V/X1; Pe2max=E*V/X2;
Pe3max=E*V/X3; delta = 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 angle could be found.\n'​)

fprintf(​'system can remain stable during this


disturbance.\n\n'​) ​return

else​,
end
dc=acos(co
sdc);

if ​dc > dmax


fprintf(​'No critical clearing angle could be found.\n'​)

fprintf(​'System can remain stable during this


disturbance.\n\n'​) ​return

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(dc)]; xm=[dmax dmax]*180/pi; ym=[0
Pe3max*sin(dmax)];

d0=d0*180/pi; dmax=dmax*180/pi;
dc=dc*180/pi; x=(d0:.1:dc);
y=Pe2max*sin(x*pi/180);

y1=Pe2max*sin(d0*pi/180);

y2=Pe2max*sin(dc*pi/180);
x=[d0 x dc];
y=[Pm y Pm];

xx=dc:.1:dmax;
h=Pe3max*sin(xx*pi/180);
xx=[dc xx dmax];
hh=[Pm hPm];

delta=delta*180/pi;
if ​X2 == inf

fprintf(​'\nFor 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 ~= 0

d0r=d0*pi/180; dcr=dc*pi/180;
tc = sqrt(2*H*(dcr-d0r)/(pi*60*Pm));
else​,​ end

else​,​ end
%clc

fprintf(​'\nInitial power angle = %7.3f \n'​, d0)

fprintf(​'Maximum angle swing = %7.3f \n'​, dmax)


fprintf(​'Critical clearing angle = %7.3f \n\n'​, dc)
if ​X2==inf & H~=0
fprintf(​'Critical clearing time = %7.3f sec. \n\n'​, tc)
else​,​ end

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, per unit'​)

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) 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 time = 0.260 sec.

b) Initial power angle = 26.388


Maximum angle swing = 146.838

Critical clearing angle = 98.834


Small signal stability of SMIB system

PROGRAM:
E=1.35; V=1.0; H=9.94; X=0.65; Pm=0.6; D=0.138;
f0=60; Pmax=E*V/X, d0=asin(Pm/Pmax)
Ps=Pmax*cos(d0)

wn=sqrt(pi*60/H*Ps)

z=D/2*sqrt(pi*60/(H*Ps))

wd=wn*sqrt(1-z^2),fd=wd/(2*pi)

tau=1/(z*wn)

th=acos(z)

Dd0=10*pi/180;

t=0:.01:3;

Dd=Dd0/sqrt(1-z^2)*exp(-z*wn*t).*sin(wd*t+th);

d=(d0+Dd)*180/pi;

Dw=-wn*Dd0/sqrt(1-z^2)*exp(-z*wn*t).*sin(wd*t);

f=f0+Dw/(2*pi);

subplot(2,1,1),plot(t,d),grid

xlabel(​'t sec'​),ylabel(​'Delta degree'​)

subplot(2,1,2),plot(t,f),grid

xlabel(​'t sec'​),ylabel(​'frquency hertz'​)

subplot(111)
OUTPUT:
Pmax = 2.0769

d0 = 0.2931

Ps = 1.9884

wn = 6.1405

z = 0.2131

wd = 5.9995

fd = 0.9549

tau = 0.7643

th = 1.3561
LOAD –​FREQUENCY DYNAMICS OF SINGLE- AREA AND TWO-

AREA POWER SYSTEMS


FOR SINGLE AREA SYSTEMS

PROGRAM:

clear ​all​;
clc;

rac=input(​'Enter the value of Related


Area​ ​capcity:'​); nol=input(​'Enter the
value of nominal operating load:'​);
f=input(​'Enter the value of frequency:'​);
cil=input(​'Enter the value of change in
load:'​);
dpd=input(​'Enter the value of deviation in load in
percentage:'​); df=input(​'Enter the value of deviation in
frequency in percentage:'​);
r=input(​'Enter the value of regulation in Hz/pu MW:'​);
H=input(​'Enter the value of Inertia Time constant:'​);
D=((dpd*(nol))/(df*f));

Dpu=(D/rac);

Kp=(1/Dpu);
Tp=((2*H)/(f*Dpu));
delpd=cil/rac;
if ​r~= inf

B=(Dpu+(1/r));

else

B=(Dpu);
end

Fs=-(delpd/B);

disp(​'The static gain of the power system in


Hz/pu MW'​ ); Kp

disp(​'The Time constant of the power system in


seconds'​); Tp
disp(​'Steady state frequency deviation
in Hz'​); Fs

OUTPUT:

Enter the value of Related Area capcity:2000

Enter the value of nominal operating load:1000


Enter the value of frequency:50

Enter the value of change in load:20


Enter the value of deviation in load in percentage:1
Enter the value of deviation in frequency in percentage:1
Enter the value of regulation in Hz/pu MW:2
Enter the value of Inertia Time constant:5
The static gain of the power system in Hz/pu MW
Kp = 100
The Time constant of teh power system in seconds
Tp = 20
Steady state frequency deviation in Hz

Fs = -0.0196

OUTPUT:

Enter the value of Related Area capcity:2000

Enter the value of nominal operating load:1000


Enter the value of frequency:50

Enter the value of change in load:20


Enter the value of deviation in load in percentage:1
Enter the value of deviation in frequency in percentage:1
Enter the value of regulation in Hz/pu MW: inf
Enter the value of Inertia Time constant:5

The static gain of the power system in Hz/pu MW


Kp = 100

The Time constant of teh power system in seconds


Tp = 20
Steady state frequency deviation in Hz

Fs = -1

WITH GAIN
WITHOUT GAIN
FOR TWO AREA SYSTEMS

PROGRAM:

clear ​all​;
clc;
rac1=input(​'Enter the value of Related area capacity-1 in MW:'​);

cil1=input(​'Enter the value of change in load-1 in MW:'​);


D1=input(​'Enter the value of damping coefficient-1 in pu:'​);
r1=input(​'Enter teh value of regulation-1 in pu:'​);
rac2=input(​'Enter the value of Related area capacity-2 in MW:'​);
cil2=input(​'Enter the value of change in load-2 in MW:'​);
D2=input(​'Enter the value of damping coefficient-2 in pu:'​);
r2=input(​'Enter teh value of regulation-2 in pu:'​);

f0=input(​'Enter the value of frequency:'​);


B1=(D1+(1/r1));
B1=B1/f0;
B2=(D1+(1/r2));
B2=B2/f0;
delpd1=cil1/rac1;
delpd2=cil2/rac2;
a12=-(rac1/rac2);
delf=((a12*delpd1)-delpd2)/(B2-(a12*B1));
f=f0+delf;

delptie=((B1*delpd2)-(B2*delpd1))/(B2-(a12*B1));

delptie=delptie*rac1;
fprintf(​'Steady state frequency deviation is : %g Hz\n'​,delf);
fprintf(​'System frequency :%g Hz\n'​,f);
fprintf(​'Change in tie line flow from area 1 to area 2 :%g
MW\n'​,
delptie);

OUTPUT:

Enter the value of Related area capacity-1 in MW:1000

Enter the value of change in load-1 in MW:200


Enter the value of damping coefficient-1 in pu:0.6

Enter the value of regulation-1 in pu:0.05


Enter the value of Related area capacity-2 in MW:1000
Enter the value of change in load-2 in MW:0
Enter the value of damping coefficient-2 in pu:0.9
Enter teh value of regulation-2 in pu:0.0625
Enter the value of frequency:50
Steady state frequency deviation is : -0.268817 Hz
System frequency :49.7312 Hz
Change in tie line flow from area 1 to area 2 :-89.2473 MW
ECONOMIC DISPATCH IN POWER SYSTEMS

WITHOUT LOSS AND GENERATING LIMITS

PROGRAM:

clc;
clear ​all​;

n=input(​'Enter the number of units:'​);


a=zeros(n);
b=zeros(n);
c=zeros(n);
for ​i=1:n
fprintf(​'Enter the unit %g Data \n'​,i);
a(i)=input(​'Enter the value of a:'​);
b(i)=input(​'Enter the value of b:'​);
c(i)=input(​'Enter the value of c:'​);
end

pd=input(​'Enter the value of load demand:'​);


P=zeros(n);
sum=0; den=0;
for ​i=1:n
sum=sum+(b(i)/(2*a(i)));

end
for ​i=1:n
den=den+(1/(2*a(i)));

end
num=pd+sum;

lamda=num/den;
for ​i=1:n
P(i)=(lamda-b(i))/(2*a(i));

end

for ​i=1:n
fprintf(​'Optimal Generation of unit %g: %g MW\n'​,i,P(i));

end
fprintf(​'Lamda: %g \n'​,lamda);
for ​i=1:n

unitcost=a(i)*P(i)^2+b(i)*P(i)+c(i);
fprintf(​'Generation cost of unit %g : %g\n'​,i,unitcost);

end

totalcost=0;

for ​i=1:n
totalcost=totalcost+a(i)*P(i)^2+b(i)*P(i)+c(i);

end
fprintf(​'Total generation cost : %g\n'​, totalcost);

OUTPUT:
Enter the number of units:3

Enter the unit 1 Data


Enter the value of a:0.004

Enter the value of b:5.3


Enter the value of c:500
Enter the unit 2 Data
Enter the value of a:0.006
Enter the value of b:5.5

Enter the value of c:400


Enter the unit 3 Data
Enter the value of a:0.009

Enter the value of b:5.8


Enter the value of c:200
Enter the value of load demand:975
Optimal Generation of unit 1: 482.895 MW
Optimal Generation of unit 2: 305.263 MW
Optimal Generation of unit 3: 186.842 MW
Lamda: 9.16316
Generation cost of unit 1 : 3992.09
Generation cost of unit 2 : 2638.06
Generation cost of unit 3 : 1597.87

Total generation cost : 8228.03


WITH LOSS AND GENERATING LIMITS

PROGRAM:

clc;
clear ​all​;

n = input(​'Enter the no. of


Units : '​); a = zeros(n);

b =
zeros(n);
c =
zeros(n);
pmin=zeros
(n);
pmax=zeros
(n); p =
zeros(n);

sum
= 0;
den
= 0;

bm = zeros(n,n);

for ​i = 1:n

fprintf(​'Enter the unit %g data


\n'​,i); a(i) = input(​'Enter the
value of a : '​); b(i) =
input(​'Enter the value of b : '​);
c(i) = input(​'Enter the value of
c : '​);
pmin(i)=input(​'Enter the MIN value of Generation : '​);
pmax(i)=input(​'Enter the MAX value of Generation : '​);

end

for ​i = 1:n
for ​j = 1:n
bm(i,j) = input(​'Enter B Coefficient : '​);

end
end

pd = input(​'Enter the value of load


demand : '​); ​for ​i = 1:n

sum = sum +
(b(i)/(2*a(i))); den =
den + (1/(2*a(i)));

end

lambda = (pd +
sum)/den; t = 1;

while ​t >0
fprintf(​'\nLambda is %g\n'​,lambda);

​ =
for i
1:n
p(i)
= 0;

end

pg = 0; pl

= 0; deldde
= 0; nb =
0;
for ​i = 1:n

for ​j = 1:n

if ​i~=j
nb = nb + bm(i,j)*p(j);

end

end
end

for ​i = 1:n
p(i) = (1 - b(i)/lambda - nb)/(2*(a(i)/lambda +
bm(i,i))); fprintf(​'Optimal generation of unit %g
is %g MW\n'​,i,p(i));

end

for ​i = 1:n
for ​j = 1:n
pl = pl + p(i)*bm(i,j)*p(j);
end
end

fprintf(​'Power Loss is %g\n'​, pl);

for ​i=1:n

if ​(p(i)>pmax(i))

p(i) = pmax(i);
elseif ​(p(i)<pmin(i))

p(i) = pmin(i);
else

p(i) = p(i);

end
end

for ​i = 1:n
pg = pg + p(i);

end

delp = pd + pl - pg;
fprintf(​'Change in load is %g\n'​, delp);

for ​i = 1:n
deldde = deldde + (a(i) + b(i)*bm(i,i))/(2*((a(i) +
lambda*bm(i,i))^2));

end

dellambda = delp/deldde;

fprintf(​'Change in Lambda is
%g\n'​,dellambda); lambda = lambda +
dellambda;
if ​delp<1

t = 0;

end
end
OUTPUT:

Enter the no. of Units : 3

Enter the unit 1 data


Enter the value of a : 0.008

Enter the value of b : 7


Enter the value of c : 200
Enter the MIN value of Generation : 10
Enter the MAX value of Generation : 85
Enter the unit 2 data
Enter the value of a : 0.009
Enter the value of b : 6.3
Enter the value of c : 180
Enter the MIN value of Generation : 10
Enter the MAX value of Generation : 80
Enter the unit 3 data
Enter the value of a : 0.007
Enter the value of b : 6.8
Enter the value of c : 140
Enter the MIN value of Generation : 10
Enter the MAX value of Generation : 70
Enter B Coefficient : 0.000218
Enter B Coefficient : 0
Enter B Coefficient : 0
Enter B Coefficient : 0
Enter B Coefficient : 0.000228
Enter B Coefficient : 0
Enter B Coefficient : 0
Enter B Coefficient : 0
Enter B Coefficient : 0.000179
Enter the value of load demand : 150

Lambda is 7.51099
Optimal generation of unit 1 is 26.511 MW
Optimal generation of unit 2 is 56.5225 MW
Optimal generation of unit 3 is 42.6028 MW
Power Loss is 1.20651
Change in load is 25.5702
Change in Lambda is 0.164165

Lambda is 7.67516
Optimal generation of unit 1 is 34.8985 MW
Optimal generation of unit 2 is 63.9613 MW
Optimal generation of unit 3 is 52.2555 MW
Power Loss is 1.68705

Change in load is 0.571665


Change in Lambda is 0.00369649
LOAD FLOW ANALYSIS BY FAST DECOUPLED LOAD FLOW
METHOD

OUTPUT:

Power Flow Solution by Fast Decoupled Method

Maximum Power Mismatch = 0.000278522

No. of Iterations = 7
Bus Voltage Angle ------Load------ ---Generation--- Injected

No. Mag. Degree MW Mvar MW Mvar Mvar

11.040 0.000 0.000 0.000 -0.996 -2.447 0.000

21.040 0.002 0.500 1.000 0.000 0.000 0.000

31.040 0.038 0.000 0.000 1.500 -3.071 0.000

Total 0.500 1.000 0.504 -5.518 0.000

Line Flow and Losses

--Line-- Power at bus & line flow --Line loss-- Transformer

from to MW Mvar MVA MW Mvar tap

1 -0.996 -2.447 2.642

2 -0.163 -1.559 1.567 0.000 -2.164

3 -0.833 -0.873 1.207 0.000 -2.163

2 -0.500 -1.000 1.118


1 0.163 -0.605 0.627 0.000 -2.164

3 -0.670 -0.397 0.779 0.000 -2.163

3 1.500 -3.071 3.418

1 0.833 -1.290 1.535 0.000 -2.163

2 0.670 -1.767 1.890 0.000 -2.163

Total loss 0.000 -6.490


ELECTROMAGNETIC TRANSIENTS IN POWER SYSTEMS
PSCAD MODEL

You might also like