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

sgvm_perform_permute

PURPOSE ^

SGVM_PERFORM_PERMUTE perform node property permutation on MPC

SYNOPSIS ^

function mpc = sgvm_perform_permute(mpc, v, permORnmap)

DESCRIPTION ^

SGVM_PERFORM_PERMUTE perform node property permutation on MPC
   MPC = SGVM_PERFORM_PERMUTE(MPC, V, PERMORNMAP)

   Vector V is *either* PERM: a mapping that permutes *properties*
                         or
   Vector V is NMAP: a mapping of node numbers.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function mpc = sgvm_perform_permute(mpc, v, permORnmap)
0002 %SGVM_PERFORM_PERMUTE perform node property permutation on MPC
0003 %   MPC = SGVM_PERFORM_PERMUTE(MPC, V, PERMORNMAP)
0004 %
0005 %   Vector V is *either* PERM: a mapping that permutes *properties*
0006 %                         or
0007 %   Vector V is NMAP: a mapping of node numbers.
0008 
0009 %   SynGrid
0010 %   Copyright (c) 2018, Power Systems Engineering Research Center (PSERC)
0011 %   by Eran Schweitzer, Arizona State University
0012 %
0013 %   This file is part of SynGrid.
0014 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0015 
0016 define_constants;
0017 nb = size(mpc.bus, 1);
0018 
0019 switch permORnmap
0020 case 'perm'
0021     perm = v;
0022     nmap = full(sparse(perm, 1, 1:nb));
0023 case 'nmap'
0024     nmap = v;
0025     perm = full(sparse(nmap,1, 1:nb));
0026 end
0027 % node property vector x is permuted as x(perm)
0028 % bus numbers , BUS_I or GEN_BUS can be mapped with nmap(GEN_BUS)
0029 % for bus matrix we use perm, for gen matrix nmap.
0030 mpc.bus = [mpc.bus(:,BUS_I), mpc.bus(perm,2:end)];
0031 mpc.gen = [nmap(mpc.gen(:,GEN_BUS)), mpc.gen(:,2:end)];

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