State Estimation
State estimation determines the most likely operating state of a power network from noisy, redundant measurements. GAT provides weighted least squares (WLS) estimation with bad data detection and observability analysis.
Overview
| Command | Purpose |
|---|---|
gat se wls | Run WLS state estimation |
gat se validate | Check measurement observability |
gat se generate | Generate synthetic measurements from power flow |
Quick Start
1. Generate Synthetic Measurements
Create test measurements from a solved power flow:
# First run power flow to get "true" state
# Generate measurements with noise
2. Run State Estimation
3. Compare Estimated vs True State
# View estimation quality
# Compare in Python
Measurement File Format
Schema
The measurement CSV must contain these columns:
| Column | Type | Description |
|---|---|---|
measurement_type | string | voltage, flow, or injection |
bus_id | int | Bus ID for voltage/injection (null for flows) |
branch_id | int | Branch ID for flow measurements (null for others) |
value | float | Measured value (MW, MVAr, or pu voltage) |
weight | float | Measurement weight (typically 1/σ²) |
label | string | Optional identifier for reporting |
Example Measurements File
Measurement Types
Voltage Magnitude (voltage)
- Measures |V| at a bus in per-unit
- High accuracy (σ ≈ 0.004-0.01 pu)
- Weight typically 10,000 - 60,000
Power Injection (injection)
- Net P or Q at a bus in MW/MVAr
- Moderate accuracy (σ ≈ 0.01-0.02 pu)
- Weight typically 2,500 - 10,000
Branch Flow (flow)
- P or Q flow on a branch in MW/MVAr
- Moderate accuracy (σ ≈ 0.01-0.02 pu)
- Branch ID format:
from-to(e.g.,1-2)
WLS State Estimation
Basic Usage
Full Options
Options:
--measurements— Input measurement file (CSV or Parquet)--out— Output residuals file--state-out— Optional: estimated state (bus voltages/angles)--max-iterations— Maximum Gauss-Newton iterations (default: 20)--tolerance— Convergence tolerance (default: 1e-6)--format— Output format:parquet(default) orjson
Output: Residuals File
| Column | Description |
|---|---|
measurement_id | Original measurement label |
value | Original measured value |
estimate | Estimated value from state |
residual | value - estimate |
normalized_residual | residual / σ |
weight | Measurement weight |
Output: State File
| Column | Description |
|---|---|
bus_id | Bus identifier |
vm | Estimated voltage magnitude (pu) |
va | Estimated voltage angle (rad) |
Interpreting Results
# Check convergence and fit quality
|
# Output example:
# {
# "converged": true,
# "iterations": 4,
# "objective_j": 23.45,
# "degrees_of_freedom": 25,
# "chi_squared_threshold": 37.65,
# "bad_data_detected": false
# }
Key metrics:
- objective_j: Sum of weighted squared residuals (should be < chi_squared_threshold)
- degrees_of_freedom: m - n (measurements minus state variables)
- chi_squared_threshold: At 99% confidence level
Bad Data Detection
GAT automatically performs chi-squared and largest normalized residual (LNR) tests.
Automatic Detection
Analyzing Bad Data
# Find measurements with large normalized residuals
# Filter bad measurements
Iterative Bad Data Removal
# Remove bad data and re-estimate
Options:
--remove-bad-data— Enable iterative removal--max-removals— Maximum measurements to remove (default: 5)--removed-out— File listing removed measurements
Observability Analysis
Check if the measurement set can determine all state variables:
Output:
Observability Analysis
──────────────────────
Total buses: 14
State variables: 27 (2N-1)
Measurements: 45
Redundancy ratio: 1.67
Status: OBSERVABLE
Measurement coverage:
Voltage: 10 buses (71%)
Injection: 12 buses (86%)
Flow: 23 branches (100%)
Handling Unobservable Systems
If the system is unobservable:
# Identify unobservable buses
# Output shows:
# WARNING: System is UNOBSERVABLE
# Observable islands: 2
# Island 1: buses [1, 2, 3, 4, 5]
# Island 2: buses [6, 7, 8, 9]
# Unobservable buses: [10, 11, 12, 13, 14]
#
# Suggested pseudo-measurements:
# - Add injection at bus 10
# - Add flow on branch 9-10
Adding Pseudo-Measurements
For unobservable regions, add pseudo-measurements with large variance:
Low weight (100 vs 10000) ensures pseudo-measurements don't override real data.
DC State Estimation
For faster estimation using DC power flow model (angles only, flat voltage assumed):
DC mode:
- Only uses real power measurements (P flows and injections)
- Estimates voltage angles only (magnitudes assumed 1.0 pu)
- Much faster for large systems
- Good approximation for transmission networks
Workflows
Real-Time State Estimation Pipeline
#!/bin/bash
# se_pipeline.sh - Production SE workflow
GRID="network.arrow"
MEASUREMENTS="scada_.csv"
RESULTS_DIR="./se_results"
# 1. Validate measurements
|| {
}
# 2. Run state estimation with bad data detection
# 3. Check results
if ; then
else
fi
# 4. Alert on bad data
if [; then
fi
Comparing SE Methods
# Compare DC vs AC state estimation
# Analyze differences
Measurement Quality Analysis
# Generate report on measurement quality
Troubleshooting
SE Does Not Converge
Symptoms: Max iterations reached, large objective function
Solutions:
- Check measurement redundancy (should be > 1.5)
- Look for gross measurement errors
# Check for |normalized_residual| > 10 - Verify network topology matches measurements
- Try DC estimation first (more robust)
Large Objective Function Value
Symptoms: J >> chi-squared threshold, but converged
Interpretation: Bad data present
Solutions:
- Enable bad data removal
- Check for systematic errors (calibration issues)
- Review measurement weights (may be too tight)
Unobservable System
Symptoms: gat se validate reports unobservable
Solutions:
- Add measurements at critical buses
- Add pseudo-measurements with low weight
- Check for isolated islands (topology errors)
- Verify branch status assumptions
Memory Issues on Large Systems
For systems > 10,000 buses:
# Use iterative solver
Integration Examples
Python Integration
"""Run GAT state estimation and return results."""
=
=
=
=
return
# Usage
=
Rust Integration
use ;
// Load network and measurements
let network = load_network?;
let measurements = load_measurements?;
// Configure estimator
let config = default
.with_max_iterations
.with_tolerance
.with_bad_data_detection;
// Run estimation
let estimator = new;
let result = estimator.estimate?;
println!;
println!;
println!;
// Access estimated state
for bus_state in &result.state
PMU-Based State Estimation
For high-resolution synchrophasor measurements from PMUs (Phasor Measurement Units), GAT provides specialized support for time-series state estimation.
PMU Data Format
GAT supports PMU data in CSV and JSON formats following IEEE C37.118 conventions:
Loading PMU Data
use ;
// Load PMU time-series
let series = load_pmu_csv?;
// Convert to measurement snapshots for SE
let snapshots = pmu_series_to_measurement_snapshots;
SoCal 28-Bus Test Network
The SoCal 28-Bus dataset provides a real-world distribution grid digital twin with dense PMU deployment. It's ideal for testing PMU-based state estimation.
use ;
// Build the network
let config = default;
let network = build_socal28_network;
// Get PMU station-to-bus mapping
let station_map = config.station_to_bus_map;
// Generate synthetic PMU data for testing
let pmu_series = generate_synthetic_pmu_data;
println!;
Network characteristics:
- 28 buses (MV/LV distribution)
- 9 PMU sensors at key locations
- 4 generators (utility + solar + fuel cell + NG)
- 15 diverse loads (data center, EV charging, commercial)
Reference: Xie et al., "A Digital Twin of an Electrical Distribution Grid: SoCal 28-Bus Dataset" (arXiv:2504.06588)
Time-Series State Estimation
For processing PMU time-series:
use ;
// Configure time-series SE
let config = TimeSeriesSeConfig ;
// Group PMU frames by timestamp
let measurements = prepare_pmu_measurements;
// Process each timestamp
for in measurements
Related Commands
- Power Flow — Generate "true" state for testing
- Network Inspection — Validate network data
- Time Series — Process measurement time series
Theory Reference
For mathematical foundations (WLS formulation, Jacobian structure, chi-squared tests):
- State Estimation Theory — Detailed mathematics
- Power Flow Theory — Related equations