Home > matpower5.0 > @opf_model > opf_model.m

opf_model

PURPOSE ^

OPF_MODEL Constructor for OPF model class.

SYNOPSIS ^

function om = opf_model(mpc)

DESCRIPTION ^

OPF_MODEL  Constructor for OPF model class.
   OM = OPF_MODEL(MPC)

   This class implements the OPF model object used to encapsulate
   a given OPF problem formulation. It allows for access to optimization
   variables, constraints and costs in named blocks, keeping track of the
   ordering and indexing of the blocks as variables, constraints and costs
   are added to the problem.

   This class is a sub-class of OPT_MODEL and simply adds the 'mpc'
   field for storing the MATPOWER case struct used to build the object
   along with the get_mpc() method.

   The following is the structure of the data in the OPF model object.
   Each field of .idx or .data is a struct whose field names are the names
   of the corresponding blocks of vars, constraints or costs (found in
   order in the corresponding .order field). The description next to these
   fields gives the meaning of the value for each named sub-field.
   E.g. om.var.data.v0.Pg contains a vector of initial values for the 'Pg'
   block of variables.

   om
       .opt_model  - the corresponding OPT_MODEL object
       .mpc        - MATPOWER case struct used to create this model object
           .baseMVA
           .bus
           .branch
           .gen
           .gencost
           .A  (if present, must have l, u)
           .l
           .u
           .N  (if present, must have fparm, H, Cw)
           .fparm
           .H
           .Cw

   See also OPT_MODEL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function om = opf_model(mpc)
0002 %OPF_MODEL  Constructor for OPF model class.
0003 %   OM = OPF_MODEL(MPC)
0004 %
0005 %   This class implements the OPF model object used to encapsulate
0006 %   a given OPF problem formulation. It allows for access to optimization
0007 %   variables, constraints and costs in named blocks, keeping track of the
0008 %   ordering and indexing of the blocks as variables, constraints and costs
0009 %   are added to the problem.
0010 %
0011 %   This class is a sub-class of OPT_MODEL and simply adds the 'mpc'
0012 %   field for storing the MATPOWER case struct used to build the object
0013 %   along with the get_mpc() method.
0014 %
0015 %   The following is the structure of the data in the OPF model object.
0016 %   Each field of .idx or .data is a struct whose field names are the names
0017 %   of the corresponding blocks of vars, constraints or costs (found in
0018 %   order in the corresponding .order field). The description next to these
0019 %   fields gives the meaning of the value for each named sub-field.
0020 %   E.g. om.var.data.v0.Pg contains a vector of initial values for the 'Pg'
0021 %   block of variables.
0022 %
0023 %   om
0024 %       .opt_model  - the corresponding OPT_MODEL object
0025 %       .mpc        - MATPOWER case struct used to create this model object
0026 %           .baseMVA
0027 %           .bus
0028 %           .branch
0029 %           .gen
0030 %           .gencost
0031 %           .A  (if present, must have l, u)
0032 %           .l
0033 %           .u
0034 %           .N  (if present, must have fparm, H, Cw)
0035 %           .fparm
0036 %           .H
0037 %           .Cw
0038 %
0039 %   See also OPT_MODEL.
0040 
0041 %   MATPOWER
0042 %   $Id: opf_model.m 2332 2014-06-09 17:11:52Z ray $
0043 %   by Ray Zimmerman, PSERC Cornell
0044 %   Copyright (c) 2008-2012 by Power System Engineering Research Center (PSERC)
0045 %
0046 %   This file is part of MATPOWER.
0047 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0048 %
0049 %   MATPOWER is free software: you can redistribute it and/or modify
0050 %   it under the terms of the GNU General Public License as published
0051 %   by the Free Software Foundation, either version 3 of the License,
0052 %   or (at your option) any later version.
0053 %
0054 %   MATPOWER is distributed in the hope that it will be useful,
0055 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0056 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0057 %   GNU General Public License for more details.
0058 %
0059 %   You should have received a copy of the GNU General Public License
0060 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0061 %
0062 %   Additional permission under GNU GPL version 3 section 7
0063 %
0064 %   If you modify MATPOWER, or any covered work, to interface with
0065 %   other modules (such as MATLAB code and MEX-files) available in a
0066 %   MATLAB(R) or comparable environment containing parts covered
0067 %   under other licensing terms, the licensors of MATPOWER grant
0068 %   you additional permission to convey the resulting work.
0069 
0070 if nargin == 0
0071     es = struct();
0072     s = struct('mpc', es);
0073     om = opt_model;
0074     om = class(s, 'opf_model', om);
0075 else
0076     if isa(mpc,'opf_model') 
0077         om = mpc;
0078     else
0079         if isfield(mpc, 'om')    %% avoid nesting
0080             s = struct('mpc', rmfield(mpc, 'om'));
0081         else
0082             s = struct('mpc', mpc);
0083         end
0084         om = opt_model;
0085         om = class(s, 'opf_model', om);
0086     end
0087 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005