Hi Dr. Zimmerman, thanks for the reply,
I ran simple cases on matlab using v5.1, and got the same errors for
situations 1 and 2. M-files are provided at the end, altered from test case
t_case9_dcline.
Thank you!
1 - For a 2-bus system dc-connected, creation of the sparse Bf matrix fails
*.Could this be because in this case there are no branches in the system?*
Error in ext2int (line 176)
mpc.branch(:, T_BUS) = o.bus.e2i( mpc.branch(:, T_BUS) );
Error in opf (line 197)
mpc = ext2int(mpc);
Error in runopf (line 77)
[r, success] = opf(casedata, mpopt);
Error in rundcopf (line 75)
[varargout{1:nargout}] = runopf(casedata, mpopt, fname, solvedcase);
2 - For a 3-bus system where one is dc-connected, the add_constraints fail
*.The difference in matrix A size and the number of variables is the number
of dc-connected buses.*
*E.g. A has 7 columns (2 buses, 3 generators + 2 gen. for the DC line
representation) while nv = 8 (3 buses + 2 + 3 generators).*
*Thus the DC bus is not counted at all for dimensioning A.*
Error using opt_model/add_constraints (line 170)
@opt_model/add_constraints: number of columns of A does not match
number of variables, A is 3 x 7, nv = 8
Error in opf_setup (line 212)
om = add_constraints(om, 'Pmis', Amis, bmis, bmis, {'Va', 'Pg'}); %% nb
Error in opf (line 200)
om = opf_setup(mpc, mpopt);
Error in runopf (line 77)
[r, success] = opf(casedata, mpopt);
Error in rundcopf (line 75)
[varargout{1:nargout}] = runopf(casedata, mpopt, fname, solvedcase);
*M file - 2-bus case*%% MATPOWER Case Format : Version 2
mpc.version = '2';
%%----- Power Flow Data -----%%
%% system MVA base
mpc.baseMVA = 100;
%% bus data
% bus_i type Pd Qd Gs Bs area Vm Va baseKV
zone Vmax Vmin
mpc.bus = [ 1 3 80 0 0 0 1 1 0 345 1
1.1 0.9;
30 3 80 0 0 0 1 1 0 345 1 1.1 0.9;];
%% generator data
% 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
0 0 0 0 0 0 0 0 0 0 0 0;
30 85 0 300 -300 1 100 1 270 0 0
200 -30 30 -15 15 0 0 0 0 0;];
%% branch data
% fbus tbus r x b rateA rateB rateC ratio
angle status angmin angmax
mpc.branch = [ 1 30 0 0.057 150 150 250 250 0
0 0 -360 360;];
%%----- OPF Data -----%%
%% generator cost data
% 1 startup shutdown n x1 y1 ... xn yn
% 2 startup shutdown n c(n-1) ... c0
mpc.gencost = [ 1 0 0 4 0 0 100 2500 200
5500 250 7250;
1 0 0 3 0 0 200 3000 300 5000 0 0;];
%%----- DC Line Data -----
% fbus tbus status Pf Pt Qf Qt Vf Vt Pmin
Pmax QminF QmaxF QminT QmaxT loss0 loss1
mpc.dcline = [ 30 1 1 10 8.9 0 0 1.01 1
0 100 -100 10 -10 10 0 0;];
%% DC line cost data
% 1 startup shutdown n x1 y1 ... xn yn
% 2 startup shutdown n c(n-1) ... c0
mpc.dclinecost = [ 2 0 0 0 0 0 0 0 0 0
0 0 0 0;];
*M file - 3-bus case*
%% MATPOWER Case Format : Version 2
mpc.version = '2';
%%----- Power Flow Data -----%%
%% system MVA base
mpc.baseMVA = 100;
%% bus data
% bus_i type Pd Qd Gs Bs area Vm Va baseKV
zone Vmax Vmin
mpc.bus = [ 1 3 80 0 0 0 1 1 0 345 1
1.1 0.9;
2 2 80 0 0 0 1 1 0 345 1 1.1 0.9;
30 3 80 0 0 0 1 1 0 345 1 1.1 0.9;];
%% generator data
% 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
0 0 0 0 0 0 0 0 0 0 0 0;
2 163 0 300 -300 1 100 1 300 0 0
200 -20 20 -10 10 0 0 0 0 0;
30 85 0 300 -300 1 100 1 270 0 0
200 -30 30 -15 15 0 0 0 0 0;];
%% branch data
% fbus tbus r x b rateA rateB rateC ratio
angle status angmin angmax
mpc.branch = [ 1 2 0 0.057 150 150 250 250 0
0 1 -360 360;
1 30 0.017 0.092 0.158 150 250 250 0 0
0 -360 360;
30 2 0.039 0.17 0.358 150 150 150 0 0
0 -360 360;];
%%----- OPF Data -----%%
%% generator cost data
% 1 startup shutdown n x1 y1 ... xn yn
% 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;];
%%----- DC Line Data -----
% fbus tbus status Pf Pt Qf Qt Vf Vt Pmin
Pmax QminF QmaxF QminT QmaxT loss0 loss1
mpc.dcline = [ 30 1 1 10 8.9 0 0 1.01 1
0 200 -100 100 -100 100 0 0;];
%% DC line cost data
% 1 startup shutdown n x1 y1 ... xn yn
% 2 startup shutdown n c(n-1) ... c0
mpc.dclinecost = [ 2 0 0 0 0 0 0 0 0 0
0 0 0 0;];
On Mon, Jul 13, 2015 at 3:13 PM, João Gorenstein Dedecca <[email protected]
> wrote:
> Hi Dr. Zimmerman, thanks for the reply,
> I ran simple cases on matlab using v5.1, and got the same errors for
> situations 1 and 2. M-files are provided at the end, altered from test case
> t_case9_dcline.
> Thank you!
>
> 1 - For a 2-bus system dc-connected, creation of the sparse Bf matrix fails
> *.Could this be because in this case there are no branches in the system?*
>
> Error in ext2int (line 176)
> mpc.branch(:, T_BUS) = o.bus.e2i( mpc.branch(:, T_BUS) );
>
> Error in opf (line 197)
> mpc = ext2int(mpc);
>
> Error in runopf (line 77)
> [r, success] = opf(casedata, mpopt);
>
> Error in rundcopf (line 75)
> [varargout{1:nargout}] = runopf(casedata, mpopt, fname, solvedcase);
>
> 2 - For a 3-bus system where one is dc-connected, the add_constraints fail
>
> *.The difference in matrix A size and the number of variables is the
> number of dc-connected buses.*
>
> *E.g. A has 7 columns (2 buses, 3 generators + 2 gen. for the DC line
> representation) while nv = 8 (3 buses + 2 + 3 generators).*
>
> *Thus the DC bus is not counted at all for dimensioning A.*
>
> Error using opt_model/add_constraints (line 170)
> @opt_model/add_constraints: number of columns of A does not match
> number of variables, A is 3 x 7, nv = 8
>
> Error in opf_setup (line 212)
> om = add_constraints(om, 'Pmis', Amis, bmis, bmis, {'Va', 'Pg'}); %% nb
>
> Error in opf (line 200)
> om = opf_setup(mpc, mpopt);
>
> Error in runopf (line 77)
> [r, success] = opf(casedata, mpopt);
>
> Error in rundcopf (line 75)
> [varargout{1:nargout}] = runopf(casedata, mpopt, fname, solvedcase);
>
>
>
>
> *M file - 2-bus case*%% MATPOWER Case Format : Version 2
> mpc.version = '2';
>
> %%----- Power Flow Data -----%%
> %% system MVA base
> mpc.baseMVA = 100;
>
> %% bus data
> % bus_i type Pd Qd Gs Bs area Vm Va
> baseKV zone Vmax Vmin
> mpc.bus = [
> 1 3 80 0 0 0 1 1 0 345 1 1.1 0.9;
> 30 3 80 0 0 0 1 1 0 345 1 1.1 0.9;
> ];
>
> %% generator data
> % 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 0 0
> 0 0 0 0 0 0 0 0 0 0;
> 30 85 0 300 -300 1 100 1 270 0 0
> 200 -30 30 -15 15 0 0 0 0 0;
> ];
>
> %% branch data
> % fbus tbus r x b rateA rateB rateC ratio
> angle status angmin angmax
> mpc.branch = [
> 1 30 0 0.057 150 150 250 250 0 0 0
> -360 360;
> ];
>
> %%----- OPF Data -----%%
> %% generator cost data
> % 1 startup shutdown n x1 y1 ... xn yn
> % 2 startup shutdown n c(n-1) ... c0
> mpc.gencost = [
> 1 0 0 4 0 0 100 2500 200 5500 250
> 7250;
> 1 0 0 3 0 0 200 3000 300 5000 0 0;
> ];
>
> %%----- DC Line Data -----
> % fbus tbus status Pf Pt Qf Qt Vf Vt Pmin
> Pmax QminF QmaxF QminT QmaxT loss0 loss1
> mpc.dcline = [
> 30 1 1 10 8.9 0 0 1.01 1 0 100
> -100 10 -10 10 0 0;
> ];
>
> %% DC line cost data
> % 1 startup shutdown n x1 y1 ... xn yn
> % 2 startup shutdown n c(n-1) ... c0
> mpc.dclinecost = [
> 2 0 0 0 0 0 0 0 0 0 0 0 0 0;
> ];
>
> *M file - 3-bus case*
>
> %% MATPOWER Case Format : Version 2
> mpc.version = '2';
>
> %%----- Power Flow Data -----%%
> %% system MVA base
> mpc.baseMVA = 100;
>
> %% bus data
> % bus_i type Pd Qd Gs Bs area Vm Va
> baseKV zone Vmax Vmin
> mpc.bus = [
> 1 3 80 0 0 0 1 1 0 345 1 1.1 0.9;
> 2 2 80 0 0 0 1 1 0 345 1 1.1 0.9;
> 30 3 80 0 0 0 1 1 0 345 1 1.1 0.9;
> ];
>
> %% generator data
> % 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 0 0
> 0 0 0 0 0 0 0 0 0 0;
> 2 163 0 300 -300 1 100 1 300 0 0
> 200 -20 20 -10 10 0 0 0 0 0;
> 30 85 0 300 -300 1 100 1 270 0 0
> 200 -30 30 -15 15 0 0 0 0 0;
> ];
>
> %% branch data
> % fbus tbus r x b rateA rateB rateC ratio
> angle status angmin angmax
> mpc.branch = [
> 1 2 0 0.057 150 150 250 250 0 0 1
> -360 360;
> 1 30 0.017 0.092 0.158 150 250 250 0 0
> 0 -360 360;
> 30 2 0.039 0.17 0.358 150 150 150 0 0
> 0 -360 360;
> ];
>
> %%----- OPF Data -----%%
> %% generator cost data
> % 1 startup shutdown n x1 y1 ... xn yn
> % 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;
> ];
>
> %%----- DC Line Data -----
> % fbus tbus status Pf Pt Qf Qt Vf Vt Pmin
> Pmax QminF QmaxF QminT QmaxT loss0 loss1
> mpc.dcline = [
> 30 1 1 10 8.9 0 0 1.01 1 0 200
> -100 100 -100 100 0 0;
> ];
>
> %% DC line cost data
> % 1 startup shutdown n x1 y1 ... xn yn
> % 2 startup shutdown n c(n-1) ... c0
> mpc.dclinecost = [
> 2 0 0 0 0 0 0 0 0 0 0 0 0 0;
> ];
>
> On Thu, Jul 9, 2015 at 6:26 PM, Ray Zimmerman <[email protected]> wrote:
>
>> I can’t really comment on the Python port, but can you check the same
>> cases using the latest MATPOWER? Does MATPOWER give the same results? If
>> you don’t have access to Matlab, you can always run MATPOWER in GNU
>> Octave <http://www.gnu.org/software/octave/>, a free-open source Matlab
>> alternative.
>>
>> Ray
>>
>>
>>
>> On Jul 8, 2015, at 4:34 AM, João Gorenstein Dedecca <[email protected]>
>> wrote:
>>
>> Dear all,
>> I am implementing a DC OPF with DC lines (using PYPOWER python port).
>> In the network some buses may be connected only through DC lines, and
>> these I define as slack buses.
>> I am finding these issues:
>>
>> 1 - For a 2-bus system where one is dc-connected, creation of the sparse
>> Bf matrix fails ("cannot infer dimensions from zero sized index arrays")
>> 2 - For a 3-bus system where one is dc-connected, the add_constraints
>> fail (3-buses with 2 generators each, "number of columns of A does not
>> match number of variables, A is 3 x 10, nv = 11"
>> 3 - For a large system, the OPF finds a solution. However, if the
>> dc-isolates buses have enough generation capacity, there is no dc flow even
>> though it would reduce the objective function value.
>>
>> Can anyone comment on these?
>> Thanks!
>>
>> João
>>
>>
>>
>