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
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-2015 by Power System Engineering Research Center (PSERC) 0027 % by Yujia Zhu, PSERC ASU 0028 % 0029 % $Id: PivotData.m 2655 2015-03-18 16:40:32Z ray $ 0030 % 0031 % This file is part of MATPOWER. 0032 % Covered by the 3-clause BSD License (see LICENSE file for details). 0033 % See http://www.pserc.cornell.edu/matpower/ for more info. 0034 0035 DataBO = zeros(size(DataB)); 0036 CIndxO = zeros(size(CIndx)); 0037 ERPO = zeros(size(ERP)); 0038 0039 % do pivot 0040 ExBus = sort(ExBus); 0041 tf1 = ismember(NUMB,ExBus); 0042 tf2 = ismember(NUMB,BoundBus); 0043 PivInd = [sort(NUMB(tf1==1))',sort(NUMB(tf2==1))',sort(NUMB(tf1==0&tf2==0))']; 0044 PivOrd = zeros(size(PivInd)); 0045 0046 for i = 1:length(PivInd) 0047 PivOrd(PivInd(i))=i; 0048 end 0049 0050 %% Do Tinnney One ordering to reduce fills 0051 [PivOrd,PivInd] = TinneyOne(ERP,PivInd,PivOrd,ExBus); 0052 0053 %% Generate the datas in compact storage format 0054 for i = 1:length(NUMB) 0055 len = ERP(PivInd(i)+1)-ERP(PivInd(i)); 0056 ERPO(i+1)=ERPO(i)+len; 0057 CIndxO((ERPO(i)+1):ERPO(i+1))=PivOrd(CIndx(ERP(PivInd(i))+1:ERP(PivInd(i)+1))); 0058 DataBO((ERPO(i)+1):ERPO(i+1))=DataB(ERP(PivInd(i))+1:ERP(PivInd(i)+1)); 0059 end 0060 0061 %% Generate the output data 0062 DataB = DataBO; 0063 CIndx = CIndxO; 0064 ERP = ERPO; 0065 0066 end