Home > matpower6.0 > extras > reduction > Initiation.m

Initiation

PURPOSE ^

Subroutine Initiation read in the input full model data and convert the

SYNOPSIS ^

function [NFROM,NTO,BraNum,LineB,ShuntB,BCIRC,BusNum,NUMB,SelfB,mpc,ExBus,newbusnum,oldbusnum] = Initiation(mpc,ExBus)

DESCRIPTION ^

 Subroutine Initiation read in the input full model data and convert the
 data format to be good to generate the full model admittance matrix.
 
 [NFROM,NTO,BraNum,LineB,ShuntB,BCIRC,BusNum,NUMB,SelfB,mpc,ExBus,newbusnum,oldbusnum] = Initiation(mpc,ExBus)

 INPUT DATA:
   mpc, struct, full model data in MATPOWER case format
   ExBus, n*1 vector, includes indices of external buses

 OUTPUT DATA
   NFROM, 1*n array, includes indices of all from end buses
   NTO, 1*n array, includes indices of all to end buses
   BraNum, 1*n array, includes indices of all branches
   LineB, 1*n array, includes line admittance of branches
   ShuntB, 1*n array, includes line shunt admittance of branches
   mpc, struct, full model in MATPOWER case format
   ExBus, n*1 vector, includes external bus indices
   newbusnum, 1*n array, indices of buses in internal bus numbering
   oldbusnum, 1*n array, indices of buses in original bus numbering
 NOTE:
   All output bus indices are in internal bus numbering.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [NFROM,NTO,BraNum,LineB,ShuntB,BCIRC,BusNum,NUMB,SelfB,mpc,ExBus,newbusnum,oldbusnum] = Initiation(mpc,ExBus)
0002 % Subroutine Initiation read in the input full model data and convert the
0003 % data format to be good to generate the full model admittance matrix.
0004 %
0005 % [NFROM,NTO,BraNum,LineB,ShuntB,BCIRC,BusNum,NUMB,SelfB,mpc,ExBus,newbusnum,oldbusnum] = Initiation(mpc,ExBus)
0006 %
0007 % INPUT DATA:
0008 %   mpc, struct, full model data in MATPOWER case format
0009 %   ExBus, n*1 vector, includes indices of external buses
0010 %
0011 % OUTPUT DATA
0012 %   NFROM, 1*n array, includes indices of all from end buses
0013 %   NTO, 1*n array, includes indices of all to end buses
0014 %   BraNum, 1*n array, includes indices of all branches
0015 %   LineB, 1*n array, includes line admittance of branches
0016 %   ShuntB, 1*n array, includes line shunt admittance of branches
0017 %   mpc, struct, full model in MATPOWER case format
0018 %   ExBus, n*1 vector, includes external bus indices
0019 %   newbusnum, 1*n array, indices of buses in internal bus numbering
0020 %   oldbusnum, 1*n array, indices of buses in original bus numbering
0021 % NOTE:
0022 %   All output bus indices are in internal bus numbering.
0023 
0024 %   MATPOWER
0025 %   Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC)
0026 %   by Yujia Zhu, PSERC ASU
0027 %
0028 %   This file is part of MATPOWER.
0029 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0030 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0031 
0032 mpc.bus = sortrows(mpc.bus,1); % sort the buses
0033 oldbusnum = mpc.bus(:,1);
0034 newbusnum = [1:size(mpc.bus,1)]';
0035 mpc.bus(:,1) = newbusnum;
0036 mpc.branch(:,1) = interp1(oldbusnum,newbusnum,mpc.branch(:,1)); % change the branch terminal bus number
0037 mpc.branch(:,2) = interp1(oldbusnum,newbusnum,mpc.branch(:,2)); % change the branch terminal bus number
0038 mpc.gen(:,1)=interp1(oldbusnum,newbusnum,mpc.gen(:,1)); % change the generator bus number
0039 ExBus = interp1(oldbusnum,newbusnum,ExBus')';
0040 % bus data
0041 NUMB = newbusnum;
0042 BusNum = size(mpc.bus,1);
0043 SelfB = mpc.bus(:,6)./mpc.baseMVA;
0044 % branch data
0045 % status = mpc.branch(:,11);
0046 % delete all out of service branches
0047 % mpc.branch(status==0,:)=[];
0048 % status(status==0)=[];
0049 BraNum = size(mpc.branch,1);
0050 NFROM = mpc.branch(:,1);
0051 NTO = mpc.branch(:,2);
0052 LineB = 1./mpc.branch(:,4); % calculate the branch susceptance (b)
0053 ShuntB = mpc.branch(:,5)/2; % branch shunts;
0054 BCIRC = GenerateBCIRC(mpc.branch);
0055 % update SelfB
0056 for i = 1:BraNum
0057     SelfB(NFROM(i))=SelfB(NFROM(i))+LineB(i)+ShuntB(i);
0058     SelfB(NTO(i))=SelfB(NTO(i))+LineB(i)+ShuntB(i);
0059 end
0060 
0061 
0062 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005