Sort Bus Function
Sort Bus Function
% returns the bus data matrix in the required sequence of bus type
% nPQ and nPV are the counts of the PQ & PV bus numbers;
% Author(s):Long
% $Date:2010/06/27 13:31$
% Bus data
bus = [1 2 1.06 0 0 0 0 0 0 0 0
3 2 1 0 -0.45 -0.15 0 0 0 0 0
4 2 1 0 -0.4 -0.05 0 0 0 0 0
5 2 1 0 -0.6 -0.1 0 0 0 0 0 ];
% Line data
[n1,m1] = size(line);
n = nb;
nSB = 1;
nPV = 0;
nPQ = 0;
for i = 1:n
type=bus(i,2);
SB(nSB,:) = bus(i,:);
nPV = nPV+1;
PV(nPV,:) = bus(i,:);
PQ(nPQ,:) = bus(i,:);
end
end
if nPV == 0
elseif nPV ~= 0
end
for i = 1:n1
for j = 1:2
for k = 1:nb
if line(i,j)==nodenum(k,2);
line(i,j) = nodenum(k,1);
break
end
end
end
end