Académique Documents
Professionnel Documents
Culture Documents
ALGORITHM:
The following algorithm was used to formulate the code to construct Impedance matrix ( ) using
building algorithm:
Step 1 : Read the number of steps n of the building process from the input file.
Step 2 : Initialize the order of the matrix, size = 0.
Step 3 : Read the case number from the input file and store it in variable casez.
Step 4 : Set the step counter i = 1.
Step 5 : If the value of casez=1 or 2 then increment the value of size by 1 by:
size = size+1,
else dont increment the value of size.
Step 6 : If casez = 1, then go to Step 7.
If casez = 2, then go to Step 8.
If casez = 3, then go to Step 9
If casez = 4, then go to Step 10
If casez 1 or 2 or 3 or 4 , then go to Step 11
Step 7 : The following steps are followed:
i. Read the new bus number from the input file and store in variable b.
ii. Read the line impedance value from the input file and store in variable z.
iii. Set the size counter j = 1.
iv. Put the value at (j,size) = 0.
v. And to make the matrix symmetric, (size,j) = (j,size).
vi. If j = size, go to line vii, else increment j by 1 and go to line iv.
vii. Put (size,size) = z.
viii. Display the modified .
Step 8 : The following steps are followed:
i. Read the new bus number from the input file and store it in variable b.
ii. Read the old bus number from the input file and store it in variable t.
iii. Read the line impedance value from input file and store it in variable z.
iv. Set the size counter j = 1.
v. Put the value at (j,size) = (j,t).
vi. And to make matrix symmetric (size,j) = (j,size).
vii. If j = size, go to line viii else increment j by 1 and go to line v.
viii. Put (size,size) = z+ (t,t).
ix. Display the modified
Step 9 : The following steps are to be followed:
i. Read the old bus number from the input file and store it in variable t.
ii. Read the value of line impedance from the input file and store it in variable z.
iii. Implement the following formula:
zbus = zbus -
zbus = zbus
Fig 3
In the following data set bus 1 has been taken as reference bus, i.e. it has been numbered from 0 and
the numbers of the rest has been decremented by 1.
c=[11124424444]
PROGRAM FILE:
clc
clear all
size=0;
X=importdata('zbusdata.txt',' ',1);
C=importdata('cases.txt',' ',1);
n=X.data(1,1);
for i=1:n
casez=C.data(i,1);
if casez= =1||casez = =2
size=size+1;
else
size=size+0;
end;
switch(casez)
case 1
b=X.data(i,2);
z=complex(X.data(i,4),X.data(i,5));
for j=1:size
zbus(j,size)=0;
zbus(size,j)=zbus(j,size);
end;
zbus(size,size)=z;
disp(zbus);
case 2
b=X.data(i,2);
t=X.data(i,3);
z=complex(X.data(i,4),X.data(i,5));
for j=1:size
zbus(j,size)=zbus(j,b);
zbus(size,j)=zbus(j,size);
end;
zbus(size,size)=z+zbus(t,t);
disp(zbus);
case 3
t=X.data(i,3);
z=complex(X.data(i,4),X.data(i,5));
zbus=zbus-((1/(zbus(t,t)+z))*zbus(:,t)*zbus(t,:));
disp(zbus);
case 4
b=X.data(i,2);
t=X.data(i,3);
z=complex(X.data(i,4),X.data(i,5));
zbus=zbus-((1/(z+zbus(b,b)+zbus(t,t)-
2*zbus(b,t)))*(zbus(:,b)-zbus(:,t))*(zbus(b,:)-zbus(t,:)));
disp(zbus);
otherwise
i=i-1;
fprintf('\nInvalid case\n');
end;
end;
OUTPUT FILE:
0.1000 + 0.2000i
0.0586 + 0.1341i 0.0000 + 0.0000i 0.0379 + 0.1012i 0.0586 + 0.1341i 0.0586 + 0.1341i
0.0000 + 0.0000i 0.0500 + 0.2000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0379 + 0.1012i 0.0000 + 0.0000i 0.0568 + 0.1518i 0.0379 + 0.1012i 0.0379 + 0.1012i
0.0586 + 0.1341i 0.0000 + 0.0000i 0.0379 + 0.1012i 0.0645 + 0.2106i 0.0586 + 0.1341i
0.0586 + 0.1341i 0.0000 + 0.0000i 0.0379 + 0.1012i 0.0586 + 0.1341i 0.1286 + 0.3341i
0.0134 + 0.0403i 0.0408 + 0.1409i 0.0083 + 0.0302i 0.0131 + 0.0626i 0.0134 + 0.0403i
0.0285 + 0.0810i 0.0083 + 0.0302i 0.0507 + 0.1365i 0.0274 + 0.0694i 0.0285 + 0.0810i
0.0421 + 0.0919i 0.0131 + 0.0626i 0.0274 + 0.0694i 0.0471 + 0.1446i 0.0421 + 0.0919i
0.0445 + 0.1075i 0.0134 + 0.0403i 0.0285 + 0.0810i 0.0421 + 0.0919i 0.1145 + 0.3075i
0.0385 + 0.0980i 0.0194 + 0.0548i 0.0245 + 0.0738i 0.0372 + 0.0880i 0.0243 + 0.0694i
0.0194 + 0.0548i 0.0359 + 0.1193i 0.0121 + 0.0412i 0.0190 + 0.0690i 0.0325 + 0.0979i
0.0245 + 0.0738i 0.0121 + 0.0412i 0.0481 + 0.1310i 0.0239 + 0.0664i 0.0152 + 0.0521i
0.0372 + 0.0880i 0.0190 + 0.0690i 0.0239 + 0.0664i 0.0438 + 0.1435i 0.0243 + 0.0757i
0.0243 + 0.0694i 0.0325 + 0.0979i 0.0152 + 0.0521i 0.0243 + 0.0757i 0.0473 + 0.1554i
The modified z-bus is as follows
0.0380 + 0.0977i 0.0189 + 0.0541i 0.0259 + 0.0755i 0.0358 + 0.0859i 0.0238 + 0.0688i
0.0189 + 0.0541i 0.0358 + 0.1179i 0.0127 + 0.0445i 0.0187 + 0.0652i 0.0323 + 0.0967i
0.0259 + 0.0755i 0.0127 + 0.0445i 0.0458 + 0.1234i 0.0256 + 0.0755i 0.0160 + 0.0549i
0.0358 + 0.0859i 0.0187 + 0.0652i 0.0256 + 0.0755i 0.0429 + 0.1329i 0.0236 + 0.0724i
0.0238 + 0.0688i 0.0323 + 0.0967i 0.0160 + 0.0549i 0.0236 + 0.0724i 0.0470 + 0.1544i
0.0373 + 0.0971i 0.0199 + 0.0552i 0.0252 + 0.0748i 0.0342 + 0.0835i 0.0259 + 0.0720i
0.0199 + 0.0552i 0.0346 + 0.1157i 0.0136 + 0.0459i 0.0205 + 0.0695i 0.0300 + 0.0908i
0.0252 + 0.0748i 0.0136 + 0.0459i 0.0452 + 0.1224i 0.0243 + 0.0727i 0.0177 + 0.0588i
0.0342 + 0.0835i 0.0205 + 0.0695i 0.0243 + 0.0727i 0.0403 + 0.1246i 0.0268 + 0.0836i
0.0259 + 0.0720i 0.0300 + 0.0908i 0.0177 + 0.0588i 0.0268 + 0.0836i 0.0432 + 0.1392i
CONCLUSION: Thus from the following assignment we have seen constructed the impedance matrix
for a 6 bus system using building algorithm.
REFERENCES: