Ask Your Question
0

Question about Dynamic Simulation based on Python For Loop

asked 2022-05-06 01:04:57 -0600

lmcqueen gravatar image

I have a sample script shown below. I am seeing issues where when i ran the script it shows an error "v.dyr file in use" after completing one loop of simulation. When the error happens, the simulation continues but it doesn't read the dyr file during activity dyre.

What could be the possible resolution to avoid this scenario?

def vrt_run(self):
    for cnv, snp in zip(os.listdir(self.cnv), os.listdir(self.snp)):
        cnv = cnv[:-4]
        snp = snp[:-4]
        psspy.progress_output(2, self.log +"\\"+ cnv + "_" + snp + "_" + "vrt" + ".pdev")
        psspy.prompt_output(2, self.log + "\\" + cnv + "_" + snp + "_" + "vrt" + ".pdev")
        if os.listdir(self.dll)==[]:
            print "No dll files found inside the folder!"
        else:
            for dll in os.listdir(self.dll):
                psspy.addmodellibrary(self.dll + "\\" + dll)
        try:
            psspy.rstr(self.snp + "\\" + snp + ".snp")
        except:
            print "Error while opening the file", snp
            sys.exit(0)  
        try:
            psspy.case(self.cnv + "\\" + cnv + ".cnv")
        except:
            print "Error while opening the file", cnv
            sys.exit(0)
        psspy.ordr(0)
        psspy.fact()
        psspy.tysl(0)
        psspy.plmod_remove(780000, '1', 1)
        psspy.dyre_add([], os.getcwd() + "\\" + "v.dyr", "", "")
        psspy.tysl(0)
        psspy.snap([-1,-1,-1,-1,-1],os.getcwd() + "\\" + cnv + "v" + ".snp")
        psspy.strt(1,self.out + "\\" + cnv + "_" + snp + "_" + "vrt" + ".out")
        psspy.run(1,15,120,3,0)
        psspy.progress_outpu
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2022-05-09 20:45:08 -0600

Tassie Dave gravatar image

I have seen this issue myself. I don't know the reason. Instead I use a work-around; I make a new copy of the dyr file (with a unique name) for each iteration of the loop. That allows PSSE to work happily with the dyr file.

edit flag offensive delete link more

Comments

Thank you for your response.

lmcqueen gravatar imagelmcqueen ( 2022-05-10 00:49:22 -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: 2022-05-06 01:04:57 -0600

Seen: 378 times

Last updated: May 09 '22