0

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

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.

Alejandro M.'s avatar
3
Alejandro M.
asked 2018-04-19 06:30:22 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

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.

Cao Huy's avatar
173
Cao Huy
answered 2018-04-19 22:34:19 -0500, updated 2018-05-01 20:41:44 -0500
edit flag offensive 0 remove flag delete link

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.'s avatar Alejandro 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's avatar Cao 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.'s avatar Alejandro M. (2018-05-03 02:29:18 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer