Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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