Home > matpower5.1 > 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 %   Copyright (c) 2012-2015 by Power System Engineering Research Center (PSERC)
0017 %   by Ray Zimmerman, PSERC Cornell
0018 %
0019 %   $Id: find_islands.m 2644 2015-03-11 19:34:22Z ray $
0020 %
0021 %   This file is part of MATPOWER.
0022 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0023 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0024 
0025 %% define named indices into data matrices
0026 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0027     VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0028 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0029     TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0030     ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0031 
0032 %% find islands
0033 nb  = size(mpc.bus, 1);     %% number of buses
0034 nl  = size(mpc.branch, 1);  %% number of branches
0035 
0036 e2i = sparse(mpc.bus(:, BUS_I), ones(nb, 1), 1:nb, max(mpc.bus(:, BUS_I)), 1);
0037 C_on = sparse(1:nl, e2i(mpc.branch(:, F_BUS)), -mpc.branch(:, BR_STATUS), nl, nb) + ...
0038        sparse(1:nl, e2i(mpc.branch(:, T_BUS)),  mpc.branch(:, BR_STATUS), nl, nb);
0039 
0040 if nnz(C_on)
0041     [groups, isolated] = connected_components(C_on);
0042 else
0043     groups = [];
0044     isolated = 1:nb;
0045 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005