The Need to Know the Future
On the path toward decarbonization, simply filling our rooftops with solar panels is not enough. The true revolution lies in predicting how much energy we will capture from the sun tomorrow, or how much a household will consume as evening falls. This is the invisible foundation upon which a truly self-sufficient and emission-free society is built.
However, this anticipation is a nearly impossible human challenge. How can we accurately predict the movement of a cloud or the exact moment a family decides to turn on the heating or run a washing machine? This is where Artificial Intelligence becomes our greatest ally.
How Can AI Predict Energy Demand?
Unlike traditional methods, which were limited to calculating averages, an AI model acts as a “detective.” It does not focus solely on calculation but on learning from the clues we provide: data. Thus, it processes vast amounts of information in seconds to:
● Interpret Context: It detects that on a Tuesday morning the house is empty and consumption is minimal, that on a Saturday consumption rises because the family is home, or that during holidays activity pauses for weeks.
● Detect Patterns: It finds relationships between the weather, time of day, and human habits that remain invisible to us.
● Convert Uncertainty into Stability: It anticipates energy flow, preventing shocks to the electrical grid. This ensures green energy is utilized to the fullest, without wasting a single watt.
However, the quality of an AI model depends entirely on the data it learns from; our “detective” needs good clues to solve the case.

Fornes as a Testing Laboratory
For this study, we situate ourselves in Fornes, a town in Granada (Spain) that has become our real-world scenario. There, a multitude of smart sensors were installed to monitor the real-time behavior of 25 private residences—always ensuring total anonymity and data privacy for every user—and two photovoltaic installations. This data forms the basis our AI uses to solve two major unknowns:
● Solar Generation: How much energy will be produced tomorrow based on this week’s records and weather forecasts?
● Energy Consumption: How will each household’s expenditure behave based on recent habits and meteorology?
Solar Logic vs. Human Behavior
Although both use cases are set in the same location and serve related purposes, in Fornes we have discovered that the data tells two completely different stories.
● The Solar Logic: Predicting how much energy panels will generate is, in essence, a matter of mathematics and physics. The sun follows a predictable script: we know when it rises, the trajectory it follows, and when it sets. Adding cloud cover and radiation data allows the AI to achieve almost surgical precision. This environment is governed by fixed rules where the model feels comfortable because the sun, unlike us, does not improvise.
● The Human Factor: This is where the case gets complicated. If solar generation is a mathematical choreography, household consumption is an improvised dance. The AI no longer battles clouds, but human behavior. An unexpected dinner or the decision to run a washing machine at midnight creates a scenario full of peaks and voids. There is no fixed pattern for 25 different families; what is routine for one home is an anomaly for another. Therefore, guessing what a human will do is the true challenge of energy prediction.
Architecture and Techniques: The Brain of the AI
In the real world, sensors sometimes fail, disconnect, or provide noise. To deal with this, a processing stage reinforces the information contained in each record. Furthermore, the Artificial Intelligence “engine” employed for this project is the XGBoost (Extreme Gradient Boosting) model, chosen for its robustness, speed, and ability to capture non-linear relationships. While other models freeze when faced with null data, XGBoost is capable of managing imperfections and missing data without sacrificing forecast precision.
However, success depends not only on the algorithm but on how it is trained:
- For Solar Generation: We implemented a recursive forecasting method. The system analyzes a sliding window of one week to predict a time horizon adaptable to the grid’s needs. This method prioritizes the most recent information, achieving surgical precision in the short term—essential for deciding whether energy should be stored or fed into the grid.
- For Domestic Consumption: Due to the high volatility of human habits, we opted for a specialization strategy. Instead of a single general model, we trained 96 independent engines. Each one is exclusively responsible for a 15-minute segment of the day. A model for 03:00 AM should not be biased by patterns from 02:00 PM. This allows the AI to focus solely on the particularities of its time slot, better capturing the specific activity patterns of each household.
It is imperative to recognise that, despite the sophistication of the 96 XGBoost engines, results in domestic consumption show greater deviation than in solar generation. While the sun responds to stable physical laws, consumption in Fornes is subject to variables the AI cannot see: an unexpected visit, a change in work routine, or a spontaneous decision to use a high-power appliance. This lower precision is not a model failure, but a data limitation: with a sample of 25 homes, the “noise” of a single household affects the aggregate. Therefore, the system seeks not individual infallibility, but the collective optimization of the network.
Conclusion: Fornes as a Compass for Energy Transition
The project in Fornes demonstrates that the success of the energy transition depends not only on how many photovoltaic installations we deploy but on our capacity to manage uncertainty.
We have achieved a level of technology that reaches mathematical precision when modeling the sun, while learning to respect freedom and privacy in the home. This balance is the essence of WeForming: a system that does not impose rules on the user but acts as an invisible manager. The result is not just abstract “sustainability,” but a more stable electrical grid, better-utilized solar energy, and, above all, a model where technological efficiency is never imposed at the expense of human privacy.
Author Bio
Carlos Antón Pérez holds a BSc in Mathematics from the University of Salamanca (USAL) and is currently pursuing a Master’s in Artificial Intelligence at the International University of La Rioja (UNIR). He works as an AI Researcher at the AIR Institute, combining a strong background in statistics, optimization, and modeling with advanced knowledge in time series and Feature Engineering. His work on the WeForming project focuses on applying complex machine learning models to transform real-time data into sustainable energy solutions.
Download full article here.
Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Education and Culture Executive Agency (EACEA). Neither the European Union nor EACEA can be held responsible for them.




