Skip to main content

pwrs

DOI

⚠️ This project is still under heavy development, the functionality is not yet guaranteed to be stable or fully available.

Pwrs is a Python package for power system simulation. It ports the well-known MATPOWER to Python and provides functions for solving power flow, continuation power flow, and optimal power flow problems.

The project aims to add type annotations to MATPOWER-style functions and to refactor MATLAB functions with multiple input/output parameters into clearer, more structured Python interfaces. The PF, CPF, and OPF implementations are checked via oracle-based tests against MATPOWER.

This project is NOT affiliated with or endorsed by the MATPOWER authors.

While the source code preserves the original functions as much as possible, deprecated or compatibility-related functions may be omitted.

This version of pwrs targets MATPOWER version 7.1.

Quick Start

You can install pwrs by pip:

pip install pwrs
# or install the development version by
pip install git+https://github.com/determ1ne/pwrs
# install all optional dependencies by
pip install pwrs[all]
# or install the package for development by uv:
# uv sync --dev
# or by pip:
# pip install -e .

**⚠️ Currently we recommend to install pwrs by pip install git+https://github.com/determ1ne/pwrs. **

Run an OPF by:

import pwrs as mp

mpc = mp.case9241pegase()
opt = mp.mpoption()
# opt.mips.linsolver = 'LU'
result = mp.runopf(mpc, opt)

License and Terms of Use

Pwrs is distributed under the 3-Clause BSD License.

This software is derived from MATPOWER, which is also licensed under the 3-Clause BSD License.

The case files distributed with pwrs are NOT covered by the BSD License. In most cases, these data files have either been included with permission or converted from data available from public sources.

Copyright 2026, Liangyu Zhang.
Copyright (c) 1996–2020, Power Systems Engineering Research Center (PSERC)
and individual contributors to MATPOWER.

See the LICENSE file distributed with this software for details.

We, together with the MATPOWER authors, kindly request that publications based on the use of pwrs or its included data files explicitly acknowledge this by citing the appropriate paper(s) and the software itself.

Papers

All publications derived from the use of pwrs, or the included data files, should cite the 2011 MATPOWER paper:

R. D. Zimmerman, C. E. Murillo-Sanchez, and R. J. Thomas, "MATPOWER: Steady-State Operations, Planning and Analysis Tools for Power Systems Research and Education," Power Systems, IEEE Transactions on, vol. 26, no. 1, pp. 12-19, Feb. 2011.
doi: [10.1109/TPWRS.2010.2051168][13]

Publications derived from the use of the Pwrs Optimal Scheduling Tool (POST) should cite the 2013 MOST paper, in addition to the 2011 MATPOWER paper above.

C. E. Murillo-Sanchez, R. D. Zimmerman, C. L. Anderson, and R. J. Thomas, "Secure Planning and Operations of Systems with Stochastic Sources, Energy Storage and Active Demand," Smart Grid, IEEE Transactions on, vol. 4, no. 4, pp. 2220-2229, Dec. 2013.
doi: [10.1109/TSG.2013.2281001][18]

Work making specific reference to the Pwrs Interior Point Solver (PIPS) should also cite:

H. Wang, C. E. Murillo-Sánchez, R. D. Zimmerman, R. J. Thomas, "On Computational Issues of Market-Based Optimal Power Flow," Power Systems, IEEE Transactions on, vol. 22, no. 3, pp. 1185-1193, Aug. 2007.
doi: [10.1109/TPWRS.2007.901301][17]

NOTE: Some of the case files included with MATPOWER request the citation of additional publications. This includes the ACTIVSg, PEGASE, and RTE cases. Details are available in the help text at the top of the corresponding case files.

Release files for pwrs 0.1.2

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

Source distribution (sdist)

Source distribution for pwrs 0.1.2
File Size Uploaded
pwrs-0.1.2.tar.gz 15.1 MB Details

Built distribution (wheel)

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

Total release size: 30.4 MB

Release files / pwrs-0.1.2.tar.gz

Download URL pwrs-0.1.2.tar.gz
Size 15.1 MB
Tags Source
SHA-256 checksum
How to use checksums
85358482a4c6e4b3dccd3d34375a767eb766e32a75d6ddc203c7c94dd08e28b5
BLAKE2b-256 checksum
How to use checksums
46848f91d4e7a23bf7071bd18411b4e38270e8e2e9bbac2e9c4228b9bca63918
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pwrs-0.1.2-py3-none-any.whl

Download URL pwrs-0.1.2-py3-none-any.whl
Size 15.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
325085989575ad5406c2971cac65bb460e14dea94712ebc6c4292f0b30f2c041
BLAKE2b-256 checksum
How to use checksums
eb40f88ca09374100cd9a50275a0fa8567f0d6449941c2c0ba325b0f97034120
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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