Djinious
Power gridsEnergy

AC grid stability

Does the grid survive the fault? Synchronous machines whose rotor angles must stay in step, a three-phase short circuit, and the critical clearing time that separates a recoverable swing from a blackout — the swing equation, the equal-area criterion, multi-machine stability, and the low-inertia renewables concern.

DjiniousLab
Two rotor-angle trajectories after a fault — one a bounded damped swing, the other diverging past the 180-degree loss-of-synchronism line
critical clearing time (SMIB)
0.37 scritical clearing time (SMIB)
equal-area vs time-domain agreement
1.9%equal-area vs time-domain agreement
settling with a stabilizer
20 → 5.2 ssettling with a stabilizer
RoCoF when inertia halves
2×RoCoF when inertia halves
design notebooks
10design notebooks
requirements PASS
5 / 5requirements PASS

Clear the fault in time and the grid holds. Too late, and it falls.

An AC power grid runs on synchronous machines spinning in lockstep. When a short circuit hits, each generator's rotor swings — and the question that keeps the lights on is whether they swing and re-settle, or whether one accelerates past the point of no return, slips out of step, and triggers a cascade. The margin is measured in tens of milliseconds: the critical clearing time. This program models that swing from the single-machine textbook case up to a multi-machine grid, the way PSS®E and PSCAD do — and ends on the inertia question the renewables transition is forcing.

A generator is a mass on a spring made of electricity.

The swing equation governs a synchronous machine's rotor angle: mechanical power in, electrical power out, and an inertia that resists change. The electrical power transferred across the network follows P = Pmax·sin δ — a curve with a stable equilibrium where the machine normally sits and an unstable one past the peak. Push the angle beyond that peak and the restoring power falls instead of rising: the machine runs away. Everything in transient stability is about staying on the right side of that curve.

DjiniousLab
The power-angle curve P = Pmax sin(delta) with stable and unstable equilibria where mechanical power crosses it
The power-angle curve: electrical power transfer is Pmax·sin δ, and the machine sits where it meets the mechanical input — a stable equilibrium on the rising side, an unstable one past the peak. Cross the peak and the restoring torque reverses. The geometry behind every stability question.
DjiniousLab
Rotor angle after a fault — a bounded damped swing for a fast clearance versus a runaway divergence for a slow one
The hero: the same fault, cleared at two different times. Cleared fast (green) the rotor swings out, swings back, and rings down — the grid holds. Cleared late (red) it accelerates past the 180° loss-of-synchronism line and never returns — a pole-slip, the seed of a blackout. The critical clearing time is the knife-edge between them.

You can predict the limit without simulating it.

The equal-area criterion turns the stability question into geometry: during the fault the machine accelerates, accumulating an area under the power-angle curve; after clearing it must give that energy back as an equal decelerating area before the angle reaches the point of no return. Set the two areas equal and you get the critical clearing angle in closed form — and it matches the time-domain simulation to under 2%. Theory and simulation agreeing is what lets you trust the limit on a grid too large to eyeball.

DjiniousLab
The equal-area criterion — an accelerating area during the fault balanced against a decelerating area after clearing
The equal-area criterion: the accelerating area A1 banked during the fault must be repaid as an equal decelerating area A2 after clearing, before the angle reaches the unstable point. Equating them gives the critical clearing angle in closed form — here within 1.9% of the full simulation.

Real grids have many machines — and they argue.

One machine against an infinite bus is the textbook; a real grid is dozens of machines coupled through a network, swinging against each other. Reduce the network to the generator nodes and the same swing dynamics produce inter-area oscillations — groups of machines rocking against other groups — that must damp out after a disturbance. The program builds a multi-machine system, finds its equilibrium, faults a line, and shows the machines either staying in step or one of them losing synchronism, with its own critical clearing time.

DjiniousLab
Relative rotor angles of several machines ringing down together and staying synchronized after a disturbance
Multi-machine: the relative rotor angles of a reduced network swing and ring down together, staying in step — with a slow inter-area mode where one machine rocks against the rest. The single-machine intuition, scaled to a grid that argues with itself.

Less spinning iron means a twitchier grid.

Synchronous generators carry physical inertia — spinning mass that resists frequency change and buys time after a disturbance. Replace them with inverter-based wind and solar and that inertia falls, so the same generation-load imbalance produces a steeper rate-of-change-of-frequency and a deeper frequency nadir. The program quantifies it: halve the inertia and the RoCoF doubles. It's the stability concern the energy transition is forcing onto every grid operator, modelled directly.

DjiniousLab
System frequency dipping after a load step, with a deeper nadir and steeper slope at lower inertia
The inertia question: after a generation-load imbalance the system frequency dips, and lower inertia means a steeper rate-of-change-of-frequency and a deeper nadir. The renewables transition's central stability concern, quantified — halving inertia doubles the RoCoF.

Every number re-derived at sign-off.

The V&V notebook rebuilds the machines and network from scratch and re-derives each requirement against theory, printing a PASS/FAIL board.

Result

  • SMIB stable vs pole-slip: 0.97 / 330 rad
  • Equal-area vs simulation: 1.9%
  • Multi-machine synchronism: 40.2° spread
  • PSS settling improvement: 20 → 5.2 s
  • Frequency nadir / RoCoF: 59.56 Hz; ×2

Requirement

  • SMIB stable vs pole-slip: R-01
  • Equal-area vs simulation: R-02 < few %
  • Multi-machine synchronism: R-03
  • PSS settling improvement: R-04
  • Frequency nadir / RoCoF: R-05

Classical machines, validated against theory.

The deliverable is ten notebooks and the dossier — the swing equations on a reduced network are a causal ODE system, not an acausal one, so there's no custom block or canvas. The machines use the classical constant-voltage-behind-reactance model (not detailed two-axis dynamics with full exciter/governor models — though the stabilizer notebook adds damping control); the network is Kron-reduced and balanced positive-sequence; there's no protection-relay modelling, and parameters are indicative. What the program proves is the core of transient stability — the swing, the critical clearing time, the equal-area criterion, multi-machine stability, and the inertia question — every number re-runnable and checked against closed-form theory where it exists. It is the AC-dynamics counterpart to the DC microgrid flagship.