Ask Your Question
0

I want to plot .out file using channels voltage and time but i see an empty plot. Is .out file not read correctly? Please help

asked 2022-05-16 15:14:20 -0500

brownkid gravatar image

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()

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2022-05-16 16:34:37 -0500

jconto gravatar image

(Try to post the error messages too. It helps in debugging)

The offending command "chnfobj.getdata()" change it to "chnfobj.get_data()"

I also commented:

#axes.set_ylim([0.6,1.2])

since I do not know if chan 6 is or not a voltage channel. Now I got a plot.

To know the channel type, print the array chanid (giving in dictionary format) first then in a second pass, plot your selected channels accordingly to their type (set the y-axis range as needed).

edit flag offensive delete link more

Comments

Thankyou! I just commented axes.set_ylim([0.6,1.2]) and it worked!!!

brownkid gravatar imagebrownkid ( 2022-05-16 16:46:02 -0500 )edit

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

1 follower

Stats

Asked: 2022-05-16 15:14:20 -0500

Seen: 272 times

Last updated: May 16