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:
- Adjust the information inside
base_config.yaml. - Run
snakemake -c1 build_skeletonto create a folder structure and template CSV files for your input data. All input folders and files shall be created inside thedatafolder after this command is executed. - 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:
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)!
- This section is for configuring directory structure for storing model inputs and results.
- A custom name you define for the input scenario folder in your model.
- A custom name you define for the output scenario folder to save your model results.
- 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.
- Modelled years should be provided as a list.
- Options: [
p,p-i,p-t,p-i-t], representing power (p), industry (i), and transport (t) sectors. - 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.
This step creates your skeleton folder and files which can be feed with your data.
π¦ 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:
- check Global CSV template for default file descriptions of country-level data.
- see Regional CSV template for detailed file descriptions of region-level data.
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.