Skip to main content

GridForge

GridForge Logo

GridForge provides a small, explicit Python API for preparing standard PYPOWER/MATPOWER cases for power-system studies. It keeps the familiar case tables, gives them readable column names, preserves real bus IDs, and adds a few domain operations that are error-prone with raw NumPy arrays. You can directly use its output to formulate power system optimization problems.

Installation

Install the released package from PyPI:

pip install powergridforge

For development:

git clone https://github.com/xuwkk/gridforge.git
cd gridforge
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

To preview or check the documentation from the repository root:

python -m mkdocs serve
python -m mkdocs build --strict

The docs workflow publishes documentation changes from master to gh-pages. For first-time setup, choose Deploy from a branch and gh-pages under GitHub Settings → Pages.

Quick Start

import gridforge as gf
import pandas as pd

case = gf.load_case("case14")
bus = case["bus"]
solar = pd.DataFrame({"BUS_IDX": [2, 6], "PG": [20.0, 30.0]})
case.add_component("solar", solar)
solar_by_bus_mw = case.connection_matrix("solar") @ case["solar"]["PG"].to_numpy()
dc = case.dc_model()
ac = case.ac_model()
print(solar_by_bus_mw, dc.ptdf.shape, ac.Ybus.shape)

Export the standard electrical model as a standalone, NumPy-only PYPOWER case file:

case.to_python("case_custom.py")

The file defines case_custom() and can be loaded with ordinary Python, PYPOWER or GridForge. Standard numeric values retain full precision; custom component tables and metadata are omitted. Existing files are protected unless overwrite=True.

For a complete example, see the worked tutorial. The API reference lists the public operations; Cases and Tables defines what each file format preserves. The documentation site covers matrix axes, units, and AC/DC conventions.

GridForge is distributed under the MIT License.

Metadata

Release files for powergridforge 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for powergridforge 2.1.0
File Size Uploaded Provenance Actions
powergridforge-2.1.0.tar.gz 1.6 MB Without provenance Details for powergridforge-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for powergridforge 2.1.0
File Interpreter ABI Platform Actions
powergridforge-2.1.0-py3-none-any.whl Python 3 none any Details for powergridforge-2.1.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / powergridforge-2.1.0.tar.gz

Download URL powergridforge-2.1.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
b1a4c3eefd7f90e10583b5c60aec9b82fca77ecd3a4f46366b40ad48dd3def26
BLAKE2b-256 checksum
How to use checksums
2a58259af04f9f93cd562934ba2df1bbca2c99d38a651930f1e7fa55fec8178b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / powergridforge-2.1.0-py3-none-any.whl

Download URL powergridforge-2.1.0-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae3a37b909ca14624861ab3824daf9a221537d2a4e4e2023fa605b8ab719919e
BLAKE2b-256 checksum
How to use checksums
7c1f683d7df2d1d1de362c2ee9e479c2903b315125dbc15e047488e0cee70ea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for powergridforge 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page