Matlab Code On FORMATION OF [YBUS] BY THE METHOD OF INSPECTION

All QuestionsCategory: Power System AnalysisMatlab Code On FORMATION OF [YBUS] BY THE METHOD OF INSPECTION
Chetan Shidling Staff asked 4 years ago

I need code.

1 Answers
Chetan Shidling Staff answered 4 years ago

Here is the code:
 
 
nb=4;nl=4;
net=[1 2;
1 3;
2 3;
2 4];
imp=[0.08+0.24*i 0+0.025*i;
0.06+0.18*i 0+0.02*i;
0.02+0.06*i 0+0.03*i;
0.01+0.03*i 0+0.01*i];
ebus=[1.04-0.03*i;
1.02-0.05*i;
0.98-0.07*i;
0.96+0.08*i];
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
ybus
ibus=ybus*ebus
sbus=conj(ebus).*ibus
for ii=1:nl
p=net(ii,1);q=net(ii,2);
ypq=1/imp(ii,1);yh=imp(ii,2);
line_flow(ii,1)=conj(ebus(p))*((ebus(p)-ebus(q))*ypq+ebus(p)*yh);
line_flow(ii,2)=conj(ebus(q))*((ebus(q)-ebus(p))*ypq+ebus(q)*yh);
end
line_flow