0001 function t_most_30b_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_case30_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
0031
0032 if have_fcn('linprog')
0033 if have_fcn('linprog_ds')
0034 mpopt = mpoption(mpopt, 'linprog.Algorithm', 'dual-simplex');
0035 else
0036 mpopt = mpoption(mpopt, 'linprog.Algorithm', 'simplex');
0037 end
0038 end
0039 mpoptac = mpoption(mpopt, 'model', 'AC');
0040 mpoptdc = mpoption(mpopt, 'model', 'DC');
0041 mpopt = mpoption(mpopt, 'most.solver', 'DEFAULT');
0042
0043
0044 s7 = warning('query', 'MATLAB:nearlySingularMatrix');
0045 s6 = warning('query', 'MATLAB:nearlySingularMatrixUMFPACK');
0046 warning('off', 'MATLAB:nearlySingularMatrix');
0047 warning('off', 'MATLAB:nearlySingularMatrixUMFPACK');
0048
0049
0050 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0051 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0052 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0053 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0054 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0055 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0056 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0057 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0058 [CT_LABEL, CT_PROB, CT_TABLE, CT_TBUS, CT_TGEN, CT_TBRCH, CT_TAREABUS, ...
0059 CT_TAREAGEN, CT_TAREABRCH, CT_ROW, CT_COL, CT_CHGTYPE, CT_REP, ...
0060 CT_REL, CT_ADD, CT_NEWVAL, CT_TLOAD, CT_TAREALOAD, CT_LOAD_ALL_PQ, ...
0061 CT_LOAD_FIX_PQ, CT_LOAD_DIS_PQ, CT_LOAD_ALL_P, CT_LOAD_FIX_P, ...
0062 CT_LOAD_DIS_P, CT_TGENCOST, CT_TAREAGENCOST, CT_MODCOST_F, ...
0063 CT_MODCOST_X] = idx_ct;
0064
0065
0066 xgd_table.colnames = {
0067 'PositiveActiveReservePrice', ...
0068 'PositiveActiveReserveQuantity', ...
0069 'NegativeActiveReservePrice', ...
0070 'NegativeActiveReserveQuantity', ...
0071 'PositiveActiveDeltaPrice', ...
0072 'NegativeActiveDeltaPrice', ...
0073 };
0074 xgd_table.data = [
0075 10.1 15 10.0 15 0.1 0.0;
0076 10.3 30 10.2 30 0.3 0.2;
0077 10.5 20 10.4 20 0.5 0.4;
0078 10.7 25 10.6 25 0.7 0.6;
0079 20.1 25 20.0 25 60.1 60.0;
0080 20.3 15 20.2 15 15.1 15.0;
0081 20.5 30 20.4 30 60.3 60.2;
0082 20.7 15 20.6 15 15.3 15.2;
0083 30.1 15 30.0 15 60.3 60.4;
0084 30.3 30 30.2 30 30.1 30.0;
0085 30.5 25 30.4 25 60.7 60.6;
0086 30.7 30 30.6 30 30.3 30.2;
0087 0.001 50 0.002 50 0 0;
0088 0.001 50 0.002 50 0 0;
0089 0.001 50 0.002 50 0 0;
0090 0.001 50 0.002 50 0 0;
0091 0.001 50 0.002 50 0 0;
0092 0.001 50 0.002 50 0 0;
0093 0.001 50 0.002 50 0 0;
0094 0.001 50 0.002 50 0 0;
0095 0.001 50 0.002 50 0 0;
0096 0.001 50 0.002 50 0 0;
0097 0.001 50 0.002 50 0 0;
0098 0.001 50 0.002 50 0 0;
0099 0.001 50 0.002 50 0 0;
0100 0.001 50 0.002 50 0 0;
0101 0.001 50 0.002 50 0 0;
0102 0.001 50 0.002 50 0 0;
0103 0.001 50 0.002 50 0 0;
0104 0.001 50 0.002 50 0 0;
0105 0.001 50 0.002 50 0 0;
0106 0.001 50 0.002 50 0 0;
0107 ];
0108
0109
0110
0111 contab = [
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 ];
0132 clist = [];
0133 nc = length(clist);
0134
0135
0136 mpc = loadcase(casename);
0137 gbus = mpc.gen(:, GEN_BUS);
0138
0139
0140 rdc = rundcopf(mpc, mpoptdc);
0141
0142
0143
0144 s.rdc = rdc;
0145
0146
0147
0148 ng = size(mpc.gen, 1);
0149 xgd = loadxgendata(xgd_table, mpc);
0150 md = loadmd(mpc, [], xgd);
0151
0152
0153 r = most(md, mpopt);
0154
0155
0156 t = 'success1';
0157 t_ok(s.rdc.success, t);
0158 t = 'success2';
0159 t_ok(r.QP.exitflag, t);
0160
0161 t = 'f';
0162 t_is(r.results.f, s.rdc.f, 4, t);
0163
0164 t = 'Pg : base';
0165 t_is(r.flow(1,1,1).mpc.gen(:, PG), s.rdc.gen(:, PG), 5, t);
0166
0167 t = 'gen : base';
0168 t_is(r.flow(1,1,1).mpc.gen(:,1:MU_PMIN), s.rdc.gen(:,1:MU_PMIN), 3, t);
0169
0170 t = 'energy prices';
0171 t_is(r.results.GenPrices, s.rdc.bus(gbus, LAM_P), 6, t);
0172
0173 t = 'Pc';
0174 t_is(r.results.Pc, s.rdc.gen(:, PG), 4, t);
0175
0176 t = 'Gmin';
0177 t_is(r.results.Pc - r.results.Rpm, s.rdc.gen(:, PG), 4, t);
0178
0179 t = 'Gmax';
0180 t_is(r.results.Pc + r.results.Rpp, s.rdc.gen(:, PG), 4, t);
0181
0182 t = 'upward contingency reserve quantities';
0183 t_is(r.results.Rpp, zeros(ng, 1), 4, t);
0184
0185 t = 'downward contingency reserve quantities';
0186 t_is(r.results.Rpm, zeros(ng, 1), 4, t);
0187
0188 t = 'upward contingency reserve prices';
0189 t_is(r.results.RppPrices, xgd.PositiveActiveReservePrice, 6, t);
0190
0191 t = 'downward contingency reserve prices';
0192 t_is(r.results.RpmPrices, xgd.NegativeActiveReservePrice, 6, t);
0193
0194 t = 'Rpmax_pos';
0195 vv = get_idx(r.om);
0196 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;
0197 t_is(Rpmax_pos, zeros(ng, 1), 6, t);
0198
0199 t = 'Rpmax_neg';
0200 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;
0201 t_is(Rpmax_neg, zeros(ng, 1), 6, t);
0202
0203
0204 warning(s7.state, 'MATLAB:nearlySingularMatrix');
0205 warning(s6.state, 'MATLAB:nearlySingularMatrixUMFPACK');
0206
0207 t_end;