Home > matpower5.1 > extras > se > getVarName.m

getVarName

PURPOSE ^

GETVARNAME Get variable name by variable index (as in H matrix).

SYNOPSIS ^

function [varName] = getVarName(varIndex, pv, pq)

DESCRIPTION ^

GETVARNAME  Get variable name by variable index (as in H matrix).
   [OUTPUT PARAMETERS]
   varName: comprise both variable type ('Va', 'Vm') and the bus number of
   the variable. For instance, Va8, Vm10, etc.
   created by Rui Bo on Jan 9, 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [varName] = getVarName(varIndex, pv, pq)
0002 %GETVARNAME  Get variable name by variable index (as in H matrix).
0003 %   [OUTPUT PARAMETERS]
0004 %   varName: comprise both variable type ('Va', 'Vm') and the bus number of
0005 %   the variable. For instance, Va8, Vm10, etc.
0006 %   created by Rui Bo on Jan 9, 2010
0007 
0008 %   MATPOWER
0009 %   Copyright (c) 2009-2015 by Power System Engineering Research Center (PSERC)
0010 %   by Rui Bo
0011 %
0012 %   $Id: getVarName.m 2644 2015-03-11 19:34:22Z ray $
0013 %
0014 %   This file is part of MATPOWER.
0015 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0016 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0017 
0018 %% get non reference buses
0019 nonref = [pv;pq];
0020 
0021 if varIndex <= length(nonref)
0022     varType = 'Va';
0023     newIdx = varIndex;
0024 else
0025     varType = 'Vm';
0026     newIdx = varIndex - length(nonref);
0027 end
0028 varName = sprintf('%s%d', varType, nonref(newIdx));

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