0

Saving “.out” file in Excel format

I am running a dynamic simulation in python. My output file is in ".out" format. I want to save bus voltage 1101 in excel format. how can I do it with programming in python. My code is as follow:

import os,sys
PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE32\PSSBIN'

sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH

import psspy
from psspy import _i
from psspy import _f
import redirect

# Redirect output from PSSE to Python:
redirect.psse2py()

# Last case:
CASE = r"C:\Users\N.JAHAN\Desktop\2015_RVS_Test_System.sav"
psspy.psseinit(12000)
psspy.case(CASE)

# Convert loads (3 step process):
psspy.conl(-1,1,1)
psspy.conl(-1,1,2,[0,0],[100,0,0,100])
psspy.conl(-1,1,3)

# Convert generators:
psspy.cong()

# Solve for dynamics
psspy.ordr()
psspy.fact()
psspy.tysl()

# Save converted case
case_root = os.path.splitext(CASE)[0]
psspy.save(case_root + "_C.sav")

# Add dynamics data
psspy.dyre_new(dyrefile=r"C:\Users\N.JAHAN\Desktop\2015_RVS_Test_System - 
Copy.dyr")

# Add channels by subsystem
#   BUS VOLTAGE

psspy.chsb(sid=0,all=1, status=[-1,-1,-1,1,13,0])

# Add channels individually
#   load active and reactive power
psspy.load_array_channel([-1,1,1101],'1')
psspy.load_array_channel([-1,2,1101],'1')

# Save snapshot
psspy.snap(sfile="C:\Program Files 
(x86)\PTI\PSSE32\EXAMPLE\python_test.snp")
#psspy.dynamics_solution_param_2([_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f, 
0.002,_f,_f,_f,_f,_f])
# Initialize
psspy.strt(outfile="C:\Program Files (x86)\PTI\PSSE32\EXAMPLE\python_test.out")
psspy.run(tpause=1)

# 3-phase fault on bus 201 (default bus fault is a 3phase and there is no bus 200)
psspy.dist_bus_fault(ibus=103)

# Run to 5 cycles
time = 1+(5.0/60.0)
psspy.run(tpause=time)

#  Clear fault (assuming only part of bus faults)
psspy.dist_clear_fault()
psspy.dist_branch_trip(ibus=103, jbus=109, id='1')
#psspy.dist_machine_trip(3011,'1')

# Run to 10 seconds
 time = 5
 psspy.run(tpause=time)

Please answer I really need it. when the simulation is finished, I want to see bus voltage 1101 in an Excel file. Thanks.

Amir90's avatar
1
Amir90
asked 2017-08-09 14:17:16 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Check posting "How can I get only certain channels from .out file to excel? e.g only angles" or search for "dyntools". The dyntools_demo.py code (located at the example folder, within the PSSe installed folder) contains code to deal with channels from an OUT file. Or you can use the "channels" tools for your export.

jconto's avatar
2.9k
jconto
answered 2017-08-09 14:48:50 -0500
edit flag offensive 0 remove flag delete link

Comments

Can you write that code for me such that matches with above code.

Amir90's avatar Amir90 (2017-08-09 15:10:36 -0500) edit

Check the post "TIME ARRAY EXTRACTION" for a code example. You need to know the channels id. Better, use the tool in post "Channels - tool to process outs files"

jconto's avatar jconto (2017-08-09 19:59:48 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer