Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPF: Change the continuation direction when the operating point moves… #25

Conversation

abhyshr
Copy link

@abhyshr abhyshr commented Sep 20, 2017

CPF: Change the continuation direction when the operating point moves from stable to unstable manifold.

Elis Nycander, https://www.mail-archive.com/matpower-l@cornell.edu/msg06048.html, brought up a case where the operating point moves from stable to unstable manifold. Once on the unstable manifold, the continuation curve moves in the direction of lambda increase, which seems intuitively opposite to expected behavior (progress along the decreasing lambda direction). The reason for the lambda increase direction when on unstable manifold is because the tangent direction was always set towards lambda increase. This fix checks whether the operating point is on stable or unstable manifold (by checking the sign of minimum eigen value) and changes the direction accordingly. When on stable manifold, an increasing lambda direction is set, while a decreasing lambda direction on unstable manifold.

Relevant discussion can be found here #23

Ray: I have not added the test cases or updated the manual yet. I'll add these once you are ok with the changes.

@jl-marin
Copy link
Collaborator

Hello Shri,

You're referencing issue #21, but I think your patch actually addresses issue #23, doesn't it?

JL

@abhyshr
Copy link
Author

abhyshr commented Sep 21, 2017 via email

@rdzman
Copy link
Member

rdzman commented Sep 25, 2017

Thanks @abhyshr. A few comments ...

  • Looks like this PR was based on an old version of the master branch. Would you mind rebasing it on the current master?
  • The test for "case300 w/Q lims" currently results in a fatal error on my machine.
  • I noticed some of the tests are not currently passing. I haven't looked at the details, but it appears to me at first glance that the logic for setting the direction may not be quite correct. In particular, the first of the failing tests ("CPF (full trace) (pseudo arc length) w/Q lims") appears to be a case where it now switches directions (unexpected behavior), when it did not previously. Same for the case that immediately follows that one ("bug Bug: runcpf with full trace and qlims #12 : early termination").

@abhyshr
Copy link
Author

abhyshr commented Oct 13, 2017 via email

@rdzman
Copy link
Member

rdzman commented Oct 13, 2017

Very strange. All of those failing tests are working fine for me. Did you try with a fresh Matlab session?

@rdzman
Copy link
Member

rdzman commented Oct 13, 2017

Looks like the Travis CI build is consistent with my local results as well. It would appear the errors you are seeing are triggered by something in your local setup. If a fresh clone in a fresh Matlab session gives the same results, then we'll have to start digging further.

@abhyshr
Copy link
Author

abhyshr commented Oct 13, 2017

Works fine for me with the fresh clone, sorry for the noise. Modifying the direction calculation code to

if(nx.lam > px.lam)
   opts.tol = 1e-3;
   direction = sign(min(real(eigs(J,1,'SR',opts))));   
end

resolves the failing tests for 9-bus case.

For the 300-bus case, the eigs solver was diverging so I relaxed its tolerance to 1e-3 as suggested online. The eigs solver converges but shows that the Jacobian has negative eigen values when the first limit is encountered. This indicates the operating point has transitioned from the stable to unstable manifold. However, if I comment out the direction check code, \lambda keeps increasing with decreasing voltages suggesting the operating point is on the stable manifold! This is confusing making me unsure if the eigen values are being computed correctly or not.

@jl-marin
Copy link
Collaborator

Please take into account that case300 is already on the unstable manifold, in the base case scenario. Bus 191 is the culprit; it is on the unstable side of its V-Q curve.

Shri Abhyankar added 2 commits November 29, 2017 12:42
… from stable to unstable manifold.

Elis Nycander, https://www.mail-archive.com/matpower-l@cornell.edu/msg06048.html, brought up a case where the operating point moves from stable to unstable manifold. Once on the unstable manifold, the continuation curve moves in the direction of lambda increase, which seems intuitively opposite to expected behavior (progress along the decreasing lambda direction). The reason for the lambda increase direction when on unstable manifold is because the tangent direction was always set towards lambda increase. This fix checks whether the operating point is on stable or unstable manifold (by checking the sign of minimum eigen value) and changes the direction accordingly. When on stable manifold, an increasing lambda direction is set, while a decreasing lambda direction on unstable manifold.

Relevant discussion can be found here MATPOWER#21
@rdzman
Copy link
Member

rdzman commented Dec 4, 2017

What's the current status of this PR? I'd like to get it back in sync with the master branch and merged in as soon as we have something we're comfortable with that is passing all tests.

abhyshr pushed a commit to abhyshr/matpower that referenced this pull request Dec 5, 2017
…s for issues pointed out in PR MATPOWER#25.

i) Change the tangent direction after switching based on the sign of the product of current tangent direction and the
sign of	the smallest real eigen value for Jacobian. This resolves issues where the PV curve seems to turn
unnaturally (go in the opposite direction) after PV->PQ switching. 9-bus test case.
ii) Use tolerance 1e-3 for eigen value calculation. This resolves the crashing of the failing test for 300-bus case w/Qlims.
iii) Check for buses having negative V-Q sensitivity. This is done by checking for positive dQ_dV elements in the tangent vector z. If found, previous tangent direction is retained. Otherwise, a new direction is calculated as per (i). This resolves the failing 300-bus w/Q lims. (Thanks J. Marin!)

All test cases pass with the above fixes.
abhyshr pushed a commit to abhyshr/matpower that referenced this pull request Dec 5, 2017
…s for issues pointed out in PR MATPOWER#25.

i) Change the tangent direction after switching based on the sign of the product of current tangent direction and the
sign of	the smallest real eigen value for Jacobian. This resolves issues where the PV curve seems to turn
unnaturally (go in the opposite direction) after PV->PQ switching. 9-bus test case.
ii) Use tolerance 1e-3 for eigen value calculation. This resolves the crashing of the failing test for 300-bus case w/Qlims.
iii) Check for buses having negative V-Q sensitivity. This is done by checking for positive dQ_dV elements in the tangent vector z. If found, previous tangent direction is retained. Otherwise, a new direction is calculated as per (i). This resolves the failing 300-bus w/Q lims. (Thanks J. Marin!)

All test cases pass with the above fixes.
@abhyshr
Copy link
Author

abhyshr commented Dec 5, 2017

Sorry for the delay. Can you please take a look at this PR. I've updated the logic for the tangent direction and have rebased off the current master. All test cases are passing.

…s for issues pointed out in PR MATPOWER#25.

i) Change the tangent direction after switching based on the sign of the product of current tangent direction and the
sign of	the smallest real eigen value for Jacobian. This resolves issues where the PV curve seems to turn
unnaturally (go in the opposite direction) after PV->PQ switching. 9-bus test case.
ii) Use tolerance 1e-3 for eigen value calculation. This resolves the crashing of the failing test for 300-bus case w/Qlims.
iii) Check for buses having negative V-Q sensitivity. This is done by checking for positive dQ_dV elements in the tangent vector z. If found, previous tangent direction is retained. Otherwise, a new direction is calculated as per (i). This resolves the failing 300-bus w/Q lims. (Thanks J. Marin!)

All test cases pass with the above fixes.
@rdzman
Copy link
Member

rdzman commented Dec 5, 2017

It looks good to me. I will plan to merge it tomorrow unless someone objects. @ElisNycander or @jl-marin, any comments? This should take care of #23.

…on direction after potential change from stable to unstable manifold.

(or vice versa)
@rdzman rdzman force-pushed the shri/cpf/manifold-change-detection-and-switching branch from 1f5ccee to 3d1e935 Compare December 6, 2017 15:22
@rdzman rdzman merged commit 3d1e935 into MATPOWER:master Dec 6, 2017
rdzman added a commit to MATPOWER/mp-element that referenced this pull request May 3, 2021
rdzman added a commit that referenced this pull request May 3, 2021
Addresses direction switching based on whether a bus type conversion results in a jump from stable to unstable manifold.

Ref: #23
Ref: #25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants