diff --git a/src/core/storage.jl b/src/core/storage.jl index 0e3d9da..1811a32 100644 --- a/src/core/storage.jl +++ b/src/core/storage.jl @@ -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