0001 function most_ex6_uc(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
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', 1e-5);
0023
0024
0025 if have_fcn('cplex')
0026
0027
0028 mpopt = mpoption(mpopt, 'cplex.lpmethod', 2);
0029
0030
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
0042
0043 mpopt = mpoption(mpopt, 'gurobi.method', 1);
0044
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
0052
0053
0054 mpopt = mpoption(mpopt, 'mosek.lp_alg', sc.MSK_OPTIMIZER_DUAL_SIMPLEX);
0055
0056
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
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
0066
0067
0068 mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex');
0069
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
0076
0077
0078
0079
0080 end
0081
0082 casefile = 'ex_case3b';
0083 mpc = loadcase(casefile);
0084 xgd = loadxgendata('ex_xgd_uc', mpc);
0085 [iwind, mpc, xgd] = addwind('ex_wind_uc', mpc, xgd);
0086 profiles = getprofiles('ex_wind_profile_d', iwind);
0087 profiles = getprofiles('ex_load_profile', profiles);
0088 nt = size(profiles(1).values, 1);
0089 mpc_full = mpc;
0090 xgd_full = xgd;
0091 mpc.gencost(:, [STARTUP SHUTDOWN]) = 0;
0092 xgd.MinUp(2) = 1;
0093 xgd.PositiveLoadFollowReserveQuantity(3) = 250;
0094 xgd.PositiveLoadFollowReservePrice(3) = 1e-6;
0095 xgd.NegativeLoadFollowReservePrice(3) = 1e-6;
0096
0097
0098
0099 mpopt = mpoption(mpopt, 'most.dc_model', 0);
0100 mdi = loadmd(mpc, nt, xgd, [], [], profiles);
0101 mdo = most(mdi, mpopt);
0102 if verbose
0103 ms = most_summary(mdo);
0104 end
0105
0106
0107 mpopt = mpoption(mpopt, 'most.dc_model', 1);
0108 mdo = most(mdi, mpopt);
0109 if verbose
0110 ms = most_summary(mdo);
0111 end
0112
0113
0114 mpc.gencost(2, [STARTUP SHUTDOWN]) = [ 200 200];
0115 mpc.gencost(3, [STARTUP SHUTDOWN]) = [3000 600];
0116
0117 mdi = loadmd(mpc, nt, xgd, [], [], profiles);
0118 mdo = most(mdi, mpopt);
0119 if verbose
0120 ms = most_summary(mdo);
0121 end
0122
0123
0124 xgd.MinUp(2) = 3;
0125 mdi = loadmd(mpc, nt, xgd, [], [], profiles);
0126 mdo = most(mdi, mpopt);
0127 if verbose
0128 ms = most_summary(mdo);
0129 end
0130
0131
0132 xgd.PositiveLoadFollowReserveQuantity(3) = 100;
0133 xgd.PositiveLoadFollowReservePrice(3) = 10;
0134 xgd.NegativeLoadFollowReservePrice(3) = 10;
0135
0136 mdi = loadmd(mpc, nt, xgd, [], [], profiles);
0137 mdo = most(mdi, mpopt);
0138 if verbose
0139 ms = most_summary(mdo);
0140 end
0141
0142
0143 mpopt = mpoption(mpopt, 'most.storage.cyclic', 1);
0144 [iess, mpc, xgd, sd] = addstorage('ex_storage', mpc, xgd);
0145 mdi = loadmd(mpc, nt, xgd, sd, [], profiles);
0146 mdo = most(mdi, mpopt);
0147 if verbose
0148 ms = most_summary(mdo);
0149 end