Skip to main content

Module batch

Module batch 

Source
Expand description

Batched DC power flow: many scenarios over one topology, one factorization in total.

batch::BatchSolver can reuse only the symbolic half of its factorization across scenarios, because Newton’s Jacobian changes numerically at every iteration of every scenario. DC has no such problem: B depends on the topology alone, so a bus-injection scenario changes only the right-hand side. That makes batching here a qualitatively cheaper operation, not merely a parallel one.

The implementation leans on DC being exactly linear rather than re-solving anything:

\[ \theta_s = \theta_{base} + \Delta\theta(\Delta P_s), \qquad P^{f}s = P^{f}{base} + \Delta P^{f}(\Delta P_s) \]

One base solve establishes the phase-shift and reference-angle terms; every scenario is then that base plus DcSensitivity::response to its own injection delta. Since response solves against a factorization built once in DcSensitivity::new, a batch of ten thousand scenarios performs exactly one numeric factorization.

This is not an approximation, and tests/dc_batch_test.rs::batch_matches_a_sequential_loop_exactly asserts it against a plain loop over dc_power_flow to 1e-12.

§Contingencies

Scenario::branch_outages is rejected here, as it is on the AC path — but for the opposite reason. On AC it is unimplemented because an outage gives each scenario its own sparsity pattern. On DC it is unnecessary: an outage’s effect on flows is DcSensitivity::outage_flows, one solve and no refactorization at all, so folding it into a scenario type designed around per-bus overrides would be a worse API than the one that already exists. See docs/src/powerflow/dc.md.

Structs§

DcBatchResult
One scenario’s DC answer.
DcBatchSolver
Solves many DC scenarios over one shared topology.