Skip to content

Conversation

@jmartin4u
Copy link
Collaborator

@jmartin4u jmartin4u commented Jan 2, 2026

Example with independently sized mine and iron/steel plant

This PR changes the iron example (#21) so that the iron_mine can be realistically large and produce a large iron_ore_out stream that is not entirely consumed by the downstream iron_plant. This allows the price_iron_ore to be calculated separately in its own financial subgroup, then passed to the iron_plant via a feedstock. To achieve this, I exposed the price config variable in the feedstock model as an OpenMDAO input.

This is still a draft PR because there is one issue that needs to be resolved: When iron_transport is connected to an iron_ore feedstock, it calculates its cost based on the iron_ore_in connected to the iron_ore_out from the feedstock, which is calculated in the feedstock performance model as the full rated_capacity. The iron_transport needs its iron_ore_in to instead be connected to the iron_ore_consumed from the iron_plant, but I'm not sure how to do this. I think it is only an issue when transporters themselves are calculating cost per unit of the feedstock transported - it doesn't crop up when we are just using simple pass-through pipe and cable transporters. I think @elenya-grant is probably the best person for this and tagged her in the TODO list

At the same time I am working in a doc page for iron_mine which was missing. If it's not cramming too much into one PR, it would be great if @kbrunik could write a doc page for iron_dri_plant too.

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:

  • @elenya-grant I need to resolve how to calculate accurate iron_transport costs using a feedstock.
  • @kbrunik Can you write a doc page iron_plant.md to go with the iron_mine.md page that's already in this PR?

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

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

Section 4: Impacted Areas of the Software

Section 4.1: New Files

  • docs\technology_models\iron_mine.md: Rectifying the missing technology doc page for iron_mine

Section 4.2: Modified Files

  • examples\21_iron_mn_to_il\: Updated example to show the breakdown of ore, iron, and steel costs, removed comparisons with old code now that we are fully running on H2I framework.
    • tech_config.yaml - Added a processed_ore_feedstock that represents the subset of the iron_mine ore output that is passed to iron_plant, so that these two converters can be sized independently
  • examples\test\test_all_examples.py: Slight differences in test values due to changes in the example
  • h2integrate\core\feedstocks.py: Changed price from a config variable to an input

Section 5: Additional Supporting Information

When I run run_iron.py, the last two cases should produce the same levelized costs, but they are not. This is because the iron_transport transporter is calculating its costs based on the rated_capacity. I want to get this running so that when I change the rated_capacity of processed_iron_ore_feedstocks, the levelized costs are not affected (as long as the capacity is above what the iron_plant needs to consume).

Section 6: Test Results, if applicable

Section 7 (Optional): New Model Checklist

  • Model Structure:
    • Follows established naming conventions outlined in docs/developer_guide/coding_guidelines.md
    • Used attrs class to define the Config to load in attributes for the model
      • If applicable: inherit from BaseConfig or CostModelBaseConfig
    • Added: initialize() method, setup() method, compute() method
      • If applicable: inherit from CostModelBaseClass
  • Integration: Model has been properly integrated into H2Integrate
    • Added to supported_models.py
    • If a new commodity_type is added, update create_financial_model in h2integrate_model.py
  • Tests: Unit tests have been added for the new model
    • Pytest-style unit tests
    • Unit tests are in a "test" folder within the folder a new model was added to
    • If applicable add integration tests
  • Example: If applicable, a working example demonstrating the new model has been created
    • Input file comments
    • Run file comments
    • Example has been tested and runs successfully in test_all_examples.py
  • Documentation:
    • Write docstrings using the Google style
    • Model added to the main models list in docs/user_guide/model_overview.md
      • Model documentation page added to the appropriate docs/ section
      • <model_name>.md is added to the _toc.yml

elenya-grant and others added 30 commits December 10, 2025 13:52
Comment on lines 161 to 167
total_priority = np.sum(commodity_to_priority)
total_other = np.sum(commodity_to_other)
# Need to do this in case _out is different units than _producced
frac_priority = total_priority / (total_priority + total_other)
total_produced = inputs[f"total_{self.config.commodity}_produced"]
total_priority = total_produced * frac_priority
total_other = total_produced * (1 - frac_priority)
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be able to refactor this to not require total_iron_ore_produced and instead get the sum in the splitter directly. This simplifies the tech interconnections. Suggested by @dakotaramos

@jmartin4u jmartin4u added the ready for review This PR is ready for input from folks label Jan 28, 2026
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