0001 function t_most_3b_3_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 = 39;
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 nt = 3;
0096 xgd = loadxgendata(xgd_table, mpc);
0097 md = loadmd(mpc, nt, xgd);
0098
0099
0100 r = most(md, mpopt);
0101
0102
0103 t = 'success1';
0104 t_ok(s.rdc.success, t);
0105 t = 'success2';
0106 t_ok(r.QP.exitflag, t);
0107
0108 t = 'f';
0109 t_is(r.results.f/sum(r.StepProb), s.rdc.f, 4, t);
0110
0111 for tt = 1:nt
0112
0113 t = sprintf('(t=%d) Pg : base', tt);
0114 t_is(r.flow(tt,1,1).mpc.gen(:, PG), s.rdc.gen(:, PG), 5, t);
0115
0116 t = sprintf('(t=%d) gen : base', tt);
0117 t_is(r.flow(tt,1,1).mpc.gen(:,1:MU_PMIN), s.rdc.gen(:,1:MU_PMIN), 3, t);
0118
0119 t = sprintf('(t=%d) energy prices', tt);
0120 t_is(r.results.GenPrices(:,tt), s.rdc.bus(gbus, LAM_P), 6, t);
0121
0122 t = sprintf('(t=%d) Pc', tt);
0123 t_is(r.results.Pc(:,tt), s.rdc.gen(:, PG), 4, t);
0124
0125 t = sprintf('(t=%d) Gmin', tt);
0126 t_is(r.results.Pc(:,tt) - r.results.Rpm(:,tt), s.rdc.gen(:, PG), 4, t);
0127
0128 t = sprintf('(t=%d) Gmax', tt);
0129 t_is(r.results.Pc(:,tt) + r.results.Rpp(:,tt), s.rdc.gen(:, PG), 4, t);
0130
0131 t = sprintf('(t=%d) upward contingency reserve quantities', tt);
0132 t_is(r.results.Rpp(:,tt), zeros(ng, 1), 4, t);
0133
0134 t = sprintf('(t=%d) downward contingency reserve quantities', tt);
0135 t_is(r.results.Rpm(:,tt), zeros(ng, 1), 4, t);
0136
0137 t = sprintf('(t=%d) upward contingency reserve prices', tt);
0138 t_is(r.results.RpmPrices(:,tt), xgd.NegativeActiveReservePrice, 6, t);
0139
0140 t = sprintf('(t=%d) downward contingency reserve prices', tt);
0141 t_is(r.results.RpmPrices(:,tt), xgd.NegativeActiveReservePrice, 6, t);
0142
0143 t = sprintf('(t=%d) Rpmax_pos', tt);
0144 vv = get_idx(r.om);
0145 Rpmax_pos = (r.QP.lambda.upper(vv.i1.Rpp(tt):vv.iN.Rpp(tt)) - r.QP.lambda.lower(vv.i1.Rpp(tt):vv.iN.Rpp(tt))) / mpc.baseMVA;
0146 t_is(Rpmax_pos, zeros(ng, 1), 6, t);
0147
0148 t = sprintf('(t=%d) Rpmax_neg', tt);
0149 Rpmax_neg = (r.QP.lambda.upper(vv.i1.Rpm(tt):vv.iN.Rpm(tt)) - r.QP.lambda.lower(vv.i1.Rpm(tt):vv.iN.Rpm(tt))) / mpc.baseMVA;
0150 t_is(Rpmax_neg, zeros(ng, 1), 6, t);
0151
0152 end
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176 warning(s7.state, 'MATLAB:nearlySingularMatrix');
0177 warning(s6.state, 'MATLAB:nearlySingularMatrixUMFPACK');
0178
0179 t_end;