Tidy mothballing - #1538
Tidy mothballing#1538
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1538 +/- ##
==========================================
- Coverage 90.85% 90.84% -0.02%
==========================================
Files 61 61
Lines 9042 9019 -23
Branches 9042 9019 -23
==========================================
- Hits 8215 8193 -22
+ Misses 508 507 -1
Partials 319 319 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
A now-incorrect dispatch doc comment and a brittle hard-coded tranche size in a test should be fixed to prevent confusion/regressions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR changes how mothballed capacity is represented in dispatch by making core Asset activity/capacity logic account for mothballed tranches directly, allowing mothballed assets to remain in dispatch/output with zero activity/flows instead of being filtered out or represented as separate reduced-capacity assets.
Changes:
- Update
Assetactivity limit calculations to use active (non-mothballed) capacity. - Remove dispatch-time filtering/subsetting of mothballed tranches so mothballed assets can still appear in flow outputs.
- Update golden test data for
simple_mothballto include zero flows for mothballed assets.
File summaries
| File | Description |
|---|---|
| tests/data/simple_mothball/commodity_flows.csv | Updates expected output to include (zero) flows for mothballed assets. |
| src/simulation/investment/appraisal/constraints.rs | Switches appraisal activity constraints to use absolute activity limits from Asset. |
| src/simulation.rs | Removes the dispatch-time filtering that previously excluded mothballed tranches/assets. |
| src/asset/pool.rs | Updates a pool test to avoid with_subset_of_tranches by directly adjusting capacity. |
| src/asset.rs | Introduces active_capacity() and applies it to activity limit/max activity calculations; removes with_subset_of_tranches. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let mut retained = full.clone(); | ||
| retained | ||
| .make_mut() | ||
| .set_capacity(AssetCapacity::new(2, Capacity(4.0))); |
Description
Rather than representing a mothballed asset as a new asset with a reduced capacity, this changes the key methods in
Assetto take mothballed capacity into account. This allowswith_subset_of_tranchesto be removed.Fixes #1460
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks