Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

zezo510 code did not work on my pc. I made a few mods to get it run in/out of the PSSe GUI:

import os,sys
#---User vars   -----------------
outfile = r"""bus154_fault.out"""
chani   = 41
psseversion = 33
#--------------------------------
if psseversion== 34 or psseversion== 33:
   exec('import psse%s'%psseversion)
else:
   pssepath = r"C:\Program Files (x86)\PTI\PSSE%s\PSSBIN"%psseversion
   if pssepath not in sys.path:
      sys.path.append(pssepath)
#--------------------------------
import psspy
#psspy.psseinit(15000)
#--------------------------------
import dyntools
import matplotlib.pyplot as plt

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

t = chandata['time']
v = chandata[chani]              #based on the channel identifier set in the dynamic simulation

fig = plt.figure()
fig.patch.set_facecolor('0.8')
plt.plot(t,v,linestyle='-', linewidth=1, color='green',label="Voltage")     #change ax1. to plt.
plt.grid(linestyle='--', color='grey',linewidth=0.5)
plt.xlabel("Time")
plt.ylabel("Voltage")
plt.legend()
axes = plt.gca()
#axes.set_facecolor('w')            #<- produce error
#axes.set_ylim([0.6,1.2])
axes.set_xlim([0,10])
plt.savefig(r"""figure.pdf""",dpi=fig.dpi,facecolor='0.8')
plt.show()

For plot code from dyntools,check also the post "Plot Legend For Dyntools." zezo510 code did not work on my pc. I made a few mods to get it run in/out of the PSSe GUI:

import os,sys
#---User vars   -----------------
outfile = r"""bus154_fault.out"""
chani   = 41
psseversion = 33
#--------------------------------
if psseversion== 34 or psseversion== 33:
   exec('import psse%s'%psseversion)
else:
   pssepath = r"C:\Program Files (x86)\PTI\PSSE%s\PSSBIN"%psseversion
   if pssepath not in sys.path:
      sys.path.append(pssepath)
#--------------------------------
import psspy
#psspy.psseinit(15000)
#--------------------------------
import dyntools
import matplotlib.pyplot as plt

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

t = chandata['time']
v = chandata[chani]              #based on the channel identifier set in the dynamic simulation

fig = plt.figure()
fig.patch.set_facecolor('0.8')
plt.plot(t,v,linestyle='-', linewidth=1, color='green',label="Voltage")     #change ax1. to plt.
plt.grid(linestyle='--', color='grey',linewidth=0.5)
plt.xlabel("Time")
plt.ylabel("Voltage")
plt.legend()
axes = plt.gca()
#axes.set_facecolor('w')            #<- produce error
#axes.set_ylim([0.6,1.2])
axes.set_xlim([0,10])
plt.savefig(r"""figure.pdf""",dpi=fig.dpi,facecolor='0.8')
plt.show()

For plot code from dyntools,check also the post "Plot Legend For Dyntools." Dyntools" or "chanplot.py = dyntools_demo.py with function calls." zezo510 code did not work on my pc. I made a few mods to get it run in/out of the PSSe GUI:

import os,sys
#---User vars   -----------------
outfile = r"""bus154_fault.out"""
chani   = 41
psseversion = 33
#--------------------------------
if psseversion== 34 or psseversion== 33:
   exec('import psse%s'%psseversion)
else:
   pssepath = r"C:\Program Files (x86)\PTI\PSSE%s\PSSBIN"%psseversion
   if pssepath not in sys.path:
      sys.path.append(pssepath)
#--------------------------------
import psspy
#psspy.psseinit(15000)
#--------------------------------
import dyntools
import matplotlib.pyplot as plt

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

t = chandata['time']
v = chandata[chani]              #based on the channel identifier set in the dynamic simulation

fig = plt.figure()
fig.patch.set_facecolor('0.8')
plt.plot(t,v,linestyle='-', linewidth=1, color='green',label="Voltage")     #change ax1. to plt.
plt.grid(linestyle='--', color='grey',linewidth=0.5)
plt.xlabel("Time")
plt.ylabel("Voltage")
plt.legend()
axes = plt.gca()
#axes.set_facecolor('w')            #<- produce error
#axes.set_ylim([0.6,1.2])
axes.set_xlim([0,10])
plt.savefig(r"""figure.pdf""",dpi=fig.dpi,facecolor='0.8')
plt.show()