Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Do dynamic simulation several times in one py file

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