-
Notifications
You must be signed in to change notification settings - Fork 11
/
most_ex3_dcopf_w_uc.m
66 lines (60 loc) · 1.79 KB
/
most_ex3_dcopf_w_uc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function most_ex3_dcopf_w_uc(quiet)
% most_ex3_dcopf_w_uc - Examples of deterministic DC optimal power flow with UC.
% MOST
% Copyright (c) 2015-2024, Power Systems Engineering Research Center (PSERC)
% by Ray Zimmerman, PSERC Cornell
%
% This file is part of MOST.
% Covered by the 3-clause BSD License (see LICENSE file for details).
% See https://github.com/MATPOWER/most for more info.
%% set up options
define_constants;
verbose = 0;
mpopt = mpoption('verbose', verbose);
mpopt = mpoption(mpopt, 'out.gen', 1);
mpopt = mpoption(mpopt, 'model', 'DC');
mpopt = mpoption(mpopt, 'opf.dc.solver', 'MIPS');
mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT');
if ~verbose
mpopt = mpoption(mpopt, 'out.all', 0);
end
%%----- DC OPF (w/UC) -----
casefile = 'ex_case3b';
mpc = loadcase(casefile);
xgd_table.colnames = { 'CommitKey' };
xgd_table.data = [
1;
1;
1;
2;
];
xgd = loadxgendata(xgd_table, mpc);
[iwind, mpc, xgd] = addwind('ex_wind_uc', mpc, xgd);
mpc = scale_load(499, mpc, [], struct('scale', 'QUANTITY'));
mpc.gencost(:, STARTUP) = 0; % ignore STARTUP and SHUTDOWN
mpc.gencost(:, SHUTDOWN) = 0; % costs for this example
mpc.reserves.zones = [mpc.reserves.zones 0];
mpc0 = mpc;
xgd0 = xgd;
%% runduopf
mpc = mpc0;
r1 = runuopf(mpc, mpopt);
u1 = r1.gen(:, GEN_STATUS); % commitment status
Pg1 = r1.gen(:, PG); % active generation
lam1 = r1.bus(:, LAM_P); % nodal energy price
%% most
mdi = loadmd(mpc, [], xgd);
mdo = most(mdi, mpopt);
r2 = mdo.flow.mpc;
u2 = r2.gen(:, GEN_STATUS); % commitment status
u2 = mdo.UC.CommitSched; % commitment status
Pg2 = r2.gen(:, PG); % active generation
lam2 = r2.bus(:, LAM_P); % nodal energy price
if verbose
printpf(r2, [], mpopt);
most_summary(mdo);
end
%% comparison
u = [u1 u2]
Pg = [Pg1 Pg2]
lam = [lam1 lam2]