journal article·2025-06-17Open access

Optimizing Energy Forecasting Using ANN and RF Models for HVAC and Heating Predictions

Khaled M. Salem, Javier M. Rey-Hernández, A. O. Elgharib, Francisco J. Rey-Martínez

Applied Sciences· Volume 15· Issue 12

Abstract

Industry 5.0 is transforming energy demand by integrating sustainability into energy planning, ensuring market stability while minimizing environmental impact for future generations. There are several patterns for calculating energy consumption depending on whether it is measured daily, monthly, or annually through the integration of artificial intelligence approaches, particularly Artificial Neural Networks (ANNs) and Random Forests (RFs), and within the framework of Industry 5.0. This study employs machine learning techniques to analyze energy consumption data from two distinct buildings in Spain: the LUCIA facility in Valladolid and the FUHEM Building in Madrid. The implementation was conducted using custom MATLAB code developed in-house. Our approach systematically evaluates and compares the predictive performance of Artificial Neural Networks (ANNs) and Random Forests (RFs) for energy demand forecasting, leveraging each algorithm’s unique characteristics to assess their suitability for this application. The performances of both models are calculated using the Root Mean Square Percentage Error (RMSPE), Root Mean Square Relative Percentage Error (RMSRPE), Mean Absolute Percentage Error (MAPE), Mean Absolute Relative Percentage Error (MARPE), Kling–Gupta Efficiency (KGE), and also the coefficient of determination, R2. Training times are validated using ANN and RF models. Lucia RF took 2.8 s, while Lucia ANN took 40 s; FUHEM RF took 0.3 s, compared to FUHEM ANN, which took 1.1 s. The performances of the two models are described in detail to show the effectiveness of each of them.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Building Energy and Comfort Optimization · Energy Load and Power Forecasting · Solar Radiation and Photovoltaics

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

GIRTER Research Group, Consolidated Research Unit (UIC053) of Castile and Leon, 47002 Valladolid, Spain

Department of Basic and Applied Science Engineering, Arab Academy for Science, Technology and Maritime Transport (Smart Village Campus), Smart Village, Giza 12577, Egypt

Department of Energy and Fluid Mechanics, Engineering School (EII), University of Valladolid (UVa), 47002 Valladolid, Spain

Department of Mechanical Engineering, Fluid Mechanics and Thermal Engines, Engineering School, University of Malaga (UMa), 29016 Málaga, Spain

Institute of Advanced Production Technologies (ITAP), University of Valladolid (Uva), 47002 Valladolid, Spain

References (59)

Show source-provided references
1. Rane, N. (2023). ChatGPT and Similar Generative Artificial Intelligence (AI) for Building and Construction Industry: Contribution, Opportunities and Challenges of Large Language Models for Industry 4.0, Industry 5.0, and Society 5.0. Oppor. Chall. Large Lang. Models Ind., 4.10.2139/ssrn.4603221 ↗
2. Musarat, M.A., Irfan, M., Alaloul, W.S., Maqsoom, A., and Ghufran, M. (2023). A Review on the Way Forward in Construction through Industrial Revolution 5.0. Sustainability, 15.10.3390/su151813862 ↗
3. Behind the Definition of Industry 5.0: A Systematic Review of Technologies, Principles, Components, and Values
4. Human-Centric Artificial Intelligence Architecture for Industry 5.0 Applications10.1080/00207543.2022.2138611 ↗
5. Korodi, A., Nițulescu, I.-V., Fülöp, A.-A., Vesa, V.-C., Demian, P., Braneci, R.-A., and Popescu, D. (2024). Integration of Legacy Industrial Equipment in a Building-Management System Industry 5.0 Scenario. Electronics, 13.10.3390/electronics13163229 ↗
6. Identifying Industry 5.0 Contributions to Sustainable Development: A Strategy Roadmap for Delivering Sustainability Values10.1016/j.spc.2022.08.003 ↗
7. Integrated Practices in the Architecture, Engineering, and Construction Industry: Current Scope and Pathway towards Industry 5.010.1016/j.jobe.2023.106788 ↗
8. Energy Models for Demand Forecasting—A Review10.1016/j.rser.2011.08.014 ↗
9. Potato Leaf Disease Classification Using Optimized Machine Learning Models and Feature Selection Techniques
10. Potato Consumption Forecasting Based on a Hybrid Stacked Deep Learning Model
11. A Review of Artificial Intelligence Based Building Energy Use Prediction: Contrasting the Capabilities of Single and Ensemble Prediction Models10.1016/j.rser.2016.10.079 ↗
12. Application of Optimized Artificial Intelligence Algorithm to Evaluate the Heating Energy Demand of Non-Residential Buildings at European Level10.1016/j.energy.2019.03.168 ↗
13. Vieri, A., Gambarotta, A., Morini, M., and Saletti, C. (2024). An Integrated Artificial Intelligence Approach for Building Energy Demand Forecasting. Energies, 17.10.3390/en17194920 ↗
14. Artificial Intelligence and Machine Learning Approaches to Energy Demand-Side Response: A Systematic Review10.1016/j.rser.2020.109899 ↗
15. A Review on Artificial Intelligence Based Load Demand Forecasting Techniques for Smart Grid and Buildings10.1016/j.rser.2015.04.065 ↗
16. Salem, K.M., Rady, M., Aly, H., and Elshimy, H. (2023). Design and Implementation of a Six-Degrees-of-Freedom Underwater Remotely Operated Vehicle. Appl. Sci., 13.10.3390/app13126870 ↗
17. Greylag Goose Optimization: Nature-Inspired Optimization Algorithm10.1016/j.eswa.2023.122147 ↗
18. An AI-Based System for Predicting Renewable Energy Power Output Using Advanced Optimization Algorithms10.54216/JAIM.080101 ↗
19. Machine Learning in Public Health Forecasting and Monitoring the Zika Virus10.54216/MOR.010201 ↗
20. Ferlito, S., Atrigna, M., Graditi, G., De Vito, S., Salvato, M., Buonanno, A., and Di Francia, G. (2015, January 3–5). Predictive Models for Building’s Energy Consumption: An Artificial Neural Network (ANN) Approach. Proceedings of the 2015 XVIII Aisem Annual Conference, Trento, Italy.10.1109/AISEM.2015.7066836 ↗
21. An ANN-Based Fast Building Energy Consumption Prediction Method for Complex Architectural Form at the Early Design Stage10.1007/s12273-019-0538-0 ↗
22. Prediction of Building Energy Consumption by Using Artificial Neural Networks10.1016/j.advengsoft.2008.05.003 ↗
23. ANN-based Energy Consumption Prediction Model up to 2050 for a Residential Building: Towards Sustainable Decision Making10.1002/ep.13544 ↗
24. Orosa, J.A., Vergara, D., Costa, Á.M., and Bouzón, R. (2019). A Novel Method for NZEB Internal Coverings Design Based on Neural Networks. Coatings, 9.10.3390/coatings9050288 ↗
25. Building Energy Modeling Using Artificial Neural Networks10.3844/erjsp.2016.24.34 ↗
26. The Daily and Hourly Energy Consumption and Load Forecasting Using Artificial Neural Network Method: A Case Study Using a Set of 93 Households in Portugal10.1016/j.egypro.2014.12.383 ↗
27. Artificial Neural Network Model for Forecasting Sub-Hourly Electricity Usage in Commercial Buildings10.1016/j.enbuild.2015.11.045 ↗
28. Cáceres, L., Merino, J.I., and Díaz-Díaz, N. (2021). A Computational Intelligence Approach to Predict Energy Demand Using Random Forest in a Cloudera Cluster. Appl. Sci., 11.10.3390/app11188635 ↗
29. Random Forest Based Hourly Building Energy Prediction10.1016/j.enbuild.2018.04.008 ↗
30. Nonlinear Autoregressive and Random Forest Approaches to Forecasting Electricity Load for Utility Energy Management Systems10.1016/j.scs.2018.12.013 ↗
31. Chen, Y.-T., Piedad, E., and Kuo, C.-C. (2019). Energy Consumption Load Forecasting Using a Level-Based Random Forest Classifier. Symmetry, 11.10.3390/sym11080956 ↗
32. Enhancing Building Energy Efficiency Using a Random Forest Model: A Hybrid Prediction Approach10.1016/j.egyr.2021.07.135 ↗
33. Automatic Hourly Solar Forecasting Using Machine Learning Models10.1016/j.rser.2019.02.006 ↗
34. Wang, Z., Hong, Y., Huang, L., Zheng, M., Yuan, H., and Zeng, R. (2025). A comprehensive review and future research directions of ensemble learning models for predicting building energy consumption. Energy Build., 115589.10.1016/j.enbuild.2025.115589 ↗
35. Research on Household Energy Demand Patterns, Data Acquisition and Influencing Factors: A Review10.1016/j.scs.2023.104916 ↗
36. Assessing the Accuracy of AI Approaches for CO2 Emission Predictions in Buildings10.1016/j.jclepro.2025.145692 ↗
37. Investigating the Impact of Data Normalization Methods on Predicting Electricity Consumption in a Building Using Different Artificial Neural Network Models10.1016/j.scs.2024.105570 ↗
38. Development and Multi-Utility of an ANN Model for an Industrial Gas Turbine10.1016/j.apenergy.2008.03.018 ↗
39. Basic Concepts of Artificial Neural Network (ANN) Modeling and Its Application in Pharmaceutical Research10.1016/S0731-7085(99)00272-1 ↗
40. Protocol for Developing ANN Models and Its Application to the Assessment of the Quality of the ANN Model Development Process in Drinking Water Quality Modelling10.1016/j.envsoft.2013.12.016 ↗
41. Real Time Prediction of Drilling Fluid Rheological Properties Using Artificial Neural Networks Visible Mathematical Model (White Box)10.1016/j.petrol.2016.08.021 ↗
42. Mathematical Modeling and Process Parameters Optimization Studies by Artificial Neural Network and Response Surface Methodology: A Case of Non-Edible Neem (Azadirachta Indica) Seed Oil Biodiesel Synthesis10.1016/j.energy.2014.05.033 ↗
43. Pavlenko, I., Trojanowska, J., Ivanov, V., and Liaposhchenko, O. (2019). Scientific and Methodological Approach for the Identification of Mathematical Models of Mechanical Systems by Using Artificial Neural Networks. Innovation, Engineering and Entrepreneurship, Springer.10.1007/978-3-319-91334-6_41 ↗
44. Random Forest Modeling for Network Intrusion Detection System10.1016/j.procs.2016.06.047 ↗
45. Application of Support Vector Machine, Random Forest, and Genetic Algorithm Optimized Random Forest Models in Groundwater Potential Mapping10.1007/s11269-017-1660-3 ↗
46. Simulating Urban Growth Using a Random Forest-Cellular Automata (RF-CA) Model10.3390/ijgi4020447 ↗
47. Random Forests: From Early Developments to Recent Advancements10.1080/21642583.2014.956265 ↗
48. Paterakis, N.G., Mocanu, E., Gibescu, M., Stappers, B., and van Alst, W. (2017, January 26–29). Deep Learning versus Traditional Machine Learning Methods for Aggregated Energy Demand Prediction. Proceedings of the 2017 IEEE PES Innovative Smart Grid Technologies Conference Europe (ISGT-Europe), Torino, Italy.10.1109/ISGTEurope.2017.8260289 ↗
49. Machine Learning, Deep Learning and Statistical Analysis for Forecasting Building Energy Consumption—A Systematic Review10.1016/j.engappai.2022.105287 ↗
50. Forootan, M.M., Larki, I., Zahedi, R., and Ahmadi, A. (2022). Machine Learning and Deep Learning in Energy Systems: A Review. Sustainability, 14.10.3390/su14084832 ↗
51. Effect of Particle Diameter and Void Fraction on Gas–Solid Two-Phase Flow: A Numerical Investigation Using the Eulerian–Eulerian Approach10.1007/s40571-024-00798-9 ↗
52. Machine Learning Approaches for Estimating Commercial Building Energy Consumption10.1016/j.apenergy.2017.09.060 ↗
53. Prediction of Energy Demands Using Neural Network with Model Identification by Global Optimization10.1016/j.enconman.2008.09.017 ↗
54. A New Optimization Strategy for the Operating Schedule of Energy Systems under Uncertainty of Renewable Energy Sources and Demand Changes10.1016/j.enbuild.2016.04.080 ↗
55. Modeling Two-Phase Gas-Solid Flow in Axisymmetric Diffusers Using Cut Cell Technique: An Eulerian-Eulerian Approach10.1186/s13661-024-01955-y ↗
56. Abumandour, R.M., El-Reafay, A.M., Salem, K.M., and Dawood, A.S. (2023). Numerical Investigation by Cut-Cell Approach for Turbulent Flow through an Expanded Wall Channel. Axioms, 12.10.3390/axioms12050442 ↗
57. Optimization Method for Minimizing Annual Energy, Peak Energy Demand, and Annual Energy Cost through Use of Building Thermal Storage/Discussion
58. Optimization of a Hybrid Energy Plant by Integrating the Cumulative Energy Demand10.1016/j.apenergy.2019.113484 ↗
59. EDeSSOpt–Energy Demand and Supply Simultaneous Optimization for Cost-Optimized Design: Application to a Multi-Family Building10.1016/j.apenergy.2018.12.043 ↗