Issue Running Dynamic Simulation in Loop, PSSEv35 vs PSSEv34
I am using PSSEv35.3 and PSSEv34.9. All I want to do is to write a loop to perform repetitive dynamic simulation. While my script works perfectly for PSSEv34, it behave differently in PSSEv35. To be more specific, it stops at the second loop right after initializing PSSE. I wonder if any of you aware of this issue?
Following is an example (simplified version) script I have for the PSSEv35. All it does is to initialize psse, open a powerflow case, convert load and gen, run CONG, ORDR, FACT & TYSL, and then open the dyr file (p.s., I am not even going to start any transient simulation at this point). I try to repeat the above steps 10 times. Running this in PSSE35 the scripts stops right after psse initialize in the second loop. However, this completes the loop perfectly in PSSE34 (the script for the psse34 version is just a change to the pssepy_PATH and the call to psse34)
Please let me know if I miss anything or if someone also experience the same issue. Thanks in advance.
import sys,os
from contextlib import contextmanager
pssepy_PATH = r"C:\Program Files\PTI\PSSE35\35.3\PSSPY39"
sys.path.append(pssepy_PATH)
import psse35
import psspy
psspy.throwPsseExceptions = True
_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()
_s = psspy.getdefaultchar()
@contextmanager
def open_sav(fname):
try:
psspy.psseinit(150000)
psspy.case(fname)
yield
except psspy.PsseException as e:
print(e.message)
finally:
try:
psspy.close_powerflow()
psspy.deltmpfiles()
psspy.pssehalt_2()
except psspy.PsseException as e:
print(e.message)
def coft():
psspy.cong(0)
psspy.ordr(0)
psspy.fact()
psspy.tysl(0)
def main():
for i in range (10):
with open_sav(r"xyz.sav"):
print("loop #: ")
print(i)
convertload() # it is just a simple function call to conl
coft()
psspy.dyre_new([_i,_i,_i,_i],r"aaa.dyr","","","")
print("finish loop")
if __name__ == "__main__":
main()
p.s. I run the script in Python3.9 (x64 for PSSEv35 and x86 for PSSEv34)
Hello, may I know did you finally find a way to run dynamic simulation for loop in PSSE 35 ?