0% found this document useful (0 votes)
122 views36 pages

Program:: '/N Medium Line T Network')

The program calculates the Y-bus matrix for a power system network using the singular transformation method. It first defines the network data such as bus connections, line impedances and shunt admittances. It then forms the node-branch incidence matrix A and the diagonal impedance matrix Zpr. The inverse of Zpr gives the branch admittance matrix Ypr. The Y-bus matrix is then calculated as A' * Ypr * A. The program shows an example calculation of the Y-bus matrix for a 5-bus system without mutual coupling between lines. It provides the expected result of the Y-bus matrix for verification.
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)
122 views36 pages

Program:: '/N Medium Line T Network')

The program calculates the Y-bus matrix for a power system network using the singular transformation method. It first defines the network data such as bus connections, line impedances and shunt admittances. It then forms the node-branch incidence matrix A and the diagonal impedance matrix Zpr. The inverse of Zpr gives the branch admittance matrix Ypr. The Y-bus matrix is then calculated as A' * Ypr * A. The program shows an example calculation of the Y-bus matrix for a 5-bus system without mutual coupling between lines. It provides the expected result of the Y-bus matrix for verification.
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/ 36

PROGRAM:

%program to calculate ABCD parameters for T network for Medium


line
clear all

length=140
Z=(0.2+0.408i)*length;
Y=(0+3.14e-6i)*length;

fprintf('\n Medium line T network');

fprintf('A B C D parameter for medium line T network');


A=1+((Y*Z)/2)
B=Z*(1+((Y*Z)/4))
C=Y
D=A

check=(A*D)-(B*C)

k2=input('\n enter 1- to read Vr, Ir and compute Vs, Is\n 2-


to read Vs, Is and compute Vr, Ir'); switch k2,

case 1
vr=input('enter Vr/phase=');
ir=input('enter ir/phase=');
vr=vr*1e3/sqrt(3);
vs=(A*vr+B*ir)/1e3;
is=C*vr+D*ir;
fprintf('\n Sending end voltage/ph=%f%+fi KV',
real(vs),imag(vs));
fprintf('\n Sending end current/ph=%f%+fi Amp',
real(is),imag(is));
vs=vs*1e3;
case 2,
vs=input('enter Vs/phase=');
is=input('enter is/phase=');
vs=vs*1e3/sqrt(3.0);
vr=(D*vs-B*is)/1e3;
ir=-C*vs+D*is;
fprintf('\n Receiving end voltage/ph=%f%+fi KV',
real(vr),imag(vr));
fprintf('\n Receiving end current/ph=%f%+fi Amp',
real(ir),imag(ir));
vr=vr*1e3;

2
Exp: 1 Date: / /

ABCD PARAMETERS FOR T NETWORK.

AIM: i) Formation for symmetric  configuration.


ii) Verification of AD-BC = 1.
iii) Determination of Efficiency & regulation.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

Note 1:

1. For short line, length=40


2. For medium line, length=140

Note 2:

1. “short transmission network”


fprintf('A B C D parameter for short transmission line');
A=1
B=Z
C=0
D=1

2. fprintf('A B C D parameter for medium line PI network');


A=1+((Y*Z)/2)
B=Z
C=Y*(1+((Y*Z)/4))
D=A

3
otherwise
disp('wrong choice');
end
rec_pow=3*real(vr*conj(ir))/1e6;
send_pow=3*real(vs*conj(is))/1e6;
eff=rec_pow/send_pow*100;
reg=(abs(vs)/abs(A)-abs(vr))/abs(vr)*100;
fprintf('\n Recieving end power=%.2fKVA',rec_pow);
fprintf('\n sending end power=%.2fKVA',send_pow);
fprintf('\n efficiency=%.2f%%',eff);
fprintf('\n voltage regulation=%.2f%%',reg);

EXPECTED RESULT for T network:


length =140

A B C D parameter for T network

A = 0.9874 + 0.0062i

B = 27.6485 +56.8476i

C = 0 +4.3960e-004i

D = 0.9874 + 0.0062i

check = 1.0000 + 0.0000i

enter 1- to read Vr, Ir and compute Vs,

Is 2- to read Vs, Is and compute Vr, Ir1

enter Vr/phase=132

enter ir/phase=174.96-131.22i

Sending end voltage/ph=87.550333+6.787052i KV

Sending end current/ph=173.570962-94.993743i

Amp Recieving end power=40.00KVA

sending end power=43.65KVA

efficiency=91.63%

voltage regulation=16.69%

4
EXPECTED RESULT for Pi network:
length = 140

A B C D parameter for medium line PI network

A = 0.9874 + 0.0062i

B = 28.0000 +57.1200i

C = -1.3527e-006 +4.3684e-004i

D = 0.9874 + 0.0062i

check = 1.0000 + 0.0000i

enter 1- to read Vr, Ir and compute Vs, Is

2- to read Vs, Is and compute Vr, Ir2

enter Vs/phase=132+0i

enter is/phase=174.96-131.22i

Receiving end voltage/ph=62.859251-5.850527i KV

Receiving end current/ph=173.674054-161.787473i Amp

Recieving end power=35.59KVA

sending end power=40.00KVA

efficiency=88.97%

voltage regulation=22.25%

5
PROGRAM:
%program to calculate ABCD parameters for long line network
clc
clear all

length=300;
Z=(0.2+0.408i)*length;
Y=(0+3.14e-6i)*length;

fprintf('A B C D parameter for long transmission line network');

zc=sqrt(Z/Y);
gam=sqrt(Z*Y);
A=cosh(gam)
B=zc*sinh(gam)
C=1/zc*sinh(gam)
D=A

check=(A*D)-(B*C)

k2=input('\n enter 1- to read Vr, Ir and compute Vs, Is\n 2- to


read Vs, Is and compute Vr, Ir'); switch k2,

case 1
vr=input('enter Vr/phase=');
ir=input('enter ir/phase=');
vr=vr*1e3/sqrt(3);
vs=(A*vr+B*ir)/1e3;
is=C*vr+D*ir;
fprintf('\n Sending end voltage/ph=%f%+fi KV',
real(vs),imag(vs));
fprintf('\n Sending end current/ph=%f%+fi Amp',
real(is),imag(is));
vs=vs*1e3;
case 2,
vs=input('enter Vs/phase=');
is=input('enter is/phase=');
vs=vs*1e3/sqrt(3.0);
vr=(D*vs-B*is)/1e3;
ir=-C*vs+D*is;
fprintf('\n Receiving end voltage/ph=%f%+fi KV',
real(vr),imag(vr));
fprintf('\n Receiving end current/ph=%f%+fi Amp',
real(ir),imag(ir));
vr=vr*1e3;
otherwise
disp('wrong choice');
end
rec_pow=3*real(vr*conj(ir))/1e6;
send_pow=3*real(vs*conj(is))/1e6;
eff=rec_pow/send_pow*100; reg=(abs(vs)/abs(A)-
abs(vr))/abs(vr)*100; fprintf('\n Recieving end
power=%.2fKVA',rec_pow); fprintf('\n sending end
power=%.2fKVA',send_pow); fprintf('\n
efficiency=%.2f%%',eff); fprintf('\n voltage
regulation=%.2f%%',reg);

6
Exp: 2 Date: / /

ABCD PARAMETERS FOR LONG TRANSMISSION


NETWORK.

AIM: i) Formation for symmetric  configuration.


ii) Verification of AD-BC = 1.
iii) Determination of Efficiency & regulation.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

Note: For long line, length=300

EXPECTED RESULT for Pi network:


A B C D parameter for long transmission line network
A = 0.9428 + 0.0277i
B = 5.7712e+001 +1.2062e+002i
C = -8.7717e-006 +9.2398e-004i
D = 0.9428 + 0.0277i
check = 1.0000

enter 1- to read Vr, Ir and compute Vs, Is


2- to read Vs, Is and compute Vr, Ir1
enter Vr/phase=132+0i
enter ir/phase=174.96-131.22i

Sending end voltage/ph=97.773395+15.642655i KV


Sending end current/ph=167.915908-48.443896i
Amp Recieving end power=40.00KVA sending end
power=46.98KVA
efficiency=85.15%
voltage regulation=37.75%

7
PROGRAM:
%FORMATION OF Ybus USING SINGULAR TRANSFORMATION
METHOD %WITHOUT MUTUAL COUPLING:
% p q Z hlcY(ADM)
z=[5 4 0.02+0.06i 0.03i
5 1 0.08+0.24i 0.025i
4 1 0.06+0.18i 0.02i
4 2 0.06+0.18i 0.02i
4 3 0.04+0.12i 0.015i
1 2 0.01+0.03i 0.01i
2 3 0.08+0.24i 0.025i];
fb=z(:,1);
tb=z(:,2);
Z=z(:,3);
hlcy=z(:,4);
y=1./Z;
nbus=max(max(fb),max(tb));
Y=zeros(nbus);
nline=length(fb);
nlb=nline+nbus;
A=zeros(nlb,nbus);
for k=1:nbus
A(k,k)=1;
end
for k=1:nline
A(nbus+k,fb(k))=1;
A(nbus+k,tb(k))=-1;
end
sh=zeros(nbus);
for k=1:nline
sh(fb(k))=sh(fb(k))+hlcy(k);
sh(tb(k))=sh(tb(k))+hlcy(k);
end
ypr=zeros(nlb,nlb);
for k=1:nbus
ypr(k,k)=sh(k);
end
for k=1:nline
ypr(nbus+k,nbus+k)=y(k);
end
format short;
Ybus=A'*ypr*A
V(1) =1.024532-0.08729i;
V(2)=1.02394-0.931i;
V(3)=1.01825-0.1074i;
V(4)=1.0476-0.049i;
V(5)=1.06+0i;
I=Ybus*V'

8
Exp: 3 Date: / /

FORMATION OF Y- BUS USING SINGULAR TRANSFORMATION


METHOD WITH AND WITHOUT MUTUAL COUPLING,

AIM: Y bus formation for systems, without mutual coupling, by singular


transformation.
THEORY:
FORMATION OF Y BUS MATRIX
Bus admittance is often used in power system studies. In most of the power system studies
it is required to form y- bus matrix of the system by considering certain power system
parameters depending upon the type of analysis.

Y-bus may be formed by inspection method only if there is no mutual coupling between the
lines. Every transmission line should be represented by - equivalent. Shunt impedances are
added to diagonal element corresponding to the buses at which these are connected. The off
diagonal elements are unaffected. The equivalent circuit of Tap changing transformers is
included while forming Y-bus matrix.
Generalized Y-bus = Yii ……….. Yid
Ydi ……… Ydd

where, Yii = Self admittance


Ydi = Transfer admittance

.
PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

9
%FORMATION OF Ybus USING SINGULAR TRANSFORMATON METHOD
%WITH MUTUAL COUPLING & WITHOUT LINE CHARGING:
% p qZmno mutual(imp)
z=[0 1 0.6i 0 0
0 2 0.5i 1 0.1i
2 3 0.5i 0 0
0 1 0.4i 1 0.2i
1 3 0.2i 0 0];
p=z(:,1);
q=z(:,2);
Z=z(:,3);
mno=z(:,4);
zmc=z(:,5);
nbus=max(max(p),max(q));
Y=zeros(nbus);
nline=length(p);
A=zeros(nline,nbus);
for k=1:nline,
if(q(k)==0)
A(k,p(k))=1;
elseif(p(k)==0)
A(k,q(k))=-1;
end
if(p(k)~=0&q(k)~=0)
A(k,p(k))=1;
A(k,q(k))=-1;
end
end
zpr=zeros(nline,nline);
for k=1:nline
zpr(k,k)=Z(k);
if(mno(k))
zpr(k,mno(k))=zmc(k);
zpr(mno(k),k)=zmc(k);
end
end
ypr=inv(zpr);
format short;
Ybus=A'*ypr*A

10
EXPECTED RESULT:
FORMATION OF Ybus USING SINGULAR TRANSFORMATION METHOD WITHOUT
MUTUAL COUPLING:
Ybus =

12.9167 -38.6950i -10.0000 +30.0000i 0 -1.6667 + 5.0000i -1.2500 + 3.7500i


-10.0000 +30.0000i 12.9167 -38.6950i -1.2500 + 3.7500i -1.6667 + 5.0000i 0
0 -1.2500 + 3.7500i 3.7500 -11.2100i -2.5000 + 7.5000i 0
-1.6667 + 5.0000i -1.6667 + 5.0000i -2.5000 + 7.5000i 10.8333 -32.4150i -5.0000 +15.0000i
-1.2500 + 3.7500i 0 0 -5.0000 +15.0000i 6.2500 -18.6950i

I=

-24.8742 - 7.9772i
32.7204 +11.1076i
-2.7353 - 0.6013i
-4.2194 - 1.6135i
-0.9560 - 0.6148i

FORMATION OF Ybus USING SINGULAR TRANSFORMATON METHOD WITH


MUTUAL COUPLING & WITHOUT LINE CHARGING:
Ybus =
0 - 8.0208i 0 + 0.2083i 0 + 5.0000i

0 + 0.2083i 0 - 4.0833i 0 + 2.0000i

0 + 5.0000i 0 + 2.0000i 0 - 7.0000i

11
PROGRAM:

% p q z hlc(ADM) a

z=[5 4 0.02+0.06i 0.03i 0.9


5 1 0.08+0.24i 0.025i 1
4 1 0.06+0.18i 0.02i 1
4 2 0.06+0.18i 0.02i 1
4 3 0.04+0.12i 0.015i 1
1 2 0.01+0.03i 0.01i 0.8
2 3 0.08+0.24i 0.025i 1 ];
%function yb(z);
fb=z(:,1);
tb=z(:,2);
Z=z(:,3);
hlc=z(:,4);
a=z(:,5);
y=1./Z;
nbus=max(max(fb),max(tb));
Y=zeros(nbus);
nline=length(fb);
for k=1:nline,
p=fb(k);q=tb(k);
y(k)=y(k)/a(k);
Y(p,p)=Y(p,p)+y(k)+hlc(k)+(1-a(k))/a(k)*y(k);
Y(q,q)=Y(q,q)+y(k)+hlc(k)+(a(k)-1)*y(k);
Y(p,q)=Y(p,q)-y(k);
Y(q,p)=Y(p,q);
end
Ybus=Y

12
Exp: 4 Date: / _/

FORMATION OF ‘Y- BUS’ BY INSPECTION METHOD.

AIM: Y bus formation for systems,by inspection method.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

EXPECTED RESULT:
Ybus =

18.5417 -55.5700i -12.5000 +37.5000i 0 -1.6667 + 5.0000i -1.2500 + 3.7500i

-12.5000 +37.5000i 12.9167 -38.6950i -1.2500 + 3.7500i -1.6667 + 5.0000i 0

0 -1.2500 + 3.7500i 3.7500 -11.2100i -2.5000 + 7.5000i 0

-1.6667 + 5.0000 -1.6667 + 5.0000i -2.500 + 7.5000i 10.8333 -32.4150i -5.5556 -16.6667i

-1.2500 + 3.7500i 0 0 -5.5556 +16.6667i 7.4228 -22.2135i

13
PROGRAM:
%Zprim=[Element no. from to Value]
clc
clear all
Z= [ 1 1 0 0.25
2 2 10.1
3 3 10.1
4 2 00.25
5 2 30.1];
[m n]= size(Z);
Zbus=[ ] ;%Let Zbus be a null matrix to begin with
currentbusno=0;
for count = 1:m,
[rows cols]=size(Zbus);
fb=Z(count,2);
tb=Z(count,3);
value=Z(count,4);
newbus=max(fb,tb);
ref=min(fb,tb);
% Type 1 Modification
if newbus>currentbusno & ref==0
Type=1
Zbus=[Zbus zeros(rows,1)
zeros(1,cols) value]
currentbusno=newbus;
continue
end
% Type 2 Modification
if newbus>currentbusno & ref~=0
Type=2
Zbus=[Zbus Zbus(:,ref)
Zbus(ref,:) value+Zbus(ref,ref)]
currentbusno=newbus; continue

end
% Type 3 Modification
if newbus<=currentbusno & ref==0
Zbus=Zbus-
1/(Zbus(newbus,newbus)+value)*Zbus(:,newbus)*Zbus(newbus,:)
continue
end
% Type 4 Modification
if newbus<=currentbusno & ref~=0 Zbus=Zbus-
1/(value+Zbus(fb,fb)+Zbus(tb,tb)-
2*Zbus(fb,tb))*((Zbus(:,fb)-Zbus(:,tb))*((Zbus(fb,:)-
Zbus(tb,:))))
continue
end
end

14
Exp:5 Date: / /

Z-BUS BUILDING ALGORITHEM

AIM: Formation of Z-bus, using Z-bus build Algorithm without mutual.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

EXPECTED RESULT
Type = 1
Zbus = 0.2500
Type = 2
Zbus =
0.2500 0.2500
0.2500 0.3500
Type = 2
Zbus =
0.2500 0.2500 0.2500
0.2500 0.3500 0.2500
0.2500 0.2500 0.3500
Zbus =
0.1458 0.1042 0.1458
0.1042 0.1458 0.1042
0.1458 0.1042 0.2458
Zbus =
0.1397 0.1103 0.1250
0.1103 0.1397 0.1250
0.1250 0.1250 0.1750

15
PROGRAM:
%power angle characteristics cylindrical rotor syn.m/c
%enter the values of x,v,Ia; clc

clear all
x=0.3;
v=1.0;
e=1.2;
pm=abs(e)*abs(v)/x;
del=0:0.1:pi;
plot(del,pm*sin(del),'r');
title('power angle characteristics of cylindrical rotor
syn.m/c');
xlabel('Delta');
ylabel('power,p');
legend('pm*sin(delta)');
del=0:0.1:pi/2;
line(del,pm);
y=0:0.1:pm;
line(pi/2,y);
reg=(abs(e)-abs(v))/abs(v)*100;
fprintf('\n the excitation Voltage = %f%%\n',e);
fprintf('\n the peak power = %f%%\n',pm);
fprintf('\n the Voltage regulation = %f%%\n',reg);

16
Exp:6 Date: / /

DETERMINATION OF POWER ANGLE CURVE FOR NON- SALIENT


POLE SYNCHRONOUS MACHINES.

AIM: To determine the power angle diagram , reluctance power, excitation, emf and
regulation for non- salient pole synchronous machines,.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

EXPECTED RESULT:

the excitation Voltage = 1.200000%


the peak power = 4.000000%
the Voltage regulation = 20.000000%

power angle characteristics of cylindrical rotor syn.m/c


4
pm*sin(delta)
3.5

2.5

1.5

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5
Delta

17
PROGRAM:
clc
clear all
xd=1;
xq=0.6;
v=1.0;
ia=0.5000-0.3750i;
theta=abs(angle(ia));
del=atan((xq*abs(ia)*cos(theta))/(abs(v)+xq*abs(ia)*sin(theta))
);
e=abs(v)*cos(del)+xd*abs(ia)*sin(del+theta);
p=(e)*abs(v)/xd;
pr=abs(v)^2*(xd-xq)/(2*xd*xq);
del=0:0.01:pi;
line(del,0);
hold on;
pe=p*sin(del)+pr*sin(2*del);
plot(del,p*sin(del),del,pr*sin(2*del),del,p*sin(del)+pr*sin(2*d
el));
title('power angle characteristics of salient pole syn.m/c');
xlabel('Delta');
ylabel('power,p');
legend('p*sin(delta)','pr*sin(2*del)','p*sin(del)+pr*sin(2*del)
');
[pmax,k]=max(pe);
fprintf('\n maximum power = %f and the corresponding angle=
%f',pmax,del(k)*180/pi);
del=0:0.01:del(k);
line(del,pmax);
y=0:0.01:pmax;
line(del(k),y);
reg=(abs(e)-abs(v))/abs(v)*100;
text(-0.4,pmax,'pmax');
text(del(k),-0.1,'deltamax');
fprintf('\n the excitation Voltage = %f pu',abs(e));
fprintf('\n the Reluctance power = %f pu\n',pr);
fprintf('\n the Voltage regulation = %f%%\n',reg);

18
Exp:7 Date: / /

DETERMINATION OF POWER ANGLE CURVE SALIENT POLE


SYNCHRONOUS MACHINES.

AIM: To determine the power angle diagram , reluctance power, excitation, emf and
regulation for salient pole synchronous machines,.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

EXPECTED RESULT:

maximum power = 1.581035 and the corresponding angle= 69.900851


the excitation Voltage = 1.454468 pu
the Reluctance power = 0.333333 pu
the Voltage regulation = 45.446817%

power angle characteristics of salient pole syn.m/c


1.6
pmax
p*sin(delta)
1.4 pr*sin(2*del)
p*sin(del)+pr*sin(2*del)
1.2

1
power,p

0.8

0.6

0.4

0.2

0
deltamax
-0.2

-0.40 0.5 1 1.5 2 2.5 3 3.5


Delta

19
PROGRAM:
clc
clear all
%program for swing curve when the fault is
cleared ps=0.9;e=1.1;v=1.0;m=0.00028;
xe=0.35;xL=0.2;
%function swing2(ps,e,v,m,xe,xL)
x1=xe+xL/2;
ch=input('enter 1-for fault at the beginning of line
\n 2-for fault at the middle of line '); switch ch

case 1,
x2=inf;
case 2,
x2=(xe*xL+xe*xL/2+xL*xL/2)/(xL/2);
otherwise
disp('wrong input');
end
x3=xe+xL;
dt=0.05;
%ct=ct/50; //conversion from cycles to sec
ct=input('\n enter clearing time in secs ');
k=ct/dt;
r=ct-floor(k)*dt;
if(r==0)
fprintf('FAULT IS CLEARED AT THE BEGINNING OF
AN INTERVEL');
else
fprintf('FAULT IS CLEARED AT THE MIDDLE OF AN
INTERVEL');
end
rr=180/pi;
f=dt^2/m;
deld=0;
it=1; t(it)=0;
pm1=e*v/x1;
del(it)=asin(ps/pm1);
pm2=e*v/x2;
pm3=e*v/x3;
fprintf('\n TIME PMAX DELTA'); pm=pm1;

pe=pm*sin(del(it));
pa=(ps-pe);

20
Exp: 8 Date: / /

PROGRAM FOR SWING CURVE WHEN THE FAULT IS


CLEARED.

AIM: To determine the Swing curve when the fault is cleared


i) At the beginning of the Line
ii) At the middle of the line

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

21
fprintf('\n %5.3f %5.2f %5.2f',
t(it),pm,del(it)* rr);
pm=pm2;

pe=pm*sin(del(it));
pa=(ps-pe)/2;
while(t(it)<=0.5)
ft=f*pa/rr;
deld=deld+ft;
fprintf('\n %5.3f %5.2f %5.2f',
t(it),pm,del(it)* rr);
it=it+1;
t(it)=t(it-1)+dt;
del(it)=del(it-1)+deld;
pm=pm2;
if(t(it)==ct)
pm=(pm2+pm3)/2;
elseif(t(it)>ct)
pm=pm3;
end
pe=pm*sin(del(it));
pa=ps-pe;
end
plot(t,del*rr,'r');
title('swing curve');
xlabel('Time');
ylabel('Delta');

EXPECTED RESULT:
swing curve swing curve
45 60

40
50

35

40
30
Delta

Delta

25 30

20
20

15
10

100 0.1 0.2 0.3 0.4 0.5 0.6 0.7


Time
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time
enter 1-for fault at the beginning of line 2-for fault at the middle of line 1

22
enter clearing time in secs 0.05 2-for fault at the middle of line 2
FAULT IS CLEARED AT THE enter clearing time in secs 0.125
BEGINNING OF AN INTERVEL FAULT IS CLEARED AT THE
TIME PMAX DELTA MIDDLE OF AN INTERVEL
0.000 2.44 21.60 TIME PMAX DELTA
0.000 0.00 21.60 0.000 2.44 21.60
0.050 1.00 25.62 0.000 0.88 21.60
0.100 2.00 33.81 0.050 0.88 24.17
0.150 2.00 40.10 0.100 0.88 31.56
0.200 2.00 42.93 0.150 2.00 42.88
0.250 2.00 41.62 0.200 2.00 50.07
0.300 2.00 36.50 0.250 2.00 51.61
0.350 2.00 28.78 0.300 2.00 47.19
0.400 2.00 20.51 0.350 2.00 37.70
0.450 2.00 14.01 0.400 2.00 25.33
0.500 2.00 11.23 0.450 2.00 13.35
0.500 2.00 5.29
enter 1-for fault at the beginning of line

23
PROGRAM:
clc
clear all
%swing curve for sustained fault and critical clearing
time.
%ps=mech. power input xe=xg+xt, x1=reactance before
fault x2=reactance after fault
ps=0.9;e=1.1;v=1.0;m=0.00028;xe=0.35;xLi=0.2;
%function swing(ps,e,v,m,xe,xLi) x1=xe+xLi/2;

ch=input('enter 1-for fault at the beginning \n 2-for


fault at the middle');
switch ch
case 1
x2=inf;
case 2
x2=(xe*xLi+xe*xLi/2+xLi*xLi/2)/(xLi/2);
otherwise
disp('wrong input');
end
dt=0.05;
rr=180/pi;
f=dt^2/m;
it=1;
t(it)=0;
deld=0;
pm1=e*v/x1;
del(it)=asin(ps/pm1);
fprintf('\n SUSTAINED FAULT');
fprintf('\n TIME PMAX DELTA');
fprintf('\n----------------');
pm=pm1;
fprintf('\n %5.3f %5.2f %5.2f',t(it),pm,del(it)*rr);
pm2=e*v/x2;
pm=pm2;
pe=pm*sin(del(it));
pa=(ps-pe)/2;
t1=0;
while(t(it)<=0.5)
ft=f*pa/rr;
deld=deld+ft;
if(t1-t(it)<=0.5)
fprintf('\n %5.3f %5.2f
%5.2f',t(it),pm,del(it)*rr);

24
Exp: 9 Date: / /

SWING CURVE FOR SUSTAINED FAULT AND CRITICAL


CLEARING ANGLE & TIME.

AIM: To determine swing curve for sustained fault and critical clearing angle & time.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

25
end
it=it+1;
t(it)=t(it-1)+dt;
del(it)=del(it-1)+deld;
pm=pm2;
pe=pm*sin(del(it));
pa=ps-pe;
end
x3=xe+xLi;
%x3=0.55;
pm3=e*v/x3;
delm=pi-del(1);
cdc=(ps*(delm-del(1))+pm3*cos(delm)-
pm2*cos(del(1)))/(pm3-pm2);
delc=acos(cdc);
fprintf('\n critical clearing angle-%f',delc*rr);
it=1;
while(t(it)<0.5)
if(del(it)>=delc)
break;
end
it=it+1;
end
fprintf('\n critical clearing time-%f',t(it));
plot(t,del,'r');
title('swing curve');
xlabel('TIME');
ylabel('DELTA');

EXPECTED RESULT:

swing curve swing curve


9 3.5

8
3
7
2.5
6

5 2
DELTA

DELTA

4
1.5
3
1
2

1 0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0
TIME 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
TIME

26
enter 1-for fault at the beginning
2-for fault at the middle1

SUSTAINED FAULT
TIME PMAX DELTA
----------------
0.000 2.44 21.60
0.000 0.00 21.60
0.050 0.00 25.62
0.100 0.00 37.67
0.150 0.00 57.76
0.200 0.00 85.89
0.250 0.00 122.05
0.300 0.00 166.25
0.350 0.00 218.48
0.400 0.00 278.75
0.450 0.00 347.05
0.500 0.00 423.39
critical clearing angle-81.684989
critical clearing time-0.200000

enter 1-for fault at the beginning


2-for fault at the middle2

SUSTAINED FAULT
TIME PMAX DELTA
----------------
0.000 2.44 21.60
0.000 0.88 21.60
0.050 0.88 24.17
0.100 0.88 31.56
0.150 0.88 42.88
0.200 0.88 56.88
0.250 0.88 72.34
0.300 0.88 88.34
0.350 0.88 104.53
0.400 0.88 121.15
0.450 0.88 139.08
0.500 0.88 159.89
critical clearing angle-118.182332
critical clearing time-0.400000

27
PROGRAM:
% Formation of Jacobian
matrix clc
clear all
nb=3;
Y=[65-45j -40+20i -25+25i; -
40+20i 60-60i -20+40i; -
25+25i -20+40i 45-65i];
V = [1.0 0;1.0 0.0 ;1.0 0.0 ];
J1 = zeros(nb-1,nb-1) ;
J2 = zeros(nb-1,nb-1) ;
J3 = zeros(nb-1,nb-1) ;
J4 = zeros(nb-1,nb-1) ;

for p = 2:nb
Vp = V(p,1);
delta_p = V(p,2) * pi/180;

Ypp = abs(Y(p,p));
theta_pp = angle(Y(p,p));

V1 = V(1,1);
delta_1 = V(1,2) * pi/180;
Yp1 = abs( Y(p,1) );
theta_p1 = angle( Y(p,1));
J1 (p-1,p-1) = Vp * V1 * Yp1 * sin( theta_p1 - delta_p + delta_1 );
J2 (p-1,p-1) = 2*Vp*Ypp*cos(theta_pp) + V1*Yp1*cos(theta_p1 - delta_p + delta_1);
J3 (p-1,p-1) = Vp*V1*Yp1*cos(theta_p1 - delta_p + delta_1);
J4 (p-1,p-1) = -2*Vp*Ypp*sin(theta_pp) - Vp*Yp1*sin(theta_p1 - delta_p + delta_1);

for q = 2:nb

Vq = V(q,1) ;
delta_q = V(q,2) * pi/180;

Ypq = abs ( Y(p,q) );


theta_pq = angle( Y(p,q) );

temp1 = -Vp * Vq * Ypq * sin( theta_pq - delta_p + delta_q) ;


temp2 = Vq * Ypq * cos( theta_pq - delta_p + delta_q) ; temp3
= -Vp * Vq * Ypq * cos( theta_pq - delta_p + delta_q) ; temp4
= -Vp * Ypq * sin( theta_pq - delta_p + delta_q) ;

if q ~= p
J1(p-1,q-1) = temp1 ;
J1(p-1,p-1) = J1(p-1,p-1) - temp1 ;

J2(p-1,q-1) = temp2 ;
J2(p-1,p-1) = J2(p-1,p-1) + temp2 ; cont…

28
Exp:10 Date: / /

FORMATION OF JACOBIAN FOR THE SYSTEM NOT EXCEEDING 4


BUSES (no PV BUSES) IN POLAR COORDINATES

Aim: A Three-Bus system is given. Form a Jacobian matrix for the system in polar coordinates.

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

cont…
J3(p-1,q-1) = temp3 ;
J3(p-1,p-1) = J3(p-1,p-1) - temp3 ;

J4(p-1,q-1) = temp4 ;
J4(p-1,p-1) = J4(p-1,p-1) + temp4 ;

end

end
end

J = [J1 J2; J3 J4]

EXPECTED RESULT

J=

60.0000 -40.0000 60.0000 -20.0000


-40.0000 65.0000 -20.0000 45.0000
-60.0000 20.0000 60.0000 -40.0000
20.0000 -45.0000 -40.0000 65.0000

29
PROGRAM:
clc
clear all
% enter Y-bus of the system
Y=[3-12i -2+8i -1+4i 0
-2+8i 3.66-14.664i -0.666+2.664i -1+4i
-1+4i -0.666+2.664i 3.66-14.664i -2+8i
0 -1+4i -2+8i 3-12i];
%enter no. of buses, slack bus no, no.of pq buses, no of pv buses
nbus=4;
sbno=1;
npq=2;
npv=1;
% assume bus no 1 as slack bus, next npq buses as pq buses and the
remaining as pv buses
%enter slack bus voltage
v(1)=1.06+0i;
%assume voltages at all other buses as 1+j0
v(2)=1;v(3)=1;v(4)=1;
%enter p & q at all pq buses P(2)=-
0.5;P(3)=-0.4;Q(2)=-0.2;Q(3)=-0.3;
%enter p ,vsp and q limits at pv buses
P(4)=0.3;
vsp(4)=1.04;Qmin(4)=0.1;Qmax(4)=1.0;
%enter accuracy of convergence
acc=0.001;
for it=1:5
%to find voltages at pq buses
for p=2:npq+1,
v1(p)=v(p); pq=(P(p)-
Q(p)*i)/conj(v(p)); ypq=0;

for q=1:nbus
if(p==q) continue;
end
ypq=ypq+Y(p,q)*v(q)
;
end v(p)=(pq-
ypq)/Y(p,p);
end
%to find voltages at pv buses
for p=npq+2:nbus,
v1(p)=v(p);
s=0;
for q=1:nbus,
if(p~=q)
s=s+Y(p,q)*v(q);
else
vp=v(q);

29
Exp:11 Date: / /

GAUSS-SEIDEL METHOD

AIM: To perform load flow analysis using Gauss- Seidel method (only pq bus)

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

30
ang=angle(v(q));
v(q)=complex(vsp(q)*cos(ang),vsp(q)*sin(ang));
s=s+Y(p,q)*v(q);
end
end
Qc(p)=-1*imag(conj(v(p))*s);
if(Qc(p)>=Qmin(p)& Qc(p)<=Qmax(p))
pq=(P(p)-Qc(p)*i)/conj(v(p));
ypq=0;
for q=1:nbus
if(p==q) continue;
end
ypq=ypq+Y(p,q)*v(q);
end
v(p)=(pq-ypq)/Y(p,p);
ang=angle(v(p));
v(p)=complex(vsp(p)*cos(ang),vsp(p)*sin(ang));
else
if(Qc(p)<Qmin(p))
Q(p)=Qmin(p);
else
Q(p)=Qmax(p);
end
pq=(P(p)-Q(p)*i)/conj(vp);
ypq=0;
for q=1:nbus
if(p==q) continue;
end
ypq=ypq+Y(p,q)*v(q);
end
v(p)=(pq-ypq)/Y(p,p);
end
end
%to find the votages at all buses and Q at pv busses
fprintf('\nThe votages at all buses and Q at pv busses after
iteration no %d',it);
for p=1:npq+1
fprintf('\nV(%d)=%.4f
at%.2fdeg',p,abs(v(p)),angle(v(p))*180/pi);
end
for p=npq+2:nbus
fprintf('\nV(%d)=%.4f at%.2fdeg
Q(%d)=%+.3f\n',p,abs(v(p)),angle(v(p))*180/pi,p,Qc(p));
end
%to check for convergence
for p=2:nbus
diff(p)=abs(v(p)-v1(p));
end
err=max(diff);
if(err<=acc)

31
break;
end
end
EXPECTED RESULT:

The votages at all buses and Q at pv busses after iteration no 1


V(1)=1.0600 at0.00deg
V(2)=1.0124 at-1.61deg
V(3)=0.9933 at-1.48deg
V(4)=1.0400 at-0.66deg Q(4)=+0.425

The votages at all buses and Q at pv busses after iteration no 2


V(1)=1.0600 at0.00deg
V(2)=1.0217 at-1.99deg
V(3)=1.0162 at-1.86deg
V(4)=1.0400 at-0.85deg Q(4)=+0.208

The votages at all buses and Q at pv busses after iteration no 3


V(1)=1.0600 at0.00deg
V(2)=1.0259 at-2.09deg
V(3)=1.0175 at-1.94deg
V(4)=1.0400 at-0.91deg Q(4)=+0.185

The votages at all buses and Q at pv busses after iteration no 4


V(1)=1.0600 at0.00deg
V(2)=1.0261 at-2.11deg
V(3)=1.0175 at-1.98deg
V(4)=1.0400 at-0.95deg Q(4)=+0.185

32
Case study:

256.6 + j 110.2
G1

(1) (2)
0.02 + j 0.04
1.05<0 0.98183<-3.5

0.01 + j 0.03 0.0125 + j 0.025

(3)
1.00125<-2.8624
138.6 + j 45.2

Program:
clc;
clear;
linedata = [1 20.02 0.04 0
1 30.01 0.03 0
2 30.0125 0.025 0];
fr=linedata(:,1);
to=linedata(:,2);
R=linedata(:,3);
X=linedata(:,4);
B_half=linedata(:,5);
nb=max(max(fr),max(to));
nbr=length(R);

bus_data = [1 1.05 0
2 0.98183 -3.5
3 1.00125 -2.8624];
bus_no=bus_data(:,1);
volt_mag=bus_data(:,2);
angle_d=bus_data(:,3);

Z = R + j*X; %branch impedance y=


ones(nbr,1)./Z; %branch admittance
Vbus=(volt_mag.*cos(angle_d*pi/180))+ (j*volt_mag.*sin(angle_d*pi/180));
%line current
for k=1:nbr
Ifr(k)=(Vbus(fr(k))-Vbus(to(k)))*y(k) + (Vbus(fr(k))*j*B_half(k));
Ito(k)=(Vbus(to(k))-Vbus(fr(k)))*y(k) + (Vbus(to(k))*j*B_half(k));
end
%line flows
% S=P+jQ
for k=1:nbr

33
Exp: 12 Date: / /

DETERMINATION OF BUS CURRENTS, BUS POWER & LINE FLOWS


FOR A SPECIFIED SYSTEM VOLTAGE (BUS) PROFILE.\

AIM: Determination of bus currents, bus power and line flow for a
specified system voltage (Bus) Profile

PROCEDURE:

Enter the command window of the MATLAB.


Create a new M – file by selecting File - New – M – File
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.

34
2017-2018

Sfr(k)=Vbus(fr(k))*Ifr(k)';
Sto(k)=Vbus(to(k))*Ito(k)';
end
%line losses
for k=1:nbr
SL(k)=Sfr(k)+Sto(k);
end
%bus power
Sbus=zeros(nb,1);
for n=1:nb
for k=1:nbr
if fr(k)==n
Sbus(n)=Sbus(n)+Sfr(k);
elseif to(k)==n
Sbus(n)=Sbus(n)+Sto(k);
end
end
end
%Bus current
%P+jQ=V*I'
Ibus=(Sbus./Vbus)';
fprintf(' OUTPUT DATA \n');
fprintf('------------------------------\n');
fprintf(' Line Currents\n');
fprintf('------------------------------\n');
for k=1:nbr
fprintf(' I%d%d= %4.3f (+) %4.3f \n',fr(k),to(k),real(Ifr(k)),imag(Ifr(k)));
fprintf(' I%d%d= %4.3f (+) %4.3f \n', to(k),fr(k),real(Ito(k)),imag(Ito(k)));
end
fprintf('------------------------------\n');

fprintf(' Line Flows\n')


fprintf('------------------------------\n');
for k=1:nbr
fprintf(' S%d%d= %4.3f (+) %4.3f \n',fr(k),to(k),real(Sfr(k)),imag(Sfr(k)));
fprintf(' S%d%d= %4.3f (+) %4.3f \n', to(k),fr(k),real(Sto(k)),imag(Sto(k)));
end
fprintf('------------------------------\n');
fprintf(' Line Losses\n')
fprintf('------------------------------\n');
for k=1:nbr
fprintf(' SL%d%d= %4.3f (+) %4.3f \n',fr(k),to(k),real(SL(k)),imag(SL(k)));
end
fprintf('------------------------------\n');
fprintf(' Bus Power\n')
fprintf('------------------------------\n');
for k=1:nb
fprintf(' P%d= %4.3f (+) %4.3f \n',k,real(Sbus(k)),imag(Sbus(k)));
end
fprintf(' Bus Current\n')
fprintf('------------------------------\n');
for k=1:nb

35
2017-2018

fprintf(' I%d= %4.3f (+) %4.3f \n',k,real(Ibus(k)),imag(Ibus(k)));


end
fprintf('------------------------------ \n');

EXPECTED RESULT:

OUTPUT DATA
------------------------------
Line Currents
------------------------------
I12= 1.899 (+) -0.801
I21= -1.899 (+) 0.801
I13= 2.000 (+) -1.000
I31= -2.000 (+) 1.000
I23= -0.638 (+) 0.481
I32= 0.638 (+) -0.481
------------------------------
Line Flows
------------------------------
S12= 1.994 (+) 0.841
S21= -1.909 (+) -0.671
S13= 2.100 (+) 1.050
S31= -2.050 (+) -0.900
S23= -0.654 (+) -0.433
S32= 0.662 (+) 0.449
------------------------------
Line Losses
------------------------------
SL12= 0.085 (+) 0.170
SL13= 0.050 (+) 0.150
SL23= 0.008 (+) 0.016
------------------------------
Bus Power
------------------------------
P1= 4.094 (+) 1.891
P2= -2.563 (+) -1.104
P3= -1.388 (+) -0.451
Bus Current
------------------------------
I1= 3.899 (+) -1.801
I2= -2.537 (+) 1.282
I3= -1.362 (+) 0.519
------------------------------

36

You might also like