1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0
//! 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:
//!
//! ```text
//! 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.
pub
pub
/// Lazy streaming builders for LODF and N-2 LODF column computation.
pub use ;
pub use ;
pub use ;
pub use ;