0001 function t_makeLODF(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 if nargin < 1
0034 quiet = 0;
0035 end
0036
0037 ntests = 31;
0038 t_begin(ntests, quiet);
0039
0040 casefile = 't_auction_case';
0041 if quiet
0042 verbose = 0;
0043 else
0044 verbose = 0;
0045 end
0046
0047 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0048 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0049 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0050 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0051 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
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
0056
0057 mpc = loadcase(casefile);
0058 mpopt = mpoption('OUT_ALL', 0, 'VERBOSE', verbose);
0059 [baseMVA, bus, gen, gencost, branch, f, success, et] = ...
0060 rundcopf(mpc, mpopt);
0061 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0062
0063
0064 F0 = branch(:, PF);
0065
0066
0067 H = makePTDF(baseMVA, bus, branch, 1);
0068
0069
0070 s = warning('query', 'MATLAB:divideByZero');
0071 warning('off', 'MATLAB:divideByZero');
0072 LODF = makeLODF(branch, H);
0073 warning(s.state, 'MATLAB:divideByZero');
0074
0075
0076 mpc.bus = bus;
0077 mpc.gen = gen;
0078 branch0 = branch;
0079 outages = [1:12 14:15 17:18 20 27:33 35:41];
0080 for k = outages
0081 mpc.branch = branch0;
0082 mpc.branch(k, BR_STATUS) = 0;
0083 [baseMVA, bus, gen, branch, success, et] = rundcpf(mpc, mpopt);
0084 F = branch(:, PF);
0085
0086 t_is(LODF(:, k), (F - F0) / F0(k), 6, sprintf('LODF(:, %d)', k));
0087 end
0088
0089 t_end;