Skip to content

Commit

Permalink
ADD: angle constraints to IVR-IVRU which seems to really help with co…
Browse files Browse the repository at this point in the history
…nvergence of this decomposition formulation.
  • Loading branch information
juanjospina committed Apr 24, 2024
1 parent 6436df8 commit cb28054
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/form_decomposition/boundary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,25 @@ function constraint_boundary_voltage_magnitude(pmd::_PMD.AbstractUnbalancedPower
end


"""
function constraint_boundary_voltage_angle(
pmd::_PMD.AbstractUnbalancedPowerModel,
i::Int;
nw::Int=nw_id_default
)
General voltage angle boundary constraint.
"""
function constraint_boundary_voltage_angle(pmd::_PMD.AbstractUnbalancedPowerModel, i::Int; nw::Int=nw_id_default)

boundary = _PMD.ref(pmd, nw, :boundary, i)
t_bus = boundary["t_bus"] # convention: to bus Distribution always!

constraint_boundary_voltage_angle(pmd, i, t_bus, boundary["f_connections"], boundary["t_connections"]; nw=nw)

end


"""
function constraint_transmission_power_balance_boundary(
pm::_PM.AbstractPowerModel,
Expand Down
31 changes: 30 additions & 1 deletion src/form_decomposition/ivr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end

"""
function constraint_boundary_voltage_magnitude(
pmd::_PMD.ACPUPowerModel,
pmd::_PMD.IVRUPowerModel,
i::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
Expand All @@ -75,6 +75,35 @@ function constraint_boundary_voltage_magnitude(pmd::_PMD.IVRUPowerModel, ::Int,
end


"""
function constraint_boundary_voltage_angle(
pmd::_PMD.IVRUPowerModel,
i::Int,
f_idx::Tuple{Int,Int,Int},
f_connections::Vector{Int},
t_connections::Vector{Int};
nw::Int = nw_id_default
)
IVRU boundary bus voltage angle constraints.
"""
function constraint_boundary_voltage_angle(pmd::_PMD.IVRUPowerModel, ::Int, t_bus::Int, ::Vector{Int}, ::Vector{Int}; nw::Int=nw_id_default)

vr_source = _PMD.var(pmd, nw, :vr, t_bus)
vi_source = _PMD.var(pmd, nw, :vi, t_bus)

# Add constraint(s): r->real, i->imaginary
JuMP.@constraint(pmd.model, vi_source[1] == 0.0)

# Add constraints related to 120 degrees offset for the distribution b and c phases
shift_120degs_rad = deg2rad(120)

# TODO: These are non-linear constraints due to transformation to degrees of phase a angle (another way - non-linear may be possible)
JuMP.@NLconstraint(pmd.model, vi_source[2] == tan(atan(vi_source[1]/vr_source[1]) - shift_120degs_rad)*vr_source[2])
JuMP.@NLconstraint(pmd.model, vi_source[3] == tan(atan(vi_source[1]/vr_source[1]) + shift_120degs_rad)*vr_source[3])

end


"""
function constraint_transmission_boundary_power_shared_vars_scaled(
Expand Down
1 change: 1 addition & 0 deletions src/prob/opfitd_decomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ function build_opfitd_decomposition(pmd_model::_PMD.AbstractUnbalancedIVRModel)
for i in _PMD.ids(pmd_model, :boundary)
constraint_boundary_power(pmd_model, i)
constraint_boundary_voltage_magnitude(pmd_model, i)
constraint_boundary_voltage_angle(pmd_model, i)
end

# PMD objective
Expand Down

0 comments on commit cb28054

Please sign in to comment.