Thomas's projects

Estimation of the consumption in an electrical grid using Markov and Leontief approaches

Thomas Auriel, 20th December 2023

In this article I present to you a way to estimate how production and consumption propagate into a grid.

Introduction

There has always been a difficulty in defining what is really consumed on a network for one particular actor. Considering only the production, it is complex to estimate what is really consumed by users. Production changes over time, interconnections and storage helps to match the load at any time. And since all the consumers are connected to all the producers it is not trivial to attribute part of a production to a consumer.

In the next figures, you can see a difference between the production and the consumption in Spain and Portugal. The production is higher than the consumption.

The colors represent the production. And the line represents the consumption. The balance and storage are added to see their impact. Positive balance/storage means they behave like production. Negative balance/storage means they behave like consumption.

Attribution strategy

To associate production to consumption, several strategies are possible. We can cite at least:

These methods allow us to attribute consumption. But it is always required to accept assumptions (and their consequences). Discussions can emerge on this and depending on the view on the electrical grid a method will be considerate valid compare to others.

It is possible to have an approach using mathematical definition. I propose with this tool to consider the electrical grid as a Markov chain or a Leontief approach.

The Markov approach shows where the production end.

The Leontief approach shows where the load is drawing its energy.

Both approaches should give the same numbers. However, we are dependent of the quality of the data. Production, load and balance never match perfectly. The previous examples show this. It means the electricity flow in the grid is not perfectly captured and the data will always show a difference. The true values should be between the two results provided by the two methods.

Explanation

To perform the calculation, we consider the European grid as a graph. This graph allows us to simplify each element as a node. Then, each generation type, country, load and exchanges are similar to nodes. The directed edges are the exchange between them.

The graph is similar to a Markov chain.

When a MWh is at node, it is split between each edge leaving the node. The division is proportional to the weight of the edges. And because the grid does not melt down and work correctly, we know there is a solution where an equilibrium is found and all the generated power ends in a storage or in a load.

Markov approach: Where does end the production in the graph (what is available to consume)

It is interesting also to notice that it is possible to follow the load. This is similar to a Leontief approach.

Leontief approach: Where the consumption end (what is driving the production).

Assumptions

Like all other methods, assumptions must be considered to understand the validity of the data:

Some mathematical assumptions need to be respected:

Example for a country with more exchanges

France present an interesting case. In the same day, it transitioned from a net importer to a net exporter. But it was still importing from a part of its neighbors.

The first two figures are the classic presentation with generation, storage and balance compared to the load.

Generation compared to production

Markov production compared to consumption The Markov approach to define the consumption (where does the energy end) shows a total lower than the reported load.

Leontief load compared to load In the opposite, the Leontief approach match the load. However, the leontief is built in such a way that all the load is distributed.

Under the hood - Mathematical Approach

The mathematical tool used to compute the attribution is the solving of Markov chains for the production point of view and Leontief chain for the load point of view.

The graph must be a connected graph. The determinant of the graph is not zero.

From there it is possible to write equations. We will take the case of Portugal and Spain. There is a bit isolated from the European grid and it is easier to understand the idea. (There is the two countries on the top of the graph.)

To simplify the example, we assume there is only wind and coal as a source for both countries.

The energy entering the each country is:

PTWind+PTCoal+PTESImport=PTPT_{Wind}+PT_{Coal}+PT_{ES Import} = PT

ESWind+ESCoal+ESPTImport+ESFRImport=ESES_{Wind}+ES_{Coal}+ES_{PT Import}+ES_{FR Import} = ES

Here we see France is implied. For this example we consider the France as unique source. We don't decompose it.

The energy leaving each country is:

PT=PTLoad+PTESExportPT = PT_{Load}+PT_{ES Export}

ES=ESLoad+ESPTExport+ESFRExportES = ES_{Load}+ES_{PT Export}+ES_{FR Export}

It is not necessary to solve the equation analytically. There is the possibility to use matrices. We can call it the exchange matrix AA. For this, we assume the columns represent the energy provided and the rows the energy consumer.

Here is a simple example (without France).

PTWPT_W PTCPT_C ESWES_W ESCES_C PTPT ESES PTLPT_L ESLES_L
PTWPT_W 0 0 0 0 0 0 0 0
PTCPT_C 0 0 0 0 0 0 0 0
ESWES_W 0 0 0 0 0 0 0 0
ESCES_C 0 0 0 0 0 0 0 0
PTPT 300 200 0 0 0 250 0 0
ESES 0 0 500 0 100 0 0 0
PTLPT_L 0 0 0 0 650 0 0 0
ESLES_L 0 0 0 0 0 350 0 0

The import/export between countries is simplified as direct connection.

The matrix AA is then:

A=(00000000000000000000000000000000300200000250000050001000000040006500000000003500)A = \begin{pmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 300 & 200 & 0 & 0 & 0 & 250 & 0 & 0\\ 0 & 0 & 500 & 0 & 100 & 0 & 0 & 0\\ 0 & 0 & 400 & 0 & 650 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & 0 & 350 & 0\\ \end{pmatrix}

Depending on the studied case, a normalization operation is necessary:

AMarkov=AijkAikA_{Markov} = \frac{A_{ij}}{\sum_{k} A_{ik}}

ALeontief=(AijkAkj)1A_{Leontief} = \left( \frac{A_{ij}}{\sum_{k} A_{kj}} \right)^{-1}

Another vector will be necessary for to the operation: the result vector BB.

BMarkov=(PTCPTWPTESCESWES00)   BLeontief=(000000PTLESL)B_{Markov}= \begin{pmatrix} PT_C \\ PT_W \\ PT \\ ES_C \\ ES_W \\ ES \\ 0 \\ 0 \\ \end{pmatrix} ~~~ B_{Leontief} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ PT_L \\ ES_L \\ \end{pmatrix}

To solve the system we have to solve the equation:

x=B(IA)1x = B(I-A)^{-1}

xx is a matrix where the source are the columns and the rows the consumer. To check that there are no issues, it is possible to sum the lines and check it is similar to the complete BB vector.

With this method we have then a decomposition of the effect of the energy sources or consumption sink on each node of the graph.

In the previous example, the xx matrices are:

xMarkov=(300000000002000000000050000000000000003182122210000042285290000027518419100000251630900000)x_{Markov} = \begin{pmatrix} 300 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 200 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 500 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 318 & 212 & 221 & 0 & 0 & 0 & 0 & 0 \\ 42 & 28 & 529 & 0 & 0 & 0 & 0 & 0 \\ 275 & 184 & 191 & 0 & 0 & 0 & 0 & 0 \\ 25 & 16 & 309 & 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix}

xLeontief=(0000002752500000018416000000191309000000000000006886200000022937100000065000000000350)x_{Leontief} = \begin{pmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 275 & 25 \\ 0 & 0 & 0 & 0 & 0 & 0 & 184 & 16 \\ 0 & 0 & 0 & 0 & 0 & 0 & 191 & 309 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 688 & 62 \\ 0 & 0 & 0 & 0 & 0 & 0 & 229 & 371 \\ 0 & 0 & 0 & 0 & 0 & 0 & 650 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 350 \\ \end{pmatrix}

Compared to the previous table, this gives:

Markov PTWPT_W PTCPT_C ESWES_W ESCES_C PTPT ESES PTLPT_L ESLES_L
PTWPT_W 300 0 0 0 0 0 0 0
PTCPT_C 0 200 0 0 0 0 0 0
ESWES_W 0 0 500 0 0 0 0 0
ESCES_C 0 0 0 0 0 0 0 0
PTPT 218 212 221 0 0 0 0 0
ESES 42 28 529 0 0 0 0 0
PTLPT_L 275 184 191 0 0 0 0 0
ESLES_L 25 16 309 0 0 0 0 0
Leontief PTWPT_W PTCPT_C ESWES_W ESCES_C PTPT ESES PTLPT_L ESLES_L
PTWPT_W 0 0 0 0 0 0 275 25
PTCPT_C 0 0 0 0 0 0 184 16
ESWES_W 0 0 0 0 0 0 191 309
ESCES_C 0 0 0 0 0 0 0 0
PTPT 0 0 0 0 0 0 688 62
ESES 0 0 0 0 0 0 299 371
PTLPT_L 0 0 0 0 0 0 650 0
ESLES_L 0 0 0 0 0 0 0 350

Conclusion

As we conclude this exploration, it's clear that the task of estimating electricity consumption in an interconnected electrical grid is both complex and nuanced. The use of Markov and Leontief approaches has provided us with a specific view through which we can better understand the impact of the grid's nature on consumption patterns and provide an attribution of the flow of electricity from producers to consumers.

Through our case studies, we've seen how these mathematical models can illustrate the intricacies of electricity distribution, offering insights that are not immediately apparent through traditional methods. However, it's important to acknowledge the limitations and assumptions inherent in these models. The real-world application of these theories requires a careful consideration of these factors, along with a comprehensive understanding of the dynamic nature of electricity grids.

This article has only scratched the surface of what's possible with such mathematical tools. As the grid evolves with the integration of renewable energies and new technologies, new behaviors on the grid can be observed. For instance, it is possible to study the source of energy from one country and see where it propagates and where the bottlenecks are. Indeed, even if the interconnections are sufficients, it is possible that several power sources enter into competition to cross such an interconnection. The pursuit of a more efficient, reliable, and sustainable electricity grid continues, and it is our hope that the methodologies discussed here will contribute to this ongoing evolution.

The code to generate the figures is available in this file.