Ask Your Question
0

Question about Dynamic Simulation based on Python For Loop

asked May 6 '2

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

1 answer

Sort by » oldest newest most voted
0

answered May 10 '2

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.

link

Comments

Thank you for your response.

lmcqueen gravatar imagelmcqueen (May 10 '2)

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: May 6 '2

Seen: 404 times

Last updated: May 09 '22