0001 function t_opf_sdpopf(quiet)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 if nargin < 1
0014 quiet = 0;
0015 end
0016
0017 num_tests = 36;
0018
0019 t_begin(num_tests, quiet);
0020
0021 [PQ, PV, REF, NONE, BUS_I, BUS_TYPE, PD, QD, GS, BS, BUS_AREA, VM, ...
0022 VA, BASE_KV, ZONE, VMAX, VMIN, LAM_P, LAM_Q, MU_VMAX, MU_VMIN] = idx_bus;
0023 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0024 MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0025 QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0026 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ...
0027 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ...
0028 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch;
0029 [PW_LINEAR, POLYNOMIAL, MODEL, STARTUP, SHUTDOWN, NCOST, COST] = idx_cost;
0030
0031 casefile = 't_case9mod_opf';
0032 if quiet
0033 verbose = 0;
0034 else
0035 verbose = 0;
0036 end
0037
0038 t0 = 'SDPOPF : ';
0039 mpopt = mpoption('opf.violation', 1e-6);
0040 mpopt = mpoption(mpopt, 'out.all', 0, 'verbose', verbose, ...
0041 'opf.ac.solver', 'SDPOPF', 'sdp_pf.eps_r', 0);
0042
0043
0044 ib_data = [1:BUS_AREA BASE_KV:VMIN];
0045 ib_voltage = [VM VA];
0046 ib_lam = [LAM_P LAM_Q];
0047 ib_mu = [MU_VMAX MU_VMIN];
0048 ig_data = [GEN_BUS QMAX QMIN MBASE:APF];
0049 ig_disp = [PG QG VG];
0050 ig_mu = (MU_PMAX:MU_QMIN);
0051 ibr_data = (1:ANGMAX);
0052 ibr_flow = (PF:QT);
0053 ibr_mu = [MU_SF MU_ST];
0054 ibr_angmu = [MU_ANGMIN MU_ANGMAX];
0055
0056
0057 load soln9mod_opf;
0058
0059
0060 t = t0;
0061 [baseMVA, bus, gen, gencost, branch, f, success, et] = runopf(casefile, mpopt);
0062 t_ok(success, [t 'success']);
0063 t_is(f, f_soln, 3, [t 'f']);
0064 t_is( bus(:,ib_data ), bus_soln(:,ib_data ), 10, [t 'bus data']);
0065 t_is( bus(:,ib_voltage), bus_soln(:,ib_voltage), 3, [t 'bus voltage']);
0066 t_is( bus(:,ib_lam ), bus_soln(:,ib_lam ), 3, [t 'bus lambda']);
0067 t_is( bus(:,ib_mu ), bus_soln(:,ib_mu ), 1, [t 'bus mu']);
0068 t_is( gen(:,ig_data ), gen_soln(:,ig_data ), 10, [t 'gen data']);
0069 t_is( gen(:,ig_disp ), gen_soln(:,ig_disp ), 2, [t 'gen dispatch']);
0070 t_is( gen(:,ig_mu ), gen_soln(:,ig_mu ), 3, [t 'gen mu']);
0071 t_is(branch(:,ibr_data ), branch_soln(:,ibr_data ), 10, [t 'branch data']);
0072 t_is(branch(:,ibr_flow ), branch_soln(:,ibr_flow ), 2, [t 'branch flow']);
0073 t_is(branch(:,ibr_mu ), branch_soln(:,ibr_mu ), 2, [t 'branch mu']);
0074
0075
0076 t = [t0 '(single-block PWL) : '];
0077 mpc = loadcase(casefile);
0078 mpc.gencost(3, NCOST) = 2;
0079 [r, success] = runopf(mpc, mpopt);
0080 [f, bus, gen, branch] = deal(r.f, r.bus, r.gen, r.branch);
0081 t_ok(success, [t 'success']);
0082 t_is(f, f_soln, 3, [t 'f']);
0083 t_is( bus(:,ib_data ), bus_soln(:,ib_data ), 10, [t 'bus data']);
0084 t_is( bus(:,ib_voltage), bus_soln(:,ib_voltage), 3, [t 'bus voltage']);
0085 t_is( bus(:,ib_lam ), bus_soln(:,ib_lam ), 3, [t 'bus lambda']);
0086 t_is( bus(:,ib_mu ), bus_soln(:,ib_mu ), 1, [t 'bus mu']);
0087 t_is( gen(:,ig_data ), gen_soln(:,ig_data ), 10, [t 'gen data']);
0088 t_is( gen(:,ig_disp ), gen_soln(:,ig_disp ), 2, [t 'gen dispatch']);
0089 t_is( gen(:,ig_mu ), gen_soln(:,ig_mu ), 3, [t 'gen mu']);
0090 t_is(branch(:,ibr_data ), branch_soln(:,ibr_data ), 10, [t 'branch data']);
0091 t_is(branch(:,ibr_flow ), branch_soln(:,ibr_flow ), 2, [t 'branch flow']);
0092 t_is(branch(:,ibr_mu ), branch_soln(:,ibr_mu ), 2, [t 'branch mu']);
0093
0094
0095 load soln9mod_opf_Plim;
0096
0097
0098 t = [t0 '(P line lim) : '];
0099 mpopt1 = mpoption(mpopt, 'opf.flow_lim', 'P');
0100 [baseMVA, bus, gen, gencost, branch, f, success, et] = runopf(casefile, mpopt1);
0101 t_ok(success, [t 'success']);
0102 t_is(f, f_soln, 3, [t 'f']);
0103 t_is( bus(:,ib_data ), bus_soln(:,ib_data ), 10, [t 'bus data']);
0104 t_is( bus(:,ib_voltage), bus_soln(:,ib_voltage), 3, [t 'bus voltage']);
0105 t_is( bus(:,ib_lam ), bus_soln(:,ib_lam ), 3, [t 'bus lambda']);
0106 t_is( bus(:,ib_mu ), bus_soln(:,ib_mu ), 1, [t 'bus mu']);
0107 t_is( gen(:,ig_data ), gen_soln(:,ig_data ), 10, [t 'gen data']);
0108 t_is( gen(:,ig_disp ), gen_soln(:,ig_disp ), 2, [t 'gen dispatch']);
0109 t_is( gen(:,ig_mu ), gen_soln(:,ig_mu ), 3, [t 'gen mu']);
0110 t_is(branch(:,ibr_data ), branch_soln(:,ibr_data ), 10, [t 'branch data']);
0111 t_is(branch(:,ibr_flow ), branch_soln(:,ibr_flow ), 2, [t 'branch flow']);
0112 t_is(branch(:,ibr_mu ), branch_soln(:,ibr_mu ), 2, [t 'branch mu']);
0113
0114 t_end;