Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's code that reads the PSSE output file and evaluates the data for a specific condition.

#dyntools contains the CHNF class for extracting channel data from .out files
#the dyntools library comes with PSSE
from dyntools import CHNF as ChanFile

threshold = 5   #set this to desired limit

#outfiles is a list of outfile paths
outfiles = ["c:\\results\\myout1.out","c:\\results\\myout2.out"]    #example

chnfall = ChanFile(outfiles)
#loop through outfiles
for outfile, clist in chnfall.chanid.iteritems():
    #loop through channels of each outfile
    for channelnum, channelname in clist.iteritems():
        #the last channel is the 'time' channel. We're ignoring it
        if channelnum <> 'time':
            print "Channel " + str(channelnum) + channelname
            if channelname == "gen1volt":
                #extract channel data from channel.
                #The CHNF class converts outfile names to lower case. Use the lower() function
                yvals = chnfall.chandata[outfile.lower()][channelnum]
                ymax = max(yvals)
                if ymax > threshold:
                    print "Threshold exceeded"
                    #perform action as a result of exceeded threshold