Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ZIP load #400

Closed
apigott opened this issue Sep 14, 2022 · 4 comments · Fixed by #401
Closed

[BUG] ZIP load #400

apigott opened this issue Sep 14, 2022 · 4 comments · Fixed by #401

Comments

@apigott
Copy link

apigott commented Sep 14, 2022

Describe the bug
PowerModelsDistribution doesn't seem to solve models other than POWER models.
With ZIP models PMD errors out that ZIP is an unrecognized model type.
With constant current and constant impedance (CURRENT, IMPEDANCE) models JuMP returns an invalid NLP model with an invalid number of constraints.

Minimum Viable Example
Here is a MWE with a ZIP model, though errors occur by replacing the load["model"] with CURRENT or IMPEDANCE.

data_eng
 = PMD.parse_file(
	"$NOTEBOOK_DIR/resources/lvtestcase_notrans.dss",
	transformations=[remove_all_bounds!]
);
PMD.reduce_lines!(data_eng);
data_eng["settings"]["sbase_default"] = 1.0*1E3/data_eng["settings"]["power_scale_factor"];
PMD.add_bus_absolute_vbounds!(
	data_eng,
	phase_lb_pu=0.9,
	phase_ub_pu=1.1,
	neutral_ub_pu=0.1
);
for (_,load) in data_eng["load"]
  load["model"] = ZIP
  load["pd_cz"] = 0.2
  load["pd_ci"] = 0.3
  load["pd_cp"] = 0.5
  load["qd_cz"] = 0.2
  load["qd_ci"] = 0.3
  load["qd_cp"] = 0.5
  load["vm_nom"] = 0.22
end
res = solve_mc_opf(data_eng, ACPUPowerModel, Ipopt.Optimizer, setting=Dict("output"=>Dict("duals"=>true)));

Expected behavior
I expect solve_mc_opf to return a result dictionary with delivered power varying according to the delivered voltage at each load bus.

Error Logs

load model 'ZIP' on 'load.load8' unrecongized

    _load_expmodel_params(::Dict{String, Any}, ::Dict{String, Any})@data.jl:538
    var"#constraint_mc_load_power#2538"(::Int64, ::Bool, ::typeof(PowerModelsDistribution.constraint_mc_load_power), ::PowerModelsDistribution.ACPUPowerModel, ::Int64)@constraint_template.jl:787
    build_mn_mc_opf(::PowerModelsDistribution.ACPUPowerModel)@opf.jl:409
    var"#instantiate_model#23"(::Vector{Function}, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(InfrastructureModels.instantiate_model), ::Dict{String, Any}, ::Type, ::typeof(PowerModelsDistribution.build_mn_mc_opf), ::typeof(PowerModelsDistribution.ref_add_core!), ::Set{String}, ::Symbol)@base.jl:370
    var"#instantiate_mc_model#3330"(::Vector{Function}, ::Bool, ::Set{String}, ::Vector{Function}, ::Dict{String, Vector{String}}, ::Vector{Function}, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(PowerModelsDistribution.instantiate_mc_model), ::Dict{String, Any}, ::Type, ::typeof(PowerModelsDistribution.build_mn_mc_opf))@common.jl:119
    top-level scope@[Local: 1](http://localhost:1234/edit?id=7883f926-3443-11ed-1dc1-89d2327ef389#)[inlined]

with load model CURRENT

This is Ipopt version 3.13.4, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient (see Ipopt documentation).

Number of nonzeros in equality constraint Jacobian...:    20461
Number of nonzeros in inequality constraint Jacobian.:     1404
Number of nonzeros in Lagrangian Hessian.............:    54094

Total number of variables............................:     2135
                     variables with only lower bounds:        0
                variables with lower and upper bounds:      351
                     variables with only upper bounds:        0
Total number of equality constraints.................:     2115
Total number of inequality constraints...............:      702
        inequality constraints with only lower bounds:      351
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:      351

The equality constraints contain an invalid number

Number of Iterations....: 0

Number of objective function evaluations             = 0
Number of objective gradient evaluations             = 1
Number of equality constraint evaluations            = 1
Number of inequality constraint evaluations          = 1
Number of equality constraint Jacobian evaluations   = 1
Number of inequality constraint Jacobian evaluations = 1
Number of Lagrangian Hessian evaluations             = 0
Total CPU secs in IPOPT (w/o function evaluations)   =      0.027
Total CPU secs in NLP function evaluations           =      0.001

EXIT: Invalid number in NLP function or derivative detected.

System Information (please complete the following information):

  • OS: Linux Fedora 36
  • PMD Version [e.g. 0.14.4]

Additional context
Add any other context about the problem here.

@MartaVanin
Copy link
Contributor

yes, the code for ZIP load models seems to be missing, even though the manual suggests they are supported.
But the other issues I cannot reproduce. With PMD v14.4 and Ipopt 3.14.4 running with MUMPS 5.4.1 and Ipopt.jl v1.1.0 IMPEDANCE and CURRENT models converge fine (on windows). I believe it's ipopt not jump that throws that error, so maybe updating it does the trick, if you have an older version.

@apigott
Copy link
Author

apigott commented Sep 15, 2022

Thanks @MartaVanin, the Ipopt upgrade worked for the CURRENT and IMPEDANCE models. I'll leave this open for now since the ZIP model is unresolved unless someone from the PMD wants me to do otherwise.

@hei06j
Copy link
Contributor

hei06j commented Sep 16, 2022

A workaround would be to just divide the ZIP load into separate loads and get the results. But the proper implementation is missing as identified.

@hei06j
Copy link
Contributor

hei06j commented Sep 20, 2022

@apigott here is a piece of code showing the workaround I mentioned. I added a few validation plots as well.

https://gist.github.com/hei06j/b1bdd1a24e6694568c9022eed7b5fdf2

@pseudocubic pseudocubic linked a pull request Oct 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants