Home > matpower5.0 > find_islands.m

find_islands

PURPOSE ^

FIND_ISLANDS Finds islands in a network

SYNOPSIS ^

function [groups, isolated] = find_islands(mpc)

DESCRIPTION ^

FIND_ISLANDS  Finds islands in a network
   GROUPS = FIND_ISLANDS(MPC)
   [GROUPS, ISOLATED] = FIND_ISLANDS(MPC)

   Returns the islands in a network. The return value GROUPS
   is a cell array of vectors of the bus indices for each island.
   The second and optional return value ISOLATED is a vector of
   indices of isolated buses that have no connecting branches.

   See also EXTRACT_ISLANDS, CONNECTED_COMPONENTS.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [groups, isolated] = find_islands(mpc)
0002 %FIND_ISLANDS  Finds islands in a network
0003 %   GROUPS = FIND_ISLANDS(MPC)
0004 %   [GROUPS, ISOLATED] = FIND_ISLANDS(MPC)
0005 %
0006 %   Returns the islands in a network. The return value GROUPS
0007 %   is a cell array of vectors of the bus indices for each island.
0008 %   The second and optional return value ISOLATED is a vector of
0009 %   indices of isolated buses that have no connecting branches.
0010 %
0011 %   See also EXTRACT_ISLANDS, CONNECTED_COMPONENTS.
0012 
0013 %   TODO: add handling of DC lines
0014 
0015 %   MATPOWER
0016 %   $Id: find_islands.m 2298 2014-03-28 15:57:08Z ray $
0017 %   by Ray Zimmerman, PSERC Cornell
0018 %   Copyright (c) 2012 by Power System Engineering Research Center (PSERC)
0019 %
0020 %   This file is part of MATPOWER.
0021 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0022 %
0023 %   MATPOWER is free software: you can redistribute it and/or modify
0024 %   it under the terms of the GNU General Public License as published
0025 %   by the Free Software Foundation, either version 3 of the License,
0026 %   or (at your option) any later version.
0027 %
0028 %   MATPOWER is distributed in the hope that it will be useful,
0029 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0031 %   GNU General Public License for more details.
0032 %
0033 %   You should have received a copy of the GNU General Public License
0034 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0035 %
0036 %   Additional permission under GNU GPL version 3 section 7
0037 %
0038 %   If you modify MATPOWER, or any covered work, to interface with
0039 %   other modules (such as MATLAB code and MEX-files) available in a
0040 %   MATLAB(R) or comparable environment containing parts covered
0041 %   under other licensing terms, the licensors of MATPOWER grant
0042 %   you additional permission to convey the resulting work.
0043 
0044 %% define named indices into data matrices
0045 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0046     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0047 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0048     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0049     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0050 
0051 %% find islands
0052 nb  = size(mpc.bus, 1);     %% number of buses
0053 nl  = size(mpc.branch, 1);  %% number of branches
0054 
0055 e2i = sparse(mpc.bus(:, BUS_I), ones(nb, 1), 1:nb, max(mpc.bus(:, BUS_I)), 1);
0056 C_on = sparse(1:nl, e2i(mpc.branch(:, F_BUS)), -mpc.branch(:, BR_STATUS), nl, nb) + ...
0057        sparse(1:nl, e2i(mpc.branch(:, T_BUS)),  mpc.branch(:, BR_STATUS), nl, nb);
0058 
0059 if nnz(C_on)
0060     [groups, isolated] = connected_components(C_on);
0061 else
0062     groups = [];
0063     isolated = 1:nb;
0064 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005