Ask Your Question
0

Plotting .out of PSSEv32 with python 2.5 code

asked 2017-11-10 07:50:51 -0500

sofiguer gravatar image

Hi everybody,

I'm doing so quite lot of tests and simulations withs PSSE v32 and I'm using python 2.5 for that.

As I'm doing lot of testing and simulations with a python code and PSSE v32, everytime I finish a simulation I have to go to PSSPLT program and open de .out file to see and evaluate the results.

I would like be able to plot some channels automatically from python code, instead to use PSSPLT and I found that I have to use dyntools. But I don't know how to used properly, somebody can help me with that?.

Also I would like to know if matploit can be use with python 2.5 I think is another way to plot do it but as I read works only for recent versions of python and not with 2.5.

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-11-15 00:57:43 -0500

zezo510 gravatar image

First let me start by saying that PSSPLT is the worst tool of plotting anything in recorded human history.

I have a simple python code to plot a single channel from an out/outx file. It can be modified to plot any number of channels. However, it is working with PSSE33 and python27. I tried to use matplotlib with python25 but couldn't. I would recommend you install PSSE33 or 34 and run this python file. Don't worry you wont need to repeat your simulations as you can plot any out file from any PSSE version. Also with PSSE 33 and 34 you can always use PSSE's plotting GUI which is very stable and actually quite descent.

import os
import sys

def add_psse_path():
    PSSEdir = str('C:\Program Files (x86)\PTI\PSSE33') # Determine PSSE Path By Default : C:\Program Files\PTI\PSSE33
    PSSEbinDir = os.path.join(PSSEdir,'PSSBIN')
    os.environ['PATH'] = PSSEbinDir + ';' + os.environ['PATH']
    sys.path.insert(0,PSSEbinDir) # Add [ C:\Program Files (x86)\PTI\PSSE33\PSSBIN ] to Python Lib Path
    return "PSSE path added"


add_psse_path()

import redirect
redirect.psse2py()
import psspy
import dyntools
psspy.throwPsseExceptions = True

import matplotlib.pyplot as plt

outfile = r"""outfile location"""
chnfobj = dyntools.CHNF(outfile)
short_title, chanid, chandata = chnfobj.get_data()

print short_title
print chanid
print chandata

t = chandata['time']
f = chandata[1]
v = chandata[2]

fig = plt.figure()
fig.patch.set_facecolor('0.8')
ax1 = plt.subplot2grid((1,1),(0,0))
ax1.plot(t,v,'g-', linewidth=1,label="Voltage")
axes = plt.gca()
plt.grid(linestyle='--', color='grey',linewidth=0.5,which='both')
plt.xlabel("Time")
plt.ylabel("Volt")
plt.title("\nVoltage\n")
plt.legend()
axes.set_facecolor('w')
axes.set_ylim([0.6,1.2],)
axes.set_xlim([0,10])
plt.savefig(r"""C:\Users\XXX\Desktop\Voltage.pdf""",dpi=fig.dpi,facecolor='0.8')
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

1 follower

Stats

Asked: 2017-11-10 07:50:51 -0500

Seen: 731 times

Last updated: Nov 15 '17