Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

var outvrsn takes an INT. Enter 0 for old out format, 1 for new outx format.

What do you do with the extracted data?

var outvrsn takes an INT. Enter 0 for old out format, 1 for new outx format.

What do you do with the extracted data?The code below runs on PSSe33, it will extract data to excel, plot using matplotlib and then save to a pdf:

import matplotlib.pyplot as plt
import psse33
import dyntools

#user data
outfile = r"""outs\Bus152_6cycles.out"""
chan = 3
#data extraction from OUT file
chnfobj = dyntools.CHNF(outfile,outvrsn=0)
short_title, chanid, chandata = chnfobj.get_data()
#export
XLSfile = 'channels.xls'
chnfobj.xlsout(channels=[chan,],outfile=outfile,
               xlsfile=XLSfile,show=False)
#plotting
label0= chanid[chan].split()[0]
label = chanid[chan]
x = chandata['time']
y = chandata[chan]
plt.plot(x,y,label=label)
plt.grid()
plt.xlabel("Time")
plt.ylabel(label0)
plt.legend()
plt.show()
#save to pdf
plt.savefig(r"""%s_chan%s.pdf"""%(label0,chan))