Experiment 5 - Z Bus Building Algorithm
Experiment 5 - Z Bus Building Algorithm
APPARATUS:
1. MATLAB R2022a
FORMULAE:
𝐙𝐛𝐮𝐬(𝐧𝐞𝐰) = [𝐙𝐛 ]
Zb is added from new bus k to the old bus j as shown in the figure. It follows from
this figure that:
𝐙𝟏𝐣
𝐙𝐛𝐮𝐬(𝐨𝐥𝐝) 𝐙𝟐𝐣
𝐙𝐛𝐮𝐬(𝐧𝐞𝐰) =
⋮
[𝐙𝐢𝟏 𝐙𝟐𝐢 … 𝐙𝐣𝐣 + 𝐙𝐛 ]
TYPE 3 MODIFICATION (OLD BUS ‘j’ TO REFERENCE BUS):
Zb connects an old bus j to the reference bus as shown in Fig 26. Thus
𝐙𝟏𝐣
𝟏
𝐙𝐛𝐮𝐬(𝐧𝐞𝐰) = 𝐙𝐛𝐮𝐬(𝐨𝐥𝐝) − [ ⋮ ] [𝐙𝐣𝟏 … 𝐙𝐣𝐧 ]
𝐙𝐣𝐣 + 𝐙𝐛 𝐙
𝐧𝐣
MATLAB CODE:
clear;clc;
format short g;
%FromBUS ToBUS Impedance
line=[ 1 0 0.33
1 2 0.18
3 1 0.14
2 0 0.25
2 3 0.22];
FromBus=line(:,1);
ToBus=line(:,2);
z=line(:,3);
nbuses=max(max(FromBus),max(ToBus));
nlines=length(FromBus);
added=-1*ones(nbuses+1,1); % To know whether each bus has been
traversed at least once
added(nbuses+1)=0;
zbus=zeros(nbuses,nbuses);
order=0; %To input the modified values onto the z bus matrix
(order increases till nxn)
for k=1:nlines
FB_TB=[FromBus(k),ToBus(k)];
common=intersect(added,FB_TB); %common is to decide the
type of modification to be done
if length(common)==1
order=order+1;
new_bus=FB_TB(FB_TB~=common);
added(new_bus)=new_bus;
if common==0 %TYPE 1 MODIFICATION - BUS TO REFERENCE
zbus(order,order)=z(k);
else %TYPE 2 MODIFICATION - NEW BUS TO OLD BUS
j=common;
zbus(:,order)=zbus(:,j);
zbus(order,:)=zbus(j,:);
zbus(order,order)=zbus(order,order)+z(k);
end
end
if length(common)==2
if any(common==0) %returns logical 1 (TRUE) if any of
the elements of the vector is a nonzero number or is logical 1
else
%TYPE 4 MODIFICATION - OLD BUS TO OLD BUS
i=FromBus(k);
j=ToBus(k);
zbus=zbus-((zbus(:,i)-zbus(:,j))*(zbus(i,:)-
zbus(j,:)))/...
(zbus(i,i)+zbus(j,j)-2*zbus(i,j)+z(k));
end
end
end
zbus=1i*zbus;
display(zbus);
OUTPUT:
zbus =
0 + 0.17443i 0 + 0.11786i 0 + 0.15243i
0 + 0.11786i 0 + 0.16071i 0 + 0.13452i
0 + 0.15243i 0 + 0.13452i 0 + 0.23102i
RESULT:
Thus, the formation of impedance matrix using Z Bus Building Algorithm was
carried out using MATLAB and results were verified.