Home > matpower7.1 > most > lib > t > most_ex3_dcopf_w_uc.m

most_ex3_dcopf_w_uc

PURPOSE ^

MOST_EX3_DCOPF_W_UC Examples of deterministic DC optimal power flow with UC.

SYNOPSIS ^

function most_ex3_dcopf_w_uc(quiet)

DESCRIPTION ^

MOST_EX3_DCOPF_W_UC  Examples of deterministic DC optimal power flow with UC.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function most_ex3_dcopf_w_uc(quiet)
0002 %MOST_EX3_DCOPF_W_UC  Examples of deterministic DC optimal power flow with UC.
0003 
0004 %   MOST
0005 %   Copyright (c) 2015-2016, Power Systems Engineering Research Center (PSERC)
0006 %   by Ray Zimmerman, PSERC Cornell
0007 %
0008 %   This file is part of MOST.
0009 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0010 %   See https://github.com/MATPOWER/most for more info.
0011 
0012 %% set up options
0013 define_constants;
0014 verbose = 0;
0015 mpopt = mpoption('verbose', verbose);
0016 mpopt = mpoption(mpopt, 'out.gen', 1);
0017 mpopt = mpoption(mpopt, 'model', 'DC');
0018 mpopt = mpoption(mpopt, 'opf.dc.solver', 'MIPS');
0019 mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT');
0020 if ~verbose
0021     mpopt = mpoption(mpopt, 'out.all', 0);
0022 end
0023 
0024 %%-----  DC OPF (w/UC)  -----
0025 casefile = 'ex_case3b';
0026 mpc = loadcase(casefile);
0027 xgd_table.colnames = { 'CommitKey' };
0028 xgd_table.data = [
0029     1;
0030     1;
0031     1;
0032     2;
0033 ];
0034 xgd = loadxgendata(xgd_table, mpc);
0035 [iwind, mpc, xgd] = addwind('ex_wind_uc', mpc, xgd);
0036 mpc = scale_load(499, mpc, [], struct('scale', 'QUANTITY'));
0037 mpc.gencost(:, STARTUP) = 0;    % ignore STARTUP and SHUTDOWN
0038 mpc.gencost(:, SHUTDOWN) = 0;   % costs for this example
0039 mpc.reserves.zones = [mpc.reserves.zones 0];
0040 mpc0 = mpc;
0041 xgd0 = xgd;
0042 
0043 %% runduopf
0044 mpc = mpc0;
0045 r1 = runuopf(mpc, mpopt);
0046 u1 = r1.gen(:, GEN_STATUS); % commitment status
0047 Pg1 = r1.gen(:, PG);        % active generation
0048 lam1 = r1.bus(:, LAM_P);    % nodal energy price
0049 
0050 %% most
0051 mdi = loadmd(mpc, [], xgd);
0052 mdo = most(mdi, mpopt);
0053 r2 = mdo.flow.mpc;
0054 u2 = r2.gen(:, GEN_STATUS); % commitment status
0055 u2 = mdo.UC.CommitSched;    % commitment status
0056 Pg2 = r2.gen(:, PG);        % active generation
0057 lam2 = r2.bus(:, LAM_P);    % nodal energy price
0058 if verbose
0059     printpf(r2, [], mpopt);
0060     most_summary(mdo);
0061 end
0062 
0063 %% comparison
0064 u = [u1 u2]
0065 Pg = [Pg1 Pg2]
0066 lam = [lam1 lam2]

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005