Skip to content

Input data: define a new modelΒΆ

This section explains how to set up a new model for a particular country/region using the PyPSA-SPICE model builder. Once your model is step you can run the model as described in Model execution.

Steps of setting up a new model:

  1. Adjust the information inside base_config.yaml.
  2. Run snakemake -c1 build_skeleton to create a folder structure and template CSV files for your input data. All input folders and files shall be created inside the data folder after this command is executed.
  3. Fill in the skeleton CSVs with the required data manually or using available resources.

An example structure created by build_skeleton is displayed below. The following sections will use this example to explain the settings.

Step 1: set up the base configuration fileΒΆ

Setting up the base config requires defining the scope and resolution of the model. Specifically, defining which countries/regions will be represented in the model and for which year the model will be run. While it is possible to change these after initial model is created, it would require significant effort to add new regions/years in the input CSVs.

The base_config.yaml contains two parts which will be used both for folder structure building and model executions:

Init settings in the config.yaml file
path_configs: #(1)!
  data_folder_name: pypsa-spice-data
  project_name: project_01
  input_scenario_name: scenario_01 # (2)!
  output_scenario_name: scenario_01_tag1 # (3)!

base_configs:
  regions: 
    XY: ["NR","CE", "SO"] # (4)!
    YZ: ["NR","CE", "SO"] 
  years: [2025, 2030, 2035, 2040, 2045, 2050] # (5)!
  sector: ["p-i-t"] # (6)!
  currency: USD # (7)!
  1. This section is for configuring directory structure for storing model inputs and results.
  2. A custom name you define for the input scenario folder in your model.
  3. A custom name you define for the output scenario folder to save your model results.
  4. List of regions or nodes within each country. This defines the network’s nodal structure. The country list contains 2-letter country codes according to ISO 3166.
  5. Modelled years should be provided as a list.
  6. Options: [p, p-i, p-t, p-i-t], representing power (p), industry (i), and transport (t) sectors.
  7. Currency usd in the model. The default setting is USD (also used in example data). Format shall be in all uppercases, ISO4217 format.

The final skeleton folder path will follow this structure:: data/data_folder_name/project_name.

By setting different input_scenario_name and country or regional settings in the base_configs section (see details in Model configuration), a new skeleton structure under the same data_folder_name folder will be created.

Step 2: build the skeletonΒΆ

After modifying the configuration file, run the following command in your terminal.

Generating the skeleton folder
snakemake -c1 build_skeleton

This step creates your skeleton folder and files which can be feed with your data.

Structure of Folder and files created by build skeleton script
πŸ“¦ data
 β”— πŸ“‚ pypsa-spice-data
    β”— πŸ“‚ project_01
       ┣ πŸ“‚ input
       ┃ ┣ πŸ“‚ global_input
       ┃ ┃ ┣ πŸ“œ availability.csv
       ┃ ┃ ┣ πŸ“œ demand_profile.csv
       ┃ ┃ ┣ πŸ“œ ev_parameters.csv
       ┃ ┃ ┣ πŸ“œ power_plant_costs.csv
       ┃ ┃ ┣ πŸ“œ renewables_technical_potential.csv
       ┃ ┃ ┣ πŸ“œ storage_costs.csv
       ┃ ┃ ┣ πŸ“œ storage_inflows.csv
       ┃ ┃ β”— πŸ“œ technologies.csv
       ┃ β”— πŸ“‚ scenario_01
       ┃   ┣ πŸ“‚ industry
       ┃   ┃ ┣ πŸ“œ buses.csv
       ┃   ┃ ┣ πŸ“œ decommission_capacity.csv
       ┃   ┃ ┣ πŸ“œ direct_air_capture.csv
       ┃   ┃ ┣ πŸ“œ fuel_conversion.csv
       ┃   ┃ ┣ πŸ“œ heat_generators.csv
       ┃   ┃ ┣ πŸ“œ heat_links.csv
       ┃   ┃ ┣ πŸ“œ loads.csv
       ┃   ┃ ┣ πŸ“œ storage_capacity.csv
       ┃   ┃ β”— πŸ“œ storage_energy.csv
       ┃   ┣ πŸ“‚ power
       ┃   ┃ ┣ πŸ“œ buses.csv
       ┃   ┃ ┣ πŸ“œ decommission_capacity.csv
       ┃   ┃ ┣ πŸ“œ fuel_suppliers.csv
       ┃   ┃ ┣ πŸ“œ interconnector.csv
       ┃   ┃ ┣ πŸ“œ loads.csv
       ┃   ┃ ┣ πŸ“œ power_generators.csv
       ┃   ┃ ┣ πŸ“œ storage_capacity.csv
       ┃   ┃ ┣ πŸ“œ power_links.csv
       ┃   ┃ β”— πŸ“œ storage_energy.csv
       ┃   ┣ πŸ“‚ transport
       ┃   ┃ ┣ πŸ“œ buses.csv
       ┃   ┃ ┣ πŸ“œ loads.csv
       ┃   ┃ ┣ πŸ“œ pev_chargers.csv
       ┃   ┃ β”— πŸ“œ pev_storages.csv
       ┃   β”— πŸ“œ scenario_config.yaml
       β”— πŸ“‚ results (will be created when during the model execution)

Tip

Once you’ve created a skeleton data folder for one scenario, you can simply duplicate the scenario folder and rename the folder name to set up additional scenarios. However, we recommend doing this only after you’ve completed filling in the data for the first one.

Step 3: fill in the skeleton CSVsΒΆ

Once a new skeleton folder is created, project-specific CSV templates will be setup. Each CSV will include placeholders marked with Please fill here. These need to be completed with relevant data so the model can perform more accurate optimisations.

To help you fill these files:

Once all the necessary input data is provided, adjust model and solver settings in Model configuration and follow Model execution to understand the model logic and how to run the model.

Tip

By default, the input structure considers large number of technologies represented in the model. If the particular technologies are not needed in your model, it is good practice to remove the input data for these technologies. You can also define your own technologies and customise the model accordingly.