TradeRES Backbone demo
This is a Spine Toolbox 'project' that uses the Backbone energy system optimization tool.
Prerequisites
- These instructions guide you to install the demo using git, so make sure you have git: https://git-scm.com/download/win.
- Backbone is built in GAMS, which is a commercial modelling language. You need to first install GAMS and make sure you have a working licence for it.
- Next, install Spine Toolbox using the Spine Toolbox installation guide.
Installation
-
Open Command Prompt.
-
Change the current working directory to the location where you want to have the TradeRES Backbone demo repository.
-
Type git clone https://github.com/TradeRES/TradeRES-Backbone-demo.git
and press enter.
git clone https://github.com/TradeRES/TradeRES-Backbone-demo.git
-
Change the current working directory to the newly added TradeRES-Backbone-demo directory.
-
Type git submodule init
and press enter.
git submodule init
-
Type git submodule update
and press enter.
git submodule update
Note: If you are not using git, you can just download the source code (https://github.com/TradeRES/TradeRES-Backbone-demo.git) and unzip it to the location where you want to have it. To get the Backbone tool, go to https://gitlab.vtt.fi/backbone/backbone/-/tree/TradeRES, download the source code and unzip it to your newly created TradeRES-Backbone-demo-master/Backbone folder. Move the contents of the TradeRES-Backbone-demo-master/Backbone/backbone-TradeRES folder to TradeRES-Backbone-demo-master/Backbone.
Upgrading
Spine Toolbox and this project are constantly evolving. To get the latest versions, do the following:
- Upgrade Spine Toolbox (see instructions):
-
Upgrade this project by changing your current working directory to the TradeRES-Backbone-demo directory and running git pull
.
git pull
Configuring and running the workflow
- First, launch Spine Toolbox (see instructions).
- Make sure Spine Toolbox knows where the local GAMS executable is (File -> Settings -> Tools). You may also want to limit the number of concurrent processes (File -> Settings -> Engine -> Maximum number of concurrent processes -> User defined limit: 2, for example).
- Then, open this project from Spine Toolbox (File -> Open project...). The workflow is run from right to left. The inputs are on the right-hand side and the data store for the outputs is on the left-hand side.
- Configure the input Data Store BB_Spine_DB_direct: Select its icon in the Design View and in the Data Store Properties, select Dialect: sqlite. Click New Spine db. Choose a folder and a new name for the database. Save the project (File -> Save project).
- Import database and scenario templates to the input Data Store: Open the BB_Spine_DB_direct Data Store in the DB Editor by double-clicking its icon (or by selecting its icon and clicking Open editor...). In the DB Editor, import the database_template.json file stored in the Data folder (Menu -> Import...). Import also the scenario_template.json file from the same Data folder (Menu -> Import...). Commit changes (Menu -> Commit...) and close the DB Editor.
- Note: Menu icon is the three stacked lines in the upper-right corner of the DB Editor.
- Import data into the input Data Store: In the Design View, select the BB_Excel_to_SpineDB Importer icon. In the top bar of Spine Toolbox, click the Selection button next to Execute. To make sure that the data has been imported, double-click the BB_Spine_DB_direct Data Store icon and check that the DB Editor can show objects and parameter values.
-
Optional step to create another scenario where fossil units have been disabled:
- Select the BB_input_Excel Data Connection icon. In the Data Connection Properties, click the plus icon next to File paths. Go to the Data folder, copy-paste empty_data.xlsx to the same folder and rename the new file to alternative_data.xlsx. Back in the Data Connection Properties, double-click the alternative_data.xlsx file path to open the Excel file. Go to the p_unit worksheet. Copy the data below and paste it to cell A1. After pasting, make sure cell A1 contains text unit (delete an empty row from the beginning if needed). Save and close the alternative_data.xlsx file.
unit |
alternative |
eff00 |
availability |
investMIP |
maxUnitCount |
is_active |
eff01 |
op00 |
op01 |
minUnitCount |
unitCount |
DE Gas |
nofossil |
|
|
|
|
no |
|
|
|
|
|
DE Hard Coal |
nofossil |
|
|
|
|
no |
|
|
|
|
|
DE Lignite |
nofossil |
|
|
|
|
no |
|
|
|
|
|
DE Oil |
nofossil |
|
|
|
|
no |
|
|
|
|
|
DE Others non-renewable |
nofossil |
|
|
|
|
no |
|
|
|
|
|
- Run the BB_Excel_to_SpineDB Importer as in step 6. (To make importing faster, you can choose to re-import only the new file: Click the BB_Excel_to_SpineDB Importer icon in the Design View, go to Importer Properties and, under Available resources, select only the alternative_data.xlsx file. Then, in the top bar of Spine Toolbox, click the Selection button next to Execute. After running the Importer, you may want to select again the original file under Available resources for future data imports.)
- Double-click the BB_Spine_DB_direct Data Store icon. In the DB Editor, go to the Scenario tree, select Type new scenario name here... and write
base-germany-nofossil
. Select the arrow next to the newly added scenario name, select Type scenario alternative name here... and write base
. Select Type scenario alternative name here... again and write base-germany
. Finally, select Type scenario alternative name here... again and write nofossil
. You can use keyboard arrows to move in the Scenario tree. Commit changes (Menu -> Commit...) and close the DB Editor.
- Save the project (File -> Save project).
- Filter the scenarios you want to run: In the Design View, click the filter/funnel icon between BB_Spine_DB_direct and BB_sets. Make sure you have selected Backbone under Tool filter and the scenarios you want to run under Scenario filter. Save the project (File -> Save project).
- Export data from the input Data Store to the Backbone tool: Select the Export_to_BB Exporter icon in the Design View. In the top bar of Spine Toolbox, click the Selection button next to Execute.
- Optional step to test the Backbone tool instead of running the full model: Select the BB_input_files Data Connection in the Design View.
- Double-click file path ending with investInit.gms to open the file in a text editor. Go to line 42 where the number of samples is given and replace 7 by 1. This will change the number of representative weeks in the investment optimization phase from 7 to 1. Save and close the file.
- Double-click file path ending with scheduleInit.gms to open the file in a text editor. Go to line 29 where t_end parameter is given and replace 8760 by 168. This will change the operational phase of the run from one year run to one week. Save and close the file.
- Configure and run the Backbone tool with investment and operational phases: Select the Backbone_loop Tool icon in the Design View. In the top bar of Spine Toolbox, click the Selection button next to Execute.
- If GAMS is not found, open the specification editor by double-clicking the Backbone_loop Tool icon. Go to line 12, add
::
to the beginning of the line and remove ::
from the beginning of line 13. Set your correct GAMS path on line 13. Repeat on lines 35-36. Save the specification file and close the specification editor. Try running again by clicking the Selection button next to Execute.
- If GAMS is still not found, open the specification editor again. Go to line 13, add
::
to the beginning of the line and remove ::
from the beginning of line 14. Modify the command on line 14 according to what you would normally use when running GAMS from command line. Repeat on lines 36-37. Save the specification file. Try running again by clicking the Selection button next to Execute.
- Configure the output Data Store: Select the BB_results Data Store icon in the Design View. In the Data Store Properties, select Dialect: sqlite. Click New Spine db. Choose a folder and a new name for the database. Save the project (File -> Save project).
- Import results to the output Data Store: Select the BB_result_invest and Result_import Importer icons in the Design View. In the top bar of Spine Toolbox, click the Selection button next to Execute.
- In the Design View, double-click the BB_results Data Store icon to view the results.