Sie sind auf Seite 1von 29

Power system simulation Lab Manual - 2012

1. A single circuit 3 phase, 50Hz, transmission line is300KM long. The conductor has the following
parameters: Z = 20+100i and Y= 1e-6i The load is 50MW at 110 KV with 0.8 power factor. Write a
MATLAB program to obtain the sending end current, power, voltage and power factor. Also find the
regulation and efficiency using nominal T method. Also calculate ABCD parameters.

MATLAB PROGRAM

% nominal T method
clear all;
Pr=input('enter the value of recieving end power=');
Vr=input('enter the value of recieving end voltage=');
pfr=input('enter the value of recieving end power facter=');
z1=input('enter the value of the line impedance/km=');
y=input('enter the value of the shunt admittance/km=');
d=input('enter the value of the transmission line length in km=');
z=z1*d
vrp=Vr/(sqrt(3))
irm=Pr/(sqrt(3)*Vr*pfr)
ira=-acos(pfr)
ir=irm*(exp(ira*j))
a=1+(y*z/2)
d=a
b=z*(1+(y*z/4))
c=y
vs=a*vrp+b*ir
is=c*vrp+d*ir
v1=vrp+(ir*z/2)
ic=y*d*v1
is=ic+ir
vs=v1+(is*z/2)
vsm=abs(vs)
vsang=angle(vs)*180/pi
isang=angle(is)*180/pi
pfs=cosd(vsang-isang)
ps=3*abs(vs)*abs(is)*pfs
eff=(Pr*100)/ps
reg=(abs(vs)-abs(vrp))*100/(abs(vrp))

Dept of E & E , K.V.G.C.E.Sullia Page 1


Power system simulation Lab Manual - 2012

input data
enter the value of recieving end power=50e6
enter the value of recieving end voltage=110e3
enter the value of recieving end power facter=0.8
enter the value of the line impedance/km=20+100i
enter the value of the shunt admittance/km=1e-6i
enter the value of the transmission line length in km=1
results
z = 2.0000e+001 +1.0000e+002i
vrp = 6.3509e+004
irm = 328.0399
ira = -0.6435
ir = 2.6243e+002 -1.9682e+002i
a = 1.0000 + 0.0000i
d = 1.0000 + 0.0000i
b = 19.9990 +99.9976i
c = 0 +1.0000e-006i
vs = 8.8436e+004 +2.2307e+004i
is = 2.6242e+002 -1.9675e+002i
v1 = 7.5974e+004 +1.1153e+004i
ic = -0.0112 + 0.0760i
is = 2.6242e+002 -1.9675e+002i
vs = 8.8436e+004 +2.2307e+004i
vsm = 9.1206e+004
vsang = 14.1569
isang = -36.8604
pfs = 0.6291
ps = 5.6456e+007
eff = 88.5653
reg = 43.6116

Dept of E & E , K.V.G.C.E.Sullia Page 2


Power system simulation Lab Manual - 2012

2. A single circuit 3 phase, 50Hz, transmission line is300KM long. The conductor has the following
parameters: Z= 0.16+0.826iohm/km and Y= 0+5e-6imho/km . The load is 125MW at 215
KV with 1 power factor. Write a MATLAB program to obtain the sending end current, power, voltage
and power factor. Also find the regulation and efficiency using nominal T method.

MATLAB PROGRAM

% nominal T method long line


clear all;
Pr=input('enter the value of recieving end power=');
Vr=input('enter the value of recieving end voltage=');
pfr=input('enter the value of recieving end power facter=');
z1=input('enter the value of the line impedance/km=');
y=input('enter the value of the shunt admittance/km=');
d=input('enter the value of the transmission line length in km=');
z=z1*d
vrp=Vr/(sqrt(3))
irm=Pr/(sqrt(3)*Vr*pfr)
ira=-acos(pfr)
ir=irm*(exp(ira*j))
a=1+(y*z/2)+(y^2*z^2/24)+(y^3*z^3/720)
d=a
b=z*(1+(y*z/6)+(y^2*z^2/120)+(y^3*z^3/5040))
c=y*(1+(y*z/6)+(y^2*z^2/120)+(y^3*z^3/5040))
vs=a*vrp+b*ir
is=c*vrp+d*ir
vsang=angle(vs)*180/pi
isang=angle(is)*180/pi
pfs=cosd(vsang-isang)
ps=3*abs(vs)*abs(is)*pfs
eff=(Pr*100)/ps
reg=(abs(vs)-abs(vrp))*100/(abs(vrp))

Dept of E & E , K.V.G.C.E.Sullia Page 3


Power system simulation Lab Manual - 2012

input data
enter the value of recieving end power=125e6
enter the value of recieving end voltage=215e3
enter the value of recieving end power facter=1
enter the value of the line impedance/km=0.16+0.826i
enter the value of the shunt admittance/km=0+5e-6i
enter the value of the transmission line length in km=300

results
z = 4.8000e+001 +2.4780e+002i
vrp = 1.2413e+005
irm = 335.6688
ira = 0
ir = 335.6688
a = 0.9994 + 0.0001i
d = 0.9994 + 0.0001i
b = 4.7980e+001 +2.4775e+002i
c = -1.9998e-010 +4.9990e-006i
vs = 1.4016e+005 +8.3177e+004i
is = 3.3546e+002 +6.6080e-001i
vsang = 30.6870
isang = 0.1129
pfs = 0.8610
ps = 1.4122e+008
eff = 88.5154
reg = 31.2986

Dept of E & E , K.V.G.C.E.Sullia Page 4


Power system simulation Lab Manual - 2012

3. Write MATLAB program to obtain the Ybus using Inspection method for the power system
shown below. Data is - line Impedance is 0.02+j0.08 PU and total Shunt Admittance of each line
is j0.02 PU.

MATLAB PROGRAM
clc;clear all;close all;
p=input('enter number of buses=');
k=input('enter number of elements=');
for m=1:k
fprintf(['Data for Transmission Line',int2str(m)]);
fprintf('\n');
i=input('enter from bus=');
j=input('enter to bus=');
z=input('enter impedance of line=');
hlc=input('enter half line charging impedance=');
yy(i,j)=1/z;
yy(j,i)=1/z;
c(m,i)=hlc;
c(m,j)=hlc;
end
yd=diag(sum(yy))+diag(sum(c));
ybus=yd-yy

Dept of E & E , K.V.G.C.E.Sullia Page 5


Power system simulation Lab Manual - 2012

RESULTS
enter number of buses=3
enter number of elements=3
Data for Transmission Line1
enter from bus=1
enter to bus=2
enter impedance of line=0.02+0.08i
enter half line charging impedance=0.01i
Data for Transmission Line2
enter from bus=2
enter to bus=3
enter impedance of line=0.02+0.08i
enter half line charging impedance=0.01i
Data for Transmission Line3
enter from bus=3
enter to bus=1
enter impedance of line=0.02+0.08i
enter half line charging impedance=0.01i

ybus =

5.8824 -23.5094i -2.9412 +11.7647i -2.9412 +11.7647i


-2.9412 +11.7647i 5.8824 -23.5094i -2.9412 +11.7647i
-2.9412 +11.7647i -2.9412 +11.7647i 5.8824 -23.5094i

Dept of E & E , K.V.G.C.E.Sullia Page 6


Power system simulation Lab Manual - 2012

4. Power system data is given below. Write MATLAB program to obtain the Ybus by singular
transformation.
p q z hlc(adm)
z=[ 1 2 0.02+0.06i 0.06i
1 3 0.08+0.24i 0.05i
2 3 0.06+0.18i 0.04i
2 4 0.06+0.18i 0.04i
2 5 0.04+0.12i 0.03i
3 4 0.01+0.03i 0.02i
4 5 0.08+0.24i 0.05i]

MATLAB PROGRAM
clear all
% p q z hlc(admittance)
z=[1 2 0.02+0.06i 0.06i;
1 3 0.08+0.24i 0.05i;
2 3 0.06+0.18i 0.04i
2 4 0.06+0.18i 0.04i;
2 5 0.04+0.12i 0.03i;
3 4 0.01+0.03i 0.02i;
4 5 0.08+0.24i 0.05i]
%function yb(z)
fb=z(:,1)
tb=z(:,2)
Z=z(:,3)
hlc=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))+hlc(k)
sh(tb(k))=sh(tb(k))+hlc(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)

Dept of E & E , K.V.G.C.E.Sullia Page 7


Power system simulation Lab Manual - 2012

end
format short;
Ybus=A'*ypr*A

RESULTS
A=
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 -1 0 0 0
1 0 -1 0 0
0 1 -1 0 0
0 1 0 -1 0
0 1 0 0 -1
0 0 1 -1 0
0 0 0 1 -1

sh =
0 + 0.1100i 0 0 0 0
0 + 0.1700i 0 0 0 0
0 + 0.1100i 0 0 0 0
0 + 0.1100i 0 0 0 0
0 + 0.0800i 0 0 0 0

Ybus =
6.2500 -18.6400i -5.0000 +15.0000i -1.2500 + 3.7500i 0 0
-5.0000 +15.0000i 10.8333 -32.3300i -1.6667 + 5.0000i -1.6667 + 5.0000i -2.5000 + 7.5000i
-1.2500 + 3.7500i -1.6667 + 5.0000i 12.9167 -38.6400i -10.0000 +30.0000i 0
0 -1.6667 + 5.0000i -10.0000 +30.0000i 12.9167 -38.6400i -1.2500 + 3.7500i
0 -2.5000 + 7.5000i 0 -1.2500 + 3.7500i 3.7500 -11.1700i

Dept of E & E , K.V.G.C.E.Sullia Page 8


Power system simulation Lab Manual - 2012

5. For a power system shown below obtain Ybus using singular transformation method by
writing MATLAB program

MATLAB program
%formation of Ybus by singular transformation
clc;
p=4;% no of buses
k=5;% no of lines
z1=[0.6 0.1;0.1 0.5]
z2=[0 0.2 0; 0 0 0]
z3=[0 0;0.2 0;0 0]
z4=[0.5 0 0;0 0.4 0;0 0 0.2]
z=[z1 z2;z3 z4]
b1=inv(z1-(z2*inv(z4)*z3))
b2=-b1*z2*inv(z4)
b3=-inv(z4)*z3*b1
b4=inv(z4)-inv(z4)*z3*b2
ypri=[b1 b2;b3 b4]
a=[-1 0 0;0 -1 0;0 1 -1;-1 0 0;1 0 -1]
Ybus=a'*[ypri]*a

Dept of E & E , K.V.G.C.E.Sullia Page 9


Power system simulation Lab Manual - 2012

RESULTS:

ypri = 2.0833 -0.4167 0 -1.0417 0

-0.4167 2.0833 0 0.2083 0

0 0 2.0000 0 0

-1.0417 0.2083 0 3.0208 0

0 0 0 0 5.0000

a= -1 0 0

0 -1 0

0 1 -1

-1 0 0

1 0 -1

Ybus = 8.0208 -0.2083 -5.0000

-0.2083 4.0833 -2.0000

-5.0000 -2.0000 7.0000

Dept of E & E , K.V.G.C.E.Sullia Page 10


Power system simulation Lab Manual - 2012

6. A star connected 3 phase Synchronous Generator 165 MVA 95.2 KV, delivering full load at
0.8 PF lag. Armature resistance = 0.2 Ω/phase, Direct axis reactance =2 Ω/phase and Quadrature
axis reactance = 1.2 Ω. Write MATLAB program to obtain the Power – angle curve. Also obtain
excitation E M F, % regulation, power delivered, reluctance power and total power.(case-1)

7. A star connected 3 phase Synchronous Generator 165 MVA 95.2 KV, delivering full load at
0.8 PF lag. Armature resistance = 0.2 Ω/phase, Direct axis reactance =2 Ω/phase and Quadrature
axis reactance = 2 Ω. Write MATLAB program to obtain the Power – angle curve. Also obtain
excitation E M F, % regulation, power delivered, reluctance power and total power.(case-2)

MATLAB program

vt=input('enter rated terminal voltage per phase=');


va=input('enter rated kva per phase=');
x=input('enter the fraction of full load at which regulation is required=');
pf=input('enter the power factor of load current=');
pfcondition=input('for lagging pf enter 0, leading pf enter 1.for upf enter 1
or 0=');
ra=input('enter armature resistance per phase=');
xd=input('enter the direct axis armature reactance per phase=');
xq=input('enter the quadreture axis armature reactance per phase=');
theta=acos(pf);
if pfcondition==0;
theta=-theta;
else if pfcondition==1;
theta=theta;
else
end
end
im=(x*va*1000)/(vt)
il=im*(exp(j*theta))
ed=vt+(il*(ra+(j*xq)))
edm=abs(ed)
delta=angle(ed)
deltad=delta*180/pi
phi=-theta+delta
ia=abs(il)*exp(j*phi)
iqa=real(ia)
ida=imag(ia)
e=abs(ed)+(ida*(xd-xq))
reg=(e-vt)*100/vt;
pdf=e*vt*sin(delta)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*delta))/(2*xd*xq);
p=pdf+pdh;
fprintf('\n');
fprintf(['internal emf= ' int2str(edm) 'volts']);
fprintf('\n');
fprintf(['power angle= ' int2str(deltad) 'degrees']);
fprintf('\n');
fprintf(['quadrature axis bcomponent of current= ' int2str(iqa) 'amps']);

Dept of E & E , K.V.G.C.E.Sullia Page 11


Power system simulation Lab Manual - 2012

fprintf('\n');
fprintf(['direct axis component of current= ' int2str(ida) 'amps']);
fprintf('\n');
fprintf(['percentage regulation= ' int2str(reg) '%']);
fprintf('\n');
fprintf(['fundamental component of power= ' int2str(pdf) 'watts']);
fprintf('\n');
fprintf(['second harmonic component of power= ' int2str(pdh) 'watts']);
fprintf('\n');
fprintf(['total power= ' int2str(p) 'watts']);
delta=0:pi/100:pi;
deltad=delta*180/pi;
pdf=e*vt*sin(delta)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*delta))/(2*xd*xq);
p=pdf+pdh;
plot(deltad,pdf,deltad,pdh,deltad,p);
grid;
disp(pdf)
disp(pdh)
disp(p)
fprintf(' %7.4f %5.4f\n',[deltad',pdf',pdh',p']');

case-1 Xd=2 & Xq=1.2

power angle curve-2


enter rated terminal voltage per phase=54960
enter rated kva per phase=55000
enter the fraction of full load at which regulation is required=1
enter the power factor of load current=0.8
for lagging pf enter 0, leading pf enter 1.for upf enter 1 or 0=0
enter armature resistance per phase=0.2
enter the direct axis armature reactance per phase=2
enter the quadreture axis armature reactance per phase=1.2

im = 1.0007e+003
il = 8.0058e+002 -6.0044e+002i
ed = 5.5841e+004 +8.4061e+002i
edm = 5.5847e+004
delta = 0.0151
deltad = 0.8625
phi = 0.6586
ia = 7.9145e+002 +6.1242e+002i
iqa = 791.4537
ida = 612.4191
e = 5.6337e+004

internal emf= 55847volts


power angle= 1degrees

Dept of E & E , K.V.G.C.E.Sullia Page 12


Power system simulation Lab Manual - 2012

quadrature axis bcomponent of current= 791amps


direct axis component of current= 612amps
percentage regulation= 3
fundamental component of power= 23302652watts
second harmonic component of power= 15153699watts
total power= 38456351watts 1.0e+009 *

Dept of E & E , K.V.G.C.E.Sullia Page 13


Power system simulation Lab Manual - 2012

Case-2 Xd= Xq=2


internal emf= 56344volts
power angle= 2degrees
quadrature axis component of current= 784amps
direct axis component of current= 621amps
percentage regulation= 3
fundamental component of power= 40700000watts
second harmonic component of power= 0watts
total power= 40700000watts 1.0e+009 *

Dept of E & E , K.V.G.C.E.Sullia Page 14


Power system simulation Lab Manual - 2012

Power angle curve 2


8. A star connected 3 phase Synchronous Generator has voltage = 1pu and delivering 0.5pu
powerat 0.8 PF lag. Direct axis reactance =0.25pu and Quadrature axis reactance = 0.2pu. Write
MATLAB program to obtain the Power – angle curve. Also obtain excitation E M F, %
regulation, power delivered, reluctance power and total power

MATLAB PROGRAM
clc;clear all;close all;
vt=1;
va=0.5;
x=1;
ra=0;
xd=0.25;
xq=0.2;
pf=0.8;
fi=-acos(pf);
im=(x*va)/(vt)
il=im*(exp(j*fi))
ed=vt+(il*(ra+(j*xq)))
edm=abs(ed)
dlt=angle(ed)
dltd=dlt*180/pi
phi=-fi+dlt
ia=abs(il)*exp(j*phi)
iqa=real(ia)
ida=imag(ia)
ema=(abs(ed)+(ida*j*(xd-xq)))*(exp(j*dltd))
e=abs(ema)
reg=(e-vt)*100/vt;
pdf=e*vt*sin(dlt)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*dlt))/(2*xd*xq);
p=pdf+pdh;
fprintf('\n');
fprintf(['internal emf= ' num2str(edm) 'volts']);
fprintf('\n');
fprintf(['power angle= ' num2str(dltd) 'degrees']);
fprintf('\n');
fprintf(['quadrature axis bcomponent of current= ' num2str(iqa) 'amps']);
fprintf('\n');
fprintf(['direct axis component of current= ' num2str(ida) 'amps']);
fprintf('\n');
fprintf(['percentage regulation= ' num2str(reg) '%']);
fprintf('\n');
fprintf(['fundamental component of power= ' num2str(pdf) 'watts']);
fprintf('\n');
fprintf(['second harmonic component of power= ' num2str(pdh) 'watts']);
fprintf('\n');
fprintf(['total power= ' num2str(p) 'watts']);

Dept of E & E , K.V.G.C.E.Sullia Page 15


Power system simulation Lab Manual - 2012

dlt=0:pi/50:pi;
dltd=dlt*180/pi;
pdf=e*vt*sin(dlt)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*dlt))/(2*xd*xq);
p=pdf+pdh;
plot(dltd,pdf/1000,dltd,pdh/1000,dltd,p/1000);
legend('fundamental component of power','harmonic component of power','total
power')
grid;
xlabel('delta in degrees-------------->')
ylabel('power in mw------------------>')
title('power angle curve')

Results:

internal emf= 1.063volts

power angle= 4.316degrees

quadrature axis bcomponent of current= 0.37629amps

direct axis component of current= 0.32925amps

percentage regulation= 6.3142

fundamental component of power= 0.32004watts

second harmonic component of power= 0.075044watts

total power= 0.39508watts

Dept of E & E , K.V.G.C.E.Sullia Page 16


Power system simulation Lab Manual - 2012

9. . A star connected 3 phase Synchronous Generator has voltage = 1pu and delivering 0.5pu
power at 0.8 PF lag. Direct axis reactance =0.25pu and Quadrature axis reactance = 0.25pu.
Write MATLAB program to obtain the Power – angle curve. Also obtain excitation E M F, %
regulation, power delivered, reluctance power and total power

When Xd=Xq=0.25

internal emf= 1.0796volts

power angle= 5.3145degrees

quadrature axis bcomponent of current= 0.37049amps

direct axis component of current= 0.33576amps

percentage regulation= 7.9641

fundamental component of power= 0.4watts

second harmonic component of power= 0watts

total power= 0.4watts

Dept of E & E , K.V.G.C.E.Sullia Page 17


Power system simulation Lab Manual - 2012

Power angle curve-3


10.A star connected 3 phase Synchronous Generator 100 MVA 11 KV has Ra = 0.2 Ω/phase, Xd
= 4 Ω/phase, and Xq = 4 Ω/phase is operating at 0.8 PF lag. Write a MATLAB Program to
determine Excitation E M F, Regulation, Fundamental component of Power, Harmonic power
and total Power. Also plot Power- angle diagram

vt=11000;
va=33333;
x=1;
ra=0.2;
xd=4;
xq=3;
pf=0.8;
fi=-acos(pf);
im=(x*va*1000)/(vt)
il=im*(exp(j*fi))
ed=vt+(il*(ra+(j*xq)))
edm=abs(ed)
dlt=angle(ed)
dltd=dlt*180/pi
phi=-fi+dlt
ia=abs(il)*exp(j*phi)
iqa=real(ia)
ida=imag(ia)
e=abs(ed)+(ida*(xd-xq))
reg=(e-vt)*100/vt;
pdf=e*vt*sin(dlt)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*dlt))/(2*xd*xq);
p=pdf+pdh;
dlt=0:pi/50:pi;
dltd=dlt*180/pi;
pdf=e*vt*sin(dlt)/xd;
pdh=(vt*vt*(xd-xq)*sin(2*dlt))/(2*xd*xq);
p=pdf+pdh;
plot(dltd,pdf/1000,dltd,pdh/1000,dltd,p/1000);grid;

Power angle curve-03 input data


enter rated terminal voltage per phase=11000
enter rated kva per phase=33333
enter the fraction of full load at which regulation is required=1
enter the power factor of load current=0.8
for lagging pf enter 0, leading pf enter 1.for upf enter 1 or 0=0
enter armature resistance per phase=0.2
enter the direct axis armature reactance per phase=4

Dept of E & E , K.V.G.C.E.Sullia Page 18


Power system simulation Lab Manual - 2012

enter the quadreture axis armature reactance per phase=3


results
im = 3.0303e+003
il = 2.4242e+003 -1.8182e+003i
ed = 1.6939e+004 +6.9090e+003i
edm = 1.8294e+004
delta = 0.3873
deltad = 22.1890
phi = 1.0308
ia = 1.5580e+003 +2.5991e+003i
iqa = 1.5580e+003
ida = 2.5991e+003
e = 2.0893e+004

internal emf= 18294volts


power angle= 22degrees
quadrature axis bcomponent of current= 1558amps
direct axis component of current= 2599amps
percentage regulation= 90
fundamental component of power= 21699118watts
second harmonic component of power= 3526086watts
total power= 25225204watts 1.0e+007 *

Dept of E & E , K.V.G.C.E.Sullia Page 19


Power system simulation Lab Manual - 2012

11.A star connected 3 phase Synchronous Generator 100 MVA 11 KV has Ra = 0.2 Ω/phase, Xd
= 4 Ω/phase, and Xq = 4 Ω/phase is operating at 0.8 PF lag. Write a MATLAB Program to
determine Excitation E M F, Regulation, Fundamental component of Power, Harmonic power
and total Power. Also plot Power- angle diagram

When Xd=Xq=4

internal emf= 20951.2078volts

power angle= 26.4537degrees

quadrature axis bcomponent of current= 1360.4424amps

direct axis component of current= 2707.7203amps

percentage regulation= 90.4655

fundamental component of power= 25666410watts

second harmonic component of power= 0watts

total power= 25666410watts

Dept of E & E , K.V.G.C.E.Sullia Page 20


Power system simulation Lab Manual - 2012

12. Write a MATLAB program to obtain the bus currents, line flows and line losses

Ybus=[ 5.882+23.582i -2.94+11.764i -2.94+11.764i ;


-2.94+11.764i 5.882+23.582i -2.94+11.764i;
-2.94+11.764i -2.94+11.764i 5.882+23.582i]

Vbus=[1.04; 1.0; 1.0]

MATLAB program
clc;clear all;close all;
noofbus=3;
noofline=3;
Ybus=[5.882+23.582i -2.94+11.764i -2.94+11.764i;-2.94+11.764i 5.882+23.582i -
2.94+11.764i;-2.94+11.764i -2.94+11.764i 5.882+23.582i];
Vbus=[1.04;1.0;1.0];
Ibus=Ybus*Vbus;
Sbus=diag(Vbus)*Ibus;
pbus=real(Sbus) ; %P+Qi
qbus=imag(Sbus);
Ploss=sum(pbus);
Qloss=sum(qbus);
for k=1:noofbus
fprintf(['bus number',num2str(k)]);
fprintf('\n')
fprintf(['bus voltage=',num2str(Vbus(k)),'volts'])
fprintf('\n')
fprintf(['bus current=',num2str(Ibus(k)),'amps'])
fprintf('\n')
fprintf(['activepower=',num2str(pbus(k)),'watts'])
fprintf('\n')
fprintf(['reactive power=',num2str(qbus(k)),'watts'])
fprintf('\n\n')
end
for k=1:noofline
fprintf(['Line Number:',int2str(k),'\n']);
b=input('enter frpm bus=');
d=input('enter to bus=');
hlc=input('enter the half line charging admittance=');
Ibd=(Vbus(b)-Vbus(d))*Ybus(b,d)+(Vbus(b)*hlc);
Idb=(Vbus(d)-Vbus(b))*Ybus(d,b)+(Vbus(d)*hlc);
Sbd=(Vbus(b))*(conj(Ibd));
Sdb=(Vbus(d))*conj(Idb);
Sloss=Sbd+Sdb;
fprintf(['line current=' num2str(Ibd)]);
fprintf('\n')
fprintf(['real power from bus' num2str(b) 'to' num2str(d),'=',
num2str(real(Sbd))]);
fprintf('\n')
fprintf(['reactive power from' num2str(b) 'to' num2str(d),'=',
num2str(imag(Sbd))]);
fprintf('\n')

Dept of E & E , K.V.G.C.E.Sullia Page 21


Power system simulation Lab Manual - 2012

fprintf(['real power from' num2str(d) 'to' num2str(b),'=',


num2str(real(Sdb))]);
fprintf('\n')
fprintf(['reactive power from' num2str(d) 'to' num2str(b),'=',
num2str(imag(Sdb))])
fprintf('\n\n\n')
end

OUTPUT
bus number1
bus voltage=1.04volts
bus current=0.23728+48.0533iamps
activepower=0.24677watts
reactive power=49.9754watts

bus number2
bus voltage=1volts
bus current=-0.1156+47.5806iamps
activepower=-0.1156watts
reactive power=47.5806watts

bus number3
bus voltage=1volts
bus current=-0.1156+47.5806iamps
activepower=-0.1156watts
reactive power=47.5806watts

Line Number:1
enter frpm bus=1
enter to bus=2
enter the half line charging admittance=0
line current=-0.1176+0.47056i
real power from bus1to2=-0.1223
reactive power from1to2=-0.48938
real power from2to1=0.1176
reactive power from2to1=0.47056

Line Number:2
enter frpm bus=1
enter to bus=3
enter the half line charging admittance=0
line current=-0.1176+0.47056i
real power from bus1to3=-0.1223

Dept of E & E , K.V.G.C.E.Sullia Page 22


Power system simulation Lab Manual - 2012

reactive power from1to3=-0.48938


real power from3to1=0.1176
reactive power from3to1=0.47056

Line Number:3
enter frpm bus=2
enter to bus=3
enter the half line charging admittance=0
line current=0
real power from bus2to3=0
reactive power from2to3=0
real power from3to2=0
reactive power from3to2=0

Dept of E & E , K.V.G.C.E.Sullia Page 23


Power system simulation Lab Manual - 2012

13. swing curve-RK method

Data for a single machine connected to infinite bus is given below. Mechanical input given is 1.2pu, pre
fault power Pe0 = 1.2pu. Power during fault is 0.pu. Power after the fault is cleared is 1.9pu. Inertial
constant of machine is 4MJ/MVA. . Write a MATLAB program to obtain the swing curve for a sustained
fault over the period of 0.5sec. take no of iterations as 25. Xpre=0.28pu

MATLAB program

clear all;
pe0=1.2;pe1=0;pe2=1.9;pm=1.2;h=4;k=25;tfn=0.5;e=1.2;xpre=0.28
b=input('enter 0 for sustained fault and 1 for fault is cleared')
if b==1
tc=input('enter fault clearing time=')
else
tc=tfn+0.01
end
d(1,1)=asin(pm*xpre/pe0)
w(1,1)=2*pi*50
d0=d(1,1)
n=1,a=1;
t=0:tfn/k:tfn;
while a==1
if t(1,n)<tc
pem=pe1
else
pem=pe2
end
k1=(w(1,n)-(2*pi*50))*0.02
L1=(pm-pem)*(pi*50/h)*0.02
k2=((w(1,n)+(L1/2))-(2*pi*50))*0.02
L2=(pm-pem)*(pi*50/h)*0.02
k3=((w(1,n)+(L2/2))-(2*pi*50))*0.02
L3=(pm-pem)*(pi*50/h)*0.02
k4=((w(1,n)+(L3))-(2*pi*50))*0.02
L4=(pm-pem)*(pi*50/h)*0.02
d(1,n+1)=d(1,n)+(k1+(2*k2)+(2*k3)+k4)*(1/6)
w(1,n+1)=w(1,n)+(L1+(2*L2)+(2*L3)+L4)*(1/6)
n=n+1
if k>=n
a=1
else
a=2
end
end
fprintf(' %7.4f %5.4f\n',[d*180/pi;t])
plot(t,d*180/pi)

Dept of E & E , K.V.G.C.E.Sullia Page 24


Power system simulation Lab Manual - 2012

%swing curve-RK method-


sustained fault
delta time
16.2602 0.0000
16.7102 0.0200
18.2402 0.0400
20.8502 0.0600
24.5402 0.0800
29.3102 0.1000
35.1602 0.1200
42.0902 0.1400
50.1002 0.1600
59.1902 0.1800
69.3602 0.2000
80.6102 0.2200
92.9402 0.2400
106.3502 0.2600
120.8402 0.2800
136.4102 0.3000
153.0602 0.3200
170.7902 0.3400
189.6002 0.3600
209.4902 0.3800
230.4602 0.4000
252.5102 0.4200
275.6402 0.4400
299.8502 0.4600
325.1402 0.4800
351.5102 0.5000

Dept of E & E , K.V.G.C.E.Sullia Page 25


Power system simulation Lab Manual - 2012

14. Data for a single machine connected to infinite bus is given below. Mechanical input given is 1.2pu,
pre fault power Pe0 = 1.2pu. Power during fault is 0.pu. Power after the fault is cleared is 1.9pu.
Inertial constant of machine is 4MJ/MVA. A 3 phase fault is cleared at 0.1sec. Write a MATLAB program
to obtain the swing curve over the period of 0.5sec. take no of iterations as 25.
Xpre=0.28pu

Swing curve-RK method-


Fault Cleared with tc=0.1
delta time
16.2602 0.0000
16.7102 0.0200
18.2402 0.0400
20.8502 0.0600
24.5402 0.0800
29.3102 0.1000
34.4477 0.1200
38.9552 0.1400
42.8327 0.1600
46.0802 0.1800
48.6977 0.2000
50.6852 0.2200
52.0427 0.2400
52.7702 0.2600
52.8677 0.2800
52.3352 0.3000
51.1727 0.3200
49.3802 0.3400
46.9577 0.3600
43.9052 0.3800
40.2227 0.4000
35.9102 0.4200
30.9677 0.4400
25.3952 0.4600
19.1927 0.4800
12.3602 0.5000

Dept of E & E , K.V.G.C.E.Sullia Page 26


Power system simulation Lab Manual - 2012

JACOBIAN MATRIX

clc;clear all;close all


nb=input('enter the number of buses in the system= ');
yb=zeros(nb,nb);
vb=zeros(nb,1);
vd=zeros(nb,1);
h=0;
fprintf('\n\n');
yb=[5.882-23.528i -2.94+11.76i -2.94+11.76i;
-2.94+11.76i 5.882-23.528i -2.94+11.76i;
-2.94+11.76i -2.94+11.76i 5.882-23.528i]
vb=[1.04+0i;1+0i;1.04;]
fprintf('\n\n');
fprintf(' data for elements of bus admittance matrix(Ybus)');
ym=abs(yb);
ya=-angle(yb);
vm=abs(vb);
va=angle(vb);
cpd=zeros(nb,nb);
cpv=zeros(nb,nb);
cqd=zeros(nb,nb);
cqv=zeros(nb,nb);
%calculation of elements of J1
for pp=2:nb;
for qq=1:nb;
if qq~=pp;
cpd(pp,qq)=vm(pp)*vm(qq)*ym(pp,qq)*sin((ya(pp,qq)+va(pp)-
va(qq)));%off diagonal
else
end
end
end
for pp=2:nb;
s=zeros(1,nb);
for qq=1:nb;
if qq~=pp;
s(1,qq)=-vm(pp)*vm(qq)*ym(pp,qq)*sin((ya(pp,qq)+va(pp)-
va(qq)));%diagonal
else
end
end
cpd(pp,pp)=sum(s);
end
cpd;
cpdf=cpd(2:nb,2:nb)
%calculation of elements of J2
for pp=2:nb;
for qq=1:nb;
if qq~=pp;
cpv(pp,qq)=vm(pp)*ym(pp,qq)*cos((ya(pp,qq)+va(pp)-va(qq)));%off
diagonal element
else

Dept of E & E , K.V.G.C.E.Sullia Page 27


Power system simulation Lab Manual - 2012

end
end
end
for pp=2:nb;
s=zeros(1,nb);
for qq=1:nb;
if qq~=pp;
s(1,qq)=vm(qq)*ym(pp,qq)*cos((ya(pp,qq)+va(pp)-
va(qq)));%diagonal
else
end
end
cpv(pp,pp)=2*(vm(pp)*ym(pp,pp)*cos(ya(pp)))-sum(s);
end
cpv;
cpvf=cpv(2:nb,2:nb)

%calculation of elements of J3
for pp=2:nb;
for qq=1:nb;
if qq~=pp;
cqd(pp,qq)=-vm(pp)*vm(qq)*ym(pp,qq)*cos((ya(pp,qq)+va(pp)-
va(qq)));% diagonal element
else
end
end
end
for pp=2:nb;
s=zeros(1,nb);
for qq=1:nb;
if qq~=pp;
s(1,qq)=vm(pp)*vm(qq)*ym(pp,qq)*cos((ya(pp,qq)+va(pp)-
va(qq)));
else
end
end
cqd(pp,pp)=sum(s);%diagonal element
end
cqd;
cqdf=cqd(2:nb,2:nb)
%calculation of elements of J4
for pp=2;
for qq=1:nb;
if qq~=pp;
cqv(pp,qq)=vm(pp)*ym(pp,qq)*sin((ya(pp,qq)+va(pp)-va(qq)));% off
diagonal element
else
end
end
end
for pp=2;
s=zeros(1,nb);
for qq=1:nb;

Dept of E & E , K.V.G.C.E.Sullia Page 28


Power system simulation Lab Manual - 2012

if qq~=pp;
s(1,qq)=vm(qq)*ym(pp,qq)*sin((ya(pp,qq)+va(pp)-va(qq)));
else
end
end
cqv(pp,pp)=-2*(vm(pp)*ym(pp,pp)*sin(ya(pp)))+(sum(s));%diagonal
element
end
cqv;
cqvf=cqv(2:nb,2:nb);
jacobian=[cpdf cpvf;cqdf cqvf]

OUTPUT OF JACOBIAN MATRIX PROGRAM

enter the number of buses in the system= 3


yb =
5.8820 -23.5280i -2.9400 +11.7600i -2.9400 +11.7600i
-2.9400 +11.7600i 5.8820 -23.5280i -2.9400 +11.7600i
-2.9400 +11.7600i -2.9400 +11.7600i 5.8820 -23.5280i
vb =
1.0400
1.0000
1.0400
data for elements of bus admittance matrix(Ybus)
cpdf =
24.4608 -12.2304
-12.2304 24.9500
cpvf =
-5.6488 -2.9400
-3.0576 -6.2370
cqdf =
-6.1152 3.0576
3.0576 -6.2375
jacobian =
24.4608 -12.2304 -5.6488 -2.9400
-12.2304 24.9500 -3.0576 -6.2370
-6.1152 3.0576 22.5952 -11.7600
3.0576 -6.2375 0 0

Dept of E & E , K.V.G.C.E.Sullia Page 29