This is a genuinely dynamic counterpart to the 3D version's steady-state DC power-flow snapshot: every bus i (generator or load) carries its own rotor/frequency state and obeys the classic power-system swing equation — a 2nd-order ODE, integrated live with RK4, not re-solved algebraically:
M_i·dω_i/dt = P_i − D_i·ω_i − Σ_j K_ij·sin(θ_i − θ_j)
dθ_i/dt = ω_i
θ_i is the bus's rotor/phase angle, ω_i its frequency deviation, M_i its inertia (generators: large; loads: small, representing motor + frequency-sensitive demand), D_i its damping, and K_ij·sin(θ_i−θ_j) the real nonlinear AC power-angle relationship (the 3D sim linearizes this to θ_i−θ_j for a one-shot solve; here the full sine is integrated through time, so you can watch electromechanical oscillations settle or fail to settle).
The cascade mechanic:
- Trigger a fault — one line opens (K→0). The remaining rotors are suddenly out of balance and visibly swing — angles and frequencies oscillate before (hopefully) re-locking to a new common frequency.
- Overcurrent relay tripping — a line whose instantaneous power exceeds its rated capacity trips after an inverse-time delay (worse overload → faster trip), exactly like the 3D sim's protection logic, but driven by the true oscillating AC flow instead of an algebraic snapshot.
- Under-frequency load shedding — if a bus's local frequency deviation ω_i collapses below a relay threshold and stays there, its load block sheds automatically, mirroring real UFLS relays that sacrifice some demand to save the rest of the island from a total blackout.
- Sync order r — the Kuramoto order parameter |mean(e^{iθ})|: 1.0 means every bus is phase-locked to a common frequency; a falling r is the dynamic signature of a grid coming apart.
Loss of synchronism is a real, distinct failure mode from a static overload: a single-machine-infinite-bus system with the same equations has a hard analytic stability limit (Pmech ≤ K, the classic equal-area criterion) — push past it and no steady state exists at all, only ever-growing angular slip.