Skip to content

Commit

Permalink
only allow min/max_duration_hours in elec storage
Browse files Browse the repository at this point in the history
  • Loading branch information
atpham88 committed Oct 19, 2024
1 parent 64b82c0 commit 25409f6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
14 changes: 8 additions & 6 deletions src/constraints/storage_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ function add_storage_size_constraints(m, p, b; _n="")
)

# Constraint (4c)-3: Limit on Storage Energy Capacity based on Duration Hours
@constraint(m,
m[Symbol("dvStorageEnergy"*_n)][b] <= m[Symbol("dvStoragePower"*_n)][b] * p.s.storage.attr[b].max_duration_hours
)
if p.s.storage.attr[b] isa ElectricStorage
@constraint(m,
m[Symbol("dvStorageEnergy"*_n)][b] <= m[Symbol("dvStoragePower"*_n)][b] * p.s.storage.attr[b].max_duration_hours
)

@constraint(m,
m[Symbol("dvStorageEnergy"*_n)][b] >= m[Symbol("dvStoragePower"*_n)][b] * p.s.storage.attr[b].min_duration_hours #p.s.storage.attr[b].min_duration_hours
)
@constraint(m,
m[Symbol("dvStorageEnergy"*_n)][b] >= m[Symbol("dvStoragePower"*_n)][b] * p.s.storage.attr[b].min_duration_hours
)
end


end
Expand Down
34 changes: 17 additions & 17 deletions src/core/energy_storage/thermal_storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Cold thermal energy storage sytem; specifically, a chilled water system used to
macrs_itc_reduction::Float64 = 0.5
total_itc_fraction::Float64 = 0.3
total_rebate_per_kwh::Float64 = 0.0
min_duration_hours::Real = 0.0
max_duration_hours::Real = 100000.0
#min_duration_hours::Real = 0.0
#max_duration_hours::Real = 100000.0
```
"""
Base.@kwdef struct ColdThermalStorageDefaults <: AbstractThermalStorageDefaults
Expand All @@ -42,8 +42,8 @@ Base.@kwdef struct ColdThermalStorageDefaults <: AbstractThermalStorageDefaults
macrs_itc_reduction::Float64 = 0.5
total_itc_fraction::Float64 = 0.3
total_rebate_per_kwh::Float64 = 0.0
min_duration_hours::Real = 0.0
max_duration_hours::Real = 100000.0
#min_duration_hours::Real = 0.0
#max_duration_hours::Real = 100000.0
end


Expand All @@ -69,8 +69,8 @@ end
can_serve_dhw::Bool = true
can_serve_space_heating:Bool = true
can_serve_process_heat::Bool = false
min_duration_hours::Real = 0.0
max_duration_hours::Real = 100000.0
#min_duration_hours::Real = 0.0
#max_duration_hours::Real = 100000.0
```
"""
Base.@kwdef struct HotThermalStorageDefaults <: AbstractThermalStorageDefaults
Expand All @@ -92,8 +92,8 @@ Base.@kwdef struct HotThermalStorageDefaults <: AbstractThermalStorageDefaults
can_serve_dhw::Bool = true
can_serve_space_heating::Bool = true
can_serve_process_heat::Bool = false
min_duration_hours::Real = 0.0
max_duration_hours::Real = 100000.0
#min_duration_hours::Real = 0.0
#max_duration_hours::Real = 100000.0
end


Expand Down Expand Up @@ -127,8 +127,8 @@ struct ColdThermalStorage <: AbstractThermalStorage
discharge_efficiency::Float64
net_present_cost_per_kwh::Float64
om_cost_per_kwh::Float64
min_duration_hours::Real
max_duration_hours::Real
#min_duration_hours::Real
#max_duration_hours::Real

function ColdThermalStorage(s::AbstractThermalStorageDefaults, f::Financial, time_steps_per_hour::Int)

Expand Down Expand Up @@ -177,9 +177,9 @@ struct ColdThermalStorage <: AbstractThermalStorage
charge_efficiency,
discharge_efficiency,
net_present_cost_per_kwh,
om_cost_per_kwh,
s.min_duration_hours,
s.max_duration_hours
om_cost_per_kwh
#s.min_duration_hours,
#s.max_duration_hours
)
end
end
Expand Down Expand Up @@ -217,8 +217,8 @@ struct HotThermalStorage <: AbstractThermalStorage
can_serve_dhw::Bool
can_serve_space_heating::Bool
can_serve_process_heat::Bool
min_duration_hours::Real
max_duration_hours::Real
#min_duration_hours::Real
#max_duration_hours::Real


function HotThermalStorage(s::AbstractThermalStorageDefaults, f::Financial, time_steps_per_hour::Int)
Expand Down Expand Up @@ -272,8 +272,8 @@ struct HotThermalStorage <: AbstractThermalStorage
s.can_serve_dhw,
s.can_serve_space_heating,
s.can_serve_process_heat,
s.min_duration_hours,
s.max_duration_hours
#s.min_duration_hours,
#s.max_duration_hours
)
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2861,16 +2861,17 @@ else # run HiGHS tests
end

@testset "Storage Duration" begin
## Battery storage
d = JSON.parsefile("scenarios/pv_storage.json")
d["ElectricStorage"]["min_duration_hours"] = 8
d["ElectricStorage"]["max_duration_hours"] = 8
s = Scenario(d)
inputs = REoptInputs(s)
m = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false))
r = run_reopt(m, inputs)

# Test battery size_kwh = size_hw * duration
@test r["ElectricStorage"]["size_kw"]*8 - r["ElectricStorage"]["size_kwh"] 0.0 atol = 0.1

end
end
end

0 comments on commit 25409f6

Please sign in to comment.