This repository contains example code related to the paper "Efficient quantification of the impact of demand and weather uncertainty in power system models".
It also contains all source code and data associated with the three test-case models used in the paper (the LP planning, MILP planning and operation models). These models are modified versions of a more general class of test power system models, available open-source in this repository, where they are documented and available in a more general form. If you want to use these models for your own research, its easier to use that respository instead of this one.
To run an example of the methodology, call
python3 main.py
from a command line. This runs a simple example of the methodology on the LP_planning model. The default settings take 10-15 minutes to run. To customise it, it's easiest to change arguments directly in main.py
-- the settings can be specified in the function run_example
. In the default settings, it creates a new directory called outputs
with the point estimates and standard deviation estimates for the outputs of the operation
model, run across 2017 data. These are calculated by first running the model once across 2017 (to get the point estimate), followed by 10 bootstrap simulations of 12 weeks each (to get the error bars). You can change these settings in main.py
.
The default settings use short samples to run quickly. If you want to actually use the method, it's recommended to increase the subsample length and number of bootstrap simulations. This can be done by changing the arguments in the run_example
function in main.py
. For faster results, run the bootstrap simulations in parallel.
This repository also contains a few tests and benchmarks which can be used to check if the code is running as expected. Running tests.py
from a command line starts a number of consistency tests and checks the outputs from a very simple application of the BUQ algorithm against a set of benchmarks. It should take around 10-15 minutes to run, and will raise warnings if any tests do not pass.
models/
: power system model generating files, forCalliope
(see acknowledgements).data/
: demand and weather time series datatest_benchmarks
: some benchmarks -- used bytests.py
to see if things are working correctly.
main.py
: a script that performs one full run through the methodology, using a single long simulation for a point estimate and multiple short simulations across bootstrap samples to estimate the standard deviation. It can be called from a command line.buq.py
: functions for the bootstrap uncertainty quantification (BUQ) algorithm, both the months and weeks scheme from the paper.models.py
: some utility code for the models.tests.py
: some tests to check if the models are behaving as expected.
Since main.py
, containing all code, is a short file with only a few functions, and is dependent on a particularl model framework, it's probably easier to fork and edit any relevant code into a personal project as opposed to installing a new module. For this reason, this repository does not contain a setup.py
file.
Running main.py
works with:
- Python modules:
Calliope 0.6.6
: see this link for installation. Everything also works with0.6.5
, and may work with many other versions.- Basic modules:
numpy
,pandas
.
- Other:
cbc
: open-source optimiser: see this link for installation. Other solvers (e.g.gurobi
) are also possible -- the solver can be specified inmodels/6_region/model.yaml
. All code is known to run with the above setup, but may also run with different verions than those specified above.
Adriaan Hilbers. Department of Mathematics, Imperial College London. a.hilbers17@imperial.ac.uk.
Models are constructed in the modelling framework Calliope
, created by Stefan Pfenninger and Bryn Pickering. See callio.pe or the following paper for details:
- Pfenninger, S. and Pickering, B. (2018). Calliope: a multi-scale energy systems modelling framework. Journal of Open Source Software, 3(29), 825, doi:10.21105/joss.00825.
The demand and wind dataset is based on work by Hannah Bloomfield et al. Details can be found in the following paper and dataset:
-
Bloomfield, H. C., Brayshaw, D. J. and Charlton-Perez, A. (2019) Characterising the winter meteorological drivers of the European electricity system using Targeted Circulation Types. Meteorological Applications. ISSN 1469-8080 (In Press). doi:10.1002/met.1858
-
HC Bloomfield, DJ Brayshaw, A Charlton-Perez (2020). MERRA2 derived time series of European country-aggregate electricity demand, wind power generation and solar power generation. University of Reading. Dataset. doi:10.17864/1947.239