floracharbo / MARL_local_electricity

Multi-agent reinforcement learning for privacy-preserving, scalable residential energy flexibility coordination
GNU Affero General Public License v3.0
24 stars 5 forks source link

Makefile CI

Multi-agent reinforcement learning for residential energy flexibility

Contact: Flora Charbonnier, flora.charbonnier@eng.ox.ac.uk

What is it?

This project uses multi-agent reinforcement learning for the coordination of residential energy flexibility.

Cooperating agents learn to control the flexibility offered by electric vehicles, space heating and flexible loads in a partially observable stochastic environment.

The novel combination of learning from off-line convex optimisations on historical data and isolating marginal contributions to total rewards in reward signals increases stability and performance at scale. This tackles the challenge of scalability for simultaneously learning independent agents under partial observability in a stochastic environment for household-level decision-making.

The houses (agents) cooperate to minimise global system costs consisting of grid, distribution and storage costs.

For more details on the system framework, a description can be found in the peer-reviewed paper below, which uses this repository code:

Charbonnier F, Morstyn T, McCulloch MD. Scalable multi-agent reinforcement learning for distributed control of residential energy flexibility. Appl Energy 2022;314:118825. https://doi.org/10.1016/j.apenergy.2022.118825.

Main Features

The learning methods are:

The flexible technologies modelled are:

Exploration sources are:

The learning for independent learners can be

The action space can be

Rewards for independent learners can be defined as:

Energy prices follow historical Octopus's agile tariff.

Where to get it

The source code for MARL_local_electricity is currently hosted on GitHub at: https://github.com/floracharbo/MARL_local_electricity

The data pre-processing for the home energy data generation HEDGE can be found at: https://github.com/floracharbo/HEDGE.

Usage

  1. Obtain input data for HEDGE, as intructed on the README in https://github.com/floracharbo/HEDGE.

  2. Create virtual environment:

    conda create -n "my_venv" python==3.9.13
  3. Install packages, inserting your operating system (os) in the yml file name below (mac or linux).

    conda env update --name my_venv --file config_files/environments/environment_[os].yml --prune
  4. Obtain Mosek licence and move to adequate folder. e.g. https://www.mosek.com/products/academic-licenses/

  5. Activate environment:

    conda activate my_venv
  6. Define user inputs Default settings are in the inputs folder config_files/input_parameters:

    • car.yaml: battery inputs
    • gen.yaml: PV generation inputs
    • heat.yaml: heating inputs
    • loads.yaml: household loads inputs
    • grd.yaml: electricity grid inputs
    • paths.yaml: user paths inputs
    • RL.yaml: reinforcement learning inputs
    • save.yaml: data savings inputs
    • syst.yaml: general system inputs

If the user wishes to change these default settings, whilst still being able to compare previous runs in organise_results, the previous default settings should be recorded in input_parameters/previous_defaults.yaml.

To use experiment-specific settings different to the default parameters in config_files/default_input_parameters, enter specific values in the settings dictionary in the main.py file, as shown in as an example in the file. If values entered are in a list format, multiple experiments will loop though these values, so multiple experiments can be planned in one run.

  1. Runmain.py

Alternatively, settings can be entered through the command line rather than from the .py or .yaml files, e.g.

python main.py -n 5 --n_repeats 2 --n_epochs 20 -o grdC --o avail_car_step --rnn_hidden_dim 100

Where -o stands for observation, -n for the number of homes. You can add more abbreviations in the get_settings_i function in the initialise_prm.py file.

  1. Obtain results inresults folder.

License

GNU AGPLv3

Open-source data references