Skip to content

Commit

Permalink
Update PF and OPF test cases to include cases where gens are reordere…
Browse files Browse the repository at this point in the history
…d internally.
  • Loading branch information
rdzman committed Feb 26, 2019
1 parent c18d66d commit edb879e
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 107 deletions.
Binary file modified lib/t/soln9_dcopf.mat
Binary file not shown.
Binary file modified lib/t/soln9_dcpf.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf_PQcap.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf_Plim.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf_ang.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf_extras1.mat
Binary file not shown.
Binary file modified lib/t/soln9_opf_vg.mat
Binary file not shown.
Binary file modified lib/t/soln9_pf.mat
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/t/t_case9_dcline.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 0 0 300 -300 1 100 1 250 90 0 0 0 0 0 0 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 200 -20 20 -10 10 0 0 0 0 0;
30 85 0 300 -300 1 100 1 270 10 0 200 -30 30 -15 15 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 200 -20 20 -10 10 0 0 0 0 0;
];

%% branch data
Expand All @@ -55,8 +55,8 @@
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [
1 0 0 4 0 0 100 2500 200 5500 250 7250;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
1 0 0 3 0 0 200 3000 300 5000 0 0;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
];

%%----- DC Line Data -----
Expand Down
4 changes: 2 additions & 2 deletions lib/t/t_case9_opf.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin
gen = [
1 0 0 300 -300 1 100 1 250 90;
2 163 0 300 -300 1 100 1 300 10;
30 85 0 300 -300 1 100 1 270 10;
2 163 0 300 -300 1 100 1 300 10;
];

%% branch data
Expand Down Expand Up @@ -58,6 +58,6 @@
% 2 startup shutdown n c(n-1) ... c0
gencost = [
1 0 0 4 0 0 100 2500 200 5500 250 7250;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
1 0 0 3 0 0 200 3000 300 5000 0 0;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
];
4 changes: 2 additions & 2 deletions lib/t/t_case9_opfv2.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 0 0 300 -300 1 100 1 250 90 0 0 0 0 0 0 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 200 -20 20 -10 10 0 0 0 0 0;
30 85 0 300 -300 1 100 1 270 10 0 200 -30 30 -15 15 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 200 -20 20 -10 10 0 0 0 0 0;
];

%% branch data
Expand All @@ -53,6 +53,6 @@
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [
1 0 0 4 0 0 100 2500 200 5500 250 7250;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
1 0 0 3 0 0 200 3000 300 5000 0 0;
2 0 0 2 24.035 -403.5 0 0 0 0 0 0;
];
2 changes: 1 addition & 1 deletion lib/t/t_case9_pf.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin
gen = [
1 0 0 300 -300 1 100 1 250 90;
2 163 0 300 -300 1 100 1 300 10;
30 85 0 300 -300 1 100 1 270 10;
2 163 0 300 -300 1 100 1 300 10;
];

%% branch data
Expand Down
2 changes: 1 addition & 1 deletion lib/t/t_case9_pfv2.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
% bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf
mpc.gen = [
1 0 0 300 -300 1 100 1 250 90 0 0 0 0 0 0 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 0 0 0 0 0 0 0 0 0 0;
30 85 0 300 -300 1 100 1 270 10 0 0 0 0 0 0 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 10 0 0 0 0 0 0 0 0 0 0 0;
];

%% branch data
Expand Down
6 changes: 3 additions & 3 deletions lib/t/t_dcline.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ function t_dcline(quiet)
t_ok(success, [t 'success']);
t_is( rp.bus(:,ib_voltage), r.bus(:,ib_voltage), 3, [t 'bus voltage']);
%t_is( rp.gen(:,ig_disp ), r.gen(:,ig_disp ), 3, [t 'gen dispatch']);
t_is( rp.gen(1:2,ig_disp ), r.gen(1:2,ig_disp ), 3, [t 'gen dispatch']);
t_is( rp.gen(3,PG ), r.gen(3,PG ), 3, [t 'gen dispatch']);
t_is( rp.gen(3,QG)+rp.dcline(1,c.QF), r.gen(3,QG)+r.dcline(1,c.QF), 3, [t 'gen dispatch']);
t_is( rp.gen([1;3],ig_disp ), r.gen([1;3],ig_disp ), 3, [t 'gen dispatch']);
t_is( rp.gen(2,PG ), r.gen(2,PG ), 3, [t 'gen dispatch']);
t_is( rp.gen(2,QG)+rp.dcline(1,c.QF), r.gen(2,QG)+r.dcline(1,c.QF), 3, [t 'gen dispatch']);
t_is(rp.branch(:,ibr_flow ), r.branch(:,ibr_flow ), 3, [t 'branch flow']);

%% add appropriate P and Q injections and check angles and generation when running PF
Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_bpmpd.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ function t_opf_dc_bpmpd(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -91,13 +91,13 @@ function t_opf_dc_bpmpd(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -111,7 +111,7 @@ function t_opf_dc_bpmpd(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_clp.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ function t_opf_dc_clp(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -136,13 +136,13 @@ function t_opf_dc_clp(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -156,7 +156,7 @@ function t_opf_dc_clp(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_cplex.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ function t_opf_dc_cplex(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -103,13 +103,13 @@ function t_opf_dc_cplex(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -123,7 +123,7 @@ function t_opf_dc_cplex(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_glpk.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ function t_opf_dc_glpk(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -118,13 +118,13 @@ function t_opf_dc_glpk(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -138,7 +138,7 @@ function t_opf_dc_glpk(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_gurobi.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ function t_opf_dc_gurobi(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -103,13 +103,13 @@ function t_opf_dc_gurobi(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -123,7 +123,7 @@ function t_opf_dc_gurobi(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 5, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 5, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 5, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 4, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_ipopt.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ function t_opf_dc_ipopt(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -98,13 +98,13 @@ function t_opf_dc_ipopt(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -118,7 +118,7 @@ function t_opf_dc_ipopt(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

Expand Down
12 changes: 6 additions & 6 deletions lib/t/t_opf_dc_mips.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ function t_opf_dc_mips(quiet)

%%----- run OPF with extra linear user constraints & costs -----
%% two new z variables
%% 0 <= z1, P2 - P1 <= z1
%% 0 <= z2, P2 - P3 <= z2
%% 0 <= z1, P3 - P1 <= z1
%% 0 <= z2, P3 - P2 <= z2
%% with A and N sized for DC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[10;11;13;11;12;14],[-1;1;-1;1;-1;-1],2,14);
mpc.A = sparse([1;1;1;2;2;2],[10;12;13;12;11;14],[-1;1;-1;1;-1;-1],2,14);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -110,13 +110,13 @@ function t_opf_dc_mips(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

%% with A and N sized for AC opf
mpc = loadcase(casefile);
mpc.A = sparse([1;1;1;2;2;2],[19;20;25;20;21;26],[-1;1;-1;1;-1;-1],2,26);
mpc.A = sparse([1;1;1;2;2;2],[19;21;25;21;20;26],[-1;1;-1;1;-1;-1],2,26);
mpc.u = [0; 0];
mpc.l = [-Inf; -Inf];
mpc.zl = [0; 0];
Expand All @@ -130,7 +130,7 @@ function t_opf_dc_mips(quiet)
[r, success] = rundcopf(mpc, mpopt);
t_ok(success, [t 'success']);
t_is(r.gen(1, PG), 116.15974, 4, [t 'Pg1 = 116.15974']);
t_is(r.gen(2, PG), 116.15974, 4, [t 'Pg2 = 116.15974']);
t_is(r.gen(3, PG), 116.15974, 4, [t 'Pg3 = 116.15974']);
t_is(r.var.val.z, [0; 0.3348], 4, [t 'user vars']);
t_is(r.cost.usr, 0.3348, 3, [t 'user costs']);

Expand Down
Loading

0 comments on commit edb879e

Please sign in to comment.