Change compute_ac_pf iteration to use more standard (smaller) Jacobian - #1011
Change compute_ac_pf iteration to use more standard (smaller) Jacobian#1011LKuhrmann wants to merge 7 commits into
Conversation
…ian" This reverts commit 85adefb.
Broke due to consequence of not iterating to find p and q injections anymore and instead calculating them in f!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1011 +/- ##
=======================================
Coverage 93.94% 93.94%
=======================================
Files 43 43
Lines 9676 9731 +55
=======================================
+ Hits 9090 9142 +52
- Misses 586 589 +3
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
Seems like the remaining failing tests would be fixed by #1010 |
|
I think this will be cleaner to implement on top of #1013. That PR also converges on your test case. This PR adds duplicate code to We can instead put the map in |
|
Interesting that #1013 converges on my test case, as it also seems to use the larger (nonstandard) Jacobian. I don't really have an opinion on what would be cleaner or how newton-rahpson should be implemented, my primary concern is convergence parity with other newton-raphson solvers. |
|
I am still investigating, but it seems we found a bug that you resolved in this PR here: On the main branch it's taking the state vectors from the last call to This is why my Newton implementation without the reduced Jacobian from #1012 also converges. Because it also does not make this mistake. We should make a new issue for this. |
|
Very interesting! I will see if I can find other cases where the convergence difference is the result of the smaller jacobian rather than a result of the jacobian using the newest voltages. If updating the voltage twice (as I implemented in the lines you link) fixes the convergence issues, then it could be a very simple bugfix from a convergence perspective. |
|
I have opened #1016 to discuss. |
Change
Fixes #1009.
Reduces what is iterated in the Newton Raphson iteration from [P, Q] for all buses to [P, Q] for PQ buses and [P] for PV buses. This reduces the Jacobian size by the number of PV busses +2.
I believe the implementation I am suggesting is more standard. The first two random results I get when I google for "newton raphson power flow" support this: random university pdf 1, page 111ff and random university pdf 2, page 9
Impact
Should make
compute_ac_pfslightly faster and more memory efficient with more standard convergence when compared to other power flow tools.As this PR simplifies the Newton-Raphson iteration by no longer converging toward Q injections (for PV and slack buses) and P injection (for the slack bus) I would expect this to converge whenever the current implementation converges.
But I can't prove that, so there is a risk that this might break convergence in some (probably a bit weird) cases.
Todo
I assume this change will need some tests. One test that could be added is the one presented in #1009 that does not currently converge.
I am uncertain if the way I implemented this is inline with the broader PowerModels codebase, so I am keen for code changes/opinions!
What else would need to happen so this can be merged?
If there are reasons for the current power flow implementation I am keen to hear them!