Home > matpower7.1 > extras > syngrid > lib > nsw_conn_check.m

nsw_conn_check

PURPOSE ^

suppose a topology, n nodes, m links, given:

SYNOPSIS ^

function [lambda2,L,Lad,connected,eigs]=nsw_conn_check(link_ids,n)

DESCRIPTION ^

 suppose a topology, n nodes, m links, given:
 network's link index matrix: % link_ids (m by 2),
 calculate:
 its Laplace matrix: L (n by n),
 link admission matrix: Lad (m by n),
 the algebraic connectivity index: lamba2,
 which is the second smallest eig of L.
 by wzf, 07/2008

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [lambda2,L,Lad,connected,eigs]=nsw_conn_check(link_ids,n)
0002 % suppose a topology, n nodes, m links, given:
0003 % network's link index matrix: % link_ids (m by 2),
0004 % calculate:
0005 % its Laplace matrix: L (n by n),
0006 % link admission matrix: Lad (m by n),
0007 % the algebraic connectivity index: lamba2,
0008 % which is the second smallest eig of L.
0009 % by wzf, 07/2008
0010 
0011 %   SynGrid
0012 %   Copyright (c) 2008, 2017-2018, Electric Power and Energy Systems (EPES) Research Lab
0013 %   by Zhifang Wang, Virginia Commonwealth University
0014 %
0015 %   This file is part of SynGrid.
0016 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0017 
0018 m = length(link_ids);
0019 Lad = zeros(m,n);
0020 for k = 1:m
0021     nodei=link_ids(k,1); nodej=link_ids(k,2);
0022     Lad(k,nodei)=1;
0023     Lad(k,nodej)=-1;
0024 end
0025 L = Lad'*Lad;
0026 eigs = sort(eig(L));
0027 lambda2 = eigs(2);
0028 
0029 if(lambda2 < 1e-6)
0030     connected = 0; % not connected
0031 else
0032     connected = 1;
0033 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005