0

Question about Dynamic Simulation based on Python For Loop

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
lmcqueen's avatar
76
lmcqueen
asked 2022-05-06 01:04:57 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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.

Tassie Dave's avatar
111
Tassie Dave
answered 2022-05-09 20:45:08 -0500
edit flag offensive 0 remove flag delete link

Comments

Thank you for your response.

lmcqueen's avatar lmcqueen (2022-05-10 00:49:22 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer