Skip to content

Oxygen output from PEM electrolyzer#642

Merged
elenya-grant merged 8 commits intoNatLabRockies:developfrom
elenya-grant:pem/o2_out
Apr 6, 2026
Merged

Oxygen output from PEM electrolyzer#642
elenya-grant merged 8 commits intoNatLabRockies:developfrom
elenya-grant:pem/o2_out

Conversation

@elenya-grant
Copy link
Copy Markdown
Collaborator

@elenya-grant elenya-grant commented Mar 31, 2026

Oxygen output from PEM electrolyzer

Added oxygen as an output from the PEM electrolyzer model.

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:

  • Add subtests for oxygen outputs to h2integrate/converters/hydrogen/test/test_pem_electrolyzer_performance.py
  • Add docstrings to new methods added to h2integrate/converters/hydrogen/pem_model/PEM_H2_LT_electrolyzer_Clusters.py

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

  • General thoughts?
    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
    • 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 3: Related Issues

This would resolve issue #628

Section 4: Impacted Areas of the Software

Section 4.1: New Files

N/A

Section 4.2: Modified Files

  • ECOElectrolyzerPerformanceModel in h2integrate/converters/hydrogen/pem_electrolyzer.py
    • setup(): added outputs for oxygen, this includes the rated oxygen production, annual oxygen production, and the oxygen_out profile.
    • compute(): populated oxygen related outputs
  • h2integrate/converters/hydrogen/pem_model/PEM_H2_LT_electrolyzer_Clusters.py
    • added import for molar mass of O2
    • PEM_H2_Clusters
      • run(): updated to calculate oxygen production and capacity factor
      • rated_o2_prod(): new method that calculates the rated oxygen production at BOL (similar to rated_h2_prod())
      • o2_production_rate(): new method to calculate the oxygen production rate (similar to h2_production_rate())
      • make_yearly_performance_dict(): updated to estimate lifetime oxygen production over plant life
  • h2integrate/converters/hydrogen/pem_model/run_h2_PEM.py
    • clean_up_final_outputs: added handling for oxygen outputs
    • run_h2_PEM: added output for oxygen production timeseries at a top-level in H2_Results
  • examples/14_wind_hydrogen_dispatch/inputs/plant_config.yaml: added finance subgroup with oxygen as an output
  • examples/test/test_all_examples.py::test_hydrogen_dispatch_example: added subtest for LCOO, functions as an integration test of the oxygen output and finance models.
  • h2integrate/converters/hydrogen/test/test_pem_electrolyzer_performance.py: added regression tests in test_electrolyzer_results

Section 5: Additional Supporting Information

Section 6: Test Results, if applicable

h2integrate/postprocess/test/test_sql_timeseries_to_csv.py::test_save_csv_all_results had a sub-fail on the number of columns (went from 40 to 41). This is expected with the added timeseries output (oxygen_out) from the electrolyzer.

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 elenya-grant marked this pull request as ready for review March 31, 2026 20:54
@elenya-grant elenya-grant added the ready for review This PR is ready for input from folks label Mar 31, 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.

Looks good to me. I did not check all the test values, but the hourly O2/H2 ratio looks about right. I am also not an expert in PEM, but I did check through the equations and they look right to me. It would not hurt to have someone else look over them as well, but I think this is good to come in from my perspective. Thank you @elenya-grant!

I left a few non-blocking comments.

power_pr_yr_kWh[i] = np.sum(annual_power_consumed_kWh)

h2_kg_hr_system = h2_kg_hr_system_init * h2_multiplier
o2_kg_hr_system = o2_kg_hr_system_init * h2_multiplier
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.

Non-blocking, but the name h2_multiplier is confusing since it looks like it is an efficiency and now it is applied to o2 as well the name threw me off.

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 agree - I renamed it to production_multiplier

float | np.array: oxygen production profile of the cluster in kg/dt
"""
n_Tot = self.faradaic_efficiency(stack_current)
o2_production_rate = n_Tot * ((self.N_cells * stack_current) / (4 * self.F)) # mol/s
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.

any citations we can include for this?

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.

yes - I pushed up the updated doc string



@pytest.mark.regression
def test_electrolyzer_results(tech_config, plant_config, subtests):
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 the tests!

@elenya-grant elenya-grant enabled auto-merge (squash) April 6, 2026 15:45
@elenya-grant elenya-grant merged commit 3b7c6a2 into NatLabRockies:develop Apr 6, 2026
5 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.

3 participants