Skip to content

Commit

Permalink
Breaking Updates for v0.20 Release (#900)
Browse files Browse the repository at this point in the history
* add z i load conversion (#792)
* update case5_pwlc to better test constant power functions
* updates for revised test case and sdp solver variation
* Objective Function Building Rewrite (#836)
* tests passing, closes #778, closes #829
* add test for mixed mode cost data
* note to change log
* drop support for jump v0.22, v0.23, update to scs v2
* drop old json versions
* Update to use two sided constraints (#838)
* closes #819
* drop support for run functions, closes #878
* drop support for multiconductor, closes #872
* update modeling of current limit constraints, closes #625
* remove conductors logic from data processing functions
* prep for release v0.20.0

---------

Co-authored-by: Jose Daniel Lara <[email protected]>
  • Loading branch information
ccoffrin and jd-lara authored Jan 2, 2024
1 parent 010b6ee commit bf46c28
Show file tree
Hide file tree
Showing 49 changed files with 1,065 additions and 1,579 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ PowerModels.jl Change Log
### Staged
- nothing

### v0.20.0
- Add support for models with mixtures of PWL and polynomial cost functions (#829)
- Revised models to use two-sided constraints (#819) (breaking)
- Rewrite code for building objective functions (#778) (breaking)
- Made current limit modeling consistent with thermal limit modeling (#625) (breaking)
- Drop support for multiple conductors (#872) (breaking)
- Drop support for `run_*` functions (#878) (breaking)
- Drop support for JuMP v0.22 and v0.23 (breaking)
- Drop support for JSON v0.18, v0.19, v0.20 (breaking)

### v0.19.10
- Add support for ACP and DCP formulation in OPF with PST variables (#543,#875)
- Fix implementation of `calc_theta_delta_bounds` when conductor parameter is used (#870)
Expand Down Expand Up @@ -33,6 +43,13 @@ PowerModels.jl Change Log
- Add support for JuMP v1.0
- Update `correct_cost_functions!` to support PWL costs with a constant power value

### v0.20.0
- Added conversion of impedance and current loads from PSSE raw files into constant power loads (#792)
- Made case name recovery optional in PTI parsing

### Staged
- nothing

### v0.19.4
- Fix `sol_component_value_edge` implementation and usage (#811)

Expand Down
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "PowerModels"
uuid = "c36e90e8-916a-50a6-bd94-075b64ef4655"
authors = ["Carleton Coffrin"]
repo = "https://github.com/lanl-ansi/PowerModels.jl"
version = "0.19.10"
version = "0.20.0"

[deps]
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
Expand All @@ -14,12 +14,12 @@ NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
HiGHS = "~0.3, ~1"
HiGHS = "~1"
InfrastructureModels = "~0.6, ~0.7"
Ipopt = "~0.8, ~0.9, ~1"
JSON = "~0.18, ~0.19, ~0.20, ~0.21"
JuMP = "~0.22, ~0.23, 1"
Juniper = "~0.8, ~0.9"
Ipopt = "~1"
JSON = "~0.21"
JuMP = "1"
Juniper = "~0.9"
Memento = "~1.0, ~1.1, ~1.2, ~1.3, ~1.4"
NLsolve = "4.0"
SCS = "~0.9, ~1.0, ~2.0"
Expand Down
109 changes: 0 additions & 109 deletions src/PowerModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,115 +85,6 @@ include("prob/test.jl")
include("util/obbt.jl")
include("util/flow_limit_cuts.jl")


# function deprecation warnings
# can be removed in a breaking release after 09/01/2022
function run_model(args...; kwargs...)
@warn("the function run_model has been replaced with solve_model", maxlog=1)
solve_model(args...; kwargs...)
end

function run_pf(args...; kwargs...)
@warn("the function run_pf has been replaced with solve_pf", maxlog=1)
solve_pf(args...; kwargs...)
end
function run_ac_pf(args...; kwargs...)
@warn("the function run_ac_pf has been replaced with solve_ac_pf", maxlog=1)
solve_ac_pf(args...; kwargs...)
end
function run_dc_pf(args...; kwargs...)
@warn("the function run_dc_pf has been replaced with solve_dc_pf", maxlog=1)
solve_dc_pf(args...; kwargs...)
end
function run_pf_bf(args...; kwargs...)
@warn("the function run_pf_bf has been replaced with solve_pf_bf", maxlog=1)
solve_pf_bf(args...; kwargs...)
end
function run_pf_iv(args...; kwargs...)
@warn("the function run_pf_iv has been replaced with solve_pf_iv", maxlog=1)
solve_pf_iv(args...; kwargs...)
end


function run_opf(args...; kwargs...)
@warn("the function run_opf has been replaced with solve_opf", maxlog=1)
solve_opf(args...; kwargs...)
end
function run_ac_opf(args...; kwargs...)
@warn("the function run_ac_opf has been replaced with solve_ac_opf", maxlog=1)
solve_ac_opf(args...; kwargs...)
end
function run_dc_opf(args...; kwargs...)
@warn("the function run_dc_opf has been replaced with solve_dc_opf", maxlog=1)
solve_dc_opf(args...; kwargs...)
end

function run_mn_opf(args...; kwargs...)
@warn("the function run_mn_opf has been replaced with solve_mn_opf", maxlog=1)
solve_mn_opf(args...; kwargs...)
end
function run_mn_opf_strg(args...; kwargs...)
@warn("the function run_mn_opf_strg has been replaced with solve_mn_opf_strg", maxlog=1)
solve_mn_opf_strg(args...; kwargs...)
end
function run_opf_ptdf(args...; kwargs...)
@warn("the function run_opf_ptdf has been replaced with solve_opf_ptdf", maxlog=1)
solve_opf_ptdf(args...; kwargs...)
end

function run_opf_bf(args...; kwargs...)
@warn("the function run_opf_bf has been replaced with solve_opf_bf", maxlog=1)
solve_opf_bf(args...; kwargs...)
end
function run_mn_opf_bf_strg(args...; kwargs...)
@warn("the function run_mn_opf_bf_strg has been replaced with solve_mn_opf_bf_strg", maxlog=1)
solve_mn_opf_bf_strg(args...; kwargs...)
end
function run_opf_iv(args...; kwargs...)
@warn("the function run_opf_iv has been replaced with solve_opf_iv", maxlog=1)
solve_opf_iv(args...; kwargs...)
end

function run_opb(args...; kwargs...)
@warn("the function run_opb has been replaced with solve_opb", maxlog=1)
solve_opb(args...; kwargs...)
end
function run_nfa_opb(args...; kwargs...)
@warn("the function run_nfa_opb has been replaced with solve_nfa_opb", maxlog=1)
solve_nfa_opb(args...; kwargs...)
end

function run_ots(args...; kwargs...)
@warn("the function run_ots has been replaced with solve_ots", maxlog=1)
solve_ots(args...; kwargs...)
end
function run_tnep(args...; kwargs...)
@warn("the function run_tnep has been replaced with solve_tnep", maxlog=1)
solve_tnep(args...; kwargs...)
end

function run_opf_branch_power_cuts(args...; kwargs...)
@warn("the function run_opf_branch_power_cuts has been replaced with solve_opf_branch_power_cuts", maxlog=1)
solve_opf_branch_power_cuts(args...; kwargs...)
end
function run_opf_branch_power_cuts!(args...; kwargs...)
@warn("the function run_opf_branch_power_cuts! has been replaced with solve_opf_branch_power_cuts!", maxlog=1)
solve_opf_branch_power_cuts!(args...; kwargs...)
end
function run_opf_ptdf_branch_power_cuts(args...; kwargs...)
@warn("the function run_opf_ptdf_branch_power_cuts has been replaced with solve_opf_ptdf_branch_power_cuts", maxlog=1)
solve_opf_ptdf_branch_power_cuts(args...; kwargs...)
end
function run_opf_ptdf_branch_power_cuts!(args...; kwargs...)
@warn("the function run_opf_ptdf_branch_power_cuts! has been replaced with solve_opf_ptdf_branch_power_cuts!", maxlog=1)
solve_opf_ptdf_branch_power_cuts!(args...; kwargs...)
end
function run_obbt_opf!(args...; kwargs...)
@warn("the function run_obbt_opf! has been replaced with solve_obbt_opf!", maxlog=1)
solve_obbt_opf!(args...; kwargs...)
end


# this must come last to support automated export
include("core/export.jl")

Expand Down
19 changes: 2 additions & 17 deletions src/core/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ _IM.@def pm_fields begin
end


""
ismulticonductor(pm::AbstractPowerModel, nw::Int) = haskey(pm.ref[:it][pm_it_sym][:nw][nw], :conductors)
ismulticonductor(pm::AbstractPowerModel; nw::Int=nw_id_default) = haskey(pm.ref[:it][pm_it_sym][:nw][nw], :conductors)

""
conductor_ids(pm::AbstractPowerModel, nw::Int) = pm.ref[:it][pm_it_sym][:nw][nw][:conductor_ids]
conductor_ids(pm::AbstractPowerModel; nw::Int=nw_id_default) = pm.ref[:it][pm_it_sym][:nw][nw][:conductor_ids]


""
function solve_model(file::String, model_type::Type, optimizer, build_method; kwargs...)
data = PowerModels.parse_file(file)
Expand All @@ -30,20 +21,14 @@ end
""
function solve_model(data::Dict{String,<:Any}, model_type::Type, optimizer, build_method;
ref_extensions=[], solution_processors=[], relax_integrality=false,
multinetwork=false, multiconductor=false, kwargs...)
multinetwork=false, kwargs...)

if multinetwork != _IM.ismultinetwork(data)
model_requirement = multinetwork ? "multi-network" : "single-network"
data_type = _IM.ismultinetwork(data) ? "multi-network" : "single-network"
Memento.error(_LOGGER, "attempted to build a $(model_requirement) model with $(data_type) data")
end

if multiconductor != ismulticonductor(data)
model_requirement = multiconductor ? "multi-conductor" : "single-conductor"
data_type = ismulticonductor(data) ? "multi-conductor" : "single-conductor"
Memento.error(_LOGGER, "attempted to build a $(model_requirement) model with $(data_type) data")
end

start_time = time()
pm = instantiate_model(data, model_type, build_method; ref_extensions=ref_extensions, kwargs...)
Memento.debug(_LOGGER, "pm model build time: $(time() - start_time)")
Expand Down Expand Up @@ -199,7 +184,7 @@ function ref_add_core!(ref::Dict{Symbol,Any})

### aggregate info for pairs of connected buses ###
if !haskey(nw_ref, :buspairs)
nw_ref[:buspairs] = calc_buspair_parameters(nw_ref[:bus], nw_ref[:branch], nw_ref[:conductor_ids], haskey(nw_ref, :conductors))
nw_ref[:buspairs] = calc_buspair_parameters(nw_ref[:bus], nw_ref[:branch])
end
end
end
Expand Down
20 changes: 15 additions & 5 deletions src/core/constraint_template.jl
Original file line number Diff line number Diff line change
Expand Up @@ -697,17 +697,27 @@ end

### Branch - Current Limit Constraints ###

"""
Adds a current magnitude limit constraint for the desired branch to the PowerModel.
"""
function constraint_current_limit(pm::AbstractPowerModel, i::Int; nw::Int=nw_id_default)
""
function constraint_current_limit_from(pm::AbstractPowerModel, i::Int; nw::Int=nw_id_default)
branch = ref(pm, nw, :branch, i)
f_bus = branch["f_bus"]
t_bus = branch["t_bus"]
f_idx = (i, f_bus, t_bus)

if haskey(branch, "c_rating_a")
constraint_current_limit(pm, nw, f_idx, branch["c_rating_a"])
constraint_current_limit_from(pm, nw, f_idx, branch["c_rating_a"])
end
end

""
function constraint_current_limit_to(pm::AbstractPowerModel, i::Int; nw::Int=nw_id_default)
branch = ref(pm, nw, :branch, i)
f_bus = branch["f_bus"]
t_bus = branch["t_bus"]
t_idx = (i, t_bus, f_bus)

if haskey(branch, "c_rating_a")
constraint_current_limit_to(pm, nw, t_idx, branch["c_rating_a"])
end
end

Expand Down
Loading

0 comments on commit bf46c28

Please sign in to comment.