Smart Grid Optimizations using Artificial Intelligence

The Traditional vs Smart Grid

The energy grid is a complex network of hard and soft infrastructure that delivers electricity from producers to consumers. Producing the electricity that powers our homes and businesses involves dozens of steps, including generation, transmission, distribution, and consumption. Luckily, most people in the United States don’t have to think about this process. They simply pay the electricity bill each month and the lights come on.

The electricity grid in the United States has remained relatively stagnant for decades. While our cars and phones have modernized, most of the grid still relies on the same systems it was using decades ago. In contrast to the conventional power model, the smart grid refers to the technologization and decentralization of the electricity network. Through smart metering, renewable and small-scale energy generation, and other technical solutions, the smart grid aims at modernizing the current system of electricity distribution by putting more power in the hands of consumers and small power producers and out of the hands of big utilities, aging infrastructure, and the top-down approach that has characterized it for decades.

The traditional power grid is a one-way flow of electricity from production (generation) to consumers (households and businesses).

Another feature of the smart grid is the ability to collect and send data to and from producers and consumers in near-real time. This bi-directional data flow is known as a fully connected grid. A fully connected grid has many potential benefits to producers and consumers, including more efficient transmission of electricity, quicker restoration of electricity after power disturbances, reduced operations and management costs for utilities, and lower power costs for consumers. Other benefits include reduced peak demand, which can help lower electricity rates, increased integration of large-scale renewable energy systems, better integration of customer-owner power generation systems, including renewable energy systems, and improved security2. Ultimately, the hope is that grid modernization may help prevent catastrophes and other disasters and power grid failures (brown and blackouts) by targeting vulnerabilities on the grid before they occur.

The smart grid offers a bi-directional data flow, with renewables on homes and electric vehicles potentially feeding electricity back onto the grid.

So, given the benefits to grid modernization and the influx of electricity data, might AI and machine learning also have a role to play in the smart grid? While its practical role is still nascent, it is already used to predict consumption price, power generation, future optimum scheduling, fault detection, and detection of network intruders. The terabytes of new data produced by distribution utilities every year offer exciting opportunities for analysis and understanding. Machine learning techniques to analyze and predict energy load, pricing, and demand include regression, classification, clustering, and bayesian methods.

Due to the tremendous economic and environmental potential of the smart grid, there are many companies interested in leveraging machine learning for use in the electricity grid. These companies range from large multinationals (Google, IBM, Siemens, Cisco, Schneider Electric) to startups (Opower, Veritone Energy, Stem, Inc), academic institutions and national labs (Berkeley National Lab, NREL), as well as power utilities themselves.

While the current role of AI is still somewhat nascent and largely performed in research settings, it has tremendous on-the-ground potential, particularly once the grid infrastructure has been updated. AI has the potential to help consumers save money and use electricity more efficiently. Machine learning can play a role on both the production and consumption side, known respectfully as supply side and demand side management.

Supply Side vs Demand Side Management

Approaches to grid modernization usually fall in one of two categories: 1) Actions taken on the supply side or 2) Actions taken on the demand side, known respectively as supply side and demand side management. Supply side management includes things done on the utility or distribution side, like integrating renewable energy sources or upgrading infrastructure. Alternatively, demand-side approaches include measures taken to influence consumer behavior, like installing smart meters or offering off-peak pricing. Machine learning can play a role in both management approaches.

One area of research where machine learning and optimization techniques can influence the grid is load balancing. Load balancing refers to the use of various techniques by power stations to store excess electrical power during low demand periods for release as demand rises. Load balancing is done in a grid with integrated renewables to balance the renewable energy supply to the demand. Renewable sources are inconsistently reliable; the sun does not shine all the time, just as it is not windy every day. To combat this variability, utilities are starting to integrate technologies like pumped hydro, flywheels, compressed air, and batteries into the grid. In the case of battery storage, one key parameter is the battery state of charge, or the battery’s remaining capacity. Determining this battery charge vs discharge rate is important to the overall efficiency of the system. Overcharging may damage or deplete the life of the battery, while undercharging may render useless some of the battery’s available storage. This optimization problem is one area of research where machine learning can play a role.


In “A review on artificial intelligence based load demand forecasting techniques for smart grid and buildings,” by M. Raza et al, the authors compare and contrast several techniques for grid load forecasting4. Overall, artificial neural networks (ANNs) showed better performance than the standard statistical techniques (linear and logistic regression). Eight different types of ANNs were highlighted, including a support vector machine based model, a Wavelet Neural Network, and a Multi-Layer Perceptron Neural Network, in addition to hybrid ANN techniques. Many of the ANN models resulted in a mean absolute percentage error (MAPE) in the 1–2% range. The neural network that achieved the lowest MAPE used a genetic algorithm technique with fuzzy logic in its implementation. The authors propose that future research might include considering other meteorological conditions (humidity, cloud cover, rainfall, wind), further optimization techniques, electricity pricing, and demand-side management.

Active Demand Side Management for Households in Smart Grids

In “Active demand side management for households in smart grids using optimization and artificial intelligence”, Gregio Di Santo et al. from the Department of Electrical Energy and Automation Engineering at the University of São Paulo, Brazil combine optimization and AI techniques for demand-side load forecasting using the price of electricity5. In the paper, the researchers aim to develop a decision making methodology for an electricity system containing solar PV generation and energy storage, with the ultimate aim of, first, reducing the consumer’s electricity cost and, second, reducing grid load at peak times. The authors use a validated neural network trained with optimized data to achieve these results.

The paper methodology is threefold: 1) Perform an optimization process to find the optimal battery storage rate, 2) Train a neural network (the Management Decision Making System, or MDMS), and 3) Validate the model, and repeat the steps if necessary.

The MDMS takes in two electricity load curves (solar and consumer profiles) and the cost of energy and outputs the optimal battery storage load curve.

The above schematic diagram shows the paper’s basic methodology. The data inputs are the solar power load curve (Psolar), the consumer load curve (Pcons), and the electricity tariff (Tenergy). These are the inputs to the MDMS; the output is the charge and discharge power of the battery (Pstorage).

First, the optimization process receives an input data set consisting of a combination of electricity consumption and solar generation profiles, as datetime intervals. This input dataset is passed to an optimization algorithm (a Dynamic Differential Evolution algorithm), where daily curves for the battery’s energy storage are produced randomly, considering charging and discharging restrictions, until an optimal curve is reached. Next, the battery’s overall power, losses, accumulated energy consumed, and electricity cost are calculated. Then, the question is posed, is the consumer’s electricity cost the minimum possible according to the optimization algorithm? If so, that data should be used to train the model. If not, repeat the optimization process, until the cost is the minimum possible (see below).

The flowchart above demonstrates the battery load curve, optimized for cost.

Once the battery’s optimal load curve is calculated, the converter’s required power can be calculated and the neural network training can begin. The neural network used in the MDMS is a Multi-Layered Perceptron Nonlinear Auto-regressive with eXogenous inputs (NARX) Artificial Neural Network (ANN). This neural network is based on the linear ARX model, which is a model commonly used for data inputs requiring timeseries. Electricity curves are essentially timeseries datasets — I find it easy to simply think of each data input as essentially two columns — one being a list of timestamps and the other being a load curve (i.e. kilowatt hours or megawatt hours). The data inputs to the neural network are the solar generation load curve, the consumer’s demand curve, the price of energy (energy tariff), and the optimal battery storage curve, obtained from the optimization step. These data sets are divided into test, training, and validation steps, and then the model is trained, with the desired output being the network equaling the optimized converter power:

Results and Evaluation

The data was trained using different datasets for three customer profiles: 1) an eco consumer, who is more efficient and uses less energy, 2) a waste consumer, who uses more energy during peak hours, and 3) an average consumer, whose energy consumption lies at the average of the eco and waste consumers. The consumption and solar generation data was from residential and commercial homes in Sao Paulo, respectively.

The main metric used to evaluate the neural network was the Mean Squared Error (MSE), with the lower MSE meaning better performance. The below figure shows the neural network training results from the ANN runs 1–17, with the number of hidden layers and MSE. The ANN16 model architecture with 5 neurons in the hidden layer achieved the lowest MSE.


This paper offers one way that machine learning could be used to lower electricity bill costs for residential consumers. There are of course obvious limitations to this approach. The electricity system used is specific, using both solar PV and battery storage. Making this methodology work with other types of renewables (wind, hydro power) might be one further area of research. The system studied is also considered in isolation, and not as one node in a larger grid network. This MDMS system would have to be implemented for many systems across the grid to be effective at large-scale.

The research around machine learning and the smart grid in many ways far exceeds the on-the-ground reality. While there are some improvements in the residential and commercial sectors, most of the country still relies on the conventional infrastructure and top-down model.

There are many obstacles to large-scale grid modernization. There are many different parties and stakeholders — power utilities, regulatory agencies, investors, companies, and consumers, whose needs have to be met. To modernize the grid one must “build a new plane while the plane is in flight,” to use one analogy. But, as we are seeing in the United Nations COP26, our priority must be on reducing fossil fuel emissions and our reliance on coal and natural gas. This may mean we have to modernize whether we like it or not.


  1. “Smart Grids: Electricity Networks and the Grid in Evolution.” Smart Grids: Electricity Networks and the Grid in Evolution, ISCOOP, 11 Oct. 2021,
  2. Khoussi, S., and A. Mattas. “Conventional Grid.” Conventional Grid — an Overview, Handbook of System Safety and Security, Science Direct Topics, 2017,
  3. B. Ramesh, et al. “How Artificial Intelligence Will Revolutionize the Energy Industry.” Science in the News,, 28 Aug. 2017,
  4. Raza, M. Q., & Khosravi, A. (2015, June 16). A review on artificial intelligence based load demand forecasting techniques for smart grid and buildings. Renewable and Sustainable Energy Reviews. Retrieved November 19, 2021,
  5. K. Gregio Di Santo , S. Giuseppe Di Santo, R. Machado Monaro, M. Antonio Saidel, “Active demand side management for households in smart grids using optimization and artificial intelligence,” Journal of the International Measurement Confederation, Volume 115, February 2018, Pages 152–161,