Ask Your Question
0

Close PSS/E after finishing dynamic simulation

asked 2024-04-29 20:10:49 -0600

YKC gravatar image

I attempt to run the dynamic simulation cyclically, which tripping the online generators one by one, and convert the result values of output file to csv files. Then, the aim is to find the frequency nadir in each simulation case, so I would read the csv files and record the nadir value. In the testing system file, there are only 10 generators in the system. However, in the formal case, the study power grid contains hundreds of generators.

In order not to let a large number of files occupy the disk space, I would like to remove the output files and csv files after recording the nadir values. But the code I finish programming current could only remove the csv files, the output files are still in the folder. I would like to ask that do anyone have any suggestion to deal with this problem "Removing the output files"?

I use python 2.7 and PSS/E v34.4.0, and implement the code in VSCode. Also since I could not paste the entire code on the forum, if anyone want to take a look, please feel free to contact me.

YKC Email: ken890309@gmail.com / yukaichung@itri.org.tw

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2024-05-08 21:04:37 -0600

WN gravatar image

updated 2024-05-08 21:12:40 -0600

I was expecting psspy.pssehalt2() to work. However, you can also try psspy.stop2().

edit flag offensive delete link more

Comments

psspy.stop_2() not psspy.stop().

WN gravatar imageWN ( 2024-05-08 21:13:51 -0600 )edit
0

answered 2024-05-08 19:50:50 -0600

Tassie Dave gravatar image

updated 2024-05-08 19:57:30 -0600

Have you tried psspy.pssehalt_2()? The documentation says : "Use this API to end the operation of PSSE, closes all associated files"
Do that in your python loop after making your output file.
Here is some pseudocode:

loop:
psspy.init()
do stuff
make csv files
psspy.halt
os.remove(csv files)
edit flag offensive delete link more

Comments

Yes, I do try that, and actually I think that function is what I need. However, after I added this API in my code, it always popped up warning "the files are still be used by other program", so I think the reason is that PSS/E does not close correctly.

YKC gravatar imageYKC ( 2024-05-08 20:22:57 -0600 )edit
0

answered 2024-04-30 19:31:26 -0600

You can use os.remove(filepath) where filepath is the path of the output file you wish to remove.

edit flag offensive delete link more

Comments

Well, I did try it, but the warning popped up and told me that I still used PSS/E so "os.remove..." could not be used. Thus, I would like to ask to close PSS/E first, and I could use "os.remove..." to remove the output files.

YKC gravatar imageYKC ( 2024-05-06 03:05:24 -0600 )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

1 follower

Stats

Asked: 2024-04-29 20:10:49 -0600

Seen: 377 times

Last updated: May 08