Home > matpower7.0 > most > lib > t > most_ex7_suc.m

most_ex7_suc

PURPOSE ^

MOST_EX7_SUC Examples of secure and stochastic unit commitment problems.

SYNOPSIS ^

function most_ex7_suc(quiet)

DESCRIPTION ^

MOST_EX7_SUC  Examples of secure and stochastic unit commitment problems.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function most_ex7_suc(quiet)
0002 %MOST_EX7_SUC  Examples of secure and stochastic unit commitment problems.
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 = 1;
0015 mpopt = mpoption('verbose', verbose);
0016 mpopt = mpoption(mpopt, 'out.gen', 1);
0017 mpopt = mpoption(mpopt, 'model', 'DC');
0018 mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT');
0019 if ~verbose
0020     mpopt = mpoption(mpopt, 'out.all', 0);
0021 end
0022 mpopt = mpoption(mpopt, 'most.price_stage_warn_tol', 10);
0023 
0024 %% solver options
0025 if have_fcn('cplex')
0026     %mpopt = mpoption(mpopt, 'cplex.lpmethod', 0);       %% automatic
0027     %mpopt = mpoption(mpopt, 'cplex.lpmethod', 1);       %% primal simplex
0028     mpopt = mpoption(mpopt, 'cplex.lpmethod', 2);       %% dual simplex
0029     %mpopt = mpoption(mpopt, 'cplex.lpmethod', 3);       %% network simplex
0030     %mpopt = mpoption(mpopt, 'cplex.lpmethod', 4);       %% barrier
0031     mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.mipgap', 0);
0032     mpopt = mpoption(mpopt, 'cplex.opts.mip.tolerances.absmipgap', 0);
0033     mpopt = mpoption(mpopt, 'cplex.opts.threads', 2);
0034 end
0035 if have_fcn('glpk')
0036     mpopt = mpoption(mpopt, 'glpk.opts.mipgap', 0);
0037     mpopt = mpoption(mpopt, 'glpk.opts.tolint', 1e-10);
0038     mpopt = mpoption(mpopt, 'glpk.opts.tolobj', 1e-10);
0039 end
0040 if have_fcn('gurobi')
0041     %mpopt = mpoption(mpopt, 'gurobi.method', -1);       %% automatic
0042     %mpopt = mpoption(mpopt, 'gurobi.method', 0);        %% primal simplex
0043     mpopt = mpoption(mpopt, 'gurobi.method', 1);        %% dual simplex
0044     %mpopt = mpoption(mpopt, 'gurobi.method', 2);        %% barrier
0045     mpopt = mpoption(mpopt, 'gurobi.threads', 2);
0046     mpopt = mpoption(mpopt, 'gurobi.opts.MIPGap', 0);
0047     mpopt = mpoption(mpopt, 'gurobi.opts.MIPGapAbs', 0);
0048 end
0049 if have_fcn('mosek')
0050     sc = mosek_symbcon;
0051     %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE);            %% default
0052     %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_INTPNT);          %% interior point
0053     %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_PRIMAL_SIMPLEX);  %% primal simplex
0054     mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_DUAL_SIMPLEX);     %% dual simplex
0055     %mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_FREE_SIMPLEX);    %% automatic simplex
0056     %mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_X', 0);
0057     mpopt = mpoption(mpopt, 'mosek.opts.MSK_IPAR_MIO_NODE_OPTIMIZER', sc.MSK_OPTIMIZER_DUAL_SIMPLEX);
0058     mpopt = mpoption(mpopt, 'mosek.opts.MSK_IPAR_MIO_ROOT_OPTIMIZER', sc.MSK_OPTIMIZER_DUAL_SIMPLEX);
0059     mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_RELAX_INT', 1e-9);
0060     %mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_RELAX_INT', 0);
0061     mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_REL_GAP', 0);
0062     mpopt = mpoption(mpopt, 'mosek.opts.MSK_DPAR_MIO_TOL_ABS_GAP', 0);
0063 end
0064 if have_fcn('intlinprog')
0065     %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'interior-point');
0066     %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'active-set');
0067     %mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex');
0068     mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex');
0069     %mpopt = mpoption(mpopt, 'intlinprog.RootLPAlgorithm', 'primal-simplex');
0070     mpopt = mpoption(mpopt, 'intlinprog.RootLPAlgorithm', 'dual-simplex');
0071     mpopt = mpoption(mpopt, 'intlinprog.TolCon', 1e-9);
0072     mpopt = mpoption(mpopt, 'intlinprog.TolGapAbs', 0);
0073     mpopt = mpoption(mpopt, 'intlinprog.TolGapRel', 0);
0074     mpopt = mpoption(mpopt, 'intlinprog.TolInteger', 1e-6);
0075     %% next line is to work around a bug in intlinprog
0076     % (Technical Support Case #01841662)
0077     mpopt = mpoption(mpopt, 'intlinprog.LPPreprocess', 'none');
0078 end
0079 
0080 casefile = 'ex_case3b';
0081 mpc = loadcase(casefile);
0082 xgd = loadxgendata('ex_xgd_uc', mpc);
0083 [iwind, mpc, xgd] = addwind('ex_wind_uc', mpc, xgd);
0084 profiles = getprofiles('ex_wind_profile', iwind);
0085 profiles = getprofiles('ex_load_profile', profiles);
0086 nt = size(profiles(1).values, 1);       % number of periods
0087 
0088 %%-----  Individual Trajectories  -----
0089 transmat_s = cell(1, nt);
0090 I = speye(3);
0091 [transmat_s{:}] = deal(I);
0092 transmat_s{1} = [ 0.158655253931457; 0.682689492137086; 0.158655253931457 ];
0093 mdi = loadmd(mpc, transmat_s, xgd, [], [], profiles);
0094 mdi = filter_ramp_transitions(mdi, 0.1);
0095 mdo = most(mdi, mpopt);
0096 if verbose
0097     ms = most_summary(mdo);
0098 end
0099 
0100 %%-----  Full Transition Probabilities  -----
0101 transmat = ex_transmat(nt);
0102 mdi = loadmd(mpc, transmat, xgd, [], [], profiles);
0103 mdo = most(mdi, mpopt);
0104 if verbose
0105     ms = most_summary(mdo);
0106 end
0107 
0108 %%-----  Full Transition Probabilities + Contingencies  -----
0109 mdi = loadmd(mpc, transmat, xgd, [], 'ex_contab', profiles);
0110 mdo = most(mdi, mpopt);
0111 if verbose
0112     ms = most_summary(mdo);
0113 end
0114 
0115 %%-----  Plus Storage  -----
0116 [iess, mpc, xgd, sd] = addstorage('ex_storage', mpc, xgd);
0117 mdi = loadmd(mpc, transmat, xgd, sd, 'ex_contab', profiles);
0118 mdo = most(mdi, mpopt);
0119 if verbose
0120     ms = most_summary(mdo);
0121 end

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005