From 99d2327ebda272a63d614ea36769df45ad9b2b76 Mon Sep 17 00:00:00 2001 From: Muhammad Yasirroni Date: Tue, 26 Sep 2023 21:44:06 +0700 Subject: [PATCH] update tutorial to run --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7fc8a48..e24b0ee 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 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 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. +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 @@ -12,6 +12,8 @@ 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 @@ -21,7 +23,7 @@ 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: +If you have `matpower` installed via `pip install matpower` (did not require `matpower[octave]`), you can easily navigate `matpower` case using: ```python import os @@ -35,6 +37,19 @@ 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