tvspina's picture
Update README.md (#2)
3356a32
|
raw
history blame
19.7 kB
---
license: mit
task_categories:
- other
tags:
- power-systems
- optimal-power-flow
- energy
- power-grid-modeling
- openstreetmap
- us-eia
- us-census
pretty_name: "GridSFM US Power Grid Models"
size_categories:
- 100M<n<1G
---
# GridSFM US Power Grid Models
OPF-ready transmission network models for all 48 contiguous U.S. states and 6 multi-state regions, derived entirely from open data (OpenStreetMap + U.S. EIA + U.S. Census).
Each model is a self-contained JSON file compatible with [PowerModels.jl](https://github.com/lanl-ansi/PowerModels.jl) and MATPOWER-format tools. Models include bus-branch topology, line impedances, generator costs, hourly load allocation, DC warm-start voltage angles, and reactive compensation shunts.
**Tools & Viewer**: The Python loader ([`gridsfm_pg_loader.py`](https://github.com/microsoft/GridSFM/tree/main/power_grid)) and the interactive Data Viewer are available in the [GridSFM repository](https://github.com/microsoft/GridSFM/tree/main/power_grid).
## Citation
If you use this data, please cite:
```bibtex
@article{britto2026powergrid,
title = {Building Power Grid Models from Open Data: A Complete Pipeline from OpenStreetMap to Optimal Power Flow},
author = {Britto, Andrea and Spina, Thiago and Yang, Weiwei and Fowers, Spencer and Zhang, Baosen and White, Chris},
year = {2026},
note = {Microsoft Research}
}
```
## Coverage
**48 states** — all contiguous U.S. states (AL, AZ, AR, CA, CO, CT, DE, FL, GA, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY).
**6 multi-state regions:**
| Region | States | Buses (approx.) |
|--------|--------|-----------------|
| `new_england` | CT, MA, ME, NH, RI, VT | ~640 |
| `pacific_nw` | OR, WA | ~1,100 |
| `desert_sw` | AZ, NV, UT | ~1,300 |
| `western` | AZ, CA, CO, ID, MT, NM, NV, OR, UT, WA, WY | ~5,100 |
| `eastern` | AL, AR, CT, DE, FL, GA, IA, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, NC, ND, NE, NH, NJ, NY, OH, OK, PA, RI, SC, SD, TN, VA, VT, WI, WV | ~21,700 |
| `pjm` | DE, IL, IN, KY, MD, MI, NC, NJ, OH, PA, TN, VA, WV | ~7,800 |
**Two operating hours per model:**
- `16h` — peak demand (4:00 PM, July 15 2024)
- `04h` — off-peak demand (4:00 AM, July 15 2024)
## File Structure
```
16h/
alabama_model.json # Full model (topology + parameters + demand + shunts + DC warm-start)
alabama_dc_results.json # DC-OPF solution
alabama_ac_results.json # AC-OPF solution
...
western_model.json # Multi-state region model
western_dc_results.json
western_ac_results.json
04h/
... # Same structure, off-peak hour
```
## Model File (`*_model.json`)
The primary artifact. A single JSON containing everything needed to run optimal power flow.
### Top-Level Metadata
| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Model name (e.g., `"delaware"`) |
| `baseMVA` | float | System base power (always 100.0) |
| `per_unit` | bool | Always `true` — all values are in per-unit |
| `version` | string | Format version |
| `source_type` | string | `"matpower"` — format compatibility marker |
| `balancing_authority` | string | Primary BA serving this state (e.g., `"PJM"`) |
| `demand_source` | string | EIA data source and allocation fraction |
| `dispatch_method` | string | Generator dispatch method (`"merit_order"` or `"proportional"`) |
| `load_allocation_method` | string | How load was distributed to buses (`"census"` or `"per_ba_census"`) |
| `ba_coverage_pct` | float | Fraction of state capacity covered by detected BAs |
| `is_multi_state` | bool | Whether this is a multi-state region model |
| `target_datetime` | string | ISO 8601 timestamp for demand snapshot |
### `bus` — Transmission Buses
Keyed by string ID (non-sequential). One bus per voltage level per substation.
| Field | Type | Description |
|-------|------|-------------|
| `bus_i` | int | Bus number |
| `bus_type` | int | 1 = PQ, 2 = PV (generator), 3 = slack (reference) |
| `index` | int | Same as `bus_i` |
| `name` | string | Substation name from OSM |
| `area` | int | Network area |
| `zone` | int | Network zone |
| `base_kv` | float | Nominal voltage (kV) |
| `lat` | float | Latitude (WGS84) |
| `lon` | float | Longitude (WGS84) |
| `vm` | float | Voltage magnitude (p.u.) — initialized to 1.0 |
| `va` | float | Voltage angle (radians) — from DC-OPF warm-start |
| `vmax` | float | Upper voltage limit (p.u.) |
| `vmin` | float | Lower voltage limit (p.u.) |
| `pd` | float | Always 0.0 (loads are in the `load` section) |
| `qd` | float | Always 0.0 |
### `gen` — Generators
| Field | Type | Description |
|-------|------|-------------|
| `index` | int | Generator number |
| `gen_bus` | int | Bus this generator is connected to |
| `gen_status` | int | 1 = online, 0 = offline |
| `name` | string | Generator/plant name from OSM |
| `fuel_type` | string | Standardized fuel type (`"gas"`, `"nuclear"`, `"solar"`, `"wind"`, `"coal"`, `"hydro"`, etc.) |
| `pg` | float | Active power output (p.u.) — from DC warm-start dispatch |
| `pmax` | float | Maximum active power (p.u.) |
| `pmin` | float | Minimum active power (p.u.) |
| `qg` | float | Reactive power output (p.u.) |
| `qmax` | float | Maximum reactive power (p.u.) |
| `qmin` | float | Minimum reactive power (p.u.) |
| `vg` | float | Voltage setpoint (p.u.) |
| `mbase` | float | Machine base (MVA) |
| `model` | int | Cost model type (2 = polynomial) |
| `ncost` | int | Number of cost coefficients |
| `cost` | list | Cost polynomial `[c2, c1, c0]` where total_cost = c2·pg² + c1·pg + c0 (p.u.) |
| `apf` | float | Area participation factor |
| `startup` | float | Startup cost ($) |
| `shutdown` | float | Shutdown cost ($) |
| `ramp_10` | float | 10-minute ramp rate (p.u.) |
| `ramp_30` | float | 30-minute ramp rate (p.u.) |
| `ramp_agc` | float | AGC ramp rate (p.u.) |
| `ramp_q` | float | Reactive ramp rate (p.u.) |
| `startup_time` | float | Startup time (hours) |
| `min_up_time` | float | Minimum up time (hours) |
| `min_down_time` | float | Minimum down time (hours) |
**EIA-matched generators** also have:
| Field | Type | Description |
|-------|------|-------------|
| `fuel_type_eia` | string | Raw EIA fuel code (`"NG"`, `"SUN"`, `"NUC"`, etc.) |
| `prime_mover` | string | EIA prime mover code (`"CT"`, `"PV"`, `"ST"`, etc.) |
| `eia_plant_id` | string | EIA plant ID |
| `eia_generator_id` | string | EIA generator ID |
| `eia_match_score` | float | Match confidence (0–1) |
| `eia_match_distance_km` | float | Distance from OSM location to EIA plant (km) |
| `ref_us_eia` | string | EIA reference ID |
| `pmax_eia` | float | EIA nameplate capacity (p.u.) |
| `heat_rate_eia` | float | EIA heat rate (BTU/kWh) — thermal generators only |
| `capacity_factor` | float | Hourly capacity factor (solar/wind derating) |
| `pmax_nameplate` | float | Nameplate pmax before capacity factor derating (p.u.) |
| `qmax_nameplate` | float | Nameplate qmax before any adjustments (p.u.) |
| `qmin_nameplate` | float | Nameplate qmin before any adjustments (p.u.) |
**Injected generators** (from distant EIA plants with no OSM match) also have:
| Field | Type | Description |
|-------|------|-------------|
| `eia_injected` | bool | Always `true` — generator was injected, not matched to OSM |
### `branch` — Transmission Lines and Transformers
| Field | Type | Description |
|-------|------|-------------|
| `index` | int | Branch number |
| `f_bus` | int | From bus |
| `t_bus` | int | To bus |
| `br_r` | float | Series resistance (p.u.) |
| `br_x` | float | Series reactance (p.u.) |
| `b_fr` | float | From-side shunt susceptance (p.u.) |
| `b_to` | float | To-side shunt susceptance (p.u.) |
| `g_fr` | float | From-side shunt conductance (p.u.) |
| `g_to` | float | To-side shunt conductance (p.u.) |
| `br_status` | int | 1 = in service |
| `rate_a` | float | Long-term thermal rating (p.u.) |
| `rate_b` | float | Short-term rating (p.u.) |
| `rate_c` | float | Emergency rating (p.u.) |
| `angmin` | float | Minimum angle difference (radians) |
| `angmax` | float | Maximum angle difference (radians) |
| `tap` | float | Tap ratio (1.0 for lines; off-nominal for transformers) |
| `tap_min` | float | Minimum tap ratio |
| `tap_max` | float | Maximum tap ratio |
| `shift` | float | Phase shift angle (radians) |
| `transformer` | bool | `true` if this is a transformer |
| `circuit_key` | string | Internal circuit identifier |
| `length_km` | float | Line length in km (0.0 for transformers) |
**Transformer branches** also have:
| Field | Type | Description |
|-------|------|-------------|
| `transformer_hv_kv` | float | High-voltage side (kV) |
| `transformer_lv_kv` | float | Low-voltage side (kV) |
### `load` — Bus Loads
| Field | Type | Description |
|-------|------|-------------|
| `index` | int | Load number |
| `load_bus` | int | Bus this load is attached to |
| `pd` | float | Active power demand (p.u.) |
| `qd` | float | Reactive power demand (p.u.) |
| `status` | int | 1 = active |
### `shunt` — Reactive Compensation
Derived from DC-OPF solution to provide reactive power support for AC-OPF convergence. These are synthetic shunts — not from OSM or EIA.
| Field | Type | Description |
|-------|------|-------------|
| `index` | int | Shunt number |
| `shunt_bus` | int | Bus this shunt is attached to |
| `gs` | float | Shunt conductance (p.u.) — always 0.0 |
| `bs` | float | Shunt susceptance (p.u.) — positive = capacitor, negative = reactor |
| `status` | int | 1 = active |
### `dcline` — HVDC Lines
| Field | Type | Description |
|-------|------|-------------|
| `index` | int | DC line number |
| `f_bus` | int | From bus |
| `t_bus` | int | To bus |
| `br_status` | int | 1 = in service |
| `pf` / `pt` | float | Active power at from/to end (p.u.) |
| `qf` / `qt` | float | Reactive power at from/to end (p.u.) |
| `vf` / `vt` | float | Voltage at from/to end (p.u.) |
| `pmaxf` / `pmaxt` | float | Max active power at from/to (p.u.) |
| `pminf` / `pmint` | float | Min active power at from/to (p.u.) |
| `qmaxf` / `qmaxt` | float | Max reactive power at from/to (p.u.) |
| `qminf` / `qmint` | float | Min reactive power at from/to (p.u.) |
| `loss0` | float | Constant loss coefficient |
| `loss1` | float | Linear loss coefficient |
| `circuit_key` | string | Internal circuit identifier |
| `length_km` | float | Line length (km) |
| `model` / `ncost` / `cost` | | Cost model (same format as generators) |
### `_warm_start` — DC Warm-Start Metadata
Present only in the warm-start model files (`*_model.json` after AC-OPF applies shunts), not in the base model.
| Field | Type | Description |
|-------|------|-------------|
| `warm_start_applied` | bool | Whether DC solution was injected |
| `dc_objective` | float | DC-OPF optimal cost ($/h) |
| `dc_solved_level` | int | Relaxation level at which DC converged (0 = strict) |
| `vm_init` | float | Initial voltage magnitude used (always 1.0) |
| `n_dc_shunts` | int | Number of shunts derived from DC solution |
| `total_shunts` | int | Total shunts in model |
## Results Files
### DC Results (`*_dc_results.json`)
Linear DC-OPF solution. Does not solve for reactive power or voltage magnitudes.
| Field | Type | Description |
|-------|------|-------------|
| `formulation` | string | `"dc"` |
| `termination_status` | string | `"LOCALLY_SOLVED"` or `"LOCALLY_INFEASIBLE"` |
| `objective` | float | Total generation cost ($/h) |
| `solve_time` | float | Solver time (seconds) |
| `relaxation_level` | int | 0 = strict, 1–5 = progressively relaxed |
| `relaxation_label` | string | Short label (e.g., `"L0"`, `"AC1"`) |
| `relaxation_name` | string | Human-readable relaxation level (e.g., `"Strict"`) |
| `total_gen_mw` | float | Total generation (MW) |
| `total_load_mw` | float | Total load (MW) |
| `n_buses` / `n_branches` / `n_gens` / `n_loads` | int | Element counts |
| `n_shunts` | int | Number of shunts in model |
| `n_decommitted` | int | Generators decommitted by unit commitment |
| `solution` | dict | Per-element solutions (see below) |
**`solution.bus`**: `va` (voltage angle, rad), `vm` (always 1.0 for DC)
**`solution.gen`**: `pg` (active power, p.u.), `pg_cost` (generation cost, $/h)
**`solution.branch`**: `pf` (from-end active flow, p.u.), `pt` (to-end active flow, p.u.)
**`solution.dcline`**: `pf`, `pt`, `p_dc_cost`
### AC Results (`*_ac_results.json`)
Full nonlinear AC-OPF solution. Same top-level fields as DC results, plus:
| Field | Type | Description |
|-------|------|-------------|
| `n_interfaces` | int | Number of inter-BA interface constraints |
**`solution.bus`**: `va`, `vm` (solved voltage magnitude)
**`solution.gen`**: `pg`, `qg` (reactive power, p.u.), `pg_cost`
**`solution.branch`**: `pf`, `pt`, `qf`, `qt`
**`solution.dcline`**: `pf`, `pt`, `qf`, `qt`, `p_dc_cost`
## Interface Constraints
Models spanning multiple Balancing Authorities include an `interface` section with inter-BA transfer limits. Only present in multi-BA states/regions (31 of 54 datasets).
### `interface` — Inter-BA Transfer Limits
Keyed by string ID. Each entry describes one directional interface between two BAs.
| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Interface name (e.g., `"PNM_to_SWPP"`) |
| `from_ba` | string | Source BA code |
| `to_ba` | string | Destination BA code |
| `branch_ids` | list | Branch IDs forming this interface |
| `n_lines` | int | Number of EHV lines in interface |
| `n_all_lines` | int | Total cross-BA lines (including lower voltage) |
| `limit` | float | Transfer limit (p.u.) |
| `limit_factor` | float | Fraction of total capacity used as limit |
| `limit_method` | string | `"known"` (NERC/WECC paths) or `"heuristic"` |
| `total_rate_a` | float | Sum of branch ratings (p.u.) |
## Quick Start
### Download from HuggingFace
```bash
pip install huggingface_hub
```
**Load a single model (no extra dependencies):**
```python
from huggingface_hub import hf_hub_download
import json
path = hf_hub_download(
repo_id="microsoft/GridSFM_US_power_grid",
filename="16h/texas_model.json",
repo_type="dataset",
)
with open(path) as f:
model = json.load(f)
print(f"Buses: {len(model['bus'])}")
print(f"Branches: {len(model['branch'])}")
print(f"Generators: {len(model['gen'])}")
print(f"Loads: {len(model['load'])}")
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
```
**Using the GridSFM loader** (from [github.com/microsoft/GridSFM/power_grid](https://github.com/microsoft/GridSFM/tree/main/power_grid)):
```python
from gridsfm_pg_loader import GridSFM_PG_Loader
# With export_dir (optional): the entire dataset is automatically downloaded
# to this directory on init. Without it, files are stored in HuggingFace's cache.
loader = GridSFM_PG_Loader(
"microsoft/GridSFM_US_power_grid",
export_dir="./gridsfm_data", # optional; pre-fetches everything here
)
# To skip the automatic download, use pre_fetch_all=False (lazy download on access)
# loader = GridSFM_PG_Loader(
# "microsoft/GridSFM_US_power_grid",
# export_dir="./gridsfm_data",
# pre_fetch_all=False,
# )
# Case-insensitive; state abbreviations work too
model = loader.load_model("TX", hour="16h")
ac = loader.load_ac_results("texas", hour="16h")
dc = loader.load_dc_results("Texas", hour="16h")
# Export a single file to a specific path
loader.export_file("TX", "model", hour="16h", dest="./my_models/texas.json")
# Save a loaded (or modified) model dict back to JSON
loader.save_json(model, "./my_models/texas_modified.json")
# Discover what's available (fetched from dataset_metadata.json)
loader.list_regions() # all 54 regions + states
loader.list_abbreviations() # {"AL": "alabama", "TX": "texas", ...}
loader.list_hours() # ["04h", "16h"]
loader.list_file_types() # ["model", "ac_results", "dc_results"]
# Export the entire dataset to a local directory at any time
loader.export_all("./gridsfm_data")
```
**Download the entire dataset (~230 MB):**
```bash
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --local-dir ./gridsfm_data
```
**Download a subset (one hour only):**
```bash
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --include "16h/*" --local-dir ./gridsfm_data
```
### Load a model from local files
```python
import json
with open("16h/texas_model.json") as f:
model = json.load(f)
print(f"Buses: {len(model['bus'])}")
print(f"Branches: {len(model['branch'])}")
print(f"Generators: {len(model['gen'])}")
print(f"Loads: {len(model['load'])}")
print(f"Shunts: {len(model['shunt'])}")
print(f"HVDC lines: {len(model['dcline'])}")
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
```
### Run OPF with PowerModels.jl
```julia
using PowerModels, Ipopt
data = PowerModels.parse_file("16h/texas_model.json")
result = solve_ac_opf(data, Ipopt.Optimizer)
println("Objective: \$(result[\"objective\"])")
println("Status: \$(result[\"termination_status\"])")
```
## Data Sources
- **Topology**: [OpenStreetMap](https://www.openstreetmap.org/) power infrastructure (lines, substations, generators)
- **Generator data**: [U.S. EIA-860](https://www.eia.gov/electricity/data/eia860/) (capacity, fuel type, location), [U.S. EIA-923](https://www.eia.gov/electricity/data/eia923/) (heat rates)
- **Demand**: [U.S. EIA-930](https://www.eia.gov/electricity/gridmonitor/) (hourly BA-level demand)
- **Gas prices**: [Henry Hub spot price](https://www.eia.gov/dnav/ng/ng_pri_fut_s1_d.htm) via EIA API
- **Load allocation**: [U.S. Census](https://www.census.gov/) tract-level population as spatial proxy
- **BA boundaries**: [HIFLD Electric Planning Areas](https://services5.arcgis.com/HDRa0B57OVrv2E1q/arcgis/rest/services/Electric_Planning_Areas/FeatureServer/0) (ArcGIS FeatureServer)
## Per-Unit Convention
All power quantities use system base `baseMVA = 100 MVA`:
- Powers (pg, pd, pmax, rate_a, etc.): multiply by 100 to get MW or MVA
- Impedances (br_r, br_x): in per-unit on system base
- Voltages (vm, vmax, vmin): in per-unit on bus `base_kv`
- Angles (va, angmin, angmax): in radians
- Cost coefficients: scaled for per-unit pg (i.e., `cost[1]` is $/h per unit of pg in p.u.)
## Relaxation Levels
Models that don't converge at strict limits are progressively relaxed. For DC-OPF the solver tries L0 → L1 → … → L5. For AC-OPF the solver tries L0 → AC1 → L1 → … → L5; if AC1 alone doesn't solve it, its V/Q relaxation is kept as a base layer for L1–L5.
The OPF solver with relaxation support is available in the [GridSFM repository](https://github.com/microsoft/GridSFM/tree/main/power_grid). These models can be used directly as input.
| Level | Label | Description |
|-------|-------|-------------|
| 0 | L0 — Strict | Model as-is from pipeline |
| 1 | L1 — Widen angles | Branch angles widened to ±60° |
| 2 | L2 — Thermal headroom | Branch ratings ×1.2, angles ±60° |
| 3 | L3 — Aggressive | Branch ratings ×1.5, angles ±90°, pmin ×0.5 |
| 4 | L4 — Load shedding | Cap load at 70%, ratings ×1.5, angles ±90°, pmin = 0 |
| 5 | L5 — Full relaxation | Remove thermal limits, angles ±90°, V [0.85, 1.15], Q ×2.0, load cap 70%, pmin = 0 |
| AC1 | AC1 — Voltage + Q | Voltage [0.90, 1.10], Q limits ×1.5 (AC-OPF only) |
The `relaxation_level` and `relaxation_label` fields in results files indicate which level was needed.
## License
This data is released under the [MIT License](LICENSE).