Yes Energy News and Insights

Using AI and Machine Learning for Power Grid Optimization: How Neural Networks Can Speed Up Optimal Power Flow

We’re on the cusp of a potential artificial intelligence (AI) revolution that could reshape the energy landscape. In this post, we delve into the complexities of price formation and the optimization processes within Independent System Operators (ISOs) to discern where AI might play a transformative role.

The Roots of Power Grid Optimization

In the 1960s, a French researcher crystallized the now well-known optimal power flow (OPF) problem. Deregulation of power markets in the 1990s led grid operators to solidify the use of economic dispatch to manage electricity generation and distribution. ISOs still tackle a variant of this problem, known as security-constrained economic dispatch (SCED), to clear markets today.

Security Constrained Economic Dispatch (SCED): The Status Quo

The process begins with market participants submitting bids. ISOs then grapple with a colossal optimization challenge, ensuring the solution is economically viable as well as physically feasible. Despite rigorous manual checks, the real-time dispatch decisions are sometimes modified due to practical considerations.

The complexity arises primarily from the physics of electricity. ISOs currently rely on a simplified version called DC optimal power flow (OPF), which isn’t ideal, since it results in physically infeasible solutions that then have to be managed after the fact. Despite that, DC OPF has worked fairly well. However, it glosses over several important aspects, including: 

  • Losses: Many ISOs approximate transmission losses or calculate them after market clearing rather than calculate them directly in the OPF.
  • Reactive Power: This is often a secondary consideration, addressed post-market clearing.
  • Voltage Levels: There's an assumption that voltage magnitudes are uniform across the network.

Aiming for High-Fidelity Optimization with AC OPF

As many researchers have shown, we ideally want to improve the economic efficiency and physical reliability of the grid by moving towards the high-fidelity AC optimal power flow problem. AC OPF would be more accurate and account for voltage variations, reactive power, and true loss models.

However, the AC OPF problem is quite complex. Its equations involve multiplying variables together and using trigonometric functions, which greatly complicates the process of finding the best solution.

Grid operators have been trying to solve the AC OPF problem for decades. But it’s quite a challenging problem, which is why we currently use the more reliable DC OPF in practice. 

Engineers frequently break complicated issues into simpler forms to solve them more effectively, 

where simplifying things can sometimes give a skewed view of reality. That’s the case with 

DC OPF, which can result in solutions that require additional corrections around losses and voltages. 

Convex Versus Nonconvex Optimization 

Millions of dollars have been dedicated to finding solutions to the AC OPF problem – most notably with the ARPA-E Grid Optimization Competition Challenge offering prizes for ISOs adopting software solutions to solve this problem. However, non-convex problems like AC OPF introduce challenges that convex problems, like DC OPF, do not pose.

Convex problems have a clear-cut, single-best solution, making them relatively easy to solve. However, nonconvex problems, like those encountered with AC OPF (see image below), can have several possible "best" solutions.

Source: Dr. Kyri Baker.

This makes it hard to be sure you've found the absolute best solution and can lead to unpredictable outcomes in situations like market behavior.

As mentioned earlier, DC OPF has worked fairly well. It offers more straightforward price interpretation and deviation, is a more “stable” problem to solve (i.e., generally less erratic solution behavior/price behavior), and is easier to provide layman’s interpretations of power and prices. 

However, shifting to a more accurate AC OPF would offer the following benefits:

  • Reliability: AC OPF can prevent the need for ad hoc fixes that SCED solutions often require, bolstering grid stability.
  • Economic: The potential cost savings from improved grid operation are significant.
  • Emissions: Preliminary studies suggest that a more accurate dispatch model could reduce emissions substantially, due to a more efficient use of generation assets.

Using AI and Machine Learning in the Power Grid 

In the past, I’ve discussed using AI and ML to predict the optimal operation of the power grid while reducing grid cost and emissions. 

Today, my focus is on the following: 

Can we find a solution to the AC OPF problem without directly solving it? 

One possibility is to work on this offline: simulate a wide variety of loading and generation scenarios, handling countless scenarios with different loads and renewable energy inputs, to create a vast collection of AC OPF solutions. (See image below.)  

Source: Dr. Kyri Baker

We could then use this approach to teach a model the relationship between the grid's current state and the optimal settings. Once trained, the model could quickly figure out the best state for the power grid without having to solve complex equations from scratch every time. This method could greatly speed up the process, making it possible to optimize large networks in real time.

From Idealized Models to Real-World Power Grid Modeling 

Whenever I describe this process, I often hear the same worry that this method seems mysterious or unclear, since it’s difficult to understand how deep neural networks make their decisions. People ask why we’d use AI to solve a problem that operates a physical grid. 

AI is currently criticized a lot in the context of of large language models (LLMs), which is what many people now think of when they think of AI. For example, the AI in my research conflated PJM’s buses with school buses. Therefore, instead of proposing we replace everything the ISOs are doing with a black box, a hybrid approach might be more realistic. 

Source: Dr. Kyri Baker

For example, instead of conducting a SCED and then checking its results with an AC power flow analysis and making adjustments, we could use a neural network to predict the actual AC OPF solution. After that, we would still use the same adjustment process that ISOs use now to fine-tune the outcomes, in case the neural network's predictions are off. Ideally, the initial results from the neural network would be a better match for the optimal solution than what we get from the current process.

Using Learning Models to Solve Power Flow Problems More Quickly

In the example to the left, we ran an analysis looking at the impact on emissions when we run DC OPF versus AC OPF.

This preliminary study on a small system for a limited timeframe shows an increase in CO2: 

  • 28% increase in emission when it was assumed a natural gas generator is the slack generator (the generator which adjusts its output for AC-related violations). 
  • 1.4% increase in cost. 

I then tested the speed of solving these problems with a neural network against a traditional solver (see image below). The neural network was about 14 times faster, meaning a problem that normally takes hours to solve could now be solved in just minutes. 

Source: Dr. Kyri Baker

This speed is sufficient for use in real-world systems. In this example, a small system with 118 buses was solved in milliseconds, and a much larger system with thousands of buses could potentially be solved in a couple minutes. There’s a trade-off, however, with the carbon emissions resulting from training the neural network model. 

Unlike the massive models used for tasks like running ChatGPT, the model for grid operations doesn’t have to be so large. I tested a shallow neural network, with just one hidden layer, on my 2017 MacBook Pro, and it trained in a few hours. This model could learn from tens of thousands of scenarios to almost match the true optimal solution.

For a slightly larger system of 1,300 buses, the model had a cost error of about 1%, which, though significant in monetary terms, was still a better performance compared to the over 2% error from the current DC OPF model used in practice. This suggests that we could be operating power generation more efficiently, especially since the DC OPF model doesn't accurately account for losses, leading to the use of costlier generators.

Besides being closer to the optimal solution, the shallow neural network model was also 22 times faster than traditional methods and could be integrated with current operations of ISOs. Moreover, when compared to other advanced mathematical techniques for solving these problems, the neural network still performed significantly faster.

Optimizing Power Grid Performance with AI and Machine Modeling

Now let’s imagine that future markets have now moved towards physics-based grid constraints, and we're able to solve market clearing within a few seconds. This rapid pace would create a frenzy for traders because generators would receive dispatch instructions every two seconds. Currently, generators maintain grid frequency by following simple, built-in rules that adjust their output. However, these aren't fine-tuned for efficiency; they're designed for stability and safety. Ideally, we'd like generators to make these adjustments in the most efficient way, receiving precise commands for power changes. However, solving such a complex optimization problem every two seconds is a huge challenge.

We might look towards recent advancements like physics-informed neural networks or neural ordinary differential equations (ODEs) from the machine learning field to help with this. These tools can incorporate generator dynamics — the factors that affect their operation on a millisecond level — directly into their calculations. Neural ODEs, for instance, are designed to solve differential equations as part of their processing, which could allow us to ask if the neural network's recommended settings are stable.

By applying these advanced neural networks, we can begin to question whether we can not only maintain stability with frequency regulation but also optimize it. Traditionally, the focus has been on stability — keeping the lights on – rather than optimizing performance.

Physics-informed neural networks take into account the rapid, second-level changes in power systems that engineers regularly face. If we only solve optimization problems every five minutes, we might be compromising the grid's stability. The new model we're developing can emulate true generator dynamics almost instantly and we're looking to integrate this with an optimization solver. This could allow us to achieve both stability and optimal performance, potentially in as little as one second.

Source: Dr. Kyri Baker

This progress has significant implications for ancillary service markets, where we might move from rule-based controls to optimal frequency regulation strategies. 

Source: Dr. Kyri Baker

Takeaway: Neural Networks Speed Up Optimal Power Flow 

Rather than waiting for broader systemic reforms, we can make impactful changes now to the way the grid functions, reducing costs and emissions through software improvements. If we were to replace the current dispatch system with a neural network while keeping the existing safety checks, we could move towards a grid that's not just cheaper and more efficient but also more responsive to changing conditions. 

Beyond what I've discussed, there are additional upgrades that could enhance the grid's operations, like implementing dynamic line ratings and software improvements at the distribution level, which could also benefit from neural networks' ability to expedite optimal power flow calculations. In the meantime, we can use neural networks to speed up optimal power flow. 

Dr. Kyri Baker is an assistant professor of the Civil, Environmental, and Architectural Engineering Department at the University of Colorado Boulder, where she leads the GRid-Interactive Frameworks For Intelligent iNfrastructure (GRIFFIN) lab.

Subscribe by email