MATLAB code on formation of Ybus by the method of inspection?

All QuestionsCategory: Transmission And Distribution SystemMATLAB code on formation of Ybus by the method of inspection?
chetan shidling asked 4 years ago

I need code with output.

1 Answers
chetan shidling answered 4 years ago

Here is the code of formation of Ybus by the method of inspection:
 
 
nb=4;nl=4;
net=[1 2;
1 3;
2 3;
2 4];
imp=[0.08+0.24i 0+0.025i;
0.06+0.18i 0+0.02i;
0.02+0.06i 0+0.03i;
0.01+0.03i 0+0.01i];
ebus=[1.04-0.03i;
1.02-0.05i;
0.98-0.07i;
0.96+0.08i];
ybus=zeros(nb,nb);
for ii=1:nl
p=net(ii,1);q=net(ii,2);
ypq=1/imp(ii,1);yh=imp(ii,2);
ybus(p,p)=ybus(p,p)+ypq+yh;
ybus(q,q)=ybus(q,q)+ypq+yh;
ybus(p,q)=ybus(p,q)-ypq;
ybus(q,p)=ybus(q,p)-ypq;
end
disp(“Ybus”)
disp(ybus)
ibus=ybus*ebus;
sbus=conj(ebus).*ibus;
disp(“Bus Power”)
disp(sbus)
for ii=1:nl
p=net(ii,1);q=net(ii,2);
ypq=1/imp(ii,1);yh=imp(ii,2);
LF(ii,1)=conj(ebus(p))*((ebus(p)-ebus(q))*ypq+ebus(p)*yh);
LF(ii,2)=conj(ebus(q))*((ebus(q)-ebus(p))*ypq+ebus(q)*yh);
end
disp(“LineFlow”)
disp(LF)
 
 
Output:
 
Ybus
2.9167 – 8.7050i -1.2500 + 3.7500i -1.6667 + 5.0000i 0.0000 + 0.0000i
-1.2500 + 3.7500i 16.2500 -48.6850i -5.0000 +15.0000i -10.0000 +30.0000i
-1.6667 + 5.0000i -5.0000 +15.0000i 6.6667 -19.9500i 0.0000 + 0.0000i
0.0000 + 0.0000i -10.0000 +30.0000i 0.0000 + 0.0000i 10.0000 -29.9900i
Bus Power
0.4245 – 0.2340i
-2.7805 – 3.6982i
-0.8353 + 0.7109i
3.4160 + 2.7213i
LineFlow
0.1055 – 0.0219i -0.1045 + 0.0721i
0.3190 – 0.2120i -0.3103 + 0.2270i
0.5350 – 0.4537i -0.5250 + 0.4840i
-3.2110 – 3.3166i 3.4160 + 2.7213i