Home > matpower7.0 > 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-2016, Power Systems Engineering Research Center (PSERC)
0010 %   by Rui Bo
0011 %
0012 %   This file is part of MATPOWER/mx-se.
0013 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0014 %   See https://github.com/MATPOWER/mx-se/ for more info.
0015 
0016 %% get non reference buses
0017 nonref = [pv;pq];
0018 
0019 if varIndex <= length(nonref)
0020     varType = 'Va';
0021     newIdx = varIndex;
0022 else
0023     varType = 'Vm';
0024     newIdx = varIndex - length(nonref);
0025 end
0026 varName = sprintf('%s%d', varType, nonref(newIdx));

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005