Ask Your Question
0

Connection between Python and an already running PSSE-process

asked 2015-09-29 08:41:44 -0500

Gusimurrvl gravatar image

updated 2015-09-30 11:02:22 -0500

Hello.

Ok. So I opened up a PSSE-process manually in windows. Is there a way to connect to this PSSE-process from my python program so that I can collect its data thats in the working case?

Calling psspy.psseinit() is not the answer because it initializes a new PSSE-process which is run in the background and that I can't see graphically.

I want to be able to access the data from the manually started graphical PSSE-process from Python. If there is no way of doing that, is there then a way of initializing a new PSSE-process (psseinit()) and then making this PSSE-process run open, graphically, in Windows? I don't want to have it running in the background.

The idea of my program is to let PSSE modify the network graphically with split bus, switch off line and other commandos and what the python part is to do it so tell PSSE when to make Fault calculations and then collect the fault data and present it graphically in my own python program instead of as text it the PSSE Output Bar.

Kind regards

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-09-29 09:40:28 -0500

jconto gravatar image

updated 2015-09-30 15:06:05 -0500

Assuming P1 is the python code running the main process and P2 running the short circuit calculations, then just bypass the opening of the *.sav case in your P2 code. Then P2 should work with whatever case in is memory (P1 and the working case). You can add your P2 code to P1 or you can call it from within P1 using the execfile() python command. There is no need to open a second PSSe instance in its GUI.

When having two PSSe instances (in GUI or not), there is no way for either instance to talk to the other to get data other than through saving data externally (*.txt, *.csv)

edit flag offensive delete link more

Comments

Thanks for your answer but after some thinking I realised I asked the wrong question. I've edited the question now. @jconto

Gusimurrvl gravatar imageGusimurrvl ( 2015-09-30 11:09:20 -0500 )edit

update my initial response as well. Let's keep trying if not satisfied.

jconto gravatar imagejconto ( 2015-09-30 15:07:12 -0500 )edit

Ok. Check. I cant communicate between different instances of PSSE. Won't try to any more. Do you know if its possible to open the PSSE instance graphically that was initiated when calling psseinit() from python? I cant find the PSSE instance in the windows task bar list even though its running.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-01 09:07:46 -0500 )edit

Once you start a run from python and call psseinit(), PSSe is 'not loaded' but all its functions are available through the API. In this mode, switching the GUI on/off is not supported. I suggest change the P1 code to run in PSSe GUI mode and from within, call P2.

jconto gravatar imagejconto ( 2015-10-01 10:08:03 -0500 )edit

Choice No. 1 for running my program is by opening PSSe GUI and loading my script with "Run automation file". I've been struggeling for 3 days trying to get that to work.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:15:35 -0500 )edit

Problem is that my PSSe V33.4 get ImportError when trying to "import wx" in PSSe. My program is all written with wx as base for the GUI. .... File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in <module> import _core_ ImportError: DLL load failed: cant find module

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:17:25 -0500 )edit

Ok. Then I know that my choice No. 2 and No.3 for running my program isn't possible because (correct me if im wrong): Choice No.2 - I can't open PSSE GUI graphically after calling psseinint() from python.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:18:37 -0500 )edit

Choice No.3 - I can't establish contact between an already running GUI PSSe instance and my python code except via "Run automation File".

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:19:11 -0500 )edit

My last option/choice No.4 for my program is to run PSSe GUI seperate from my python program. The only way to get to the GUI PSSE working case data is to save it to a *.SAV-file, start python and psseinit() and load the *.SAV file.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:36:50 -0500 )edit

Everytime I want to try a new calculation based on an altered working case I got to save to a new *.SAV-file and then load that *.SAV from python. It wont make my program user friendly having to do those steps of saving and loading after every change i do in the PSSE GUI.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:36:59 -0500 )edit

I might have just gotten lucky! I contacted Siemens PSSe support and they affirmed that it's a bug in PSSe version 33.4 that you cant import wx but that there is an easy fix for fixing the problem. I'll write under "Answer" if it works.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:44:32 -0500 )edit

The Easy fix they said would work didn't work so still interested if you got any other ideas that could help me. I'll be in contact with Siemens now to try to get Option 1. to work.

Gusimurrvl gravatar imageGusimurrvl ( 2015-10-02 03:54:29 -0500 )edit
0

answered 2015-10-05 05:44:03 -0500

Gusimurrvl gravatar image

What I learned:

  1. PSSE Version 33.4 contains a bug so that you can't import module wx or cmath without getting ImportError respectively making PSSE and Python crash. The bug is fixed in version 33.5 and 33.6 of PSSE so update your version of PSSE if you run into the problem. There is no quick-fix for the problem. Update your PSSE version instead!
  2. You can't open PSSE GUI graphically after calling psseinint() from python.
  3. You can't establish contact between an already running GUI PSSe instance and python code EXCEPT via "Run automation File".
edit flag offensive delete link more

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

Stats

Asked: 2015-09-29 08:41:44 -0500

Seen: 3,721 times

Last updated: Oct 05 '15