Skip to content

Standardize Feedstock Outputs (follow-on to 463)#523

Open
elenya-grant wants to merge 27 commits intoNatLabRockies:developfrom
elenya-grant:feedstock_updates
Open

Standardize Feedstock Outputs (follow-on to 463)#523
elenya-grant wants to merge 27 commits intoNatLabRockies:developfrom
elenya-grant:feedstock_updates

Conversation

@elenya-grant
Copy link
Copy Markdown
Collaborator

@elenya-grant elenya-grant commented Feb 11, 2026

Standardize Feedstock Outputs (follow-on to 463)

Updated feedstock component to have standard outputs (like those output from the PerformanceModelBaseClass). Feedstock model now outputs capacity_factor, annual_commodity_consumed, and total_commodity_consumed. Note that these are output from the FeedstockCostModel, which is due to the special handling of feedstock components.

This PR was re-opened because it seemed relevant for PR #605 so that non-electricity commodities could also be used with the updated dispatch method that is introduced in PR #605.

This PR is ready for high-level feedback, the questions for reviewers are noted in Section 2!

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:

  • depends on reviewer feedback.
  • update feedstocks.md
  • add test of feedstock component integrated with finance model (by adding it to an example)

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

  • Is there any reason why the feedstock standard outputs be following the "produced" naming instead of "consumed"? I think that it makes sense for feedstock standard outputs to be "consumed".

Implementation feedback:

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 has been updated to describe the changes made in this PR

Section 3: Related Issues

Made Issue #659 when creating this PR, this issue is not resolved by this PR

Resolves part of Issue #485 about updates feedstock to have standardized performance

Section 4: Impacted Areas of the Software

Section 4.1: New Files

None

Section 4.2: Modified Files

  • h2integrate/core/feedstocks.py:
    • FeedstockCostModel:
      • added input of commodity_out, which is used as the denominator in the capacity factor calculation
      • added outputs of capacity_factor, annual_commodity_consumed, and total_commodity_consumed
  • examples/test/test_all_examples.py::test_natural_gas_example added subtest for feedstock capacity factor
  • h2integrate/core/test/test_feedstocks.py: added new test test_feedstock_standard_outputs
  • h2integrate/core/h2integrate_model.py
    • H2IntegrateModel.connect_technologies(): added connection to connect commodity_out output of the feedstock performance model to the input commodity_out of the feedstock cost model (this was needed because the FeedstockCostModel and FeedstockPerformanceModel are not part of the same sub-system (they don't have shared inputs/outputs - they're connected using connections, not promoted inputs/outputs))
  • examples/16_natural_gas/tech_config.yaml: added some comments for natural gas feedstock
  • h2integrate/tools/profast_tools.py:
    • make_price_breakdown(): updated so it can handle cases with a zero total capex.
  • examples/12_ammonia_synloop/
    • tech_config.yaml: updated n2_feedstock price to be $5.0/t (instead of 0) or to prevent errors when trying to run profast with zero costs
    • plant_config.yaml: added n2 finance subgroup for integration testing purposes. Removed n2_feedstock from the nh3 technology group so that LCOA doesn't change in tests (before the n2_feedstock had zero cost, but the update to the n2_feedstock price would give a larger LCOA if included). Could instead update the test value if desired.
  • pytest examples/test/test_all_examples.py::test_ammonia_synloop_example: added subtest for LCON

Section 5: Additional Supporting Information

Section 6: Test Results, if applicable

N/A

@elenya-grant elenya-grant added the ready for review This PR is ready for input from folks label Feb 11, 2026
self.commodity_rate_units = self.config.commodity_rate_units

self.add_output(f"{feedstock_type}_out", shape=n_timesteps, units=self.config.units)
# NOTE: should below be renamed to f"{self.commodity}_capacity"?
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.

I'd support that change, it seems more clear

@johnjasa
Copy link
Copy Markdown
Collaborator

Is there any reason why the feedstock standard outputs be following the "produced" naming instead of "consumed"? I think that it makes sense for feedstock standard outputs to be "consumed"

Stick with consumed imo. That's more clear given how we're handling feedstock quantities.

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 this, Elenya! I like the thought you put into the feedstocks setup and how it could be more standard to match other components. I also appreciate you fixing the NG units to be consistently correct.

My blocking request is for you to update feedstocks.md as well. Could you please change that doc so it matches what you've done here, then also add a few words to explain the CF calculation and anything else you introduce here?

f"total_{self.commodity}_consumed"
] * (1 / self.fraction_of_year_simulated)

outputs[f"rated_{self.commodity}_production"] = inputs[f"{self.commodity}_out"].max()
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.

I know I brought this up on a call, but I forget where we landed. Will this assumption (that the rated production is the max of the commodity stream) be limiting in any way? Would this go against users' intuition at some point?

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.

I don't think so - the inputs[f"commodity_out"] is the output from the performance model, which outputs the commodity_out as an array of all the same values. Aka - the max should equal the mean which should equal the "commodity_capacity" input to the performance model.

Comment on lines +154 to +155
# Calculate performance based on consumption

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.

Suggest removing comment as it isn't necessarily helpful

@johnjasa johnjasa closed this Feb 17, 2026
@elenya-grant elenya-grant reopened this Apr 6, 2026
@elenya-grant elenya-grant removed the ready for review This PR is ready for input from folks label Apr 6, 2026
@elenya-grant elenya-grant marked this pull request as ready for review April 7, 2026 22:24
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.

2 participants