-
Notifications
You must be signed in to change notification settings - Fork 34
Peak load management heuristic control #641
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
933ae89
begin open loop peak load management control
jaredthomas68 90b82d8
Merge branch 'develop' into peakload
jaredthomas68 d338cce
peak finding working as expected
jaredthomas68 e8a2dfb
peak merging working
jaredthomas68 7276db6
all elements present
jaredthomas68 226f0a4
Merge branch 'develop' into peakload
johnjasa 6fc22a7
update comments and doc strings
jaredthomas68 ecc0abd
Merge remote-tracking branch 'myfork/peakload' into peakload
jaredthomas68 db0c72a
seperate the demand and time series to separate config inputs
jaredthomas68 d5b4250
regression tests working
jaredthomas68 b7b2573
move time series method to a utility function
jaredthomas68 9b021ee
wip: add example
jaredthomas68 ad97f44
Merge branch 'develop' into peakload
jaredthomas68 b4508be
remove debug statements
jaredthomas68 4473244
remove defaults and add input of min_proximity
jaredthomas68 4b6e25f
exclude example 33 demand profile yamls from yamlfix
jaredthomas68 d7774d2
example runs
jaredthomas68 74fc2ed
example complete
jaredthomas68 b456d75
remove n_timesteps since it comes from base class
jaredthomas68 a624bd4
remove erroneous changes to example 32
jaredthomas68 0aa1ee2
Merge branch 'develop' into peakload
johnjasa 767eab2
Merge branch 'develop' into peakload
johnjasa cc03ac3
Merge branch 'develop' into peakload
jaredthomas68 e3d824f
Merge remote-tracking branch 'myfork/peakload' into peakload
jaredthomas68 7b3d3da
add doc strings, input checks, time series function updates, test upd…
jaredthomas68 5e6ef34
move dispatch strategy outline to doc string
jaredthomas68 1a344e6
shift merge_peaks method from using primary and secondary to peaks_1 …
jaredthomas68 ca878ed
add check against peaks_1 being None
jaredthomas68 a0bb555
rename get_allowed_discharge to get_allowed_charge
jaredthomas68 cef5b02
minor renaming and logic adjustments based on pr reviews
jaredthomas68 fe01f8f
rename from supervisor and secondary to _1 and _2
jaredthomas68 5527570
adjust variable naming
jaredthomas68 52f5e45
make example 33_peak_load_management run full 8760
jaredthomas68 af66754
Merge branch 'develop' into peakload
jaredthomas68 797e1d6
refine example 33 plot
jaredthomas68 830b6ee
fix color coordination in plot for peak load example 33 and remove de…
jaredthomas68 dfe8380
improve code reuse
jaredthomas68 9c0b212
added common compute checks to baseclass
jaredthomas68 7cbfe2f
move input file contents to fixture
jaredthomas68 725838b
add storage parameters to baseclass but optional
jaredthomas68 55d6d7a
create plant_config fixture
jaredthomas68 b5689a4
complete and refine example 33 peak load
jaredthomas68 83c0e4f
add docs page for peak load control
jaredthomas68 6ebe8ea
update changelog
jaredthomas68 b0f3036
undue minor changes
jaredthomas68 f63fd63
add PeakLoadManagementOpenLoopStorageController to model_overview
jaredthomas68 8d3d82a
resolve merge conflicts in CHANGELOG.md
jaredthomas68 15d178a
resolve merge conflicts
jaredthomas68 983d770
Merge branch 'develop' into peakload
johnjasa b65478e
merge from develop
jaredthomas68 6cfc269
update changelog
jaredthomas68 71d9737
add test for example 33 and add grid purchase profile to plot
jaredthomas68 840304d
merge develop
jaredthomas68 2867695
update to be compatible with demand components (from PR 666)
jaredthomas68 5a81860
fix merge conflicts
jaredthomas68 01d44c5
Merge branch 'develop' into peakload
jaredthomas68 7c878cb
resolve merge conflicts
jaredthomas68 617f819
add comments. simplify documentation. remove meta data in favor of do…
jaredthomas68 30484e3
update docs and example to demarcate override peaks
jaredthomas68 a1bab83
update docs
jaredthomas68 9d7b7a3
add doc comment
jaredthomas68 c0a1561
move static method to after compute
jaredthomas68 515557d
Update docs/control/open-loop_controllers.md
jaredthomas68 2e2820a
Merge remote-tracking branch 'myfork/peakload' into peakload
jaredthomas68 e103abe
minor update
jaredthomas68 4d921cc
Merge branch 'develop' into peakload
johnjasa 750b61b
rename demand_profile_2 to demand_profile_upstream and add Heuristic …
jaredthomas68 c527ad7
update changelog
jaredthomas68 c024eb6
Rename demand_profile_upstream.yaml
johnjasa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
examples/33_peak_load_management/33_peak_load_management.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| name: H2Integrate_config | ||
| system_summary: Peak load management dispatch | ||
| driver_config: driver_config.yaml | ||
| technology_config: tech_config.yaml | ||
| plant_config: plant_config.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| name: driver_config | ||
| description: Driver configuration for multivariable streams example | ||
| general: | ||
| folder_output: outputs | ||
| create_om_reports: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| name: plant_config | ||
| description: Demonstrates multivariable streams with a gas combiner | ||
| plant: | ||
| plant_life: 30 | ||
| simulation: | ||
| n_timesteps: 168 | ||
| dt: 3600 | ||
| timezone: -6 | ||
| start_time: 2025/07/01 00:00:00 | ||
| technology_interconnections: | ||
| - [battery, grid_buy, [electricity_out, electricity_in]] | ||
72 changes: 72 additions & 0 deletions
72
examples/33_peak_load_management/run_peak_load_management.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| """ | ||
| Example 33: Peak load management dispatch | ||
|
|
||
| This example demonstrates: | ||
| 1. Peak load management dispatch open loop control | ||
| 2. Battery charging without an input stream, assuming purchase from the grid | ||
|
|
||
| """ | ||
|
|
||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
|
|
||
| from h2integrate.core.utilities import build_time_series_from_plant_config | ||
| from h2integrate.core.file_utils import load_yaml | ||
| from h2integrate.core.h2integrate_model import H2IntegrateModel | ||
|
|
||
|
|
||
| # Create and setup the H2Integrate model | ||
| model = H2IntegrateModel("33_peak_load_management.yaml") | ||
|
|
||
| model.setup() | ||
|
|
||
| model.run() | ||
|
|
||
| plant_config = load_yaml("plant_config.yaml") | ||
| supervisor_demand = np.asarray( | ||
| load_yaml("demand_profiles/demand_profile_supervisor.yaml"), dtype=float | ||
| ) | ||
| secondary_demand = np.asarray( | ||
| load_yaml("demand_profiles/demand_profile_secondary.yaml"), dtype=float | ||
| ) | ||
|
|
||
| time_series = build_time_series_from_plant_config(plant_config) | ||
|
|
||
| # Example profiles may be shorter than the simulation horizon; plot over shared length. | ||
| n_plot = min(len(time_series), len(supervisor_demand), len(secondary_demand)) | ||
| time_plot = time_series[:n_plot] | ||
|
|
||
| fig, ax = plt.subplots(4, 1, sharex=True) | ||
|
|
||
| ax[0].plot(time_plot, supervisor_demand[:n_plot] * 1e-3, label="Supervisory demand (MW)") | ||
| ax[0].plot(time_plot, secondary_demand[:n_plot] * 1e-3, label="Secondary demand (MW)") | ||
| ax[0].set_ylabel("Power (MW)") | ||
| ax[0].legend(loc="upper right") | ||
|
|
||
| ax[1].plot(time_plot, model.prob.get_val("battery.SOC", units="percent")) | ||
| ax[1].set(ylabel="SOC") | ||
|
|
||
| ax[2].plot(time_plot, secondary_demand[:n_plot] * 1e-3, label="Original demand (MW)") | ||
| ax[2].plot( | ||
| time_plot, | ||
| model.prob.get_val("battery.electricity_out", units="MW"), | ||
| label="Battery charge/discharge", | ||
| ) | ||
| ax[2].set(ylabel="Power (MW)") | ||
| ax[2].legend() | ||
|
|
||
| ax[3].plot(time_plot, secondary_demand[:n_plot] * 1e-3, label="Original demand (MW)") | ||
| ax[3].plot( | ||
| time_plot, | ||
| model.prob.get_val("battery.unmet_electricity_demand_out", units="MW"), | ||
| label="New demand profile", | ||
| ) | ||
| ax[3].set(ylabel="Power (MW)") | ||
| ax[3].legend() | ||
|
|
||
|
|
||
| ax[3].tick_params(axis="x", labelrotation=90) | ||
|
|
||
| # import pdb; pdb.set_trace() | ||
| plt.tight_layout() | ||
| plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: technology_config | ||
| description: This plant charges a battery from the grid to reduce peak demand | ||
| technologies: | ||
| battery: | ||
| performance_model: | ||
| model: StoragePerformanceModel | ||
| cost_model: | ||
| model: ATBBatteryCostModel | ||
| control_strategy: | ||
| model: PeakLoadManagementOpenLoopStorageController | ||
| model_inputs: | ||
| shared_parameters: | ||
| commodity: electricity | ||
| commodity_rate_units: kW | ||
| max_charge_rate: 2500.0 # kW/time step, 1, 2.5, or 5 MW | ||
| max_capacity: 10000.0 # kWh, 80 MWh | ||
|
elenya-grant marked this conversation as resolved.
Outdated
|
||
| max_soc_fraction: 0.9 # percent as decimal | ||
| min_soc_fraction: 0.1 # percent as decimal | ||
| init_soc_fraction: 0.9 # percent as decimal | ||
| demand_profile: !include demand_profiles/demand_profile_secondary.yaml | ||
| charge_efficiency: 1.0 # percent as decimal | ||
| discharge_efficiency: 1.0 # percent as decimal | ||
| control_parameters: | ||
|
Collaborator
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. thanks for the comments here! they're helpful! |
||
| max_discharge_rate: 2500.0 # kW/time step | ||
| charge_equals_discharge: true | ||
| demand_profile_supervisor: !include demand_profiles/demand_profile_supervisor.yaml | ||
| dispatch_priority_demand_profile: demand_profile_supervisor | ||
| max_supervisor_events: 2 | ||
|
elenya-grant marked this conversation as resolved.
Outdated
|
||
| max_supervisor_event_period: W | ||
| peak_range: | ||
| start: 12:00:00 | ||
| end: 17:00:00 | ||
| advance_discharge_period: | ||
| units: h | ||
| val: 2 | ||
| delay_charge_period: | ||
| units: h | ||
| val: 4 | ||
| allow_charge_in_peak_range: false | ||
| min_peak_proximity: | ||
| units: h | ||
| val: 4 | ||
| cost_parameters: | ||
| cost_year: 2024 | ||
| energy_capex: 408 # $/kWh # conservative case for 2024 ATB utility scale batteries | ||
| power_capex: 379 # $/kW # conservative case for 2024 ATB utility scale batteries | ||
| opex_fraction: 0.025 # 2.5% percent of capex as per 2024 ATB for utility scale batteries | ||
| grid_buy: | ||
| performance_model: | ||
| model: GridPerformanceModel | ||
| cost_model: | ||
| model: GridCostModel | ||
| model_inputs: | ||
| shared_parameters: | ||
| interconnection_size: 100000 | ||
| cost_parameters: | ||
| cost_year: 2024 | ||
| fixed_interconnection_cost: 0.0 | ||
| interconnection_capex_per_kw: 0.0 | ||
| interconnection_opex_per_kw: 0.0 | ||
| electricity_buy_price: 0.09 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.