--- jupytext: text_representation: extension: .md format_name: myst format_version: 0.13 jupytext_version: 1.10.3 kernelspec: display_name: Python 3 language: python name: python3 --- ## Marginal cost statistics (€/MWh) *indexed by : energy, node, statistics, test case* ### Description This KPI computes the minimum, maximum, average and demand weighted average value of the marginal costs over the optimisation horizon for every node. It is intended to have an immediate overview of the marginal costs across the different nodes of the energy system. For a more detailed analysis, please use the temporal KPI [Marginal costs](../temporal_kpis/marginal_costs.md)

Modelling hint

To simplify the analysis, CO2 and captured CO2 are included in this indicator. The unit is then €/t instead of €/MWh so that it is easy to directly compare all marginal costs in the energy system.
### Calculation The equation below is valid for any realization and is therefore implicitly indexed by test case. Let $mc_{n, e}$ be the marginal cost timeseries for energy $e$ at node $n$. We can then express the different values returned by this indicator as follows. #### Minimum $$ x_{n, e}^{min} = min_t[ \text{ } mc_{n, e}(t)] $$ #### Maximum $$ x_{n, e}^{max} = max_t[ \text{ } mc_{n, e}(t)] $$ #### Average $$ x_{n, e}^{avg} = mean_t[ \text{ } mc_{n, e}(t)] $$ #### Weighted average $$ x_{n, e}^{wgt \text{ } avg} = \frac{\sum_{t} mc_{n, e}(t) \cdot c_{n, e}(t)}{\sum_{t} c_{n, e}(t)} $$ With: - $c_{n, e}(t)$ : the total consumption for the energy $e$ at timestep $t$ at node $n$. - $c_{n, e}(t) = \sum_\limits{a \in A_{n,e}^c} c_{a, e, n}(t)$

Calculation hint

For more details on how marginal costs timeseries are computed out of the optimization results please refer to the [Marginal costs KPI documentation](../temporal_kpis/marginal_costs.md)
*Global variables and parameters notations definitions can be consulted [here](../notations.md).* ### Indexing - The energy index of this KPI refers to the energy which marginal costs is displayed - The node index of this KPI refers to the node at which an energy marginal costs is displayed - The statistics index of this KPI refers to the type of statistics displayed for marginal costs among minimum, maximum, average and weighted average - The test case index corresponds the test case of the realization variables and parameters are taken from