Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Added a storage performance baseclass model `StoragePerformanceBase` and updated the other storage performance models to inherit it [PR 624](https://github.com/NatLabRockies/H2Integrate/pull/624)
- Modified the calc tilt angle function for pysam solar to support latitudes in the southern hemisphere [PR 646](https://github.com/NatLabRockies/H2Integrate/pull/646)
- Added oxygen production metrics and as outputs to `ECOElectrolyzerPerformanceModel` [PR 642](https://github.com/NatLabRockies/H2Integrate/pull/642)
- Bugfix to allow for one resource to be connected to multiple technologies [PR 655](https://github.com/NatLabRockies/H2Integrate/pull/655)
- 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)

## 0.7.1 [March 13, 2026]
Expand Down
2 changes: 1 addition & 1 deletion h2integrate/core/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def find_file(filename: str | Path, root_folder: str | Path | None = None):
f"the root directory {root_folder}."
)
raise ValueError(
f"Cannot find unique file: found {len(files_cwd)} files relative to cwd, "
f"Cannot find unique file for {filename}: found {len(files_cwd)} files relative to cwd, "
f"{len(files_h2i)} files relative to H2Integrate root directory, "
f"{len(files)} files relative to the root folder."
)
Expand Down
2 changes: 1 addition & 1 deletion h2integrate/core/h2integrate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def connect_technologies(self):
resource_models = {}
for site_grp, site_grp_inputs in self.plant_config["sites"].items():
for resource_key, resource_params in site_grp_inputs.get("resources", {}).items():
resource_models[f"{site_grp}-{resource_key}"] = resource_params
resource_models[f"{site_grp}.{resource_key}"] = resource_params
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a small but impactful change but I can't quite place it since there aren't other changes related to this. Is this the simple bugfix (naming from - to .) and that's all that's needed to enable this? If so, love it! Just making sure I understand.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. resource_source_connections are the first element in the resource_to_tech_connections which are formatted as site.wind_resource. The checks are checking the keys in resource_models against the resource_source_connections - so if they have a different format (like resource_models using dashes) then that makes the comparison fail. Aka - the missing_resource variable would be populated with all the resources because of the difference in formatting.


resource_source_connections = [c[0] for c in resource_to_tech_connections]
# Check if there is a missing resource to tech connection or missing resource model
Expand Down
27 changes: 27 additions & 0 deletions h2integrate/core/test/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,33 @@ def test_resource_connection_error_missing_resource(temp_dir):
temp_highlevel_yaml.unlink(missing_ok=True)


@pytest.mark.unit
def test_no_resource_connection_error_resource_to_multiple_techs(temp_dir):
# Path to the original plant_config.yaml and high-level yaml in the example directory

driver_config = load_driver_yaml(EXAMPLE_DIR / "08_wind_electrolyzer" / "driver_config.yaml")
tech_config = load_tech_yaml(EXAMPLE_DIR / "08_wind_electrolyzer" / "tech_config.yaml")
plant_config = load_plant_yaml(EXAMPLE_DIR / "08_wind_electrolyzer" / "plant_config.yaml")
# Add a second wind technology
wind_tech = tech_config["technologies"]["wind"]
tech_config["technologies"].update({"wind_plant2": wind_tech})
resource_to_tech_connections = [
["site.wind_resource", "wind", "wind_resource_data"],
["site.wind_resource", "wind_plant2", "wind_resource_data"],
]
plant_config["resource_to_tech_connections"] = resource_to_tech_connections
input_config = {
"plant_config": plant_config,
"technology_config": tech_config,
"driver_config": driver_config,
}
h2i_model = H2IntegrateModel(input_config)
h2i_model.setup()
# Need to call final_setup to trigger the potential error related to the resource connections
h2i_model.prob.final_setup()
assert True


@pytest.mark.unit
def test_reports_turned_off(temp_dir):
# Path to the original config files in the example directory
Expand Down
Loading