0001 function t_most_3b_1_1_0(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 if nargin < 1
0013 quiet = 0;
0014 end
0015
0016 n_tests = 15;
0017
0018 t_begin(n_tests, quiet);
0019
0020 casename = 't_case3_most';
0021 fudging = struct( ...
0022 'fudge', 0.05, ...
0023 'step', 0.01, ...
0024 'lim', 0.1);
0025
0026
0027
0028 mpopt = mpoption('verbose', 0, 'out.all', 0);
0029 mpopt = mpoption(mpopt, 'opf.violation', 5e-7, 'mips.comptol', 5e-8);
0030 mpoptac = mpoption(mpopt, 'model', 'AC');
0031 mpoptdc = mpoption(mpopt, 'model', 'DC');
0032 mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT');
0033
0034
0035 s7 = warning('query', 'MATLAB:nearlySingularMatrix');
0036 s6 = warning('query', 'MATLAB:nearlySingularMatrixUMFPACK');
0037 warning('off', 'MATLAB:nearlySingularMatrix');
0038 warning('off', 'MATLAB:nearlySingularMatrixUMFPACK');
0039
0040
0041 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0042 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0043 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0044 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0045 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0046 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0047 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0048 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0049 [CT_LABEL, CT_PROB, CT_TABLE, CT_TBUS, CT_TGEN, CT_TBRCH, CT_TAREABUS, ...
0050 CT_TAREAGEN, CT_TAREABRCH, CT_ROW, CT_COL, CT_CHGTYPE, CT_REP, ...
0051 CT_REL, CT_ADD, CT_NEWVAL, CT_TLOAD, CT_TAREALOAD, CT_LOAD_ALL_PQ, ...
0052 CT_LOAD_FIX_PQ, CT_LOAD_DIS_PQ, CT_LOAD_ALL_P, CT_LOAD_FIX_P, ...
0053 CT_LOAD_DIS_P, CT_TGENCOST, CT_TAREAGENCOST, CT_MODCOST_F, ...
0054 CT_MODCOST_X] = idx_ct;
0055
0056
0057 xgd_table.colnames = {
0058 'PositiveActiveReservePrice', ...
0059 'PositiveActiveReserveQuantity', ...
0060 'NegativeActiveReservePrice', ...
0061 'NegativeActiveReserveQuantity', ...
0062 'PositiveActiveDeltaPrice', ...
0063 'NegativeActiveDeltaPrice', ...
0064 };
0065 xgd_table.data = [
0066 1 400 2 400 0.01 0.01;
0067 3 300 4 300 0.01 0.01;
0068 0.001 450 0.002 450 0 0;
0069 ];
0070
0071
0072
0073 contab = [
0074
0075
0076
0077 ];
0078 clist = [];
0079 nc = length(clist);
0080
0081
0082 mpc = loadcase(casename);
0083 gbus = mpc.gen(:, GEN_BUS);
0084
0085
0086 rdc = rundcopf(mpc, mpoptdc);
0087
0088
0089
0090 s.rdc = rdc;
0091
0092
0093
0094 ng = size(mpc.gen, 1);
0095 xgd = loadxgendata(xgd_table, mpc);
0096 md = loadmd(mpc, [], xgd);
0097
0098
0099 r = most(md, mpopt);
0100
0101
0102 t = 'success1';
0103 t_ok(s.rdc.success, t);
0104 t = 'success2';
0105 t_ok(r.QP.exitflag, t);
0106
0107 t = 'f';
0108 t_is(r.results.f, s.rdc.f, 4, t);
0109
0110 t = 'Pg : base';
0111 t_is(r.flow(1,1,1).mpc.gen(:, PG), s.rdc.gen(:, PG), 5, t);
0112
0113 t = 'gen : base';
0114 t_is(r.flow(1,1,1).mpc.gen(:,1:MU_PMIN), s.rdc.gen(:,1:MU_PMIN), 3, t);
0115
0116 t = 'energy prices';
0117 t_is(r.results.GenPrices, s.rdc.bus(gbus, LAM_P), 6, t);
0118
0119 t = 'Pc';
0120 t_is(r.results.Pc, s.rdc.gen(:, PG), 4, t);
0121
0122 t = 'Gmin';
0123 t_is(r.results.Pc - r.results.Rpm, s.rdc.gen(:, PG), 4, t);
0124
0125 t = 'Gmax';
0126 t_is(r.results.Pc + r.results.Rpp, s.rdc.gen(:, PG), 4, t);
0127
0128 t = 'upward contingency reserve quantities';
0129 t_is(r.results.Rpp, zeros(ng, 1), 4, t);
0130
0131 t = 'downward contingency reserve quantities';
0132 t_is(r.results.Rpm, zeros(ng, 1), 4, t);
0133
0134 t = 'upward contingency reserve prices';
0135 t_is(r.results.RppPrices, xgd.PositiveActiveReservePrice, 6, t);
0136
0137 t = 'downward contingency reserve prices';
0138 t_is(r.results.RpmPrices, xgd.NegativeActiveReservePrice, 6, t);
0139
0140 t = 'Rpmax_pos';
0141 vv = get_idx(r.om);
0142 Rpmax_pos = (r.QP.lambda.upper(vv.i1.Rpp(1):vv.iN.Rpp(1)) - r.QP.lambda.lower(vv.i1.Rpp(1):vv.iN.Rpp(1))) / mpc.baseMVA;
0143 t_is(Rpmax_pos, zeros(ng, 1), 6, t);
0144
0145 t = 'Rpmax_neg';
0146 Rpmax_neg = (r.QP.lambda.upper(vv.i1.Rpm(1):vv.iN.Rpm(1)) - r.QP.lambda.lower(vv.i1.Rpm(1):vv.iN.Rpm(1))) / mpc.baseMVA;
0147 t_is(Rpmax_neg, zeros(ng, 1), 6, t);
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172 warning(s7.state, 'MATLAB:nearlySingularMatrix');
0173 warning(s6.state, 'MATLAB:nearlySingularMatrixUMFPACK');
0174
0175 t_end;