Follow-ups for nonannual framework PR
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
- Domain
- backend, documentation, testing
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
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), and1e-10years (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_simulatedis still computed fromhours_per_year = 8760in bothPerformanceModelBaseClass.setup()andCostModelBaseClass.setup(). Derive it fromSECONDS_PER_PLANT_YEARso there is one definition. Consider moving the duplicatedn_timesteps/dt/plant_life/annual_extrapolation_methodreads in bothsetup()methods into a shared helper. - Drop redundant validation.
calculate_annual_cf_and_replacement_schedulere-validatesdtandplant_life, which the schema andload_plant_yamlalready check. Keep it only if the method is meant to be callable outside a configured plant. - Clean up the API.
calculate_annual_varopexaccepts an unused**kwargs.- The per-call override is named
no_degradation_extrapolationfor CF andannual_extrapolation_methodfor 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
AdjustedCapacityFactorCompis 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.mdon 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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NatLabRockies/H2Integrate
-
infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
NatLabRockies/H2Integrate#977 ·
Maintainers usually reply within 1 day
-
SimpleThermalNuclearReactorCostModel: variable O&M overstated 1000x (kWh treated as MWh)Possibly taken A pull request linked to this issue is open or already merged. Openbug finance
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
NatLabRockies/H2Integrate#968 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NatLabRockies/H2Integrate#944 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NatLabRockies/H2Integrate#894 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NatLabRockies/H2Integrate#623 ·
Maintainers usually reply within 1 day
All issues in NatLabRockies/H2Integrate
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 65/100
EclipseFdn/open-vsx.org#15057 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki HomePossibly taken @ChiefGyk3D claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
vllm-project/vime#508 ·
Maintainers usually reply within 4 days