The application of machine learning to energy systems has matured considerably since the early experiments with neural network load forecasting in the 1990s. What was once an academic exercise -- can we predict tomorrow's electricity demand slightly better than a regression model? -- has become an operational necessity. Behind-the-meter solar and battery systems require accurate forecasts and intelligent dispatch to capture their full economic value, and the margin between a well-optimised system and a poorly optimised one can be the difference between an attractive investment and a marginal one. This article examines four specific domains where machine learning is making a measurable difference in energy system performance, drawing on published research and industry results.
Load Forecasting for Battery Dispatch
The economic case for a behind-the-meter battery system rests on its ability to reduce electricity costs by shifting consumption away from expensive periods and toward cheap ones. In a commercial building on a demand charge tariff, this means discharging the battery during periods of peak demand and recharging when demand is low. In a time-of-use tariff structure, it means arbitraging between high-rate and low-rate periods. In either case, the battery controller needs to know what the building's load will be over the coming hours in order to make intelligent charge and discharge decisions.
A naive approach -- simply setting the battery to discharge during predetermined hours -- leaves significant value on the table. Building loads are stochastic: they vary with weather, occupancy, production schedules, and dozens of other factors. A factory might run an extra shift; a hotel might host an event; an office building might see different occupancy patterns on different days of the week. If the battery controller cannot anticipate these variations, it will frequently discharge too early, too late, or at the wrong rate.
Recurrent neural networks, particularly Long Short-Term Memory (LSTM) architectures, emerged as the dominant approach for building load forecasting in the mid-2010s. A widely cited study by Kong et al. (2019) in Applied Energy demonstrated that LSTM models could achieve mean absolute percentage errors (MAPE) of 2-5% for day-ahead building load prediction, compared to 5-10% for traditional statistical methods such as ARIMA. This improvement matters more than it might seem: research by NREL on battery dispatch optimization has shown that each percentage point improvement in load forecast accuracy translates to roughly 1-3% improvement in annual battery savings, depending on the tariff structure and battery sizing.
More recently, transformer-based architectures -- the same fundamental approach underpinning large language models -- have shown promise for energy time-series forecasting. The Temporal Fusion Transformer architecture developed by researchers at Google, published in 2021, incorporates attention mechanisms that allow the model to weigh the relative importance of different input variables (temperature, time of day, day of week, holiday indicators) at different forecast horizons. Early results from deployments in commercial building portfolios suggest that transformer models can reduce forecast error by an additional 10-20% compared to LSTM baselines, particularly for longer forecast horizons of 12-48 hours where capturing complex temporal dependencies matters most.
The practical impact is significant. For a typical 250 kW / 500 kWh commercial battery system on a demand charge tariff in a U.S. market, improving load forecast MAPE from 8% to 3% can increase annual demand charge savings by $5,000 to $15,000, depending on the specific rate structure and load profile. Over a 10 to 15 year asset life, this compounds to a meaningful difference in project returns.
Battery Dispatch Optimization with Reinforcement Learning
Load forecasting tells you what will happen. Dispatch optimization tells the battery what to do about it. The two problems are related but distinct, and the optimal dispatch strategy is surprisingly complex even for a single site.
Consider a commercial building with solar, a battery, and access to both a demand charge tariff and a wholesale ancillary services market. At any given moment, the battery controller must decide whether to charge from solar, charge from the grid, discharge to reduce building demand, discharge to export to the grid for ancillary services revenue, or hold its current state of charge in anticipation of a future high-value period. These decisions interact with each other across time: discharging now to reduce a demand peak means less stored energy available for an evening peak that might be larger. The problem is a stochastic dynamic program, and the state space grows rapidly when you consider that the controller must also account for battery degradation (cycling affects lifespan), solar generation uncertainty (clouds), and wholesale market price volatility.
Rule-based dispatch controllers, which use heuristic thresholds (e.g., "discharge when building load exceeds X kW, charge when solar generation exceeds Y kW"), were the industry standard through approximately 2020. They are simple to implement and easy to explain but consistently leave value on the table. A study published in Applied Energy by Cao et al. (2020) compared rule-based dispatch against reinforcement learning (RL) approaches across a portfolio of commercial battery systems and found that RL-based controllers achieved 10-20% higher annual savings, primarily by better managing the trade-offs between demand charge reduction and energy arbitrage.
Deep reinforcement learning, specifically variants of the Deep Q-Network (DQN) and Proximal Policy Optimization (PPO) algorithms, has become the preferred approach for battery dispatch in research and increasingly in commercial deployments. The RL agent learns a dispatch policy through simulated interaction with an environment that includes the building load model, solar generation forecasts, tariff schedules, and battery degradation curves. Research from teams at Stanford and MIT has demonstrated that RL-based battery controllers can learn strategies that rule-based systems struggle to replicate, such as partially discharging before an anticipated demand peak to preserve cycle life, or strategically charging from the grid during low-price periods to position for a high-value ancillary services event.
In practice, companies deploying RL-based dispatch controllers have reported annual energy cost reductions of 20-35% for commercial solar-plus-storage systems, compared to 15-25% for rule-based approaches. The improvement is most pronounced in markets with complex, overlapping value streams -- for example, a California site on an SCE TOU-GS-3 tariff with access to the CAISO real-time market, where the interplay between demand charges, time-of-use rates, and wholesale prices creates an optimization problem that is genuinely difficult to solve with static rules.
Anomaly Detection and Predictive Maintenance
Once a distributed energy system is deployed, the ongoing challenge shifts from optimization to reliability. A solar inverter that fails silently on a commercial rooftop can go unnoticed for days or weeks if no one is actively monitoring the system, resulting in lost generation and revenue. Battery cells that degrade faster than expected can reduce capacity and eventually create safety hazards. In a portfolio of hundreds or thousands of sites, manual monitoring is impractical.
Machine learning approaches to anomaly detection in solar and storage systems have progressed substantially. The most effective methods compare actual system performance against a model of expected performance and flag deviations that exceed statistical thresholds. For solar arrays, this typically involves comparing measured inverter output against a physical or machine-learned model of expected generation given the current irradiance, temperature, and system configuration. pvlib, an open-source Python library developed originally at Sandia National Laboratories, provides the physical models; machine learning adds the ability to learn site-specific deviations and detect subtle degradation patterns that physical models miss.
A study in Solar Energy by Livera et al. (2019) demonstrated that convolutional neural networks trained on inverter time-series data could detect common fault types -- ground faults, string failures, inverter clipping, and partial shading anomalies -- with accuracy rates above 95%, and crucially, could detect faults an average of 3-5 days before they would be caught by conventional threshold-based monitoring. For a commercial solar system generating $100-$300 per day in revenue, catching a fault several days earlier translates to meaningful savings over the course of a year, particularly when compounded across a large portfolio.
Battery health monitoring presents a different challenge. Lithium-ion batteries degrade through multiple mechanisms -- solid electrolyte interphase (SEI) layer growth, lithium plating, cathode dissolution -- that interact in complex ways depending on temperature, state of charge, cycling depth, and charge rate. Predicting remaining useful life requires models that can learn these interactions from operational data. Research published in Nature Energy by Severson et al. (2019) from a team at Stanford and MIT demonstrated that machine learning models could predict battery cycle life using data from only the first 100 cycles, achieving prediction errors of less than 10%. This has practical implications for warranty management, performance guarantees, and early identification of cells or modules that are degrading anomalously.
When deployed across a portfolio of distributed battery systems, these predictive models allow operators to move from reactive maintenance (replacing equipment after failure) to predictive maintenance (scheduling interventions before failure occurs). The U.S. Department of Energy has estimated that predictive maintenance approaches can reduce O&M costs for solar systems by 15-25% compared to calendar-based or reactive approaches, while simultaneously improving system uptime.
The Agentic Shift: From Models That Predict to Systems That Act
The three applications described above -- forecasting, dispatch, and anomaly detection -- share a common architecture: a machine learning model receives data, produces an output (a forecast, a dispatch command, a fault classification), and a human or simple automation system acts on that output. This architecture has served the industry well, but it is beginning to change in a way that has significant implications for how distributed energy portfolios are built and managed.
The emerging paradigm, often described as "agentic AI," involves systems that can autonomously chain multiple actions together to accomplish complex tasks with minimal human supervision. Rather than a single model performing a single prediction, an agentic system might: retrieve utility rate data from multiple sources, clean and validate the data, run a financial model, identify anomalies in the inputs, request clarification or additional data, and produce a final underwriting recommendation -- all without human intervention at each step.
This shift matters most in the pre-deployment phases of distributed energy, where the operational bottlenecks are most acute. Underwriting a commercial solar-plus-storage project today requires gathering and integrating data from multiple sources: satellite imagery and LiDAR for roof assessment, utility rate tariffs (which in the U.S. alone number over 3,000 distinct rate schedules across hundreds of utilities, as catalogued by NREL's Utility Rate Database), interval meter data for load profiling, local permitting requirements, interconnection rules, equipment specifications, and financial assumptions. Traditionally, an analyst might spend 20-40 hours compiling and analysing this data for a single site. At that cost, only the largest and most obvious projects justify the effort.
Agentic AI systems can compress this workflow dramatically. A data-cleaning agent can ingest raw interval meter data, identify and impute missing values, flag anomalous periods, and produce a validated load profile. A market data retrieval agent can pull the current tariff schedule, identify applicable demand charges and time-of-use periods, and format the data for financial modelling. An automated underwriting agent can combine these inputs with solar resource data and equipment specifications to produce a preliminary financial model, complete with sensitivity analyses. The entire process -- from raw data to preliminary investment decision -- can be compressed from weeks to hours.
The implications for portfolio economics are significant. If underwriting a site costs $5,000 in analyst time and the expected annual net operating income is $30,000, only sites with high confidence of strong returns justify the effort. If underwriting costs $500 or less through automation, the aperture widens dramatically -- smaller sites, sites in less familiar markets, and marginal sites that need careful optimisation to be viable all become candidates for deployment. This is how distributed energy portfolios go from dozens of sites to thousands: not by making each site more profitable, but by making the cost of adding each site low enough that a broader range of sites becomes investable.
The shift from predictive ML models to agentic AI systems is still in its early stages. The technical challenges are real: ensuring reliability and accuracy when autonomous agents make consequential decisions, maintaining auditability and explainability for investors and regulators, and handling the edge cases and exceptions that inevitably arise in messy real-world data. But the direction is clear. The binding constraint on distributed energy has never been the hardware or the underlying economics. It has been the cost and complexity of the human-intensive processes that surround each site. As those processes become increasingly automated, the market opens up.