National Institute of Technology Kurukshetra: Matlab Programming Report
National Institute of Technology Kurukshetra: Matlab Programming Report
KURUKSHETRA
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];
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:-
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
STEP5
t
Y BUS
Using the given relation Y BUS= A yA find
STOP
PROGRAM:-
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:-
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=
Ybus =
Zbus =
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
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:-
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
first line=1
second line=4
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=
0 0 2.5000 0 0
0 0 0 0 2.5000
Ybus =
Zbus =