1 | initial version |
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')