Skip to content

Commit 677d424

Browse files
committed
git subrepo pull --branch=master most
subrepo: subdir: "most" merged: "0e7620dc" upstream: origin: "[email protected]:MATPOWER/most" branch: "master" commit: "0e7620dc" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "b00d41b"
1 parent c1ecfc9 commit 677d424

File tree

8 files changed

+130
-65
lines changed

8 files changed

+130
-65
lines changed

most/.gitrepo

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[subrepo]
77
remote = [email protected]:MATPOWER/most
88
branch = master
9-
commit = 9387fc7e0152fe1d782236dbea280fd3bd6ee611
10-
parent = 650721826ff477ee4cf393a028ea7d497fcd9b7a
9+
commit = 0e7620dc1d6e8be0ed36a49bcd4b64d5aa9abef8
10+
parent = c1ecfc9c19123886b8f40105f0515409dbe14fbc
1111
method = merge
12-
cmdver = 0.4.6
12+
cmdver = 0.4.9

most/CHANGES.md

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ Change history for MOST
22
=======================
33

44

5+
since 1.3
6+
---------
7+
8+
#### 10/7/24
9+
- Tweak tests (again) to avoid warnings and presolve bug with HiGHS-based
10+
`linprog` and `intlinprog` in Optimization Toolbox R2024b.
11+
12+
#### 9/12/24
13+
- Fix issue with `most_summary()` when ramp results are missing.
14+
15+
#### 5/29/24
16+
- Fix [issue #45][12] where `most()` does not properly handle cases with
17+
contingencies defined only in some periods/scenarios.
18+
*Thanks to Stefano Nicolin.*
19+
- Update `most_summary()` to skip display of non-existent contingencies.
20+
21+
522
Version 1.3 - *May 10, 2024*
623
----------------------------
724

@@ -338,3 +355,4 @@ Version 1.0 - *Jun 1, 2016*
338355
[9]: https://github.com/MATPOWER/most/issues/37
339356
[10]: https://github.com/MATPOWER/most/issues/39
340357
[11]: https://github.com/MATPOWER/mp-opt-model
358+
[12]: https://github.com/MATPOWER/most/issues/45

most/docs/sphinx/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
# matlab_auto_link = "basic"
7272
matlab_auto_link = "all"
7373
matlab_show_property_default_value = True
74+
matlab_show_property_specs = True
7475
# autoclass_content = 'both' # 'class', 'init', 'both'
7576
autodoc_member_order = 'bysource' # 'alphabetical', 'groupwise', 'bysource'
7677
napoleon_use_param = False

most/docs/src/MOST-manual/MOST-manual.tex

+33-7
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
\newcommand{\mostname}[0]{{{\bf M}{\sc atpower} \textbf{O}ptimal \textbf{S}cheduling \textbf{T}ool}}
160160
\newcommand{\mosturl}[0]{https://github.com/MATPOWER/most}
161161
\newcommand{\mostlink}[0]{\href{\mosturl}{\most{}}}
162-
\newcommand{\mostver}[0]{1.3}
162+
\newcommand{\mostver}[0]{1.3.1-dev}
163163
\newcommand{\md}[0]{{\most{} Data struct}}
164164
\newcommand{\powerweb}[0]{{\sc PowerWeb}}
165165
\newcommand{\pserc}[0]{{\sc PSerc}}
@@ -240,7 +240,7 @@
240240
%%% BEFORE PUBLISHING A NEW VERSION:
241241
%%% Update the publication year for \bibitem{matpower} and
242242
%%% \bibitem{matpower_manual} to the year of the latest release
243-
\date{May 10, 2024} % comment this line to display the current date
243+
%\date{May 10, 2024} % comment this line to display the current date
244244
%\date{December 14, 2011\thanks{Second revision. First revision was December 13, 2011}} % comment this line to display the current date
245245

246246
%%% BEGIN DOCUMENT
@@ -1532,7 +1532,7 @@ \subsubsection{{\tt sd} -- Storage Data ({\tt StorageData})}
15321532
\subsubsection{{\tt contab} -- Contingency Table}
15331533
\label{sec:contab}
15341534

1535-
The optional \code{contab} argument is a contingency table with a master set of contingencies used for security throughout entire horizon. It is a matrix in the form of a \emph{change table} recognized by \code{apply\_changes}, described in Section~\ref{MUM-sec:apply_changes} in the \mum{}. The probabilities defined in this contingency table correspond to the conditional probabilities $\psi_0^{tjk}$ of contingency~$k$ occuring conditioned on being in base scenario~$j$. While the \md{} (\code{md}) itself allows for contingencies to be defined independently for all scenarios and time periods, \code{loadmd} applies a single set of contingencies and conditional probabilities (single \code{contab}) to all.
1535+
The optional \code{contab} argument is a contingency table with a master set of contingencies used for security throughout the entire horizon. It is a matrix in the form of a \emph{change table} recognized by \code{apply\_changes}, described in Section~\ref{MUM-sec:apply_changes} in the \mum{}. The probabilities defined in this contingency table correspond to the conditional probabilities $\psi_0^{tjk}$ of contingency~$k$ occuring conditioned on being in base scenario~$j$. While the \md{} (\code{md}) itself allows for contingencies to be defined independently for all scenarios and time periods, \code{loadmd} applies a single set of contingencies and conditional probabilities (single \code{contab}) to all.
15361536

15371537
\clearpage
15381538

@@ -3459,10 +3459,36 @@ \subsubsection*{Incompatible Changes}
34593459
\end{itemize}
34603460

34613461

3462-
% \subsection{Version 1.2 -- released ??? ?, 2022}
3463-
% \label{app:v12}
3462+
\subsection{Version 1.3.1-dev -- released ??? ?, 202?}
3463+
\label{app:v12}
3464+
3465+
The \href{https://matpower.org/docs/MOST-manual-1.3.1.pdf}{\most{} 1.3.1 User's Manual} is available online.\footnote{\url{https://matpower.org/docs/MOST-manual-1.3.1.pdf}}
3466+
3467+
\subsubsection*{Changes}
3468+
\begin{itemize}
3469+
\item \code{most\_summary()} now skips display of non-existent contingencies.
3470+
\item
3471+
3472+
\end{itemize}
3473+
3474+
\subsubsection*{Bugs Fixed}
3475+
\begin{itemize}
3476+
\item Fix issue \#45 where \code{most()} does not properly handle cases with contingencies defined only in some periods/scenarios.
3477+
\emph{Thanks to Stefano Nicolin.}
3478+
\item Fix issue with \code{most\_summary()} when ramp results are missing.
3479+
\item Tweak tests to work around bug in HiGHS-based \code{linprog} and \code{intlinprog} in Optimization Toolbox R2024a and R2024b.
3480+
\end{itemize}
3481+
3482+
\subsubsection*{Incompatible Changes}
3483+
\begin{itemize}
3484+
\item
3485+
\end{itemize}
3486+
3487+
3488+
% \subsection{Version 1.4 -- released ??? ?, 202?}
3489+
% \label{app:v14}
34643490
%
3465-
% The \href{https://matpower.org/docs/MOST-manual-1.2.pdf}{\most{} 1.2 User's Manual} is available online.\footnote{\url{https://matpower.org/docs/MOST-manual-1.2.pdf}}
3491+
% The \href{https://matpower.org/docs/MOST-manual-1.4.pdf}{\most{} 1.4 User's Manual} is available online.\footnote{\url{https://matpower.org/docs/MOST-manual-1.4.pdf}}
34663492
%
34673493
% \subsubsection*{Changes}
34683494
% \begin{itemize}
@@ -3495,7 +3521,7 @@ \subsubsection*{Incompatible Changes}
34953521
\doi{10.1109/TPWRS.2010.2051168}
34963522

34973523
\bibitem{matpower}
3498-
R.~D. Zimmerman, C.~E. Murillo-S{\'a}nchez (2022). \matpower{}\\~
3524+
R.~D. Zimmerman, C.~E. Murillo-S{\'a}nchez (2024). \matpower{}\\~
34993525
[Software]. Available: \url{https://matpower.org}\\
35003526
\doi{10.5281/zenodo.3236535}
35013527

most/lib/most.m

+46-32
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,19 @@
144144
mo.IncludeFixedReserves = 0;
145145
end
146146
end
147+
if mo.SecurityConstrained % check that at least some contingency is specified
148+
have_contingency = 0;
149+
for t = 1:nt
150+
for j = 1:mdi.idx.nj(t)
151+
if isfield(mdi, 'cont') && isfield(mdi.cont(t,j), 'contab') && ...
152+
~isempty(mdi.cont(t,j).contab)
153+
have_contingency = 1; % found a contingency
154+
end
155+
end
156+
end
157+
end
147158
if mo.SecurityConstrained == -1
148-
if isfield(mdi, 'cont') && isfield(mdi.cont(1,1), 'contab') && ...
149-
~isempty(mdi.cont(1,1).contab)
159+
if have_contingency
150160
mo.SecurityConstrained = 1;
151161
else
152162
mo.SecurityConstrained = 0;
@@ -165,9 +175,8 @@
165175
isfield(mdi.FixedReserves(1,1,1), 'req'))
166176
error('most: MDI.FixedReserves(t,j,k) must be specified when MPOPT.most.fixed_res = 1');
167177
end
168-
if mo.SecurityConstrained && ~(isfield(mdi, 'cont') && ...
169-
isfield(mdi.cont(1,1), 'contab') && ~isempty(mdi.cont(1,1).contab))
170-
error('most: MDI.cont(t,j).contab cannot be empty when MPOPT.most.security_constraints = 1');
178+
if mo.SecurityConstrained && ~have_contingency
179+
error('most: MDI.cont(t,j).contab cannot be empty for all t, j when MPOPT.most.security_constraints = 1');
171180
end
172181
if mo.IncludeFixedReserves && mo.SecurityConstrained
173182
warning('most: Using MPOPT.most.fixed_res = 1 and MPOPT.most.security_constraints = 1 together is not recommended.');
@@ -446,35 +455,40 @@
446455
mdi.StepProb(t) = sum(scenario_probs); % probability of making it to the t-th step
447456
if mdi.SecurityConstrained
448457
for j = 1:mdi.idx.nj(t)
449-
[tmp, ii] = sort(mdi.cont(t,j).contab(:, CT_LABEL)); %sort in ascending contingency label
450-
contab = mdi.cont(t,j).contab(ii, :);
451-
rowdecomlist = ones(size(contab,1), 1);
452-
for l = 1:size(contab, 1)
453-
if contab(l, CT_TABLE) == CT_TGEN && contab(l, CT_COL) == GEN_STATUS ...
454-
&& contab(l, CT_CHGTYPE) == CT_REP && contab(l, CT_NEWVAL) == 0 ... % gen turned off
455-
&& mdi.flow(t,j,1).mpc.gen(contab(l, CT_ROW), GEN_STATUS) <= 0 % but it was off on input
456-
rowdecomlist(l) = 0;
457-
elseif contab(l, CT_TABLE) == CT_TBRCH && contab(l, CT_COL) == BR_STATUS ...
458-
&& contab(l, CT_CHGTYPE) == CT_REP && contab(l, CT_NEWVAL) == 0 ... % branch taken out
459-
&& mdi.flow(t,j,1).mpc.branch(contab(l, CT_ROW), BR_STATUS) <= 0 % but it was off on input
460-
rowdecomlist(l) = 0;
458+
if isempty(mdi.cont(t,j).contab)
459+
mdi.idx.nc(t, j) = 0;
460+
mdi.CostWeights(1, j, t) = 1;
461+
else
462+
[tmp, ii] = sort(mdi.cont(t,j).contab(:, CT_LABEL)); %sort in ascending contingency label
463+
contab = mdi.cont(t,j).contab(ii, :);
464+
rowdecomlist = ones(size(contab,1), 1);
465+
for l = 1:size(contab, 1)
466+
if contab(l, CT_TABLE) == CT_TGEN && contab(l, CT_COL) == GEN_STATUS ...
467+
&& contab(l, CT_CHGTYPE) == CT_REP && contab(l, CT_NEWVAL) == 0 ... % gen turned off
468+
&& mdi.flow(t,j,1).mpc.gen(contab(l, CT_ROW), GEN_STATUS) <= 0 % but it was off on input
469+
rowdecomlist(l) = 0;
470+
elseif contab(l, CT_TABLE) == CT_TBRCH && contab(l, CT_COL) == BR_STATUS ...
471+
&& contab(l, CT_CHGTYPE) == CT_REP && contab(l, CT_NEWVAL) == 0 ... % branch taken out
472+
&& mdi.flow(t,j,1).mpc.branch(contab(l, CT_ROW), BR_STATUS) <= 0 % but it was off on input
473+
rowdecomlist(l) = 0;
474+
end
461475
end
476+
contab = contab(rowdecomlist ~= 0, :);
477+
mdi.cont(t, j).contab = contab;
478+
clist = unique(contab(:, CT_LABEL));
479+
mdi.idx.nc(t, j) = length(clist);
480+
k = 2;
481+
for label = clist'
482+
mdi.flow(t, j, k).mpc = apply_changes(label, mdi.flow(t, j, 1).mpc, contab);
483+
ii = find( label == contab(:, CT_LABEL) );
484+
mdi.CostWeights(k, j, t) = contab(ii(1), CT_PROB);
485+
mdi.idx.nb(t, j, k) = size(mdi.flow(t, j, k).mpc.bus, 1);
486+
mdi.idx.ny(t, j, k) = length(find(mdi.flow(t, j, 1).mpc.gencost(:, MODEL) == PW_LINEAR));
487+
k = k + 1;
488+
end
489+
mdi.CostWeights(1, j, t) = 1 - sum(mdi.CostWeights(2:mdi.idx.nc(t,j)+1, j, t));
490+
mdi.CostWeights(1:mdi.idx.nc(t,j)+1, j, t) = scenario_probs(j) * mdi.CostWeights(1:mdi.idx.nc(t,j)+1, j, t);
462491
end
463-
contab = contab(rowdecomlist ~= 0, :);
464-
mdi.cont(t, j).contab = contab;
465-
clist = unique(contab(:, CT_LABEL));
466-
mdi.idx.nc(t, j) = length(clist);
467-
k = 2;
468-
for label = clist'
469-
mdi.flow(t, j, k).mpc = apply_changes(label, mdi.flow(t, j, 1).mpc, contab);
470-
ii = find( label == contab(:, CT_LABEL) );
471-
mdi.CostWeights(k, j, t) = contab(ii(1), CT_PROB);
472-
mdi.idx.nb(t, j, k) = size(mdi.flow(t, j, k).mpc.bus, 1);
473-
mdi.idx.ny(t, j, k) = length(find(mdi.flow(t, j, 1).mpc.gencost(:, MODEL) == PW_LINEAR));
474-
k = k + 1;
475-
end
476-
mdi.CostWeights(1, j, t) = 1 - sum(mdi.CostWeights(2:mdi.idx.nc(t,j)+1, j, t));
477-
mdi.CostWeights(1:mdi.idx.nc(t,j)+1, j, t) = scenario_probs(j) * mdi.CostWeights(1:mdi.idx.nc(t,j)+1, j, t);
478492
end
479493
else
480494
for j = 1:mdi.idx.nj(t)

most/lib/most_summary.m

+22-19
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,30 @@
6868
nl = size(mpc.branch, 1);
6969
ng = size(mpc.gen, 1);
7070
nt = mdo.idx.nt;
71-
nj_max = max(mdo.idx.nj);
72-
nc_max = max(max(mdo.idx.nc));
71+
nj = mdo.idx.nj;
72+
nc = mdo.idx.nc;
73+
nj_max = max(nj);
74+
nc_max = max(max(nc));
7375
ns = mdo.idx.ns;
7476

7577
%% summarize results
76-
psi = zeros(nt, nj_max, nc_max+1);
77-
Pg = zeros(ng, nt, nj_max, nc_max+1);
78-
Pd = zeros(nb, nt, nj_max, nc_max+1);
79-
if mdo.idx.ntramp
78+
psi = NaN(nt, nj_max, nc_max+1);
79+
Pg = NaN(ng, nt, nj_max, nc_max+1);
80+
Pd = NaN(nb, nt, nj_max, nc_max+1);
81+
if mdo.idx.ntramp && isfield(mdo.results, 'Rrp')
8082
Rup = mdo.results.Rrp;
8183
Rdn = mdo.results.Rrm;
8284
else
8385
Rup = [];
8486
Rdn = [];
8587
end
86-
u = zeros(ng, nt);
87-
lamP = zeros(nb, nt, nj_max, nc_max+1);
88-
muF = zeros(nl, nt, nj_max, nc_max+1);
89-
Pf = zeros(nl, nt, nj_max, nc_max+1);
88+
u = NaN(ng, nt);
89+
lamP = NaN(nb, nt, nj_max, nc_max+1);
90+
muF = NaN(nl, nt, nj_max, nc_max+1);
91+
Pf = NaN(nl, nt, nj_max, nc_max+1);
9092
for t = 1:nt
91-
for j = 1:mdo.idx.nj(t)
92-
for k = 1:mdo.idx.nc(t,j)+1
93+
for j = 1:nj(t)
94+
for k = 1:nc(t,j)+1
9395
rr = mdo.flow(t,j,k).mpc;
9496
psi(t, j, k) = mdo.CostWeightsAdj(k, j, t);
9597
u(:, t) = rr.gen(:, GEN_STATUS);
@@ -159,19 +161,19 @@
159161
end
160162
fprintf('\n');
161163

162-
print_most_summary_section('PG', 'Gen', nt, nj_max, nc_max, Pg);
163-
if mdo.idx.ntramp
164+
print_most_summary_section('PG', 'Gen', nt, nj_max, nc, Pg);
165+
if mdo.idx.ntramp && isfield(mdo.results, 'Rrp')
164166
print_most_summary_section('RAMP UP', 'Gen', nt, 1, 0, Rup);
165167
print_most_summary_section('RAMP DOWN', 'Gen', nt, 1, 0, Rdn);
166168
end
167-
print_most_summary_section('FIXED LOAD', 'Bus', nt, nj_max, nc_max, Pd);
169+
print_most_summary_section('FIXED LOAD', 'Bus', nt, nj_max, nc, Pd);
168170
if ns
169171
print_most_summary_section('ESS E[SoC]', 'ESS', nt, 1, 0, SoC);
170172
end
171173
if mdo.DCMODEL
172-
print_most_summary_section('LAM_P', 'Bus', nt, nj_max, nc_max, lamP);
173-
print_most_summary_section('PF', 'Brch', nt, nj_max, nc_max, Pf);
174-
print_most_summary_section('MU_F', 'Brch', nt, nj_max, nc_max, muF);
174+
print_most_summary_section('LAM_P', 'Bus', nt, nj_max, nc, lamP);
175+
print_most_summary_section('PF', 'Brch', nt, nj_max, nc, Pf);
176+
print_most_summary_section('MU_F', 'Brch', nt, nj_max, nc, muF);
175177
end
176178
end
177179

@@ -180,7 +182,7 @@
180182
end
181183

182184
%%---------------------------------------------------------
183-
function print_most_summary_section(label, section_type, nt, nj_max, nc_max, data, tol)
185+
function print_most_summary_section(label, section_type, nt, nj_max, nc, data, tol)
184186
if nargin < 7
185187
tol = 1e-4;
186188
end
@@ -189,6 +191,7 @@ function print_most_summary_section(label, section_type, nt, nj_max, nc_max, dat
189191
fprintf('\n==========%-12s==========\n', sprintf('%s%s', bl, label));
190192
if any(data(:))
191193
for j = 1:nj_max
194+
nc_max = max(nc(:,j));
192195
for k = 1:nc_max+1
193196
if nj_max > 1 || nc_max > 0
194197
fprintf('\nSCENARIO %d', j);

most/lib/mostver.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
% See https://github.com/MATPOWER/most for more info.
2525

2626
v = struct( 'Name', 'MOST', ...
27-
'Version', '1.3', ...
27+
'Version', '1.3.1-dev', ...
2828
'Release', '', ...
29-
'Date', '10-May-2024' );
29+
'Date', '12-Sep-2024' );
3030
if nargout > 0
3131
if nargin > 0
3232
rv = v;

most/lib/t/t_most_uc.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,12 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir)
135135
% (except actually in this case it triggers it rather than working
136136
% around it, so we comment it out)
137137
%mpopt = mpoption(mpopt, 'intlinprog.LPPreprocess', 'none');
138-
else mpopt = mpoption(mpopt, 'intlinprog.LPPreprocess', 'none');
138+
elseif have_feature('intlinprog', 'vnum') == 24.001
139+
mpopt = mpoption(mpopt, 'intlinprog.LPPreprocess', 'none');
139140
s2 = warning('query', 'optim:intlinprog:IgnoreOptions');
140141
warning('off', 'optim:intlinprog:IgnoreOptions');
142+
elseif have_feature('intlinprog', 'vnum') == 24.002
143+
mpopt = mpoption(mpopt, 'intlinprog.Presolve', 'off');
141144
end
142145
end
143146
if ~verbose
@@ -413,7 +416,7 @@ function t_most_uc(quiet, create_plots, create_pdfs, savedir)
413416

414417
if have_feature('octave')
415418
warning(s1.state, file_in_path_warn_id);
416-
elseif have_feature('intlinprog') && have_feature('intlinprog', 'vnum') >= 24
419+
elseif have_feature('intlinprog') && have_feature('intlinprog', 'vnum') == 24.001
417420
warning(s2.state, 'optim:intlinprog:IgnoreOptions');
418421
end
419422

0 commit comments

Comments
 (0)