-
Notifications
You must be signed in to change notification settings - Fork 33
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
Open
jaredthomas68
wants to merge
56
commits into
NatLabRockies:develop
Choose a base branch
from
jaredthomas68:peakload
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
56 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 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
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
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
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
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 |
|---|---|---|
|
|
@@ -2,9 +2,10 @@ | |
| # Open-Loop Controllers | ||
|
|
||
| ## Open-Loop Storage Controllers | ||
| The open-loop storage controllers can be attached as the control strategy in the `tech_config` for various storage converters (e.g., battery or hydrogen storage). There are two controller types for storage: | ||
| 1. Pass-through Controller - passes the commodity flow to the output without any modification | ||
| 2. Demand Open-Loop Storage Controller - uses simple logic to attempt to meet demand using the storage technology. | ||
| The open-loop storage controllers can be attached as the control strategy in the `tech_config` for various storage converters (e.g., battery or hydrogen storage). There are three controller types for storage: | ||
| 1. [Simple Open-Loop Storage Controller](#pass-through-controller) — passes the commodity flow to the output with only minimal or no modifications. | ||
| 2. [Demand Open-Loop Storage Controller](#demand-open-loop-storage-controller) — uses simple logic to attempt to meet demand using the storage technology. | ||
| 3. [Peak Load Management Open-Loop Storage Controller](#peak-load-management-open-loop-storage-controller) — computes a peak-shaving dispatch schedule to reduce demand peaks, supporting one or two demand profiles with configurable event limits and time windows. | ||
|
|
||
| (pass-through-controller)= | ||
| ### Simple Open-Loop Storage Controller | ||
|
|
@@ -26,3 +27,98 @@ An example of an N2 diagram for a system using the open-loop control framework f | |
| For examples of how to use the `DemandOpenLoopStorageController` open-loop control framework, see the following: | ||
| - `examples/14_wind_hydrogen_dispatch/` | ||
| - `examples/19_simple_dispatch/` | ||
|
|
||
| (peak-load-management-open-loop-storage-controller)= | ||
| ### Peak Load Management Open-Loop Storage Controller | ||
| The `PeakLoadManagementOpenLoopStorageController` computes and executes a peak-shaving dispatch schedule assuming perfect forecasting. It is designed for reducing peak loads, not meeting a specific demand, using either one or two loads for determining peaks. | ||
|
|
||
| The controller supports two demand profiles: | ||
|
|
||
| - **`demand_profile`** — the local or sub-system demand. Peaks within a configurable daily time window (`peak_range`) are identified as candidate discharge targets. | ||
| - **`demand_profile_2`** — an optional upstream or supervisory demand. When provided, an operator can override the local peak schedule up to a configurable number of events per period (e.g., three times per week). Peaks are determined as the highest n peaks in each period. | ||
|
|
||
| The `dispatch_priority_demand_profile` parameter selects which profile acts as the override schedule. On days where the priority profile flags a peak, the controller follows that schedule; on all other days it falls back to the other profile. | ||
|
|
||
| **Dispatch logic (state machine)** | ||
|
|
||
| 1. **Discharge** — begins `advance_discharge_period` before the next scheduled peak and runs until `min_soc_fraction` is reached. | ||
| 2. **Charge** — resumes after `delay_charge_period` has elapsed since the end of discharge, subject to the `allow_charge_in_peak_range` flag which can block recharging during the peak windows. | ||
| 3. **Idle** — all other timesteps; set-point is zero. | ||
|
|
||
| An example output for the first week of a one-year simulation is shown below. Orange shading marks the 12:00–19:00 daily peak window. The top panel shows both demand profiles; the second panel shows battery state of charge; the third shows battery charge/discharge power; the fourth shows the resulting net demand. | ||
|
|
||
|  | ||
|
|
||
| For an example of how to use the `PeakLoadManagementOpenLoopStorageController`, see: | ||
| - `examples/33_peak_load_management/` | ||
|
|
||
| #### Configuration | ||
| The controller is defined within the `tech_config` and requires the shared storage parameters plus a `control_parameters` block: | ||
|
|
||
| **Storage system parameters used by the controller** | ||
|
|
||
| | Field | Type | Description | | ||
| | --- | --- | --- | | ||
| | `commodity` | `str` | Commodity name (e.g., `electricity`). | | ||
| | `commodity_rate_units` | `str` | Rate units (e.g., `kW`). | | ||
| | `demand_profile` | scalar or list | Local demand timeseries. | | ||
| | `max_capacity` | `float` | Storage capacity in commodity amount units. | | ||
| | `max_charge_rate` | `float` | Maximum charge rate. | | ||
| | `max_discharge_rate` | `float` | Maximum discharge rate (required if `charge_equals_discharge: false`). | | ||
| | `charge_equals_discharge` | `bool` | If `true`, discharge rate equals `max_charge_rate`. | | ||
| | `max_soc_fraction` | `float` | Upper SOC limit as a fraction (0–1). | | ||
| | `min_soc_fraction` | `float` | Lower SOC limit as a fraction (0–1). | | ||
| | `init_soc_fraction` | `float` | Initial SOC as a fraction (0–1). | | ||
| | `charge_efficiency` | `float` | Charging efficiency (0–1). | | ||
| | `discharge_efficiency` | `float` | Discharging efficiency (0–1). | | ||
|
|
||
| **Control-specific parameters** | ||
|
|
||
| | Field | Type | Description | | ||
| | --- | --- | --- | | ||
| | `demand_profile_2` | scalar, list, or `null` | Optional supervisory/upstream demand timeseries. | | ||
| | `dispatch_priority_demand_profile` | `str` | Which profile controls scheduling: `demand_profile` or `demand_profile_2`. | | ||
| | `n_override_events` | `int \| null` | Maximum supervisory dispatch events allowed per `override_events_period`. | | ||
| | `override_events_period` | `str \| null` | Pandas period alias for resetting the event counter (e.g., `W` for weekly, `M` for monthly). | | ||
| | `peak_range` | `dict` | Daily window for local peak detection. Keys `start` and `end` as `HH:MM:SS` strings. | | ||
| | `advance_discharge_period` | `dict` | Lead time before a peak to start discharging. Keys `units` (e.g., `h`) and `val`. | | ||
| | `delay_charge_period` | `dict` | Wait after discharge before recharging. Keys `units` and `val`. | | ||
| | `allow_charge_in_peak_range` | `bool` | If `false`, charging is blocked during `peak_range`. | | ||
| | `min_peak_proximity` | `dict` | Minimum separation between retained peak events. Keys `units` and `val`. | | ||
|
|
||
| ```yaml | ||
| control_strategy: | ||
| model: PeakLoadManagementOpenLoopStorageController | ||
| model_inputs: | ||
| shared_parameters: | ||
| commodity: electricity | ||
| commodity_rate_units: kW | ||
| max_charge_rate: 300.0 | ||
| max_capacity: 1200.0 | ||
| max_soc_fraction: 0.9 | ||
| min_soc_fraction: 0.1 | ||
| init_soc_fraction: 0.9 | ||
| demand_profile: !include demand_profile.yaml | ||
| charge_efficiency: 1.0 | ||
| discharge_efficiency: 1.0 | ||
| control_parameters: | ||
| max_discharge_rate: 300.0 | ||
| charge_equals_discharge: true | ||
|
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. can you put some comments next to some of these parameters to explain them? Specifically the ones related to |
||
| demand_profile_2: !include demand_profile_2.yaml | ||
| dispatch_priority_demand_profile: demand_profile_2 | ||
| n_override_events: 3 | ||
| override_events_period: W | ||
| peak_range: | ||
| start: "12:00:00" | ||
| end: "19:00:00" | ||
| advance_discharge_period: | ||
| units: h | ||
| val: 1 | ||
| delay_charge_period: | ||
| units: h | ||
| val: 4 | ||
| allow_charge_in_peak_range: false | ||
| min_peak_proximity: | ||
| units: h | ||
| val: 4 | ||
| ``` | ||
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 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very detailed documentation! Since this section is so detailed - should this be moved to a separate file that's linked in this file? Non-blocking, just a thought!