Home > matpower5.1 > @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 %   Copyright (c) 2008-2015 by Power System Engineering Research Center (PSERC)
0043 %   by Ray Zimmerman, PSERC Cornell
0044 %
0045 %   $Id: opf_model.m 2644 2015-03-11 19:34:22Z ray $
0046 %
0047 %   This file is part of MATPOWER.
0048 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0049 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0050 
0051 if nargin == 0
0052     es = struct();
0053     s = struct('mpc', es);
0054     om = opt_model;
0055     om = class(s, 'opf_model', om);
0056 else
0057     if isa(mpc,'opf_model') 
0058         om = mpc;
0059     else
0060         if isfield(mpc, 'om')    %% avoid nesting
0061             s = struct('mpc', rmfield(mpc, 'om'));
0062         else
0063             s = struct('mpc', mpc);
0064         end
0065         om = opt_model;
0066         om = class(s, 'opf_model', om);
0067     end
0068 end

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