Skip to content

Energy Technologies MPhil ETB1 masterclass in Energy Systems Modelling

License

Notifications You must be signed in to change notification settings

brynpickering/ET-masterclass-2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ET-Masterclass-2024

Energy Technologies MPhil ETA1 masterclass in Energy Systems Modelling.

This repository contains a subset of the Euro-Calliope pre-built model, containing two countries in the European energy system. It is built for use in Calliope v0.7. The model is available on the national spatial resolution and daily temporal resolution, with a subset of technologies available compared to the base Euro-Calliope.

Euro-Calliope models like this can be built manually, which adds more configuration options. To learn how to build Euro-Calliope manually, head over to Euro-Calliope's documentation.

At a glance

The base Euro-Calliope is a model of the European energy system, with each node representing an administrative unit. It is built on three spatial resolutions: on the continental level as a single node, on the national level with 34 nodes, and on the regional level with 497 nodes. At each spatial node, renewable generation capacities (wind, solar, bioenergy) and balancing capacities (battery, hydrogen) can be invested in to meet electricity demand, and heat pumps or conventional natural gas can be invested in to meet building heat demand. In addition, a fixed amount of hydro electricity and pumped hydro storage is available, based on what already exists today. Once invested in, technologies can satisfy energy demands at each node, where demand is based on historic data. Nodes are connected through electricity transmission lines, which may have unrestricted capacity or be limited based on real data. Using Calliope, the model is solved as a linear optimisation problem with total monetary cost of all capacities and their operation as the minimisation objective.

Prepare

First, you will need to install software on your device:

  1. VSCode. This gives you access to an Interactive Development Environment (IDE) in which to edit code and to interact with your device's terminal. On Windows, I recommend you follow the command prompt instructions.
  2. Miniforge. This gives you access to conda in your device's terminal, with which you can create isolated Python environments to work in. There are other variants of access to conda (Anaconda, Miniconda, Mambaforge, etc.). I recommend Miniforge as it defaults to the open-source conda-forge channel, instead of the commercial defaults channel.

Note

On Windows, you should download Miniforge3-Windows-x86_64 from the releases. You may find that on Chrome it says the download is "dangerous" - you can safely bypass this and force the download.

  1. The Gurobi solver license. This gives you access to a high-performance optimisation solver.

Tip

You can ignore steps 2 and 3 of the instructions (downloading the installer) and go straight to requesting a "named user" license after registering. See our Gurobi license section for details on installing the license.

Note

You can only request and set up the license while connected to the university network (i.e., connected to eduroam and not behind a personal VPN).

Set up VSCode

With this software installed, you can then set up VSCode to allow access to conda and git from the "terminal":

  1. Set the correct terminal
    1. Open VSCode.
    2. Open the command palette (Control-Shift-P, shows a bar at the top of the screen).
    3. Search for Terminal: Select Default Profile.
    4. Select Command Prompt.
  2. Install the Python Extension. Click on the "Extensions" tab on the left-hand side of VSCode (four squares) and search for the official Microsoft Python extension.
  3. Set your Python environment
    1. Open the command palette (Control-Shift-P, shows a bar at the top of the screen).
    2. Search for Python: Select Interpreter
    3. Select base (it should have miniforge3 in the file path)
  4. Open a new terminal window (Terminal top-bar tab -> New Terminal, it will open at the bottom of the screen).
  5. Run conda install git in the terminal.

Clone the GitHub repository

With VSCode set up, you can "clone" (i.e. copy) this repository to your device:

  1. In the VSCode terminal, call git clone https://github.com/brynpickering/ET-masterclass-2024.git <output-directory>\ET-masterclass-2024. <output-directory> should be a directory on your device where you want to store cloned GitHub repositories (often something like %USERPROFILE%\Repositories on Windows or ~/Repositories on Linux/MacOS).
  2. Then you can open that cloned repository (i.e. downloaded folder) in VSCode (File top-bar tab -> Open Folder -> navigate to <output-directory>\ET-masterclass-2024).

Create the masterclass conda environment

Finally, you can create the isolated Python working environment for this masterclass:

  1. In your <output-directory>\ET-masterclass-2024 VSCode session, open a new terminal.

  2. Run the following two commands to create your working environment and then to activate it:

    conda env create -f environment.yaml
    conda activate et-masterclass

Set the Gurobi license

With the et-masterclass conda environment activated, you can then call the grbgetkey command in the terminal to install the Gurobi license that you have requested, e.g.:

grbgetkey ae36ac20-16e6-acd2-f242-4da6e765fa0a

The license key can be found on the Gurobi portal, under the "Licenses" tab and then the "show installation instructions" button.

Run

We recommend you run the models from the terminal. They will be available on your device after following the preparation steps, and visible in the VSCode Explorer when you have the <output-directory>\ET-masterclass-2024 folder open in VSCode. To run a model and save the outputs in the NetCDF format (a storage convention for multi-dimensional data):

calliope run "model-gbr-irl/model.yaml" --save_netcdf "model-gbr-irl.nc"

Run a scenario

There is one pre-defined "scenario" in the GBR+IRL model, to add in nuclear as a technology. To introduce this, you can add it to your command line arguments

calliope run "model-gbr-irl/model.yaml" --save_netcdf "model-gbr-irl-with-nuclear.nc" --scenario add_nuclear

Visualise

Once you have results, you can use calligraph, a tool for visualising Calliope model results that we are currently developing (i.e., expect some rough edges). Once you have run a model, you can call calligraph with the name of the NetCDF file:

calligraph "model-gbr-irl.nc"

This will open a tab in your browser with a data dashboard.

Go further

This pre-built model is a very simple example. You can extend / amend it directly by modifying the YAML files. You can also find more complete pre-built models on Zenodo. You may find that even that needs customisation to fit your purpose. Once you've managed to run them, it's a good point in time to learn about model customisation options in Euro-Calliope.

More information

For more information on Euro-Calliope and how to use and modify the models, see Euro-Calliope's documentation.

License and attribution

Euro-Calliope is developed and maintained within the Calliope project.

Creative Commons Licence
This work is licensed under a Creative Commons Attribution 4.0 International License.

Contains modified Copernicus Atmosphere Monitoring Service information 2020. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

Contains modified data from Renewables.ninja.

Contains modified data from Open Power System Data.

For more details on sources, see the Euro-Calliope GitHub repository.

About

Energy Technologies MPhil ETB1 masterclass in Energy Systems Modelling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published