Sub-Millisecond Transmission Safety via PTDF Matrix Screening
Replaces slow 10 Hz DC-OPF iterative linear programming with fast O(L) Power Transfer Distribution Factor dot products to intercept thermal overload risks instantly.
“A single dot product per trade decides whether the grid survives. The PTDF matrix is physics compressed to a lookup table.”
The DC-OPF Bottleneck
Full DC Optimal Power Flow (DC-OPF) formulates transmission security as a linear program with B_bus · θ = p_net as the nodal balance constraint, subject to thermal limits |f_l| ≤ f_l^{max} on every line. Solving this LP at 10 Hz for each candidate trade requires roughly 1–10 ms per call depending on the network size — too slow for a market maker that must quote in under 1 ms. The iterative interior-point solver also introduces non-determinism in its convergence path, making it unsuitable for a deterministic event-sourced ledger. PTDF pre-computation eliminates these problems by compressing the full AC physics into a static matrix.
PTDF Matrix Derivation
The Power Transfer Distribution Factor matrix Φ ∈ ℝ^{L×N} maps a vector of bus injections p ∈ ℝ^N to line flows f = Φ · p. It is derived analytically from the DC power-flow Jacobian: Φ = B_d · A_inc · B_bus^{+}, where B_d = diag(1/x_l) is the diagonal susceptance matrix, A_inc ∈ ℝ^{L×N} is the signed incidence matrix of the graph, and B_bus^{+} is the Moore-Penrose pseudoinverse of the nodal susceptance matrix with the slack bus column zeroed. Once computed, Φ is a dense floating-point matrix that can be stored in a few kilobytes for typical microgrid topologies.
O(L) Trade Screening
Given a proposed trade of dP MW from bus i to bus j, the incremental line flow vector is Δf = (Φ[:,i] − Φ[:,j]) · dP. The trade is accepted if and only if max_l |f_l + Δf_l| ≤ f_l^{max} · safety_margin for all L lines, where safety_margin ≈ 0.95 provides a 5 % thermal headroom. This is a single matrix-vector multiply plus a max-comparison, executing in O(L) time — approximately 9 microseconds for our 7-bus, 9-line microgrid on commodity hardware. The deterministic nature of the check means every rejection can be reconstructed from the event log given the PTDF matrix and the injection vector.
Congestion Flags and LMP Shadow Costs
When a line's current utilization |f_l| / f_l^{max} exceeds 85 %, the grid store sets congestionFlags[lineId] = true, triggering the amber visual indicator on the topology map. Exceeding 95 % promotes the flag to critical and applies a CSS pulse animation to draw operator attention. Locational Marginal Prices (LMPs) under congestion can be decomposed as LMP_i = λ + Σ_l μ_l · Φ_{l,i}, where λ is the system energy price and μ_l is the shadow price (dual variable) of the thermal constraint on line l. In Sovereign-AMM's stub implementation, shadow prices are approximated from the utilization excess, giving operators directional LMP signals without solving the full LP.