Estimating the marginal carbon intensity of electricity with machine learning

July 03, 2018 · 9 min read

How do you know where your electricity comes from? The answer, in its simplest form, is given by the electricityMap. However, when consumers are faced with a decision — for example deciding when to charge an electric vehicle — things get more subtle. So why shouldn’t you charge your electric vehicle when your electricity is physically low-carbon?

It turns out that when a consumer is asking for more electricity, that additional electricity will come from the cheapest power plant that still has spare capacity at that time. This power plant is called the marginal power plant. Typically the marginal plant is a system that can react quickly to changes in electricity demand, such as a gas turbine. It however cannot be a wind turbine or solar cells, as you can’t command them to produce more (unless you command the weather that is).

marginal-demand

Generation systems are called upon in a specific order of increasing cost (in order to minimise overall cost). That order gives a curve, called the “merit order curve”.

As a consumer, when you decide to charge your electric vehicle at a given time, you are causing the marginal plant to produce more, and therefore, are responsible for the carbon emissions associated to it. Those emissions are called marginal carbon emissions. It is the quantity that should guide our choice as flexible consumers. For example, it is better to charge your electric vehicle when a hydro dam provides the additional electricity, compared to when a gas turbines does (as the latter has much higher emissions). Note that long-term effects exist (e.g. the depletion of a hydro reservoir that would causes coal plants to supply electricity once it’s empty), but we here focus on short-term effects.

Traditionally, marginal carbon emissions were calculated using assumptions on what kind of generation would be marginal at a given time. However, we’d like to present an alternative: Instead of assuming what kind of generation is marginal, this article is about how we use machine learning to estimate the marginal origin of electricity, and thereafter deduct the associated carbon emissions. Let’s dive in!

The European electricity system is incredibly well connected. As a result, the marginal electricity might come from neighbouring areas. The first step is therefore to figure out which area will supply the additional demand.

At the core of the solution is a simple formula that states that any change of generation (or imports) that was historically observed can be explained by the sum of two components:

  1. One which is independent of changes in electricity demand (wind production for example)
  2. One which depends on changes in electricity demand (that’s the one we’re interested in)

This holds at all market and weather conditions (which we call situations depicted as z) and at all times.

marginal-formula

A change of generation (or import), depicted as dX, can be separated as the sum of a demand-dependent and a demand-independent contribution. The multiplier g(z) applied to a change in demand dL is the marginal factor.

The multiplier g(z) is the marginal factor in a given situation z. It represents how much the local generation (or import) X typically increases during a time interval when the demand increases by one unit during that same interval: it’s the marginal origin of electricity.

The electricityMap database has been collecting a tremendous amount of data in which these changes are observed across a variety of weather and market conditions z. The changes in generation (or import) dX are all observed in our data, together with the changes in local demand dL. We therefore simply need to estimate which situations z best separate the signal into a marginal and a non-marginal part, in order to extract the marginal factor. We will then be able to estimate the marginal origin of electricity in future known situations z.

The model is trained using our whole database of hourly data, using more than 1000 explanatory variables that together describe a whole range of various grid states (e.g. weather and market conditions). The model automatically selects the variables (situations) that best explain the observed data.

At the beginning of February 2018, our model estimated that the Eastern Denmark area (named DK2) procured roughly 80% of its marginal electricity from Sweden, the rest coming from local generation. This means that increasing demand lead (mostly) to higher Swedish imports.

marginal-origin

The Eastern Denmark area procured roughly 80% of its marginal electricity from Sweden, the rest coming from local generation. This means that increasing demand lead (mostly) to higher Swedish imports.

However, care has to be taken as Swedish electricity might not only come from Swedish generators, as Sweden is connected to both Norway, Finland, Poland and Germany. Furthermore, those might also in turn import from their neighbouring areas. As we’re interested in attributing carbon emissions, we need to trace back the area that generated the marginal electricity.

eastern-denmark

In this particular example, Eastern Denmark imports from West Denmark, which imports from Germany. It also imports from Sweden which imports from Poland and Lithuania, the latter which also imports from Poland.. whew!

In order to figure out which area generated the marginal electricity, we will have to follow the chain of imports. This is called flow tracing. Here’s an brief outline of the methodology:

  1. For all areas, we estimate where the marginal electricity comes from (is it local generation or imports from neighbours?)
  2. Given that a marginal import from an area yields an increase in demand in that area, write out flow conservation equations (analogous to energy conservation laws). That’s one equation per area.
  3. Simultaneously solve the system of equations in order to estimate, for each areas, the areas in which the marginal electricity was generated.

The final result is a matrix which we call the marginal topology matrix. Each row depicts which area generated which fraction of the marginal electricity of that row area. Here’s an example of how that matrix looks like at a particular time:

marginal-generation

Each row shows where the marginal electricity of that row area is generated. For example, DK-DK2 has marginal electricity coming from local generation (the diagonal term) as well as originating from Norway (although it has no direct connection to it) and Sweden.

Around 80% of the marginal electricity of Eastern Denmark comes from Sweden. But because the Swedish marginal electricity is procured from Norway and Finland, a portion of the marginal electricity that came from Sweden was actually generated in Norway.

marginal-dk

Some of the marginal electricity of the Eastern Denmark area originates from Norway although those areas are not directly connected.

So far we’ve covered how we discover which areas generate the marginal electricity of a given area. Next, we need to estimate what generation type (hydro, gas, coal…) was used to generate that marginal electricity. From there we will be able to estimate carbon emissions.

In order to estimate which generation type is used to generate an additional unit of electricity, we will re-use the formula used in the previous step by changing the two following elements:

  • The changes in generation (and imports) dX, are replaced by changes in generation of each generation type.
  • The change in demand dL is replaced by the change in local generation.

This enables us to estimate what type of generation unit is used to generate an additional unit of electricity. This is calculated for each area. For example, Eastern Denmark generates an additional unit of electricity using mostly coal and gas:

marginal-generation-dk

When the Eastern Denmark area generates an additional unit of electricity, it generates it using mostly coal and gas.

Using the IPCC emission factors for each power plant type, we can infer the emissions from marginal generation in Eastern Denmark, which are slightly under 700gCO2eq for each additional kWh generated. This carbon intensity is rather stable over time as the marginal generation mix is rather stable as well.

marginal-dk-emission

For each additional kWh of electricity generated in Eastern Denmark, a little less than 700 gCO2eq are emitted.

Marginal emissions of Eastern Denmark come both from emissions of local generation as well as marginal imports from Swedish and Norwegian areas (see previous section). The total marginal emissions are therefore computed as the weighted average of the generation emissions of those 3 areas, using the percentage of origin as weight:

marginal-dk-intensity

Large increase in marginal carbon emissions in 26–28 January is caused by decreased Swedish marginal imports (see previous graphs). Marginal emissions are often lower than the average ones, due to imports from Sweden.

What about other areas?

Here’s how, on average, each area generates its marginal electricity:

marginal-generation-mix

Here’s how an area generates an additional unit of electricity when it has to. Hydro is by far the main mechanism used, followed by coal and gas. France seems to use nuclear to complement.

and here are the associated emissions of generating an extra unit of electricity:

marginal-emission-per-area

Using the knowledge of where marginal electricity comes from (using the topology matrix), we can infer the typical marginal carbon intensity of each area:

marginal-emission-per-area-imports

Note the interesting case of Eastern Denmark (DK-DK2) which has a lower marginal carbon intensity when imports are included. This is due to marginal imports from Sweden that are mostly low-carbon hydro power.

Note that those figures only show the average situation. As the European system is highly interconnected and powered by intermittent renewables, the hourly values can fluctuate significantly.

In summary, we have developed a methodology that enables us, without using prior knowledge, to estimate the carbon impact of increasing or lowering electricity demand in a certain area.

This signal should be used to guide all of our choices as flexible consumers: when to heat up or cool down our house, or when to charge an electric vehicle. If you’re building such devices, check out our API at api.electricitymap.org, or reach out to us directly at [email protected]


Written by Olivier Corradi
Founder @ Tomorrow, CEO
follow him on