Ask Your Question
0

How can i apply a single macro in PSSE to a multiple files

asked 2018-04-19 06:30:22 -0500

Alejandro M. gravatar image

I have a lot of files and i have to make the same change in all of them, the only thing i know to do is to apply a macro but i don't know if there is a way to do it easily and fastly with all of the files at once.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-04-19 22:34:19 -0500

Cao Huy gravatar image

updated 2018-05-01 20:41:44 -0500

Here are few steps to do the task:

Firstly, you have to record the macro you want to apply, using the reocding button in the GUI of PSSE.

Secondly, fill in these below code, which will do the task for you.

import psspy
File_List = [your list of sav formatted file names you want to excecute]
for file in File_List:
    psspy.case(file) #or load a raw formated file by psspy.read()
    #insert your macro here
    #save sav file if you want by psspy.sav(); save raw file by psspy.rawd_2()

Thirdly, run it.

Above are just some simple stuffs, for more infomation you should check out the documents of PSSE.

edit flag offensive delete link more

Comments

The case is that all the files that i want to modify are raw type, how do i have to put the names of the files on the list? Do i have to put "filename.raw" or only "filename". The files will be in the same folder that the macro. How could i use the "psspy.rawd_2()" function to overwrite the file?

Alejandro M. gravatar imageAlejandro M. ( 2018-04-23 05:14:12 -0500 )edit

I usually use filename.raw. You should check the API document of PSSE. Unless you declare the new path in python, it is default that your files and your macro in the same folder. "psspy.rawd_2()" functions is for writing raw file; psspy.read() for reding raw file. My bad. I also fixed the answer.

Cao Huy gravatar imageCao Huy ( 2018-05-01 20:40:52 -0500 )edit

Thank you very much, i was totally lost and you have make me get the good way.

Alejandro M. gravatar imageAlejandro M. ( 2018-05-03 02:29:18 -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

Stats

Asked: 2018-04-19 06:30:22 -0500

Seen: 132 times

Last updated: May 01