Skip to content

Commit

Permalink
RM: commented code not needed in IVRU formulations for storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjospina committed Sep 19, 2024
1 parent 496a3c9 commit d0c59e1
Showing 1 changed file with 0 additions and 168 deletions.
168 changes: 0 additions & 168 deletions src/core/objective_storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,87 +164,6 @@ function _objective_itd_min_fuel_cost_polynomial_linquad_storage(pmitd::Abstract

@error "IVR-IVRU formulation not yet supported for storage problems."

# # PM
# pm_gen_cost = Dict()

# for (n, nw_ref) in _PM.nws(pm)
# for (i,gen) in nw_ref[:gen]
# bus = gen["gen_bus"]

# #to avoid function calls inside of @constraint:
# pg = _PM.var(pm, n, :pg, i)
# if length(gen["cost"]) == 1
# pm_gen_cost[(n,i)] = gen["cost"][1]
# elseif length(gen["cost"]) == 2
# pm_gen_cost[(n,i)] = JuMP.@expression(pm.model, gen["cost"][1]*pg + gen["cost"][2])
# elseif length(gen["cost"]) == 3
# pm_gen_cost[(n,i)] = JuMP.@expression(pm.model, gen["cost"][1]*pg^2 + gen["cost"][2]*pg + gen["cost"][3])
# else
# pm_gen_cost[(n,i)] = 0.0
# end
# end
# end

# # PM Storage
# pm_strg_cost = Dict()

# for (n, nw_ref) in _PM.nws(pm)
# for (i, strg) in nw_ref[:storage]
# dsch = _PM.var(pm, n, :sd, i) # get discharge power value
# pm_strg_cost[(n,i)] = strg["cost"][1]*dsch # compute discharge cost (no cost conversion is needed, cost must be in $/pu)
# end
# end

# # PMD
# pmd_gen_cost = Dict()

# for (n, nw_ref) in _PMD.nws(pmd)
# for (i,gen) in nw_ref[:gen]
# bus = gen["gen_bus"]

# #to avoid function calls inside of @constraint:
# pg = _PMD.var(pmd, n, :pg, i)
# if length(gen["cost"]) == 1
# pmd_gen_cost[(n,i)] = gen["cost"][1]
# elseif length(gen["cost"]) == 2
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmd.model, gen["cost"][1]*sum(pg[c] for c in gen["connections"]) + gen["cost"][2])
# elseif length(gen["cost"]) == 3
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmd.model, gen["cost"][1]*sum(pg[c] for c in gen["connections"])^2 + gen["cost"][2]*sum(pg[c] for c in gen["connections"]) + gen["cost"][3])
# else
# pmd_gen_cost[(n,i)] = 0.0
# end
# end
# end

# # PMD Storage
# pmd_strg_cost = Dict()

# for (n, nw_ref) in _PMD.nws(pmd)
# for (i, strg) in nw_ref[:storage]
# dsch = _PMD.var(pmd, n, :sd, i) # get discharge power value
# strg_cost_dollar_per_pu = strg["cost"][1]#*nw_ref[:settings]["sbase_default"] # convert from $/kWh -> $/pu
# strg_cost_dollar_per_pu = round(strg_cost_dollar_per_pu, digits=4)
# pmd_strg_cost[(n,i)] = strg_cost_dollar_per_pu*dsch # compute discharge cost
# end
# end


# # ITD (Combined objective)
# return JuMP.@objective(pmitd.model, Min,
# sum(
# sum( pm_gen_cost[(n,i)] for (i,gen) in nw_ref[:gen] )
# for (n, nw_ref) in _PM.nws(pm))
# + sum(
# sum( pm_strg_cost[(n,i)] for (i,strg) in nw_ref[:storage] )
# for (n, nw_ref) in _PM.nws(pm))
# + sum(
# sum( pmd_gen_cost[(n,i)] for (i,gen) in nw_ref[:gen] )
# for (n, nw_ref) in _PMD.nws(pmd))
# + sum(
# sum( pmd_strg_cost[(n,i)] for (i,strg) in nw_ref[:storage] )
# for (n, nw_ref) in _PMD.nws(pmd))
# )

end


Expand All @@ -261,93 +180,6 @@ function _objective_itd_min_fuel_cost_polynomial_nl_storage(pmitd::AbstractIVRPo

@error "IVR-IVRU formulation not yet supported for storage problems."

# # PM
# pm_gen_cost = Dict()
# for (n, nw_ref) in _PM.nws(pm)
# for (i,gen) in nw_ref[:gen]
# bus = gen["gen_bus"]

# #to avoid function calls inside of @constraint:
# pg = _PM.var(pm, n, :pg, i)
# cost_rev = reverse(gen["cost"])
# if length(cost_rev) == 1
# pm_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1])
# elseif length(cost_rev) == 2
# pm_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*pg)
# elseif length(cost_rev) == 3
# pm_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*pg + cost_rev[3]*pg^2)
# elseif length(cost_rev) >= 4
# cost_rev_nl = cost_rev[4:end]
# pm_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*pg + cost_rev[3]*pg^2 + sum( v*pg^(d+3) for (d,v) in enumerate(cost_rev_nl)) )
# else
# pm_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, 0.0)
# end
# end
# end

# # PM Storage
# pm_strg_cost = Dict()

# for (n, nw_ref) in _PM.nws(pm)
# for (i, strg) in nw_ref[:storage]
# dsch = _PM.var(pm, n, :sd, i) # get discharge power value
# pm_strg_cost[(n,i)] = strg["cost"][1]*dsch # compute discharge cost (no cost conversion is needed, cost must be in $/pu)
# end
# end


# # PMD
# pmd_gen_cost = Dict()
# for (n, nw_ref) in _PMD.nws(pmd)
# for (i,gen) in nw_ref[:gen]

# pg = _PMD.var(pmd, n, :pg, i)
# cost_rev = reverse(gen["cost"])

# if length(cost_rev) == 1
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1])
# elseif length(cost_rev) == 2
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*sum(pg[c] for c in gen["connections"]))
# elseif length(cost_rev) == 3
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*sum(pg[c] for c in gen["connections"]) + cost_rev[3]*sum(pg[c] for c in gen["connections"])^2)
# elseif length(cost_rev) >= 4
# cost_rev_nl = cost_rev[4:end]
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, cost_rev[1] + cost_rev[2]*sum(pg[c] for c in gen["connections"]) + cost_rev[3]*sum(pg[c] for c in gen["connections"])^2 + sum( v*sum(pg[c] for c in gen["connections"])^(d+3) for (d,v) in enumerate(cost_rev_nl)) )
# else
# pmd_gen_cost[(n,i)] = JuMP.@expression(pmitd.model, 0.0)
# end
# end
# end

# # PMD Storage
# pmd_strg_cost = Dict()

# for (n, nw_ref) in _PMD.nws(pmd)
# for (i, strg) in nw_ref[:storage]
# dsch = _PMD.var(pmd, n, :sd, i) # get discharge power value
# strg_cost_dollar_per_pu = strg["cost"][1]#*nw_ref[:settings]["sbase_default"] # convert from $/kWh -> $/pu
# strg_cost_dollar_per_pu = round(strg_cost_dollar_per_pu, digits=4)
# pmd_strg_cost[(n,i)] = strg_cost_dollar_per_pu*dsch # compute discharge cost
# end
# end


# # ITD (Combined objective)
# return JuMP.@objective(pmitd.model, Min,
# sum(
# sum( pm_gen_cost[(n,i)] for (i,gen) in nw_ref[:gen] )
# for (n, nw_ref) in _PM.nws(pm))
# + sum(
# sum( pm_strg_cost[(n,i)] for (i,strg) in nw_ref[:storage] )
# for (n, nw_ref) in _PM.nws(pm))
# + sum(
# sum( pmd_gen_cost[(n,i)] for (i,gen) in nw_ref[:gen] )
# for (n, nw_ref) in _PMD.nws(pmd))
# + sum(
# sum( pmd_strg_cost[(n,i)] for (i,strg) in nw_ref[:storage] )
# for (n, nw_ref) in _PMD.nws(pmd))
# )

end


Expand Down

0 comments on commit d0c59e1

Please sign in to comment.