You are on page 1of 19

NATIONAL INSTITUTE OF TECHNOLOGY

KURUKSHETRA

MATLAB PROGRAMMING REPORT

Submitted To:-
SAURABH CHANANA
Dept. of Electrical Engineering

Submitted By:-
ABHISHEK RAI
M.Tech I(Power System)
Roll No. 31604211
PROGRAM – 1

AIM:-
To determine the Bus incidence and reduced bus incidence matrices using MATLAB

THEORY:-

The incidence of branches to nodes in a connected graph is given by the element-node incidence
matrix, A ˆ. An element aij of A ˆ is defined as under:

aij
= 1 if the branch-i is incident to and oriented away from the node-j.
= -1 if the branch-i is incident to and oriented towards the node-j.
= 0 if the branch-i is not at all incident on the node-j.

GIVEN NETWORK:
ALGORITHM: -
START
STEP1:
Form data matrices such that they represent line data of the given network
For the above network linedata = [e.no, from node, to node]
STEP2:
Form a zero metrics of order element by nodes
STEP3:
Use for loop and for each element choose the from node and to node in the created matrics and
give the value as 1 and -1 respectively
STEP4:
Perform STEP3 for all elements to get the Bus incidence matrices
STEP5:
Remove the column corresponding to the reference node in the obtained matrics to get the
reduced bus incidence matrices
STOP

PROGRAM: -
data=[1,1,2;2,1,3;3,1,5;4,5,4;5,3,4;6,2,3;7,4,2];

%BUS INCIDENCE MATRX STARTS

e=max(data(:,1));

n=max(max(data(:,2)),max(data(:,3)));

matA=zeros(e,n);
for i=1:e
matA(i,data(i,2))=1;
matA(i,data(i,3))=-1;
end
matA
A=matA;
A(:,1)=[ ]
%A IS REDUCED BUS INCIDENCE MATRIX

Result:

matA =

1 -1 0 0 0
1 0 -1 0 0
1 0 0 0 -1
0 0 0 -1 1
0 0 1 -1 0
0 1 -1 0 0
0 -1 0 1 0

A=

-1 0 0 0
0 -1 0 0
0 0 0 -1
0 0 -1 1
0 1 -1 0
1 -1 0 0
-1 0 1 0
ROGRAM – 2
AIM:-
Formation of reduced bus incident matrixA, basic cut set matrix B and basic loop matrix C.

THEORY:-

Incidence matrix (A)

The incidence of branches to nodes in a connected graph is given by the element-


node incidence matrix, A ˆ. An element aij of A ˆ is defined as under:
= 1; if the branch-i is incident to and oriented away from the node-j.
= -1; if the branch-i is incident to and oriented towards the node-j.
= 0; if the branch-i is not at all incident on the node-j.

Cut-set matrix (B)

The incidence of elements to basic cut-sets of a connected graph is shown by the


basic cut-set matrix B. The elements of this matrix are-
= 1; if the ith element is incident to and oriented in the same direction
as the jth basic cutset
= -1; if the ith element is incident to and oriented in the opposite
direction as the jth basic cutset
= 0; if the ith element is not incident to the jth basic cutset

Loop matrix (C)

The incidence of elements to basic loops of a connected graph is shown by the


basic loop incidence matrix C. The elements of this matrix are-
= 1; if the ith element is incident to and oriented in the same direction
as the jth basic loop
= -1; if the ith element is incident to and oriented in the opposite
direction as the jth basic loop
= 0; if the ith element is not incident to the jth basic loop
Bl=Al*Ab^(-1)

Cb= -(Bl)’

ALGORITHM:-
STEP1
Form a data matrix to represent the line data of the given system
STEP2
Form the reduced Incidence matrix A
STEP3
From the reduced incidence matrix select the rows which belong to tree elements and place them
in matrix “Ab” and the rows which belong to link elements in matrix “Al” .This way we can
partition the A matrix into Ab and Al
STEP4
Use the following relations to get the required matrices
−1 '
K t =A b K=K t
'
B l= A l K t Cb =−Bl

STEP5
Form augmented matrices of B and C
STOP

PROGRAM:-

data=[1,1,2;2,1,3;3,1,5;4,5,4;5,3,4;6,2,3;7,4,2];
e=max(data(:,1));
n=max(max(data(:,2)),max(data(:,3)));
b=n-1;
l=e-b;
matA=zeros(e,n);

for i=1:e
matA(i,data(i,2))=1;
matA(i,data(i,3))=-1;
end

matA;
A=matA;
A(:,1)=[] % REDUCED BUS INCIDENT MATRIX A

Ab=A(1:b,:);
Al=A(b+1:e,:);
Bl=Al*Ab^(-1);
B=zeros(e,b);
Ub=eye(b);
B(1:b,:)=Ub;
B(n:e,:)=Bl;
B % BASIC CUT SET B

Cb=-(Bl)';
Cl=eye(l);
C=zeros(e,l);
C(1:b,:)=Cb;
C(n:e,:)=Cl;
C % BASIC LOOP MATRIX C
RESULT:-

A=

-1 0 0 0
0 -1 0 0
0 0 0 -1
0 0 -1 1
0 1 -1 0
1 -1 0 0
-1 0 1 0

B=

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
0 -1 1 1
-1 1 0 0
1 0 -1 -1

C=

0 1 -1
1 -1 0
-1 0 1
-1 0 1
1 0 0
0 1 0
0 0 1
PROGRAM – 3
AIM:-
To determine Y Bus and Z Bus using singular transformation

THEORY:-
By using primitive admittance matrices we can find Y bus matrices. The relation as follows

Y BUS= A t yA

Where “y” is primitive admittance matrix and “A” is reduced bus incidence matrix

GIVEN NETWORK:-
ELEMENT SELF IMPEDANCE
1 J0.6
2 J0.5
3 J0.5
4 J0.4
5 J0.2
ALGORITHM:-
STEP1
Create two matrices to represent line data and the mutual impedance data line data contains
information about element number, from node , to node, element impedance where as mutual
data contains element, mutual element, mutual impedance.
STEP2
Form the reduced bus incidence matrix
STEP3
Form the primitive impedance matrix ‘z’. Where z is a matrix of order element by element in
which diagonal elements are self-impedances and off diagonal elements are mutual impedances
STEP4

Find primitive admittance matrix ‘y’ using the relation y=z−1

STEP5
t
Y BUS
Using the given relation Y BUS= A yA find

STOP

PROGRAM:-

disp('formation of bus admittance matrix=');


nb = input('no of buses including the slack bus=');
nl = input('no of lines=');
mb = input('no of mutal links=');

for j=1:nl;
sb(j) = input('starting bus=');
eb(j) = input('ending bus=');
u(j) = input('input values=');
end
A=zeros(nl,nb);
for i=1:nl;
k=sb(i);
m=eb(i);
A(i,k)=1;
A(i,m)=-1;
end

A(:,1)=[];
z=zeros(nl,nl);
for i=1:nl;
z(i,i)=u(i);
end
for j=1:mb;
e=input ('first line=');
f=input ('second line=');
g=input ('enter the value=');
z(e,f)=g;
z(f,e)=g;
end
A %INCIDENCE MATRIX
z %IMPEDENCE MATRIX
Y=z^-1 %ADMITTANCE MATRIX
Ybus=A'*Y*A %BUS ADMITTANCE MATRIX
Zbus=Ybus^-1 %BUS IMPEDECE MATRIX

RESULT:-

formation of bus admittance matrix

no of buses including the slack bus=4

no of lines=5

no of mutal links=0

starting bus=1

ending bus=2

input values= .6
starting bus=1

ending bus=3

input values=.5

starting bus=3

ending bus=4

input values=.5

starting bus=1

ending bus=2

input values=.4

starting bus=2

ending bus=4

input values=.2

A=

-1 0 0
0 -1 0
0 1 -1
-1 0 0
1 0 -1

z=

0.6000 0.1000 0 0.2000 0


0.1000 0.5000 0 0 0
0 0 0.5000 0 0
0.2000 0 0 0.4000 0
0 0 0 0 0.2000
Y=

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

Ybus =

8.0208 -0.2083 -5.0000

-0.2083 4.0833 -2.0000

-5.0000 -2.0000 7.0000

Zbus =

0.2713 0.1264 0.2299

0.1264 0.3437 0.1885

0.2299 0.1885 0.3609


PROGRAM -4

AIM:-
To determine Y Bus and Z Bus using singular transformation

THEORY:-
By using primitive admittance matrices we can find Y bus matrices. The relation as follows
t
Y BUS= A yA

Where “y” is primitive admittance matrix and “A” is reduced bus incidence matrix

Element From Bus To Bus Impedance Tree


1 1 2 J0.1 1
2 1 3 J0.15 1
3 2 4 J0.4 1
4 2 3 j0.6 0
5 3 4 J0.4 0

Mutual impedance data


Mutual impedance Element 1 Element 2
J0.1 1 2
J0.2 1 4
ALGORITHM:-
STEP1
Create two matrices to represent line data and the mutual impedance data line data contains
information about element number, from node , to node, element impedance where as mutual
data contains element, mutual element, mutual impedance.
STEP2
Form the reduced bus incidence matrix
STEP3
Form the primitive impedance matrix ‘z’. Where z is a matrix of order element by element in
which diagonal elements are self-impedances and off diagonal elements are mutual impedances
STEP4

Find primitive admittance matrix ‘y’ using the relation y=z−1

STEP5
t
Y BUS
Using the given relation Y BUS= A yA find

STOP

PROGRAM :-
disp('formation of bus admittance matrix');
nb = input('no of buses including the slack bus=');
nl = input('no of lines=');
mb = input('no of mutal links=');

for j=1:nl;
sb(j) = input('starting bus=');
eb(j) = input('ending bus=');
u(j) = input('input values=');
end
A=zeros(nl,nb);
for i=1:nl;
k=sb(i);
m=eb(i);
A(i,k)=1;
A(i,m)=-1;
end

A(:,1)=[];
z=zeros(nl,nl);
for i=1:nl;
z(i,i)=u(i);
end
for j=1:mb;
e=input ('first line=');
f=input ('second line=');
g=input ('enter the value=');
z(e,f)=g;
z(f,e)=g;
end
A %INCIDENCE MATRIX
z %IMPEDENCE MATRIX
Y=z^-1 %ADMITTANCE MATRIX
Ybus=A'*Y*A %BUS ADMITTANCE MATRIX
Zbus=Ybus^-1 %BUS IMPEDECE MATRIX

RESULT:-

formation of bus admittance matrix

no of buses including the slack bus=4

no of lines=5

no of mutal links=2

starting bus=1

ending bus=2

input values=.1

starting bus=1

ending bus=3

input values=.15

starting bus=2
ending bus=4

input values=.4

starting bus=2

ending bus=3

input values=.6

starting bus=3

ending bus=4

input values=.4

first line=1

second line=2

enter the value=.1

first line=1

second line=4

enter the value=.2

A=

-1 0 0

0 -1 0

1 0 -1

1 -1 0

0 1 -1

z=
0.1000 0.1000 0 0.2000 0

0.1000 0.1500 0 0 0

0 0 0.4000 0 0

0.2000 0 0 0.6000 0

0 0 0 0 0.4000

Y=

-30.0000 20.0000 0 10.0000 0

20.0000 -6.6667 0 -6.6667 0

0 0 2.5000 0 0

10.0000 -6.6667 0 -1.6667 0

0 0 0 0 2.5000

Ybus =

-49.1667 38.3333 -2.5000

38.3333 -19.1667 -2.5000

-2.5000 -2.5000 5.0000

Zbus =

0.0590 0.1072 0.0831


0.1072 0.1458 0.1265

0.0831 0.1265 0.3048

You might also like