Skip to main content

Python package for power system simulation, ported from MATPOWER.

Project description

pwrs

⚠️ 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 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 .

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwrs-0.1.0.tar.gz (15.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwrs-0.1.0-py3-none-any.whl (15.6 MB view details)

Uploaded Python 3

File details

Details for the file pwrs-0.1.0.tar.gz.

File metadata

  • Download URL: pwrs-0.1.0.tar.gz
  • Upload date:
  • Size: 15.4 MB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for pwrs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f1d6be1748ad96d7e3fbc959a8c4f56da1242a88134c64ac73d9cd59e0763da
MD5 f1a2a6513dfa1adb8951eb003e55bd61
BLAKE2b-256 dc75c30c0af2591b2806b8a2836ab03e3c3949d433ee09d6fd02f7ffaf87dc07

See more details on using hashes here.

File details

Details for the file pwrs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pwrs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 MB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for pwrs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 907e1ea643fec86bcab103e7fcc9b932b376c2488730c36e0a8ffb9163001649
MD5 3906519ab1f5f30d3950226219fa31fb
BLAKE2b-256 22bf7bb7e092f60625967cf9eb3d89d3c29702f1301cb14a514bd819503428db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page