Machine Learning applied to active demand response

The electrical grid is an incredibly complicated system. We have internalized that when we press a button a light turns on, therefore we do not stop to think about the technical and economic challenges behind to make it possible.

Image by: @Muhammad Shoaib

A priori, it would be difficult for us to imagine that one of the biggest problems that must be solved for the electrical grid to work is the supply-demand equivalence. Today, electricity storage alternatives are very scarce and not very mature, so practically all the electricity is consumed at a given moment, for example, when we are pressing the light switch, the energy is being produced at that same moment. But if we produce too much, since we cannot store it, we will have to waste it, incurring unnecessary production costs, and may even damage electrical equipment or the network itself. And if we under-produce energy, the light simply won’t turn on.

Active demand response

In any electrical system there are a bunch of markets and regulatory mechanisms that aim to achieve this balance. Some of these markets and mechanisms are the forward market, daily market, intraday market, the review of technical restrictions by the network operator, secondary and tertiary regulation, etc.

Since last year, with Royal Decree Law 17/2022, the active response to demand is regulated as one of these control mechanisms. In this mechanism, there are individual consumers or consumption aggregators who undertake to reduce their demand if at any time it becomes much higher than supply. For example, a market participant may have demanded a consumption of 200 MW for a certain time slot. This participant can, however, commit to reduce his consumption by 5 MW if requested to do so by the grid operator. In exchange for this flexibility in demand, the consumer is financially rewarded for that availability, whether it has to be used or not. Active Demand Response will be a fundamental piece of modern electricity networks thanks to its benefits:

  • It facilitates the integration of renewable energy sources, allowing the grid to adapt to the intermittent and less predictable production of these sources.
  • It increases the resilience and reliability of the network in the face of events such as plant failures, transmission line breaks, extreme weather events or extreme peaks in demand, helping to avoid supply cuts and blackouts.
  • It represents a better cost for electricity, since it can generally be cheaper to reduce demand than to increase production, especially in peak demand where the available power belongs to more expensive sources such as combined cycle plants.
  • It reduces emissions in electricity production, by integrating more renewable sources and at the same time reducing the need to use more flexible but generally more polluting plants.
  • It provides valuable economic signals, which improve the flow of information to consumers, allowing them to modify their behavior, improving the overall cost of the system.
  • It reduces and delays the need to invest in infrastructure such as new plants or transmission lines, by homogenizing demand both temporally and geographically, which reduces the need for extra capacity in both generation and transportation.

If active demand response has so many benefits, then why isn’t it much more widespread? In part, it is because the regulatory framework is somewhat immature. But possibly the biggest obstacle for this to become a widespread practice is that it is not something technically easy to do. Large consumers such as factories are generally focused on carrying out their productive activity, and although some do look for ways to reduce costs by making their demand more flexible, not all manage to integrate this flexibility into their daily lives. Not to mention small businesses or homes, where modifying their behavior by adapting it to the needs of the network is even more difficult. It is true that demand aggregators, which manage the consumption of multiple individuals and reduce the group’s demand when necessary, can carry out this reduction more efficiently (in the same way that marketers foresee the consumption of all their clients better than a private client could do). But even so, both individuals and aggregators face multiple problems when offering Active Demand Response. That’s where Machine Learning  techniques can play a fundamental role, allowing the benefit of this service to be maximized, minimizing the impact on the daily lives of the participants.

Image by: @victollio

Opportunity areas

Some problems of active demand response where these techniques are useful are the following:

  • Demand forecast: Having a detailed demand forecast is the fundamental piece to determine how much this demand can respond to the network requirements. This forecast can be made at the level of aggregates of consumers, buildings or even particular devices. It is also worth differentiating between short-term forecasts (less than 24 hours horizons), and long-term forecasts, which are useful for more strategic market participation decisions. A final important differentiation is that sometimes it is useful to predict the base demand as such, while on other occasions forecasts are made of the available flexibility of said demand.
  • Price forecast: One of the fundamental signals in any demand response strategy is the price of electricity at all times. By obtaining price predictions, consumers can perform optimal behaviors in maximizing the economic benefits of demand response.
  • Response planning: When a consumer or aggregator needs to reduce demand, it must do so in the most convenient way possible for all users of the service. There are demands that cannot be stopped, others that can only be stopped at certain times, others that can be anticipated to reduce the impact once they stop… Hence, the problem of demand planning.
  • Demand control: In addition to determining what consumption should ideally occur at each moment, those responsible for the active response must guarantee that actual consumption fits the consumption pattern to which they have committed. This problem falls within control, and there are a multitude of techniques that allow the aggregator or large consumer to control this consumption in real time to adjust to the agreed requirements for the active response.
  • Demand segmentation: For demand aggregators, once they are asked to reduce demand, they must decide to which consumption to direct this reduction. Different segmentation techniques can be used to categorize different consumption patterns and combine them into groups, facilitating the decision of which loads to order consumption reduction.
Imagen por: @yelantsevv

As shown, the problem of active demand response is not a single problem. It is made up of multiple factors: such as economic, technical, behavioral, etc. Only by taking advantage of the latest advances in machine learning and control, we can find good solutions to each of the sub-problems and begin to take advantage of all the advantages it has to offer.

If you belong to the energy sector and want to know more or share experiences in a forum that will bring together professionals from the sector. Register now and reserve your place at the next meeting “Intelligent Energy AI and digital transformation”, which will be held in Madrid on November 28, 2023.


“BOE-A-2022-15354 Royal Decree-Law 17/2022, of September 20, which adopts urgent measures in the field of energy, in the application of the remuneration regime to cogeneration facilities and The rate of Value Added Tax applicable to intra-Community deliveries, imports and acquisitions of certain fuels is temporarily reduced.,”, 2022. id=BOE-A-2022-15354.

Antonopoulos et al., “Artificial intelligence and machine learning approaches to energy demand-side response: A systematic review,” Renewable & Sustainable Energy Reviews, vol. 130, pp. 109899–109899, Sep. 2020, doi:

Journal of Electrical Systems and Information Technology, vol., 1999. [3] Isaac Kofi Nti, T. Moses, Owusu Nyarko‐Boateng, and Adebayo Felix Adekoya. 7, no. 1, Sept. 2020, doi:

Ahmad Rezaee Jordehi, “Optimisation of demand response in electric power systems, a review,” Renewable & Sustainable Energy Reviews, vol. 103, pp. 308–319, Apr. 2019, doi: