#power-flow #power-systems #lodf #ptdf #dc-power-flow

surge-dc

Surge DC — DC power flow solver (linear approximation, B-theta formulation)

10 releases

Uses new Rust 2024

0.1.9 May 4, 2026
0.1.8 May 1, 2026
0.1.7 Apr 26, 2026
0.1.1 Mar 31, 2026

#2320 in Algorithms


Used in 6 crates (5 directly)

PolyForm-Noncommercial-1.0.0

1.5MB
30K SLoC

surge-dc

DC power flow and linear sensitivity studies for Surge.

This crate provides linear B-theta power flow along with reusable sensitivity calculations such as PTDF, LODF, OTDF, and related prepared-study workflows used by transfer, contingency, dispatch, and OPF layers.


lib.rs:

Surge DC — DC power flow solver and linear sensitivity analysis.

DC Power Flow: Fundamental Assumptions

The DC power flow model makes three simultaneous approximations to linearize the AC power flow equations:

  1. Flat voltage profile — all bus voltage magnitudes are assumed to be 1.0 p.u. (|V_i| = 1.0 for all buses). This eliminates the voltage magnitude unknowns and decouples P from Q.

  2. Small angle differences — the sine of the voltage angle difference across each branch is replaced by the angle itself: sin(theta_i - theta_j) ≈ theta_i - theta_j. Valid when angle differences are small (typically < 10-15 degrees).

  3. Lossless branches — branch resistance is neglected (r ≈ 0, so that g_ij ≈ 0 and the branch admittance is purely imaginary: y_ij ≈ -j/x_ij). This means real power losses (I^2 R) are not captured.

Together, these yield the linear system:

P = B' * theta

where B' is the bus susceptance matrix (with the slack bus row/column removed) and theta is the vector of bus voltage angles. This system is solved with a single sparse LU factorization (KLU) — no iteration required.

What DC Power Flow Does NOT Compute

Because of the three approximations above, DC power flow does not produce:

  • Voltage magnitudes — reported as 1.0 p.u. for all buses (assumed, not computed).
  • Reactive power flows — reported as 0.0 for all buses and branches.
  • Real power losses — the lossless assumption means branch losses are zero.
  • Voltage-dependent load behavior — all loads are treated as constant-power at 1.0 p.u.

For precise power flow results including losses, reactive power, voltage magnitudes, and voltage-dependent loads, use the AC Newton-Raphson solver in surge_ac.

When to Use DC Power Flow

DC power flow is the industry standard for applications where speed and linearity matter more than exact voltage/reactive results:

  • ISO/RTO real-time market clearing — all US ISOs (ERCOT, PJM, MISO, CAISO, SPP, NYISO, ISO-NE) use DC power flow in their Security-Constrained Economic Dispatch (SCED) and Locational Marginal Price (LMP) engines.
  • Contingency screening — PTDF/LODF-based N-1 and N-2 screening is orders of magnitude faster than AC re-solve for each contingency.
  • Transfer capability studies — ATC/TTC/AFC calculations per NERC methodology.
  • Shift factor computation — GSF, BLDF, PTDF, LODF for market and planning analysis.
  • Injection capability heatmaps — FERC Order 2023 interconnection study requirements.

Module Structure

  • Top-level exports provide the canonical public API.
  • streaming exposes advanced lazy LODF/N-2 column builders.
  • Internal modules cover the DC solver kernel and one-shot sensitivity wrappers.

Transfer capability analysis (ATC/TTC/AFC, DFAX, stability-limited transfer) has been consolidated in the surge_transfer crate.

Dependencies

~17MB
~293K SLoC