matpowercaseframes


Namematpowercaseframes JSON
Version 1.0.7 PyPI version JSON
download
home_page
SummaryParse MATPOWER case into pandas DataFrame.
upload_time2023-09-26 14:49:51
maintainer
docs_urlNone
author
requires_python>=3.7.1
licenseMIT License
keywords matpower parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MATPOWER Case Frames

Parse MATPOWER case into pandas DataFrame.

Unlike the [tutorial](https://github.com/yasirroni/matpower-pip#extra-require-oct2py-or-matlabengine) on [`matpower-pip`](https://github.com/yasirroni/matpower-pip), this package supports 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

```plaintext
pip install matpowercaseframes
```

## Usage

The main utility of `matpowercaseframes` is to help read `matpower` data in user-friendly format as follows,

```python
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:

```python
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)
```

Furthermore, `matpowercaseframes` also support generating data that is acceptable by `matpower` via `matpower-pip` package (require `matlab` or `octave`),

```python
from matpowercaseframes import CaseFrames

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

m = start_instance()
m.runpf(mpc)
```

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

```python
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:

```python
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](https://ft.ugm.ac.id/en/) under the supervision of [Mr. Sarjiya](https://www.researchgate.net/profile/Sarjiya_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](https://www.semanticscholar.org/author/Sarjiya/2267414) scholar](https://www.semanticscholar.org/author/Sarjiya/2267414) or [IEEE](https://ieeexplore.ieee.org/author/37548066400).

This package is a fork and simplification from [psst](https://github.com/ames-market/psst) MATPOWER parser, thus we greatly thank psst developers and contributors.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "matpowercaseframes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.1",
    "maintainer_email": "Muhammad Yasirroni <muhammadyasirroni@gmail.com>",
    "keywords": "matpower,parser",
    "author": "",
    "author_email": "Muhammad Yasirroni <muhammadyasirroni@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1a/6e/fa60e49fcb2d3319c8322dd2229f6cb066887b2556d4ce9401b30b2db23f/matpowercaseframes-1.0.7.tar.gz",
    "platform": null,
    "description": "# MATPOWER Case Frames\n\nParse MATPOWER case into pandas DataFrame.\n\nUnlike the [tutorial](https://github.com/yasirroni/matpower-pip#extra-require-oct2py-or-matlabengine) on [`matpower-pip`](https://github.com/yasirroni/matpower-pip), this package supports 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.\n\n## Installation\n\n```plaintext\npip install matpowercaseframes\n```\n\n## Usage\n\nThe main utility of `matpowercaseframes` is to help read `matpower` data in user-friendly format as follows,\n\n```python\nfrom matpowercaseframes import CaseFrames\n\ncase_path = 'case9.m'\ncf = CaseFrames(case_path)\n\nprint(cf.gencost)\n```\n\nIf you have `matpower` installed via `pip install matpower` (did not require `matpower[octave]`), you can easily navigate `matpower` case using:\n\n```python\nimport os\nfrom matpower import path_matpower # require `pip install matpower`\nfrom matpowercaseframes import CaseFrames\n\ncase_name = 'case9.m'\ncase_path = os.path.join(path_matpower, 'data', case_name)\ncf = CaseFrames(case_path)\n\nprint(cf.gencost)\n```\n\nFurthermore, `matpowercaseframes` also support generating data that is acceptable by `matpower` via `matpower-pip` package (require `matlab` or `octave`),\n\n```python\nfrom matpowercaseframes import CaseFrames\n\ncase_path = 'case9.m'\ncf = CaseFrames(case_path)\nmpc = cf.to_dict()\n\nm = start_instance()\nm.runpf(mpc)\n```\n\nTo save all `DataFrame` to a single `xlsx` file, use:\n\n```python\nfrom matpowercaseframes import CaseFrames\n\ncase_path = 'case9.m'\ncf = CaseFrames(case_path)\n\ncf.to_excel('PATH/TO/DIR/case9.xlsx')\n```\n\nIf you use `matpower[octave]`, `CaseFrames` also support `oct2py.io.Struct` as input using:\n\n```python\nfrom matpower import start_instance\nfrom matpowercaseframes import CaseFrames\n\nm = start_instance()\n\n# support mpc before runpf\nmpc = m.loadcase('case9', verbose=False)\ncf = CaseFrames(mpc)\nprint(cf.gencost)\n\n# support mpc after runpf\nmpc = m.runpf(mpc, verbose=False)\ncf = CaseFrames(mpc)\nprint(cf.gencost)\n\nm.exit()\n```\n\n## Acknowledgment\n\nThis repository was supported by the [Faculty of Engineering, Universitas Gadjah Mada](https://ft.ugm.ac.id/en/) under the supervision of [Mr. Sarjiya](https://www.researchgate.net/profile/Sarjiya_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](https://www.semanticscholar.org/author/Sarjiya/2267414) scholar](https://www.semanticscholar.org/author/Sarjiya/2267414) or [IEEE](https://ieeexplore.ieee.org/author/37548066400).\n\nThis package is a fork and simplification from [psst](https://github.com/ames-market/psst) MATPOWER parser, thus we greatly thank psst developers and contributors.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Parse MATPOWER case into pandas DataFrame.",
    "version": "1.0.7",
    "project_urls": {
        "Documentation": "https://github.com/UGM-EPSLab/matpowercaseframes#readme",
        "Issues": "https://github.com/UGM-EPSLab/matpowercaseframes/issues",
        "Source": "https://github.com/UGM-EPSLab/matpowercaseframes"
    },
    "split_keywords": [
        "matpower",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22dbe502916a5f7b596c9ff1b9b1bae3df0748cf5125ffdf238fa6d7d2d692c0",
                "md5": "2acd7caf43f912ac517e32fd1bd0291f",
                "sha256": "42ebc39d9e80c21680c2ec475bc374d27a6d3b07b5428d5d7e36979c0a062f5f"
            },
            "downloads": -1,
            "filename": "matpowercaseframes-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2acd7caf43f912ac517e32fd1bd0291f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.1",
            "size": 9527,
            "upload_time": "2023-09-26T14:49:49",
            "upload_time_iso_8601": "2023-09-26T14:49:49.780496Z",
            "url": "https://files.pythonhosted.org/packages/22/db/e502916a5f7b596c9ff1b9b1bae3df0748cf5125ffdf238fa6d7d2d692c0/matpowercaseframes-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a6efa60e49fcb2d3319c8322dd2229f6cb066887b2556d4ce9401b30b2db23f",
                "md5": "1b86052c20696fd0d7157007c66d303f",
                "sha256": "1e91c7a71ec1588ffeffbf4cc21b153b3611774387668b73746a79f87a05120b"
            },
            "downloads": -1,
            "filename": "matpowercaseframes-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "1b86052c20696fd0d7157007c66d303f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.1",
            "size": 11070,
            "upload_time": "2023-09-26T14:49:51",
            "upload_time_iso_8601": "2023-09-26T14:49:51.380696Z",
            "url": "https://files.pythonhosted.org/packages/1a/6e/fa60e49fcb2d3319c8322dd2229f6cb066887b2556d4ce9401b30b2db23f/matpowercaseframes-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-26 14:49:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "UGM-EPSLab",
    "github_project": "matpowercaseframes#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "matpowercaseframes"
}
        
Elapsed time: 0.16333s