Skip to content

Commit 547800d

Browse files
Bugfix: Update storage models so can use different control types per storage type (#615)
* updated logic in pysam batery and generic storage to handle multiple storage types * added tests and bugfix in heuristic with setting efficiencies --------- Co-authored-by: John Jasa <johnjasa11@gmail.com>
1 parent 4576870 commit 547800d

7 files changed

Lines changed: 812 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Bugfix in tests of pyomo control strategies with `StoragePerformanceModel` so that the pathname attribute is correct
2222
- Added `demand_profile` as an input to `StoragePerformanceModel` and `PySAMBatteryPerformanceModel`
2323
- Renamed `xx_charge_fraction` to `xx_soc_fraction`
24+
- Bugfix in `StoragePerformanceModel` and `PySAMBatteryPerformanceModel` for setting control inputs to account for cases with multiple storage technologies with different control strategy types [PR 615](https://github.com/NatLabRockies/H2Integrate/pull/615)
2425
- Bugfix input energy to OAE financial model [PR 617](https://github.com/NatLabRockies/H2Integrate/pull/617)
2526
- Remove `MarineCarbonCapture` base classes
2627

h2integrate/control/control_strategies/heuristic_pyomo_controller.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ def setup(self):
108108
self.max_discharge_fraction = [0.0] * self.config.n_control_window
109109
self._fixed_dispatch = [0.0] * self.config.n_control_window
110110

111-
if self.config.charge_efficiency is not None:
112-
self.charge_efficiency = self.config.charge_efficiency
113-
if self.config.discharge_efficiency is not None:
114-
self.discharge_efficiency = self.config.discharge_efficiency
115-
116111
def pyomo_setup(self, discrete_inputs):
117112
"""Create the Pyomo model, attach per-tech Blocks, and return dispatch solver.
118113
@@ -248,6 +243,11 @@ def pyomo_dispatch_solver(
248243
def initialize_parameters(self, inputs):
249244
"""Initializes parameters."""
250245

246+
if self.config.charge_efficiency is not None:
247+
self.charge_efficiency = self.config.charge_efficiency
248+
if self.config.discharge_efficiency is not None:
249+
self.discharge_efficiency = self.config.discharge_efficiency
250+
251251
self.minimum_storage = 0.0
252252
self.maximum_storage = inputs["storage_capacity"][0]
253253
self.minimum_soc = self.config.min_soc_fraction

h2integrate/control/control_strategies/storage/simple_openloop_controller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def setup(self):
6767
self.config = SimpleStorageOpenLoopControllerConfig.from_dict(
6868
merge_shared_inputs(self.options["tech_config"]["model_inputs"], "control"),
6969
additional_cls_name=self.__class__.__name__,
70+
strict=False,
7071
)
7172

7273
self.n_timesteps = self.options["plant_config"]["plant"]["simulation"]["n_timesteps"]

h2integrate/control/test/test_heuristic_with_generic_storage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def plant_config():
2323
},
2424
},
2525
"tech_to_dispatch_connections": [
26+
["combiner", "h2_storage"],
2627
["h2_storage", "h2_storage"],
2728
],
2829
}
@@ -47,12 +48,12 @@ def tech_config_generic():
4748
"min_soc_fraction": 0.1,
4849
"commodity": "hydrogen",
4950
"commodity_rate_units": "kg/h",
51+
"charge_efficiency": 1.0,
52+
"discharge_efficiency": 1.0,
5053
},
5154
"performance_parameters": {
5255
"charge_equals_discharge": True,
5356
"commodity_amount_units": "kg",
54-
"charge_efficiency": 1.0,
55-
"discharge_efficiency": 1.0,
5657
"demand_profile": 0.0,
5758
},
5859
"control_parameters": {

0 commit comments

Comments
 (0)