Skip to content

Bugfix to technology_graph and other minor fixes - #823

Merged
johnjasa merged 8 commits into
NatLabRockies:developfrom
elenya-grant:fix/tech_graph
Aug 5, 2026
Merged

Bugfix to technology_graph and other minor fixes#823
johnjasa merged 8 commits into
NatLabRockies:developfrom
elenya-grant:fix/tech_graph

Conversation

@elenya-grant

@elenya-grant elenya-grant commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Bugfix to technology_graph and other minor fixes

This PR has two bug-fixes that were not caught earlier because those use-cases are not yet possible with the technologies in H2I or they were not tested. The main bug-fix has to do with adding the commodity attribute to edges when creating the technology_graph. The commodity attribute was added as a string. In cases where multiple commodities are passed from one technology to another, this string is over-written. The technology graph should have not worked properly if there was a connection like below:

- [electrolyzer, fake_system, hydrogen, pipe]
- [electrolyzer, fake_system, oxygen, pipe]

Now - the edge attribute of the technology graph may be a string or a list, to prevent it getting overwritten.

Another minor fix/update was make to H2IntegrateModel.create_slc_topology to ensure that the slc_topology only contains information about technologies that are upstream and have a path to the demand component. This was a minor change in the tech_control_classifiers and tech_to_commodity inputs to the slc_topology dictionary.

These changes were motivated by some of the work and testing done in PR #816

Section 1: Type of Contribution

  • Feature Enhancement
    • Framework
    • New Model
    • Updated Model
    • Tools/Utilities
    • Other (please describe):
  • Bug Fix
  • Documentation Update
  • CI Changes
  • Other (please describe):

Section 2: Draft PR Checklist

  • Open draft PR
  • Describe the feature that will be added
  • Fill out TODO list steps
  • Describe requested feedback from reviewers on draft PR
  • Complete Section 7: New Model Checklist (if applicable)

TODO:

  • Update the relevant method in SLCBaseClass and add test for it with the multi-commodity situation.

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

Implementation feedback:

  • should we just make the edge attribute always be a list even if a single commodity is being passed through? This could simplify some of the logic for checking the edges for both if its a string and if its a list.

Other feedback:

Section 3: General PR Checklist

  • PR description thoroughly describes the new feature, bug fix, etc.
  • Added tests for new functionality or bug fixes
  • Tests pass (If not, and this is expected, please elaborate in the Section 6: Test Results)
  • Documentation
    • Docstrings are up-to-date
    • Related docs/ files are up-to-date, or added when necessary
    • Documentation has been rebuilt successfully
    • Examples have been updated (if applicable)
  • CHANGELOG.md
    • At least one complete sentence has been provided to describe the changes made in this PR
    • After the above, a hyperlink has been provided to the PR using the following format:
      "A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
      XYZ should be replaced with the actual number.

Section 4: Related Issues

Section 5: Impacted Areas of the Software

Section 5.1: New Files

  • path/to/file.extension
    • method1: What and why something was changed in one sentence or less.

Section 5.2: Modified Files

  • H2IntegrateModel in h2integrate/core/h2integrate_model.py
    • create_technology_graph(): updated to account for multiple commodities being connected between two technologies
    • _classify_slc_technologies(): updated to account for change in create_technology_graph and also bugfix to only include tech info for techs upstream and with a path to the demand component for all information contained in the slc_topology
  • h2integrate/core/test/test_slc_framework.py::test_slc_topology_fake_complex_system: new test that uses a fake system where multiple commodities are connected between the electrolyzer and haber Bosch system
  • h2integrate/core/test/inputs/tech_connection_cases.yaml
  • SystemLevelControlBase in h2integrate/control/control_strategies/system_level/system_level_control_base.py
    • get_upstream_techs_for_commodity: updated to work for update to tech graph

Section 6: Additional Supporting Information

Section 7: Test Results, if applicable

@johnjasa johnjasa left a comment

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.

Thanks for this, Elenya! I pushed up some changes directly. Please update the changelog, otherwise this is good to come in. Let me know if you want a re-review after you make any more changes.

@elenya-grant
elenya-grant marked this pull request as ready for review August 4, 2026 23:23
@elenya-grant
elenya-grant marked this pull request as draft August 4, 2026 23:25
@elenya-grant

Copy link
Copy Markdown
Collaborator Author

@johnjasa I updated the changelog but I'm gonna play around with it a bit but will mark is ready for review once I'm done!

@elenya-grant
elenya-grant marked this pull request as ready for review August 5, 2026 00:02
@johnjasa
johnjasa merged commit 7b94d82 into NatLabRockies:develop Aug 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants