Export all channels of a .out (Dyntools) to excel file
Hello, I am writing because I have around 50 .out files. Inside each simulation, I have several channels. I would like to export all of them into an excel file or a txt. I tried to export with a function named " dyntools" and also with "excelpy" but it does not work. Someone knows, How could create an excel file? Could I create a TXT instead and EXCEL file with all the channels info to avoid the overflow error? Could I do a txt file with all the channels without created a graph in python?
import excelpy
import dyntools
# LF process
# Channels identification
#LVRT TEST: out_file11
#PROBLEM: EXPORT ALL OUT CHANNELS TO AN EXCEL/TXT FILE
According to the information which I read in the forum, I did several tests in order to find the best way for exporting the .out channels to and text or excel file. However, I have not any psse reply, The excel is not created and no answer is written in the alert/progress output file. After doing several tests, the problem was in the definition of the Output file it was fixed thanks to the post "Using api "pssplot.channelfileexcelexport()" rasise error" , I write the solution and the tests which I did:
SOLUTION*
In the dynamic simulation test the .out should be defined:
psspy.set_chnfil_type(0)
psspy.strt_2([0,1],out_file11)
psspy.run(0,3.0,L1,L2,L3)
#############=======================TEST 01 ================================
#out_file11 = 'case5_1.out'
txt_file='Case5_1.xlsx'
out_file11 = os.path.join(Root,'case5_1.out')
# txt_file= os.path.join(Root,'Case5_1.xlsx')
#pn, x = os.path.splitext(out_file11)
out_list=[]
# out_list.append.os.path.join(Root,'case5_1.out')
out_list = [out_file11]
#####FOUR OPTIONS
chnfobj = dyntools.CHNF(out_list,0)
#chnfobj = dyntools.CHNF(out_file11,0)
#chnfobj = dyntools.CHNF(out_file11,outvrsn=0)
#chnfobj = dyntools.CHNF(out_list,outvrsn=0)
##### OPTIONS #############
#chnfobj.xlsout(channels=[1,4], show=true, xlsfile=pn, sheet ='', overwritesheet=True)
chnfobj.xlsout(channels=[1,4], show=True, xlsfile=txt_file, sheet ='', overwritesheet=True)
#chnfobj.xlsout(channels=[1,4], show=True, xlsfile=txt_file, outfile='case5_1.out', sheet ='', overwritesheet=True)
#chnfobj.xlsout(outfile=out_file11,channels=[1,4], show = True, xlsfile=txt_file)
#############=======================TEST 02================================
# Root=os.getcwd()
# #out_file11 = 'case5_1.out'
# #txt_file='Case5_1.xlsx'
# out_file11 = os.path.join(Root,'case5_1.out')
# #txt_file=os.path.join(Root,'Case5_1.xlsx')
#chnfobj = dyntools.CHNF(out_list,0)
# #chnfobj = dyntools.CHNF(out_file11,0)
# #chnfobj = dyntools.CHNF(out_file11,outvrsn=0)
# #chnfobj = dyntools.CHNF(out_list,outvrsn=0)
# short_title, chanid, chandata = chnfobj.get_data()
# xl = excelpy.workbook(xlsfile='Case5_1.xlsx', mode='w')
# xl.set_range(1, 'a', [short_title])
# xl.save()
# xl.close()
#############=======================TEST 03================================
######====================Test_03.A===============
# # import win32com
# #xl = win32com.client.Dispatch("Excel.Application")
# #xl.DisplayAlerts = False
######=======================Test_03.B===============
# xl = excelpy.workbook(xlsfile, mode='w')
# name='case5.1';
# outfile = dyntools.CHNF(name+'.out')
# shorttitle, chaniddict, chandatadict = outfile.getdata()
# xlsfile=name+'.xlsx';
# xl = excelpy.workbook(xlsfile, mode='w')
# outfile.xlsout(sheet=name,overwritesheet=True)
# xl.save();
# xl.close()