Skip to content

New asset_capacities.csv file#1302

Open
tsmbland wants to merge 11 commits into
mainfrom
assets_output
Open

New asset_capacities.csv file#1302
tsmbland wants to merge 11 commits into
mainfrom
assets_output

Conversation

@tsmbland
Copy link
Copy Markdown
Collaborator

@tsmbland tsmbland commented May 21, 2026

Description

This breaks the capacity data from the existing assets.csv output file to a new file asset_capacities.csv. This only really has implications for divisible assets which can decrease in capacity over time. For these, we now have a single row in assets.csv representing the parent (rather than rows for each child asset), and you can track the overall capacity over time in asset_capacities.csv. For non-divisible assets, capacities will just be flat until in eventually gets decommissioned, at which point it will disappear from the file.

One challenge was how to add the appropriate assets to the assets.csv file each year so everything is covered and we don't get duplicate rows. This needs to include newly selected assets and assets from the assets.csv input file. The latter may include assets that get decommissioned straight away, which never exist in the asset pool at the same time as newly selected assets, so there was some fiddly work to keep track of the assets that we need to add to the file. It works, but it's a bit hacky.

Beyond just the output files, there are a few wider implications:

  • we can remove the decommission_year column from assets.csv as users can track decommissioning/partial decommissioning via the asset_capacities.csv file
  • we no longer have to rewrite the whole assets.csv file each year just to update the now-removed decommission_year column
  • we no longer have to keep track of decommissioned assets, as we were only previously using them to populate decommission_year. This means we can remove the decommissioned pool from AssetPool, and can remove the AssetState::Decommissioned state

Fixes #1245

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 85.34483% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.55%. Comparing base (31ed4a1) to head (8874678).
⚠️ Report is 56 commits behind head on main.

Files with missing lines Patch % Lines
src/asset/pool.rs 81.81% 6 Missing and 2 partials ⚠️
src/output.rs 91.93% 1 Missing and 4 partials ⚠️
src/simulation.rs 55.55% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1302      +/-   ##
==========================================
+ Coverage   89.39%   89.55%   +0.16%     
==========================================
  Files          57       58       +1     
  Lines        8379     8491     +112     
  Branches     8379     8491     +112     
==========================================
+ Hits         7490     7604     +114     
+ Misses        582      571      -11     
- Partials      307      316       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tsmbland tsmbland marked this pull request as ready for review May 21, 2026 15:44
Copilot AI review requested due to automatic review settings May 21, 2026 15:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the simulation output format by moving time-varying capacity information out of assets.csv into a new asset_capacities.csv, enabling correct tracking of partially decommissioned (divisible) assets while simplifying asset lifecycle representation.

Changes:

  • Add a new asset_capacities.csv output (and schema/docs) containing capacity per asset/group per milestone year.
  • Change assets.csv to emit only newly commissioned asset definitions (one row per divisible group) and drop decommission_year/capacity columns.
  • Remove explicit “decommissioned” asset state tracking and update decommissioning logic/output writing accordingly.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/simulation.rs Writes only newly commissioned asset definitions and writes per-year capacity snapshots via the new writer API.
src/output.rs Adds asset_capacities.csv writer + row type; changes asset writing to append and to emit one row per divisible group. Includes a new unit test for capacity output.
src/asset/pool.rs Refactors commissioning/decommissioning APIs (return newly commissioned assets; drop decommissioned collection) and updates unit tests accordingly.
src/asset.rs Removes AssetState::Decommissioned and related decommission APIs/tests; keeps parent/child mechanics for divisible assets.
schemas/output/assets.yaml Updates assets.csv schema to reflect new columns/semantics and removal of decommission/capacity fields.
schemas/output/asset_capacities.yaml Adds schema for the new asset_capacities.csv output.
docs/file_formats/generate_docs.py Adds asset_capacities to the documented output file order.
tests/data/**/assets.csv Updates regression golden files for the new assets.csv format.
tests/data/**/asset_capacities.csv Adds regression golden files for the new asset_capacities.csv output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/output.rs
Comment thread src/asset/pool.rs
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.

Change format for output files tracking commissioned/decommissioned assets

2 participants