Home > matpower7.0 > extras > syngrid > lib > sgvm_mpc2data.m

sgvm_mpc2data

PURPOSE ^

SGVM_MPC2DATA create VARIATIONS MODE inputs from MATPOWER case

SYNOPSIS ^

function [data, topo] = sgvm_mpc2data(mpc)

DESCRIPTION ^

SGVM_MPC2DATA create VARIATIONS MODE inputs from MATPOWER case
   [DATA, TOPO] = SGVM_MPC2DATA(MPC)

   Converts a MATPOWER structure to a data structure that is suitable for
   sampling via the SGVM_DATA2MPC function. This is essentially a function
   that strips out the used data from the MPC structure.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [data, topo] = sgvm_mpc2data(mpc)
0002 %SGVM_MPC2DATA create VARIATIONS MODE inputs from MATPOWER case
0003 %   [DATA, TOPO] = SGVM_MPC2DATA(MPC)
0004 %
0005 %   Converts a MATPOWER structure to a data structure that is suitable for
0006 %   sampling via the SGVM_DATA2MPC function. This is essentially a function
0007 %   that strips out the used data from the MPC structure.
0008 
0009 %   SynGrid
0010 %   Copyright (c) 2018, Power Systems Engineering Research Center (PSERC)
0011 %   by Eran Schweitzer, Arizona State University
0012 %
0013 %   This file is part of SynGrid.
0014 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0015 
0016 %% some initializations
0017 define_constants;
0018 data = struct();
0019 nb = size(mpc.bus, 1);
0020 
0021 %% if not consecutive numbering use ext2int
0022 if ~all(mpc.bus(:,BUS_I)  == (1:nb).')
0023     mpc = ext2int(mpc);
0024 end
0025 
0026 %% power base
0027 data.baseMVA = mpc.baseMVA;
0028 
0029 %% branch
0030 data.branch = mpc.branch(:, [BR_R, BR_X, BR_B, RATE_A, TAP, SHIFT]);
0031 topo        = mpc.branch(:, [F_BUS, T_BUS]);
0032 %% load
0033 data.load   = mpc.bus(:, [PD, QD]);
0034 
0035 %% gen
0036 data.gen    = mpc.gen(:, [GEN_BUS, QMAX, QMIN, PMAX, PMIN]);
0037 
0038 %% gencost
0039 if isfield(mpc, 'gencost')
0040     data.gencost = mpc.gencost;
0041 end

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