Home > matpower5.1 > extras > reduction > MapBus.m

MapBus

PURPOSE ^

Subroutine MapBus convert bus indices from oldbusnum to newbusnum. The

SYNOPSIS ^

function [mpc]=MapBus(mpc,oldbusnum,newbusnum)

DESCRIPTION ^

 Subroutine MapBus convert bus indices from oldbusnum to newbusnum. The
 conversion will be done to fields including buses, branches and
 generators.

   [mpc]=MapBus(mpc,oldbusnum,newbusnum)

 INPUT DATA:
   mpc - struct, input model in MATPOWER format
   oldbusnum - 1*n array, the old bus indices which will be converted "from"
   newbusnum - 1*n array, the new bus indices which will be converted "to"

 OUTPUT DATA:
   mpc - sctruct, output model in MATPOWER format with converted bus
         indices.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [mpc]=MapBus(mpc,oldbusnum,newbusnum)
0002 % Subroutine MapBus convert bus indices from oldbusnum to newbusnum. The
0003 % conversion will be done to fields including buses, branches and
0004 % generators.
0005 %
0006 %   [mpc]=MapBus(mpc,oldbusnum,newbusnum)
0007 %
0008 % INPUT DATA:
0009 %   mpc - struct, input model in MATPOWER format
0010 %   oldbusnum - 1*n array, the old bus indices which will be converted "from"
0011 %   newbusnum - 1*n array, the new bus indices which will be converted "to"
0012 %
0013 % OUTPUT DATA:
0014 %   mpc - sctruct, output model in MATPOWER format with converted bus
0015 %         indices.
0016 
0017 %   MATPOWER
0018 %   Copyright (c) 2014-2015 by Power System Engineering Research Center (PSERC)
0019 %   by Yujia Zhu, PSERC ASU
0020 %
0021 %   $Id: MapBus.m 2655 2015-03-18 16:40:32Z ray $
0022 %
0023 %   This file is part of MATPOWER.
0024 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0025 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0026 
0027 % convert bus number
0028     mpc.bus(:,1)=interp1(oldbusnum,newbusnum,mpc.bus(:,1));
0029     % convert branch terminal bus number
0030     mpc.branch(:,1)=interp1(oldbusnum,newbusnum,mpc.branch(:,1));
0031     mpc.branch(:,2)=interp1(oldbusnum,newbusnum,mpc.branch(:,2));
0032     % convert generator bus number
0033     mpc.gen(:,1)=interp1(oldbusnum,newbusnum,mpc.gen(:,1));
0034 %     if isfield(mpc,'dcline')
0035 %     % convert hvdc line bus number
0036 %     mpc.dcline(:,1)=interp1(oldbusnum,newbusnum,mpc.dcline(:,1));
0037 %     mpc.dcline(:,2)=interp1(oldbusnum,newbusnum,mpc.dcline(:,2));
0038 %     end
0039 end

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