📄 fm_connectivity.m
字号:
function fm_connectivity(actual_time,flag)
% FM_CONNECTIVITY determines in how many islands the system is
% fractioned after braker interventions
%
% FM_CONNECTIVTY(T)
% T actual simulation time
%
%Author: Federico Milano
%Date: 03-Nov-2005
%Version: 1.0.0
%
% This function has been fully rewritten based on the original
% version by Laurent Lenoir, June 2005.
%
%E-mail: fmilano@thunderbox.uwaterloo.ca
%Web-site: http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano
global Line Bus Syn SW PV
persistent old_time
switch flag
case 'init'
old_time = -999;
case 'islands'
%global PQ Mn Pl Fl Exload Thload Jimma Mixload
global Ltc Phs Hvdc Lines
% accounting for PV and load buses
%busPQV = zeros(Bus.n,1);
%if PV.n, busPQV(PV.bus) = 1; end
%if PQ.n, busPQV(PQ.bus) = 1; end
%if Mn.n, busPQV(Mn.bus) = 1; end
%if Pl.n, busPQV(Pl.bus) = 1; end
%if Fl.n, busPQV(Fl.bus) = 1; end
%if Exload.n, busPQV(Exload.bus) = 1; end
%if Thload.n, busPQV(Thload.bus) = 1; end
%if Jimma.n, busPQV(Jimma.bus) = 1; end
%if Mixload.n, busPQV(Mixload.bus) = 1; end
% looking for islanded buses
traceY = abs(sum(Line.Y).'-diag(Line.Y));
if Lines.n
traceY(Lines.bus1) = 1;
traceY(Lines.bus2) = 1;
end
if Hvdc.n
traceY(Hvdc.bus1) = 1;
traceY(Hvdc.bus2) = 1;
end
if Ltc.n
traceY(Ltc.bus1) = 1;
traceY(Ltc.bus2) = 1;
end
if Phs.n
traceY(Phs.bus1) = 1;
traceY(Phs.bus2) = 1;
end
% defining critical islanded buses
Bus.island = find(traceY < 1e-4); % & busPQV);
if ~isempty(Bus.island)
fm_disp(strcat(' * * Bus #',num2str(Bus.island), ' is islanded.'))
end
case 'areas'
% do not repeat computations if the simulation is stucking
if old_time ~= actual_time
old_time = actual_time;
else
return
end
% connectivity matrix
connect_mat = sparse(Line.from,Line.to,1,Bus.n,Bus.n);
connect_mat = connect_mat + sparse(Line.from,Line.from,1,Bus.n,Bus.n);
connect_mat = connect_mat + sparse(Line.to,Line.to,1,Bus.n,Bus.n);
connect_mat = connect_mat + sparse(Line.to,Line.from,1,Bus.n,Bus.n);
% check for open lines
open_lines = find(Line.con(:,9) > 1e5);
if ~isempty(open_lines)
% modify connectivity matrix if there are open lines
hhh = Line.from(open_lines);
kkk = Line.to(open_lines);
connect_mat = connect_mat - sparse(hhh,kkk,1,Bus.n,Bus.n);
connect_mat = connect_mat - sparse(kkk,hhh,1,Bus.n,Bus.n);
% find network islands using QR factorization
[Q,R] = qr(connect_mat);
idx = find(abs(sum(R,2)-diag(R)) < 1e-5);
% find generators for each island
nisland = length(idx);
if nisland > 1
disp(['There are ' num2str(nisland) ' islanded networks'])
gen_bus = [Syn.bus;SW.bus;PV.bus];
for i = 1:nisland
buses = find(Q(:,idx(i)));
ngen = 0;
nbuses = length(buses);
for j = 1:nbuses
ngen = ngen + length(find(gen_bus == buses(j)));
end
disp([' * * Sub_network has ', num2str(nbuses), ...
' bus(es) and ', num2str(ngen), ' generator(s)'])
end
end
end
otherwise
% unknown option
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -