0001 function t_makeLODF(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 1
0015 quiet = 0;
0016 end
0017
0018 ntests = 31;
0019 t_begin(ntests, quiet);
0020
0021 casefile = 't_auction_case';
0022 if quiet
0023 verbose = 0;
0024 else
0025 verbose = 0;
0026 end
0027
0028 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0029 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0030 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0031 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0032 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0033 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0034 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0035 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0036
0037
0038 mpc = loadcase(casefile);
0039 mpopt = mpoption('out.all', 0, 'verbose', verbose);
0040 [baseMVA, bus, gen, gencost, branch, f, success, et] = ...
0041 rundcopf(mpc, mpopt);
0042 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0043
0044
0045 F0 = branch(:, PF);
0046
0047
0048 H = makePTDF(baseMVA, bus, branch, 1);
0049
0050
0051 s = warning('query', 'MATLAB:divideByZero');
0052 warning('off', 'MATLAB:divideByZero');
0053 LODF = makeLODF(branch, H);
0054 warning(s.state, 'MATLAB:divideByZero');
0055
0056
0057 mpc.bus = bus;
0058 mpc.gen = gen;
0059 branch0 = branch;
0060 outages = [1:12 14:15 17:18 20 27:33 35:41];
0061 for k = outages
0062 mpc.branch = branch0;
0063 mpc.branch(k, BR_STATUS) = 0;
0064 [baseMVA, bus, gen, branch, success, et] = rundcpf(mpc, mpopt);
0065 F = branch(:, PF);
0066
0067 t_is(LODF(:, k), (F - F0) / F0(k), 6, sprintf('LODF(:, %d)', k));
0068 end
0069
0070 t_end;