Ask Your Question
1

.out output file + excel

asked 2012-11-21 05:03:26 -0500

ShandaF gravatar image

Easy to load .out files into Excel? Not sure where to look at all. Can anyone give pointers?

I opened a .out file with Microsoft Wordpad and it was a jumble of letters and numbers and exclamation marks.

thanks ahead

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2012-11-21 10:17:43 -0500

waltterval gravatar image

updated 2012-11-26 09:37:44 -0500

You can not do it. .out is a binary file, you can not open with excel, notepad or any program different that PSSE.

PSSE has a tool to export the data to excel file.

Regards, Waltter

EDITED Example to export to excel

import os
import sys
import numpy as np

# Ajustamos las variables de entorno para el PSSE
sys.path.insert(0,r"C:\Archivos de programa\PTI\PSSE33\PSSBIN")
os.environ['PATH'] = r"C:\Archivos de programa\PTI\PSSE33\PSSBIN" + ";" + os.environ['PATH']
import excelpy
import dyntools

# Para la información de las frecuencias
contingenciaf = ["Contingencia"]
nodos = ["nodo"]
nfmin = ["fmin"]
nfmax = ["fmax"]
nffinal = ["ffinal"]

"""
Comienza a extraer la información para cada uno de los *.out
"""
OutNames = [Out1, Out2]
Ruta = os.getcwd()


for OutName in OutNames:
    rootDir = Ruta + "\\"
    logFile = file(rootDir + "Reporte_" + OutName + "_Din.txt", "w")
    logFile1 = file(rootDir + "Errores_" + OutName + "_Din.txt", "w")
    sys.stdout = logFile  # Las salidas
    sys.stderr = logFile1  # Los errores

    outFile = dyntools.CHNF(OutName + ".out")

    #Extrae información del archivo *.out
    short_title, chanid_dict, chandata_dict = outFile.get_data()

    # Datos de las frecuencias
    freq_chanList = range(51, 62)
    for freqchan in freq_chanList:
        frecuencia = np.add(np.multiply(np.array(chandata_dict[freqchan]), 60), 60)
        nfmin.append(frecuencia.min())
        nfmax.append(frecuencia.max())
        nffinal.append(frecuencia[len(frecuencia) - 1])
        nodos.append(chanid_dict[freqchan])
    for n in range(1,(len(freq_chanList) + 1)):
        contingenciaf.append(OutName)

    logFile.close()
    logFile1.close()

""" Crea los reportes en formato csv """
reporte = Ruta + '\\' + u'InfoDinámica.xlsx'
xl = excelpy.workbook(xlsfile=reporte, sheet="Frecuencia",
                              overwritesheet=True, mode='w')
xl.show_alerts(False)

# Reporte de Frecuencias
xl.worksheet_add_end(sheet="Frecuencia")
xl.set_range(1, 'a', zip(contingenciaf))
xl.set_range(1, 'b', zip(nodos))
xl.set_range(1, 'c', zip(nfmin))
xl.set_range(1, 'd', zip(nfmax))
xl.set_range(1, 'e', zip(nffinal))

xl.save(reporte)
xl.close()
edit flag offensive delete link more

Comments

@waltterval - is there any way to read the .out with PSSE and Python?

JervisW gravatar imageJervisW ( 2012-11-23 00:22:31 -0500 )edit
2

@JervisW Yes it is. You can use the module dyntool to read the .out, then you can use excelpy to export to excel or matplotlib to graph, etc. I will edit my answer with an example.

waltterval gravatar imagewaltterval ( 2012-11-26 09:34:17 -0500 )edit

Hello Walter, can you explain the line code: freq_chanList = range(51, 62) What's the meaning of (51, 62)? Why this values? It´s for the channel number in OUT file? And in: frecuencia = np.add(np.multiply(np.array(chandata_dict[freqchan]), 60), 60), What's the meaning of 60), 60)? Gracias ;)

SAE_2016 gravatar imageSAE_2016 ( 2016-08-17 18:50:11 -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

3 followers

Stats

Asked: 2012-11-21 05:03:26 -0500

Seen: 5,252 times

Last updated: Nov 26 '12