There is a newer version of the record available.

Published June 6, 2023 | Version WIP
Other Open

SpineOpt demo for the IEA EBC Annex 83 summer school

Authors/Creators

Description

Please note that this version is still very much a work in progress, but can be used for testing the installation.

# SpineOpt demo for the IEA EBC Annex 83 PhD summer school

A [Spine Toolbox](https://github.com/spine-tools/Spine-Toolbox) workflow for
demoing [SpineOpt](https://github.com/spine-tools/SpineOpt.jl) for the
IEA EBC Annex 83 PhD summer school.


## Key contents

1. `.spinetoolbox/` contains the Spine Toolbox project files.
2. `code/` contains the source code of the key modules required to run this workflow.
3. `data/` contains the raw data files used in creating the simple model.
4. `install.bat` script installs the contained Spine Toolbox version, and runs `install_julia_modules.jl`.
5. `install_julia_modules.jl` script is run as part of `install.bat`, setting up the necessary Julia modules in the project.
6. `toolbox.bat` starts Spine Toolbox and pre-loads the project.


## Installation

This project uses both [Python](https://www.python.org/) and
[Julia](https://julialang.org/), so one needs to have both of
them installed. [Miniconda](https://docs.conda.io/en/latest/miniconda.html)
is used for Python package management.

**All of the above need to be installed and included in your `path`, so that they can be called from the command line in the scripts!**

The `install.bat` script can be used to automatically install the contents of
this Spine Toolbox project, and performs the following steps:

1. Creates a Spine Toolbox compatible Python 3.9 Conda environment named `SpineOptPEDDemo`.
2. Activates said environment.
3. Installs the contained Spine Toolbox into the environment using `pip`.
4. Runs the `install_julia_modules.jl` script to set up the contained Julia modules.

Additionally, it may be necessary to configure Spine Toolbox to use the correct Julia.
This can be done by opening Spine Toolbox via `toolbox.bat` or by running
```
activate SpineOptPEDDemo
python -m spinetoolbox
```
and navigating to the `File -> Settings -> Tools -> Julia` to set the desired Julia path.

The `install_julia_modules.jl` script performs the necessary setup for the Julia
side of things following the steps:

1. Installs the contained `SpineInterface.jl`.
2. Configures the `PyCall.jl` module used by `SpineInterface.jl` to use the same Conda environment as the previous Spine Toolbox installation. This is important to get access to the Spine DB API from `SpineInterface.jl`. All of the remaining modules use this as a dependency, hence it needs to be installed first.
3. Installs the contained `SpineOpt.jl` used for solving the model.
4. Installs the contained `ArchetypeBuildingModel.jl`, used for processing the building models and their for SpineOpt.


## Use

The Spine Toolbox workflow comes pre-configured to run the example model.
One can open the workflow in Spine Toolbox to inspect it in more detail
using `toolbox.bat` or by running in the root folder.
```
activate SpineOptPEDDemo
python -m spinetoolbox .
```
From there, the workflow can be executed in its entirety or in parts using
the Spine Toolbox UI. Results can be examined from the `spineopt_output`
datastore.

### Editing the workflow

If one wants to mess with the simulations and their settings, it is highly
recommended to familiarize oneself with the online documentation of
[ArchetypeBuildingModel.jl](https://github.com/vttresearch/ArchetypeBuildingModel)
and [SpineOpt.jl](https://github.com/spine-tools/SpineOpt.jl).

The `data_and_definitions.sqlite` datastore contains all the building-related data and definitions,
which is processed for SpineOpt by ArchetypeBuildingModel.jl. 

The `spineopt_template_and_data.sqlite` datastore contains the SpineOpt input data for the simple energy
system. These are in SpineOpt input data format, and provide all the necessary definitions etc.
that the building dataset might be missing.

**Any changes with staying power should be made to the above datastores!**
The `spineopt_combined_input.sqlite` merely merges the above two datastores to form a single
combined input dataset for SpineOpt.


## License

Please note that different parts of this workflow can be subject to different
licenses. In general, most parts are subject to either
the [MIT](https://mit-license.org/) or the
[Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) licenses.


## Acknowledgements

This work was carried out under the Academy of Finland project "Integration of building flexibility into future energy systems (FlexiB)" under grant agreement No 332421.

This work has also benefited from the EU project Mopo (2023-2026), which has received funding from
European Climate, Infrastructure and Environment Executive Agency under the
European Union’s HORIZON Research and Innovation Actions under grant agreement N°101095998.

### ERA5 weather data 

Hersbach, H., Bell, B., Berrisford, P., Hirahara, S., Horányi, A., Muñoz‐Sabater, J., Nicolas, J., Peubey, C., Radu, R., Schepers, D., Simmons, A., Soci, C., Abdalla, S., Abellan, X., Balsamo, G., Bechtold, P., Biavati, G., Bidlot, J., Bonavita, M., De Chiara, G., Dahlgren, P., Dee, D., Diamantakis, M., Dragani, R., Flemming, J., Forbes, R., Fuentes, M., Geer, A., Haimberger, L., Healy, S., Hogan, R.J., Hólm, E., Janisková, M., Keeley, S., Laloyaux, P., Lopez, P., Lupu, C., Radnoti, G., de Rosnay, P., Rozum, I., Vamborg, F., Villaume, S., Thépaut, J-N. (2017): Complete ERA5 from 1979: Fifth generation of ECMWF atmospheric reanalyses of the global climate. Copernicus Climate Change Service (C3S) Data Store (CDS).

### PyPSA/atlite for weather data processing

Hofmann et al., (2021). atlite: A Lightweight Python Package for Calculating Renewable Power Potentials and Time Series. Journal of Open Source Software, 6(62), 3294, https://doi.org/10.21105/joss.03294

### ENTSO-E transparency platform data

Installed generation capacities per production type in Finland and Estonia, as well as total load for Finland and Estonia for the year 2015.

https://transparency.entsoe.eu/dashboard/show

### Renewables.ninja

Solar and wind capacity factor timeseries for Finland and Estonia for the year 2015:

[1] Pfenninger, Stefan and Staffell, Iain (2016). Long-term patterns of European PV output using 30 years of validated hourly reanalysis and satellite data. Energy 114, pp. 1251-1265. doi: 10.1016/j.energy.2016.08.060

[2] Staffell, Iain and Pfenninger, Stefan (2016). Using Bias-Corrected Reanalysis to Simulate Current and Future Wind Power Output. Energy 114, pp. 1224-1239. doi: 10.1016/j.energy.2016.08.068

Files

SpineOpt_PED_demo.zip

Files (156.5 MB)

Name Size Download all
md5:1e002aec6d952701dc3bca7756c3a66f
156.5 MB Preview Download

Additional details

Funding

European Commission
Mopo - Comprehensive, fast, user-friendly and thoroughly validated open-source energy system planning framework 101095998
Research Council of Finland
Integration of building flexibility into future energy systems / Consortium: FlexiB 332421