Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

To answer this I might need to make some guesses at how your program was written. Let me know if I've guessed incorrectly anywhere:

import psspy

def run_dynamic_study(caseFile, convertldv, dynDate):
    psspy.psseinit(150000)
    psspy.case(caseFile)
    psspy.runrspnsfile(convertIdv)
    psspy.dyre_new([1,1,1,1],dynDate,"1","1","1")
    psspy.strt(1,"")
    ierr = psspy.run(1,1,60,1,5)
    psspy.pssehalt_2()
    return ierr

dynamic_info = [("casefile1.sav", "dynamics.idv", "dynamics-10-10-2012.dyr"),
                ("casefile2.sav", "dynamics.idv", "dynamics-11-10-2012.dyr")]

for caseFile, convertIdv, dynDate in dynamic_info:
    ierr = run_dynamic_study(caseFile, convertIdv, dynDate)
    if ierr: 
        print "Got ierr=%d" % ierr
        break

I'm not entirely sure what the problem with your script is just yet - there is too little information. It sounds like Python enters an endless loop somewhere and you get a message like "Python has stopped responding".

You might be using a while loop instead of my for loop, and your program never exits the while loop.

There may also be an error from any one of those psspy function calls. Here is a method for finding where your program has an error quickly:

import psspy
psspy.throwPsseExceptions = True

Write that second line: psspy.throwPsseExceptions = True. It will stop (crash) your program and show you exactly where one of your psspy function calls has an error, now you don't have to play a guessing game, or pass ierr codes around your program.

Update your question once you've had a chance to try out some of these ideas