Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I were you, I would first take all the N-1 line outages in powerflow and make sure they are good to go (ie; solve correctly and not blown up), then save them as individual cases and put them all in the same folder. Then create some code similar to this: https://psspy.org/psse-help-forum/question/1118/dynamic-simulations-using-python/, but wrap most of it up in a for loop that changes the case each loop. ie;

import os,sys
import glob
import psspy
import redirect
PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE32\PSSBIN'

sys.path.append(PYTHONPATH)
os.environ['PATH'] += ';' + PYTHONPATH

#Modify GENERATORS to include generators you want to trip in form of [[BUS #, 'GEN_ID'],[BUS #, 'GEN_ID']....]
GENERATORS = [[32,'1'],[35,'1'],[37,'1'],[38,'1'],[39,'1']] #GEN_ID might not be correct here...

# Redirect output from PSSE to Python:
redirect.psse2py()

# Loop through cases
for CASE in glob.glob(os.path.join('C:\\YOUR\\DIRECTORY\\', '*.sav')):
    psspy.psseinit(12000)
    psspy.case(CASE)

    # Convert loads (3 step process):
    psspy.conl(-1,1,1)
    psspy.conl(-1,1,2,[0,0],[100,0,0,100])
    psspy.conl(-1,1,3)

    # Convert generators:
    psspy.cong()

    # Solve for dynamics
    psspy.ordr()
    psspy.fact()
    psspy.tysl()

    # Save converted case
    case_root = os.path.splitext(sys.argv[1])[0]
    psspy.save(case_root + "_C.sav")

    # Add dynamics data
    psspy.dyre_new(dyrefile="C:\\YOUR\\DIRECTORY\\YOUR_DYRE.DYR")

    # Add channels
    #ADD CHANNEL CODE HERE IF YOU NEED IT

    # Save snapshot
    psspy.snap(sfile=case_root + ".snp")

    #Loop through outages
    for gen in GENERATORS:    
        # Re-load case
        psspy.open(case_root + "_C.sav")
        psspy.rstr(sfile=case_root + ".snp")

        # Initialize
        psspy.strt(outfile=case_root + "_SIM_%d_%s.out" % (gen[0],gen[1]))
        psspy.run(tpause=0)

        # Disconnect generator
        ierr = dist_machine_trip(gen[0],gen[1])

        # Run to 20 seconds
        time = 20
        psspy.run(tpause=time)

# Halt
psspy.pssehalt_2()

I haven't tested that code, but it should hopefully be something close to what you are looking for.