power-grid-lib / pglib-opf

Benchmarks for the Optimal Power Flow Problem
Other
297 stars 84 forks source link

Error when solving case89_pegase__api and case240_pserc__api #25

Open cbingane opened 5 years ago

cbingane commented 5 years ago

Hello,

I got the following error when solving OPF for 2 test cases: case89_pegase__api and case240_pserc__api with the MATPOWER function runopf. It seems that there is a problem when generator bound Pmax is 0.

Error using makeAvl (line 52) makeAvl: either Qmin or Qmax must be equal to zero for each dispatchable load.

Error in opf_setup (line 171) [Avl, lvl, uvl] = makeAvl(baseMVA, gen);

Error in opf (line 198) om = opf_setup(mpc, mpopt);

Error in runopf (line 75) [r, success] = opf(casedata, mpopt);

Best regards,

Christian

ccoffrin commented 5 years ago

Thanks for the heads up! Did you test with v19.05? We recently fixed some generator bounds in that release.

cbingane commented 5 years ago

Yes, I did.

ccoffrin commented 5 years ago

Ok I think I see the source of the issue.

For example a generator from case89_pegase__api,

    4586     -363.8  0.0     254.4   -254.4  1.0     100.0   1   0   -727.6; % SYNC

This is a consumption-only generator, which also provides reactive support.

This is a valid input for the AC-OPF problem as stated by the specification of this repository and I can also imagine practical cases where this type of input would be generated. My inclination is to say this is an inconsistency between the AC-OPF formulation in this repository and the one defined in Matpower, and that Matpower's formulation should be extended to support this case. However, I am open to debate on this point.

cbingane commented 5 years ago

I also think there is an inconsistency with the ACOPF defined in MATPOWER. Maybe, there is a reason why they do not take into account this kind of generator in their formulation. Thanks for the clarification.

ccoffrin commented 5 years ago

@rdzman, what are your thoughts on modifying Matpower to support non-zero q-bounds on consumption-only generators?

rdzman commented 5 years ago

I don't think the issue is the Q bounds themselves. MATPOWER includes a constant power factor constraint for dispatchable loads. Currently a dispatchable load is represented as a consumption-only generator. That is, it is defined as a generator with negative Pmin and Pmax exactly equal to zero.

If I understand correctly, what you want is to be able to define such a generator without MATPOWER automatically assuming it is a dispatchable load and adding the constant power factor constraint. The easiest workaround would be to define Pmax to be some non-zero value very close to, but not equal to, zero (e.g. -1e-10).

Eventually, I plan to explicitly model dispatchable loads as separate elements, rather than using the "negative generator" hack. At that point, this should be a non-issue.

ccoffrin commented 5 years ago

That sounds good, thanks for your insights! We will use the -1e-10 work around until dispatchable loads become separate elements.