Home > matpower7.0 > extras > reduction > PivotData.m

PivotData

PURPOSE ^

Subroutine PivotData do pivotting to the input addmittance matrix. Two

SYNOPSIS ^

function [DataB,ERP,CIndx,PivOrd,PivInd] = PivotData(DataB,ERP,CIndx,ExBus,NUMB,BoundBus)

DESCRIPTION ^

 Subroutine PivotData do pivotting to the input addmittance matrix. Two
 pivotting will be done: 1. columns and rows corresponding to external
 buses will be pivotted to the top left corner of the input matrix. 2.
 Tinney One optimal ordering strategy will be applied to pivot the data in
 order to reduce fills during (Partial) LU factorization.

   [DataB,ERP,CIndx,PivOrd,PivInd] = PivotData(DataB,ERP,CIndx,ExBus,NUMB,BoundBus)

 INPUT DATA:
   DataB: 1*n array, includes addmittance data of the full model before
   pivotting
   ERP: 1*n array, includes end of row pointer before pivotting
   CIndx: 1*n array, includes column index pointer before pivotting
   ExBus: 1*n array, includes external bus indices in internal numbering
   NUMB: 1*n array, includes bus numbers in internal numbering

 OUTPUT DATA:
   DataB: 1*n array, includes pivotted addmittance data of the full model
   ERP: 1*n array, includes end of row pointer before pivotting
   CIndx: 1*n array, includes column index pointer
   PivOrd: 1*n array, includes bus indices after pivotting
   PivInd: 1*n array, includes bus ordering after pivotting

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [DataB,ERP,CIndx,PivOrd,PivInd] = PivotData(DataB,ERP,CIndx,ExBus,NUMB,BoundBus)
0002 % Subroutine PivotData do pivotting to the input addmittance matrix. Two
0003 % pivotting will be done: 1. columns and rows corresponding to external
0004 % buses will be pivotted to the top left corner of the input matrix. 2.
0005 % Tinney One optimal ordering strategy will be applied to pivot the data in
0006 % order to reduce fills during (Partial) LU factorization.
0007 %
0008 %   [DataB,ERP,CIndx,PivOrd,PivInd] = PivotData(DataB,ERP,CIndx,ExBus,NUMB,BoundBus)
0009 %
0010 % INPUT DATA:
0011 %   DataB: 1*n array, includes addmittance data of the full model before
0012 %   pivotting
0013 %   ERP: 1*n array, includes end of row pointer before pivotting
0014 %   CIndx: 1*n array, includes column index pointer before pivotting
0015 %   ExBus: 1*n array, includes external bus indices in internal numbering
0016 %   NUMB: 1*n array, includes bus numbers in internal numbering
0017 %
0018 % OUTPUT DATA:
0019 %   DataB: 1*n array, includes pivotted addmittance data of the full model
0020 %   ERP: 1*n array, includes end of row pointer before pivotting
0021 %   CIndx: 1*n array, includes column index pointer
0022 %   PivOrd: 1*n array, includes bus indices after pivotting
0023 %   PivInd: 1*n array, includes bus ordering after pivotting
0024 
0025 %   MATPOWER
0026 %   Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC)
0027 %   by Yujia Zhu, PSERC ASU
0028 %
0029 %   This file is part of MATPOWER/mx-reduction.
0030 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0031 %   See https://github.com/MATPOWER/mx-reduction/ for more info.
0032 
0033 DataBO = zeros(size(DataB));
0034 CIndxO = zeros(size(CIndx));
0035 ERPO = zeros(size(ERP));
0036 
0037 % do pivot
0038 ExBus = sort(ExBus);
0039 tf1 = ismember(NUMB,ExBus);
0040 tf2 = ismember(NUMB,BoundBus);
0041 PivInd = [sort(NUMB(tf1==1))',sort(NUMB(tf2==1))',sort(NUMB(tf1==0&tf2==0))'];
0042 PivOrd = zeros(size(PivInd));
0043 
0044 for i = 1:length(PivInd)
0045     PivOrd(PivInd(i))=i;
0046 end
0047 
0048 %% Do Tinnney One ordering to reduce fills
0049 [PivOrd,PivInd] = TinneyOne(ERP,PivInd,PivOrd,ExBus);
0050 
0051 %% Generate the datas in compact storage format
0052 for i = 1:length(NUMB)
0053     len = ERP(PivInd(i)+1)-ERP(PivInd(i));
0054     ERPO(i+1)=ERPO(i)+len;
0055     CIndxO((ERPO(i)+1):ERPO(i+1))=PivOrd(CIndx(ERP(PivInd(i))+1:ERP(PivInd(i)+1)));
0056     DataBO((ERPO(i)+1):ERPO(i+1))=DataB(ERP(PivInd(i))+1:ERP(PivInd(i)+1));
0057 end
0058 
0059 %% Generate the output data
0060 DataB = DataBO;
0061 CIndx = CIndxO;
0062 ERP = ERPO;
0063 
0064 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005