First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
1

.out output file + excel

asked Nov 21 '12

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

1 answer

Sort by » oldest newest most voted
1

answered Nov 21 '12

waltterval gravatar image

updated Nov 26 '12

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

Comments

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

JervisW gravatar imageJervisW (Nov 23 '12)
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 (Nov 26 '12)

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 (Aug 18 '16)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

3 followers

Stats

Asked: Nov 21 '12

Seen: 5,589 times

Last updated: Nov 26 '12