MATPOWER / MATPOWER/matpower

CPF Gets Stuck in While Loop with Adaptive Stepping Enabled Due to Tiny Step Sizes

Open
#279 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MATLAB
Stars
592
Forks
184
PR merge metrics
No merged PRs in 30d

Description

When running Continuation Power Flow (CPF) with adaptive stepping enabled 'cpf.adapt_step' = 1, the algorithm can get stuck in an infinite loop inside the main while ~done.flag loop. This occurs without triggering any rollback mechanisms. The root cause appears to be the adaptive step size shrinking to extremely small values (e.g., 1e-7 or smaller), causing the next predicted state to be effectively identical to the current state. As a result, the continuation parameter (lam) doesn't change, while event detection doesn't trigger terminations.

I reported the outputs when I met this problem as follows. Hope the author can fix this issue. Thank you very much!

step 235 : stepsize = 0.2 lambda = 4.293 2 corrector Newton steps
step 236 : stepsize = 0.2 lambda = 4.330 2 corrector Newton steps
step 237 : stepsize = 0.2 lambda = 4.367 2 corrector Newton steps
step 238 : stepsize = 0.2 lambda = 4.402 2 corrector Newton steps
step 239 : stepsize = 0.2 lambda = 4.676 5 corrector Newton steps
step 240 : stepsize = 0.0604 lambda = 4.676 1 corrector Newton steps
step 241a : stepsize = 0.121 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 241 : stepsize = 0.0967 lambda = 4.677 2 corrector Newton steps
step 242a : stepsize = 0.0183 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 242b : stepsize = 0.0143 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 242c : stepsize = 0.0112 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 242d : stepsize = 0.00884 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 242e : stepsize = 0.00701 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 242 : stepsize = 0.00558 lambda = 4.677 1 corrector Newton steps
step 243a : stepsize = 0.00114 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 243b : stepsize = 0.000902 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 243c : stepsize = 0.000717 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 243 : stepsize = 0.00057 lambda = 4.677 1 corrector Newton steps
step 244a : stepsize = 0.000117 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 244 : stepsize = 9.29e-05 lambda = 4.677 0 corrector Newton steps
step 245a : stepsize = 1.9e-05 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245b : stepsize = 1.51e-05 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245c : stepsize = 1.2e-05 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245d : stepsize = 9.57e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245e : stepsize = 7.6e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245f : stepsize = 6.04e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245g : stepsize = 4.8e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245h : stepsize = 3.82e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245i : stepsize = 3.04e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245j : stepsize = 2.41e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245k : stepsize = 1.92e-06 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 245 : stepsize = 1.52e-06 lambda = 4.677 0 corrector Newton steps
step 246a : stepsize = 3.13e-07 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 246 : stepsize = 2.49e-07 lambda = 4.677 0 corrector Newton steps
step 247a : stepsize = 5.1e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247b : stepsize = 4.05e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247c : stepsize = 3.22e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247d : stepsize = 2.56e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247e : stepsize = 2.04e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247f : stepsize = 1.62e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247g : stepsize = 1.29e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247h : stepsize = 1.02e-08 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247i : stepsize = 8.12e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247j : stepsize = 6.46e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247k : stepsize = 5.13e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 247 : stepsize = 4.08e-09 lambda = 4.677 0 corrector Newton steps
step 248 : stepsize = 8.37e-10 lambda = 4.677 0 corrector Newton steps
step 249a : stepsize = 3.42e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249b : stepsize = 2.71e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249c : stepsize = 2.16e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249d : stepsize = 1.72e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249e : stepsize = 1.36e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249f : stepsize = 1.08e-09 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249g : stepsize = 8.61e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249h : stepsize = 6.85e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249i : stepsize = 5.44e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249j : stepsize = 4.33e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249k : stepsize = 3.44e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249l : stepsize = 2.73e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249m : stepsize = 2.17e-10 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 249 : stepsize = 1.73e-10 lambda = 4.677 0 corrector Newton steps
step 250a : stepsize = 3.54e-11 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 250b : stepsize = 2.82e-11 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 250 : stepsize = 2.24e-11 lambda = 4.677 0 corrector Newton steps
step 251a : stepsize = 4.59e-12 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 251 : stepsize = 3.65e-12 lambda = 4.677 0 corrector Newton steps
step 252a : stepsize = 7.49e-13 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 252b : stepsize = 5.95e-13 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
step 252c : stepsize = 4.73e-13 lambda = 4.679 3 corrector Newton steps ^ ROLLBACK
...
step 1552 : stepsize = 1.4e-15 lambda = 4.677 0 corrector Newton steps
step 1553 : stepsize = 1.4e-15 lambda = 4.677 0 corrector Newton steps
step 1554 : stepsize = 1.4e-15 lambda = 4.677 0 corrector Newton steps
step 1555 : stepsize = 1.4e-15 lambda = 4.677 0 corrector Newton steps

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the main while ~done.flag loop with 'cpf.adapt_step' = 1 enabled, focusing on how shrinking step sizes affect lam and event detection. Reproduce the reported progression toward a step size near 1e-15, then ensure the CPF run cannot remain in the loop when the predicted state and continuation parameter stop changing.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.