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

Add initial storage level and storage inflows #239

Merged
merged 5 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
1 change: 1 addition & 0 deletions src/input-tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct AssetData
initial_capacity::Float64 # MW
peak_demand::Float64 # MW
initial_storage_capacity::Float64 # MWh
initial_storage_level::Float64 # MWh
energy_to_power_ratio::Float64 # Hours
end

Expand Down
3 changes: 3 additions & 0 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ function create_parameters_and_sets_from_file(input_folder::AbstractString)

# Parameters for storage
initial_storage_capacity = Dict{String,Float64}()
initial_storage_level = Dict{String,Float64}()
energy_to_power_ratio = Dict{String,Float64}()
for row in eachrow(assets_data_df)
if row.name in assets_storage
initial_storage_capacity[row.name] = row.initial_storage_capacity
initial_storage_level[row.name] = row.initial_storage_level
energy_to_power_ratio[row.name] = row.energy_to_power_ratio
end
end
Expand Down Expand Up @@ -134,6 +136,7 @@ function create_parameters_and_sets_from_file(input_folder::AbstractString)
flows_is_transport = flows_is_transport,
peak_demand = peak_demand,
initial_storage_capacity = initial_storage_capacity,
initial_storage_level = initial_storage_level,
energy_to_power_ratio = energy_to_power_ratio,
rp_weight = rp_weight,
rp_resolution = rp_resolution,
Expand Down
9 changes: 8 additions & 1 deletion src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function create_model(graph, params, sets; verbose = false, write_lp_file = fals
model,
storage_balance[a ∈ As, rp ∈ RP, (k, B) ∈ enumerate(P[(a, rp)])],
storage_level[a, rp, B] ==
(k > 1 ? storage_level[a, rp, P[(a, rp)][k-1]] : 0.0) +
(k > 1 ? storage_level[a, rp, P[(a, rp)][k-1]] : params.initial_storage_level[a]) +
incoming_flow_w_efficiency[(a, rp, B)] - outgoing_flow_w_efficiency[(a, rp, B)]
)

Expand Down Expand Up @@ -242,6 +242,13 @@ function create_model(graph, params, sets; verbose = false, write_lp_file = fals
params.initial_storage_capacity[a] + (a ∈ Ai ? energy_limit[a] : 0.0)
)

# - cycling condition for storage level
@constraint(
model,
cycling_condition_for_storage_level[a ∈ As, rp ∈ RP, T ∈ P[(a, rp)]],
storage_level[a, rp, T] ≥ params.initial_storage_level[a]
datejada marked this conversation as resolved.
Show resolved Hide resolved
)

if write_lp_file
write_to_file(model, "model.lp")
end
Expand Down
48 changes: 24 additions & 24 deletions test/inputs/Norse/assets-data.csv
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
,,{producer;consumer;storage;hub;conversion},{true;false},{true;false},kEUR/MWh,kEUR/MW/year,MW,MW,MW,MW/unit,MW/unit,MW,MW,MWh,h,kEUR/MW/year,year,0
id,name,type,active,investable,variable_cost,investment_cost,capacity,initial_capacity,peak_demand,charging_capacity,discharging_capacity,initial_charging_capacity,initial_discharging_capacity,initial_storage_capacity,energy_to_power_ratio,fixed_cost,lifetime,efficiency
1,Asgard_Battery,storage,true,true,0.003,300,10,0,0,1,1,0,0,0,100,3,10,0
2,Asgard_Solar,producer,true,true,0.001,350,100,0,0,0,0,0,0,0,0,8,25,0
3,Asgard_E_demand,consumer,true,false,0,0,0,0,65787.17792,0,0,0,0,0,0,0,0,0
4,Asgard_CCGT,conversion,true,true,0.0015,650,500,0,0,0,0,0,0,0,0,10,30,0.6
5,G_imports,producer,true,false,0.08,0,0,75000,0,0,0,0,0,0,0,0,0,0
6,Midgard_Wind,producer,true,true,0.002,1300,3,0,0,0,0,0,0,0,0,15,25,0
7,Midgard_Hydro,storage,true,false,0.0012,1600,0,250,0,3,3,0,0,4000,0,16,50,0
8,Midgard_Nuclear_SMR,producer,true,true,0.015,6000,150,1000,0,0,0,0,0,0,0,101,60,0
9,Midgard_E_imports,producer,true,false,0.02,0,0,500,0,0,0,0,0,0,0,0,0,0
10,Midgard_CCGT,conversion,true,true,0.0015,650,500,0,0,0,0,0,0,0,0,10,30,0.6
11,Midgard_E_demand,consumer,true,false,0,0,0,0,19604.76443,0,0,0,0,0,0,0,0,0
12,Valhalla_H2_generator,conversion,true,true,0,479,100,0,0,0,0,0,0,0,0,10,20,0.6
13,Valhalla_H2_storage,storage,true,true,0,0.1,500,0,0,3,3,0,0,0,10000,0.005,50,0
14,Valhalla_H2_demand,consumer,true,false,0,0,0,0,745.735,0,0,0,0,0,0,0,0,0
15,Valhalla_Electrolyser,conversion,true,true,0,1260,100,500,0,0,0,0,0,0,0,60,25,0.704
16,Valhalla_E_balance,hub,true,false,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17,Valhalla_E_exports,consumer,true,false,0.09,0,0,0,50,0,0,0,0,0,0,0,0,0
18,Valhalla_Fuel_cell,conversion,true,true,0,800,100,0,0,0,0,0,0,0,0,40,25,0.5
19,Valhalla_Heat_pump,conversion,true,true,0,300,100,0,0,0,0,0,0,0,0,15,20,4
20,Valhalla_Waste_heat,producer,true,false,0.0025,1450,200,0,0,0,0,0,0,0,0,0,30,0
21,Valhalla_Heat_demand,consumer,true,false,0,0,0,0,3548.42445,0,0,0,0,0,0,0,0,0
22,Valhalla_GT,conversion,true,true,0.0015,400,500,0,0,0,0,0,0,0,0,3.85,30,0.6
,,{producer;consumer;storage;hub;conversion},{true;false},{true;false},kEUR/MWh,kEUR/MW/year,MW,MW,MW,MW/unit,MW/unit,MW,MW,MWh,MWh,h,kEUR/MW/year,year,0
id,name,type,active,investable,variable_cost,investment_cost,capacity,initial_capacity,peak_demand,charging_capacity,discharging_capacity,initial_charging_capacity,initial_discharging_capacity,initial_storage_capacity,initial_storage_level,energy_to_power_ratio,fixed_cost,lifetime,efficiency
1,Asgard_Battery,storage,true,true,0.003,300,10,0,0,1,1,0,0,0,0,100,3,10,0
2,Asgard_Solar,producer,true,true,0.001,350,100,0,0,0,0,0,0,0,0,0,8,25,0
3,Asgard_E_demand,consumer,true,false,0,0,0,0,65787.17792,0,0,0,0,0,0,0,0,0,0
4,Asgard_CCGT,conversion,true,true,0.0015,650,500,0,0,0,0,0,0,0,0,0,10,30,0.6
5,G_imports,producer,true,false,0.08,0,0,75000,0,0,0,0,0,0,0,0,0,0,0
6,Midgard_Wind,producer,true,true,0.002,1300,3,0,0,0,0,0,0,0,0,0,15,25,0
7,Midgard_Hydro,storage,true,false,0.0012,1600,0,250,0,3,3,0,0,4000,2000,0,16,50,0
8,Midgard_Nuclear_SMR,producer,true,true,0.015,6000,150,1000,0,0,0,0,0,0,0,0,101,60,0
9,Midgard_E_imports,producer,true,false,0.02,0,0,500,0,0,0,0,0,0,0,0,0,0,0
10,Midgard_CCGT,conversion,true,true,0.0015,650,500,0,0,0,0,0,0,0,0,0,10,30,0.6
11,Midgard_E_demand,consumer,true,false,0,0,0,0,19604.76443,0,0,0,0,0,0,0,0,0,0
12,Valhalla_H2_generator,conversion,true,true,0,479,100,0,0,0,0,0,0,0,0,0,10,20,0.6
13,Valhalla_H2_storage,storage,true,true,0,0.1,500,0,0,3,3,0,0,0,0,10000,0.005,50,0
14,Valhalla_H2_demand,consumer,true,false,0,0,0,0,745.735,0,0,0,0,0,0,0,0,0,0
15,Valhalla_Electrolyser,conversion,true,true,0,1260,100,500,0,0,0,0,0,0,0,0,60,25,0.704
16,Valhalla_E_balance,hub,true,false,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17,Valhalla_E_exports,consumer,true,false,0.09,0,0,0,50,0,0,0,0,0,0,0,0,0,0
18,Valhalla_Fuel_cell,conversion,true,true,0,800,100,0,0,0,0,0,0,0,0,0,40,25,0.5
19,Valhalla_Heat_pump,conversion,true,true,0,300,100,0,0,0,0,0,0,0,0,0,15,20,4
20,Valhalla_Waste_heat,producer,true,false,0.0025,1450,200,0,0,0,0,0,0,0,0,0,0,30,0
21,Valhalla_Heat_demand,consumer,true,false,0,0,0,0,3548.42445,0,0,0,0,0,0,0,0,0,0
22,Valhalla_GT,conversion,true,true,0.0015,400,500,0,0,0,0,0,0,0,0,0,3.85,30,0.6
16 changes: 8 additions & 8 deletions test/inputs/Tiny/assets-data.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
,,{producer;consumer},{true;false},{true;false},kEUR/MW/year,MW,MW,MW,MWh,h
id,name,type,active,investable,investment_cost,capacity,initial_capacity,peak_demand,initial_storage_capacity,energy_to_power_ratio
1,ocgt,producer,true,true,25,100,0,0,0,0
2,ccgt,producer,true,true,40,400,0,0,0,0
3,wind,producer,true,true,70,50,0,0,0,0
4,solar,producer,true,true,50,10,0,0,0,0
5,ens,producer,true,false,0,0,1115,0,0,0
6,demand,consumer,true,false,0,0,0,1115,0,0
,,{producer;consumer},{true;false},{true;false},kEUR/MW/year,MW,MW,MW,MWh,MWh,h
id,name,type,active,investable,investment_cost,capacity,initial_capacity,peak_demand,initial_storage_capacity,initial_storage_level,energy_to_power_ratio
1,ocgt,producer,true,true,25,100,0,0,0,0,0
2,ccgt,producer,true,true,40,400,0,0,0,0,0
3,wind,producer,true,true,70,50,0,0,0,0,0
4,solar,producer,true,true,50,10,0,0,0,0,0
5,ens,producer,true,false,0,0,1115,0,0,0,0
6,demand,consumer,true,false,0,0,0,1115,0,0,0