Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A channel ID is needed to extract simulation data from the OUT file. The channel id allocation depends in the case and sequence of channel declaration. To keep the 'run process' and the 'output data extraction process' in the same python code, run twice, once to ID the target channels and second to create the data matrix. The code below will follow after the end of the run [it assumes that target channel ID are 3 and 5]:

psspy.run(0,150,1,1,0)     #the end of the run process
#psspy.pssehalt_2()         #commented to avoid PSSe quitting
import dyntools              #not needed if done 'above in your code'
ch = dyntools.CHNF(OutFile)  
short_title, chanid_dict, chandata_dict = ch.get_data()
#print chanid content to id target channels
for key,val in chanid_dict.items():
      print key, val
#retrieve selected channel data from chandata_dict
timevec= chandata_dict['time']
Pxvec  = chandata_dict[3]                   # update channel id as needed
Qxvec  = chandata_dict[5]                   # update channel id as needed
PQmat  = zip(timevec,Pxvec,Qxvec)
print "first 5 row of 'matrix'"
for i in range(5):
      print PQmat[i][0],PQmat[i][1],PQmat[i][2]