The code in this repository is designed to generate a national-scale Urban Building Energy Model (nUBEM) for Spain. The nUBEM model offers a powerful AI-driven framework for evaluating the energy performance and greenhouse gas emissions of residential buildings on a national scale. By enabling urban and nationwide insights, it supports comprehensive analysis of building characteristics and energy performance across the residential building stock. This model is useful for the design of targeted energy efficiency policies and assessing their effectiveness in reducing greenhouse gas emissions.
The code in this repository is part of the paper 'Predicting Energy and Emissions in Residential Building stocks: National UBEM with Energy Performance Certificates and Artificial Intelligence', published in Applied Sciences in 2025 and written by Carlos Beltrán-Velamazán, Marta Monzón-Chavarrías and Belinda López-Mesa from the Built4Life Lab, University of Zaragoza - I3A (Spain), doi: 10.3390/app15020514. There the methodology is explained and developed and the results obtained are shown. The Zenodo repository 'nUBEM: National UBEM with Energy Performance Certificates and Artificial Intelligence' can be found in the following doi link 10.5281/zenodo.14524563. If you use this tool please cite the paper: Beltrán-Velamazán, C.; Monzón-Chavarrías, M.; López-Mesa, B. Predicting Energy and Emissions in Residential Building Stocks: National UBEM with Energy Performance Certificates and Artificial Intelligence. Appl. Sci. 2025, 15, 514. https://doi.org/10.3390/app15020514
To obtain the data to train and test de Machine Learning model please use the code in: https://github.com/CarlosBeltranVelamazan/NBEM. From the research article: Carlos Beltrán-Velamazán, Marta Monzón-Chavarrías, Belinda López-Mesa, A new approach for national-scale Building Energy Models based on Energy Performance Certificates in European countries: The case of Spain, Heliyon, Volume 10, Issue 3, 2024, e25473, ISSN 2405-8440, https://doi.org/10.1016/j.heliyon.2024.e25473.
This tool was developed at the Built4Life Lab, research group from the University of Zaragoza-I3A, within the research project named LocalRegen, funded by the Ministry of Science and Innovation of Spain, grant number PID2019-104871RB-C21/AEI/10.13039/501100011033 and by GOBIERNO DE ARAGÓN, grant number T37_23R: Built4Life Lab. Website: http://www.localregen.net/
- Main Contact: Belinda López-Mesa, Built4Life Lab, University of Zaragoza-I3A, 50108 Zaragoza, Spain (belinda@unizar.es)
Released, development ongoing. For any suggestions, questions, or inquiries about the code, its usage, or the model, please feel free to send a mail to cbeltran@unizar.es
A model with all the buildings in Spain in the cadaster and a model with all the EPCs data in Spain. To obtain the data to train and test de Machine Learning model please use the code in: https://github.com/CarlosBeltranVelamazan/NBEM. From the research article: Carlos Beltrán-Velamazán, Marta Monzón-Chavarrías, Belinda López-Mesa, A new approach for national-scale Building Energy Models based on Energy Performance Certificates in European countries: The case of Spain, Heliyon, Volume 10, Issue 3, 2024, e25473, ISSN 2405-8440, https://doi.org/10.1016/j.heliyon.2024.e25473.
The code contains Python scripts to generate the model; no specific files need to be installed. Certain libraries such as Pandas, Geopandas, and xgboost are required. See requirements.txt for the listing and versions.
A script named main_nUBEM.py has been created to handle the entire automated process in Python for generating the nUBEM with Energy Performance Certificates and Artificial Intelligence. The main script contains the parameters and controls all the steps for generating the model. Internal scripts can be modified to obtain different results if desired.
The code is available under the terms of the MIT License. Permitted with proper citation: Unrestricted use, distribution, and reproduction in any medium.

