Skip to content

Commit ca295e4

Browse files
elenya-grantjohnjasaRHammond2kbrunik
authored
Check for extraneous or mis-categorized input parameters (#647)
* added dictionary utilities * bugfix in setup() and added start of a test * added fix to calling check_inputs * fixed check_inputs * added another check in check_inputs * updated error messages in check_inputs and fixed example 1 * Added tests * added another subtest to test_check_inputs * fixed tech configs for examples * added some inline comments * check for requisite models and return if none * perform check from note and collapse checking logic * collapse user input regeneration to reduce number of loops * remove nested looping approach * move assert to proper context manager level * add indent level back * fix min combinations logic for passing tests * flatten improperly shared parameterization checking logic * update test to include multiple categories for improperly shared * fix typo * update docstring * added handling for combined cost and performance models * Added tech config fpath to the error messages for parameter checking * changlog * changed strict to True for six converter models * reverted strict setting for electrolyzer --------- Co-authored-by: John Jasa <johnjasa11@gmail.com> Co-authored-by: Hammond, Rob <13874373+RHammond2@users.noreply.github.com> Co-authored-by: kbrunik <kbrunik@gmail.com>
1 parent e10c892 commit ca295e4

17 files changed

Lines changed: 372 additions & 54 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- Added oxygen production metrics and as outputs to `ECOElectrolyzerPerformanceModel` [PR 642](https://github.com/NatLabRockies/H2Integrate/pull/642)
3636
- Bugfix to allow for one resource to be connected to multiple technologies [PR 655](https://github.com/NatLabRockies/H2Integrate/pull/655)
3737
- Removed the last of the logic that was based on technology names rather than model classes [PR 654](https://github.com/NatLabRockies/H2Integrate/pull/654)
38+
- Add input checking for extraneous or mis-categorized input parameters for technologies that have a defined control strategy or dispatch rule set [PR 647](https://github.com/NatLabRockies/H2Integrate/pull/647)
3839
- Bumps the `coin-or-cbc` dependency to at least 2.10.12 to enable easy Windows compatibility. [PR 590](https://github.com/NatLabRockies/H2Integrate/pull/590)
3940
- Uses the optional installation parameter `extras` to combine all analysis extras, and remove them
4041
from the `develop` options. [PR 590](https://github.com/NatLabRockies/H2Integrate/pull/590)

examples/01_onshore_steel_mn/tech_config.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ technologies:
6060
dispatch_rule_set:
6161
model: PyomoDispatchGenericConverter
6262
model_inputs:
63-
performance_parameters:
64-
commodity: electricity
65-
commodity_rate_units: kW
66-
dispatch_rule_parameters:
63+
shared_parameters:
6764
commodity: electricity
6865
commodity_rate_units: kW
6966
battery:
@@ -81,20 +78,20 @@ technologies:
8178
commodity_rate_units: kW
8279
max_charge_rate: 375740.4 # kW
8380
max_capacity: 375745.2 # kWh
84-
n_control_window: 24
8581
init_soc_fraction: 0.9
8682
max_soc_fraction: 1.0
8783
min_soc_fraction: 0.2
88-
system_commodity_interface_limit: 1e12
8984
performance_parameters:
90-
system_model_source: pysam
9185
chemistry: LFPGraphite
9286
demand_profile: 720000 # 720 MW
9387
cost_parameters:
9488
cost_year: 2019
9589
energy_capex: 310 # $/kWh from 2024 ATB year 2025
9690
power_capex: 311 # $/kW from 2024 ATB year 2025
9791
opex_fraction: 0.024999840573439444
92+
control_parameters:
93+
system_commodity_interface_limit: 1e12
94+
n_control_window: 24
9895
electrolyzer:
9996
performance_model:
10097
model: ECOElectrolyzerPerformanceModel
@@ -128,12 +125,12 @@ technologies:
128125
commodity: hydrogen
129126
commodity_rate_units: kg/h
130127
set_demand_as_avg_commodity_in: true
128+
commodity_amount_units: kg
131129
performance_parameters:
132130
min_soc_fraction: 0.0
133131
max_soc_fraction: 1.0
134132
charge_efficiency: 1.0
135133
discharge_efficiency: 1.0
136-
commodity_amount_units: kg
137134
cost_parameters:
138135
# since the storage is being auto-sized by the performance model,
139136
# we set the sizing mode to 'auto' rather than defining the capacities

examples/02_texas_ammonia/tech_config.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ technologies:
6060
dispatch_rule_set:
6161
model: PyomoDispatchGenericConverter
6262
model_inputs:
63-
performance_parameters:
64-
commodity: electricity
65-
commodity_rate_units: kW
66-
dispatch_rule_parameters:
63+
shared_parameters:
6764
commodity: electricity
6865
commodity_rate_units: kW
6966
battery:
@@ -81,20 +78,20 @@ technologies:
8178
commodity_rate_units: kW
8279
max_charge_rate: 96.0 # kW
8380
max_capacity: 96.0 # kWh
84-
n_control_window: 24
8581
init_soc_fraction: 0.9
8682
max_soc_fraction: 1.0
8783
min_soc_fraction: 0.2
88-
system_commodity_interface_limit: 1e12
8984
performance_parameters:
90-
system_model_source: pysam
9185
chemistry: LFPGraphite
9286
demand_profile: 640000 # 640 MW
9387
cost_parameters:
9488
cost_year: 2019
9589
energy_capex: 310 # $/kWh from 2024 ATB year 2025
9690
power_capex: 311 # $/kW from 2024 ATB year 2025
9791
opex_fraction: 0.025
92+
control_parameters:
93+
system_commodity_interface_limit: 1e12
94+
n_control_window: 24
9895
electrolyzer:
9996
performance_model:
10097
model: ECOElectrolyzerPerformanceModel
@@ -127,13 +124,13 @@ technologies:
127124
shared_parameters:
128125
commodity: hydrogen
129126
commodity_rate_units: kg/h
127+
commodity_amount_units: kg
130128
set_demand_as_avg_commodity_in: true
131129
performance_parameters:
132130
min_soc_fraction: 0.0
133131
max_soc_fraction: 1.0
134132
charge_efficiency: 1.0
135133
discharge_efficiency: 1.0
136-
commodity_amount_units: kg
137134
cost_parameters:
138135
# since the storage is being auto-sized by the performance model,
139136
# we set the sizing mode to 'auto' rather than defining the capacities

examples/09_co2/direct_ocean_capture/tech_config.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ technologies:
99
dispatch_rule_set:
1010
model: PyomoDispatchGenericConverter
1111
model_inputs:
12-
shared_parameters:
13-
cost_year: 2022
1412
performance_parameters:
1513
cache_dir: cache
1614
enable_caching: true
1715
hopp_config: !include tech_inputs/hopp_config.yaml
16+
cost_year: 2022
1817
dispatch_rule_parameters:
1918
commodity: electricity
2019
commodity_rate_units: kW
@@ -53,10 +52,7 @@ technologies:
5352
dispatch_rule_set:
5453
model: PyomoDispatchGenericConverter
5554
model_inputs:
56-
performance_parameters:
57-
commodity: electricity
58-
commodity_rate_units: kW
59-
dispatch_rule_parameters:
55+
shared_parameters:
6056
commodity: electricity
6157
commodity_rate_units: kW
6258
battery:
@@ -74,20 +70,20 @@ technologies:
7470
commodity_rate_units: kW
7571
max_charge_rate: 50000 # kW
7672
max_capacity: 200000 # kWh
77-
n_control_window: 24
7873
init_soc_fraction: 0.9
7974
max_soc_fraction: 1.0
8075
min_soc_fraction: 0.2
81-
system_commodity_interface_limit: 1e12
8276
performance_parameters:
83-
system_model_source: pysam
8477
chemistry: LFPGraphite
8578
demand_profile: 340000 # 340 MW
8679
cost_parameters:
8780
cost_year: 2022
8881
energy_capex: 246 # $/kWh from 2024 ATB year 2025
8982
power_capex: 317 # $/kW from 2024 ATB year 2025
9083
opex_fraction: 0.02536510376633359
84+
control_parameters:
85+
n_control_window: 24
86+
system_commodity_interface_limit: 1e12
9187
doc:
9288
performance_model:
9389
model: DOCPerformanceModel

examples/09_co2/ocean_alkalinity_enhancement/tech_config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,20 @@ technologies:
5050
commodity_rate_units: kW
5151
max_charge_rate: 50000 # kW
5252
max_capacity: 200000 # kWh
53-
n_control_window: 24
5453
init_soc_fraction: 0.9
5554
max_soc_fraction: 1.0
5655
min_soc_fraction: 0.2
57-
system_commodity_interface_limit: 1e12
5856
performance_parameters:
59-
system_model_source: pysam
6057
chemistry: LFPGraphite
6158
demand_profile: 330000 # 330 MW
6259
cost_parameters:
6360
cost_year: 2022
64-
commodity_units: kW
6561
energy_capex: 246 # $/kWh from 2024 ATB year 2025
6662
power_capex: 317 # $/kW from 2024 ATB year 2025
6763
opex_fraction: 0.02536510376633359
64+
control_parameters:
65+
n_control_window: 24
66+
system_commodity_interface_limit: 1e12
6867
oae:
6968
performance_model:
7069
model: OAEPerformanceModel

examples/12_ammonia_synloop/tech_config.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ technologies:
6060
dispatch_rule_set:
6161
model: PyomoDispatchGenericConverter
6262
model_inputs:
63-
performance_parameters:
64-
commodity: electricity
65-
commodity_rate_units: kW
66-
dispatch_rule_parameters:
63+
shared_parameters:
6764
commodity: electricity
6865
commodity_rate_units: kW
6966
battery:
@@ -81,20 +78,20 @@ technologies:
8178
commodity_rate_units: kW
8279
max_charge_rate: 96.0 # kW
8380
max_capacity: 96.0 # kWh
84-
n_control_window: 24
8581
init_soc_fraction: 0.9
8682
max_soc_fraction: 1.0
8783
min_soc_fraction: 0.2
88-
system_commodity_interface_limit: 1e12
8984
performance_parameters:
90-
system_model_source: pysam
9185
chemistry: LFPGraphite
9286
demand_profile: 640000 # 640 MW
9387
cost_parameters:
9488
cost_year: 2019
9589
energy_capex: 310 # $/kWh from 2024 ATB year 2025
9690
power_capex: 311 # $/kW from 2024 ATB year 2025
9791
opex_fraction: 0.025
92+
control_parameters:
93+
n_control_window: 24
94+
system_commodity_interface_limit: 1e12
9895
electrolyzer:
9996
performance_model:
10097
model: ECOElectrolyzerPerformanceModel
@@ -127,13 +124,13 @@ technologies:
127124
shared_parameters:
128125
commodity: hydrogen
129126
commodity_rate_units: kg/h
127+
commodity_amount_units: kg
130128
set_demand_as_avg_commodity_in: true
131129
performance_parameters:
132130
min_soc_fraction: 0.0
133131
max_soc_fraction: 1.0
134132
charge_efficiency: 1.0
135133
discharge_efficiency: 1.0
136-
commodity_amount_units: kg
137134
cost_parameters:
138135
# since the storage is being auto-sized by the performance model,
139136
# we set the sizing mode to 'auto' rather than defining the capacities

examples/18_pyomo_heuristic_dispatch/tech_config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ technologies:
4848
commodity_rate_units: kW
4949
max_charge_rate: 100000
5050
max_capacity: 500000
51-
n_control_window: 24
5251
init_soc_fraction: 0.5
5352
max_soc_fraction: 0.9
5453
min_soc_fraction: 0.1
55-
system_commodity_interface_limit: 1e12
5654
performance_parameters:
57-
system_model_source: pysam
5855
chemistry: LFPGraphite
5956
demand_profile: 50000 # 50 MW
6057
cost_parameters:
6158
cost_year: 2022
6259
energy_capex: 310 # $/kWh from 2024 ATB year 2025
6360
power_capex: 311 # $/kW from 2024 ATB year 2025
6461
opex_fraction: 0.25 # 0.25% of capex per year from 2024 ATB
62+
control_parameters:
63+
n_control_window: 24
64+
system_commodity_interface_limit: 1e12

examples/30_pyomo_optimized_dispatch/tech_config.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,13 @@ technologies:
4343
model: ATBBatteryCostModel
4444
model_inputs:
4545
shared_parameters:
46-
commodity: electricity
4746
max_charge_rate: 100000
4847
max_capacity: 400000
4948
init_soc_fraction: 0.5 # Initial SOC for the storage
5049
max_soc_fraction: 0.9 # Maximum SOC allowable for the storage technology
5150
min_soc_fraction: 0.1 # Minimum SOC allowable for the storage technology
52-
system_commodity_interface_limit: 1e12
53-
charge_efficiency: 0.95 # Charge efficiency of the storage technology
54-
discharge_efficiency: 0.95 # Discharge efficiency of the storage technology
5551
commodity_rate_units: kW
56-
# rated_demand: 100000 # in kW
5752
performance_parameters:
58-
system_model_source: pysam
5953
chemistry: LFPGraphite
6054
demand_profile: 100000 # 100 MW
6155
cost_parameters:
@@ -64,9 +58,13 @@ technologies:
6458
power_capex: 311 # $/kW from 2024 ATB year 2025
6559
opex_fraction: 0.25 # 0.25% of capex per year from 2024 ATB
6660
control_parameters:
61+
commodity: electricity
62+
charge_efficiency: 0.95 # Charge efficiency of the storage technology
63+
discharge_efficiency: 0.95 # Discharge efficiency of the storage technology
6764
cost_per_charge: 0.03 # in $/kW, cost to charge the storage (note that charging is incentivized)
6865
cost_per_discharge: 0.05 # in $/kW, cost to discharge the storage
6966
commodity_met_value: 0.1 # in $/kW, penalty for not meeting the desired load demand
7067
cost_per_production: 0.0 # in $/kW, cost to use the incoming produced commodity (i.e. electricity from wind)
7168
time_weighting_factor: 0.995 # This parameter discounts each subsequent time step incrementally in the future in the horizon window by this amount
7269
n_control_window: 24 # in timesteps (currently hours), The length of time that the control is applied to in the rolling window optimization
70+
system_commodity_interface_limit: 1e12

h2integrate/converters/hopp/hopp_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def initialize(self):
3737
def setup(self):
3838
self.config = HOPPComponentModelConfig.from_dict(
3939
merge_shared_inputs(self.options["tech_config"]["model_inputs"], "performance"),
40-
strict=False,
40+
strict=True,
4141
additional_cls_name=self.__class__.__name__,
4242
)
4343

h2integrate/converters/iron/iron_dri_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def setup(self):
327327

328328
self.config = IronReductionCostBaseConfig.from_dict(
329329
config_dict,
330-
strict=False,
330+
strict=True,
331331
additional_cls_name=self.__class__.__name__,
332332
)
333333

0 commit comments

Comments
 (0)