2609005114
  • Open Access
  • Article

Modelling and Forecasting of Solar Energy Generation and Consumption in Residential Buildings Using Machine Learning

  • Behnoosh Shahidpoorfalah,   
  • Shuo Li and 
  • Wei Peng *

Received: 11 August 2026 | Revised: 07 September 2026 | Accepted: 07 September 2026 | Published: 06 November 2026

Abstract

Residential buildings account for a substantial share of global electricity use, and their reliance on solar energy is constrained by the intermittency of irradiance and the variability of heating and cooling demand, particularly in cold climates such as Regina, Saskatchewan. This paper presents a modular, three-stage, fully data-driven machine learning framework for intelligent solar-assisted energy control in residential buildings. In Stage 1, an ensemble of XGBoost and LightGBM gradient-boosting models forecasts Global Horizontal Irradiance (GHI) from historical weather data and engineered solar-geometry features, achieving a coefficient of determination (R2) of 0.9975. In Stage 2, a hybrid deep learning architecture that combines a one-dimensional convolutional neural network (CNN), two stacked Long Short-Term Memory (LSTM) layers, and trainable building-identity embeddings predicts hourly heating and cooling energy consumption for twelve residential buildings, reaching R2 = 0.9730 for heating and R2 = 0.9140 for cooling. In Stage 3, a Random Forest classifier trained on rule-derived labels assigns each hour to one of three operational modes (SOLAR, GRID, or OFF) with classification accuracy exceeding 99% across heating and cooling scenarios. The framework is evaluated using observational 2018 weather and GHI data from Regina, Saskatchewan, together with hourly residential building-energy data from twelve buildings in the NREL ResStock AMY2018 dataset located in North Dakota, a climatically similar region, and its performance is benchmarked against multiple peer-reviewed forecasting and control studies. The results show that combining interpretable ensemble learning, sequence-aware deep learning, and rule-informed classification yields a scalable and transparent decision-support pipeline for solar energy management that can be progressively extended toward real-time smart-building deployment.

References 

  • 1.

    Aguilar, J.; Garces-Jimenez, A.; R-Moreno, M.D.; et al. A Systematic Literature Review on the Use of Artificial Intelligence in Energy Self-Management in Smart Buildings. Renew. Sustain. Energy Rev. 2021, 151, 111530. https://doi.org/10.1016/j.rser.2021.111530.

  • 2.

    Kumari, P.; Toshniwal, D. Deep Learning Models for Solar Irradiance Forecasting: A Comprehensive Review. J. Clean. Prod. 2021, 318, 128566. https://doi.org/10.1016/j.jclepro.2021.128566.

  • 3.

    Zhou, H.; Zhou, Y.; Hu, J.; et al. LSTM-Based Energy Management for Electric Vehicle Charging in Commercial-Building Prosumers. J. Mod. Power Syst. Clean Energy 2021, 9, 1205–1216. https://doi.org/10.35833/mpce.2020.000501.

  • 4.

    Duffie, J.A.; Beckman, W.A. Solar Engineering of Thermal Processes, 4th ed.; Wiley: Hoboken, NJ, USA, 2013. https://doi.org/10.1002/9781118671603.

  • 5.

    Salari, A.; Ahmadi, S.E.; Marzband, M.; et al. Fuzzy Q-Learning-Based Approach for Real-Time Energy Management of Home Microgrids Using Cooperative Multi-Agent System. Sustain. Cities Soc. 2023, 95, 104528. https://doi.org/10.1016/j.scs.2023.104528.

  • 6.

    Nabavi, S.A.; Motlagh, N.H.; Zaidan, M.A.; et al. Deep Learning in Energy Modeling: Application in Smart Buildings with Distributed Energy Generation. IEEE Access 2021, 9, 125439–125461. https://doi.org/10.1109/access.2021.3110960.

  • 7.

    Mehrjerdi, H.; Saad, M.; Lefebvre, S. Efficiency-Resilience Nexus in Building Energy Management under Disruptions and Events. IEEE Syst. J. 2022, 16, 299–308. https://doi.org/10.1109/jsyst.2020.3021697.

  • 8.

    Houchati, M.; Beitelmal, A.H.; Khraisheh, M. Predictive Modeling for Rooftop Solar Energy Throughput: A Machine Learning-Based Optimization for Building Energy Demand Scheduling. J. Energy Resour. Technol. 2022, 144, 011302 https://doi.org/10.1115/1.4050844.

  • 9.

    Mansour, S.H.; Azzam, S.M.; Hasanien, H.M.; et al. Wasserstein Generative Adversarial Networks-Based Photovoltaic Uncertainty in a Smart Home Energy Management System Including Battery Storage Devices. Energy 2024, 306, 132412. https://doi.org/10.1016/j.energy.2024.132412.

  • 10.

    Wang, Z.; Liu, J.; Zhang, Y.; et al. Practical Issues in Implementing Machine-Learning Models for Building Energy Efficiency: Moving beyond Obstacles. Renew. Sustain. Energy Rev. 2021, 143, 110929. https://doi.org/10.1016/j.rser.2021.110929.

  • 11.

    Kurukuru, V.S.B.; Haque, A.; Khan, M.A.; et al. A Review on Artificial Intelligence Applications for Grid-Connected Solar Photovoltaic Systems. Energies 2021, 14, 4690. https://doi.org/10.3390/en14154690.

  • 12.

    Tina, G.M.; Ventura, C.; Ferlito, S.; et al. A State-of-Art-Review on Machine-Learning Based Methods for PV. Appl. Sci. 2021, 11, 7550. https://doi.org/10.3390/app11167550.

  • 13.

    Pang, Z.; Niu, F.; O’Neill, Z. Solar Radiation Prediction Using Recurrent Neural Network and Artificial Neural Network: A Case Study with Comparisons. Renew. Energy 2020, 156, 279–289. https://doi.org/10.1016/j.renene.2020.04.042.

  • 14.

    Rajagukguk, R.A.; Ramadhan, R.A.A.; Lee, H.J. A Review on Deep Learning Models for Forecasting Time Series Data of Solar Irradiance and Photovoltaic Power. Energies 2020, 13, 6623. https://doi.org/10.3390/en13246623.

  • 15.

    Wang, H.; Liu, Y.; Zhou, B.; et al. Taxonomy Research of Artificial Intelligence for Deterministic Solar Power Forecasting. Energy Convers. Manag. 2020, 214, 112909. https://doi.org/10.1016/j.enconman.2020.112909.

  • 16.

    Kim, T.Y.; Cho, S.B. Predicting Residential Energy Consumption Using CNN-LSTM Neural Networks. Energy 2019, 182, 72–81. https://doi.org/10.1016/j.energy.2019.05.230.

  • 17.

    Le, T.; Vo, M.; Vo, B.; et al. Improving Electric Energy Consumption Prediction Using CNN and Bi-LSTM. Appl. Sci. 2019, 9, 4237. https://doi.org/10.3390/app9204237.

  • 18.

    Sajjad, M.; Khan, Z.A.; Ullah, A.; et al. A Novel CNN-GRU-Based Hybrid Approach for Short-Term Residential Load Forecasting. IEEE Access 2020, 8, 143759–143768. https://doi.org/10.1109/access.2020.3009537.

  • 19.

    Drir, N.; Chekired, F.; Rekioua, D. An Integrated Neural Network for the Dynamic Domestic Energy Management of a Solar House. Int. Trans. Electr. Energy Syst. 2021, 31, e13227. https://doi.org/10.1002/2050-7038.13227.

  • 20.

    Ben Slama, S.; Mahmoud, M. A Deep Learning Model for Intelligent Home Energy Management System Using Renewable Energy. Eng. Appl. Artif. Intell. 2023, 123, 106388. https://doi.org/10.1016/j.engappai.2023.106388.

  • 21.

    Chou, J.S.; Tran, D.S. Forecasting Energy Consumption Time Series Using Machine Learning Techniques Based on Usage Patterns of Residential Householders. Energy 2018, 165, 709–726. https://doi.org/10.1016/j.energy.2018.09.144.

  • 22.

    Paul, S.; Padhy, N.P. Real-Time Bilevel Energy Management of Smart Residential Apartment Building. IEEE Trans. Ind. Inform. 2020, 16, 3708–3720. https://doi.org/10.1109/tii.2019.2941739.

  • 23.

    Zhang, B.; Hu, W.; Xu, X.; et al. Physical-Model-Free Intelligent Energy Management for a Grid-Connected Hybrid Wind-Microturbine-PV-EV Energy System via Deep Reinforcement Learning Approach. Renew. Energy 2022, 200, 433–448. https://doi.org/10.1016/j.renene.2022.09.125.

  • 24.

    Wei, G.; Chi, M.; Liu, Z.W.; et al. Deep Reinforcement Learning for Real-Time Energy Management in Smart Home. IEEE Syst. J. 2023, 17, 2489–2499. https://doi.org/10.1109/jsyst.2023.3247592.

  • 25.

    Xu, Y.; Gao, W.; Li, Y.; et al. Operational Optimization for the Grid-Connected Residential Photovoltaic-Battery System Using Model-Based Reinforcement Learning. J. Build. Eng. 2023, 73, 106774. https://doi.org/10.1016/j.jobe.2023.106774.

  • 26.

    Xu, X.; Jia, Y.; Xu, Y.; et al. A Multi-Agent Reinforcement Learning-Based Data-Driven Method for Home Energy Management. IEEE Trans. Smart Grid 2020, 11, 3201–3211. https://doi.org/10.1109/tsg.2020.2971427.

  • 27.

    Chen, L.; Wu, J.; Tang, H.; et al. A Q-Learning Based Optimization Method of Energy Management for Peak Load Control of Residential Areas with CCHP Systems. Electr. Power Syst. Res. 2023, 214, 108895. https://doi.org/10.1016/j.epsr.2022.108895.

  • 28.

    Lee, S.; Choi, D.H. Energy Management of Smart Home with Home Appliances, Energy Storage System and Electric Vehicle: A Hierarchical Deep Reinforcement Learning Approach. Sensors 2020, 20, 2157. https://doi.org/10.3390/s20072157.

  • 29.

    Zeynali, S.; Rostami, N.; Ahmadian, A.; et al. Two-Stage Stochastic Home Energy Management Strategy Considering Electric Vehicle and Battery Energy Storage System: An ANN-Based Scenario Generation Methodology. Sustain. Energy Technol. Assess. 2020, 39, 100722. https://doi.org/10.1016/j.seta.2020.100722.

  • 30.

    Li, B.; Liu, Z.; Wu, Y.; et al. Review on Photovoltaic with Battery Energy Storage System for Power Supply to Buildings: Challenges and Opportunities. J. Energy Storage 2023, 61, 106763. https://doi.org/10.1016/j.est.2023.106763.

  • 31.

    Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the KDD’16: The 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. https://doi.org/10.1145/2939672.2939785.

  • 32.

    Ke, G.; Meng, Q.; Finley, T.; et al. LightGBM: A Highly Efficient Gradient Boosting Decision Tree. In Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, CA, USA, 4–9 December 2017; Volume 30, pp. 3146–3154.

  • 33.

    Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput. 1997, 9, 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735.

  • 34.

    Alhussein, M.; Aurangzeb, K.; Haider, S.I. Hybrid CNN-LSTM Model for Short-Term Individual Household Load Forecasting. IEEE Access 2020, 8, 180544–180557. https://doi.org/10.1109/access.2020.3028281.

Share this article:
How to Cite
Shahidpoorfalah, B.; Li, S.; Peng, W. Modelling and Forecasting of Solar Energy Generation and Consumption in Residential Buildings Using Machine Learning. Energy Resources and Sustainability 2026, 1 (1), 4.
RIS
BibTex
Copyright & License
article copyright Image
Copyright (c) 2026 by the authors.
Article Metrics
4
Article Views
0
Citations