PyPSA-Spain: An extension of PyPSA-Eur to model the Spanish energy system
Cristóbal Gallego‐Castillo, Marta Victoria
Abstract
This work presents PyPSA-Spain, an open-source, high-resolution model of the Spanish energy system, developed as a national-scale fork of PyPSA-Eur. The model integrates detailed national datasets to improve the representation of renewable generation profiles (via quantile-to-quantile transformations) and regional electricity demand, and identifies a spatial resolution of 35–50 nodes as a practical balance between geographical detail and network complexity. Cross-border electricity flows with France and Portugal are represented through a nested modelling approach, using time-dependent electricity prices precomputed with PyPSA-Eur. As a case study, PyPSA-Spain is applied to optimise the 2030 electricity generation mix under decarbonisation targets from Spain’s updated National Energy and Climate Plan (NECP). Results show that improved renewable profiles lead to a more balanced deployment of solar and wind. The model also reveals potential transmission bottlenecks that may constrain the optimal use of renewable resources. PyPSA-Spain fills a methodological gap between European-scale optimisation and national planning, offering a transparent and flexible platform for future energy system analysis in Spain.