Code and analysis used for calculating the merit order effect of renewables on price and carbon intensity of electricity markets
Project description
MOE-Py
Installation
To reduce dependency bloat the moepy
library can be installed in two ways. If you just wish to use the LOWESS curve fitting aspects of the library then you can install it using:
pip install moepy
If you wish to reproduce the analysis used for estimation of the Merit Order Effect in this paper please run :
pip install moepy[research]
Overview
This repository outlines the development and usage of code and analysis used in calculating the Merit-Order-Effect (MOE) of renewables on price and carbon intensity of electricity markets. Beyond MOE analysis the moepy
library can be used more generally for standard, quantile, and bootstrapped LOWESS estimation. The particular implementation of LOWESS in this software has been extended to significantly reduce the computational resource required.
The original LOWESS model was developed by W. S. Cleveland in 1979 and the FORTRAN code for it can be found here. LOWESS is an acronym for Locally Weighted Scatterplot Smoothing, whereby multiple regressions are fitted over different regions of the data domain and then combined based on weightings linked to the distance between the prediction point and the data used to fit each of the local regressions.
moepy
exposes several variants on the traditional LOWESS, including estimation of confidence and prediction intervals, as well as the robust LOWESS proposed by Cleveland in 1988. Examples of how to use each of these are shown in the Quick-Start notebook. An example of a LOWESS curve estimated by moepy
can be seen below, the code to generate the plot can be found here.
The library also includes the option to ensemble LOWESS models together (very meta) and smooth them over time without including time within the regression itself. This is particularly useful when there are many exogenous factors changing over time but you don't have data for them, meaning it is therefore not easy to capture them within the regression. An example fit from the ensembled date-smoothing model is shown below, depicting the marginal price curve of dispatchable generation in Great Britain. For ease of use this model has been made to work directly with Pandas datetime indexes and is again exposed through a standard sklearn model API.
Examples
Several notebooks have been created to show examples of how LOWESS estimations can be made using various data sources and for different analysis purposes, these include:
- Quantile estimation of hydro-power production in Portgual
- Confidence interval estimation of gravitational wave observations
- Cleaning of wind power curves
- Estimation of electricity price curves
Key plots from each of these can be seen below.
Get involved! If you have used moepy
for something cool and want to share it with others please create a pull request containing a notebook with your self-contained example.
Why MOE-Py?
LOWESS implementation in Python is relatively sparse compared to most regression methods. Statsmodels provides a LOWESS model, however it exposes no predict method, forcing users to add wrappers on top that linearly interpolate between the results Statsmodels does return (e.g. here and here). In contrast the moepy
library is made specifically for LOWESS estimation and provides it through an sklearn
compatible API, meaning that it works within the broader sklearn
eco-system for model ensembling and tuning as well as reducing the learning barrier.
Paper
The moepy
library was developed to enable new research into the Merit-Order-Effect of renewables in the British and German power systems. The full paper can be found here, the abstract is shown below:
This paper presents an empirical analysis of the reduction in day-ahead market prices and CO2 emissions due to increased renewable generation on both the British and German electricity markets. This Merit Order Effect is becoming more important as markets evolve to incorporate greater shares of renewable energy sources, driving renewable capture price cannibilisation and market volatility. However, explicitly determining its magnitude can be challenging due to the confidential nature of the data required. Existing statistical methods for inferring this effect have focused on linear parametric approaches. However, these have a number of disadvantages. In this work we propose a flexible non-parametric blended Locally Weighted Scatterplot Smoothing approach that captures the non-linear relationship between electricity price and dispatchable generation. This is the first application of this method in this context. We found the accuracy of this approach comparable to methods used in modern price back-casting literature. Our results indicate that the Merit Order Effect has increased dramatically over the time period analysed, with a sharp and continuing increase from 2016 in Britain. We found that renewables delivered total reductions equal to 318M and 442M tonnes of CO2 and savings of €56B and £17B in Germany and Britain respectively.
The key premise behind the analysis is that intermittent renewables with no fuel costs displace high-cost dispatchable generation - this is called the Merit Order Effect (MOE). The effect can be visualised as a rightward shift in the marginal price curve of electricity, which combined with the inelasticity of demand results in a lower market clearing price (shown below).
In this work a time-adaptive LOWESS was used to estimate the marginal price curve, then simulate the MOE. We calculated significant CO2 emission and electricity price savings for Britain and Germany. Results for 2019 are shown in the table below.
Germany | Great Britain | |
---|---|---|
Price ([EUR,GBP]/MWh) | 20.53 | 9.8 |
Price Reduction (%) | 36.7 | 19.3 |
Carbon (Tonnes/h) | 5085 | 1637 |
Carbon Reduction (%) | 34.88 | 33.53 |
We identified a strong relationship between increasing renewable penetration and the Merit-Order-Effect. In Britain the MOE has seen a sharp increase since 2016, with an average 0.67% price reduction per percentage point increase in renewable penetration.
Referencing
If you wish to reference a specific version of this software please use the following citation, changing the DOI to reflect the specific version you used (these are available through the Zenodo link at the top of this page):
@software{bourn_moepy_2021,
title = {moepy},
url = {https://ayrtonb.github.io/Merit-Order-Effect/},
abstract = {This repository outlines the development and usage of code and analysis used in calculating the Merit-Order-Effect (MOE) of renewables on price and carbon intensity of electricity markets. Beyond MOE analysis the `moepy` library can be used more generally for standard, quantile, and bootstrapped LOWESS estimation. The particular implementation of LOWESS in this software has been extended to significantly reduce the computational resource required.},
author = {Bourn, Ayrton},
month = mar,
year = {2021},
doi = {10.5281/zenodo.4642896},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file moepy-1.1.4.tar.gz
.
File metadata
- Download URL: moepy-1.1.4.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b60398de6bba2ca8b39e9184380008cb3a86b90877be003b54a0d6230959015 |
|
MD5 | 70a4acbdbc555745b9791cb5504237ab |
|
BLAKE2b-256 | 31787b4bc2638e9d0b084804d12e755af7598d6cc80e0e8ca8d8e0df42fb2e93 |
File details
Details for the file moepy-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: moepy-1.1.4-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cd1cf1e4131502f25d0d0d53a25ffded856efa7239d7072b33833dfc679850e |
|
MD5 | 8870865a68afddd63db58315b70b4897 |
|
BLAKE2b-256 | ae2683fc7ebd62095b9ec6c7ae06b1aeebf2b93d704d21856937465d6d9deeed |