-
Notifications
You must be signed in to change notification settings - Fork 47
Add input for ElectricStorage SOC timeseries #486
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
base: develop
Are you sure you want to change the base?
Changes from all commits
247f776
690aadc
19499d9
564c89b
51fc70a
4cfb537
6295eb1
383f03d
05e659a
3d6530c
d458a9c
c661d5c
828a084
ae46755
87c357f
f044684
8a07806
ad2563a
24e89ca
deb2cc6
c26364b
5d8f3e4
1909b02
a2555b8
a0f411d
8a89e6b
77b2a69
a13e311
0f6d48f
e74734b
9ab2de4
be310d6
38daa44
5980d84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,38 +105,39 @@ function add_elec_storage_dispatch_constraints(m, p, b; _n="") | |
| ) | ||
| ) | ||
|
|
||
| # Constraint (4i)-1: Dispatch to electrical storage is no greater than power capacity | ||
| @constraint(m, [ts in p.time_steps], | ||
| m[Symbol("dvStoragePower"*_n)][b] >= | ||
| sum(m[Symbol("dvProductionToStorage"*_n)][b, t, ts] for t in p.techs.elec) + m[Symbol("dvGridToStorage"*_n)][b, ts] | ||
| ) | ||
|
|
||
| #Constraint (4k)-alt: Dispatch to and from electrical storage is no greater than power capacity | ||
| @constraint(m, [ts in p.time_steps_with_grid], | ||
| m[Symbol("dvStoragePower"*_n)][b] >= m[Symbol("dvDischargeFromStorage"*_n)][b, ts] + | ||
| sum(m[Symbol("dvProductionToStorage"*_n)][b, t, ts] for t in p.techs.elec) + m[Symbol("dvGridToStorage"*_n)][b, ts] | ||
| ) | ||
|
|
||
| #Constraint (4l)-alt: Dispatch from electrical storage is no greater than power capacity (no grid connection) | ||
| @constraint(m, [ts in p.time_steps_without_grid], | ||
| m[Symbol("dvStoragePower"*_n)][b] >= m[Symbol("dvDischargeFromStorage"*_n)][b,ts] + | ||
| sum(m[Symbol("dvProductionToStorage"*_n)][b, t, ts] for t in p.techs.elec) | ||
| # Constraint (4i): Dispatch to and from electrical storage is no greater than power capacity | ||
| @constraint(m, [ts in p.time_steps], | ||
| m[Symbol("dvStoragePower"*_n)][b] >= m[Symbol("dvDischargeFromStorage"*_n)][b, ts] | ||
| + sum(m[Symbol("dvProductionToStorage"*_n)][b, t, ts] for t in p.techs.elec) | ||
| + m[Symbol("dvGridToStorage"*_n)][b, ts] | ||
| ) | ||
|
|
||
| # Remove grid-to-storage as an option if option to grid charge is turned off | ||
| # Constraint (4j): Remove grid-to-storage as an option if option to grid charge is turned off | ||
| if !(p.s.storage.attr[b].can_grid_charge) | ||
| for ts in p.time_steps_with_grid | ||
| fix(m[Symbol("dvGridToStorage"*_n)][b, ts], 0.0, force=true) | ||
| end | ||
| end | ||
|
|
||
| # Constraint (4k): Constrain average state of charge | ||
| if p.s.storage.attr[b].minimum_avg_soc_fraction > 0 | ||
| avg_soc = sum(m[Symbol("dvStoredEnergy"*_n)][b, ts] for ts in p.time_steps) / | ||
| (8760. / p.hours_per_time_step) | ||
| @constraint(m, avg_soc >= p.s.storage.attr[b].minimum_avg_soc_fraction * | ||
| sum(m[Symbol("dvStorageEnergy"*_n)][b]) | ||
| ) | ||
| end | ||
|
|
||
| # Constraint (4l): Constrain to fixed_soc_series_fraction | ||
| if hasproperty(p.s.storage.attr[b], :fixed_soc_series_fraction) && !isnothing(p.s.storage.attr[b].fixed_soc_series_fraction) | ||
| # Allow for a percentage point (fractional) buffer on user-provided fixed_soc_series_fraction | ||
| @constraint(m, [ts in p.time_steps], | ||
| m[Symbol("dvStoredEnergy"*_n)][b, ts] <= (p.s.storage.attr[b].fixed_soc_series_fraction_tolerance + p.s.storage.attr[b].fixed_soc_series_fraction[ts]) * m[Symbol("dvStorageEnergy"*_n)][b] | ||
| ) | ||
| @constraint(m, [ts in p.time_steps], | ||
| m[Symbol("dvStoredEnergy"*_n)][b, ts] >= (-p.s.storage.attr[b].fixed_soc_series_fraction_tolerance + p.s.storage.attr[b].fixed_soc_series_fraction[ts]) * m[Symbol("dvStorageEnergy"*_n)][b] | ||
|
adfarth marked this conversation as resolved.
|
||
| ) | ||
|
Comment on lines
+131
to
+139
|
||
| end | ||
| end | ||
|
|
||
| function add_elec_storage_cost_constant_constraints(m, p, b; _n="") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,8 +82,8 @@ function build_mpc!(m::JuMP.AbstractModel, p::MPCInputs) | |
|
|
||
| fix(m[:dvGridPurchase][ts], 0.0, force=true) | ||
|
|
||
| for t in p.s.storage.types.elec | ||
| fix(m[:dvGridToStorage][t, ts], 0.0, force=true) | ||
| for b in p.s.storage.types.elec | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changing for consistency in how we index storage |
||
| fix(m[:dvGridToStorage][b, ts], 0.0, force=true) | ||
| end | ||
|
|
||
| for t in p.techs.elec, u in p.export_bins_by_tech[t] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.