Skip to content

Commit

Permalink
WIP: comment out storage unbalance constraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjospina committed Aug 16, 2024
1 parent db8ccaf commit 9cfa7f2
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/core/storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@

function constraint_storage_phase_unbalance_distribution(pmd::_PMD.AbstractUnbalancedPowerModel, i::Int; nw::Int=nw_id_default, unbalance_factor::Float64=0.05)

ps = _PMD.var(pmd, nw, :ps, i)
# qs = _PMD.var(pmd, nw, :qs, i)
# ps = _PMD.var(pmd, nw, :ps, i)
# # qs = _PMD.var(pmd, nw, :qs, i)

sc = _PMD.var(pmd, nw, :sc, i)
sd = _PMD.var(pmd, nw, :sd, i)
# sc = _PMD.var(pmd, nw, :sc, i)
# sd = _PMD.var(pmd, nw, :sd, i)

conns = length(ps)
connections = collect(range(1, stop=conns))
# conns = length(ps)
# connections = collect(range(1, stop=conns))

sd_ps = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sd_ps_$(i)")
sc_ps = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sc_ps_$(i)")
# sd_ps = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sd_ps_$(i)")
# sc_ps = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sc_ps_$(i)")
# sd_qs = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sd_qs_$(i)")
# sc_qs = JuMP.@variable(pmd.model, [c in connections], base_name="$(nw)_sc_qs_$(i)")

M = 1e6 # Large number for big-M method
# M = 1e6 # Large number for big-M method

# JuMP.@constraint(pmd.model, ((sum(ps))^2+(sum(qs))^2) == (-1*sd + 1*sc)^2)
# JuMP.@constraint(pmd.model, sum(ps) == (1*sd - 1*sc))

for (idx,c) in enumerate(connections)
if idx < length(connections)
for d in connections[idx+1:end]
# for (idx,c) in enumerate(connections)
# if idx < length(connections)
# for d in connections[idx+1:end]

# JuMP.@constraint(pmd.model, ps[c]-ps[d] <= unbalance_factor*(ps[c] + ps[d]) + M*(1-sc_ps[c]))
# JuMP.@constraint(pmd.model, ps[c]-ps[d] >= -unbalance_factor*(ps[c] + ps[d]) - M*(1-sc_ps[d]))
# JuMP.@constraint(pmd.model, ps[d]-ps[c] <= unbalance_factor*(ps[c] + ps[d]) + M*(1-sc_ps[c]))
# JuMP.@constraint(pmd.model, ps[d]-ps[c] >= -unbalance_factor*(ps[c] + ps[d]) - M*(1-sc_ps[d]))
# # JuMP.@constraint(pmd.model, ps[c]-ps[d] <= unbalance_factor*(ps[c] + ps[d]) + M*(1-sc_ps[c]))
# # JuMP.@constraint(pmd.model, ps[c]-ps[d] >= -unbalance_factor*(ps[c] + ps[d]) - M*(1-sc_ps[d]))
# # JuMP.@constraint(pmd.model, ps[d]-ps[c] <= unbalance_factor*(ps[c] + ps[d]) + M*(1-sc_ps[c]))
# # JuMP.@constraint(pmd.model, ps[d]-ps[c] >= -unbalance_factor*(ps[c] + ps[d]) - M*(1-sc_ps[d]))

JuMP.@constraint(pmd.model, ps[c] >= ps[d] - unbalance_factor*(-1*sd_ps[d] + 1*sc_ps[d]))
JuMP.@constraint(pmd.model, ps[c] <= ps[d] + unbalance_factor*(-1*sd_ps[d] + 1*sc_ps[d]))
# JuMP.@constraint(pmd.model, qs[c] >= qs[d] - unbalance_factor*(-1*sd_qs[d] + 1*sc_qs[d]))
# JuMP.@constraint(pmd.model, qs[c] <= qs[d] + unbalance_factor*(-1*sd_qs[d] + 1*sc_qs[d]))
# # JuMP.@constraint(pmd.model, ps[c] >= ps[d] - unbalance_factor*(-1*sd_ps[d] + 1*sc_ps[d]))
# # JuMP.@constraint(pmd.model, ps[c] <= ps[d] + unbalance_factor*(-1*sd_ps[d] + 1*sc_ps[d]))
# # JuMP.@constraint(pmd.model, qs[c] >= qs[d] - unbalance_factor*(-1*sd_qs[d] + 1*sc_qs[d]))
# # JuMP.@constraint(pmd.model, qs[c] <= qs[d] + unbalance_factor*(-1*sd_qs[d] + 1*sc_qs[d]))

# JuMP.@constraint(pmd.model, ps[c] >= ps[d] - unbalance_factor*(-1*sd + 1*sc))
# JuMP.@constraint(pmd.model, ps[c] <= ps[d] + unbalance_factor*(-1*sd + 1*sc))
# # JuMP.@constraint(pmd.model, ps[c] >= ps[d] - unbalance_factor*(-1*sd + 1*sc))
# # JuMP.@constraint(pmd.model, ps[c] <= ps[d] + unbalance_factor*(-1*sd + 1*sc))

# Ensure all ps/qs values have the same sign
JuMP.@constraint(pmd.model, ps[c] * ps[d] >= 0)
# JuMP.@constraint(pmd.model, qs[c] * qs[d] >= 0)
# # Ensure all ps/qs values have the same sign
# # JuMP.@constraint(pmd.model, ps[c] * ps[d] >= 0)
# # JuMP.@constraint(pmd.model, qs[c] * qs[d] >= 0)

end
end
end
# end
# end
# end

end

0 comments on commit 9cfa7f2

Please sign in to comment.