First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
import os, sys
PSSE_PATH = r'C:\Program Files\PTI\PSSE35\35.3\PSSPY37'
sys.path.append(PSSE_PATH)
os.environ['PATH'] += ';' + PSSE_PATH
import psse35
import psspy
psse35.set_minor(3)
import redirect
redirect.psse2py()
import dyntools
import numpy
import matplotlib.pyplot as plt
outfile = r"C:\Program Files\PTI\PSSE35\35.3\EXAMPLE\Fault1.out"
chnfobj = dyntools.CHNF(outfile)
shorttitle, chanid, chandata = chnfobj.getdata()
t = chandata['time']
v = chandata[6] #based on the channel identifier set in the dynamic simulation
fig = plt.figure()
fig.patch.set_facecolor('0.8')
ax1 = plt.subplot2grid((1,1),(0,0))
ax1.plot(t,v,linestyle='-', linewidth=1, color='green',label="Voltage")
plt.grid(linestyle='--', color='grey',linewidth=0.5)
plt.xlabel("Time")
plt.ylabel("Voltage")
plt.legend()
axes = plt.gca()
axes.set_facecolor('w')
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()