Ask Your Question

reattempt solve if iteration limit is reached

asked 2012-01-05 01:05:44 -0500

JervisW gravatar image

updated 2012-01-05 01:10:37 -0500

How can I reattempt to solve using the full newton raphson method when the 20 iteration limit is reached?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-01-15 01:25:42 -0500

jtrain gravatar image

To do this programmatically, I use the solved function. It looks at the last solution and returns an error code > 0 if there was a problem and returns 0 for no problem.

Assuming you have psspy.throwPsseExceptions = True near the start of your file:

import psspy
psspy.throwPsseExceptions = True

def solve_and_reattempt(attempts=3):
    for attempt in range(attempts):

            return psspy.fnsl()

        except psspy.FnslError:

            # an error solving, if iteration limit reached resolve
            if psspy.solved() == ITERATION_LIMIT:
            #  else re-raise Error

and you would use the solve_and_reattempt function like this:

edit flag offensive delete link more

answered 2012-01-11 04:45:42 -0500

chiangm gravatar image

Hi JervisW,

You may increase the maximum number of iterations to something like 100 or more: Power Flow > Solution > Parameters > ITMXN

regards, chiangm

edit flag offensive delete link more


Nice, I didn't know about increasing the solution parameters. What if I wanted to check if the iteration limit is reached in my script?

jtrain gravatar imagejtrain ( 2012-01-11 05:42:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools


Asked: 2012-01-05 01:05:44 -0500

Seen: 696 times

Last updated: Jan 15 '12