Ask Your Question
0

How to make a conditional statement based on PSSE output file?

asked 2014-06-17 13:55:04 -0500

Russt62 gravatar image

Hello everyone.

I'm trying to automate Dynamic analysis. Has anyone written a conditional statement based on a PSSE output file? I want to run a loop based on system frequency in a dynamic simulation.

Thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-07-09 18:35:35 -0500

jconto gravatar image

can you expand on what kind of logic you need to have in the loop, based on a frequency value after a simulation is completed? based on instantaneous value or average value, with or without delay? To interact with a variable during a simulation is better to use a user-defined model, developed in Fortran, though it is more complicated.

edit flag offensive delete link more
0

answered 2014-07-08 09:37:37 -0500

nwilson gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2014-06-17 13:55:04 -0500

Seen: 920 times

Last updated: Jul 09 '14