Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Solver Overview

GDM-Flow provides four power flow solvers, each suited to different analysis needs. All operate on DistributionSystem objects from grid-data-models and share the same Y-bus construction infrastructure.

Solver Comparison

FeatureAC OPFAC PFDC OPFLinDistFlow
FormulationNonlinear least-squaresFixed-point iteration (OpenDSS-style)Quadratic programBackward/forward sweep
VariablesVmV_m, θ\theta (per-unit)VV (SI, complex)PgP_g, θ\thetaV2V^2, PP, QQ
LossesFull I2RI^2R lossesFull I2RI^2R lossesNeglectedNeglected
Reactive PowerFull Q modelingFull Q modelingNeglectedModeled
Network TopologyMeshed or radialMeshed or radialMeshed or radialRadial only
Economic DispatchNoNoYes (generation costs)No
SpeedModerate (~300 ms)Moderate (~200 ms)Moderate (~400 ms)Fast (~2 ms)
AccuracyHighestHighestApproximateApproximate
Center-Tapped TransformersFull support (polarity-aware)Full support (polarity-aware)Limited (small-angle violation)Full support (directed graph)

When to Use Each Solver

AC OPF

Use when you need accurate voltages and losses. The AC solver finds complex voltages that satisfy power balance at every node, including reactive power and I2RI^2R line losses. Best for:

AC PF (Fixed-Point Iteration)

Use when you need classical power flow with fixed P/Q injections and a slack bus. Unlike the AC OPF which optimises voltage magnitudes within bounds, the AC PF solves the standard power-flow equations directly. Best for:

Features SI-unit formulation (avoids per-unit ill-conditioning across voltage levels), sparse LU factorisation of the Y-bus, and a direct initial solve (V=Y1IV = Y^{-1} \cdot I) for a physically correct warm start.

DC OPF

Use when you need economic dispatch with generation costs. The DC solver minimizes total generation cost subject to linearized power balance constraints. Best for:

Note: DC OPF uses the small-angle approximation (sinΔθΔθ\sin\Delta\theta \approx \Delta\theta), which breaks down across center-tapped transformers where the S2 winding operates at 180° from the primary. On systems with significant split-phase residential load, DC OPF will underestimate total source power. Use AC OPF or LinDistFlow for accurate results on such systems.

LinDistFlow

Use when you need fast voltage drop estimates on radial feeders. LinDistFlow performs a single backward/forward sweep without iteration. Best for:

Common Workflow

All solvers follow the same pattern:

from gdm.distribution import DistributionSystem

# 1. Load the system
system = DistributionSystem.from_json("model.json")

# 2. Run a solver (each has a *_from_components convenience wrapper)
result = solver_from_components(system, ...)

# 3. Inspect results
print(result.success)

The *_from_components wrapper functions automatically extract loads, solar, batteries, and other components from the system. For fine-grained control, use the lower-level functions that accept explicit parameter dictionaries.

Time Series Simulation

For models with time-varying load and solar profiles, GDM-Flow offers two simulation modes:

ModeApproachBattery SOCRamp LimitsSolvers
QSTSSequential snapshots with warm-startTracked (not optimized)NoAll four
Multi-Period OPFJoint optimization over horizonOptimized across timeYesDC OPF, LinDistFlow

See the Time Series guide for details.