Skip to content

Add documentation for commodity price calculations#1362

Merged
tsmbland merged 17 commits into
mainfrom
price_documentation
Jun 30, 2026
Merged

Add documentation for commodity price calculations#1362
tsmbland merged 17 commits into
mainfrom
price_documentation

Conversation

@tsmbland

@tsmbland tsmbland commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds documentation describing the approach for calculating commodity prices. Includes the example laid out in #1128 (comment)

Fixes #1034

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 Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.68%. Comparing base (651b4e2) to head (58b0ec6).
⚠️ Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1362      +/-   ##
==========================================
- Coverage   89.75%   89.68%   -0.07%     
==========================================
  Files          58       58              
  Lines        8529     8406     -123     
  Branches     8529     8406     -123     
==========================================
- Hits         7655     7539     -116     
+ Misses        561      550      -11     
- Partials      313      317       +4     

☔ 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 June 23, 2026 14:24
Copilot AI review requested due to automatic review settings June 23, 2026 14:24

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 user-facing documentation page describing how MUSE2 calculates commodity prices after dispatch, including an end-to-end worked example for full-cost pricing (per the referenced issues).

Changes:

  • Add a new “Commodity Prices” page under the Model Description section.
  • Document pricing strategies, cost component breakdowns, ordering logic (including cycles), and a worked example.

Reviewed changes

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

File Description
docs/SUMMARY.md Adds the new “Commodity Prices” page to the mdBook table of contents.
docs/model/prices.md New documentation page describing pricing strategies and worked examples for commodity price calculation.

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

Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md Outdated
tsmbland and others added 5 commits June 23, 2026 15:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@dc2917 dc2917 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.

A couple of minor suggestions but otherwise looks good to me

Comment thread docs/model/prices.md
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md Outdated

@alexdewar alexdewar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! A useful resource. I've put some comments.

Maybe you could link to this page from the docs for src/simulation/prices.rs? (Though bear in mind the URL may change soon, see: #1366 (comment)).

I spotted one place where we are using a different name for the variable elsewhere in the docs from what's here (there may be more), but your naming scheme is at least internally consistent, so I think that's better. We have a bit of a mix of single letters, snake case and Pascal case in equations. Not sure if we should do something about that.

Comment thread docs/model/prices.md
highest-cost active asset producing the commodity.
- **`shadow`**: Prices are taken directly from the shadow prices (dual values) of the commodity
balance constraints in the dispatch optimisation.
- **`scarcity`**: Prices are set to the shadow price plus the highest activity dual of the assets

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Side note: I think this option might be misnamed. I had it in mind it removes the effect of scarcity from prices. scarcity_adjusted or something might be clearer.

Comment thread docs/model/prices.md Outdated
Comment thread docs/glossary.md
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md Outdated
Comment thread docs/model/prices.md
Comment thread docs/model/prices.md
Comment thread docs/model/prices.md
Comment thread docs/model/prices.md Outdated
@tsmbland

Copy link
Copy Markdown
Collaborator Author

I spotted one place where we are using a different name for the variable elsewhere in the docs from what's here (there may be more), but your naming scheme is at least internally consistent, so I think that's better. We have a bit of a mix of single letters, snake case and Pascal case in equations. Not sure if we should do something about that.

I admittedly didn't make much of an attempt to make it consistent with the rest of the docs. Probably should be long run, but I think we'd need to agree upon a proper naming scheme before embarking on that.

@tsmbland tsmbland requested a review from alexdewar June 26, 2026 14:04
@tsmbland

Copy link
Copy Markdown
Collaborator Author

Maybe you could link to this page from the docs for src/simulation/prices.rs? (Though bear in mind the URL may change soon, see: #1366 (comment)).

Done, although linkchecker will fail until this is merged

@alexdewar alexdewar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Tried it locally and it renders nicely.

I spotted one place where we are using a different name for the variable elsewhere in the docs from what's here (there may be more), but your naming scheme is at least internally consistent, so I think that's better. We have a bit of a mix of single letters, snake case and Pascal case in equations. Not sure if we should do something about that.

I admittedly didn't make much of an attempt to make it consistent with the rest of the docs. Probably should be long run, but I think we'd need to agree upon a proper naming scheme before embarking on that.

Agreed! I think this is fine for now.

Maybe you could link to this page from the docs for src/simulation/prices.rs? (Though bear in mind the URL may change soon, see: #1366 (comment)).

Done, although linkchecker will fail until this is merged

👍 Feel free to bypass and merge as long as there are no other failures.

@AdrianDAlessandro This is another link that will need updating for #1366.

Comment thread docs/model/prices.md
Comment on lines +130 to +131
<!-- markdownlint-disable MD024 -->
## Example

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah ok! My bad. This is fine then

@tsmbland tsmbland merged commit cb8a34d into main Jun 30, 2026
7 of 8 checks passed
@tsmbland tsmbland deleted the price_documentation branch June 30, 2026 08:28
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.

Better documentation for pricing strategies

4 participants