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