Skip to content

Commit

Permalink
Updated H2 storage and truck inputs
Browse files Browse the repository at this point in the history
- Typos related to set "H2_STOR_LONG_DURATION" in h2_long_duration_storage.jl
- modified if condition when truck related input files are read. Setup["ModelH2Trucks"] now controls whether trucks are modeled or not.
  • Loading branch information
dharik13 committed Sep 14, 2022
1 parent 10f8546 commit 4ea9e90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/HSC/load_inputs/load_H2_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ function load_h2_inputs(inputs::Dict,setup::Dict,path::AbstractString)


# Read input data about hydrogen transport truck types
if isfile(string(path,sep,"HSC_trucks.csv"))
if setup["ModelH2Trucks"] ==1
inputs = load_h2_truck(path, sep, inputs)
setup["ModelH2Trucks"] =1
else
setup["ModelH2Trucks"] = 0
end


Expand Down
4 changes: 2 additions & 2 deletions src/HSC/load_inputs/load_h2_truck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ function load_h2_truck(path::AbstractString, sep::AbstractString, inputs_truck::
Z = inputs_truck["Z"]
Z_set = 1:Z

zone_distance = DataFrame(CSV.File(string(path, sep, "HSC_zone_distances_miles.csv"), header=true), copycols=true)
zone_distance = DataFrame(CSV.File(string(path, sep, "HSC_zone_truck_distances_miles.csv"), header=true), copycols=true)

RouteLength = zone_distance[Z_set,Z_set.+1]
inputs_truck["RouteLength"] = RouteLength

println("HSC_zone_distances_miles.csv Successfully Read!")
println("HSC_zone_truck_distances_miles.csv Successfully Read!")

# H2 truck type inputs
h2_truck_in = DataFrame(CSV.File(string(path, sep, "HSC_trucks.csv"), header=true), copycols=true)
Expand Down
4 changes: 2 additions & 2 deletions src/HSC/model/storage/h2_long_duration_storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ function h2_long_duration_storage(EP::Model, inputs::Dict)
# Variables to define inter-period energy transferred between modeled periods

# State of charge of H2 storage at beginning of each modeled period n
@variable(EP, vH2SOCw[y in STOR_LONG_DURATION, n in MODELED_PERIODS_INDEX] >= 0)
@variable(EP, vH2SOCw[y in H2_STOR_LONG_DURATION, n in MODELED_PERIODS_INDEX] >= 0)

# Build up in storage inventory over each representative period w
# Build up inventory can be positive or negative
@variable(EP, vdH2SOC[y in STOR_LONG_DURATION, w=1:REP_PERIOD])
@variable(EP, vdH2SOC[y in H2_STOR_LONG_DURATION, w=1:REP_PERIOD])

### Constraints ###

Expand Down
4 changes: 3 additions & 1 deletion src/HSC/model/storage/h2_storage_all.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ function h2_storage_all(EP::Model, inputs::Dict, setup::Dict)

START_SUBPERIODS = inputs["START_SUBPERIODS"] # Starting subperiod index for each representative period
INTERIOR_SUBPERIODS = inputs["INTERIOR_SUBPERIODS"] # Index of interior subperiod for each representative period
H2_STOR_SHORT_DURATION = inputs["H2_STOR_SHORT_DURATION"] # Set of H2 storage modeled as short-duration (no energy carryover from one rep. week to the next)
H2_STOR_LONG_DURATION = inputs["H2_STOR_LONG_DURATION"] # Set of H2 storage modeled as long-duration (energy carry over allowed)

hours_per_subperiod = inputs["hours_per_subperiod"] #total number of hours per subperiod

Expand Down Expand Up @@ -144,7 +146,7 @@ function h2_storage_all(EP::Model, inputs::Dict, setup::Dict)
# Links state of charge in first time step with decisions in last time step of each subperiod
# We use a modified formulation of this constraint (cSoCBalLongDurationStorageStart) when operations wrapping and long duration storage are being modeled

if setup["OperationWrapping"] == 1 && !isempty(inputs["H2_STOR_LONG_DURATION"]) # Apply constraints to those storage technologies with short duration only
if setup["OperationWrapping"] == 1 && !isempty(H2_STOR_LONG_DURATION) # Apply constraints to those storage technologies with short duration only
@constraint(EP, cH2SoCBalStart[t in START_SUBPERIODS, y in H2_STOR_SHORT_DURATION], EP[:vH2S][y,t] ==
EP[:vH2S][y,t+hours_per_subperiod-1]-(1/dfH2Gen[!,:H2Stor_eff_discharge][y]*EP[:vH2Gen][y,t])
+(dfH2Gen[!,:H2Stor_eff_charge][y]*EP[:vH2_CHARGE_STOR][y,t])-(dfH2Gen[!,:H2Stor_self_discharge_rate_p_hour][y]*EP[:vH2S][y,t+hours_per_subperiod-1]))
Expand Down

0 comments on commit 4ea9e90

Please sign in to comment.