Algorithms for fairness and control in energy systems

New energy sources and demands are putting fierce new pressures on our energy grid and, without adaptation, our access is at risk

Story by Catherine Tays, with Visuals by Kaitlin Pylypa - 06 May 2021

A simplified diagram of a city split between night and day, with different power uses, all connected by the electric distribution grid.

The electric distribution grid is changing, and keeping up with it will require monitoring, algorithms, and a good dose of innovation (Art: Kaitlin Pylypa).

Energy has to travel. Electricity is often generated at a central plant, but simultaneously required at thousands of locations across the entire electrical grid that supports our communities. It’s a complex system that has remained fundamentally unchanged since the Second Industrial Revolution at the turn of the 19th century.

Dr. Moosa Moghimi Haji understands the transmission and distribution of energy to our homes, businesses, and communities, and he knows we’re facing an important challenge: how can our traditional energy distribution system evolve to keep up with the ever-evolving complexity of our future energy systems?

“Right now, we're seeing new loads with new characteristics on the distribution grid in addition to renewable energy installations that are volatile in nature," he explains. From electric vehicles to rooftop solar installations, large disturbances to the old norm are becoming common. “Power systems have been around for more than a century –– they’re mature systems, everything has a standard, but that standard doesn’t match our new reality.”

Moosa is addressing this challenge in his postdoctoral fellowship under the supervision of Future Energy Systems investigator, Dr. Omid Ardakanian, a professor in the Department of Computer Science.

“I have about four different projects I’m working on or helping with,” he says, “and those are far from the only things we can and need to look at.”

An old grid with new problems

An electric substation feeds electricity to five houses, with some of them feeding energy back from solar panel generation.

With new loads and new renewable energy installations in the grid, the electricity distribution situation is becoming more complex (Art: Kaitlin Pylypa).

Omid’s group focuses on multiple areas of energy management. Some of the most visible calls for energy management in Canada have been through campaigns urging people to turn off lights and devices when they leave the room, or dress warmer indoors so they can reduce their home heating in the winter. Omid’s group is doing work that could automate those choices through algorithms that could enable smart buildings to balance energy-savings and comfortable living and working conditions. 

Beyond the familiar everyday energy management practices, the group is applying similar balancing algorithms to develop smart grids for electric distribution. Changing the topology of the distribution network has the potential to reduce losses, identify events using sensor data, and ensure that energy access remains fair and reliable. Unfortunately, maintaining a stable and fair power supply can be a challenge, even under good conditions.

“The first problem is monitoring,” Moosa explains. Traditionally, power distribution systems are very simple and predictable: energy requirements in residential areas are higher in the evenings when people are home from work, and lower in the day when they are away. “Because they have been predictable, our systems have very little monitoring capabilities beyond distribution substations.”

However, that predictability is shifting, with higher electricity draws from electric vehicle charging, private solar installations reducing energy draws, and even energy being fed back into the grid from surplus generation. As that predictability wanes, monitoring becomes essential to avoid damaging the grid infrastructure. 

Sensors are expensive and were of limited use in the past, meaning that usually only one sensor is installed at the substation or feeder head. Omid’s group is asking how we can use this limited data to identify the type of event that is happening in the grid –– a high usage spike, for instance –– and control the devices at the end, be they solar panels and inverters, electric vehicles, thermostats, or other new sources and demands.

Moosa’s first project is to determine how many additional monitoring devices would be required to acceptably improve resolution and visibility of the system. Adding sensors to every home would be cost prohibitive, so understanding how many are required at what interval will keep costs in check, while preventing breakers from being tripped.

“We can take advantage of new smart meters being developed that measure not just how much energy a house or building has drawn from the grid, but moment-to-moment electric flow, in both directions,” he adds. “This would allow users to help balance the entire grid.”  

For instance, one possibility would be to send notifications to users about the state of the grid and request they change their energy behaviour, like holding off on charging their car. If not, best effort service might come into play –– like less energy provided to all the electric vehicles when the demand is too high –– a system similar to bandwidth throttling from internet service providers.

Scheduling electric vehicles

Two houses with electric cars, one charging and one not charging, and different energy uses (lights) within the house windows

New algorithms could be the answer to balancing grid inputs and loads, for instance by scheduling the charging of electric vehicles (Art: Kaitlin Pylypa).

While Moosa leads the project assessing monitoring devices in the grid, he also lends his expertise to projects being led by Masters students in Omid’s lab which are focused on adapting to the uncertainties that Moosa’s research hopes to monitor. The first project: work on scheduling the charging of electric vehicles (EVs), led by Masters student Abdullah Al Zishan. 

“When everyone comes home from work around the same time and they plug in their EVs, the grid will get congested and it will overheat the transformers, reducing their lifespan,” Moosa explains. 

However, not everyone needs to charge their EV at the same moment; the person leaving again in thirty minutes to go grocery shopping needs energy before the person planning to stay in until the next morning’s commute. With an understanding of different user demands, an algorithm could be designed to schedule the charging of electric vehicles across the grid. 

“We want to have fairness among charging EVs, not first come, first serve,” Moosa says.

To pursue this idea, a complex model of the electric grid must be created, recognizing the limitation that no one actually has full visibility of the grid. The solution is to use the power of reinforcement learning –– a type of machine learning where an agent ‘learns’ to adjust charging power for EV based on historic, provided data about user needs and power grid conditions.

In Alberta, EV’s are not yet common, though numbers are growing. The model built by Omid’s group consists of eight thousand homes, then assumed a future scenario where five hundred of those homes –– 6.25 per cent –– would own a single electric vehicle. One charge of an average commuter electric vehicle could power a home for two to three days, so each car adds a significant draw to the grid.

“We wanted to show that even if one out of sixteen homes has an EV, we will still have problems,” Moosa explains. Unscheduled and opportunistic charging of those vehicles leads to high pressures on the electric grid, and energy flow to all homes is hampered. If customers want to avoid different prices for energy access, hour-by-hour, or paying for ‘premium access’ at high-demand times, being honest about the urgency of their energy needs will be required. An algorithm scheduling charging alleviates those bottlenecks.

“Providing mathematical proof of the model is difficult for reinforcement learning, so instead we test multiple scenarios to cover all bases,” Moosa explains. “It allows us to consider the fairness of our algorithm by seeing how it works in different situations.”

Solar generation and disaggregation

A collection of houses, three with solar panels on the roof for energy generation, one directly metered to measure power generation of the panel.
Directly metering just a proportion of solar panels could be the way to understand the total potential generation capacity of all panels throughout a distribution grid (Art: Kaitlin Pylypa).

Reinforcement learning helps address concerns of energy access in light of higher energy demands. However, even as demand increases, so might production by individual homes. 

“Another project for our model is adding renewable energy sources to the smart grid,” Moosa explains. With solar panels, or photovoltaics, appearing on more residential roofs, energy is no longer just flowing one way into residential properties. That’s why Omid’s research group also examines ‘solar disaggregation’ in a project led by Masters student Xinlei Chen.

“When we add solar generation to the distribution grid, it could lead to over-voltages in the system, if not accounted for,” Moosa says. Grid operators need to have an idea of how much solar generation exists in the grid, but there’s a problem: “They’re often unregistered because they’re so easy to install!”

One solution Omid’s group is pursuing is the creation of an algorithm that can find how much solar power is being generated by customers at a given time. This relates to, and relies on, Moosa’s first project: the idea of monitoring devices, in this case each house’s electric meter.

Traditional electric meters only measured consumption, and though new smart meters measure in both directions –– consumption from the grid and energy being fed into the grid –– they still don’t tell the full story. 

Moosa explains: “The smart meter doesn’t connect directly to the solar panel, so it doesn’t tell us how much total power it generates. It tells us how much power is left over after the house uses part of the supply. We need to understand the total potential generation capacity of those panels, to be able to predict the grid's state throughout the day and make adjustments to prevent potential damages if necessary.”

Their solution relies on directly metering some solar panels –– just a few in a city –– to provide data that could be used to refine their algorithm, providing grid operators with a tool to predict solar generation capacity across the network. 

“The time that you see most solar generation is mid-day, with the most sun,” Moosa says. “But that’s also a time of very low energy demand. In the evening, it’s the opposite.” That means a lot of energy is being produced when it's not needed, so Moosa is also leading another separate project on energy storage systems. 

“Assuming we know the location and capacity of photovoltaic panels, we can focus on voltage regulation, from the grid side, and prevent overages,” he says. “We want people to store the energy generated until the grid needs the influx to keep it stable.”  

Consumer side priorities do not necessarily align with this perspective. Some consumers with solar energy generation would prefer to maximise their profit, storing energy until they can sell it to the grid at a higher price. 

“It’s a phenomenon we need to understand,” he adds. “Battery energy storage systems are commonly paired with photovoltaic systems, so we need to add that concept to our model of the grid and the algorithms we’re designing.”

Building up power

Moosa Moghimi Haji (pictured above) has been leading and assisting with multiple distribution grid projects throughout his postdoctoral fellowship with Omid Ardakanian.

Though Moosa now has his hands in four projects centred around algorithms and reinforcement learning, this field is not where he started his research career. He wasn’t even working in energy distribution systems.

While earning his undergraduate and Masters degrees in electrical engineering in Iran, Moosa’s focus was on electricity transmission systems and grid management. At the time, he quickly realized he would have to learn to code to do the work he was envisioning. 

“I didn’t take any classes in coding,” he laughs. “It was always something I was passionate about –– even in high school.” He dove into Matlab first, finding it interesting enough to begin doing online competitions. “Neural networks were just becoming big, and Matlab already had a package –– it was exciting, and a great way to teach myself about coding before moving into other languages.”

When he moved to Canada for his PhD, that passion led him to research in modeling power systems. 

“In my PhD, I did different projects, but almost all of them were on transmission systems,” he says, referring to the vast network of transmission lines that carry energy from large-scale generation plants to the distribution networks found in communities. 

Transmission is a much different beast than distribution, with distinct challenges. “There’s lots of monitoring, unlike distribution, and it’s a very conservative field because it’s very expensive to make changes,” he adds. 

Because they connect directly to users, distribution networks are changing much more quickly. Wanting to focus his efforts on this rapidly-evolving field, Moosa joined Omid’s group in January 2019, transitioning from the electrical engineering department to computer sciences in the process. 

Despite the challenges inherent in moving into a different discipline, Moosa remains enthusiastic about learning the ins and outs of a new field. 

“In distribution, people are more willing to try things, to investigate,” he says. “The cool thing is there’s more options.”

Options, progress, and grids are all things that Moosa’s proven most capable of managing. Where will these skills take him?

“My postdoc with Omid’s group is coming to an end, and I’m looking forward to seeing what comes next,” he says. In smart grids, he finds, there’s lots of new concepts and lots of openness to explore, research, and develop. 

“It’s exciting because you might see your solution be adopted, and see it have an impact,” he says. “That’s rewarding for me.”

To learn more about these projects, click here!