Skip to content

Support more output from m.runpf() #28

@yasirroni-au

Description

@yasirroni-au

From case2.m output dict:

dict_keys(['version', 'baseMVA', 'bus', 'gen', 'branch', 'gencost', 'order', 'et', 'success', 'iterations', 'getdoc'])
{'version': '2',
 'baseMVA': 100.0,
 'bus': array([[ 1.00000000e+00,  3.00000000e+00,  0.00000000e+00,
          0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
          1.00000000e+00,  1.00000000e+00,  0.00000000e+00,
          3.45000000e+02,  1.00000000e+00,  1.10000000e+00,
          9.00000000e-01],
        [ 2.00000000e+00,  1.00000000e+00,  2.50000000e+00,
          1.00000000e+00,  0.00000000e+00,  0.00000000e+00,
          1.00000000e+00,  9.99498967e-01, -7.16556448e-02,
          3.45000000e+02,  1.00000000e+00,  1.10000000e+00,
          9.00000000e-01]]),
 'gen': array([[   1.        ,    2.5       ,    1.00362863,  300.        ,
         -300.        ,    1.        ,  100.        ,    1.        ,
           15.        ,    0.        ,    0.        ,    0.        ,
            0.        ,    0.        ,    0.        ,    0.        ,
            0.        ,    0.        ,    0.        ,    0.        ,
            0.        ]]),
 'branch': array([[ 1.00000000e+00,  2.00000000e+00,  0.00000000e+00,
          5.00000000e-02,  0.00000000e+00,  2.50000000e+02,
          2.50000000e+02,  2.50000000e+02,  0.00000000e+00,
          0.00000000e+00,  1.00000000e+00, -3.60000000e+02,
          3.60000000e+02,  2.50000000e+00,  1.00362863e+00,
         -2.50000000e+00, -9.99999997e-01]]),
 'gencost': array([[   2., 1500.,    0.,    3.,    0.,    5.,    0.]]),
 'order': {'bus': {'e2i': <Compressed Sparse Column sparse array of dtype 'float64'
   	with 2 stored elements and shape (2, 1)>,
   'i2e': array([[1.],
          [2.]]),
   'status': {'on': array([[1.],
           [2.]]),
    'off': array([], shape=(0, 1), dtype=float64)}},
  'gen': {'e2i': 1.0, 'i2e': 1.0, 'status': {'on': 1.0, 'off': []}},
  'branch': {'status': {'on': 1.0, 'off': []}},
  'state': 'e',
  'int': {'bus': array([[ 1.00000000e+00,  3.00000000e+00,  0.00000000e+00,
            0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
            1.00000000e+00,  1.00000000e+00,  0.00000000e+00,
            3.45000000e+02,  1.00000000e+00,  1.10000000e+00,
            9.00000000e-01],
          [ 2.00000000e+00,  1.00000000e+00,  2.50000000e+00,
            1.00000000e+00,  0.00000000e+00,  0.00000000e+00,
            1.00000000e+00,  9.99498967e-01, -7.16556448e-02,
            3.45000000e+02,  1.00000000e+00,  1.10000000e+00,
            9.00000000e-01]]),
   'branch': array([[ 1.00000000e+00,  2.00000000e+00,  0.00000000e+00,
            5.00000000e-02,  0.00000000e+00,  2.50000000e+02,
            2.50000000e+02,  2.50000000e+02,  0.00000000e+00,
            0.00000000e+00,  1.00000000e+00, -3.60000000e+02,
            3.60000000e+02,  2.50000000e+00,  1.00362863e+00,
           -2.50000000e+00, -9.99999997e-01]]),
   'gen': array([[   1.        ,    2.5       ,    1.00362863,  300.        ,
           -300.        ,    1.        ,  100.        ,    1.        ,
             15.        ,    0.        ,    0.        ,    0.        ,
              0.        ,    0.        ,    0.        ,    0.        ,
              0.        ,    0.        ,    0.        ,    0.        ,
              0.        ]])}},
 'et': 0.05357098579406738,
 'success': 1,
 'iterations': 2.0,
 'getdoc': {}}

The easier part is to include 'et', 'success', 'iterations'. As it serve as info, for export, place it on:

        pd.DataFrame(
            data={
                "INFO": {
                    "version": getattr(self, "version", None),
                    "baseMVA": getattr(self, "baseMVA", None),
                }
            }
        ).to_csv(os.path.join(path, f"{prefix}info{suffix}.csv"))

https://github.com/UGM-EPSLab/matpowercaseframes/blob/b859fd5c08d8fd7eef052017564f2d1f63c232fc/matpowercaseframes/core.py#L600C1-L607C66

But the code need to be refactored to only add the keys when it is not None for 'et', 'success', 'iterations'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions