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

sg_topology

PURPOSE ^

SG_TOPOLOGY Generate random power grid topology using RT-nestedSmallWorld

SYNOPSIS ^

function [youtN, Zpr, lambda2, L, A, indx] = sg_topology(N, N0, ks, ltc_k, topo_pars, rwd_pars, Zpr_pars)

DESCRIPTION ^

SG_TOPOLOGY Generate random power grid topology using RT-nestedSmallWorld
[YOUTN, ZPR, LAMBDA2, L, A, INDX] = ...
   SG_TOPOLOGY(N, N0, KS, LTC_K, TOPO_PARS, RWD_PARS, ZPR_PARS)

   Inputs:
       N - network size
       N0 - island size; if this given '0', the program will compute it
       ks - total number of islands
       ltc_k - total number of lattice connections between neighboring islands
       topo_pars - topology parameters
       rwd_pars - rewiring parameters
       Zpr_pars - line impedance parameters

   Outputs:
       youtN - actual network size;
       Zpr - generated line impedances;
       lambda2 - algebraic connectivity
       L - the Laplacian
       A - line admittance matrix;
       indx - link index

   model:  (1) form islands limited by connectivity limits
           (2) connect the islands with lattice connections

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [youtN, Zpr, lambda2, L, A, indx] = sg_topology(N, N0, ks, ltc_k, topo_pars, rwd_pars, Zpr_pars)
0002 %SG_TOPOLOGY Generate random power grid topology using RT-nestedSmallWorld
0003 %[YOUTN, ZPR, LAMBDA2, L, A, INDX] = ...
0004 %   SG_TOPOLOGY(N, N0, KS, LTC_K, TOPO_PARS, RWD_PARS, ZPR_PARS)
0005 %
0006 %   Inputs:
0007 %       N - network size
0008 %       N0 - island size; if this given '0', the program will compute it
0009 %       ks - total number of islands
0010 %       ltc_k - total number of lattice connections between neighboring islands
0011 %       topo_pars - topology parameters
0012 %       rwd_pars - rewiring parameters
0013 %       Zpr_pars - line impedance parameters
0014 %
0015 %   Outputs:
0016 %       youtN - actual network size;
0017 %       Zpr - generated line impedances;
0018 %       lambda2 - algebraic connectivity
0019 %       L - the Laplacian
0020 %       A - line admittance matrix;
0021 %       indx - link index
0022 %
0023 %   model:  (1) form islands limited by connectivity limits
0024 %           (2) connect the islands with lattice connections
0025 
0026 %   SynGrid
0027 %   Copyright (c) 2008-2018, Electric Power and Energy Systems (EPES) Research Lab
0028 %   by Zhifang Wang, Virginia Commonwealth University
0029 %
0030 %   This file is part of SynGrid.
0031 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0032 
0033 % obtain the parameters
0034 degModel = topo_pars{1}; mdeg = topo_pars{2};
0035 if(N0 == 0)
0036     N0 = round(3*exp(mdeg(1)));
0037     ks = ceil(N/N0);
0038 end
0039  % added to make youtN == N as given
0040     N0s = round(N/ks).*ones(1,ks);
0041     N0s(ks) = N-sum(N0s(1:ks-1));
0042     if(N~=sum(N0s))
0043         disp('error, youtN does not equal N as given!');
0044     end
0045     N0=N0s(1);
0046 if(isempty(rwd_pars)) % if rewired_pars not given
0047     if(N0 <= 30)
0048         p_lrwd = 0.24; p_nrwd = 0.43; avg_clsts = 2.6;
0049     elseif(N0 <= 57)
0050         p_lrwd = 0.22; p_nrwd = 0.37; avg_clsts = 3.0;
0051     elseif(N0 <= 118)
0052         p_lrwd = 0.21; p_nrwd = 0.46; avg_clsts = 2.0;
0053     elseif(N0 <= 300)
0054         %p_lrwd = 0.367; p_nrwd = 0.67; avg_clsts = 4.22;  % estimate from NYISO data
0055         %p_lrwd = 0.15; p_nrwd = 0.3; avg_clsts = 3; % for the clustreing coefficient
0056         p_lrwd = 0.1; p_nrwd = 0.1; avg_clsts = 3;
0057     else
0058         p_lrwd = 0.367; p_nrwd = 0.67; avg_clsts = 4.22;
0059     end
0060 else
0061     p_lrwd = rwd_pars(1); p_nrwd = rwd_pars(2); avg_clsts = rwd_pars(3);
0062 end
0063 bta = 1/avg_clsts;
0064 alph = bta*(p_nrwd/(1-p_nrwd));
0065 
0066 
0067 if(ltc_k==0) % if lattice connection not specified
0068     % the number of links between neighboring islands, each side have ltc_k links.
0069     ltc_k = 2;
0070 end
0071 
0072 % Form the topology
0073 indx =[];
0074 youtNs =zeros(ks,1);
0075 lls = zeros(ks*ltc_k,1); % starting nodes of lattice links between islands
0076 llt = zeros(ks*ltc_k,1); % terminating nodes
0077 
0078 for ni = 1:ks
0079     % the island with size of N0
0080     N0i=N0s(ni);
0081     [Ai,Mai,indxi,Mdi,lbd2i,youtNi,L] = nsw_cluster_smallworld(N0i,degModel,mdeg,p_lrwd,alph,bta);
0082     indx =[indx;
0083            indxi+sum(youtNs)]; % generate ks islands, update links of each island
0084 
0085     % generate lattice links between islands
0086     lls( (ni-1)*ltc_k+1 : ni*ltc_k ) = randi([1,youtNi],ltc_k,1)+sum(youtNs);
0087     if(ni>1)
0088         llt( (ni-2)*ltc_k+1 : (ni-1)*ltc_k ) = randi([1,youtNi],ltc_k,1)+sum(youtNs);
0089     else
0090         llt( (ks-1)*ltc_k+1 :  ks*ltc_k )  =  randi([1,youtNi],ltc_k,1)+sum(youtNs);
0091     end
0092     % update island size
0093     youtNs(ni) = youtNi;
0094     end
0095 youtN = sum(youtNs); % total topology size
0096 if(ks>1)
0097    indx     = [indx; [lls llt] ]; % all the links
0098    m3 = length(lls);
0099 else
0100     m3 =0;
0101 end
0102 m = length(indx(:,1));
0103 m2 = round((m-m3)*p_lrwd);
0104 m1 = m-m2-m3;
0105 [lambda2,L,A]=nsw_conn_check(indx,youtN);
0106 
0107 % Generate the line impedances
0108 Zpr = nsw_gen_Zpr(Zpr_pars, [m1 m2 m3]);

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