This module allows the user to reproduce the workflow used by the UCL ESAIL team for submissions to the Western Power Distribition Data Science competition
Project description
WPD-DS-Challenge
This repository includes the workflow used by the UCL ESAIL team for submissions to the Western Power Distribition Data Science competition.
An example charging profile from our latest submission can be seen below
Installation
You can install the battery optimisation library using:
pip install batopt
Challenge Details
High-level Overview
- A 6MWh/2.5MW battery is connected to a primary distribution substation and a 5MW solar farm in Devon, southwest England.
- Design the control of a storage device to support the distribution network to:
- Maximise the daily evening peak reduction.
- Using as much solar photovoltaic energy as possible.
- This will be done for each day for the week following the current challenge date.
- In other words it is a constrained optimisation/control problem under uncertainty.
- There will be four assessed weeks as part of this challenge.
A recording of the kick-off meeting can also be found here.
Battery Charging
The aim of this compoennt is to maximise the proportion of the battery's charge that comes from solar PV. The total battery charge can be written as:
where is the power drawn to the battery from solar generation on day , period , and is that drawn from the grid.
Whenever the battery is charging, it will draw from solar PV as much as possible, and take the remainder from the grid. We can therefore express that for a period , the battery will draw from PV an amount:
The remainder is drawn from the grid:
The proportion of energy stored in the battery from solar PV on day is expressed as:
An equivalent expression gives the proportion of energy stored in the battery that was drawn from the grid, .
The scoring function is proportional to . We therefore want to maximise by coinciding our battery charging with the solar PV generation. Note that the minimum score that can be gained from this component is 1 (entirely charged from grid), and the maximum is 3 (entirely charged from solar PV).
Battery Discharging
We'll start by defining the cost function for the demand forecasting component of the battery discharge optimisation.
For each day ( = 1, … , 7) the peak percentage reduction is calculated using:
Where:
- is the average power (in MW) over the half hour of day , where would mean the period from midnight to 00:30 AM on the current day, .
- is the average power (in MW) over the half hour of day , to minimise the peak demand over the evening period (the half hours = 32 to 42)
Our goal is to maximise the peak percentage reduction from 3.30PM to 9PM.
Constraints
We also have a number of constraints. The first constraint is on the maximum import and export of energy, in this case:
Secondly the battery cannot charge beyond its capacity, , (in MWh):
The total charge in the battery at the next time step is related to how much is currently in the battery and how much charged within the battery at time , i.e.
Finally, the battery must start empty at the start of each day in the test week. I.e. for .
Literature
The literature used in this work is being tracked using Zotero within the ESAIL group, please add new papers and comment on existing ones. These should hopefully make it a lot easier down the line if we turn the work into a paper.
Environment Set-Up
The easiest way to set-up your conda
environment is with the setup_env.bat
script for Windows. Alternatively you can carry out these manual steps from the terminal:
> conda env create -f environment.yml
> conda activate batopt
> ipython kernel install --user --name=batopt
Nb-Dev Design Approach
What is Nb-Dev?
nbdev
is a library that allows you to develop a python library in Jupyter Notebooks, putting all your code, tests and documentation in one place. That is: you now have a true literate programming environment, as envisioned by Donald Knuth back in 1983!"
Why use Nb-Dev?
It enables notebooks to be used as the origin of both the documentation and the code-base, improving code-readability and fitting more nicely within the standard data-science workflow. The library also provides a several tools to handle common problems such as merge issues with notebooks.
How to use Nb-Dev?
Most of the complexity around nbdev
is in the initial set-up which has already been carried out for this repository, leaving the main learning curve as the special commands used in notebooks for exporting code. The special commands all have a #
prefix and are used at the top of a cell.
#default_exp <sub-module-name>
- the name of the sub-module that the notebook will be outputted to (put in the first cell)#exports
- to export all contents in the cell#hide
- to remove the cell from the documentation
These just describe what to do with the cells though, we have to run another function to carry out this conversion (which is normally added at the end of each notebook):
from nbdev.export import notebook2script
notebook2script()
Potential Further Research Questions
- How does the relative importance of the discharge and charge models change seasonally?
- How much harder is it to optimise when the real-time grid carbon intensity is used?
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 batopt-0.0.4.tar.gz
.
File metadata
- Download URL: batopt-0.0.4.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d627a4450b85efb0e6edde6977a2e3229d73037b00085dfcfe8e5bb107cad254 |
|
MD5 | 06b2616e5a2ce4edca6c54081f4c363b |
|
BLAKE2b-256 | d2d8b7bba42d24d3eb1d56362af5476da948d417ab4db1af96cf5659a624d8b6 |
File details
Details for the file batopt-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: batopt-0.0.4-py3-none-any.whl
- Upload date:
- Size: 55.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef8cf5a149eb0479c7a5c287b7db1d22c9ebadd6f91f64229bef196706e3aa80 |
|
MD5 | 10a619a8190e527256309e7983fc3c86 |
|
BLAKE2b-256 | 68f50232afc2ee9b986dec9d443f82d4394deebc4245d1be58c449144852ba54 |