BDonnot / lightsim2grid

LightSim2grid implements a c++ backend targeting the Grid2Op (https://github.com/rte-france/grid2op) platform.
https://lightsim2grid.readthedocs.io/en/latest/
Mozilla Public License 2.0
46 stars 9 forks source link

Fixed Decoupled Power Flow algorithm in LightSim2Grid #63

Closed shabansatti closed 9 months ago

shabansatti commented 11 months ago

I was wondering if you looked at implementing the Fixed Decoupled Power Flow algorithm in LightSim2Grid? I think this method is faster as the factorization can be reused directly between iterations. The method is implemented in MATPOWER. The relevant parts of the code can be found at the following links:

  1. https://github.com/MATPOWER/matpower/blob/3232f1ec3df214b162c9073227aa23ce933fcb73/lib/runpf.m#L336
  2. https://github.com/MATPOWER/matpower/blob/3232f1ec3df214b162c9073227aa23ce933fcb73/lib/runpf.m#L337
  3. https://github.com/MATPOWER/matpower/blob/master/lib/fdpf.m

The B matrices needed for this algorithm can be easily created from the Ybus matrix . The MATPOWER code for creating B matrices can be found in the following link. The two key lines are line 75 and 84. These matrices are formed from submatrices of the imaginary part of Ybus.

https://github.com/MATPOWER/matpower/blob/3232f1ec3df214b162c9073227aa23ce933fcb73/lib/makeB.m

BDonnot commented 11 months ago

Hello

Thanks for all this material.

Pypower a port of matpower in python also implements this method, see eg here https://github.com/rwl/PYPOWER/blob/master/pypower/makeB.py

You can use it in the mean time (and I can use when developping some tests: easier to check things when staying in python rather than to switch programming langage)

Thanks for the proposition.

BDonnot commented 9 months ago

It's now available (though not fully optimized yet) in the latest version