Skip to main content

Parse MATPOWER case into pandas DataFrame.

Project description

MATPOWER Case Frames

Parse MATPOWER case into pandas DataFrame.

Unlike the tutorial on matpower-pip, this package support parsing MATPOWER case using re instead of Oct2Py and Octave. After that, you can further parse the data into any format supported by your solver.

Installation

pip install matpowercaseframes

Usage

from matpowercaseframes import CaseFrames

case_path = 'case9.m'
cf = CaseFrames(case_path)

print(cf.gencost)

If you have matpower installed via pip install matpower (did not require matpower[octave]), you can easily navigate MATPOWER case using:

import os
from matpower import path_matpower # require `pip install matpower`
from matpowercaseframes import CaseFrames

case_name = 'case9.m'
case_path = os.path.join(path_matpower, 'data', case_name)
cf = CaseFrames(case_path)

print(cf.gencost)

To save all DataFrame to a single xlsx file, use:

from matpowercaseframes import CaseFrames

case_path = 'case9.m'
cf = CaseFrames(case_path)

cf.to_excel('PATH/TO/DIR/case9.xlsx')

If you use matpower[octave], CaseFrames also support oct2py.io.Struct as input using:

from matpower import start_instance
from matpowercaseframes import CaseFrames

m = start_instance()

# support mpc before runpf
mpc = m.loadcase('case9', verbose=False)
cf = CaseFrames(mpc)
print(cf.gencost)

# support mpc after runpf
mpc = m.runpf(mpc, verbose=False)
cf = CaseFrames(mpc)
print(cf.gencost)

m.exit()

Acknowledgment

This repository was supported by the Faculty of Engineering, Universitas Gadjah Mada under the supervision of Mr. Sarjiya. If you use this package for your research, we are very glad if you cite any relevant publication under Mr. Sarjiya's name as thanks (but you are not responsible to cite). You can find his publications in the semantic scholar](https://www.semanticscholar.org/author/Sarjiya/2267414) or IEEE.

This package is a fork and simplification from psst MATPOWER parser, thus we greatly thank psst developers and contributors.

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

matpowercaseframes-1.0.6.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

matpowercaseframes-1.0.6-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file matpowercaseframes-1.0.6.tar.gz.

File metadata

  • Download URL: matpowercaseframes-1.0.6.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for matpowercaseframes-1.0.6.tar.gz
Algorithm Hash digest
SHA256 a1aa973824fe85f104fdd6c702b0889b8553ff07ebf1703333830de1e723d4d8
MD5 c5b4fcbf19bb59311311ea9c4a6c18e7
BLAKE2b-256 9ffffd4fdd98af9b929b90a6e7c50ba92a8b9827c37582ca25a057b6b944176e

See more details on using hashes here.

File details

Details for the file matpowercaseframes-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for matpowercaseframes-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2ad01dd248664b6d2d71574473b545946279b2a5e2b1723809139ae0e313606d
MD5 a6f0c78f4fa6e249c83da436516ae2d5
BLAKE2b-256 be0041ac86e5c1a534b03fa650d30d027b930e984ed230a681b7faa319c9269d

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