Home > matpower7.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-2016, Power Systems Engineering Research Center (PSERC)
0019 %   by Yujia Zhu, PSERC ASU
0020 %
0021 %   This file is part of MATPOWER/mx-reduction.
0022 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0023 %   See https://github.com/MATPOWER/mx-reduction/ for more info.
0024 
0025 % convert bus number
0026     mpc.bus(:,1)=interp1(oldbusnum,newbusnum,mpc.bus(:,1));
0027     % convert branch terminal bus number
0028     mpc.branch(:,1)=interp1(oldbusnum,newbusnum,mpc.branch(:,1));
0029     mpc.branch(:,2)=interp1(oldbusnum,newbusnum,mpc.branch(:,2));
0030     % convert generator bus number
0031     mpc.gen(:,1)=interp1(oldbusnum,newbusnum,mpc.gen(:,1));
0032 %     if isfield(mpc,'dcline')
0033 %     % convert hvdc line bus number
0034 %     mpc.dcline(:,1)=interp1(oldbusnum,newbusnum,mpc.dcline(:,1));
0035 %     mpc.dcline(:,2)=interp1(oldbusnum,newbusnum,mpc.dcline(:,2));
0036 %     end
0037 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005