VALID_NAMED_SET_TYPE Returns a label for the given named set type or empty. ----- PRIVATE METHOD ----- STR = OM.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 types and their corresponding return values are: SET_TYPE STR 'var' 'variable' 'lin' 'linear constraint' 'nle' 'nonlinear equality constraint' 'nli' 'nonlinear inequality constraint' 'cost' 'cost'
0001 function str = valid_named_set_type(om, 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 = OM.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 types and their corresponding return values are: 0013 % SET_TYPE STR 0014 % 'var' 'variable' 0015 % 'lin' 'linear constraint' 0016 % 'nle' 'nonlinear equality constraint' 0017 % 'nli' 'nonlinear inequality constraint' 0018 % 'cost' 'cost' 0019 0020 % MATPOWER 0021 % Copyright (c) 2017, Power Systems Engineering Research Center (PSERC) 0022 % by Ray Zimmerman, PSERC Cornell 0023 % 0024 % This file is part of MATPOWER. 0025 % Covered by the 3-clause BSD License (see LICENSE file for details). 0026 % See https://matpower.org for more info. 0027 0028 persistent named_set_types; 0029 if isempty(named_set_types) 0030 named_set_types = struct(... 0031 'var', 'variable', ... 0032 'lin', 'linear constraint', ... 0033 'nle', 'nonlinear equality constraint', ... 0034 'nli', 'nonlinear inequality constraint', ... 0035 'qdc', 'quadratic cost', ... 0036 'nlc', 'general nonlinear cost', ... 0037 'cost', 'legacy cost' ... 0038 ); 0039 end 0040 if isfield(named_set_types, set_type) 0041 str = named_set_types.(set_type); 0042 else 0043 str = ''; 0044 end