Git Product home page Git Product logo

ol-ems's Introduction

Learning-based Model Predictive Control for Microgrid Energy Management

by Vittorio Casagrande ([email protected]), Martin Ferianc, Miguel Rodrigues and Francesca Boem

This repository contains the code used for the paper "An Online Learning Method for Microgrid Energy Management Control" presented at the 31st Mediterranean Conference on Control and Automation (MED 2023) in Limassol, Cyprus. In the code we implement an innovative method for online training of a neural network used for prediction of unknown profiles (for example load demand and electricity prices) to be used for microgrid energy management. The code is implemented in Pytorch leveraging the Pytorch Lightning framework for neural network training and cvxpylayers for constructing the convex optimisation layer.

Abstract

A novel Model Predictive Control (MPC) scheme based on online-learning (OL) for microgrid energy management, is proposed. The MPC method deals with uncertainty on the load demand, renewable generation and electricity prices, by employing the predictions provided by an online trained neural network in the optimisation problem. In order to adapt to possible changes in the environment, the neural network is online trained based on continuously received data. The network hyperparameters can be selected by performing a hyperparameter optimisation before the deployment of the controller, using a pretraining dataset. We show the effectiveness of the proposed method for microgrid energy management through extensive experiments on real microgrid datasets. Moreover, we show that the proposed algorithm has good transfer learning (TL) capabilities among different microgrids.

Running the code

Several experiments can be run using the code in this repository. The power and price profiles for three different industrial sites are provided in the data folder. A standard LSTM neural network is used for prediction of the unknown profiles, all the network and optimisation parameters can be passed as command line arguments.

Getting the code

A copy of all the files can be obtained by cloning the repository:

git clone https://github.com/vittpi/ol-ems.git

Requirements

A working Python environment is required to run the code. To do this create a virtual environment and install the required packages.

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Running the experiment

To run the experiments with default parameters, run the following command:

python3 main.py

Additional command line arguments can be passed to the script to change the default parameters. For example, to change the number of hidden units of the neural network to 24, run the following command:

python3 main.py --hidden_dim 24

Hyperparameters optimisation

The syne-tune library is used for hyperparameters optimisation. To run the optimisation, run the following command:

python3 tune.py --config_file ./configurations/sample.py

where the hyperparameters to optimise are specified in the configurations/sample.py file.

Citation

If you use this code, please cite the following paper:

@inproceedings{casagrande2023online,
  title={An Online Learning Method for Microgrid Energy Management Control},
  author={Casagrande, Vittorio and Ferianc, Martin and Rodrigues, Miguel and Boem, Francesca},
  booktitle={2023 31st Mediterranean Conference on Control and Automation (MED)},
  pages={263--268},
  year={2023},
  organization={IEEE}
}

Authors

Vittorio Casagrande ([email protected]), Martin Ferianc ([email protected])

Contributing

In case you find any bugs or have any suggestions, please open an issue or a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This work was supported by the UK Engineering and Physical Sciences Research Council (EPSRC) under grant EP/W024411/1 and EP/R513143/1.

ol-ems's People

Contributors

vittpi avatar martinferianc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.