Skip to content

Ability to use timeseries profiles for finance calcs#725

Merged
elenya-grant merged 16 commits intoNatLabRockies:developfrom
elenya-grant:finance/ts_streams
May 7, 2026
Merged

Ability to use timeseries profiles for finance calcs#725
elenya-grant merged 16 commits intoNatLabRockies:developfrom
elenya-grant:finance/ts_streams

Conversation

@elenya-grant
Copy link
Copy Markdown
Collaborator

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

Ability to use timeseries profiles for finance calcs

This PR attempts to resolve Issue #724.

The basis of this PR is that sometimes a user may want to calculate the finances using a timeseries profile. For example, it was not previously possible to calculate the LCOE using the electricity_out1 profile output from a splitter. This PR introduces the ability to use timeseries profiles with the finance models. This is done through an additional finance subsystem in the finance subgroup that is used upstream of the finance model. This new component is called AdjustedCapacityFactorComp. The user can opt to use one this functionality in a finance subgroup by specifying two variables, use_commodity_stream_timeseries and commodity_stream_output as shown below:

  finance_subgroups:
    electricity_doc:
      commodity: electricity
      commodity_stream: electricity_splitter # name of technology that commodity is output from
      use_commodity_stream_timeseries: true # new variable to flag to use time-series profile
      commodity_stream_output: electricity_out1 # the output of `commodity_stream` tech
      technologies: [wind, doc]

This functionality is showcased in Example 17. Specific feedback for reviewers is outlined in Section 2.

Section 1: Type of Contribution

  • Feature Enhancement
    • Framework
    • New Model
    • Updated Model
    • Tools/Utilities
    • Other (please describe): added flexibility for commodity streams of finance models.
  • 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:

  • Add unit and regression tests for AdjustedCapacityFactorComp
  • Add integration test to ensure that error is thrown if use_commodity_stream_timeseries is True but commodity_stream_output is not input.
  • Update finance documentation

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

Implementation feedback:

Other feedback:

  • Thoughts on variable names (use_commodity_stream_timeseries and commodity_stream_output)? Should commodity_stream_name be commodity_stream_output_name? I intentionally included use_commodity_stream_timeseries (although a lot of the logic in H2I could be handled with just commodity_stream_output) because I wanted users to have to be very clear with what they're doing if they want to use this option.
  • Thoughts on the name of the class AdjustedCapacityFactorComp? Totally open to other naming suggestions.

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

This would resolve issue #724

Section 5: Impacted Areas of the Software

Section 5.1: New Files

  • h2integrate/finances/test/test_finance_components.py: tests for AdjustedCapacityFactorComp

Section 5.2: Modified Files

  • h2integrate/core/h2integrate_model.py
    • create_finance_model(): Updated to see if AdjustedCapacityFactorComp should be added to the finance subgroup.
    • connect_technologies(): Updated to handle connections to finance subgroup based on the commodity stream and whether to use the timeseries or the capacity factor.
  • h2integrate/finances/finances.py: added new component AdjustedCapacityFactorComp
  • examples/17_splitter_wind_doc_h2/plant_config.yaml: Added two finance subgroups to highlight this functionality.
  • pytest examples/test/test_all_examples.py::test_splitter_wind_doc_h2_example: added subtests for the new finance subgroups, functions as an integration test.
  • h2integrate/core/test/test_framework.py: added new test test_use_commodity_stream_timeseries_finances_error
  • docs/user_guide/specifying_finance_parameters.md: updated documentation

Section 6: Additional Supporting Information

Section 7: Test Results, if applicable

@elenya-grant elenya-grant added the ready for review This PR is ready for input from folks label May 4, 2026
Copy link
Copy Markdown
Collaborator

@jaredthomas68 jaredthomas68 left a comment

Choose a reason for hiding this comment

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

I like this, thanks for putting it together so quickly.

Comment thread h2integrate/finances/finances.py
# uniquely named outputs
commodity_output_desc = commodity_output_desc + f"_{finance_group_name}"

if finance_subgroups[subgroup_name]["use_commodity_stream_timeseries"]:
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.

nice error message!

Comment thread h2integrate/core/h2integrate_model.py Outdated
Comment thread h2integrate/core/h2integrate_model.py Outdated
@johnjasa johnjasa requested a review from jaredthomas68 May 5, 2026 15:45
Copy link
Copy Markdown
Collaborator

@johnjasa johnjasa left a comment

Choose a reason for hiding this comment

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

Thanks for your quick and helpful response to @cfrontin's request, @elenya-grant! Really appreciate it. This is good to go from my end, I've just re-requested @jaredthomas68's review. Thanks again!

@kbrunik
Copy link
Copy Markdown
Collaborator

kbrunik commented May 5, 2026

I like the name use_commodity_stream_timeseries. I'd prefer commodity_stream_output to commodity_stream_name in the finance subgroup.

Could you also add a test that ensures that use_commodity_stream_timeseries works for a converter commodity_stream_output as well? I'd assume that for the PEM it would make the LCOH be different values. And if we were really trying to dot our i's and cross our t's we'd add a test one for the LCOE from the wind and that it's the same value.

@elenya-grant
Copy link
Copy Markdown
Collaborator Author

I like the name use_commodity_stream_timeseries. I'd prefer commodity_stream_output to commodity_stream_name in the finance subgroup.

Could you also add a test that ensures that use_commodity_stream_timeseries works for a converter commodity_stream_output as well? I'd assume that for the PEM it would make the LCOH be different values. And if we were really trying to dot our i's and cross our t's we'd add a test one for the LCOE from the wind and that it's the same value.

@kbrunik - I updated the name to commodity_stream_output. Thanks for responding to that requested feedback! I also added your suggested tests into the examples/test/test_all_examples.py::test_splitter_wind_doc_h2_example, this test now tests that:

  • LCOH using hydrogen_out from the electrolyzer is less than LCOH using the capacity factor (which reflects lifetime performance)
  • LCOE using electricity_out from the wind is equal to the LCOE using the capacity factor (since the wind component does not reflect lifetime performance)

@elenya-grant elenya-grant marked this pull request as ready for review May 5, 2026 17:14
Copy link
Copy Markdown
Collaborator

@jaredthomas68 jaredthomas68 left a comment

Choose a reason for hiding this comment

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

One minor test adjustment needed.

The following is non-blocking:

I also think shifting to a nested approach for the "use_commodity_stream_timeseries" etc could help extend this capability to allow for degradation adjustment over time:

use_commodity_stream_timeseries:
    commodity_stream_output: "name" # should default to None to make the boolean unnecessary
    commodity_stream_degradation: 0.05 # decrease by 5% each year - note that I'm not set on naming or usage, just some thoughts.

This would also make the boolean unnecessary.

Comment thread h2integrate/core/test/test_framework.py
@elenya-grant elenya-grant requested a review from jaredthomas68 May 6, 2026 20:29
Copy link
Copy Markdown
Collaborator

@jaredthomas68 jaredthomas68 left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

@elenya-grant elenya-grant enabled auto-merge (squash) May 6, 2026 22:01
@elenya-grant elenya-grant merged commit 598a341 into NatLabRockies:develop May 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review This PR is ready for input from folks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants