Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PowerModels.jl Change Log
=========================

### Staged
- nothing
- Fix `sol_component_value_edge` implementation and usage (#811)

### v0.19.3
- Add support for JuMP v0.23
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ JuMP = "~0.22, ~0.23"
Juniper = "~0.8, ~0.9"
Memento = "~1.0, ~1.1, ~1.2, ~1.3"
NLsolve = "4.0"
SCS = "~0.9, ~1"
SCS = "~0.9, ~1.0"
julia = "1.6"

[extras]
Expand Down
2 changes: 1 addition & 1 deletion src/core/solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ end

"PowerModels wrapper for the InfrastructureModels `sol_component_value_edge` function."
function sol_component_value_edge(aim::AbstractPowerModel, n::Int, comp_name::Symbol, field_name_fr::Symbol, field_name_to::Symbol, comp_ids_fr, comp_ids_to, variables)
return _IM.sol_component_value(aim, pm_it_sym, n, comp_name, field_name_fr, field_name_to, comp_ids_fr, comp_ids_to, variables)
return _IM.sol_component_value_edge(aim, pm_it_sym, n, comp_name, field_name_fr, field_name_to, comp_ids_fr, comp_ids_to, variables)
end
24 changes: 12 additions & 12 deletions src/core/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function variable_branch_power_real(pm::AbstractPowerModel; nw::Int=nw_id_defaul
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p)
report && sol_component_value_edge(pm, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p)
end

"variable: `q[l,i,j]` for `(l,i,j)` in `arcs`"
Expand Down Expand Up @@ -470,7 +470,7 @@ function variable_branch_power_imaginary(pm::AbstractPowerModel; nw::Int=nw_id_d
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :qf, :qt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), q)
report && sol_component_value_edge(pm, nw, :branch, :qf, :qt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), q)
end

function variable_branch_transform(pm::AbstractPolarModels; kwargs...)
Expand Down Expand Up @@ -546,7 +546,7 @@ function variable_branch_current_real(pm::AbstractPowerModel; nw::Int=nw_id_defa
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :cr_fr, :cr_to, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), cr)
report && sol_component_value_edge(pm, nw, :branch, :cr_fr, :cr_to, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), cr)
end


Expand Down Expand Up @@ -583,7 +583,7 @@ function variable_branch_current_imaginary(pm::AbstractPowerModel; nw::Int=nw_id
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :ci_fr, :ci_to, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), ci)
report && sol_component_value_edge(pm, nw, :branch, :ci_fr, :ci_to, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), ci)
end


Expand Down Expand Up @@ -704,7 +704,7 @@ function variable_dcline_power_real(pm::AbstractPowerModel; nw::Int=nw_id_defaul
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :pf, :pt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), p_dc)
report && sol_component_value_edge(pm, nw, :dcline, :pf, :pt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), p_dc)
end

"variable: `q_dc[l,i,j]` for `(l,i,j)` in `arcs_dc`"
Expand Down Expand Up @@ -738,7 +738,7 @@ function variable_dcline_power_imaginary(pm::AbstractPowerModel; nw::Int=nw_id_d
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :qf, :qt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), q_dc)
report && sol_component_value_edge(pm, nw, :dcline, :qf, :qt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), q_dc)
end

"variable: `crdc[j]` for `j` in `dcline`"
Expand Down Expand Up @@ -768,7 +768,7 @@ function variable_dcline_current_real(pm::AbstractPowerModel; nw::Int=nw_id_defa
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :crdc_fr, :crdc_to, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), crdc)
report && sol_component_value_edge(pm, nw, :dcline, :crdc_fr, :crdc_to, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), crdc)
end

"variable: `cidc[j]` for `j` in `dcline`"
Expand Down Expand Up @@ -798,7 +798,7 @@ function variable_dcline_current_imaginary(pm::AbstractPowerModel; nw::Int=nw_id
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :cidc_fr, :cidc_to, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), cidc)
report && sol_component_value_edge(pm, nw, :dcline, :cidc_fr, :cidc_to, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), cidc)
end


Expand Down Expand Up @@ -856,7 +856,7 @@ function variable_switch_power_real(pm::AbstractPowerModel; nw::Int=nw_id_defaul
psw_expr = merge(psw_expr, Dict( (l,j,i) => -1.0*psw[(l,i,j)] for (l,i,j) in ref(pm, nw, :arcs_from_sw)))
var(pm, nw)[:psw] = psw_expr

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :switch, :psw_fr, :psw_to, ref(pm, nw, :arcs_from_sw), ref(pm, nw, :arcs_to_sw), psw_expr)
report && sol_component_value_edge(pm, nw, :switch, :psw_fr, :psw_to, ref(pm, nw, :arcs_from_sw), ref(pm, nw, :arcs_to_sw), psw_expr)
end


Expand Down Expand Up @@ -886,7 +886,7 @@ function variable_switch_power_imaginary(pm::AbstractPowerModel; nw::Int=nw_id_d
qsw_expr = merge(qsw_expr, Dict( (l,j,i) => -1.0*qsw[(l,i,j)] for (l,i,j) in ref(pm, nw, :arcs_from_sw)))
var(pm, nw)[:qsw] = qsw_expr

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :switch, :qsw_fr, :qsw_to, ref(pm, nw, :arcs_from_sw), ref(pm, nw, :arcs_to_sw), qsw_expr)
report && sol_component_value_edge(pm, nw, :switch, :qsw_fr, :qsw_to, ref(pm, nw, :arcs_from_sw), ref(pm, nw, :arcs_to_sw), qsw_expr)
end


Expand Down Expand Up @@ -1201,7 +1201,7 @@ function variable_ne_branch_power_real(pm::AbstractPowerModel; nw::Int=nw_id_def
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :ne_branch, :pf, :pt, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), p_ne)
report && sol_component_value_edge(pm, nw, :ne_branch, :pf, :pt, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), p_ne)
end

"variable: `-ne_branch[l][\"rate_a\"] <= q_ne[l,i,j] <= ne_branch[l][\"rate_a\"]` for `(l,i,j)` in `ne_arcs`"
Expand All @@ -1225,7 +1225,7 @@ function variable_ne_branch_power_imaginary(pm::AbstractPowerModel; nw::Int=nw_i
end
end

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :ne_branch, :qf, :qt, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), q_ne)
report && sol_component_value_edge(pm, nw, :ne_branch, :qf, :qt, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), q_ne)
end

"variable: `0 <= z_branch[l] <= 1` for `l` in `branch`es"
Expand Down
4 changes: 2 additions & 2 deletions src/form/dcp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function variable_branch_power_real(pm::AbstractAPLossLessModels; nw::Int=nw_id_
p_expr = merge(p_expr, Dict( ((l,j,i), -1.0*p[(l,i,j)]) for (l,i,j) in ref(pm, nw, :arcs_from)))
var(pm, nw)[:p] = p_expr

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p_expr)
report && sol_component_value_edge(pm, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p_expr)
end

""
Expand All @@ -280,7 +280,7 @@ function variable_ne_branch_power_real(pm::AbstractAPLossLessModels; nw::Int=nw_
p_ne_expr = merge(p_ne_expr, Dict(((l,j,i), -1.0*var(pm, nw, :p_ne, (l,i,j))) for (l,i,j) in ref(pm, nw, :ne_arcs_from)))
var(pm, nw)[:p_ne] = p_ne_expr

report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :ne_branch, :p_ne_fr, :p_ne_to, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), p_ne_expr)
report && sol_component_value_edge(pm, nw, :ne_branch, :p_ne_fr, :p_ne_to, ref(pm, nw, :ne_arcs_from), ref(pm, nw, :ne_arcs_to), p_ne_expr)
end

""
Expand Down
8 changes: 4 additions & 4 deletions src/form/iv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function variable_branch_current(pm::AbstractIVRModel; nw::Int=nw_id_default, bo

var(pm, nw)[:p] = p
var(pm, nw)[:q] = q
report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p)
report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :branch, :qf, :qt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), q)
report && sol_component_value_edge(pm, nw, :branch, :pf, :pt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), p)
report && sol_component_value_edge(pm, nw, :branch, :qf, :qt, ref(pm, nw, :arcs_from), ref(pm, nw, :arcs_to), q)

variable_branch_series_current_real(pm, nw=nw, bounded=bounded, report=report; kwargs...)
variable_branch_series_current_imaginary(pm, nw=nw, bounded=bounded, report=report; kwargs...)
Expand Down Expand Up @@ -93,8 +93,8 @@ function variable_dcline_current(pm::AbstractIVRModel; nw::Int=nw_id_default, bo

var(pm, nw)[:p_dc] = p
var(pm, nw)[:q_dc] = q
report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :pf, :pt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), p)
report && _IM.sol_component_value_edge(pm, pm_it_sym, nw, :dcline, :qf, :qt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), q)
report && sol_component_value_edge(pm, nw, :dcline, :pf, :pt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), p)
report && sol_component_value_edge(pm, nw, :dcline, :qf, :qt, ref(pm, nw, :arcs_from_dc), ref(pm, nw, :arcs_to_dc), q)

if bounded
for (i,dcline) in ref(pm, nw, :dcline)
Expand Down