diff --git a/CHANGES.md b/CHANGES.md index e14c64ce..86b2782a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,9 @@ For change history for [MOST][3], see [most/CHANGES.md](most/CHANGES.md). since 8.0b1 ----------- +#### 1/18/24 + - Rename the `is_index_name()` method of `mp.mapped_array` to `has_name()`. + #### 1/9/24 - Add `mp.cost_table_utils` with static methods for use by `mp.cost_table`. diff --git a/docs/sphinx/source/conf.py b/docs/sphinx/source/conf.py index 06141f9a..7858b283 100644 --- a/docs/sphinx/source/conf.py +++ b/docs/sphinx/source/conf.py @@ -20,7 +20,7 @@ # -- Project information ----------------------------------------------------- project = 'MATPOWER Documentation' -copyright = '1996-2023, Power Systems Engineering Research Center (PSERC)' +copyright = '1996-2024, Power Systems Engineering Research Center (PSERC)' author = 'Ray D. Zimmerman, Carlos E. Murillo-Sánchez, Hongye Wang, et. al.' # The full version, including alpha/beta/rc tags diff --git a/lib/+mp/data_model.m b/lib/+mp/data_model.m index b8ae0117..71b3c091 100644 --- a/lib/+mp/data_model.m +++ b/lib/+mp/data_model.m @@ -250,7 +250,7 @@ % Output: % n (integer) : number of online elements - if obj.elements.is_index_name(name) + if obj.elements.has_name(name) n = obj.elements.(name).n; else n = 0; @@ -411,7 +411,7 @@ function display(obj) %% suppress output detail (default for large systems) suppress = mpopt.out.suppress_detail; if suppress == -1 - if obj.elements.is_index_name('bus') && ... + if obj.elements.has_name('bus') && ... obj.elements.bus.nr > 500 suppress = 1; else diff --git a/lib/+mp/dm_converter.m b/lib/+mp/dm_converter.m index 4853184e..45fffc28 100644 --- a/lib/+mp/dm_converter.m +++ b/lib/+mp/dm_converter.m @@ -148,7 +148,7 @@ for k = 1:length(dm.elements) dme = dm.elements{k}; - if obj.elements.is_index_name(dme.name) + if obj.elements.has_name(dme.name) dmce = dme.dm_converter_element(obj); if all_vars vars = dme.main_table_var_names(); diff --git a/lib/+mp/dme_bus.m b/lib/+mp/dme_bus.m index 309b9e14..5d7f647c 100644 --- a/lib/+mp/dme_bus.m +++ b/lib/+mp/dme_bus.m @@ -124,7 +124,7 @@ obj.vm_ub = bus.vm_ub(obj.on); %% update bus type and starting vm based on connected gen status - if dm.elements.is_index_name('gen') + if dm.elements.has_name('gen') gen_dme = dm.elements.gen; [gbus, ig] = obj.gbus_vector(gen_dme); nb = obj.n; diff --git a/lib/+mp/dme_bus3p.m b/lib/+mp/dme_bus3p.m index b1a94e2a..2d06c706 100644 --- a/lib/+mp/dme_bus3p.m +++ b/lib/+mp/dme_bus3p.m @@ -128,7 +128,7 @@ obj.vm3_start = bus.vm3(obj.on); %% update bus type and starting vm based on connected gen status - if dm.elements.is_index_name('gen3p') + if dm.elements.has_name('gen3p') gen_dme = dm.elements.gen3p; [gbus, ig] = obj.gbus_vector(gen_dme); nb = obj.n; diff --git a/lib/+mp/mapped_array.m b/lib/+mp/mapped_array.m index 69262b15..0139beae 100644 --- a/lib/+mp/mapped_array.m +++ b/lib/+mp/mapped_array.m @@ -27,7 +27,7 @@ % ma.delete_elements('height'); % % % check for named element -% ma.is_index_name('color'); +% ma.has_name('color'); % % mp.mapped_array Methods: % * mapped_array - constructor @@ -37,7 +37,7 @@ % * add_names - add or modify names of elements % * add_elements - append elements to the end of the mapped array % * delete_elements - delete elements from the mapped array -% * is_index_name - return ``true`` if the name exists in the mapped array +% * has_name - return ``true`` if the name exists in the mapped array % * name2idx - return the index corresponding to a name % * subsref - called when indexing a mapped array to retrieve data % * subsasgn - called when indexing a mapped array to assign data @@ -251,11 +251,11 @@ end end - function TorF = is_index_name(obj, name) + function TorF = has_name(obj, name) % Return ``true`` if the name exists in the mapped array. % :: % - % TorF = obj.is_index_name(name); + % TorF = obj.has_name(name); % % Input: % name (char array) : name to check @@ -298,8 +298,8 @@ end else %% method calls or properties switch s(1).subs - case 'is_index_name' - varargout{1} = is_index_name(obj, s(2).subs{:}); + case 'has_name' + varargout{1} = has_name(obj, s(2).subs{:}); case 'name2idx' varargout{1} = name2idx(obj, s(2).subs{:}); case 'length' diff --git a/lib/+mp/math_model_pf_acps.m b/lib/+mp/math_model_pf_acps.m index b8c4167c..9fff3eab 100644 --- a/lib/+mp/math_model_pf_acps.m +++ b/lib/+mp/math_model_pf_acps.m @@ -222,7 +222,7 @@ %% modify data model to form Bp (B prime) if nargout > 1 %% for both Bp and Bpp dm1 = dm.copy(); - if dm1.elements.is_index_name('shunt') + if dm1.elements.has_name('shunt') dm1.elements.shunt.tab.bs(:) = 0; %% zero out shunts at buses end dm2 = dm1.copy(); diff --git a/lib/+mp/nm_element.m b/lib/+mp/nm_element.m index 666b8c68..7bc60dc6 100644 --- a/lib/+mp/nm_element.m +++ b/lib/+mp/nm_element.m @@ -157,7 +157,7 @@ if nargin < 3 name = obj.name; end - if mm.elements.is_index_name(name) + if mm.elements.has_name(name) mme = mm.elements.(name); else mme = []; @@ -520,7 +520,7 @@ [nidx{:}] = deal(zeros(dme.n, 1)); for i = 1:length(cxn_type) - if dm.elements.is_index_name(cxn_type{i}) + if dm.elements.has_name(cxn_type{i}) jxn_dme = dm.elements.(cxn_type{i}); %% data model element for cxn_type{i} jxn_nme = nm.elements.(cxn_type{i}); %% corresp. net model element ni = nm.get_node_idx(cxn_type{i}); %% corresponding node indices diff --git a/lib/+mp/task.m b/lib/+mp/task.m index 0c1b110a..d6932c91 100644 --- a/lib/+mp/task.m +++ b/lib/+mp/task.m @@ -562,7 +562,7 @@ function save_soln(obj, fname) ~isempty(mpopt.exp.exclude_elements) ex = mpopt.exp.exclude_elements; for k = length(ex):-1:1 - if ~dmc.elements.is_index_name(ex{k}) + if ~dmc.elements.has_name(ex{k}) ex(k) = []; %% skip missing exclusions end end diff --git a/lib/t/+mp/dme_branch_node_test.m b/lib/t/+mp/dme_branch_node_test.m index fb25a21a..270eebf4 100644 --- a/lib/t/+mp/dme_branch_node_test.m +++ b/lib/t/+mp/dme_branch_node_test.m @@ -34,7 +34,7 @@ %% get bus mapping info obj.nbet = length(obj.cxn_type); for k = obj.nbet:-1:1 - if dm.elements.is_index_name(obj.cxn_type{k}) + if dm.elements.has_name(obj.cxn_type{k}) bus_dme{k} = dm.elements.(obj.cxn_type{k}); b2i_k{k} = bus_dme{k}.ID2i; %% bus element num to idx mapping else @@ -72,7 +72,7 @@ function obj = update_status(obj, dm) %% get bus status info for k = 1:obj.nbet - if dm.elements.is_index_name(obj.cxn_type{k}) + if dm.elements.has_name(obj.cxn_type{k}) bus_dme = dm.elements.(obj.cxn_type{k}); bs = bus_dme.tab.status; %% bus element status diff --git a/lib/t/+mp/dme_gen_node_test.m b/lib/t/+mp/dme_gen_node_test.m index 2ec3591a..8e577711 100644 --- a/lib/t/+mp/dme_gen_node_test.m +++ b/lib/t/+mp/dme_gen_node_test.m @@ -33,7 +33,7 @@ %% get bus mapping info obj.nbet = length(obj.cxn_type); for k = obj.nbet:-1:1 - if dm.elements.is_index_name(obj.cxn_type{k}) + if dm.elements.has_name(obj.cxn_type{k}) bus_dme{k} = dm.elements.(obj.cxn_type{k}); b2i_k{k} = bus_dme{k}.ID2i; else @@ -67,7 +67,7 @@ function obj = update_status(obj, dm) %% get bus status info for k = 1:obj.nbet - if dm.elements.is_index_name(obj.cxn_type{k}) + if dm.elements.has_name(obj.cxn_type{k}) bus_dme = dm.elements.(obj.cxn_type{k}); bs = bus_dme.tab.status; %% bus element status diff --git a/lib/t/+mp/mme_branch_opf_acp_node_test.m b/lib/t/+mp/mme_branch_opf_acp_node_test.m index e41b11ae..0be3bd26 100644 --- a/lib/t/+mp/mme_branch_opf_acp_node_test.m +++ b/lib/t/+mp/mme_branch_opf_acp_node_test.m @@ -15,7 +15,7 @@ %% from makeAang() nb = 0; for k = 1:dme.nbet - if dm.elements.is_index_name(dme.cxn_type{k}) + if dm.elements.has_name(dme.cxn_type{k}) nb = nb + dm.elements.(dme.cxn_type{k}).n; end end diff --git a/lib/t/t_mp_data_model.m b/lib/t/t_mp_data_model.m index 2ce47ac3..81125eb9 100644 --- a/lib/t/t_mp_data_model.m +++ b/lib/t/t_mp_data_model.m @@ -55,11 +55,11 @@ t_ok(isa(dm.elements, 'mp.mapped_array'), [t 'isa(dm.elements, ''mp.mapped_array'')']); t_is(length(dm.elements), 5, 12, [t 'length(dm.elements)']); t_ok(isa(dm.elements, 'mp.mapped_array'), [t 'isa(dm.elements, ''mp.mapped_array'')']); - t_ok(dm.elements.is_index_name('bus'), [t 'dm.elements.is_index_name(''bus'')']); - t_ok(dm.elements.is_index_name('gen'), [t 'dm.elements.is_index_name(''gen'')']); - t_ok(dm.elements.is_index_name('load'), [t 'dm.elements.is_index_name(''load'')']); - t_ok(dm.elements.is_index_name('branch'), [t 'dm.elements.is_index_name(''branch'')']); - t_ok(dm.elements.is_index_name('shunt'), [t 'dm.elements.is_index_name(''shunt'')']); + t_ok(dm.elements.has_name('bus'), [t 'dm.elements.has_name(''bus'')']); + t_ok(dm.elements.has_name('gen'), [t 'dm.elements.has_name(''gen'')']); + t_ok(dm.elements.has_name('load'), [t 'dm.elements.has_name(''load'')']); + t_ok(dm.elements.has_name('branch'), [t 'dm.elements.has_name(''branch'')']); + t_ok(dm.elements.has_name('shunt'), [t 'dm.elements.has_name(''shunt'')']); t_is(dm.elements.name2idx('bus'), 1, 12, [t 'dm.elements.name2idx(''bus'')']); t_is(dm.elements.name2idx('gen'), 2, 12, [t 'dm.elements.name2idx(''gen'')']); t_is(dm.elements.name2idx('load'), 3, 12, [t 'dm.elements.name2idx(''load'')']); diff --git a/lib/t/t_mp_mapped_array.m b/lib/t/t_mp_mapped_array.m index ca90c4ae..8a1121b3 100644 --- a/lib/t/t_mp_mapped_array.m +++ b/lib/t/t_mp_mapped_array.m @@ -47,12 +47,12 @@ t_ok(isequal(A.p_.vals, vals), [t 'vals']); t_ok(isequal(A.p_.names, names), [t 'names']); -t = 'is_index_name : '; -t_ok(A.is_index_name('vector'), [t 'vector']); -t_ok(A.is_index_name('cellstr'), [t 'cellstr']); -t_ok(A.is_index_name('struct'), [t 'struct']); -t_ok(A.is_index_name('object'), [t 'object']); -t_ok(~A.is_index_name('random'), [t 'random']); +t = 'has_name : '; +t_ok(A.has_name('vector'), [t 'vector']); +t_ok(A.has_name('cellstr'), [t 'cellstr']); +t_ok(A.has_name('struct'), [t 'struct']); +t_ok(A.has_name('object'), [t 'object']); +t_ok(~A.has_name('random'), [t 'random']); t = 'name2idx : '; t_is(A.name2idx('vector'), 1, 12, [t 'vector']);