Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In the past I've gone the path Jervis has recommended. In my case, the issue was that PSSE would crash during the fault list or have a criteria violation.

Python was in control using the subprocess command to launch PSSE with an IDEV argument. It was kind of a hack-job but basically it would periodically check if the PSSE process was still running and also scan the log file for violation notifications. If violations were detected, then it would kill the process, make some modifications, and re-run it.

I guess the important question is - what is causing your simulations to hang? What is the best way to detect this condition?

Here's some code below that can be improved upon. The idev it's launching is "run_stab_wvoltage". I remember the first argument to Popen being somewhat sensitive to special characters.

import subprocess
try: #to open pss/e with the newly created idv.
        pssdsInstance = subprocess.Popen(
         ["C:\\progra~1\\pti\\psse30\\pssbin\\PSSDS430.exe",  '-buses','80000','-inpdev', 'run_stab_wvoltage.idv'],
         cwd= activation_path + "\\" + case + "\\", #path where launching PSSE from
         shell=False,
         creationflags=512|16 #CREATE_NEW_PROCESS_GROUP|CREATE_NEW_TERMINAL
        )
        logging.info( "PSSE Successfully Launched! Running %s\%s\%s at %d MW" % (case, condition, faultName, faultMW))
except:
        logging.warning( "ERROR WITH POPEN and PSS/E")

I then used the following commands to see/modify what the process was up to, although you could certainly do something fancier.

pssdsInstance.poll()       #Still running?
pssdsInstance.terminate()  #Kill the process

Good luck!