diff --git a/CHANGELOG.md b/CHANGELOG.md index 003a195..b975e70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ PowerModelsAnnex.jl Change Log ### Staged - nothing +### v0.7.0 +- Update to InfrastructureModels v0.6 and PowerModels v0.18 + ### v0.6.1 - Add variants of piecewise linear cost model formulations - Update to DataFrames v0.21 diff --git a/Project.toml b/Project.toml index 0aa99ca..25341c8 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "PowerModelsAnnex" uuid = "6e471128-d39d-5672-b02b-a742bd1b77ed" authors = ["Carleton Coffrin, et. al."] repo = "https://github.com/lanl-ansi/PowerModelsAnnex.jl" -version = "0.6.1" +version = "0.7.0" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" @@ -17,12 +17,12 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] DataFrames = "~0.19, ~0.20, ~0.21, ~0.22" -InfrastructureModels = "~0.5" -JuMP = "~0.19.1, ~0.20, ~0.21" -MathOptInterface = "~0.7, ~0.8, ~0.9" -Memento = "~0.10, ~0.11, ~0.12, ~0.13, ~1.0, ~1.1" +InfrastructureModels = "~0.6" +JuMP = "~0.21" +MathOptInterface = "~0.9" +Memento = "~1.0, ~1.1" Missings = "~0.3, ~0.4" -PowerModels = "~0.17.1" +PowerModels = "~0.18.0" PowerSystemsUnits = "~0.2" Unitful = "~0.7, ~0.8, ~0.10, ~0.11, ~0.12, ~0.13, ~0.14, ~0.15, ~0.16, ~0.17, ~0.18" julia = "^1" diff --git a/src/PowerModelsAnnex.jl b/src/PowerModelsAnnex.jl index a42852a..f27b224 100644 --- a/src/PowerModelsAnnex.jl +++ b/src/PowerModelsAnnex.jl @@ -6,7 +6,7 @@ import JuMP: @variable, @constraint, @NLexpression, @NLconstraint, @objective, @ import InfrastructureModels; const _IM = InfrastructureModels import PowerModels; const _PM = PowerModels -import PowerModels: ids, ref, var, con, sol +import PowerModels: ids, ref, var, con, sol, nw_id_default import Memento diff --git a/src/model/ac-opf.jl b/src/model/ac-opf.jl index 11bf9a7..197758a 100644 --- a/src/model/ac-opf.jl +++ b/src/model/ac-opf.jl @@ -46,7 +46,7 @@ PowerModels.standardize_cost_terms!(data, order=2) PowerModels.calc_thermal_limits!(data) # use build_ref to filter out inactive components -ref = PowerModels.build_ref(data)[:nw][0] +ref = PowerModels.build_ref(data)[:it][:pm][:nw][0] # note: ref contains all the relevant system parameters needed to build the OPF model # When we introduce constraints and variable bounds below, we use the parameters in ref. diff --git a/src/model/dc-opf.jl b/src/model/dc-opf.jl index 8843c4d..82adc09 100644 --- a/src/model/dc-opf.jl +++ b/src/model/dc-opf.jl @@ -46,7 +46,7 @@ PowerModels.standardize_cost_terms!(data, order=2) PowerModels.calc_thermal_limits!(data) # use build_ref to filter out inactive components -ref = PowerModels.build_ref(data)[:nw][0] +ref = PowerModels.build_ref(data)[:it][:pm][:nw][0] # Note: ref contains all the relevant system parameters needed to build the OPF model # When we introduce constraints and variable bounds below, we use the parameters in ref. diff --git a/src/model/opf.jl b/src/model/opf.jl index d67c751..5e752ac 100644 --- a/src/model/opf.jl +++ b/src/model/opf.jl @@ -9,7 +9,7 @@ function build_ac_opf(data::Dict{String,Any}, model=Model()) @assert !haskey(data, "conductors") PowerModels.standardize_cost_terms!(data, order=2) - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, va[i in keys(ref[:bus])]) @variable(model, ref[:bus][i]["vmin"] <= vm[i in keys(ref[:bus])] <= ref[:bus][i]["vmax"], start=1.0) @@ -143,7 +143,7 @@ function build_soc_opf(data::Dict{String,Any}, model=Model()) @assert !haskey(data, "conductors") PowerModels.standardize_cost_terms!(data, order=2) - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, ref[:bus][i]["vmin"]^2 <= w[i in keys(ref[:bus])] <= ref[:bus][i]["vmax"]^2, start=1.001) @@ -302,7 +302,7 @@ function build_qc_opf(data::Dict{String,Any}, model=Model()) @assert !haskey(data, "conductors") PowerModels.standardize_cost_terms!(data, order=2) - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] # voltage angle and magnitude @variable(model, va[i in keys(ref[:bus])]) @@ -639,7 +639,7 @@ function build_dc_opf(data::Dict{String,Any}, model=Model()) @assert !haskey(data, "conductors") PowerModels.standardize_cost_terms!(data, order=2) - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, va[i in keys(ref[:bus])]) diff --git a/src/model/pf.jl b/src/model/pf.jl index fe335cb..7ff9a21 100644 --- a/src/model/pf.jl +++ b/src/model/pf.jl @@ -8,7 +8,7 @@ function build_ac_pf(data::Dict{String,Any}, model=Model()) @assert !_IM.ismultinetwork(data) @assert !haskey(data, "conductors") - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, va[i in keys(ref[:bus])]) @variable(model, vm[i in keys(ref[:bus])], start=1.0) @@ -121,7 +121,7 @@ function build_soc_pf(data::Dict{String,Any}, model=Model()) @assert !_IM.ismultinetwork(data) @assert !haskey(data, "conductors") - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, w[i in keys(ref[:bus])] >= 0, start=1.001) @variable(model, wr[bp in keys(ref[:buspairs])], start=1.0) @@ -238,7 +238,7 @@ function build_dc_pf(data::Dict{String,Any}, model=Model()) @assert !_IM.ismultinetwork(data) @assert !haskey(data, "conductors") - ref = PowerModels.build_ref(data)[:nw][0] + ref = PowerModels.build_ref(data)[:it][_PM.pm_it_sym][:nw][nw_id_default] @variable(model, va[i in keys(ref[:bus])]) diff --git a/src/pglib/api.jl b/src/pglib/api.jl index 452f56b..eb7fa49 100644 --- a/src/pglib/api.jl +++ b/src/pglib/api.jl @@ -159,5 +159,5 @@ function constraint_power_balance_shunt_scaled(pm::_PM.AbstractACPModel, n::Int, @constraint(pm.model, sum(q[a] for a in bus_arcs) == sum(qg[g] for g in bus_gens) - qd + bs*vm^2) end -constraint_power_balance_shunt_scaled(pm::_PM.AbstractPowerModel, i::Int) = constraint_power_balance_shunt_scaled(pm, pm.cnw, i) +constraint_power_balance_shunt_scaled(pm::_PM.AbstractPowerModel, i::Int) = constraint_power_balance_shunt_scaled(pm, nw_id_default, i) diff --git a/src/pglib/shared.jl b/src/pglib/shared.jl index 797c728..a3ab43a 100644 --- a/src/pglib/shared.jl +++ b/src/pglib/shared.jl @@ -11,7 +11,7 @@ function constraint_thermal_limit_from(pm::_PM.AbstractPowerModel, n::Int, i::In _PM.constraint_thermal_limit_from(pm, n, f_idx, branch["rate_a"]*scale) end end -constraint_thermal_limit_from(pm::_PM.AbstractPowerModel, i::Int; scale = 1.0) = constraint_thermal_limit_from(pm, pm.cnw, i; scale=scale) +constraint_thermal_limit_from(pm::_PM.AbstractPowerModel, i::Int; scale = 1.0) = constraint_thermal_limit_from(pm, nw_id_default, i; scale=scale) "" function constraint_thermal_limit_to(pm::_PM.AbstractPowerModel, n::Int, i::Int; scale = 1.0) @@ -24,6 +24,6 @@ function constraint_thermal_limit_to(pm::_PM.AbstractPowerModel, n::Int, i::Int; _PM.constraint_thermal_limit_to(pm, n, t_idx, branch["rate_a"]*scale) end end -constraint_thermal_limit_to(pm::_PM.AbstractPowerModel, i::Int; scale = 1.0) = constraint_thermal_limit_to(pm, pm.cnw, i; scale=scale) +constraint_thermal_limit_to(pm::_PM.AbstractPowerModel, i::Int; scale = 1.0) = constraint_thermal_limit_to(pm, nw_id_default, i; scale=scale) diff --git a/src/piecewise-linear/delta.jl b/src/piecewise-linear/delta.jl index 7753b03..014f6a5 100644 --- a/src/piecewise-linear/delta.jl +++ b/src/piecewise-linear/delta.jl @@ -101,6 +101,6 @@ function objective_variable_pg_cost_delta(pm::_PM.AbstractPowerModel, report::Bo pg_cost[i] = points[1].cost + sum(cost_per_mw[i]*pg_cost_mw[i] for i in 2:length(points)) end - report && _IM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) + report && _PM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) end end diff --git a/src/piecewise-linear/lambda.jl b/src/piecewise-linear/lambda.jl index b9e1b76..4ede350 100644 --- a/src/piecewise-linear/lambda.jl +++ b/src/piecewise-linear/lambda.jl @@ -86,7 +86,7 @@ function objective_variable_pg_cost_lambda(pm::_PM.AbstractPowerModel, report::B pg_cost[i] = pg_cost_expr end - report && _IM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) + report && _PM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) end end diff --git a/src/piecewise-linear/phi.jl b/src/piecewise-linear/phi.jl index a7d0499..f749589 100644 --- a/src/piecewise-linear/phi.jl +++ b/src/piecewise-linear/phi.jl @@ -107,6 +107,6 @@ function objective_variable_pg_cost_phi(pm::_PM.AbstractPowerModel, report::Bool end end - report && _IM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) + report && _PM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) end end diff --git a/src/piecewise-linear/psi.jl b/src/piecewise-linear/psi.jl index b05b10b..5c7bfd2 100644 --- a/src/piecewise-linear/psi.jl +++ b/src/piecewise-linear/psi.jl @@ -104,7 +104,7 @@ function objective_variable_pg_cost_psi(pm::_PM.AbstractPowerModel, report::Bool lower_bound = pg_cost_min[i], upper_bound = pg_cost_max[i] ) - report && _IM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) + report && _PM.sol_component_value(pm, n, :gen, :pg_cost, ids(pm, n, :gen), pg_cost) # gen pwl cost for (i, gen) in nw_ref[:gen]