Home > matpower5.1 > 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-2015 by Power System Engineering Research Center (PSERC)
0026 %   by Yujia Zhu, PSERC ASU
0027 %
0028 %   $Id: Initiation.m 2655 2015-03-18 16:40:32Z ray $
0029 %
0030 %   This file is part of MATPOWER.
0031 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0032 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0033 
0034 mpc.bus = sortrows(mpc.bus,1); % sort the buses
0035 oldbusnum = mpc.bus(:,1);
0036 newbusnum = [1:size(mpc.bus,1)]';
0037 mpc.bus(:,1) = newbusnum;
0038 mpc.branch(:,1) = interp1(oldbusnum,newbusnum,mpc.branch(:,1)); % change the branch terminal bus number
0039 mpc.branch(:,2) = interp1(oldbusnum,newbusnum,mpc.branch(:,2)); % change the branch terminal bus number
0040 mpc.gen(:,1)=interp1(oldbusnum,newbusnum,mpc.gen(:,1)); % change the generator bus number
0041 ExBus = interp1(oldbusnum,newbusnum,ExBus')';
0042 % bus data
0043 NUMB = newbusnum;
0044 BusNum = size(mpc.bus,1);
0045 SelfB = mpc.bus(:,6)./mpc.baseMVA;
0046 % branch data
0047 % status = mpc.branch(:,11);
0048 % delete all out of service branches
0049 % mpc.branch(status==0,:)=[];
0050 % status(status==0)=[];
0051 BraNum = size(mpc.branch,1);
0052 NFROM = mpc.branch(:,1);
0053 NTO = mpc.branch(:,2);
0054 LineB = 1./mpc.branch(:,4); % calculate the branch susceptance (b)
0055 ShuntB = mpc.branch(:,5)/2; % branch shunts;
0056 BCIRC = GenerateBCIRC(mpc.branch);
0057 % update SelfB
0058 for i = 1:BraNum
0059     SelfB(NFROM(i))=SelfB(NFROM(i))+LineB(i)+ShuntB(i);
0060     SelfB(NTO(i))=SelfB(NTO(i))+LineB(i)+ShuntB(i);
0061 end
0062 
0063 
0064 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005