Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benches/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn calculate_seed_prices(
&solution_existing,
&solution_with_candidates,
candidates,
&Prices::default(),
BASE_YEAR,
)
.expect("Failed to calculate prices")
Expand Down
14 changes: 6 additions & 8 deletions docs/model/prices.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

This section describes how commodity prices are calculated in MUSE2 at the end of each
milestone year iteration. The pricing algorithm operates on the results of the dispatch
optimisation, translating flows, capacities, and solver dual values (shadow prices) into commodity
market prices.
optimisation, translating flows and capacities into commodity market prices.

## Pricing Strategies

Expand All @@ -16,10 +15,6 @@ commodity.
active assets.
- **`full`**: Prices are set to the full cost (marginal cost + annual fixed/capital costs) of the
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
producing the commodity in that region and time slice.
- **`unpriced`**: No prices are calculated for the commodity. This is mandatory for all OTH
(Other)-type commodities.

Expand Down Expand Up @@ -119,13 +114,15 @@ determined, see [Commodity Graphs](./commodity_graphs.md#investment-and-price-or
Within a [circularity][graph-circularities], markets are priced in the reverse of their investment
order. As with investment, some processes need the price of an input that hasn't been calculated
yet: these are exactly the [feedback processes][graph-circularities]. For these inputs, MUSE2 uses
the shadow price from dispatch as an estimate.
the price from the previous milestone year (or the previous
[ironing-out loop][framework-overview] iteration, if enabled) as an estimate. If there is no
previous price (e.g. in the first year), zero is used.

In the [example model][graph-example], hydrogen is invested in before electricity, so prices are
calculated in this order:

1. **Electricity** is priced first. The hydrogen turbine (H2YGEN) is a feedback process, and the
price of hydrogen hasn't been calculated yet, so the shadow price of hydrogen is used for its
price of hydrogen hasn't been calculated yet, so the previous price of hydrogen is used for its
input.
2. **Hydrogen** is then priced, using the electricity price from step 1 for the electrolyser's
(H2YPRO) input.
Expand Down Expand Up @@ -237,3 +234,4 @@ calculated first and then used as an input cost when calculating the GASNAT pric
[graph-circularities]: ./commodity_graphs.md#circularities
[graph-example]: ./commodity_graphs.md#example
[model-toml]: ../file_formats/input_files.md#model-parameters-modeltoml
[framework-overview]: index.html#framework-overview
4 changes: 4 additions & 0 deletions docs/release_notes/upcoming.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
- The `capacity_margin` parameter has been removed ([#1557])
- `portfolio` is now the default agent type. To keep the previous investment behaviour, set
`agent_type` to `competitive` in `agents.csv` ([#1574])
- The `shadow` and `scarcity` pricing strategies have been removed. Commodities using them in
`commodities.csv`, or `fallback_pricing_strategy` in `model.toml`, must switch to another strategy
- Prices in cyclically-dependent markets are now seeded with the previous year's (or previous
ironing-out iteration's) prices, or zero if there are none, rather than with shadow prices

## Bug fixes

Expand Down
19 changes: 7 additions & 12 deletions schemas/input/commodities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,21 @@ fields:
- name: pricing_strategy
type: string
enum:
- shadow
- marginal
- marginal_average
- full
- full_average
- scarcity
- unpriced
description: The pricing strategy for this commodity
notes: |
Optional. If specified, must be one of `shadow` (priced using shadow prices from supply-demand
constraints), `marginal` (priced at the marginal cost of the highest cost active asset),
`marginal_average` (priced at the load-weighted average marginal cost of production across
assets), `full` (priced at the full cost of production of the highest cost active asset,
including capital costs), `full_average` (priced at the load-weighted average full cost of
production across assets), `scarcity` (priced adjusted for scarcity), or `unpriced` (not
priced at all).
Optional. If specified, must be one of `marginal` (priced at the marginal cost of the highest
cost active asset), `marginal_average` (priced at the load-weighted average marginal cost of
production across assets), `full` (priced at the full cost of production of the highest cost
active asset, including capital costs), `full_average` (priced at the load-weighted average
full cost of production across assets), or `unpriced` (not priced at all).

For `svd` and `sed` commodities, it must be one of `shadow`, `marginal`,
`marginal_average`, `full` or `full_average`. For `oth` commodities, it *must* be
`unpriced`.
For `svd` and `sed` commodities, it must be one of `marginal`, `marginal_average`, `full` or
`full_average`. For `oth` commodities, it *must* be `unpriced`.

If unspecified, the commodity will use the default pricing strategy according to the commodity
type: `full_average` for `svd` and `sed` commodities, and `unpriced` for `oth` commodities.
Expand Down
2 changes: 0 additions & 2 deletions schemas/input/model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ properties:
default: full_average
enum:
- unpriced
- shadow
- scarcity
- marginal
- marginal_average
- full
Expand Down
6 changes: 0 additions & 6 deletions src/commodity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ pub enum CommodityType {
/// The strategy used for calculating commodity prices
#[derive(Debug, PartialEq, Clone, Copy, Deserialize, Hash, Eq)]
pub enum PricingStrategy {
/// Take commodity prices directly from the shadow prices
#[serde(rename = "shadow")]
Shadow,
/// Adjust shadow prices for scarcity
#[serde(rename = "scarcity")]
ScarcityAdjusted,
/// Use marginal cost of highest-cost active asset producing the commodity
#[serde(rename = "marginal")]
MarginalCost,
Expand Down
16 changes: 0 additions & 16 deletions src/example/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,6 @@ fn get_all_patches() -> PatchMap {
None,
),
),
(
// The simple example with electricity priced using shadow prices
"simple_shadow",
PatchInfo::new(
"simple",
vec![FilePatch::new("commodities.csv").with_replacement(&[
"id,description,type,time_slice_level,pricing_strategy,units",
"GASPRD,Gas produced,sed,season,,PJ",
"GASNAT,Natural gas,sed,season,,PJ",
"ELCTRI,Electricity,sed,daynight,shadow,PJ",
"RSHEAT,Residential heating,svd,daynight,,PJ",
"CO2EMT,CO2 emitted,oth,annual,,ktCO2",
])],
None,
),
),
// The simple example with the ironing-out loop turned on
(
"simple_ironing_out",
Expand Down
6 changes: 3 additions & 3 deletions src/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn svd_commodity() -> Commodity {
description: String::new(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::DayNight,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -166,7 +166,7 @@ pub fn sed_commodity() -> Commodity {
description: "Test SED commodity".into(),
kind: CommodityType::SupplyEqualsDemand,
time_slice_level: TimeSliceLevel::DayNight,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -182,7 +182,7 @@ pub fn other_commodity() -> Commodity {
description: "Test other commodity".into(),
kind: CommodityType::Other,
time_slice_level: TimeSliceLevel::DayNight,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand Down
22 changes: 4 additions & 18 deletions src/input/commodity.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
//! Code for reading commodity-related data from CSV files.
use super::{input_err_msg, read_csv};
use crate::ISSUES_URL;
use crate::commodity::{
BalanceType, Commodity, CommodityConstraintsMap, CommodityID, CommodityLevyMap, CommodityMap,
CommodityType, DemandMap, PricingStrategy,
};
use crate::model::{ALLOW_DANGEROUS_OPTION_NAME, dangerous_model_options_enabled};
use crate::region::RegionID;
use crate::time_slice::{TimeSliceInfo, TimeSliceLevel};
use anyhow::{Context, Ok, Result, ensure};
use indexmap::{IndexMap, IndexSet};
use log::warn;
use serde::Deserialize;
use std::path::Path;

Expand Down Expand Up @@ -181,20 +178,6 @@ fn validate_commodity(commodity: &Commodity) -> Result<()> {
}
}

// Gatekeep scarcity-adjusted pricing option
if commodity.pricing_strategy == PricingStrategy::ScarcityAdjusted {
ensure!(
dangerous_model_options_enabled(),
"The 'scarcity' pricing strategy is currently experimental. \
To run anyway, set the {ALLOW_DANGEROUS_OPTION_NAME} option to true."
);
warn!(
"The pricing strategy for {} is set to 'scarcity'. Commodity prices may be \
incorrect if assets have more than one output commodity. See: {ISSUES_URL}/677",
commodity.id
);
}

// check that units are provided
ensure!(
!commodity.units.trim().is_empty(),
Expand Down Expand Up @@ -228,7 +211,10 @@ mod tests {

#[test]
fn validate_commodity_works() {
let commodity = make_commodity(CommodityType::SupplyEqualsDemand, PricingStrategy::Shadow);
let commodity = make_commodity(
CommodityType::SupplyEqualsDemand,
PricingStrategy::FullCostAverage,
);
validate_commodity(&commodity).unwrap();
}

Expand Down
4 changes: 2 additions & 2 deletions src/input/process/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ mod tests {
description: "Test SED commodity (PJ)".into(),
kind: CommodityType::SupplyEqualsDemand,
time_slice_level: TimeSliceLevel::DayNight,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -458,7 +458,7 @@ mod tests {
description: "Test SED commodity (tonnes)".into(),
kind: CommodityType::SupplyEqualsDemand,
time_slice_level: TimeSliceLevel::DayNight,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand Down
18 changes: 9 additions & 9 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod,
levies_cons,
demand: DemandMap::new(),
Expand All @@ -664,7 +664,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: levies,
demand: DemandMap::new(),
Expand All @@ -686,7 +686,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: levies,
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -710,7 +710,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod,
levies_cons,
demand: DemandMap::new(),
Expand All @@ -726,7 +726,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -743,7 +743,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -767,7 +767,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: levies,
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand All @@ -791,7 +791,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: levies,
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand Down Expand Up @@ -1060,7 +1060,7 @@ mod tests {
description: "Test commodity".into(),
kind: CommodityType::ServiceDemand,
time_slice_level: TimeSliceLevel::Annual,
pricing_strategy: PricingStrategy::Shadow,
pricing_strategy: PricingStrategy::FullCostAverage,
levies_prod: CommodityLevyMap::new(),
levies_cons: CommodityLevyMap::new(),
demand: DemandMap::new(),
Expand Down
Loading
Loading