Home / Paper

GAT: A High-Performance Rust Toolkit for Power System Analysis

Author: Tom Wilson | Pages: 24 | Updated: November 2024

Abstract

We present the Grid Analysis Toolkit (GAT), an open-source command-line toolkit for power system analysis implemented in Rust. This comprehensive technical reference documents GAT's complete solver hierarchy for optimal power flow (OPF)—from sub-millisecond economic dispatch through DC-OPF, SOCP relaxation, and full nonlinear AC-OPF with IPOPT—alongside state estimation, N-k contingency analysis, and time-series dispatch. We detail the framework's design decisions rooted in Rust's type system and memory safety guarantees, the challenges of parsing heterogeneous power system datasets (MATPOWER, PSS/E, CIM, pandapower), and the mathematical foundations underlying each analysis module.

Key Mathematical Formulations

AC Power Flow Equations

Complex power balance at each bus:

$$P_i = \sum_j |V_i||V_j|(G_{ij}\cos\theta_{ij} + B_{ij}\sin\theta_{ij})$$ $$Q_i = \sum_j |V_i||V_j|(G_{ij}\sin\theta_{ij} - B_{ij}\cos\theta_{ij})$$

DC Optimal Power Flow

Linearized OPF formulation:

$$\min_{\mathbf{P}_g, \boldsymbol{\theta}} \sum_g c_{1,g} P_g$$ $$\text{s.t. } P_f = B_{ij}(\theta_i - \theta_j)$$

SOCP Relaxation

Second-order cone constraint:

$$\left\| \begin{matrix} 2P_{ij} \\ 2Q_{ij} \\ \ell_{ij} - v_i \end{matrix} \right\|_2 \leq \ell_{ij} + v_i$$

Newton-Raphson Jacobian

Analytical derivatives for IPOPT:

$$\frac{\partial P_i}{\partial \theta_j} = |V_i||V_j|(G_{ij}\sin\theta_{ij} - B_{ij}\cos\theta_{ij})$$

Contents

Part I: Framework Architecture

  1. 1. Introduction
  2. 2. Why Rust for Power Systems
  3. 3. Crate Architecture
  4. 4. Type-Driven Design
  5. 5. Dataset Challenges

Part II: Mathematical Foundations

  1. 6. Newton-Raphson Power Flow
  2. 7. OPF Solver Hierarchy
  3. 8. Economic Dispatch
  4. 9. DC-OPF & SOCP
  5. 10. AC-OPF with IPOPT
  6. 11. Contingency Analysis
  7. 12. State Estimation

Part III: Benchmarks

  1. 13. PGLib-OPF Validation
  2. 14. Performance Profiling
  3. 15. Conclusions
  4. + Appendices

Key Results

Test Case GAT Objective PGLib Reference Gap
case14_ieee $2,178.08/hr $2,178.10/hr -0.00%
case118_ieee $97,213.61/hr $97,214.00/hr -0.00%

GAT achieves <0.01% objective gap on standard IEEE test cases compared to PGLib-OPF reference solutions.