---
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
---
Supply-demand balance (MWh)
======
*indexed by asset, data type (Demand or Production), energy, node, technology and test case*
### Description
This KPI returns the volumes of energy consumed and produced over the entire simulation for every energy, node, asset, and technology of a given context (except for CO2 energies: see [specific KPI](co2_sdb.md)).
The results indicated in this KPI are directly those of the optimization problem.
If an asset produces, it will appear in the *Production* tag of the "Data type" index.
For example, a storage asset may appear in both the *Production* and *Demand* tags, as it
consumes energy to store it and produces energy during its life cycle.
Modelling hint
Note that Voluntary Load Curtailment, which represents consumption curtailment, and Loss of
Load, which represents failure, are modelled as production assets. They will therefore appear in the *Production* tag.
This KPI is particularly interesting to understand the equilibrium between the national production and the national demand over a node for a given energy.
### Calculation
The equations below are valid for any realization and are therefore implicitly indexed by test case. Index *Technology* is directly deduced from the asset.
#### Production
Let be $x_{a, e, n}$ the value returned by the data type *Production* for a given asset $a$, energy $e$ and node $n$.
We can then express $x_{a, e, n}$ as:
$$
x_{a, e, n} = \frac{1}{N_h} * \sum_{\text{timestep } t} p_{a, e, n}(t)
$$
#### Consumption
Let be $x_{a, e, n}$ the value returned by the data type *Consumption* for a given asset $a$, energy $e$ and node $n$.
We can then express $x_{a, e, n}$ as:
$$
x_{a, e, n} = \frac{1}{N_h} * \sum_{\text{timestep } t} c_{a, e, n}(t)
$$
*Global variables and parameters notations definitions can be consulted [here](../notations.md).*