Home > matpower4.0 > @opf_model > getN.m

getN

PURPOSE ^

GETN Returns the number of variables, constraints or cost rows.

SYNOPSIS ^

function N = getN(om, selector, name)

DESCRIPTION ^

GETN  Returns the number of variables, constraints or cost rows.
   N = GETN(OM, SELECTOR)
   N = GETN(OM, SELECTOR, NAME)

   Returns either the total number of variables/constraints/cost rows
   or the number corresponding to a specified named block.

   Examples:
       N = getN(om, 'var')         : total number of variables
       N = getN(om, 'lin')         : total number of linear constraints
       N = getN(om, 'nln')         : total number of nonlinear constraints
       N = getN(om, 'cost')        : total number of cost rows (in N)
       N = getN(om, 'var', name)   : number of variables in named set
       N = getN(om, 'lin', name)   : number of linear constraints in named set
       N = getN(om, 'nln', name)   : number of nonlinear cons. in named set
       N = getN(om, 'cost', name)  : number of cost rows (in N) in named set

   See also OPF_MODEL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function N = getN(om, selector, name)
0002 %GETN  Returns the number of variables, constraints or cost rows.
0003 %   N = GETN(OM, SELECTOR)
0004 %   N = GETN(OM, SELECTOR, NAME)
0005 %
0006 %   Returns either the total number of variables/constraints/cost rows
0007 %   or the number corresponding to a specified named block.
0008 %
0009 %   Examples:
0010 %       N = getN(om, 'var')         : total number of variables
0011 %       N = getN(om, 'lin')         : total number of linear constraints
0012 %       N = getN(om, 'nln')         : total number of nonlinear constraints
0013 %       N = getN(om, 'cost')        : total number of cost rows (in N)
0014 %       N = getN(om, 'var', name)   : number of variables in named set
0015 %       N = getN(om, 'lin', name)   : number of linear constraints in named set
0016 %       N = getN(om, 'nln', name)   : number of nonlinear cons. in named set
0017 %       N = getN(om, 'cost', name)  : number of cost rows (in N) in named set
0018 %
0019 %   See also OPF_MODEL.
0020 
0021 %   MATPOWER
0022 %   $Id: getN.m,v 1.5 2010/06/09 14:56:58 ray Exp $
0023 %   by Ray Zimmerman, PSERC Cornell
0024 %   Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC)
0025 %
0026 %   This file is part of MATPOWER.
0027 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0028 %
0029 %   MATPOWER is free software: you can redistribute it and/or modify
0030 %   it under the terms of the GNU General Public License as published
0031 %   by the Free Software Foundation, either version 3 of the License,
0032 %   or (at your option) any later version.
0033 %
0034 %   MATPOWER is distributed in the hope that it will be useful,
0035 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0036 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0037 %   GNU General Public License for more details.
0038 %
0039 %   You should have received a copy of the GNU General Public License
0040 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0041 %
0042 %   Additional permission under GNU GPL version 3 section 7
0043 %
0044 %   If you modify MATPOWER, or any covered work, to interface with
0045 %   other modules (such as MATLAB code and MEX-files) available in a
0046 %   MATLAB(R) or comparable environment containing parts covered
0047 %   under other licensing terms, the licensors of MATPOWER grant
0048 %   you additional permission to convey the resulting work.
0049 
0050 if nargin < 3
0051     N = om.(selector).N;
0052 else
0053     if isfield(om.(selector).idx.N, name)
0054         N = om.(selector).idx.N.(name);
0055     else
0056         N = 0;
0057     end
0058 end

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005