Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Follow-ups for nonannual framework PR

Open
#965 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start with h2integrate/core/annualization.py, model_baseclass.py, h2integrate/core/h2integrate_model.py, and the related docs under docs/developer_guide/ and docs/user_guide/. First review PR #934 and wait for the model opt-ins and non-annual example to land, then coordinate the compatibility checks with the connect_technologies refactor. The issue lists several independent cleanup, documentation, validation, and testing decisions; done means completing the agreed follow-ups and adding the requested regression coverage.

Written by the indexing model from the issue text.

Description

code cleanup documentation framework

Follow-up cleanup after the non-annual framework lands

Cleanup items found while reviewing #934. None change behavior for existing annual-only simulations. Best done after the model opt-ins and the non-annual example have merged, so the cleanup is tested against real users of the API. Some of these suggestions might change based on code updates as a result of these other PRs.

1. Annualization cleanup (h2integrate/core/annualization.py, model_baseclass.py)

  • Standardize tolerances. Three different literals decide "equal" in nearby code: 1e-9 (upward SOH jump marks a replacement), 1e-12 (EOL reached), and 1e-10 years (replacement event on a year boundary). Move them to named module constants with a one-line rationale each, or reduce them to one or two.
  • Unify the year definition. fraction_of_year_simulated is still computed from hours_per_year = 8760 in both PerformanceModelBaseClass.setup() and CostModelBaseClass.setup(). Derive it from SECONDS_PER_PLANT_YEAR so there is one definition. Consider moving the duplicated n_timesteps / dt / plant_life / annual_extrapolation_method reads in both setup() methods into a shared helper.
  • Drop redundant validation. calculate_annual_cf_and_replacement_schedule re-validates dt and plant_life, which the schema and load_plant_yaml already check. Keep it only if the method is meant to be callable outside a configured plant.
  • Clean up the API.
    • calculate_annual_varopex accepts an unused **kwargs.
    • The per-call override is named no_degradation_extrapolation for CF and annual_extrapolation_method for VarOpEx. Pick one name (with a deprecation path if the CF name has shipped).
  • Revisit SOH projection. The final cycle is extended linearly from the last two SOH samples, which is sensitive to noise. Consider a fit over a short trailing window, or document that models must provide smooth SOH.
  • Rated production in AdjustedCapacityFactorComp is the largest annual-segment mean, so a strong partial-year segment can set the rated value. Decide whether that is intended and document it for users, or switch to the time-weighted mean.

2. Streamline model compatibility checks (h2integrate/core/h2integrate_model.py)

check_model_time_step and check_model_simulation_duration are called as a pair in five places, plus the duration check alone for system-level controllers and per-technology finance models. Replace the pairs with one helper, for example check_model_compatibility(model_name, model_object, plant_config) in model_checks.py, that reads dt and n_timesteps itself. Decide whether the per-technology finance model should also get the time-step check, and whether the getattr(..., (1.0, 1.0)) fallback is still needed once all models inherit the bounds. Coordinate with the connect_technologies refactor to avoid conflicts.

3. Documentation additions

  • A worked numeric example for replacement cycles (a short SOH series, its cycles, the projected CF, and the resulting replacement schedule), ideally as a figure or table in docs/developer_guide/.
  • A user-facing note on how rated production and capacity factors are chosen for custom finance timeseries over partial or multi-year runs.
  • A section in adding_a_new_technology.md on how to opt a model in to non-annual runs: widen _simulation_duration_bounds, call the annualization methods, and what to verify first.
  • Once the opt-in models exist, list each model's supported duration range on its model docs page and in docs/user_guide/model_overview.md.

4. Other

  • Add an end-to-end regression test that runs a partial-year and a multi-year plant through finance, once an opted-in model exists. The current coverage is unit tests with dummy models.
  • Move the leap-day rejection from H2IntegrateModel.__init__ into plant or resource config validation so it is reported with the other config errors.
Dominant language
Python
Stars
30
Forks
44
Avg merge
3d 12h
Merged PRs (30d)
28

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NatLabRockies/H2Integrate

All issues in NatLabRockies/H2Integrate

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.