Dear all,
After reviewing the code I believe this is caused by the sparse matrix
creation command for the Bf matrix.
In the case in question the Bf matrix must have an empty last row. But
since no element of this row is provided to the sparse command it creates a
Bf matrix with a missing row.
This can be fixed by changing the line in makeBdc.m from:

Bf = sparse(i, [f; t], [b; -b]);    % = spdiags(b, 0, nl, nl) * Cft;

to

Bf = sparse(i, [f; t], [b; -b], nl, nb);    % = spdiags(b, 0, nl, nl) * Cft;

Best regards,

João Gorenstein Dedecca

On Fri, Jul 31, 2015 at 9:07 AM, João Gorenstein Dedecca <jdede...@gmail.com
> wrote:

> Dear Matpower community,
> For a DCOPF with a dc line a simple change in the bus order causes an
> error in matpower 5.1.
> Attached are the .m files for a 4-bus system with 2 x AC and 1 x DC lines.
> Presenting the DC bus in the branch matrix before last results in the
> error below.
>
>
> 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 4 x 6, nv = 7
>
> Error in opf_setup (line 212)
>   om = add_constraints(om, 'Pmis', Amis, bmis, bmis, {'Va', 'Pg'}); %% nb
>
>
> Has anyone faced this before?
> Thanks,
>
> João Gorenstein Dedecca
>

Reply via email to