Home > matpower4.1 > @opf_model > getv.m

getv

PURPOSE ^

GETV Returns initial value, lower bound and upper bound for opt variables.

SYNOPSIS ^

function [v0, vl, vu] = getv(om, name)

DESCRIPTION ^

GETV  Returns initial value, lower bound and upper bound for opt variables.
   [V0, VL, VU] = GETV(OM)
   [V0, VL, VU] = GETV(OM, NAME)
   Returns the Returns value, lower bound and upper bound for the full
   optimization variable vector, or for a specific named variable set.

   Examples:
       [x, xmin, xmax] = getv(om);
       [Pg, Pmin, Pmax] = getv(om, 'Pg');
   
   See also OPF_MODEL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [v0, vl, vu] = getv(om, name)
0002 %GETV  Returns initial value, lower bound and upper bound for opt variables.
0003 %   [V0, VL, VU] = GETV(OM)
0004 %   [V0, VL, VU] = GETV(OM, NAME)
0005 %   Returns the Returns value, lower bound and upper bound for the full
0006 %   optimization variable vector, or for a specific named variable set.
0007 %
0008 %   Examples:
0009 %       [x, xmin, xmax] = getv(om);
0010 %       [Pg, Pmin, Pmax] = getv(om, 'Pg');
0011 %
0012 %   See also OPF_MODEL.
0013 
0014 %   MATPOWER
0015 %   $Id: getv.m,v 1.7 2010/04/26 19:45:25 ray Exp $
0016 %   by Ray Zimmerman, PSERC Cornell
0017 %   Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC)
0018 %
0019 %   This file is part of MATPOWER.
0020 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0021 %
0022 %   MATPOWER is free software: you can redistribute it and/or modify
0023 %   it under the terms of the GNU General Public License as published
0024 %   by the Free Software Foundation, either version 3 of the License,
0025 %   or (at your option) any later version.
0026 %
0027 %   MATPOWER is distributed in the hope that it will be useful,
0028 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0029 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0030 %   GNU General Public License for more details.
0031 %
0032 %   You should have received a copy of the GNU General Public License
0033 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0034 %
0035 %   Additional permission under GNU GPL version 3 section 7
0036 %
0037 %   If you modify MATPOWER, or any covered work, to interface with
0038 %   other modules (such as MATLAB code and MEX-files) available in a
0039 %   MATLAB(R) or comparable environment containing parts covered
0040 %   under other licensing terms, the licensors of MATPOWER grant
0041 %   you additional permission to convey the resulting work.
0042 
0043 if nargin < 2
0044     v0 = []; vl = []; vu = [];
0045     for k = 1:om.var.NS
0046         name = om.var.order{k};
0047         v0 = [ v0; om.var.data.v0.(name) ];
0048         vl = [ vl; om.var.data.vl.(name) ];
0049         vu = [ vu; om.var.data.vu.(name) ];
0050     end
0051 else
0052     if isfield(om.var.idx.N, name)
0053         v0 = om.var.data.v0.(name);
0054         vl = om.var.data.vl.(name);
0055         vu = om.var.data.vu.(name);
0056     else
0057         v0 = [];
0058         vl = [];
0059         vu = [];
0060     end
0061 end

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005