Skip to content

Commit

Permalink
add self discharge terms to elec no simultaneous charge/discharge con…
Browse files Browse the repository at this point in the history
…straint
  • Loading branch information
hdunham committed Oct 25, 2024
1 parent d4979c2 commit a10fb6b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/constraints/storage_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ function add_elec_storage_dispatch_constraints(m, p, b; _n="")
# Constraint (4h): prevent simultaneous charge and discharge by limitting charging alone to not make the SOC exceed 100%
# (4h)-1: with grid
@constraint(m, [ts in p.time_steps_with_grid],
m[Symbol("dvStorageEnergy"*_n)][b] >= m[Symbol("dvStoredEnergy"*_n)][b, ts-1] + p.hours_per_time_step * (
m[Symbol("dvStorageEnergy"*_n)][b] >= m[Symbol("dvStoredEnergy"*_n)][b, ts-1] +
p.hours_per_time_step * (
sum(p.s.storage.attr[b].charge_efficiency * m[Symbol("dvProductionToStorage"*_n)][b, t, ts] for t in p.techs.elec)
+ p.s.storage.attr[b].grid_charge_efficiency * m[Symbol("dvGridToStorage"*_n)][b, ts]
)
- (p.s.storage.attr[b].soc_based_per_ts_self_discharge_fraction * m[Symbol("dvStoredEnergy"*_n)][b, ts])
- (p.s.storage.attr[b].capacity_based_per_ts_self_discharge_fraction * m[Symbol("dvStorageEnergy"*_n)][b])
)
# (4h)-2: no grid
@constraint(m, [ts in p.time_steps_without_grid],
Expand Down

0 comments on commit a10fb6b

Please sign in to comment.