Quickstart: Your First Power Flow Analysis
This guide will get you from zero to running power flow analysis in 5 minutes. No prerequisites required.
1. Installation (1 minute)
Install GAT using the modular installer:
|
The installer will:
- Download the latest GAT binary for your OS (Linux or macOS)
- Extract it to
~/.gat/bin/ - Create a config directory at
~/.gat/config/
Add GAT to your PATH:
Or make it permanent by adding the line above to your ~/.bashrc or ~/.zshrc.
Verify installation:
You should see: gat-cli 0.5.7
Troubleshooting? See Installation Troubleshooting for common issues.
2. Understand the Basics (1 minute)
GAT analyzes power grids. Here are the key concepts:
What is Power Flow Analysis?
Power flow analysis calculates how electricity flows through a grid given demand and generation.
- DC Power Flow — Fast approximation, linearized equations
- AC Power Flow — Accurate simulation, full nonlinear equations
Input: Grid Data
You need a grid file describing:
- Buses (nodes) with demand and generation
- Lines (branches) connecting buses with flow limits
- Generators with costs and limits
- Transformer settings, reactive power constraints
Supported formats: MATPOWER (.m), Pandapower (.pkl), CSV
Output: Results
GAT outputs analysis results in Parquet format — a columnar format that works with:
- Python (Polars, Pandas, PyArrow)
- DuckDB for SQL analysis
- Any modern data tool
3. Get Sample Data (1 minute)
GAT includes example datasets. Clone the repository to access them:
The test_data/matpower/ directory contains:
ieee14.case— IEEE 14-bus test caseieee14.arrow— Pre-converted Arrow format (ready to use)
For this quickstart, we'll use the IEEE 14-bus system.
4. Run Your First Power Flow (1 minute)
Option A: Use Pre-converted Arrow File (Fastest)
If you have pre-converted Arrow files:
Option B: Import and Analyze (From MATPOWER)
To convert from MATPOWER format and run analysis:
# Step 1: Import MATPOWER case to Arrow format
)) for
# Step 2: Run DC power flow
What this does:
gat import matpower— Convert MATPOWER .m/.case file to Arrowgat pf dc— Run DC power flow on the converted grid--out flows_dc.parquet— Save results to Parquet
AC Power Flow (More Accurate)
AC power flow solves the full nonlinear equations:
This takes slightly longer (still under 100ms for small cases) but gives more accurate voltages and reactive power.
5. Examine Your Results (1 minute)
View Results in Python
Use Polars to examine results (install with pip install polars):
# Read the parquet file
=
# Show basic info
# Get bus voltages
# Get line flows
View Results in DuckDB
Or use DuckDB for SQL analysis:
Simple Text View
For a quick look without installing tools:
# Show file info
# Show first few rows (requires parquet-tools)
6. Next Steps
Now that you've run your first analysis, explore these topics:
📚 Learn More About Power Flow
- Power Flow Guide — Deep dive into DC vs AC power flow
- Solver Selection — When to use each solver
🎯 Try Other Analyses
- Optimal Power Flow (OPF) — Economic dispatch
- N-1 Contingency Analysis — What happens if a line fails?
- State Estimation — Infer grid state from measurements
💻 Build Automation Workflows
- Command-Line Interface — Automate analysis pipelines
- Time Series — Run multi-period analysis
- Manifests — Batch processing
📊 Visualize Results
- TUI Dashboard — Interactive terminal dashboard
🤖 Integrate with Other Tools
- MCP Server — AI agent integration
- Agent Integration — Use GAT with Claude, ChatGPT, etc.
Common Tasks
Run Analysis on Your Own Grid
If you have a MATPOWER file, import it first:
# Import to Arrow format
# Run power flow
Compare DC vs AC Results
# Run both analyses on your Arrow grid
# Compare in Python
)
)
# Show voltage differences
) ))
Speed Benchmarks
On a modern laptop, typical analysis times:
| Grid Size | DC Power Flow | AC Power Flow |
|---|---|---|
| 9 buses | ~10ms | ~50ms |
| 30 buses | ~15ms | ~80ms |
| 118 buses | ~30ms | ~150ms |
| 1000+ buses | ~100ms | ~500ms |
(Times vary by solver and hardware)
Troubleshooting
"gat: command not found"
You need to add GAT to your PATH. Run:
"File not found" errors
Clone the GAT repository to get example files:
# Use the pre-converted Arrow file
Power flow doesn't converge
- AC power flow: Try relaxing convergence tolerance with
--tolerance 1e-3 - DC power flow: Should always converge (it's linear)
- Check your grid has a slack bus (usually bus 1)
Results file not created
- Check write permissions in current directory
- Try using absolute path:
--out /tmp/results.parquet
What You Learned
✅ Installed GAT ✅ Ran DC and AC power flow ✅ Examined results in Parquet format ✅ Understood basic power systems concepts
You're ready to explore deeper! Pick a topic from Next Steps or check the full Documentation.
Get Help
- Questions? Start a discussion
- Issues? Report a bug
- Want to contribute? See Contributing Guide