Add documentation for commodity price calculations#1362
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1362 +/- ##
==========================================
+ Coverage 89.75% 89.80% +0.05%
==========================================
Files 58 58
Lines 8529 8524 -5
Branches 8529 8524 -5
==========================================
Hits 7655 7655
+ Misses 561 556 -5
Partials 313 313 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
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
left a comment
There was a problem hiding this comment.
A couple of minor suggestions but otherwise looks good to me
alexdewar
left a comment
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| balance constraints in the dispatch optimisation. | ||
| - **`scarcity`**: Prices are set to the shadow price plus the highest activity dual of the assets | ||
| producing the commodity in that region and time slice. | ||
| - **`unpriced`**: No prices are calculated for the commodity. |
There was a problem hiding this comment.
Worth mentioning that for OTH-type prices, you have to use this option?
|
|
||
| **Supply Equals Demand (SED):**: An SED commodity is a type of commodity that is both consumed and | ||
| produced by processes in the system. In fully resolved systems, supply of these commodities is | ||
| constrained to be equal to or greater than demand. |
There was a problem hiding this comment.
Would it also be worth mentioning OTH commodities here? The abbreviation isn't very self-explanatory
| The generic activity cost comprises all operating expenditures, input purchases, and flow costs/levies | ||
| not associated with specific SED/SVD outputs: | ||
| \\[ | ||
| \text{GenericActivityCost} = \text{VariableOperatingCost} + \text{InputPurchases} + \sum \text{GenericFlowCosts} |
There was a problem hiding this comment.
Just noting that we use
You could abbreviate "operating cost" to "opex" though, as you use that below anyway:
| \text{GenericActivityCost} = \text{VariableOperatingCost} + \text{InputPurchases} + \sum \text{GenericFlowCosts} | |
| \text{GenericActivityCost} = \text{VariableOpex} + \text{InputPurchases} + \sum \text{GenericFlowCosts} |
| *Note: this only works if all output commodities are measured in the same energy units (e.g. PJ). | ||
| For this reason, MUSE2 disallows processes that have output commodities with differing units.* |
There was a problem hiding this comment.
I'd put this in a box:
| *Note: this only works if all output commodities are measured in the same energy units (e.g. PJ). | |
| For this reason, MUSE2 disallows processes that have output commodities with differing units.* | |
| > Note: this only works if all output commodities are measured in the same energy units (e.g. PJ). | |
| > For this reason, MUSE2 disallows processes that have output commodities with differing units. |
|
|
||
| ### GASPRD | ||
|
|
||
| In this scenario, GASPRD is produced by a single GASDRV asset. This asset produces 1 unit of GASPRD |
There was a problem hiding this comment.
Is the reader likely to know what GASPRD refers to, i.e. is it a common abbreviation? I always assumed these names were MUSE-isms.
If so, should we maybe have a list spelling out what they mean? Alternatively we could just use longer names.
| \\[ | ||
| \text{CRF} = 0.11016807219 | ||
| \\] | ||
|
|
||
| \\[ | ||
| \text{AnnualFixedCostPerCapacity} = (10 \times 0.11016807219 + 0.3) = 1.4016807219 | ||
| \\] |
There was a problem hiding this comment.
How about aligning these on the = signs?
| \\[ | |
| \text{CRF} = 0.11016807219 | |
| \\] | |
| \\[ | |
| \text{AnnualFixedCostPerCapacity} = (10 \times 0.11016807219 + 0.3) = 1.4016807219 | |
| \\] | |
| \\[ | |
| \begin{aligned} | |
| \text{CRF} &= 0.11016807219 | |
| \text{AnnualFixedCostPerCapacity} &= (10 \times 0.11016807219 + 0.3) = 1.4016807219 | |
| \end{aligned} | |
| \\] |
You might even be able to get the equations below to line up by keeping the whole lot in a math block or something, but, even if not, I think it's nicer to have these aligned.
| \\[ | ||
| \text{CO2Levy} = 2.5565 \times 0.04 = 0.10226 | ||
| \\] | ||
|
|
||
| \\[ | ||
| \text{InputPurchases} = 8.9477554044 \times 1.05 = 9.39514317462 | ||
| \\] | ||
|
|
||
| \\[ | ||
| \text{MarginalCost}_{\text{GASNAT}} = 0.10226 + 0.5 + 9.39514317462 = 9.99740317462 | ||
| \\] |
There was a problem hiding this comment.
As above:
| \\[ | |
| \text{CO2Levy} = 2.5565 \times 0.04 = 0.10226 | |
| \\] | |
| \\[ | |
| \text{InputPurchases} = 8.9477554044 \times 1.05 = 9.39514317462 | |
| \\] | |
| \\[ | |
| \text{MarginalCost}_{\text{GASNAT}} = 0.10226 + 0.5 + 9.39514317462 = 9.99740317462 | |
| \\] | |
| \\[ | |
| \begin{aligned} | |
| \text{CO2Levy} &= 2.5565 \times 0.04 = 0.10226 | |
| \text{InputPurchases} &= 8.9477554044 \times 1.05 = 9.39514317462 | |
| \text{MarginalCost}_{\text{GASNAT}} &= 0.10226 + 0.5 + 9.39514317462 = 9.99740317462 | |
| \end{aligned} | |
| \\] |
| \\[ | ||
| \text{CRF} = 0.11016807219 | ||
| \\] | ||
|
|
||
| \\[ | ||
| \text{AnnualFixedCostPerCapacity} = (7 \times 0.11016807219 + 0.21) = 0.98117650533 | ||
| \\] |
There was a problem hiding this comment.
| \\[ | |
| \text{CRF} = 0.11016807219 | |
| \\] | |
| \\[ | |
| \text{AnnualFixedCostPerCapacity} = (7 \times 0.11016807219 + 0.21) = 0.98117650533 | |
| \\] | |
| \\[ | |
| \begin{aligned} | |
| \text{CRF} &= 0.11016807219 | |
| \text{AnnualFixedCostPerCapacity} &= (7 \times 0.11016807219 + 0.21) = 0.98117650533 | |
| \end{aligned} | |
| \\] |
| \[ | ||
| \text{AnnualFixedCostPerOutput} = \frac{4.6836756722}{1} = 4.6836756722 | ||
| \] |
There was a problem hiding this comment.
This didn't render for me:
| \[ | |
| \text{AnnualFixedCostPerOutput} = \frac{4.6836756722}{1} = 4.6836756722 | |
| \] | |
| \\[ | |
| \text{AnnualFixedCostPerOutput} = \frac{4.6836756722}{1} = 4.6836756722 | |
| \\] |
Description
Adds documentation describing the approach for calculating commodity prices. Includes the example laid out in #1128 (comment)
Fixes #1034
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks