Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding storage network expansion formulation and associated variables #405

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
93745f6
Add stubs for network expansion variables and constraints.
tasseff Mar 29, 2022
be6bfff
Correct network expansion formulation.
tasseff Mar 29, 2022
332b9cf
Adding variables and constraints for storage expansion decisions
asazamzam Apr 13, 2022
a6efb9d
fixing network expansion storage
asazamzam Apr 13, 2022
72904c6
Add objective to the network expansion problem.
tasseff Apr 14, 2022
1534047
Change name of the `ne` objective.
tasseff Apr 14, 2022
c646663
Include network expansion cost in example.
tasseff Apr 14, 2022
82e4f9d
Correct charging/discharging constraints.
tasseff Apr 15, 2022
57e3f6c
Consolidate `storage_ne` model in non-`ne` problem specification.
tasseff Apr 15, 2022
f48aacf
Update network expansion constraints.
tasseff Apr 19, 2022
3d40ddc
update operational conditions for ne storages
asazamzam Apr 28, 2022
75c1f7a
Merge branch 'ne-objective' of github.com:asazamzam/PowerModelsDistri…
asazamzam Apr 28, 2022
7c85a33
working example for network expansion for energy storage
asazamzam May 9, 2022
9133f39
expansion storages
asazamzam Nov 9, 2022
13cb844
Adding solar generation expansion decisions
asazamzam Feb 16, 2023
794dcdc
"Update multi-scenario network expansion"
asazamzam May 11, 2023
b978b4e
"time series for pv in case3_balanced_pv_mod.dss"
asazamzam May 11, 2023
7679a29
"Add expansion for IEEE13 feeder"
asazamzam May 12, 2023
00a2f11
Adding expansion formulations for AC-Polar formulations and test case…
asazamzam Sep 26, 2023
9e66451
Adding expansion formulations for AC-Polar formulations and test case…
asazamzam Sep 26, 2023
dd287cf
Add _apply_voltage_bounds_math!(data_math, ...)
asazamzam Oct 3, 2023
107babd
correct _apply_voltage_bounds_math()
asazamzam Oct 3, 2023
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
8 changes: 8 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ repo = "https://github.com/lanl-ansi/PowerModelsDistribution.jl.git"
version = "0.14.3"

[deps]
CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Juniper = "2ddba703-00a4-53a7-87a5-e8b9971dde84"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PolyhedralRelaxations = "2e741578-48fa-11ea-2d62-b52c946f73a0"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Xpress = "9e70acf3-d6c9-5be6-b5bd-4e2c73e3e054"

[compat]
CSV = "0.8.5, 0.9, 0.10"
Expand Down
42 changes: 42 additions & 0 deletions examples/expand_small_DS.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import CSV
import JuMP
import Ipopt
import Pkg

using DataFrames
using Revise
using Printf
using Juniper
using SCIP

using PowerModelsDistribution
const PMD = PowerModelsDistribution

network_file = "/Users/azamzam/dev/Julia/power-water-expansion/PowerModelsDistribution.jl/test/data/opendss/case3_unbalanced.dss"
expansion_file = "/Users/azamzam/dev/Julia/power-water-expansion/PowerModelsDistribution.jl/test/data/ne_json/expansion3u.json"

data = parse_file(network_file, data_model = DSS)
expand_mods = parse_file(expansion_file)
PMD._IM.update_data!(data, expand_mods)

apply_voltage_bounds!(data, vm_lb=0.97, vm_ub=1.03)

data_mn = make_multinetwork(data)

interval_len = Dict("interval_len"=> 24)
PMD._IM.update_data!(data_mn, interval_len)

pm_type = ACPUPowerModel

data_mn_math = transform_data_model(data_mn; kron_reduce=true)

pm = instantiate_mc_model(data_mn_math, pm_type, build_mn_mc_mld_multi_scenario_ne)
expand_cost = objective_ne(pm)
JuMP.@constraint(pm.model, expand_cost <= 100000)
objective_mc_min_fuel_cost(pm)

ipopt_solver = optimizer_with_attributes(() -> Ipopt.Optimizer())
juniper_optimizer = optimizer_with_attributes(Juniper.Optimizer, "nl_solver"=>ipopt_solver, "time_limit"=>600)
scip_optimizer = optimizer_with_attributes(SCIP.Optimizer, "limits/gap"=>0.05)

res = optimize_model!(pm, optimizer=juniper_optimizer)
44 changes: 44 additions & 0 deletions examples/network_expand.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import CSV
import JuMP
import Ipopt
import Pkg

using DataFrames
using Xpress
using Revise

using PowerModelsDistribution
const PMD = PowerModelsDistribution

# ENV["CPLEX_STUDIO_BINARIES"] = "/Applications/CPLEX_Studio1210/cplex/bin/x86-64_osx/"
# Pkg.add("CPLEX")
# Pkg.build("CPLEX")

# using CPLEX

# cplex_solver = optimizer_with_attributes(() -> CPLEX.Optimizer())


# network_file = "test/data/opendss/IEEE13_CDPSM.dss"
network_file = "test/data/opendss/case3_balanced_pv_mod.dss"
# expansion_file = "test/data/ne_json/expansion13.json"
expansion_file = "test/data/ne_json/case3_balanced_ne.json"

data = parse_file(network_file)
expand_mods = parse_file(expansion_file)
PMD._IM.update_data!(data, expand_mods)

data_mn = make_multinetwork(data)

interval_len = Dict("interval_len"=> 5)
PMD._IM.update_data!(data_mn, interval_len)

pm_type = NFAUPowerModel

pm = instantiate_mc_model(data_mn, pm_type, build_mn_mc_mld_multi_scenario_ne)
expand_cost = objective_ne(pm)
JuMP.@constraint(pm.model, expand_cost <= 1000)
objective_mc_min_fuel_cost(pm)

xpress_solver = optimizer_with_attributes(() -> Xpress.Optimizer(DEFAULTALG=2, PRESOLVE=0, logfile = "output.log"))
res = optimize_model!(pm, optimizer=xpress_solver)
76 changes: 76 additions & 0 deletions examples/optimize_feederPV.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import CSV
import JuMP
import Ipopt
import Pkg

using DataFrames
using Xpress
using Revise
using Printf

using PowerModelsDistribution
const PMD = PowerModelsDistribution

network_file = "test/data/opendss/123bus/IEEE123Master.dss"

data = parse_file(network_file, data_model = DSS)

apply_voltage_bounds!(data, vm_lb=0.97, vm_ub=1.03)

increase_factor = 4
Vulnerabele = ["60", "76", "97", "96", "114", "151"]
for (k, solar) in data["solar"]
solar["pg"] = solar["pg"]*increase_factor
solar["pg_ub"] = solar["pg_ub"]*increase_factor
solar["pg_lb"] = solar["pg_lb"]*increase_factor
solar["qg_ub"] = solar["qg_ub"]*increase_factor
solar["qg_lb"] = solar["qg_lb"]*increase_factor
if solar["bus"] in Vulnerabele
solar["vulnerable"] = 1
else
solar["vulnerable"] = 0
end
end



pm_type = LinDist3FlowPowerModel

pm = instantiate_mc_model(data, pm_type, build_mc_opf_curt)

# xpress_solver = optimizer_with_attributes(() -> Xpress.Optimizer(DEFAULTALG=2, PRESOLVE=0, logfile = "output.log"))
ipopt_solver = optimizer_with_attributes(() -> Ipopt.Optimizer())

res = optimize_model!(pm, optimizer=ipopt_solver)

sbase = data["settings"]["sbase_default"]
println('#', " \t", "Curtailed", " \t\t", "Available")
for (k, gen) in res["solution"]["gen"]
pg = gen["pg"]*sbase
pg_tot = sum(pg)

pgvar = var(pm, :pg, parse(Int, k))
if k == "17"
Pglimit = 0
continue
else
Pglimit = sum(JuMP.upper_bound(pgvar[i]) for i in eachindex(pgvar))*sbase
end

@printf("%s \t %.3f \t %.3f\n", k, Pglimit - pg_tot, Pglimit)
end

Vub_ = 0
Vlb_ = Inf
for (k, bus) in res["solution"]["bus"]
# vl = sqrt(minimum(bus["w"]))
# vh = sqrt(maximum(bus["w"]))
if sqrt(minimum(bus["w"])) < Vlb_
global Vlb_ = sqrt(minimum(bus["w"]))
end
if sqrt(maximum(bus["w"])) > Vub_
global Vub_ = sqrt(maximum(bus["w"]))
end
end
println("Maximum Voltage: ", Vub_)
println("Minimum Voltage: ", Vlb_)
32 changes: 32 additions & 0 deletions examples/optimize_small_DS.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import CSV
import JuMP
import Ipopt
import Pkg

using DataFrames
using Xpress
using Revise
using Printf

using PowerModelsDistribution
const PMD = PowerModelsDistribution

network_file = "test/data/opendss/case3_unbalanced.dss"

data = parse_file(network_file, data_model = DSS)

increase_factor = 4

pm_type = ACPUPowerModel

data_math = transform_data_model(data; kron_reduce=true)

apply_voltage_bounds!(data_math, vm_lb=0.97, vm_ub=1.03)

pm = instantiate_mc_model(data_math, pm_type, build_mc_opf)


# xpress_solver = optimizer_with_attributes(() -> Xpress.Optimizer(DEFAULTALG=2, PRESOLVE=0, logfile = "output.log"))
ipopt_solver = optimizer_with_attributes(() -> Ipopt.Optimizer())

res = optimize_model!(pm, optimizer=ipopt_solver)
Loading