First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Do dynamic simulation several times in one py file

asked Sep 23 '0

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####

1 answer

Sort by » oldest newest most voted
0

answered Sep 23 '0

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####
link

Comments

Thanks a lot!

sugui_ gravatar imagesugui_ (Sep 26 '0)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Sep 23 '0

Seen: 397 times

Last updated: Sep 23 '20