reattempt solve if iteration limit is reached
How can I reattempt to solve using the full newton raphson method when the 20 iteration limit is reached?
How can I reattempt to solve using the full newton raphson method when the 20 iteration limit is reached?
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
ITERATION_LIMIT = 1
def solve_and_reattempt(attempts=3):
    for attempt in range(attempts):
        try:
            return psspy.fnsl()
        except psspy.FnslError:
            # an error solving, if iteration limit reached resolve
            if psspy.solved() == ITERATION_LIMIT:
                continue
            #  else re-raise Error
            else:
                raise
 and you would use the solve_and_reattempt function like this:
solve_and_reattempt(attempts=2)
 Hi JervisW,
You may increase the maximum number of iterations to something like 100 or more: Power Flow > Solution > Parameters > ITMXN
regards, chiangm
 
                
                whit loves you.      Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.