Skip to main content

Python package for power system simulation, ported from MATPOWER.

Project description

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 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.1.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.1-py3-none-any.whl (15.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pwrs-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c3f577f06d87bf47b064efeb2f8cccd4712ba426afa588217d7684d790dc9147
MD5 c2bc51b9011ef730a56efb2cd1dd4719
BLAKE2b-256 382237f0d5b5ba3bd8b9a18dc36d013e0950461444ed6bbf0f61e4306b4292d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pwrs-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9017b2dd006f90156b224fc3768c5241be33f3e2edc6b92119edff61cde8389d
MD5 903b5fa31d5493f817e14ce83b717f8d
BLAKE2b-256 44502e8046acae553e6edc7b69dbcfb9f54dd0e26317d1821d3756f3acf9e264

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