Vous êtes sur la page 1sur 5

%Y-bus formation%

% S E R X B%
% starting ending resistence Reactance susceptance%%
%b/w node 1 and 4 X=0.80%
data=[1 4 0 .08 0
4 5 0.00197 0.04193 4.18
5 2 0 0.15 0
2 6 0 0.05 0
6 7 .04788 .18769 0
7 12 0 0.05 0
12 8 0 .1 0
8 9 .01654 .12361 .36
9 3 0 .1 0
3 10 0 .17 0
10 11 .05968 .2346 0
11 1 0 .17 0];
s = data(:,1); %to access first colum of [data]
e = data(:,2);
R = data(:,3);
x = data(:,4);
b = data(:,5);
y = 1./(R+i*x);
b = i*b;
buses = max(max(s),max(e));
branches = length(s);
Ybus = zeros(buses,buses);
% Off-Diagonal Elements%
for k=1:branches
Ybus(s(k),e(k)) =-y(k);
Ybus(e(k),s(k)) = Ybus(s(k),e(k));
end
% Diagonal Elements
for m =1:buses
for n =1:branches
if s(n) == m
Ybus(m,m) = Ybus(m,m)+y(n) + b(n)/2;
elseif e(n) == m
Ybus(m,m) = Ybus(m,m)+y(n) + b(n)/2;
end
end
end
Ybus

In COMMAMND WINDOW
>> ybus
Ybus =
Columns 1 through 2
0 -18.3824i
0
0
0 +12.5000i
0
0
0
0
0
0
0 + 5.8824i
0

0
0 -26.6667i
0
0
0 + 6.6667i
0 +20.0000i
0
0
0
0
0
0

Columns 3 through 4
0
0
0 -15.8824i
0
0
0
0
0
0 +10.0000i
0 + 5.8824i
0
0

0 +12.5000i
0
0
1.1180 -34.2067i
-1.1180 +23.7967i
0
0
0
0
0
0
0

Columns 5 through 6
0
0 + 6.6667i
0
-1.1180 +23.7967i
1.1180 -28.3734i
0

0
0 +20.0000i
0
0
0
1.2761 -25.0024i

0
0
0
0
0
0

-1.2761 + 5.0024i
0
0
0
0
0

Columns 7 through 8
0
0
0
0
0
-1.2761 + 5.0024i
1.2761 -25.0024i
0
0
0
0
0 +20.0000i

0
0
0
0
0
0
0
1.0635 -17.7677i
-1.0635 + 7.9477i
0
0
0 +10.0000i

Columns 9 through 10
0
0
0 +10.0000i
0
0
0
0
-1.0635 + 7.9477i
1.0635 -17.7677i
0
0
0

0
0
0 + 5.8824i
0
0
0
0
0
0
1.0184 - 9.8858i
-1.0184 + 4.0035i
0

Columns 11 through 12
0 + 5.8824i
0
0
0
0
0
0
0

0
0
0
0
0
0
0 +20.0000i
0 +10.0000i

0
-1.0184 + 4.0035i
1.0184 - 9.8858i
0

0
0
0
0 -30.0000i

%%% Kron Reduction%%%


new= lop (Ybus)
function [ ret ] = Kron (old)
for m=11:-1:4
order=length(old);
newbus=zeros(order);
for row = 1:order
for column =1:order
newbus(row,column)= old(row,column)-((old(row,m)*old(m,column))/old(m,m));
end
end
newbus(m,:)=[]; %Deletion of Row containg Zero
newbus(:,m)=[]; %Deletion of Column containg Zero
old=newbus;
end
ret=newbus;
end