Power System Simulation Lab I Report: Hawassa University
Power System Simulation Lab I Report: Hawassa University
Institute of Technology
School of Electrical & Computer Engineering
Power System And Energy Engineering
4,2016
power system simulation lab I Report
Submitted to
Dr.Slochnal
power system simulation lab I 4,2016
Contents
1.3. Algorithm of YBUS[formation of admittance matrix].................................................................3
1.3.1. Lab#1 without Reference:.........................................................................................................3
1.3.2. Lab#2 with Reference (Take Bus 5 as Reference).....................................................................4
1.3.3. Lab#3 with Reference mutual coupling (Take Bus 5 as Reference)...........................................5
1.4. Algorithm for GS method.................................................................................................................6
1.4. 1. Case (a): Systems with PQ buses present:....................................................................................6
1.4.1.1 Lab#4 PQ bus..............................................................................................................................6
1.4.2. Case (b): Systems with PV buses also present:..............................................................................7
1.4.2.1. Lab#5PV bus..........................................................................................................................8
1.5. Newton Raphson Method..............................................................................................................10
1.6. Fast Decouple Load Flow Method (FDLF)....................................................................................14
1.7. Symmetrical Fault analysis algorithm............................................................................................17
1.8. Unsymmetrical Fault analysis algorithm........................................................................................20
1.8.1.Single Line to Ground Fault.............................................................................................................20
1.8.2.Line to line Fault.......................................................................................................................22
1.8.3.Double Line to ground Fault.....................................................................................................25
6
power system simulation lab I 4,2016
1.3. Algorithm of YBUS[formation of admittance matrix]
6
power system simulation lab I 4,2016
YBus =
2.9308 - 0.9614i -1.8349 + 0.5505i -1.0959 + 0.4110i 0
-1.8349 + 0.5505i 3.0898 - 4.9034i -0.6667 + 2.0000i -0.5882 + 2.3529i
-1.0959 + 0.4110i -0.6667 + 2.0000i 4.1764 - 3.4454i -2.4138 + 1.0345i
0 -0.5882 + 2.3529i -2.4138 + 1.0345i 3.0020 - 3.3874i
1.3.2. Lab#2 with Reference (Take Bus 5 as Reference)
zdata=[1 0 1 0.5+j*0.15; 2 0 2 0.8+j*0.3;3 1 2 0.15+j*0.45;4 1 3 0.1+j*0.4; 5 2 3 0.35+j*0.15];
elements=max(zdata(:,1));
zprimitive=zeros(elements,elements);
for i=1:elements,
zprimitive(i,i)=zdata(i,4);
end
yprimitive=inv(zprimitive);
buses=max(max(zdata(:,2)),max(zdata(:,3)));
A=zeros(elements,buses);
for i=1:elements,
if (zdata(i,2)~=0)
A(i,zdata(i,2))=1;
end
if (zdata(i,3)~=0)
A(i,zdata(i,3))=-1;
end
end
A
Ybus=A'*yprimitive*A
A=
-1 0 0
0 -1 0
1 -1 0
1 0 -1
0 1 -1
Ybus =
3.0898 - 4.9034i -0.6667 + 2.0000i -0.5882 + 2.3529i
-0.6667 + 2.0000i 4.1764 - 3.4454i -2.4138 + 1.0345i
-0.5882 + 2.3529i -2.4138 + 1.0345i 3.0020 - 3.3874i
6
power system simulation lab I 4,2016
A=
1 -1 0 0
1 0 -1 0
0 1 -1 0
0 1 0 -1
0 0 1 -1
Ybus =
2.9308 - 0.9614i -1.8349 + 0.5505i -1.0959 + 0.4110i 0
-1.8349 + 0.5505i 3.0898 - 4.9034i -0.6667 + 2.0000i -0.5882 + 2.3529i
-1.0959 + 0.4110i -0.6667 + 2.0000i 4.1764 - 3.4454i -2.4138 + 1.0345i
0 -0.5882 + 2.3529i -2.4138 + 1.0345i 3.0020 - 3.3874i
6
power system simulation lab I 4,2016
1.4. Algorithm for GS method
6
power system simulation lab I 4,2016
delv=v(i)-vold(i);
vacc(i)=vold(i)+1.6*delv;
%diff=max((abs(vacc(2:n))-abs(vold(2:n))));
vold(i)=vacc(i);
end
noofiter;
v1=vacc(1)
v2=vacc(2)
v3=vacc(3)
noofiter=noofiter+1;
end
v1 =
1.0500
v2 =
0.9722 - 0.0494i, from book=V 2(1)=0.98256− j0.0387
v3 =
0.9940 - 0.0726i, from book=V 3(1) =0.9989− j0.0453629
v1 =
1.0500
v2 =
0.9789 - 0.0894i, from book=V 2(2) =0.98126− j 0.05226
v3 =
1.0036 - 0.0611i, from book=V 3(2) =0.9999− j 0.0469
changed, so again calculate voltage magnitude and phase angle using Qi(k+1).
6
power system simulation lab I 4,2016
1
V (ik+1)= ¿
Y ii
7. Take only phase angle and maintain the voltage magnitude at PV bus only.
6
power system simulation lab I 4,2016
end
if (qcal(i)>qlimitmax(i)),
q(i)=qlimitmax(i);
type(i)=1;
typechanged=1;
end
if(qcal(i)>qlimitmin(i)|(qcal(i)<qlimitmax(i)))
q(i)=qcal(i);
type(i)=2;
typechanged(i)=0;
end
end
sumyv=0;
for k=1:n
if (i~=k)
sumyv=sumyv+ybus(i,k)*vacc(k);
end
end
%ybus(i,i)
%p(i)
%q(i)
%vacc(i)
v(i)=1/ybus(i,i)*(((p(i)-j*q(i))/conj(vacc(i)))-sumyv);
%acceleration factor=1
delv=v(i)-vold(i);
vacc(i)=vold(i)+1*delv;
if (type(i)==2)
b=atan(imag(vacc(i))/real(vacc(i)));
%polar to rectangular conversion
vacc(i)=vmagfixed(i)*(cos(b)+j*sin(b));
vold(i)=vacc(i);
end
end
noofiter;
v1=vacc(1)
v2=vacc(2)
v3=vacc(3)
noofiter=noofiter+1;
%delv(2:n);
%delv2=delv(2);
%delv3=delv(3);
%abs(delv(2:n));
%diff=max(abs(vacc(2:n)-abs(vold(2:n))))
end
6
power system simulation lab I 4,2016
v1 =
1.0500
v2 =
1.0295 - 0.0329i,from book=V 2(1)=1.02897− j0.0454874
v3 =
1.0246 - 0.0315i,from book=V 3(1) =1.029302− j 0.0491933
v1 =
1.0500
v2 =
1.0289 - 0.0477i,from book=V 2(2) =1.023216− j0.0611087
v3 =
1.0243 - 0.0340i,from book=V 3(2) =1.02− j0.03194278
6
power system simulation lab I 4,2016
Step 12: Display the output.
Step 13: End the Program.
%NEWTON RAPHSON METHOd
%load flow stability exercise 4
nb=3; %input(' Enter the number of buses= ')
Ybus=[20-j*50 -10+j*20 -10+j*30
-10+j*20 26-j*52 -16+j*32
-10+j*30 -16+j*32 26-j*62];
Ybusmag=abs(Ybus);
Ybusang=angle(Ybus)*(180/pi);
% Calculation of P and Q
v=[1.05 1.04 1];
Pold=[0 -4 2];
Qold=[0 0 -2.5];
P=[0 0 0];
Q=[0 0 0];
del=[0 0 0];
for p=2:nb
for q=1:nb
P(p)=P(p)+(v(p)*v(q)*Ybusmag(p,q)*cos(del(p)+angle(Ybus(p,q))-del(q)));
Q(p)=(Q(p)+(v(p)*v(q)*Ybusmag(p,q)*sin(del(p)-angle(Ybus(p,q))-del(q))));
delP(p)=Pold(p)-P(p);
delQ(p)=Qold(p)-Q(p);
end
end
P;
Q;
delP;
delQ;
%Calculation of J1
P2=[0 0 0];
for p=2:nb
for q=2:nb
if(p==q)
P1=2*v(p)*Ybusmag(p,q)*cos(angle(Ybus(p,q)));
for j=1:nb
if (j~=p)
P2(q)=P2(q)+v(j)*Ybusmag(q,j)*cos(del(q)+angle(Ybus(q,j))-del(j));
PV(p,q)=P1+P2(q);
end
end
else
PV(p,q)=v(p)*Ybusmag(p,q)*cos(del(p)+angle(Ybus(p,q))-del(q));
6
power system simulation lab I 4,2016
end
end
end
PV;
% Calculation of J2
Pdel=[0 0 0;0 0 0;0 0 0];
for p=2:nb
for q=2:nb
if(p==q)
for j=1:nb
if(j~=p)
Pdel(p,q)=Pdel(p,q)-v(j)*v(q)*Ybusmag(q,j)*sin(del(q)-angle(Ybus(p,j))-del(j));
end
end
else
Pdel(p,q)=-v(p)*v(q)*Ybusmag(p,q)*sin(del(p)+angle(Ybus(p,q))-del(q));
end
end
end
Pdel;
%Calculation of J3
Q2=[0 0 0];
for p=2:nb
for q=2:nb
if(p==q)
Q1=2*v(p)*Ybusmag(p,q)*sin(-angle(Ybus(p,q)));
for j=1:nb
if (j~=p)
Q2(q)=Q2(q)+v(j)*Ybusmag(q,j)*sin(del(q)-angle(Ybus(q,j))-del(j));
QV(p,q)=Q1+Q2(q);
end
end
else
QV(p,q)=v(p)*Ybusmag(p,q)*sin(del(p)-angle(Ybus(p,q))-del(q));
end
end
end
QV;
%Calculation of J4
Qdel=[0 0 0;0 0 0;0 0 0];
for p=2:nb
for q=2:nb
if(p==q)
for j=1:nb
if(j~=p)
Qdel(p,q)=Qdel(p,q)+v(j)*v(q)*Ybusmag(q,j)*cos(del(q)+angle(Ybus(p,j))-del(j));
6
power system simulation lab I 4,2016
end
end
else
Qdel(p,q)=-v(p)*v(q)*Ybusmag(p,q)*cos(del(p)+angle(Ybus(p,q))-del(q));
end
end
end
Qdel;
%Jacobian matrix
PV(1,:)=[ ];
PV(:,1)=[ ];
Pdel(1,:)=[ ];
Pdel(:,1)=[ ];
QV(1,:)=[ ];
QV(:,1)=[ ];
Qdel(1,:)=[ ];
Qdel(:,1)=[ ];
J=[PV Pdel;QV Qdel]
%Find the change in v&del
delP(1:1)=[];
delQ(1:1)=[];
delpq=[delP';delQ']
vdel=inv(J)*delpq
%Find new v&del
for i=1:nb-1
for j=2:nb
vnew(i)=v(j)+vdel(i);
delnew(i)=del(j)+vdel(i+2);
end
end
VNEW=[v(1) vnew]
DELNEW=[del(1) delnew]
J=
27.5800 -16.6400 55.1200 -33.2800
-16.0000 24.8600 -33.2800 64.7800
55.1600 -33.2800 -27.5600 16.6400
-32.0000 59.2200 16.6400 -27.1400
delpq =
-4.5616
3.1400
-1.1232
6
power system simulation lab I 4,2016
0.2800
vdel =
-0.0517
-0.0038
-0.0516
0.0106
VNEW =
1.0500 0.9483 0.9962
DELNEW =
0 -0.0516 0.0106
6
power system simulation lab I 4,2016
type=ones(n,1);
typechanged=zeros(n,1);
Qlimitmax=zeros(n,1);
Qlimitmin=zeros(n,1);
vmagold=[1.4 1.0 1.04];
vmagfixed=zeros(n,1);
pical=zeros(n,1);
deltaP=zeros(n,1);
delold=zeros(n,1);
Qcal=zeros(n,1);
deltaQ=zeros(n,1);
deltavmag=zeros(n,1);
vacc=vold;
type(2)=3;
Qlimitmax(2)=5.5;
Qlimitmin(2)=0.0;
vmagfixed(2)=1.1;
%diff=10;
noofiter=1;
%while (noofiter<2),
for i=2:n,
sumi=0;
if type(i)==2 ||typechanged(i)==1
for k=1:n;
sumi=sumi+ybus(i,k)*vacc(k);
end
Qcal=-imag(conj(vacc(i))*sumi);
if (Qcal<Qlimitmin(i,1))
type(i)=1;
typechanged(i)=1;
Q(i)=Qlimitmin(i,1);
if (Qcal>Qlimitmax(i,1))
type(i)=1;
typechanged(i)=1;
Q(i)=Qlimitmax(i,1);
if (Qcal>Qlimitmin(i,1) ||Qcal<Qlimitmax(i,1));
type(i)=2;
typechanged(i)=2;
Q(i)=Qcal;
end
end
end
end
sumi=0;
for k=1:n,
sumi=sumi+ybus(i,k)*vacc(k);
6
power system simulation lab I 4,2016
end
pical(i)=real(conj(vacc(i))*sumi);
deltaP(i)=[P(i)-pical(i)];
deltaP(i)=deltaP(i)/vacc(i);
end
deltap2=deltaP(2);
deltaP3=deltaP(3);
deltaP=deltaP(2:n,1);
AB=-[B(2:n,2:n)];
inv(AB);
deltadel=inv(AB)*deltaP;
for i=1:n-1,
delnew(i)=delold(i)+deltadel(i);
delold(i)=delnew(i);
end
del2=delnew(1)
del3=delnew(2)
for i=2:n,
sumi=0;
if type(i)==1&typechanged==0
i;
m=i
for k=1:n,
sumi=sumi+ybus(i,k)*vacc(k);
end
Qcal(i)=-imag(conj(vacc(i))*sumi);
deltaQ(i)=[Q(i)-Qcal(i)];
deltaQ(i)=deltaQ(i)/abs(vacc(i));
end
end
for i=2:n,
if (typechanged==1)
i;
x=i
deltaQ(i)=[Q(i)-Qcal(i)];
deltaQ(i)=deltaQ(i)/abs(vacc(i));
end
end
for i=2:m,
AB=-[B(2:m,2:m)];
deltavmag=inv(AB)*deltaQ(i);
vmagnew=vmagold(1,i)+deltavmag;
end
vmagnew2=vmagnew
del2 =
0.2045
6
power system simulation lab I 4,2016
del3 =
-0.2627
vmagnew2 =
1.0376 1.0388
1.0388 1.0364
6
power system simulation lab I 4,2016
vp=[1+j*0 1+j*0 1+j*0];
va=zeros(n,1)%voltage at the healthy
%buses during fault=vr(f)
I=zeros(n,1);
%zbus(k,i)=impedance between the healthy
%bus k and the faulted bus i
for i=1:n,
for k=1:n,
if (k~=i)
i;
k;
%voltage at the healthy buses during fault
va(k)=vp(k)-(zbus(k,i)*Ifc(i));
van=[va(1) va(2) va(3)]
end
end
end
%I(i)=current flowing from bus i to bus k
for i=1:n,
for k=1:n,
i;
k;
%voltage at the buses during fault
va(k)=vp(k)-(zbus(k,i)*Ifc(i));
vak=[va(1) va(2) va(3)];
va(i)=vp(i)-(zbus(i,i)*Ifc(i));
va=[va(1) va(2) va(3)]
I(k)=(va(k)-va(i))/zbus(k,i);
I=[I(1) I(2) I(3)]
end
end
Ifc1 =
0.7727 90.0000
Ifc2 =
2.3356 90.0000
Ifc3 =
3.4801 90.0000
va =
0
0
0
van =
0 0.8030 0
van =
6
power system simulation lab I 4,2016
0 0.8030 0.8635
van =
0.4045 0.8030 0.8635
van =
0.4045 0.8030 0.5874
van =
0.3852 0.8030 0.5874
van =
0.3852 0.3852 0.5874
va =
0.1338 0.3852 0.5874
I=
0 0 0
va =
0.1338 0.8030 0.5874
I=
0 0 - 2.6246i 0
va =
0.1338 0.8030 0.8635
I=
0 0 - 2.6246i 0 - 4.1301i
va =
0.4045 0.4045 0.8635
I=
0 0 - 2.6246i 0 - 4.1301i
va =
0.4045 0.4045 0.8635
I=
0 0 0 - 4.1301i
va =
0.4045 0.4045 0.5874
I=
0 0 0 - 1.0350i
va =
0.3852 0.4045 0.6028
I=
0 + 1.2317i 0 0 - 1.0350i
va =
0.3852 0.3852 0.6028
I=
0 + 1.2317i 0 + 1.2317i 0 - 1.0350i
va =
0.3852 0.3852 0.6028
I=
0 + 1.2317i 0 + 1.2317i 0
6
power system simulation lab I 4,2016
1.8. Unsymmetrical Fault analysis algorithm
7. calculate zero, positive and negative sequence voltages as shown bellow respectively
6
power system simulation lab I 4,2016
z2=j*1.9;
z0=j*3.4;
vp=zeros(n,1);
vs=zeros(n,1);
a=-0.5+j*0.866;
%%b=a*a
b=a^2;
A=[1 1 1;1 b a;1 a b];
%a)for single line to ground fault
Ia1=e/(z0+z1+z2);
Ia2=Ia1;
Ia0=Ia1;
Ia=Ia0+Ia1+Ia2;
I012=[Ia0;Ia1;Ia2]
va1=e-Ia1*z1;
va2=-Ia2*z2;
va0=-Ia0*z0;
V012=[va0;va1;va2]
Vabc=A*V012;
va=Vabc(1,1);
vb=Vabc(2,1);
vc=Vabc(3,1);
%line to line voltages at fault point are
vab=va-vb;
vbc=vb-vc;
vca=vc-va;
Vlv=[vab;vbc;vca]
%rectangular to polar conversion
V012p=[abs(V012), angle(V012)*180/pi]
Vlvp=[abs(Vlv),angle(Vlv)*180/pi]
%the actula values of line to line post fault voltages are
vabcactual=Vabc*((bkv*10^3)/sqrt(3));
Vabcp=[abs(vabcactual),angle(vabcactual)*180/pi];
%calculation of fault current for 3-fault let Ifc is fault current
Ifc=e/z1
I012p=[abs(I012), angle(I012)*180/pi]
Iabc=A*I012;
Iabcp=[abs(Iabc), angle(Iabc)*180/pi]
Iabcactual=[Iabc*basecurrent]
I012 =
0 - 0.1333i
0 - 0.1333i
0 - 0.1333i
V012 =
-0.4533
0.7067
6
power system simulation lab I 4,2016
-0.2533
Vlv =
0.6800 + 0.8314i
0.0000 - 1.6627i
-0.6800 + 0.8314i
V012p =
0.4533 180.0000
0.7067 0
0.2533 180.0000
Vlvp =
1.0740 50.7203
1.6627 -89.9985
1.0740 129.2815
Ifc =
0 - 0.4545i
I012p =
0.1333 -90.0000
0.1333 -90.0000
0.1333 -90.0000
Iabcp =
0.4000 -90.0000
0.0000 -90.0000
0.0000 -90.0000
Iabcactual =
1.0e+002 *
0 - 6.2984i
0 - 0.0001i
0 - 0.0001i
1.8.2.Line to line Fault
Algorithm
6
power system simulation lab I 4,2016
6. Calculate fault current as follows
6
power system simulation lab I 4,2016
vb=vp(2,1);
vc=vp(3,1);
vabc=[va vb vc]
%actual line to neutral currents at the point are
Iamag=abs(Ia);
delIa=atan(imag(Ia)/real(Ia))*180/pi;
Iaactual=Ia*basecurrent;
Iaactualmag=abs(Iaactual);
delIaactual=atan(imag(Iaactual)/real(Iaactual))*180/pi;
Ibmag=abs(Ib);
delIb=atan(imag(Ib)/real(Ib))*180/pi;
Ibactual=Ib*basecurrent;
Ibactualmag=abs(Ibactual);
delIbactual=atan(imag(Ibactual)/real(Ibactual))*180/pi;
Icmag=abs(Ic);
delIc=atan(imag(Ic)/real(Ic))*180/pi;
Icactual=Ic*basecurrent;
Icactualmag=abs(Icactual);
delIcactual=atan(imag(Icactual)/real(Icactual))*180/pi;
%actual line to neutral voltages at the point are
vamag=abs(va);
delva=atan(imag(va)/real(va))*180/pi;
vbmag=abs(vb);
delvb=atan(imag(vb)/real(vb))*180/pi;
vcmag=abs(vc);
delvc=atan(imag(vc)/real(vc))*180/pi;
%the actula values of line to line post fault voltages are
vaactual=va*bkv/sqrt(3);
vaactualmag=abs(vaactual);
delva=atan(imag(vaactual)/real(vaactual))*180/pi;
vbactual=vb*bkv/sqrt(3);
vbactaulmag=abs(vbactual);
delvb=atan(imag(vbactual)/real(vbactual))*180/pi;
vcactual=vc*bkv/sqrt(3);
vcactualmag=abs(vcactual);
delvc=atan(imag(vcactual)/real(vcactual))*180/pi;
Ia012 =
0 0 - 2.5000i 0 + 2.5000i
Iabc =
0 -4.3301 4.3301
vao12 =
0 0.5000 0.5000
vabc =
6
power system simulation lab I 4,2016
1.0000 -0.5000 -0.5000
1.8.3.Double Line to ground Fault
Algorithm
4. Calculate the phase voltages and currents if the sequencecomponents are given.
6
power system simulation lab I 4,2016
vp=zeros(n,1);
vs=zeros(n,1);
Ip=zeros(n,1);
Isym=zeros(n,1);
Iactual=zeros(n,1);
a=-0.5+j*0.866;
%%b=a*a
b=a^2;
A=[1 1 1;1 b a;1 a b];
%a)fault current currentcalculation for double line to ground fault
Ia1=e/(z1+((z2+zo)/(z2+zo)));
Ia2=-Ia1*zo/(z2+zo);
Iao=-Ia1*z2/(z2+zo);
Ia012=[Iao Ia1 Ia2]
%fault currents Ia Ib Ic
Isym=[Iao Ia1 Ia2]';
Ip=A*Isym;
Ia=Ip(1,1);
Ib=Ip(2,1);
Ic=Ip(3,1);
Iabc=[Ia Ib Ic]
%actual line to neutral currents at the point are
Iamag=abs(Ia);
delIa=atan(imag(Ia)/real(Ia))*180/pi;
Iaactual=Ia*basecurrent;
Iaactualmag=abs(Iaactual);
delIaactual=atan(imag(Iaactual)/real(Iaactual))*180/pi;
Ibmag=abs(Ib);
delIb=atan(imag(Ib)/real(Ib))*180/pi;
Ibactual=Ib*basecurrent;
Ibactualmag=abs(Ibactual);
delIbactual=atan(imag(Ibactual)/real(Ibactual))*180/pi;
Icmag=abs(Ic);
delIc=atan(imag(Ic)/real(Ic))*180/pi;
Icactual=Ic*basecurrent;
Icactualmag=abs(Icactual);
delIcactual=atan(imag(Icactual)/real(Icactual))*180/pi;
%fault current Ifc=Ib+Ic
Ifc=Ib+Ic;
Ifcmag=abs(Ifc);
delIfc=atan(imag(Ifc)/real(Ifc))*180/pi;
Ifcactual=Ifc*basecurrent;
Ifcactualmag=abs(Icactual);
delIfcactual=atan(imag(Ifcactual)/real(Ifcactual))*180/pi;
%line to neutral voltages at the fault point are
va1=e-Ia1*z1;
6
power system simulation lab I 4,2016
va2=va1;
vao=va1;
va012=[vao va1 va2]
vs=[vao va1 va2]';
vp=A*vs;
va=vp(1,1)
vb=vp(2,1)
vc=vp(3,1)
%actual values of line to neutral voltages are
vaactual=va*bkv/sqrt(3);
vbactual=vb*bkv/sqrt(3);
vcactual=vc*bkv/sqrt(3);
Ia012 =
-0.7692 + 0.1538i 0.9615 - 0.1923i -0.1923 + 0.0385i
Iabc =
0 -0.9540 - 1.2300i -1.3537 + 0.7685i
va012 =
0.9615 - 0.1923i 0.9615 - 0.1923i 0.9615 - 0.1923i
va =
2.8846 + 0.5769i
vb =
4.2308e-005 +8.4615e-006i
vc =
4.2308e-005 +8.4615e-006i
End