First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
You are on the right track with this code:
i=1
while i<=3:
psspy.case('savcnv.sav')
psspy.rstr('savnw.snp')
psspy.strt(outfile='i.out')
psspy.run(tpause=1.0)
psspy.dist_machine_trip(ibus=101, id='1 ')
psspy.run(tpause=1.05)
psspy.dist_clear_fault()
psspy.run(tpause=5.0)
i=i+1
But that line outfile='i.out'
won't do what you think it does.
'i.out'
is just a string, it doesn't know about the i
variable you created. You must explicitly tell Python to substitute the i
value into the string. e.g.
filename = '%s.out' % i
psspy.strt(outfile=filename)
the %s
will be replaced with the i
variable so it will change each time in your loop.