About a month ago I sat down and attempted to write down equations which govern grid dynamics. That is, how power comes out of the wall. Why is another story, but it turned out to be quite complicated. Additionally, I never found a concise explanation online so I have decided to write this blog in case any other traveler in cyberspace needs to know the physics or mathematics of the electrical grid.

First I will signpost all the different parts, then give plain English explanations, then equations. If the stars align I may eventually provide a github repo with a basic demo.

Like in any electrical circuit, currents are more or less instant responses to voltages, so we need a mechanism to solve for currents. Then we need to compute the time dependent aspects, which fall into passive and active components.

I just found out WordPress supports so hold on to your hat.

## Oh My God, It’s So Parallel

The counterintuitive thing about the grid is that everything is extremely parallel. On the load (consumer) side, adding a load to the grid *reduces* its total resistance. That is, plugging in a toaster adds another path from active to neutral, reducing the overall resistance of the grid.

The grid is full of transformers so that less power is lost in transmission, but for the purposes of this analysis I’m going to pretend that generation, transmission, and load all occurs at the same voltage and that wires have no resistance at all. This is a safe assumption for the dynamics I’m attempting to capture, provided we pick sensible values for load resistance and inductance.

To get a feeling for how grid resistance works in practice, consider a 100W light bulb. Operating at 110V (RMS), this bulb has a resistance of about 100 , which is quite a lot! Now consider the power grid of a small town, which consumes a peak of 500MW. The effective resistance of that grid is V^2/P = 20 , which is less than a lump of copper!

Electricity demand varies throughout the day, traditionally peaking in the late afternoon and falling in the early morning, often varying by a factor of two or three. Although individual consumers operating switches are discrete events, over a large area power demand, or effective grid resistance, is not only pretty continuous, it’s also very predictable. Traditionally, power has been dispatched a day in advance, with a blindingly fast 30 minute market for followup. In markets with lots of wind and solar this has become problematic, but only because of less predictable variations on the supply side, not the demand side.

The grid operates on AC power at ideally constant frequency and voltage. The effect of lowered grid resistance is higher current flow. Current flowing through the generator produces a dragging torque, which is overcome by (typically) a turbine or other prime mover. Operating a grid, then, is a delicate dance to match grid demand with turbine-generated torque, keeping voltage and frequency stable.

## Okay, Now Parallelize

This is all reasonably straight forward. In practice, however, most grids have more than one generator. My area of interest is in how dozens of different types of power plant coordinate and compete when connected to the same grid without breaking everything.

While the voltages produced by the generators are essentially a function of their rotation speed, the currents, which generate the drag force, need to be computed.

## Step One – Resolve Grid Currents

I will use a somewhat contrived example consisting of a series of generators in parallel. Each parallel string contains, in series, an AC voltage generator (function of frequency and phase ), an inductor and resistor . One could add capacitors but the electrical grid is dominated by resistive and inductive elements.

Each string, labelled by numeral subscript , generates a current defined to flow from neutral to active, i.e. upwards.

In order to solve for the , we need a set of conditions. These are that the sum over the is zero, and that all the voltages are equal in complex amplitude at any given time. In this formulation, that means that this difference between any two voltages is also zero.

That is,

and

where

or

splitting the EMF and reactive components, and

Fortunately, this can be expressed compactly in matrix form, e.g.

where (alas we have reached the limits of WordPress’s parser…)

and

Note that A is nearly upper diagonal, meaning a solution is easily computed, if not trivial to typeset. The addition of a load to this formalism is trivial, if slightly inelegant – simply set the voltage contribution (or frequency, equivalently) of one of the generators to zero.

## Step Two – Compute Torque

With current in hand, it is a simple matter to compute the torque experienced by the generator’s armature and balanced by, eg, steam flowing through a turbine. I will employ the rotational version of .

or torque equals moment of inertia times angular acceleration.

where is the turbine’s power, set by some sort of throttle or governor, and the drag term is due to Lorentz force. Practically speaking, the drag force is proportional to the current (which varies), the magnetic field in the generator (which is typically fixed if produced by permanent magnets) and geometric quantities, the most salient of which is the relative phase angle between the current and the magnetic field.

Consider the simplest example, that of a single wire loop rotating in a uniform magnetic field. The peak EMF coincides with the maximum change of flux, meaning that the current flow peaks coincide with the magnetic field peaks, maximizing drag. The inductive component of the circuit’s reactance, however, delays the current peak by some acute angle, slightly reducing the torque drag.

A full explanation of AC generators and phasor diagrams is beyond the scope of this blog, but here are a few YouTube videos I found that explain the basic concepts, and here is a website with a thorough explanation of the underlying theory.

In actual generators, current is generated in three phases carefully designed to provide constant drag force with armature angle, minimizing ripple.

The most important part of this section is showing how multiple generators operating in lockstep are generally stable.

Consider a special case where there are a large number of generators all in phase, and one small one that has somehow gotten out of phase by a small factor , perhaps due to a loss of steam. That is, the physical phase of its armature is ahead or behind that of the other generators.

One consequence of solving the matrix equation in part one is that for many generators in parallel, the current that flows through them is the sum of the current contributions of every generator. That means that even though the troublesome generator is out of phase, the current it carried is still in phase, because the individual contribution of that generator is rather small in the grand scheme of things.

In words, an armature that has fallen behind has a greater angular mismatch between its coils and the peak magnetic field and experiences less torque, while one that has gotten ahead has a smaller angular mismatch between its coils and the peak magnetic field, and experiences greater torque. The consequence of this variation is that the perturbations are self-correcting and do not lead to growth.

Mathematically,

where

In the case where , then , i.e. in steady state. The easiest way to analyze this is to take a Taylor expansion around .

which has the appropriate behavior provided is negative, that is, the circuit is dominated by inductive rather than capacitive loads.

In practice, a lack of inductance in the circuit reduces the amplitude of the correcting impulse, leading to slowed perturbation recovery and ultimately instability in the grid. Traditionally, some utilities have operated turbines well below capacity purely for inductive ballast. In the future, grid scale batteries can easily correct wobbles in real time.

Finally, a large perturbation will eventually overcome the region of stability and lead to severe problems – so physical generators in this situation will trip their breaker and disconnect from the circuit.

## Step Three – Droop Speed Control

With the above machinery we can calculate how a mass of parallel generators and loads generate currents, and how each individual generator physically provides the torque necessary to shove electrons down wires and vice versa. The only missing part of the picture is how the grid ramps up and down each day in response to demand.

This is performed using droop speed control. The Wikipedia article is a bit opaque so I’ll include a summary here.

Consider a single generator powering a load that slowly varies over time. If the load resistance decreases due to an addition of appliances to the grid, such as everyone turning on their television, then the current flowing through the grid increases. An increase in current increases the drag torque the generator experiences. This slows the armature and reduces the grid frequency.

In response to the reduction of frequency, the speed control on the generator increases power to the turbine, matching the drag torque with an addition of power. The same process works in reverse, when the load diminishes and the turbine’s powering torque is reduced.

Droop speed control dictates by what fraction power is altered to the generator as a function of frequency variation. Droop percentages of about 4% are conventional in the industry. This means that if the frequency decreases (droops) by 4%, then the governor will open to 100%. A more typical frequency reduction of, say, 0.01% will result in the governor opening by 0.25%.

Provided that all the generators in the grid are wired with this (or a very similar) proportionality constant, they will all respond to demand and frequency variation in the same way, ensuring that load is shared among generators of different sizes in accordance with their capacity.

## Conclusion

I believe that the physics captured above is adequate to describe the dynamics of large electrical grids at a granular level of detail. My intention in getting started on this was to build a agent-based model to simulate the behavior of grid participants in a world defined by these laws. This model also has a financial layer based on how utilities pay for generation services and price electricity. The grid is the single most complex and indispensable system ever built by humans, and after a half-century of business as usual it is now evolving rapidly as traditional fossil-fueled steam turbines are rapidly displaced by wind, solar, and batteries. What makes it interesting is that it all has to be backwards compatible and never turned off!