First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Need Python Script to Open PSSE v34

asked Feb 22 '1

damiensommer gravatar image

updated Feb 22 '1

I have a python script I've been using to for a few years that would open PSSE and run some analysis for me if I just double clicked the .py script from my virtual desktop. I really liked that I didn't have to open PSSE and then load the python script. This is the code that is in my script that used to work in v33 to open PSSE and get it ready to run my functions:

import os,sys
PSSBINPATH = r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN"
sys.path.append_PSSBINPATH)
os.environ['PATH'] = PSSBINPATH + ';' + os.environ['PATH']
import psspy, redirect, re
redirect.psse2py()
psspy.psseinit(150000)
import dyntools
import csv

I've tried a number of things I've seen on this forum to get it to open PSSE for me but nothing has worked. I updated the OS path to PSSE34\PSSBIN and I've tried setting the system path to the PSSPY27 and PSSPY37 folders. Neither worked. I have PSSE v34.8 and my PSSE is using python version 2.7.13.

1 answer

Sort by » oldest newest most voted
1

answered Feb 22 '1

jconto gravatar image

Check the post "Python 3.7 w/ PSSE 34" for additional info. The 'auto' loading of a python script might not work with multiple python version, multiple PSSe versions on same machine.

Save the following as test34.py code:

import os, sys
PSSPY27PATH = r"C:\Program Files (x86)\PTI\PSSE34\PSSPY27"
sys.path.append(PSSPY27PATH)     #path to psspy for python 2.7
# import psse34                  #it replaces the above two lines
import psspy
import redirect
redirect.psse2py()
psspy.psseinit(150000)
import dyntools
import csv, re

Now, open explicitly the command prompt window (DOS window) provided with the installation of PSSe v 34, change directory to your working folder

c:\..>cd c:\...\wfolder

and type:

c:\..\wfolder>c:\python27\python test34.py
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

2 followers

Stats

Asked: Feb 22 '1

Seen: 914 times

Last updated: Feb 22 '21