Ask Your Question

Python threads in PSSE

asked 2012-12-10 05:08:10 -0500

zeeegis gravatar image

updated 2012-12-10 05:09:49 -0500

I tried to implement wxPython aplication with additional thread for calculations and update wxPython progress dialog within that thread. But psse crashes all the time.

So after that i tried to run really simple multithread python script in psse and it also caused psse crash. There is simple multithread psse script

import threading
import time

class TestThread(threading.Thread):
    def __init__(self):

    def run(self):
        for i in range(0, 60, 3):
            print "T2: ", i

for i in range(0, 60, 2):
    print "T1: ", i

So my question is does psse allow to use threads in python script?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2012-12-11 00:39:05 -0500

JervisW gravatar image

I followed your advice. Starting the thread also caused my PSSE instance to hang. There wasn't any error message, but the program never finished.

I changed the program so that there were no sleep statements at all, so it should have finished very quickly, but still PSSE wasn't able to run the program to completion. It just becomes non-responsive.

It may be that you are unable to run threads from inside of the PSSE program. Here is how to run a loadflow inside a thread, from outside of PSSE.

import sys
import os
import threading
import time

PSSE_LOCATION = r'c:/program files/pti/psse32/pssbin'
os.environ['PATH'] += ';' + PSSE_LOCATION

import psspy
psspy.throwPsseExceptions = True

class RunLoadflow(threading.Thread):
    def __init__(self, savefilename):
        super(RunLoadflow, self).__init__()
        self.casename = savefilename

    def run(self):

CASENAME = r"c:/program files/pti/psse32/example/savnw.sav"
thread = RunLoadflow(CASENAME)

This might help you restructure your Python code so that it runs outside of the PSSE program.

edit flag offensive delete link more


This looks right to me. I am attempting to do a similar thing. For some reason the sleep function causes the thread to hand in PSSE, even from the command line.

KyleA gravatar imageKyleA ( 2013-06-21 15:15:55 -0500 )edit

An additional question, have you tried running multiple threads in parallel? I get some strange results with cases apparently crossing up each other. Is there a known way to force PSSE to keep itself separate when initialized multiple times?

KyleA gravatar imageKyleA ( 2013-06-21 15:16:53 -0500 )edit

answered 2017-10-05 23:56:29 -0500

Check this one...python thread basics

edit flag offensive delete link more

answered 2012-12-24 00:57:03 -0500

The Bull gravatar image

Can someone please tell me about the basics of Python Programming ??? I mean where should i write my program how to link it with PSSE and how to get it simulated . PLEASE!

edit flag offensive delete link more


Here's a tutorial page for PSSE + Python that we wrote. I'm adding stuff all the time, so let me know if you think of other topics to put on i!!

JervisW gravatar imageJervisW ( 2012-12-24 03:18:10 -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-12-10 05:08:10 -0500

Seen: 817 times

Last updated: Oct 05