Update README.md
#8
by tvspina - opened
README.md
CHANGED
|
@@ -10,32 +10,159 @@ tags:
|
|
| 10 |
- openstreetmap
|
| 11 |
- us-eia
|
| 12 |
- us-census
|
| 13 |
-
pretty_name: "GridSFM US Power Grid
|
| 14 |
size_categories:
|
| 15 |
- 100M<n<1G
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# GridSFM US Power Grid Models
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
```bibtex
|
| 31 |
@article{britto2026powergrid,
|
| 32 |
title = {Building Power Grid Models from Open Data: A Complete Pipeline from OpenStreetMap to Optimal Power Flow},
|
| 33 |
author = {Britto, Andrea and Spina, Thiago and Yang, Weiwei and Fowers, Spencer and Zhang, Baosen and White, Chris},
|
| 34 |
year = {2026},
|
|
|
|
| 35 |
note = {Microsoft Research}
|
| 36 |
}
|
| 37 |
```
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
## Coverage
|
| 40 |
|
| 41 |
**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).
|
|
@@ -70,6 +197,115 @@ If you use this data, please cite:
|
|
| 70 |
... # Same structure, off-peak hour
|
| 71 |
```
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
## Model File (`*_model.json`)
|
| 74 |
|
| 75 |
The primary artifact. A single JSON containing everything needed to run optimal power flow.
|
|
@@ -327,114 +563,6 @@ Keyed by string ID. Each entry describes one directional interface between two B
|
|
| 327 |
| `limit_method` | string | `"known"` (NERC/WECC paths) or `"heuristic"` |
|
| 328 |
| `total_rate_a` | float | Sum of branch ratings (p.u.) |
|
| 329 |
|
| 330 |
-
## Quick Start
|
| 331 |
-
|
| 332 |
-
### Download from HuggingFace
|
| 333 |
-
|
| 334 |
-
```bash
|
| 335 |
-
pip install huggingface_hub
|
| 336 |
-
```
|
| 337 |
-
|
| 338 |
-
**Load a single model (no extra dependencies):**
|
| 339 |
-
|
| 340 |
-
```python
|
| 341 |
-
from huggingface_hub import hf_hub_download
|
| 342 |
-
import json
|
| 343 |
-
|
| 344 |
-
path = hf_hub_download(
|
| 345 |
-
repo_id="microsoft/GridSFM_US_power_grid",
|
| 346 |
-
filename="16h/texas_model.json",
|
| 347 |
-
repo_type="dataset",
|
| 348 |
-
)
|
| 349 |
-
with open(path) as f:
|
| 350 |
-
model = json.load(f)
|
| 351 |
-
|
| 352 |
-
print(f"Buses: {len(model['bus'])}")
|
| 353 |
-
print(f"Branches: {len(model['branch'])}")
|
| 354 |
-
print(f"Generators: {len(model['gen'])}")
|
| 355 |
-
print(f"Loads: {len(model['load'])}")
|
| 356 |
-
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
|
| 357 |
-
```
|
| 358 |
-
|
| 359 |
-
**Using the GridSFM loader** (from [github.com/microsoft/GridSFM/power_grid](https://github.com/microsoft/GridSFM/tree/main/power_grid)):
|
| 360 |
-
|
| 361 |
-
```python
|
| 362 |
-
from gridsfm_pg_loader import GridSFM_PG_Loader
|
| 363 |
-
|
| 364 |
-
# With export_dir (optional): the entire dataset is automatically downloaded
|
| 365 |
-
# to this directory on init. Without it, files are stored in HuggingFace's cache.
|
| 366 |
-
loader = GridSFM_PG_Loader(
|
| 367 |
-
"microsoft/GridSFM_US_power_grid",
|
| 368 |
-
export_dir="./gridsfm_data", # optional; pre-fetches everything here
|
| 369 |
-
)
|
| 370 |
-
|
| 371 |
-
# To skip the automatic download, use pre_fetch_all=False (lazy download on access)
|
| 372 |
-
# loader = GridSFM_PG_Loader(
|
| 373 |
-
# "microsoft/GridSFM_US_power_grid",
|
| 374 |
-
# export_dir="./gridsfm_data",
|
| 375 |
-
# pre_fetch_all=False,
|
| 376 |
-
# )
|
| 377 |
-
|
| 378 |
-
# Case-insensitive; state abbreviations work too
|
| 379 |
-
model = loader.load_model("TX", hour="16h")
|
| 380 |
-
ac = loader.load_ac_results("texas", hour="16h")
|
| 381 |
-
dc = loader.load_dc_results("Texas", hour="16h")
|
| 382 |
-
|
| 383 |
-
# Export a single file to a specific path
|
| 384 |
-
loader.export_file("TX", "model", hour="16h", dest="./my_models/texas.json")
|
| 385 |
-
|
| 386 |
-
# Save a loaded (or modified) model dict back to JSON
|
| 387 |
-
loader.save_json(model, "./my_models/texas_modified.json")
|
| 388 |
-
|
| 389 |
-
# Discover what's available (fetched from dataset_metadata.json)
|
| 390 |
-
loader.list_regions() # all 54 regions + states
|
| 391 |
-
loader.list_abbreviations() # {"AL": "alabama", "TX": "texas", ...}
|
| 392 |
-
loader.list_hours() # ["04h", "16h"]
|
| 393 |
-
loader.list_file_types() # ["model", "ac_results", "dc_results"]
|
| 394 |
-
|
| 395 |
-
# Export the entire dataset to a local directory at any time
|
| 396 |
-
loader.export_all("./gridsfm_data")
|
| 397 |
-
```
|
| 398 |
-
|
| 399 |
-
**Download the entire dataset (~230 MB):**
|
| 400 |
-
|
| 401 |
-
```bash
|
| 402 |
-
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --local-dir ./gridsfm_data
|
| 403 |
-
```
|
| 404 |
-
|
| 405 |
-
**Download a subset (one hour only):**
|
| 406 |
-
|
| 407 |
-
```bash
|
| 408 |
-
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --include "16h/*" --local-dir ./gridsfm_data
|
| 409 |
-
```
|
| 410 |
-
|
| 411 |
-
### Load a model from local files
|
| 412 |
-
|
| 413 |
-
```python
|
| 414 |
-
import json
|
| 415 |
-
|
| 416 |
-
with open("16h/texas_model.json") as f:
|
| 417 |
-
model = json.load(f)
|
| 418 |
-
|
| 419 |
-
print(f"Buses: {len(model['bus'])}")
|
| 420 |
-
print(f"Branches: {len(model['branch'])}")
|
| 421 |
-
print(f"Generators: {len(model['gen'])}")
|
| 422 |
-
print(f"Loads: {len(model['load'])}")
|
| 423 |
-
print(f"Shunts: {len(model['shunt'])}")
|
| 424 |
-
print(f"HVDC lines: {len(model['dcline'])}")
|
| 425 |
-
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
|
| 426 |
-
```
|
| 427 |
-
|
| 428 |
-
### Run OPF with PowerModels.jl
|
| 429 |
-
|
| 430 |
-
```julia
|
| 431 |
-
using PowerModels, Ipopt
|
| 432 |
-
|
| 433 |
-
data = PowerModels.parse_file("16h/texas_model.json")
|
| 434 |
-
result = solve_ac_opf(data, Ipopt.Optimizer)
|
| 435 |
-
println("Objective: \$(result[\"objective\"])")
|
| 436 |
-
println("Status: \$(result[\"termination_status\"])")
|
| 437 |
-
```
|
| 438 |
|
| 439 |
## Data Sources
|
| 440 |
|
|
@@ -470,8 +598,4 @@ The OPF solver with relaxation support is available in the [GridSFM repository](
|
|
| 470 |
| 5 | L5 — Full relaxation | Remove thermal limits, angles ±90°, V [0.85, 1.15], Q ×2.0, load cap 70%, pmin = 0 |
|
| 471 |
| AC1 | AC1 — Voltage + Q | Voltage [0.90, 1.10], Q limits ×1.5 (AC-OPF only) |
|
| 472 |
|
| 473 |
-
The `relaxation_level` and `relaxation_label` fields in results files indicate which level was needed.
|
| 474 |
-
|
| 475 |
-
## License
|
| 476 |
-
|
| 477 |
-
This data is released under the [MIT License](LICENSE).
|
|
|
|
| 10 |
- openstreetmap
|
| 11 |
- us-eia
|
| 12 |
- us-census
|
| 13 |
+
pretty_name: "GridSFM US Power Grid Dataset"
|
| 14 |
size_categories:
|
| 15 |
- 100M<n<1G
|
| 16 |
---
|
| 17 |
|
|
|
|
| 18 |
|
| 19 |
+
# GridSFM US Power Grid Dataset
|
| 20 |
|
| 21 |
+
## Overview
|
| 22 |
|
| 23 |
+
GridSFM US Power Grid Dataset is a set of geographically grounded, electrically coherent power-system network derived entirely from publicly available data. It was developed to support AC optimal power flow (AC-OPF) analysis, enabling physics-based study of congestion, capacity, and demand sitting without restricted data.
|
| 24 |
+
|
| 25 |
+
A detailed discussion of GridSFM US Power Grid Dataset, including how it was developed and evaluated, can be found in our paper at: https://arxiv.org/abs/2605.04289.
|
| 26 |
+
|
| 27 |
+
### Intended uses
|
| 28 |
+
|
| 29 |
+
The GridSFM US Power Grid Dataset is intended to support a broad range of physics-based research questions on the U.S. transmission network, covering 48 states and multi-state interconnections with realistic geographic structure, including transmission expansion potential, targeted line upgrades, and placement of large loads.
|
| 30 |
+
|
| 31 |
+
### Out-of-scope uses
|
| 32 |
+
|
| 33 |
+
GridSFM US Power Grid Dataset is not well suited for detailed operational or market-critical decision making, including real-time dispatch, contingency analysis, or regulatory planning that requires exact system parameters.
|
| 34 |
+
|
| 35 |
+
There are few or no instances of measured electrical parameters, complete multi-circuit topology, detailed protection models, or operational control parameters in this dataset. As a result, GridSFM US Power Grid Dataset should not be used for safety-critical, financial, or regulatory decisions that depend on precise modeling of the real transmission grid.
|
| 36 |
+
|
| 37 |
+
We do not recommend using GridSFM US Power Grid Dataset in commercial or real-world applications without further testing and development. It is being released for research purposes.
|
| 38 |
|
| 39 |
+
We do not recommend using GridSFM US Power Grid Dataset in the context of high-risk decision making (e.g. in law enforcement, legal, finance, or healthcare).
|
| 40 |
|
| 41 |
+
### Citation
|
| 42 |
+
|
| 43 |
+
If you use this dataset, please cite:
|
| 44 |
|
| 45 |
```bibtex
|
| 46 |
@article{britto2026powergrid,
|
| 47 |
title = {Building Power Grid Models from Open Data: A Complete Pipeline from OpenStreetMap to Optimal Power Flow},
|
| 48 |
author = {Britto, Andrea and Spina, Thiago and Yang, Weiwei and Fowers, Spencer and Zhang, Baosen and White, Chris},
|
| 49 |
year = {2026},
|
| 50 |
+
url = {https://arxiv.org/abs/2605.04289}
|
| 51 |
note = {Microsoft Research}
|
| 52 |
}
|
| 53 |
```
|
| 54 |
|
| 55 |
+
## Dataset Details
|
| 56 |
+
|
| 57 |
+
### Dataset Contents
|
| 58 |
+
|
| 59 |
+
GridSFM US Power Grid Dataset consists of 54 instances of OPF-ready transmission network models (48 contiguous U.S. states and 6 multi-state regions), derived entirely from open data.
|
| 60 |
+
|
| 61 |
+
Each instance includes bus-branch topology, estimated electrical parameters (line impedances, transformer characteristics), generator attributes (capacity, fuel type, cost functions), hourly demand allocation, DC warm-start solution (voltage angles and dispatch), and synthetic reactive compensation shunts for AC-OPF feasibility.
|
| 62 |
+
|
| 63 |
+
Each instance is associated with a label describing the geographic scope (state or multi-state region) and operating condition (peak 16h or off-peak 04h demand snapshot).
|
| 64 |
+
|
| 65 |
+
The data was generated between 2025 and 2026.
|
| 66 |
+
|
| 67 |
+
GridSFM US Power Grid Dataset does not contain links to external data sources. Links are to publicly available datasets used during generation (e.g., OpenStreetMap, U.S. EIA, U.S. Census, HIFLD), which are referenced for provenance but not dynamically queried at runtime.
|
| 68 |
+
|
| 69 |
+
### Data Creation & Processing
|
| 70 |
+
|
| 71 |
+
GridSFM US Power Grid Dataset was created from scratch, using publicly available open data sources, rather than adapting any existing power grid datasets.
|
| 72 |
+
|
| 73 |
+
The existing data that was used to create GridSFM US Power Grid Dataset consisted of geospatial descriptions of power infrastructure (transmission lines, substations, and generators), generator metadata (capacity, fuel type, heat rates), hourly demand measurements at the balancing-authority level, population-based geographic data, and boundary definitions for balancing authorities.
|
| 74 |
+
|
| 75 |
+
The existing data that was used to create GridSFM US Power Grid Dataset was originally collected by external public data providers, including OpenStreetMap contributors (crowdsourced mapping), the U.S. Energy Information Administration (EIA), the U.S. Census Bureau, and U.S. government infrastructure datasets such as HIFLD.
|
| 76 |
+
|
| 77 |
+
GridSFM US Power Grid Dataset was created by transforming these heterogeneous data sources into transmission network models through a multi-stage pipeline, including data extraction, topology reconstruction, parameter estimation, demand allocation, and optimal power flow (OPF) solving with progressive relaxation.
|
| 78 |
+
|
| 79 |
+
Dataset creation was carried out by members of the Microsoft Research Catalyst Lab team.
|
| 80 |
+
|
| 81 |
+
GridSFM US Power Grid Dataset includes data crawled from the web. Specifically, OpenStreetMap data (power infrastructure features) was programmatically retrieved via local copy using the Overpass API, which serves publicly available, user-contributed geographic data.
|
| 82 |
+
|
| 83 |
+
#### People & Identifiers
|
| 84 |
+
|
| 85 |
+
The GridSFM US Power Grid Dataset is not related to humans in any way and thus does not include any information that could be used to identify a person.
|
| 86 |
+
|
| 87 |
+
#### Sensitive or harmful content
|
| 88 |
+
|
| 89 |
+
GridSFM US Power Grid Dataset contains only power systems information and thus no sensitive or harmful content.
|
| 90 |
+
|
| 91 |
+
#### Other processing
|
| 92 |
+
|
| 93 |
+
Duplicate/redundant information was automatically removed using software, as part of the topology reconstruction and data preprocessing pipeline.
|
| 94 |
+
|
| 95 |
+
The data was labeled with metadata describing the modeled region (state or multi-state region), operating condition (peak or off-peak hour), and solver outputs (e.g., DC/AC-OPF results and relaxation levels). The labeling was performed automatically using software, based on deterministic naming conventions and outputs from the OPF pipeline.
|
| 96 |
+
|
| 97 |
+
## How to get started
|
| 98 |
+
|
| 99 |
+
To begin using GridSFM US Power Grid Dataset, users can download and load the dataset directly from Hugging Face or use the official loader from the GridSFM repository:
|
| 100 |
+
|
| 101 |
+
- microsoft/GridSFM_US_power_grid · Datasets at Hugging Face
|
| 102 |
+
- microsoft/GridSFM: Small Foundation Models for the Power Grid
|
| 103 |
+
|
| 104 |
+
See section [Dataset Download, Usage, and File Specification](#dataset-download-usage-and-file-specification) for detailed code examples.
|
| 105 |
+
|
| 106 |
+
## Validation
|
| 107 |
+
|
| 108 |
+
To assess how effective GridSFM US Power Grid Dataset would be at its intended purpose, our team looked for physical plausibility, solver feasibility, and consistency with real-world power system statistics.
|
| 109 |
+
|
| 110 |
+
Specifically, we:
|
| 111 |
+
- Evaluated DC-OPF and AC-OPF convergence rates across all 48 states and multi-state regions
|
| 112 |
+
- Measured dispatch costs, system losses, and generator utilization, comparing them to expected ranges in real-world systems
|
| 113 |
+
- Assessed model robustness under different relaxation levels, using convergence behavior as a proxy for data quality
|
| 114 |
+
- Verified scaling consistency across geographic regions, from small states to continent-scale interconnections
|
| 115 |
+
|
| 116 |
+
A detailed discussion of our validation methods and results can be found in our paper at: https://arxiv.org/abs/2605.04289
|
| 117 |
+
|
| 118 |
+
## Limitations
|
| 119 |
+
|
| 120 |
+
GridSFM US Power Grid Dataset was developed for research and experimental purposes. Further testing and validation are needed before considering its application in commercial or real-world scenarios.
|
| 121 |
+
|
| 122 |
+
GridSFM US Power Grid Dataset consists of English language instances only.
|
| 123 |
+
|
| 124 |
+
GridSFM US Power Grid Dataset contains approximate and inferred data, including estimation noise in electrical parameters (e.g., line impedances, thermal limits), incomplete topology reconstruction (e.g., missing parallel circuits), and heuristic demand allocation.
|
| 125 |
+
|
| 126 |
+
GridSFM US Power Grid Dataset is missing utility-grade measurements and operational data, including exact network topology, measured electrical parameters, protection settings, dynamic system behavior, and time-series operational constraints.
|
| 127 |
+
|
| 128 |
+
There are few or no instances of detailed distribution-level networks, low-voltage infrastructure, or precise multi-circuit transmission representations in the dataset. As a result, GridSFM US Power Grid Dataset should not be used for high-fidelity operational studies, protection analysis, or real-time decision-making.
|
| 129 |
+
|
| 130 |
+
The ability to access external links in the dataset is beyond the control of the research team.
|
| 131 |
+
|
| 132 |
+
GridSFM US Power Grid Dataset should not be used in highly regulated domains where inaccurate or incomplete outputs could suggest actions that lead to injury or negatively impact an individual's legal, financial, or life opportunities.
|
| 133 |
+
|
| 134 |
+
## Best Practices
|
| 135 |
+
|
| 136 |
+
We recommend splitting the data into train/validation/test splits based on geographic regions (e.g., by state or multi-state region) or operating conditions (peak vs off-peak), depending on the intended use case.
|
| 137 |
+
|
| 138 |
+
It is the user’s responsibility to ensure that the use of GridSFM US Power Grid Dataset complies with relevant data protection regulations and organizational guidelines.
|
| 139 |
+
|
| 140 |
+
## License
|
| 141 |
+
|
| 142 |
+
MIT License
|
| 143 |
+
|
| 144 |
+
Nothing disclosed here, including the Out of Scope Uses section, should be interpreted as or deemed a restriction or modification to the license the code is released under.
|
| 145 |
+
|
| 146 |
+
## Trademarks
|
| 147 |
+
|
| 148 |
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
|
| 149 |
+
|
| 150 |
+
## Contact
|
| 151 |
+
|
| 152 |
+
This research was conducted by members of Microsoft Research. We welcome feedback and collaboration from our audience. If you have suggestions, questions, or observe unexpected/problematic data in our dataset, please contact us at gridsfm@microsoft.com.
|
| 153 |
+
|
| 154 |
+
If the team receives reports of undesired content or identifies issues independently, we will update this repository with appropriate mitigations.
|
| 155 |
+
|
| 156 |
+
---
|
| 157 |
+
|
| 158 |
+
# Dataset Content, Quick Start, and Specification
|
| 159 |
+
|
| 160 |
+
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).
|
| 161 |
+
|
| 162 |
+
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.
|
| 163 |
+
|
| 164 |
+
**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).
|
| 165 |
+
|
| 166 |
## Coverage
|
| 167 |
|
| 168 |
**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).
|
|
|
|
| 197 |
... # Same structure, off-peak hour
|
| 198 |
```
|
| 199 |
|
| 200 |
+
## Quick Start
|
| 201 |
+
|
| 202 |
+
### Download from HuggingFace
|
| 203 |
+
|
| 204 |
+
```bash
|
| 205 |
+
pip install huggingface_hub
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
**Load a single model (no extra dependencies):**
|
| 209 |
+
|
| 210 |
+
```python
|
| 211 |
+
from huggingface_hub import hf_hub_download
|
| 212 |
+
import json
|
| 213 |
+
|
| 214 |
+
path = hf_hub_download(
|
| 215 |
+
repo_id="microsoft/GridSFM_US_power_grid",
|
| 216 |
+
filename="16h/texas_model.json",
|
| 217 |
+
repo_type="dataset",
|
| 218 |
+
)
|
| 219 |
+
with open(path) as f:
|
| 220 |
+
model = json.load(f)
|
| 221 |
+
|
| 222 |
+
print(f"Buses: {len(model['bus'])}")
|
| 223 |
+
print(f"Branches: {len(model['branch'])}")
|
| 224 |
+
print(f"Generators: {len(model['gen'])}")
|
| 225 |
+
print(f"Loads: {len(model['load'])}")
|
| 226 |
+
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
**Using the GridSFM loader** (from [github.com/microsoft/GridSFM/power_grid](https://github.com/microsoft/GridSFM/tree/main/power_grid)):
|
| 230 |
+
|
| 231 |
+
```python
|
| 232 |
+
from gridsfm_pg_loader import GridSFM_PG_Loader
|
| 233 |
+
|
| 234 |
+
# With export_dir (optional): the entire dataset is automatically downloaded
|
| 235 |
+
# to this directory on init. Without it, files are stored in HuggingFace's cache.
|
| 236 |
+
loader = GridSFM_PG_Loader(
|
| 237 |
+
"microsoft/GridSFM_US_power_grid",
|
| 238 |
+
export_dir="./gridsfm_data", # optional; pre-fetches everything here
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
# To skip the automatic download, use pre_fetch_all=False (lazy download on access)
|
| 242 |
+
# loader = GridSFM_PG_Loader(
|
| 243 |
+
# "microsoft/GridSFM_US_power_grid",
|
| 244 |
+
# export_dir="./gridsfm_data",
|
| 245 |
+
# pre_fetch_all=False,
|
| 246 |
+
# )
|
| 247 |
+
|
| 248 |
+
# Case-insensitive; state abbreviations work too
|
| 249 |
+
model = loader.load_model("TX", hour="16h")
|
| 250 |
+
ac = loader.load_ac_results("texas", hour="16h")
|
| 251 |
+
dc = loader.load_dc_results("Texas", hour="16h")
|
| 252 |
+
|
| 253 |
+
# Export a single file to a specific path
|
| 254 |
+
loader.export_file("TX", "model", hour="16h", dest="./my_models/texas.json")
|
| 255 |
+
|
| 256 |
+
# Save a loaded (or modified) model dict back to JSON
|
| 257 |
+
loader.save_json(model, "./my_models/texas_modified.json")
|
| 258 |
+
|
| 259 |
+
# Discover what's available (fetched from dataset_metadata.json)
|
| 260 |
+
loader.list_regions() # all 54 regions + states
|
| 261 |
+
loader.list_abbreviations() # {"AL": "alabama", "TX": "texas", ...}
|
| 262 |
+
loader.list_hours() # ["04h", "16h"]
|
| 263 |
+
loader.list_file_types() # ["model", "ac_results", "dc_results"]
|
| 264 |
+
|
| 265 |
+
# Export the entire dataset to a local directory at any time
|
| 266 |
+
loader.export_all("./gridsfm_data")
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
**Download the entire dataset (~230 MB):**
|
| 270 |
+
|
| 271 |
+
```bash
|
| 272 |
+
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --local-dir ./gridsfm_data
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
**Download a subset (one hour only):**
|
| 276 |
+
|
| 277 |
+
```bash
|
| 278 |
+
hf download --repo-type dataset microsoft/GridSFM_US_power_grid --include "16h/*" --local-dir ./gridsfm_data
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
### Load a model from local files
|
| 282 |
+
|
| 283 |
+
```python
|
| 284 |
+
import json
|
| 285 |
+
|
| 286 |
+
with open("16h/texas_model.json") as f:
|
| 287 |
+
model = json.load(f)
|
| 288 |
+
|
| 289 |
+
print(f"Buses: {len(model['bus'])}")
|
| 290 |
+
print(f"Branches: {len(model['branch'])}")
|
| 291 |
+
print(f"Generators: {len(model['gen'])}")
|
| 292 |
+
print(f"Loads: {len(model['load'])}")
|
| 293 |
+
print(f"Shunts: {len(model['shunt'])}")
|
| 294 |
+
print(f"HVDC lines: {len(model['dcline'])}")
|
| 295 |
+
print(f"Total load: {sum(l['pd'] for l in model['load'].values()) * model['baseMVA']:.0f} MW")
|
| 296 |
+
```
|
| 297 |
+
|
| 298 |
+
### Run OPF with PowerModels.jl
|
| 299 |
+
|
| 300 |
+
```julia
|
| 301 |
+
using PowerModels, Ipopt
|
| 302 |
+
|
| 303 |
+
data = PowerModels.parse_file("16h/texas_model.json")
|
| 304 |
+
result = solve_ac_opf(data, Ipopt.Optimizer)
|
| 305 |
+
println("Objective: \$(result[\"objective\"])")
|
| 306 |
+
println("Status: \$(result[\"termination_status\"])")
|
| 307 |
+
```
|
| 308 |
+
|
| 309 |
## Model File (`*_model.json`)
|
| 310 |
|
| 311 |
The primary artifact. A single JSON containing everything needed to run optimal power flow.
|
|
|
|
| 563 |
| `limit_method` | string | `"known"` (NERC/WECC paths) or `"heuristic"` |
|
| 564 |
| `total_rate_a` | float | Sum of branch ratings (p.u.) |
|
| 565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
|
| 567 |
## Data Sources
|
| 568 |
|
|
|
|
| 598 |
| 5 | L5 — Full relaxation | Remove thermal limits, angles ±90°, V [0.85, 1.15], Q ×2.0, load cap 70%, pmin = 0 |
|
| 599 |
| AC1 | AC1 — Voltage + Q | Voltage [0.90, 1.10], Q limits ×1.5 (AC-OPF only) |
|
| 600 |
|
| 601 |
+
The `relaxation_level` and `relaxation_label` fields in results files indicate which level was needed.
|
|
|
|
|
|
|
|
|
|
|
|