Home > matpower6.0 > most > t > most_ex2_dcopf.m

most_ex2_dcopf

PURPOSE ^

MOST_EX2_DCOPF Examples of deterministic DC optimal power flow.

SYNOPSIS ^

function most_ex2_dcopf(quiet)

DESCRIPTION ^

MOST_EX2_DCOPF  Examples of deterministic DC optimal power flow.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function most_ex2_dcopf(quiet)
0002 %MOST_EX2_DCOPF  Examples of deterministic DC optimal power flow.
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 http://www.pserc.cornell.edu/matpower/ for more info.
0011 
0012 %% set up options
0013 define_constants;
0014 verbose = 0;
0015 casefile = 'ex_case3a';
0016 mpopt = mpoption('verbose', verbose);
0017 mpopt = mpoption(mpopt, 'out.gen', 1);
0018 mpopt = mpoption(mpopt, 'model', 'DC');
0019 mpopt = mpoption(mpopt, 'opf.dc.solver', 'MIPS');
0020 mpopt = mpoption(mpopt, 'most.solver', mpopt.opf.dc.solver);
0021 if ~verbose
0022     mpopt = mpoption(mpopt, 'out.all', 0);
0023 end
0024 
0025 %%-----  DC OPF  -----
0026 %% runopf
0027 mpc = loadcase(casefile);
0028 r1 = rundcopf(mpc, mpopt);
0029 Pg1 = r1.gen(:, PG);        % active generation
0030 lam1 = r1.bus(:, LAM_P);    % nodal energy price
0031 
0032 %% most
0033 mpc = loadcase(casefile);
0034 mpopt = mpoption(mpopt, 'most.dc_model', 1);    % use DC network model (default)
0035 mdi = loadmd(mpc);
0036 mdo = most(mdi, mpopt);
0037 ms = most_summary(mdo);
0038 r2 = mdo.flow.mpc;
0039 Pg2 = r2.gen(:, PG);        % active generation
0040 lam2 = r2.bus(:, LAM_P);    % nodal energy price
0041 
0042 %% comparison
0043 Pg = [Pg1 Pg2]
0044 lam = [lam1 lam2]
0045 
0046 %%-----  DC OPF (w/reserves)  -----
0047 %% runopf_w_res
0048 mpc = loadcase(casefile);
0049 r1 = runopf_w_res(mpc, mpopt);
0050 Pg1 = r1.gen(:, PG);        % active generation
0051 lam1 = r1.bus(:, LAM_P);    % nodal energy price
0052 R1 = r1.reserves.R;         % reserve quantity
0053 prc1 = r1.reserves.prc;     % reserve price
0054 
0055 %% most
0056 mpc = loadcase(casefile);
0057 mpopt = mpoption(mpopt, 'most.dc_model', 1);    % use DC network model (default)
0058 mdi = loadmd(mpc);
0059 mdi.FixedReserves = mpc.reserves;   % include fixed zonal reserves
0060 mdo = most(mdi, mpopt);
0061 ms = most_summary(mdo);
0062 r2 = mdo.flow.mpc;
0063 Pg2 = r2.gen(:, PG);        % active generation
0064 lam2 = r2.bus(:, LAM_P);    % nodal energy price
0065 R2 = r2.reserves.R;         % reserve quantity
0066 prc2 = r2.reserves.prc;     % reserve price
0067 
0068 %% comparison
0069 Pg = [Pg1 Pg2]
0070 lam = [lam1 lam2]
0071 R = [R1 R2]
0072 prc = [prc1 prc2]

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005