Quickstart: Run Your First Model#
This guide gets you running a PyPSA-GB scenario.
Prerequisites#
Ensure you’ve completed the Installation steps and have the pypsa-gb environment activated:
conda activate pypsa-gb
Step 1: Check Available Scenarios#
PyPSA-GB comes with pre-configured scenarios. View them:
# List active scenarios
python -c "
import yaml
with open('config/config.yaml') as f:
config = yaml.safe_load(f)
print('Active scenarios:', config.get('scenarios', []))
"
Common scenarios include:
Scenario |
Description |
|---|---|
|
Holistic Transition 2035 (ETYS network) |
|
Holistic Transition 2050 (ETYS network) |
|
Historical year 2020 |
|
Holistic Transition 2035 (32-bus reduced) |
Step 2: Run a Scenario#
Run a single scenario using Snakemake:
# Run the HT35_clustered scenario (2035 Holistic Transition, clustered network)
snakemake resources/network/HT35_clustered_solved.nc -j 4
Note
The -j 4 flag runs up to 4 jobs in parallel. Adjust based on your CPU cores.
What Happens#
The workflow executes these steps automatically:
flowchart LR
A[Build Network] --> B[Add Demand]
B --> C[Add Renewables]
C --> D[Add Thermal]
D --> E[Add Storage]
E --> F[Add Hydrogen]
F --> G[Add Interconnectors]
G --> H[Solve Network]
Step 3: View Results#
Once complete, load and inspect the solved network:
import pypsa
# Load the solved network
n = pypsa.Network("resources/network/HT35_clustered_solved.nc")
# Basic statistics
print(f"Buses: {len(n.buses)}")
print(f"Generators: {len(n.generators)}")
print(f"Storage units: {len(n.storage_units)}")
print(f"Lines: {len(n.lines)}")
# Generation capacity by technology
print("\nGeneration capacity (GW):")
print((n.generators.groupby('carrier')['p_nom'].sum() / 1000).round(1).sort_values(ascending=False))
Step 4: Generate Analysis Outputs#
Generate HTML analysis reports:
# Generate spatial analysis map
snakemake resources/analysis/HT35_clustered_spatial.html -j 1
# Generate summary dashboard
snakemake resources/analysis/HT35_clustered_dashboard.html -j 1
Open the generated HTML files in your browser.
Market scenarios produce additional outputs under resources/market/ and
resources/analysis/. After the basic workflow is working, see
Market Dispatch for wholesale-only and two-stage market runs.
Quick Commands Reference#
# Dry run (show what would execute)
snakemake resources/network/HT35_clustered_solved.nc -n -p
# Force re-run of a specific rule
snakemake -R solve_network -j 4
# Run with verbose logging
snakemake resources/network/HT35_clustered_solved.nc -j 4 --verbose
# Clean all outputs for a scenario
snakemake clean_HT35_clustered
Faster Testing with Reduced Networks#
For quick tests, use reduced network models:
# 32-bus reduced network (much faster)
snakemake resources/network/HT35_reduced_solved.nc -j 4
# Clustered to ~100 buses
snakemake resources/network/HT35_clustered_100_solved.nc -j 4
Expected Run Times#
Network Type |
Buses |
Typical Solve Time |
|---|---|---|
Zonal |
17 |
~1 minute |
Reduced |
32 |
~2 minutes |
Clustered (100) |
~100 |
~5 minutes |
ETYS Full |
2000+ |
~30 minutes |
Tip
Start with reduced networks for testing, then scale up to full ETYS for production runs.
Next Steps#
Your First Custom Scenario - Create your own custom scenario
Configuration Reference - Understand configuration options
Snakemake Workflow - Deep dive into the Snakemake workflow
Market Dispatch - Run wholesale and balancing market dispatch
Market Dispatch - Analyse market validation outputs