-
Notifications
You must be signed in to change notification settings - Fork 41
Converter PLM dispatch #773
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
19ff6e1
d026a8a
c653a77
c1564c2
1d80254
bcd95c2
d58cbf9
0f99537
3d7dc9c
3b2fdfd
eafbf14
d885c12
b964811
19b84f9
6193c9a
1602280
2afd03b
6296b1a
c124ecb
b4f54ba
7b8c33a
8bc1616
d0abe9f
6c5caed
e09472a
fd466c6
02ea362
c448201
eb2502d
8989520
c418808
6aaba79
c513199
201eb25
98609d7
fc8c4c2
bbb42bd
fd8bb7c
61a327a
b5f0c1b
fa4b8c4
fcc4ed6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| name: driver_config | ||
| description: Driver configuration for peak load management converter heuristic control | ||
| general: | ||
| folder_output: outputs | ||
| create_om_reports: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: plant_config | ||
| description: Plant configuration for peak load management converter heuristic control | ||
| plant: | ||
| plant_life: 30 | ||
| simulation: | ||
| n_timesteps: 8760 | ||
| dt: 3600 | ||
| timezone: -6 | ||
| start_time: 2025/07/01 00:00:00 | ||
| technology_interconnections: | ||
| - [hydrogen_feedstock, fuel_cell, hydrogen, pipe] | ||
| - [fuel_cell, electrical_load_demand, [electricity_out, electricity_in]] | ||
| - [electrical_load_demand, grid_buy, [unmet_electricity_demand_out, electricity_set_point]] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| """ | ||
| Example 33: Peak load management converter heuristic dispatch | ||
|
|
||
| This example demonstrates peak load management dispatch open loop control of a converter | ||
| with two demand profiles of interest | ||
|
|
||
| In this example, the fuel-cell converter command is determined by a simple open-loop | ||
| threshold heuristic that uses two profiles: | ||
|
|
||
| 1. demand_profile (local set-point) | ||
| 2. demand_profile_upstream (supervisory or upstream signal) | ||
|
|
||
| At each time step, dispatch is only considered when either profile exceeds its configured | ||
| cutoff. For electricity-mode upstream control, the commanded dispatch is based on the | ||
| larger exceedance of the two profiles and is then limited by both the instantaneous local | ||
| demand and converter capacity. This creates a peak-shaving command profile for the | ||
| converter without storage state-of-charge dynamics or optimization. | ||
|
|
||
| The output figure compares the original local demand, upstream demand, cutoff thresholds, | ||
| converter output, resulting unmet demand, and grid purchases. | ||
|
|
||
| """ | ||
|
|
||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
|
|
||
| from h2integrate import H2IntegrateModel | ||
| from h2integrate.core.utilities import build_time_series_from_plant_config | ||
|
|
||
|
|
||
| # Create, setup, and run the H2Integrate model | ||
| model = H2IntegrateModel("33_plm_converter_heuristic.yaml") | ||
|
|
||
| model.setup() | ||
| # om.n2(model.prob) | ||
| model.run() | ||
| model.post_process() | ||
|
|
||
| demand_profile = model.prob.get_val("fuel_cell.electricity_set_point", units="kW") | ||
| # plot the results for the first week | ||
| demand_profile_upstream = np.array( | ||
| model.technology_config["technologies"]["fuel_cell"]["model_inputs"]["control_parameters"][ | ||
| "demand_profile_upstream" | ||
| ] | ||
| ) | ||
| demand_profile_peak_cutoff = model.technology_config["technologies"]["fuel_cell"]["model_inputs"][ | ||
| "control_parameters" | ||
| ]["demand_profile_peak_cutoff"] | ||
| demand_profile_upstream_peak_cutoff = model.technology_config["technologies"]["fuel_cell"][ | ||
| "model_inputs" | ||
| ]["control_parameters"]["demand_profile_upstream_peak_cutoff"] | ||
| grid_output = model.prob.get_val("grid_buy.electricity_out", units="MW") | ||
|
|
||
| time_series = build_time_series_from_plant_config(model.plant_config) | ||
|
|
||
| n_plot = 24 * 7 | ||
| time_plot = time_series[:n_plot] | ||
|
|
||
| fig, ax = plt.subplots(3, 1, sharex=True, figsize=(10, 5)) | ||
| ax[0].plot(time_plot, demand_profile_upstream[:n_plot] * 1e-3, label="Upstream demand") | ||
| ax[0].plot(time_plot, demand_profile[:n_plot] * 1e-3, label="Original demand") | ||
| ax[0].axhline( | ||
| demand_profile_peak_cutoff * 1e-3, label="Demand peak cutoff", color="k", linestyle="--" | ||
| ) | ||
| ax[0].axhline( | ||
| demand_profile_upstream_peak_cutoff * 1e-3, | ||
| label="Upstream demand peak cutoff", | ||
| color="k", | ||
| linestyle=":", | ||
| ) | ||
| ax[0].set(ylabel="Power (MW)", ylim=[-2, 2]) | ||
| ax[0].legend(frameon=True, ncol=3) | ||
|
|
||
| ax[1].plot(time_plot, demand_profile[:n_plot] * 1e-3, label="Original demand (MW)") | ||
| ax[1].plot( | ||
| time_plot, | ||
| model.prob.get_val("fuel_cell.electricity_out", units="MW")[:n_plot], | ||
| label="fuel_cell dispatch", | ||
| ) | ||
| ax[1].set(ylabel="Power (MW)", ylim=[-2, 2]) | ||
| ax[1].legend(frameon=False, ncol=2) | ||
|
|
||
| ax[2].plot(time_plot, demand_profile[:n_plot] * 1e-3, label="Original demand (MW)") | ||
| ax[2].plot( | ||
| time_plot, | ||
| model.prob.get_val("electrical_load_demand.unmet_electricity_demand_out", units="MW")[:n_plot], | ||
| label="New demand profile", | ||
| ) | ||
| ax[2].plot(time_plot, grid_output[:n_plot], label="Grid purchase (MW)", linestyle=":") | ||
|
|
||
| ax[2].set(ylabel="Power (MW)", ylim=[-2, 2]) | ||
| ax[2].legend(frameon=False, ncol=3) | ||
| ax[2].tick_params(axis="x", labelrotation=90) | ||
|
|
||
| for axis in ax: | ||
| axis.minorticks_on() | ||
| axis.grid(True, which="major", alpha=0.45, linewidth=0.8) | ||
| axis.grid(True, which="minor", alpha=0.2, linewidth=0.5) | ||
|
|
||
| plt.tight_layout() | ||
| plt.savefig("example_peak_load_dispatch.png", transparent=False) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: technology_config | ||
| description: This plant dispatches a fuel cell to reduce peak demand | ||
| technologies: | ||
| hydrogen_feedstock: | ||
| performance_model: | ||
| model: FeedstockPerformanceModel | ||
| cost_model: | ||
| model: FeedstockCostModel | ||
| model_inputs: | ||
| shared_parameters: | ||
| commodity: hydrogen | ||
| commodity_rate_units: kg/h | ||
| performance_parameters: | ||
| rated_capacity: 50.0 # kg of H2/hour | ||
| cost_parameters: | ||
| cost_year: 2022 | ||
| price: 5.0 # USD/kg H2 | ||
| annual_cost: 0. | ||
| start_up_cost: 0.0 | ||
| fuel_cell: | ||
| performance_model: | ||
| model: LinearH2FuelCellPerformanceModel | ||
| cost_model: | ||
| model: H2FuelCellCostModel | ||
| control_strategy: | ||
| model: PeakLoadManagementHeuristicOpenLoopConverterController | ||
| model_inputs: | ||
| shared_parameters: | ||
| system_capacity_kw: 1000.0 | ||
| performance_parameters: | ||
| fuel_cell_efficiency_hhv: 0.50 | ||
| uptime_hours_until_eol: 80000 | ||
| cost_parameters: | ||
| capex_per_kw: 200.0 | ||
| fixed_opex_per_kw_per_year: 10.0 | ||
| variable_opex_per_kwh: 0.0 | ||
| cost_year: 2018 | ||
| control_parameters: | ||
| commodity: electricity | ||
| commodity_rate_units: kW | ||
| demand_profile: !include demand_profiles/demand_profile.yaml # found in library/demand_profiles | ||
| demand_profile_upstream: !include demand_profiles/demand_profile_upstream.yaml # found in library/demand_profiles | ||
| demand_profile_peak_cutoff: 400.0 | ||
| demand_profile_upstream_peak_cutoff: 1000.0 | ||
| electrical_load_demand: | ||
| performance_model: | ||
| model: GenericDemandComponent | ||
| model_inputs: | ||
| performance_parameters: | ||
| commodity: electricity | ||
| commodity_rate_units: kW | ||
| demand_profile: !include demand_profiles/demand_profile.yaml # found in library/demand_profiles | ||
| 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 | ||
|
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. I think it could be good to have both peak load management examples (storage and converter) in the same folder
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. Done
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. Let's update name of this file so it's not the same as the storage PLM file.
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. Done |
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| name: driver_config | ||
| description: Driver configuration for peak load management storage heuristic control | ||
| general: | ||
| folder_output: outputs | ||
| create_om_reports: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from h2integrate.control.control_strategies.converters.plm_openloop_converter_controller import ( | ||
| PeakLoadManagementHeuristicOpenLoopConverterController, | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.