Home > matpower7.1 > mp-opt-model > lib > @mp_idx_manager > valid_named_set_type.m

valid_named_set_type

PURPOSE ^

VALID_NAMED_SET_TYPE Returns a label for the given named set type or empty.

SYNOPSIS ^

function str = valid_named_set_type(obj, set_type)

DESCRIPTION ^

VALID_NAMED_SET_TYPE  Returns a label for the given named set type or empty.

   -----  PRIVATE METHOD  -----

   STR = OBJ.VALID_NAMED_SET_TYPE(SET_TYPE)

   Returns a string corresponding to the type of the named set for
   valid values of SET_TYPE, otherwise an empty string. Can be used to
   check whether SET_TYPE is a valid type.

   Valid set types, and the corresponding values are defined as a struct
   returned by the DEF_SET_TYPES method.

   E.g. The following method ...
       function obj = def_set_types(obj)
           obj.set_types = struct(...
                   'var', 'variable', ...
                   'lin', 'linear constraint' ...
               );
       end

   ... indicates the following valid SET_TYPES and corresponding
   return values:

       SET_TYPE    STR
       'var'       'variable'
       'lin'       'linear constraint'

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function str = valid_named_set_type(obj, set_type)
0002 %VALID_NAMED_SET_TYPE  Returns a label for the given named set type or empty.
0003 %
0004 %   -----  PRIVATE METHOD  -----
0005 %
0006 %   STR = OBJ.VALID_NAMED_SET_TYPE(SET_TYPE)
0007 %
0008 %   Returns a string corresponding to the type of the named set for
0009 %   valid values of SET_TYPE, otherwise an empty string. Can be used to
0010 %   check whether SET_TYPE is a valid type.
0011 %
0012 %   Valid set types, and the corresponding values are defined as a struct
0013 %   returned by the DEF_SET_TYPES method.
0014 %
0015 %   E.g. The following method ...
0016 %       function obj = def_set_types(obj)
0017 %           obj.set_types = struct(...
0018 %                   'var', 'variable', ...
0019 %                   'lin', 'linear constraint' ...
0020 %               );
0021 %       end
0022 %
0023 %   ... indicates the following valid SET_TYPES and corresponding
0024 %   return values:
0025 %
0026 %       SET_TYPE    STR
0027 %       'var'       'variable'
0028 %       'lin'       'linear constraint'
0029 
0030 %   MP-Opt-Model
0031 %   Copyright (c) 2017-2020, Power Systems Engineering Research Center (PSERC)
0032 %   by Ray Zimmerman, PSERC Cornell
0033 %
0034 %   This file is part of MP-Opt-Model.
0035 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0036 %   See https://github.com/MATPOWER/mp-opt-model for more info.
0037 
0038 if isfield(obj.set_types, set_type)
0039     str = obj.set_types.(set_type);
0040 else
0041     str = '';
0042 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005