Skip to content

Add Units and Dimensions page to documentation - #1503

Open
tsmbland wants to merge 3 commits into
mainfrom
units_documentation
Open

Add Units and Dimensions page to documentation#1503
tsmbland wants to merge 3 commits into
mainfrom
units_documentation

Conversation

@tsmbland

@tsmbland tsmbland commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds a page to the documentation describing how units work in MUSE. Hopefully this should be a useful guide for anyone building a model or interpreting results.

To help explain how monetary quantities work, and to serve as a useful record, I've added a currency field to the model.toml file so that users can record the currency used for all monetary quantities. We have something similar in MUSE1. This isn't actually used by the model, but it helps to stress that monetary quantities should follow some consistent scheme, and is referred to a lot in the documentation to explain how monetary quantities work. Together with the units column in commodities.csv, all prices and costs in the input/output data can now be interpreted in terms of real world units (e.g a price of 0.5 for a commodity measured in PJ, in a model with currency MUSD2020 -> price = $500,000/PJ). Without this parameter, it would be up to the modeller to remember the currency or document it independently, and share it alongside the results.

Whilst capacities don't have a defined unit of measurement in the input data, this can be figured out in a slightly roundabout way using the commodity units and the capacity_to_activity factor. Similarly, together with currency, capital costs can be resolved (e.g. 1.5 might mean $1,500,000/GW). It's a conscious decision not to include capacity units in the input data, because it wouldn't necessarily be correct unless the modeller has done their unit conversions properly, and could lead to a false sense of security. This is not such a worry for commodity units and currency, as these are orthogonal concepts.

(Note, "capacity units" is a distinct concept to "asset units", which very confusingly uses the same word. I've proposed #1502 to change the terminology around asset units to reduce confusion.)

Fixes # (issue)

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

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (a332ac1) to head (9a28da5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1503      +/-   ##
==========================================
+ Coverage   90.29%   90.30%   +0.01%     
==========================================
  Files          60       60              
  Lines        8645     8658      +13     
  Branches     8645     8658      +13     
==========================================
+ Hits         7806     7819      +13     
  Misses        525      525              
  Partials      314      314              

☔ View full report in Codecov by Harness.
📢 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 August 21, 2026 13:11
Copilot AI lite review requested due to automatic review settings August 21, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new documentation page explaining MUSE2’s unit conventions (commodity units, activity, capacity, and monetary quantities), and introduces an optional currency label in model.toml as metadata to help users interpret monetary inputs/outputs consistently.

Changes:

  • Add currency: Option<String> to ModelParameters, update the input schema, and add a deserialisation test confirming it is optional metadata.
  • Add a new “Units and Dimensions” documentation page and link it from the model docs and SUMMARY.
  • Populate currency = "MUSD2020" in the example model.toml files to demonstrate/document the convention.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/model/parameters.rs Adds optional currency field, defaulting to None, plus a test verifying backwards-compatible TOML deserialisation.
schemas/input/model.yaml Documents the new optional currency property in the model parameters schema.
examples/two_regions/model.toml Adds currency metadata to the example configuration.
examples/two_outputs/model.toml Adds currency metadata to the example configuration.
examples/simple/model.toml Adds currency metadata to the example configuration.
examples/muse1_default/model.toml Adds currency metadata to the example configuration.
examples/missing_commodity/model.toml Adds currency metadata to the example configuration.
examples/circularity/model.toml Adds currency metadata to the example configuration.
docs/SUMMARY.md Links the new “Units and Dimensions” page in the documentation sidebar.
docs/model/units_and_dimensions.md New page describing how MUSE2 interprets unit labels and relates activity/capacity/flows/costs.
docs/model/README.md Adds a short pointer to the new units/dimensions documentation.
docs/model/prices.md Clarifies that SED/SVD output “unit” consistency is based on label matching (no conversion).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tsmbland

Copy link
Copy Markdown
Collaborator Author

@ahawkes FYI. Hopefully this is all correct and clear!

@ahawkes

ahawkes commented Aug 21, 2026 via email

Copy link
Copy Markdown
Contributor

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.

3 participants