fn add_marginal_cost_prices<'a, I, J>(
activity_for_existing: I,
activity_keys_for_candidates: J,
existing_prices: &mut CommodityPrices,
year: u32,
markets_to_price: &HashSet<(CommodityID, RegionID)>,
commodities: &CommodityMap,
time_slice_info: &TimeSliceInfo,
)where
I: Iterator<Item = (&'a AssetRef, &'a TimeSliceID, Activity)>,
J: Iterator<Item = (&'a AssetRef, &'a TimeSliceID)>,Expand description
Calculate marginal cost prices for a set of commodities and add to an existing prices map.
This pricing strategy aims to incorporate the marginal cost of commodity production into the price.
For a given asset, a marginal cost can be calculated for each SED/SVD output, which is the sum of:
- Generic activity costs: Activity-related costs not tied to a specific SED/SVD output (variable operating costs, cost of purchasing inputs, plus all levies and flow costs not associated with specific SED/SVD outputs). These are shared over all SED/SVD outputs according to their flow coefficients.
- Commodity-specific activity costs: flow costs/levies for the specific SED/SVD output.
For example, consider an asset A(SED) -> B(SED) + 2C(SED) + D(OTH), with the following costs:
- Variable operating cost: 5 per unit activity
- Production levy on C: 3 per unit flow
- Production levy on D: 4 per unit flow
- Price of A: 1 per unit flow
Then:
- Generic activity cost per activity = (1 + 5 + 4) = 10
- Generic activity cost per SED/SVD output = 10 / (1 + 2) = 3.333
- Marginal cost of B = 3.333
- Marginal cost of C = 3.333 + 3 = 6.333
For each region, the price in each time slice is taken from the installed asset with the highest marginal cost. If there are no producers of the commodity in that region (in particular, this may occur when there’s no demand for the commodity), then candidate assets are considered: we take the price from the candidate asset with the lowest marginal cost, assuming full utilisation (i.e. the single candidate asset that would be most competitive if a small amount of demand was added).
For commodities with seasonal/annual time slice levels, marginal costs are weighted by activity (or the maximum potential activity for candidates) to get a time slice-weighted average marginal cost for each asset, before taking the max across assets. Consequently, the price of these commodities is flat within each season/year.
§Arguments
activity_for_existing- Iterator over(asset, time_slice, activity)from optimisation solution for existing assetsactivity_keys_for_candidates- Iterator over(asset, time_slice)for candidate assetsexisting_prices- Existing prices to use as inputs and extend. This is expected to include prices from all markets upstream of the markets we are calculating for.year- The year for which prices are being calculatedmarkets_to_price- Set of markets to calculate marginal prices forcommodities- Map of all commodities (used to look up each commodity’stime_slice_level)time_slice_info- Time slice information (used to expand groups to individual time slices)