Skip to content

Commit 2ccaea1

Browse files
committed
Fix #256, make opf.use_vg compatible with gens at PQ buses.
1 parent 285b4fa commit 2ccaea1

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ For change history for [MOST][3], see [most/CHANGES.md](most/CHANGES.md).
1313
since 8.0
1414
---------
1515

16+
#### 2/17/25
17+
- Fix [bug #256][38] to make `opf.use_vg` option compatible with generators
18+
at PQ buses.
19+
1620
#### 8/30/24
1721
- Incorporate major [MP-Opt-Model][27] refactor of `mp_idx_manager` and
1822
`opt_model` to use the new classes `mp.set_manager`,
@@ -3453,3 +3457,4 @@ First Public Release – *Jun 25, 1997*
34533457
[35]: https://github.com/MATPOWER/mx-simulink_matpower
34543458
[36]: https://github.com/MATPOWER/matpower/issues/210
34553459
[37]: https://github.com/MATPOWER/matpower/issues/223
3460+
[38]: https://github.com/MATPOWER/matpower/issues/256

docs/src/MATPOWER-manual/MATPOWER-manual.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -8691,7 +8691,7 @@ \subsubsection*{Other Improvements}
86918691
\subsubsection*{Bugs Fixed}
86928692
\begin{itemize}
86938693
\item Optional \codeq{soln\_fname} input to \code{run\_mp()}, hence also to \code{run\_pf()}, \code{run\_cpf()}, and \code{run\_opf()}, was being ignored.
8694-
8694+
\item Fix bug \#256 to make \code{opf.use\_vg} option compatible with generators at PQ buses.
86958695
\end{itemize}
86968696

86978697
\subsubsection*{Incompatible Changes}

lib/+mp/data_model.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,10 @@ function display(obj)
736736

737737
%% gen connection matrix, element i, j is 1 if, generator j at bus i is ON
738738
Cg = sparse(gbus, (1:ng)', 1, nb, ng);
739+
Cg(:, bus_dme.type(gbus) == mp.NODE_TYPE.PQ) = 0; %% exclude PQ buses
739740
Vbg = Cg * sparse(1:ng, 1:ng, gen_dme.vm_setpoint, ng, ng);
740741
vm_ub = max(Vbg, [], 2); %% zero for non-gen buses, else max vm_setpoint of gens @ bus
741-
ib = find(vm_ub); %% buses with online gens
742+
ib = find(vm_ub); %% non-PQ buses with online gens
742743
vm_lb = max(2*Cg - Vbg, [], 2); %% same as vm_ub, except min vm_setpoint of gens @ bus
743744
vm_lb(ib) = 2 - vm_lb(ib);
744745

lib/mpver.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
v{1} = struct( 'Name', 'MATPOWER', ...
3737
'Version', '8.0.1-dev', ...
3838
'Release', '', ...
39-
'Date', '30-Aug-2024' );
39+
'Date', '17-Feb-2025' );
4040
if nargout > 0
4141
if nargin > 0
4242
rv = v{1};

lib/opf_setup.m

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
if use_vg %% adjust bus voltage limits based on generator Vg setpoint
111111
%% gen connection matrix, element i, j is 1 if, generator j at bus i is ON
112112
Cg = sparse(mpc.gen(:, GEN_BUS), (1:ng)', mpc.gen(:, GEN_STATUS) > 0, nb, ng);
113+
Cg(:, mpc.bus(mpc.gen(:, GEN_BUS), BUS_TYPE) == PQ) = 0; %% exclude PQ buses
113114
Vbg = Cg * sparse(1:ng, 1:ng, mpc.gen(:, VG), ng, ng);
114115
Vmax = max(Vbg, [], 2); %% zero for non-gen buses, else max Vg of gens @ bus
115116
ib = find(Vmax); %% buses with online gens

0 commit comments

Comments
 (0)