Skip to content

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

Closed
elenya-grant wants to merge 19 commits intoNatLabRockies:developfrom
elenya-grant:feedstock_updates
Closed

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

Conversation

@elenya-grant
Copy link
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) and use new naming convention for commodity and the commodity_rate_units. Feedstock model now outputs capacity_factor, annual_commodity_consumed, and total_commodity_consumed.

This PR also allows for the rated capacity of feedstocks and the feedstock price to be swept variables (added these as inputs).

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:

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:

  • Since 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), should we have rated_commodity_production as an output of the FeedstockCostModel (calculated as the max of commodity_out from the FeedstockPerformanceModel and rename the input rated_commodity_production of the FeedstockPerformanceModel to be rated_capacity or something? This means that all the "standard outputs" would be coming from the feedstock cost model (this is because feedstocks are uniquely handled). How I have it right now, values from the feedstock would be accessed like below:
h2i.prob.get_val("ng_feedstock_source.rated_natural_gas_production")
h2i.prob.get_val("ng_feedstock.capacity_factor")
h2i.prob.get_val("ng_feedstock.total_natural_gas_consumed")

But the alternative approach above would allow for:

h2i.prob.get_val("ng_feedstock.rated_natural_gas_production")
h2i.prob.get_val("ng_feedstock.capacity_factor")
h2i.prob.get_val("ng_feedstock.total_natural_gas_consumed")

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

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

Made issue #522 to address incorrect units used in natural gas model. This PR would resolve that issue.

Section 4: Impacted Areas of the Software

Section 4.1: New Files

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

Section 4.2: Modified Files

  • h2integrate/core/feedstocks.py: all models updated to use commodity and commodity_rate_unitsinstead offeedstock_typeandunits`.
    • FeedstockPerformanceConfig: rename attribute names
    • FeedstockPerformanceModel: added rated_commodity_production as an input
    • FeedstockCostConfig: rename attribute names, added optional attribute of commodity_amount_units
    • FeedstockCostModel:
      • added input for price, so the price can be varied in a sweep
      • 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
  • examples/23_solar_wind_ng_demand/tech_config.yaml: updated key names for feedstock shared parameters
  • examples/23_solar_wind_ng_demand/plant_config.yaml: removed site boundaries and year from 'site' - this example is untested by the way!
  • examples/23_solar_wind_ng_demand/flexible_demand_tech_config.yaml: updated key names for feedstock shared parameters
  • examples/16_natural_gas/tech_config.yaml: updated key names for feedstock shared parameters
  • examples/21_iron_mn_to_il/tech_config.yaml: updated key names for feedstock shared parameters

Also updated some files so that natural gas units are in MMBtu/h instead of MMBtu (see Issue #522)

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
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
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
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
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?

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

Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority 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