Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
85 views28 pages

Power System Stability and Analysis: Assignment: 1

The document provides data for a 5 bus power system including line impedances and shunt elements. The code uses the direct method to calculate the bus admittance matrix (Ybus) for the system with and without shunt elements. With shunt elements, the diagonal elements of Ybus are modified to include the shunt admittances. The code can also be extended to include mutual impedances between lines by appropriately modifying the off-diagonal elements of Ybus.

Uploaded by

Ritwik Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views28 pages

Power System Stability and Analysis: Assignment: 1

The document provides data for a 5 bus power system including line impedances and shunt elements. The code uses the direct method to calculate the bus admittance matrix (Ybus) for the system with and without shunt elements. With shunt elements, the diagonal elements of Ybus are modified to include the shunt admittances. The code can also be extended to include mutual impedances between lines by appropriately modifying the off-diagonal elements of Ybus.

Uploaded by

Ritwik Mehta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Power System Stability

and Analysis

Assignment: 1

Yashwant Singh
101804044
3EE3
Aesmunn

Epman MV VP

I)
SoovSAv 9:6 AVA s . 302 2 I1.713

2i2eV -2 v 4 0.08 2

New ba
AgSov.s v S 4o -2pv lokVA 8. 138

).2l2o 7.2bv Jobva


dasd /30 V 6kVA -4084ab) 120v -bvz_ -92 4
1-u

in8 . v .2v
133 p4 + -6-655pT PT
A M - AMw-loae
H Joscin Canlo n

V Yoo V
:
S AsemmLnk at
TEEE S bus data

shunt
0 02t 0 . S-
A -2
B 3 0-03 ti 2y 2S-3-2 0.o 23S
C -3 0-6t 0.r O077-SD) 2
D -y P7-S
E -S .o ti 0-12 S-7S
3- .o ti 0.03 lo- 3
003 j:24 .32S
Page

GO wiHhou Shb Eleen

O Wihat shunb Elemanb

Yh

63513.1 -5t 1s -25+i3-1


-SHlS 1o.01131.4 o17 tj313 67+StiS
-1-2s H3-75 -o.9174322-1s137.$3 lot3o o
-1-67S lo+i3 1-16j28 =L23j8-23
21-S 12 i3-s 3.7 2
) ih Shun men
Shunt olOmenh a arlae aong bA_DDPago

Ybu 62Sj1372s - S I 25 3s
-5 +jls 31-27-0.) h3732 -6) tjs -
12s +3-7 0.o74 3-722 13-1S773747-btj3o
-167 +jS lo tj3o R-933- .3ti31
s+i1- -35t3-7 3.1s-
i wim Shun lenuno

p-) 3

Y
-

-2

13 m
9-3
Y

-1 3

(3,3) Yhu 3)
Yu (3,1)=y bu ()-.
Yh
y buo (33) =Ybu (33) tja

Vb (2) -Ybus (h2)th Y tn


hu (a,2)= Yhuu (3,2)J -
yb (33)-Ybus (3,3 Jn
Page

V 6S-j1b:lo-St+io-2s 9-7s O
-S tlo 10-7-31.2-o.914913-614S -2St 1s
F-28 i3-25-0.4)ti:13 12-S7-j147lot3
-7+jS--+3 91639-49-I. s 3-2
2 i 37S 3-1s6 j3/
)Sigan hrana lor mauHon Mahad
ihau Shun
S
AA
C

Y S
1:23-j37s

2S-j7S
lo-j3
1-2-i3

AT YA
Page

Aly 5-s s-3-73 O

-Sis 04073712 I-iS 73 o


-12+37s 3-182 O

-615S -o30 125-3-3


-4115 1253-7

bus

-SS 2s3:7S O
-StL lo.37-j312 09a H313167 7
-1.25 3-7 -OGs7F3.182 2-1S37.S3 i3o
fo j3 RI33--12j3-
-3-54 2413s 3.%-i1-2
w; n shun
3

A L

C0

-l

O.0 S5
SSo
4-
Page

Y=
9 25-1375
O .9)-3.73)

1:-S
1-13
23-7s 0

9.02
. o SS
00SSo

O O

Vaun A A
Page
T 5-Is 1-3ti3:7o
0.0)j3-14 -61-isSo-5
-25+13-75 -14|3.78 0

-.5+15 -2s375

.0SSo

j.y

C.2s13 735 -S EiS -1-2s4j3-13


-stjs lo-0713122 -.0 31%
3-2 0.967 313 12-597-j71-

-2s7-
tj
h9-A 386 2 3:2
3-7sJ).2)
wh Mh Tnpaoho
bw B anel

A
-

0 183-
o- 0.907-3-7T22) 0
Q O-

lo3

10-
O 100Sj»
jo-as
0.0
Yhia
Ay-Ss 12-3- s
0.437-3-73 6IS_ S75

-Stj-S

j0.0SSo
aa
+1030
1S-1375
O 34j3.-7 jo
6s-137 -SJo
-o.91 i 73
-S+lo 1o-07-.32
o ) + 8-79 RIS7.47
j3o
-2Stj7S

- fo 3 >

191 23-9 - 3-7


- 1.2s 3-7S
Page
K Alittanu hbiq

LO o3 jo.21

O2 %

.03 ojo2

0 2 . fa 2 jo 21
2(o) 0 24 0 )

Os2j3:6 -jo.1

o0011+j3-00
Zh
0 o.175 ho.%3
9 OD120 oy jo-13s
0-o7tjoos's 0.0392 2

Zh 0-0099 to-o 2
ti o-s3y 7SpoB
0-0 jo-o36 oYjo
oE.73
ol7s o-o
0O17sio-o53 o-0099 io-02 0.02S o.35
O 0 175 tja.S? s30.o75
t jo-

-.007 -j07 o.bo)


Zb Zu tio-
o.06-270-32-2
.3 B.1
a7-j021 a5377-ja
-a011-ja

017 0.9 o.O1nt.33) -9117 jo.o37 0-07 tjo-o


9.0 tjo.03 023) hj8:1 o a1i.99 9. ti
0-0127 t oo3 29jo.os
17t OOS)3 121i 3 .0S7jo

Zbua L o.613-ja.
co2 io2
.174jo.0s62 Doy3-0-314
-o2 tjo.072
O-0413-j./3Yf -9o4t3-jo.
9

0169 4j0as 0.0123 E036 0-0174jp


-o123o3 o.p3 0 . 0 tjoo
O:O 3 i 34 9.0 o-0821 0 03 oo114 1SE0A
313 iS39 .013io13
Direct method

1.Without shunt

Code:

clc
clear
bus_system=5;
[line_data]=databus(bus_system);
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
ysh=j*line_data(:,5);
ybus=zeros(nbus);
for k=1:nbr
m=line_data(k,1);
n=line_data(k,2);
ybus(m,n)=ybus(m,n)-y(k);
ybus(n,m)=ybus(m,n);
ybus(m,m)=ybus(m,m)+y(k)
ybus(n,n)=ybus(n,n)+y(k)
end
ybus
function [line_data]=databus(bus_system)
switch bus_system
case 5
line_data=[1 2 0.02 0.06 0;
1 3 0.08 0.24 0.025;
2 3 0.06 0.25 0.020;
2 4 0.06 0.18 0.020;
2 5 0.04 0.12 0.015;
3 4 0.01 0.03 0.010;
4 5 0.08 0.24 0.025]
end

Output:
2.With Shunt:

Code:

%direct method
clc
clear
bus_system=5;
[line_data]=databus(bus_system);
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
ysh=j*line_data(:,5);
ybus=zeros(nbus);
for k=1:nbr
m=line_data(k,1);
n=line_data(k,2);
ybus(m,n)=ybus(m,n)-y(k);
ybus(n,m)=ybus(m,n);
ybus(m,m)=ybus(m,m)+y(k)+ysh(k);
ybus(n,n)=ybus(n,n)+y(k)+ysh(k);
end
ybus
function [line_data]=databus(bus_system)
switch bus_system
case 5
line_data=[1 2 0.02 0.06 0;
1 3 0.08 0.24 0.025;
2 3 0.06 0.25 0.020;
2 4 0.06 0.18 0.020;
2 5 0.04 0.12 0.015;
3 4 0.01 0.03 0.010;
4 5 0.08 0.24 0.025]
end

Output:
3.With Mutual Impedance

Code:
clc

clear

[line_data]=databus();
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
ysh=j*line_data(:,5);
ybus=zeros(nbus);
l=0;
for k=1:nbr
if line_data(k,6)~=0
l=k;
end
m=line_data(k,1);
n=line_data(k,2);
ybus(m,n)=ybus(m,n)-y(k);
ybus(n,m)=ybus(m,n);
ybus(m,m)=ybus(m,m)+y(k)+ysh(k);
ybus(n,n)=ybus(n,n)+y(k)+ysh(k);
end
if l~=0
l=l-1;
p=line_data(l,1);
q=line_data(l,2);
r=line_data(l+1,1);
s=line_data(l+1,2);
ym1=-j*1/line_data(l,6);
ym2=-j*1/line_data(l+1,6);
h=[p q r s];
adsh=[1 -1 0 0;
0 0 1 -1;];
yb=adsh'*[y(l) ym1;
ym2 y(l+1);]*adsh;
for x=1:2
for y=3:4
ybus(h(x),h(y))=ybus(h(x),h(y))+yb(x,y);
ybus(h(y),h(x))=ybus(h(y),h(x))+yb(y,x) ;
end
end
end
ybus
function [line_data]=databus()
line_data=[1 2 0.02 0.06 0.025 0;
1 3 0.08 0.24 0.025 0.2;
2 3 0.06 0.25 0.020 0.2;
2 4 0.06 0.18 0.020 0;
2 5 0.04 0.12 0.015 0;
3 4 0.01 0.03 0.010 0;
4 5 0.08 0.24 0.025 0;];

end
Output:

Singular Transformation Method

1.Without Shunt

Code:

%incidence matrix method


clc
clear
bus_system=5;
[line_data]=databus(bus_system);
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
disp(y)
ysh=j*line_data(:,5);
ybus=zeros(nbus);
a=zeros(nbr,nbus);
ybus=zeros(nbus,nbus);
ypr=zeros(nbr,nbr);
zpr=zeros(nbr)
%ybus without shunt elements
for k=1:nbr
m=line_data(k,1);
n=line_data(k,2);
a(k,m)=1;
a(k,n)=-1;
ypr(k,k)=y(k);
zpr(k,k)=z(k);
end
ybus=a'*ypr*a
function [line_data]=databus(bus_system)
switch bus_system
case 5
line_data=[1 2 0.02 0.06 0;
1 3 0.08 0.24 0.025;
2 3 0.06 0.25 0.020;
2 4 0.06 0.18 0.020;
2 5 0.04 0.12 0.015;
3 4 0.01 0.03 0.010;
4 5 0.08 0.24 0.025]

end
end
Output:

2.With Shunt

Code:

%incidence matrix method


clc
clear
bus_system=5;
[line_data]=databus(bus_system);
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
yshc=zeros(nbus,nbus);
ysh=j*line_data(:,5);
for i=1:nbus
for z=1:nbr
if line_data(z,1)==i||line_data(z,2)==i
yshc(i,i)=yshc(i,i)+ysh(z);
end
end
end
ybus=zeros(nbus);
a=zeros(nbr+nbus,nbus);
ybus=zeros(nbus,nbus);
ypr=zeros(nbr+nbus,nbr+nbus);
ym=0;
k=0;
for k=1:nbr+nbus
if k<=nbr
m=line_data(k,1);
n=line_data(k,2);
a(k,m)=1;
a(k,n)=-1;
ypr(k,k)=y(k);
else
a(k,k-nbr)=1;
ypr(k,k)=yshc(k-nbr,k-nbr);
end
end
ybus=a'*ypr*a

function [line_data]=databus(bus_system)
switch bus_system
case 5
line_data=[1 2 0.02 0.06 0 0;
1 3 0.08 0.24 0.025 0.2;
2 3 0.06 0.25 0.020 0.2;
2 4 0.06 0.18 0.020 0;
2 5 0.04 0.12 0.015 0;
3 4 0.01 0.03 0.010 0;
4 5 0.08 0.24 0.025 0];

end
end

Output:

3.With Mutual Impedance

Code:

%incidence matrix method


clc
clear
bus_system=5;
[line_data]=databus(bus_system);
nbr=size(line_data,1);
nbus=max(max(line_data(:,1)),max(line_data(:,2)));
z=line_data(:,3)+j*line_data(:,4);
y=1./z;
yshc=zeros(nbus,nbus);
ysh=j*line_data(:,5);
for i=1:nbus
for z=1:nbr
if line_data(z,1)==i||line_data(z,2)==i
yshc(i,i)=yshc(i,i)+ysh(z);
end
end
end
ybus=zeros(nbus);
a=zeros(nbr+nbus,nbus);
ybus=zeros(nbus,nbus);
ypr=zeros(nbr+nbus,nbr+nbus);
ym=0;
k=0;
for k=1:nbr+nbus
if k<=nbr
m=line_data(k,1);
n=line_data(k,2);
a(k,m)=1;
a(k,n)=-1;
ypr(k,k)=y(k);

if line_data(k,6)~=0
flag=k-1;
end
else
a(k,k-nbr)=1;
ypr(k,k)=yshc(k-nbr,k-nbr);
end
end
ym=1/j*inv(line_data(flag,6));
ypr(flag,flag+1)=ypr(flag,flag+1)+ym;
ypr(flag+1,flag)=ypr(flag+1,flag)+ym;
line_data()
ybus=a'*ypr*a

function [line_data]=databus(bus_system)
switch bus_system
case 5
line_data=[1 2 0.02 0.06 0 0;
1 3 0.08 0.24 0.025 0.2;
2 3 0.06 0.25 0.020 0.2;
2 4 0.06 0.18 0.020 0;
2 5 0.04 0.12 0.015 0;
3 4 0.01 0.03 0.010 0;
4 5 0.08 0.24 0.025 0];

end
end
Output:
Zbus Formulation

Code:

clc
clear
[line_data]=databus()
nbr=size(line_data,1);
zbus=[0];
currentbusno=0;
for i=1:7
from=line_data(i,2);
to=line_data(i,3);
value=line_data(i,4)+j*line_data(i,5);
dim=size(zbus,1);
newbus=max(from,to);
ref=min(from,to);
if newbus>currentbusno && ref==1
zbus=[zbus zeros(dim,1);
zeros(1,dim) value;]
currentbusno=newbus;
continue
end
if newbus>currentbusno && ref~=1
zbus=[zbus zbus(:,ref);
zbus(ref,:) zbus(ref,ref)+value;]
currentbusno=newbus;
continue
end
if newbus<=currentbusno && ref==1
x=zbus(:,newbus)
y=zbus(newbus,:)
z=(zbus(newbus,newbus)+value)
z=1/z
zbus=zbus-x*z*y
continue
end
if newbus<=currentbusno && ref~=1
x=zbus(:,ref)-zbus(:,newbus)
y=zbus(ref,:)-zbus(newbus,:)
z=(zbus(ref,ref)+zbus(newbus,newbus)-(2*zbus(ref,newbus))+value);
z=1/z
zbus=zbus-x*z*y
continue
end
end
Output:

You might also like