Power Flow Commands
gat pf runs the DC or AC power-flow solvers built on gat-core graphs plus the shared solver registry (gat-core::solver::SolverKind). The CLI exposes the same options for both solvers so you can switch backends, control threading, and stage the output for downstream tools.
Quick start: For most use cases, start with DC power flow for fast linearized analysis, then move to AC for precise nonlinear results.
gat pf dc <grid.arrow> --out flows.parquet
Performs the classical DC approximation (B' θ = P) with configurable solver/backends:
--solver gauss|faer: selects the linear solver registered ingat-core::solver.--threads auto|N: hints for Rayon's thread pool.--out-partitions col1,col2: writes partitioned Parquet underpf-dc/while copying a canonical file toflows.parquet.
The command prints branch counts, min/max flow, and the pf-dc/.run.json manifest for gat runs resume.
Example:
# Run DC power flow on IEEE 14-bus system
gat pf dc test_data/matpower/ieee14.arrow --out flows.parquet
# Use specific solver and thread count
gat pf dc grid.arrow --solver faer --threads 4 --out flows.parquet
Performance tip: DC power flow typically completes in milliseconds, even for large systems (12k+ buses).
gat pf ac <grid.arrow> --out flows.parquet
Runs the AC Newton–Raphson driver with tolerance/iteration controls:
--tol 1e-6: exit when max mismatch drops below this tolerance.--max-iter 20: stop after this many Newton steps even if not converged.--solverand--threadsbehave as in the DC command.- The output lives under
pf-ac/plus the canonicalflows.parquet.
Q-Limit Enforcement
AC power flow supports PV-PQ bus switching for reactive power limits:
gat pf ac grid.arrow --out flows.parquet --enforce-q-limits
When a generator hits its Q limit (qmin or qmax), the bus switches from PV (voltage-controlled) to PQ (load bus) and the reactive output is clamped.
Shunt Element Support (v0.4.0)
AC power flow includes full shunt element modeling (fixed capacitors and reactors). This is essential for achieving exact agreement with external tools like MATPOWER, PowerModels.jl, and PSS/E:
gat pf ac grid.arrow --out flows.parquet --include-shunts
Shunts are modeled as constant-admittance injections:
- Gs: Shunt conductance (p.u.) — real power injection
- Bs: Shunt susceptance (p.u.) — reactive power injection (positive = capacitive)
Troubleshooting
AC Power Flow Does Not Converge
Symptoms: "Did not converge" after max iterations, large mismatch values
Common Causes & Solutions:
-
Insufficient generation capacity
# Check: Total generation > Total load -
Network islands (disconnected buses)
# Should report 1 island for valid network -
Unrealistic voltage setpoints
# Check generator voltage setpoints are within [0.9, 1.1] pu | \ -
Missing slack bus
# Verify exactly one slack (type=3) bus exists | \ -
Try DC first, then warm-start AC
Large Mismatches at Specific Buses
Symptoms: Convergence but some buses show large P/Q mismatch
Solutions:
-
Check Q limits are reasonable
| \ -
Enable Q-limit enforcement
-
Verify load data
# Check for negative loads or unrealistic values
Results Don't Match MATPOWER/PSS/E
Solutions:
-
Include shunt elements
-
Check per-unit base
# Verify base_mva matches external tool -
Verify transformer tap ratios
| \
Memory Issues on Large Systems
Symptoms: Out of memory on systems > 50k buses
Solutions:
# Use sparse solver (default for large systems)
# Reduce thread count to lower memory pressure