Skip to content

Add core framework support for non-annual simulation durations - #7

Open
jaredthomas68 wants to merge 6 commits into
nonannual-resourcefrom
nonannual-framework
Open

jaredthomas68 wants to merge 6 commits into
nonannual-resourcefrom
nonannual-framework

Conversation

@jaredthomas68

@jaredthomas68 jaredthomas68 commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Core framework support for non-annual simulation durations

This PR is the second of a stack of PRs enabling non-annual simulation durations in H2Integrate (built on top of the resource resampling work in H2Integrate PR NatLabRockies#893 and preceding the technology-model adoption PR).

Key changes:

  1. Simulation duration validation: load_plant_yaml now permits positive durations up to plant_life (sub-annual, single-year, or multi-year).
  2. Model-level duration checks: Adds check_model_simulation_duration and _simulation_duration_bounds ((min, max) in years, defaulting to (1.0, 1.0)) on base classes so existing models safely remain protected at annual-only until explicitly validated.
  3. Annualization helpers: Adds PerformanceModelBaseClass.calculate_annual_cf_and_replacement_schedule() and CostModelBaseClass.calculate_annual_varopex() to project capacity factors, component replacements, and variable OpEx across plant life.
  4. ProFAST unit conversion fix: Replaces hardcoded 24/8760 multipliers with explicit OpenMDAO unit conversions between rate and amount units, avoiding double-conversion bugs with nonstandard price units.

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 8: New Model Checklist (if applicable)

TODO:

  • Implement core annualization helpers and simulation-duration checks
  • Unit test framework validation and baseclass helper methods
  • Document model attribute bounds and annualization methods in developer guide

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

  • Architecture of _simulation_duration_bounds checking parallel to _time_step_bounds
  • Implementation of calculate_annual_cf_and_replacement_schedule and calculate_annual_varopex

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)
      • Example 24 demonstrating non-annual simulation is included in the follow-up PR that adopts these bounds across individual models.
  • CHANGELOG.md
    • At least one complete sentence has been provided to describe the changes made in this PR
    • [.] Hyperlink provided to PR

Section 4: Related Issues

Partially resolves NatLabRockies#204

Section 5: Impacted Areas of the Software

Section 5.1: New Files

  • None.

Section 5.2: Modified Files

  • h2integrate/core/inputs/validation.py
    • Allows positive simulation durations up to plant_life.
  • h2integrate/core/model_checks.py
    • Adds check_model_simulation_duration to validate simulation length against _simulation_duration_bounds.
  • h2integrate/core/model_baseclass.py
    • Adds _simulation_duration_bounds defaults and helpers calculate_annual_cf_and_replacement_schedule and calculate_annual_varopex.
  • h2integrate/core/h2integrate_model.py
    • Calls check_model_simulation_duration alongside time-step checks for all technology, feedstock, and transport components.
  • h2integrate/control/control_strategies/openloop_control_baseclass.py
    • Sets default _simulation_duration_bounds = (1.0, 1.0).
  • h2integrate/control/control_strategies/pyomo_storage_controller_baseclass.py
    • Sets default _simulation_duration_bounds = (1.0, 1.0).
  • h2integrate/control/control_rules/pyomo_rule_baseclass.py
    • Sets default _simulation_duration_bounds = (1.0, 1.0).
  • h2integrate/finances/profast_baseclass.py & profast_npv.py
    • Fixes amount/rate unit conversions for capacity and total production.
  • h2integrate/core/test/test_framework.py
    • Tests duration bounds validation and error handling.
  • h2integrate/core/test/test_model_baseclasses.py
    • Unit tests for annualization and replacement schedule projection helpers.
  • h2integrate/finances/test/ (test_finances.py, test_profast_lco.py, test_profast_npv.py)
    • Validates ProFAST unit conversions with standard and custom price units.
  • docs/intro.md, docs/developer_guide/class_structure.md, docs/developer_guide/adding_a_new_technology.md, docs/developer_guide/features_not_currently_implemented.md
    • Updates documentation on simulation duration bounds and annualization helpers.

Section 6: Additional Supporting Information

Subsequent PR will widen _simulation_duration_bounds on specific concrete models (solar, battery, grid, demand, combiners) and demonstrate non-annual runs in Example 24.

Section 7: Test Results, if applicable

Targeted core framework, model baseclass, and finance tests all pass.

@jaredthomas68
jaredthomas68 added this pull request to stack #8 October 8, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant