Home > matpower7.0 > extras > reduction > PreProcessData.m

PreProcessData

PURPOSE ^

Subroutine PreProcess do following tasks to input model:

SYNOPSIS ^

function [mpc,ExBus]=PreProcessData(mpc,ExBus)

DESCRIPTION ^

 Subroutine PreProcess do following tasks to input model:
 1. Eliminate all isolated buses
 2. Eliminate all out-of-service branches
 3. Eliminate all in-service but connected to isolated bus branches
 4. Eliminate all HVDC line connected to isolated buses
 5. Eliminate all generators on isolated buses
 6. Update the list of external bus (ExBus) by eliminating the isolated
 buses in the list
 
   [mpc,ExBus]=PreProcessData(mpc,ExBus)

 INPUT DATA:
 mpc: struct, input original full model (MATPOWER case file)
 ExBus: 1*n array, original list of external buses

 OUTPUT DATA:
 mpc: struct, updated model
 ExBus: 1*n array, updated list of external buses

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [mpc,ExBus]=PreProcessData(mpc,ExBus)
0002 % Subroutine PreProcess do following tasks to input model:
0003 % 1. Eliminate all isolated buses
0004 % 2. Eliminate all out-of-service branches
0005 % 3. Eliminate all in-service but connected to isolated bus branches
0006 % 4. Eliminate all HVDC line connected to isolated buses
0007 % 5. Eliminate all generators on isolated buses
0008 % 6. Update the list of external bus (ExBus) by eliminating the isolated
0009 % buses in the list
0010 %
0011 %   [mpc,ExBus]=PreProcessData(mpc,ExBus)
0012 %
0013 % INPUT DATA:
0014 % mpc: struct, input original full model (MATPOWER case file)
0015 % ExBus: 1*n array, original list of external buses
0016 %
0017 % OUTPUT DATA:
0018 % mpc: struct, updated model
0019 % ExBus: 1*n array, updated list of external buses
0020 
0021 %   MATPOWER
0022 %   Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC)
0023 %   by Yujia Zhu, PSERC ASU
0024 %
0025 %   This file is part of MATPOWER/mx-reduction.
0026 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0027 %   See https://github.com/MATPOWER/mx-reduction/ for more info.
0028 
0029 mpc.bus = sortrows(mpc.bus,1);
0030 mpc.branch = sortrows(mpc.branch,[1,2]);
0031 numbr=size(mpc.branch,1);
0032 mpc.branch(mpc.branch(:,11)==0,:)=[];% eliminated all out-of-service lines
0033 isobus=mpc.bus(mpc.bus(:,2)==4,1);
0034 fprintf('\nEliminate %d isolated buses',length(isobus));
0035 tf1=ismember(mpc.branch(:,1),isobus);
0036 tf2=ismember(mpc.branch(:,2),isobus);
0037 mpc.branch(tf1|tf2,:)=[]; % eliminate all branch connected to isolated buses
0038 fprintf('\nEliminate %d branches',numbr-size(mpc.branch,1));
0039 
0040 mpc.bus(mpc.bus(:,2)==4,:)=[]; % eliminate all isolated buses
0041 tfgen=ismember(mpc.gen(:,1),isobus);
0042 mpc.gen(tfgen,:)=[]; % eliminate all generators on isolated buses
0043 fprintf('\nEliminate %d generators',length(tfgen(tfgen==1)));
0044 if isfield (mpc,'gencost')
0045     mpc.gencost(tfgen,:)=[];
0046 end
0047 ind=ismember(ExBus,isobus);
0048 ExBus(ind)=[];
0049 if isfield(mpc,'dcline')
0050     tfdc1=ismember(mpc.dcline(:,1),isobus);
0051     tfdc2=ismember(mpc.dcline(:,2),isobus);
0052     mpc.dcline(tfdc1|tfdc2,:)=[]; % eliminate dcline connecting isolated terminal
0053     fprintf('\nEliminate %d dc lines',length(length(find(tfdc1|tfdc2))));
0054 
0055 end
0056 fprintf('\nPreprocessing complete');
0057 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005