Giter VIP home page Giter VIP logo

powermodelsmld.jl's Introduction

Package Deprecation

As of February 2020, the PowerModelsMLD package has been deprecated and is not longer be maintained. Its functionality has been moved to the more general PowerModelsRestoration package. At the time of migration (i.e. PowerModels v0.14 and PowerModelsRestoration v0.1) migrating from PowerModelsMLD to PowerModelsRestoration simply requires updating the name of the package.

PowerModelsMLD.jl

Dev: Build Status codecov

A PowerModelsMLD provides extensions to PowerModels for solving the Maximum Load Delivery (MLD) problem. The MLD problem provides a reliable numerical method for solving challenging N-k damage scenarios, such as those that arise in the analysis of extreme events.

Core Problem Specifications

  • Maximum Load Delivery with Discrete Variables (mld_uc)
  • Maximum Load Delivery with Continuous Variables (mld)

Core Network Formulations

  • AC (polar coordinates)
  • DC Approximation (polar coordinates)
  • SDP Relaxation (W-space)
  • SOC Relaxation (W-space)

Quick Start

The primary entry point of the PowerModelsMLD package is the PowerModelsMLD.run_ac_mld_uc function, which provides a scalable heuristic for solving the AC-MLD problem. The following example illustrates how to load a network, damage components and solve the AC-MLD problem.

using PowerModels; using PowerModelsMLD; using Ipopt
network_file = joinpath(dirname(pathof(PowerModels)), "../test/data/matpower/case5.m")
case = PowerModels.parse_file(network_file)

case["bus"]["2"]["bus_type"] = 4
case["gen"]["2"]["gen_status"] = 0
case["branch"]["7"]["br_status"] = 0

result = PowerModelsMLD.run_ac_mld_uc(case, with_optimizer(Ipopt.Optimizer))

The result data indicates that only 700 of the 1000 MWs can be delivered given the removal of bus 2, generator 2 and branch 7.

Citing PowerModelsMLD

If you find PowerModelsMLD useful in your work, we kindly request that you cite the following publication:

@article{8494809, 
  author={Carleton Coffrin and Russel Bent and Byron Tasseff and Kaarthik Sundar and Scott Backhaus}, 
  title={Relaxations of AC Maximal Load Delivery for Severe Contingency Analysis}, 
  journal={IEEE Transactions on Power Systems}, 
  volume={34}, number={2}, pages={1450-1458},
  month={March}, year={2019},
  doi={10.1109/TPWRS.2018.2876507}, ISSN={0885-8950}
}

Citation of the PowerModels framework is also encouraged when publishing works that use PowerModels extension packages.

License

This code is provided under a BSD license as part of the Multi-Infrastructure Control and Optimization Toolkit (MICOT) project, LA-CC-13-108.

powermodelsmld.jl's People

Contributors

ccoffrin avatar harshangrjn avatar noahrhodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

powermodelsmld.jl's Issues

storage variables in model are incorrect

Redundant variables are added to the problems.

    _PMs.variable_storage(pm)
    _PMs.variable_storage_indicator(pm, relax = true)
    _PMs.variable_storage_mi_on_off(pm)

Likely should be

    _PMs.variable_storage_indicator(pm, relax = true)
    _PMs.variable_storage_mi_on_off(pm)

`variable_active_storage_on_off` loops over wrong ref

There is a bug in variable_active_storage_on_off, the symbol :gen is used instead of :storage, and storage also has no pmax, so the upper and lower bounds will have to be determined some other way, like with this expression found in variable_active_storage

inj_lb, inj_ub = ref_calc_storage_injection_bounds(ref(pm, nw, :storage), ref(pm, nw, :bus), cnd)

This only works currently because there are also active generators in the test case. If for example generator 1 is deactivated, then the model creation will fail because key 1 won't exist.

CC @noahrhodes

typo in `wi` variable creation?

wi[bp in _PMs.ids(pm, nw, :buspairs)], base_name="$(nw)_$(cnd)_wi",

This line gives an error when I try working with multinetwork SOCWR formulations:

ERROR: An object of name wi is already attached to this model. If this is intended, consider using the anonymous construction syntax, e.g., x = @variable(model, [1:N], ...) where the name of the object does not appear inside the macro.

Why does this line start with wi[...]?

modeling power flow on disabled buses

I've been looking through MLD to try and understand how the bus on/off constraints are used. The code uses a z_voltage indicator to set bus voltage, but is this supposed to implicitly turn off the bus? Does it represent a bus being shorted to ground? What is this supposed to represent in the model? Is it representative of a damaged bus or does it help with network feasibility by expanding the allowed voltage ranges?

The code includes:

    variable_bus_voltage_indicator(pm, relax=true)
    variable_bus_voltage_on_off(pm)

To create a z_voltage variable to control whether the voltage on a bus should be set to zero. relaxed, is allows the voltage to vary from 0% to 100%.

constraint_bus_voltage_on_off(pm)

Sets the voltage using these variables.

Branch power flow is controlled by:

 _PMs.constraint_ohms_yt_from(pm, i)
 _PMs.constraint_ohms_yt_to(pm, i)

using the voltage value and branch conductance/sustenance. However, I don't see how having one end of a branch at v=0 prevents power flow into the branch. Doesn't it act as a ground?

"KeyError: Key 32 not found" in solution.jl

I tried to run the AC MLD on the ACTIVSg200 system. after setting the bus_type of some buses to 4. The program seems to be running fine until exporting the solution. The complete error message is attached below. The problem seems to be at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\solution.jl:249.

Is there a fix or workaround? Thanks!

Number of objective function evaluations             = 47
Number of objective gradient evaluations             = 43
Number of equality constraint evaluations            = 47
Number of inequality constraint evaluations          = 47
Number of equality constraint Jacobian evaluations   = 43
Number of inequality constraint Jacobian evaluations = 43
Number of Lagrangian Hessian evaluations             = 42
Total CPU secs in IPOPT (w/o function evaluations)   =      2.908
Total CPU secs in NLP function evaluations           =      0.739

EXIT: Optimal Solution Found.
[warn | PowerModels]: the given optimizer does not provide the SolveTime() attribute, falling back on @timed.  This is not a rigorous timing value.
ERROR: LoadError: KeyError: key 32 not found
Stacktrace:
 [1] getindex at .\dict.jl:478 [inlined]
 [2] lookup_index at C:\Users\username\.julia\packages\JuMP\ibcEh\src\Containers\DenseAxisArray.jl:136 [inlined]
 [3] _to_index_tuple at C:\Users\username\.julia\packages\JuMP\ibcEh\src\Containers\DenseAxisArray.jl:145 [inlined]
 [4] to_index at C:\Users\username\.julia\packages\JuMP\ibcEh\src\Containers\DenseAxisArray.jl:163 [inlined]
 [5] getindex(::JuMP.Containers.DenseAxisArray{JuMP.VariableRef,1,Tuple{Base.KeySet{Int64,Dict{Int64,Any}}},Tuple{Dict{Int64,Int64}}}, ::Int64) at C:\Users\username\.julia\packages\JuMP\ibcEh\src\Containers\DenseAxisArray.jl:177
 [6] #add_setpoint!#502(::String, ::getfield(PowerModels, Symbol("##507#514")), ::getfield(PowerModels, Symbol("##508#515")), ::getfield(PowerModels, Symbol("##509#516")), ::Dict{String,Any}, ::Bool, ::String, ::Int64, ::typeof(add_setpoint!), ::Dict{String,Any}, ::SOCWRPowerModel, ::String, ::String, ::Symbol) at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\solution.jl:249
 [7] (::getfield(PowerModels, Symbol("#kw##add_setpoint!")))(::NamedTuple{(:status_name,),Tuple{String}}, ::typeof(add_setpoint!), ::Dict{String,Any}, ::SOCWRPowerModel, ::String, ::String, ::Symbol) at .\none:0
 [8] add_setpoint_generator_power! at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\solution.jl:117 [inlined]
 [9] solution_mld(::SOCWRPowerModel, ::Dict{String,Any}) at C:\Users\username\.julia\packages\PowerModelsMLD\lLm9c\src\prob\mld.jl:108
 [10] #build_result#469(::typeof(solution_mld), ::Function, ::SOCWRPowerModel, ::Float64) at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\solution.jl:33
 [11] (::getfield(PowerModels, Symbol("#kw##build_result")))(::NamedTuple{(:solution_builder,),Tuple{typeof(solution_mld)}}, ::typeof(build_result), ::SOCWRPowerModel, ::Float64) at .\none:0
 [12] #optimize_model!#199(::JuMP.OptimizerFactory, ::Function, ::Function, ::SOCWRPowerModel) at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\base.jl:222
 [13] (::getfield(PowerModels, Symbol("#kw##optimize_model!")))(::NamedTuple{(:optimizer, :solution_builder),Tuple{JuMP.OptimizerFactory,typeof(solution_mld)}}, ::typeof(optimize_model!), ::SOCWRPowerModel) at .\none:0
 [14] #run_model#196(::Array{Any,1}, ::Function, ::Base.Iterators.Pairs{Symbol,Dict{String,Any},Tuple{Symbol},NamedTuple{(:setting,),Tuple{Dict{String,Any}}}}, ::Function, ::Dict{String,Any}, ::Type, ::JuMP.OptimizerFactory, ::Function) at C:\Users\username\.julia\packages\PowerModels\w29A2\src\core\base.jl:151
 [15] (::getfield(PowerModels, Symbol("#kw##run_model")))(::NamedTuple{(:solution_builder, :setting),Tuple{typeof(solution_mld),Dict{String,Any}}}, ::typeof(run_model), ::Dict{String,Any}, ::Type, ::JuMP.OptimizerFactory, ::Function) at .\none:0
 [16] #run_mld#119(::Base.Iterators.Pairs{Symbol,Dict{String,Any},Tuple{Symbol},NamedTuple{(:setting,),Tuple{Dict{String,Any}}}}, ::Function, ::Dict{String,Any}, ::Type, ::JuMP.OptimizerFactory) at C:\Users\username\.julia\packages\PowerModelsMLD\lLm9c\src\prob\mld.jl:3
 [17] (::getfield(PowerModelsMLD, Symbol("#kw##run_mld")))(::NamedTuple{(:setting,),Tuple{Dict{String,Any}}}, ::typeof(run_mld), ::Dict{String,Any}, ::Type, ::JuMP.OptimizerFactory) at .\none:0
 [18] #run_ac_mld_uc#143(::Dict{String,Any}, ::Dict{String,Any}, ::Float64, ::Function, ::Dict{String,Any}, ::JuMP.OptimizerFactory) at C:\Users\username\.julia\packages\PowerModelsMLD\lLm9c\src\util\ac-mld-uc.jl:16
 [19] run_ac_mld_uc(::Dict{String,Any}, ::JuMP.OptimizerFactory) at C:\Users\username\.julia\packages\PowerModelsMLD\lLm9c\src\util\ac-mld-uc.jl:4
 [20] top-level scope at none:0
 [21] include_string(::Module, ::String, ::String) at .\loading.jl:1008
 [22] (::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String})() at c:\Users\username\.vscode\extensions\julialang.language-julia-0.13.1\scripts\terminalserver\terminalserver.jl:153
 [23] withpath(::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String}, ::String) at c:\Users\username\.vscode\extensions\julialang.language-julia-0.13.1\scripts\terminalserver\repl.jl:62
 [24] (::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String})() at c:\Users\username\.vscode\extensions\julialang.language-julia-0.13.1\scripts\terminalserver\terminalserver.jl:152
 [25] hideprompt(::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String}) at c:\Users\username\.vscode\extensions\julialang.language-julia-0.13.1\scripts\terminalserver\repl.jl:28
 [26] macro expansion at c:\Users\username\.vscode\extensions\julialang.language-julia-0.13.1\scripts\terminalserver\terminalserver.jl:148 [inlined]
 [27] (::getfield(Main._vscodeserver, Symbol("##7#10")))() at .\task.jl:259
in expression starting at c:\Users\username\Code_Data\AGM_TDC_Restoration\tdc-topology\postHurricaneMLD.jl:30

Empty Network

Add a test for a case where all components get removed form the network.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.