This is how I run my dynamic simulations with multiple fault files and converted models.
Here's a simple way to do it - Others may have better codes than this, but this works well for me. Of course you could add additional details in between as you wish but it should get what you are asking for.
workdir and flt are folders but you could specifically assign what workdir path is or completely forget it and have everything input/output from your main folder.
Reading and storing all fault files in flt folder
mypath_ = work_dir + "/flt"
flt_file = [a for a in listdir(mypath_) if isfile(join(mypath_, a))]
#splitting up file extensions
flt_infile = []
for r in flt_file:
flt_infile.append(os.path.splitext(r)[0])
print 'FAULT_DEF = ' , flt_infile
print (" \n")
Reading and storing all converted cases convlf folder
mypath = work_dir + "/convlf"
clf_file = [g for g in listdir(mypath) if isfile(join(mypath, g))]
#splitting up the .sav extension
clf_infile = []
for t in clf_file:
clf_infile.append(os.path.splitext(t)[0])
print 'CONVLF_DEF = ' , clf_infile
print (" \n")
Looping through all cases and flt files
flt_flag = 0 #1 = idv files, 0 = python files
dist_run = 20.0 #20 seconds run
for x in clf_infile:
for y in flt_infile:
psspy.case(work_dir + "/convlf/" + x + ".sav")
psspy.rstr(work_dir + "/snap/" + snapfile + ".snp")
psspy.strt(option = 0,
outfile = work_dir + "/bin/" + x + "-" + y + ".out"
)
# run disturbance in steady state for 0.1 sec
psspy.run(option = 0,
tpause = flat_start,
nprt = 0,
nplt = 1,
crtplt = 0
)
# run disturbance and clear fault
if flt_flag == 0:
execfile(work_dir + "/flt/" + y + ".py")
else:
psspy.runrspnsfile(work_dir + "/flt/" + y + ".idv")
# finish 20 second run
psspy.run(option = 0,
tpause = dist_run,
nprt = 0,
nplt = 1,
crtplt = 0
)