Ask Your Question
0

Do dynamic simulation several times in one py file

asked 2020-09-22 22:20:16 -0500

sugui_ gravatar image

Hello,

I'm trying to use python running dynamic simulation automatically. Here is part of my code and I have 15 cases that use the same .sav file. Every time I simulate one case I will initialize PSSE first. If there is another way that I don't need to initialize PSSE and open case every time?

for i in range(1,16):
    if i==1:#case 1
        psspy.psseinit(10000) #initialize PSSE
        psspy.case(r"""C:\Users\bbbb4\Downloads\112L-150M.sav""")
        Predyr()
        psspy.strt(0,r"""C:\Users\bbbb4\Downloads\112L-150M\case1.out""")
        #### here's the code of event 1 ####
    if i==2:#case 1-1
        psspy.psseinit(10000) #initialize PSSE
        psspy.case(r"""C:\Users\bbbb4\Downloads\112L-150M.sav""")
        Predyr()
        psspy.strt(0,r"""C:\Users\bbbb4\Downloads\112L-150M\case1-1.out""")
        #### here's the code of event 2####
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-09-23 04:16:12 -0500

perolofl gravatar image

Initialise PSSE before the loop and perform case and Predyr before the if-statements.

psspy.psseinit(10000) #initialize PSSE
for i in range(1,16):
    psspy.case(r"""C:\Users\bbbb4\Downloads\112L-150M.sav""")
    Predyr()
    if i==1:#case 1
        psspy.strt(0,r"""C:\Users\bbbb4\Downloads\112L-150M\case1.out""")
        #### here's the code of event 1 ####
    if i==2:#case 1-1
        psspy.strt(0,r"""C:\Users\bbbb4\Downloads\112L-150M\case1-1.out""")
        #### here's the code of event 2####
edit flag offensive delete link more

Comments

Thanks a lot!

sugui_ gravatar imagesugui_ ( 2020-09-25 18:51:06 -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

1 follower

Stats

Asked: 2020-09-22 22:20:16 -0500

Seen: 391 times

Last updated: Sep 23 '20