I'm writing an app for batch processing contingency studies in PSSE 33 with various initial conditions. I'm running into a problem related to API routines psspy.accc_with_dsp_3()
and/or psspy.accc_single_run_report_4()
. My program ran just fine in PSSE 32 with routines psspy.accc()
and psspy.accc_single_run_report_3()
, and it works in Version 33 until I close it (i.e., call root.destroy()
on my Tkinter
window), at which point PSSE's progress window displays
AC Contingency analysis results "PATH/file.acc" are ready for graphical display
and then PSSE crashes. If I wait a few minutes after my program runs or if I delete the last generated *.acc file, PSSE no longer crashes when I close my app, which tells me the problem may have something to do with PSSE processing the *.acc file.
Here's a portion of the code:
psspy.dfax([0, 1],
sub_file,
mon_file,
con_file,
dfx_file)
psspy.accc_with_dsp_3(accc_opt1,
accc_opt2,
"",
dfx_file,
acc_file,
"", "", "")
psspy.lines_per_page_one_device(1, 10000)
psspy.report_output(2,
dat_file,
[0, 0])
psspy.accc_single_run_report_4(rpt_opt1,
rpt_opt2,
rpt_opt3,
acc_file)
psspy.close_report()
psspy.close_powerflow()
According to PTI Support,
PSSE 33 is built using Microsoft C/C++ (MSC) version 10 compiler (corresponds with Microsoft Visual Studio 2010). Python 2.7 (hence Tkinter module) is built with Microsoft C/C++ version 9 compiler (corresponds with Microsoft Visual Studio 2008). In order for Python 2.7 to work from inside of PSSE33 GUI, PTI has re-compiled Python 2.7 and some other essential Python modules using Visual Studio 2010. We have experienced such crashes with wxPython, Tkinter. In case of wxPython apps, I have seen that when you run wxPython as dialog instead of "mainloop app", you can avoid such crashes. I wonder, if you write Tkinter dialog to call from PSSE, will that avoid such crash. The best solution would be to run PSSE and your script which uses Tkinter from any Python Interpreter, like IDLE (Start >Programs >Python 2.7 >IDLE). This will avoid the crashes you are seeing.
This is not a satisfactory answer, since it means that user-defined Custom Tools in PSSE 33 are less functional than in previous versions. Can anyone suggest a better workaround?
I'm running PSSE 33.7.0, Python 2.7.9 and Tkinter 8.5 on Windows 7.