yasirroni / matpower-pip

A Python Package for Easy Access to MATPOWER Power System Simulation Package
MIT License
21 stars 0 forks source link

MATPOWER 8 return `task` and `om`. #17

Closed yasirroni closed 4 months ago

yasirroni commented 5 months ago
from matpower import start_instance
from matpowercaseframes import CaseFrames

m = start_instance()

mpc = m.loadcase('case9', verbose=False)

m.push("_mpc", mpc, verbose=False)
m.eval("_r1 = runpf(_mpc);", verbose=True)
fieldnames_r1 = m.eval("fieldnames(_r1);", verbose=False)

for i in fieldnames_r1.ravel():
    try:
        val = m.eval(f"_r1.{i};", verbose=False)
        # print(type(val))
        # print(val)
    except Exception as e:
        print(i)
        print(e)
        pass
Cell(['version', 'baseMVA', 'bus', 'gen', 'branch', 'gencost', 'order',
       'task', 'et', 'success', 'iterations', 'om'])
task
Octave evaluation error:
error: save: error while writing '' to MAT file
om
Octave evaluation error:
error: save: error while writing '' to MAT file
yasirroni commented 4 months ago

Solved in https://github.com/yasirroni/matpower-pip/pull/15.