New NPV metric using SNAS#1379
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR updates the “NPV” investment appraisal tool to use the SNAS-style metric described in #1201, and refreshes regression fixtures/docs accordingly.
Changes:
- Switch NPV appraisal from the previous profitability-index/TAS hybrid comparison to a single per-activity metric (via
snas). - Re-enable and update regression coverage/fixtures for
circularity_npvand updatesimple_npvexpected outputs. - Simplify the investment-tool documentation by removing the old NPV section and noting the intended relationship to LCOX.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/finance.rs |
Introduces snas() helper and removes the old profitability index implementation. |
src/simulation/investment/appraisal.rs |
Updates NPV appraisal to use snas and adjusts metric structs/tests accordingly. |
docs/model/investment.md |
Rewrites the NPV tool documentation section. |
tests/regression.rs |
Re-enables the circularity_npv regression test. |
tests/data/simple_npv/commodity_prices.csv |
Updates expected outputs for simple_npv regression. |
tests/data/simple_npv/commodity_flows.csv |
Updates expected outputs for simple_npv regression. |
tests/data/simple_npv/assets.csv |
Updates expected outputs for simple_npv regression. |
tests/data/simple_npv/asset_capacities.csv |
Updates expected outputs for simple_npv regression. |
tests/data/circularity_npv/commodity_prices.csv |
Updates expected outputs for circularity_npv regression. |
tests/data/circularity_npv/commodity_flows.csv |
Updates expected outputs for circularity_npv regression. |
tests/data/circularity_npv/assets.csv |
Updates expected outputs for circularity_npv regression. |
tests/data/circularity_npv/asset_capacities.csv |
Updates expected outputs for circularity_npv regression. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1379 +/- ##
==========================================
- Coverage 89.68% 89.60% -0.09%
==========================================
Files 58 58
Lines 8406 8338 -68
Branches 8406 8338 -68
==========================================
- Hits 7539 7471 -68
Misses 550 550
Partials 317 317 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dc2917
left a comment
There was a problem hiding this comment.
Just made a comment on the docs, but the code itself looks good - implementation in src/finance.rs looks fine, and it seems reasonable to have snas defined as a function in a separate module, that happens to be the metric used for NPV.
|
@alexdewar Merging now, but you may want to look at when you're back |
Description
Simplifies the NPV metric to use the SNAS calculation described in #1201. Previously, there was a much more complicated ranking method based on two numbers (
total_annualised_surplusandannualised_fixed_cost), now it's a much simpler method involving one number (the SNAS), where higher is better.In practice, this ends up being extremely similar to LCOX, the only real difference being that SNAS includes the commodity of interest whereas LCOX doesn't. Apart from that, SNAS is just the negative of LCOX, and maximised instead of minimised.
There are almost certainly ways we could tidy up the code, but I figured that's a separate job and @alexdewar may already have ideas about that. We also need to retain some flexibility as future objective metrics may be more fundamentally different.
The docs are also of date. I've deleted the entire NPV section and replaced it with a short section below LCOX that just highlights the differences. The LCOX documentation is outdated, but that was already the case, and I figured that's a separate job.
Fixes the
circularity_npvmodel, so I've re-enabled that.Fixes #1201
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks