예제 #1
0
def run_savnw_simulation(datapath, outfile1, outfile2, outfile3, prgfile):

    import psspy
    psspy.psseinit()

    savfile = 'Converted_NETS-NYPS 68 Bus System_C.sav'
    snpfile = 'NETS-NYPS 68 Bus System.snp'

    if datapath:
        savfile = os.path.join(datapath, savfile)
        snpfile = os.path.join(datapath,
                               snpfile)  #why produce these two kinds of files?

    psspy.lines_per_page_one_device(1, 90)
    psspy.progress_output(2, prgfile, [0, 0])

    ierr = psspy.case(savfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.case Error")
        return
    ierr = psspy.rstr(snpfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.rstr Error")
        return

# fault + line trip
    psspy.strt(0, outfile1)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_bus_fault(52, 1, 138.0, [0.0, -0.2E+10])
    psspy.run(0, 1.1, 1000, 1, 0)
    psspy.dist_clear_fault(1)
    psspy.dist_branch_trip(52, 55, '1')
    psspy.run(0, 1.2, 1000, 1, 0)
    psspy.dist_machine_trip(1, '1')
    psspy.run(0, 5.0, 1000, 1, 0)

    # line trip (with faults) + generator trip
    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0, outfile2)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_bus_fault(52, 1, 138.0, [0.0, -0.2E+10])
    psspy.run(0, 1.1, 1000, 1, 0)
    psspy.dist_clear_fault(1)
    psspy.run(0, 1.2, 1000, 1, 0)
    psspy.dist_machine_trip(8, '1')
    psspy.run(0, 5.0, 1000, 1, 0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0, outfile3)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_branch_trip(32, 33, '1')
    psspy.run(0, 5.0, 1000, 1, 0)

    psspy.lines_per_page_one_device(2, 10000000)
    psspy.progress_output(1, "", [0, 0])
def run_savnw_simulation(datapath, outfile1, outfile2, outfile3, prgfile):

    import psspy
    psspy.psseinit()

    savfile = 'savcnv.sav'
    snpfile = 'savnw.snp'

    if datapath:
        savfile = os.path.join(datapath, savfile)
        snpfile = os.path.join(datapath, snpfile)

    psspy.lines_per_page_one_device(1, 90)
    psspy.progress_output(2, prgfile, [0, 0])

    ierr = psspy.case(savfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.case Error")
        return
    ierr = psspy.rstr(snpfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.rstr Error")
        return

    psspy.strt(0, outfile1)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_bus_fault(154, 1, 230.0, [0.0, -0.2E+10])
    psspy.run(0, 1.05, 1000, 1, 0)
    psspy.dist_clear_fault(1)
    psspy.run(0, 5.0, 1000, 1, 0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0, outfile2)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_machine_trip(3018, '1')
    psspy.run(0, 5.0, 1000, 1, 0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0, outfile3)
    psspy.run(0, 1.0, 1000, 1, 0)
    psspy.dist_branch_trip(3005, 3007, '1')
    psspy.run(0, 5.0, 1000, 1, 0)

    psspy.lines_per_page_one_device(2, 10000000)
    psspy.progress_output(1, "", [0, 0])
def run_savnw_simulation(datapath, outfile, prgfile):

    import psspy
    psspy.psseinit()

    savfile = 'Converted_NETS-NYPS 68 Bus System_C.sav'
    snpfile = 'NETS-NYPS 68 Bus System.snp'

    if datapath:
        savfile = os.path.join(datapath, savfile)
        snpfile = os.path.join(datapath, snpfile)

    psspy.lines_per_page_one_device(1, 90)
    psspy.progress_output(2, prgfile, [0, 0])  # directly output to file
    #psspy.chsb(0,1,[-1,-1,-1,1,13,0])

    ierr = psspy.case(savfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.case Error")
        return
    ierr = psspy.rstr(snpfile)
    if ierr:
        psspy.progress_output(1, "", [0, 0])
        print(" psspy.rstr Error")
        return

    # run generator trip automatically
    for i in range(16):
        psspy.case(savfile)
        psspy.rstr(snpfile)
        psspy.strt(0, outfile[i])
        #psspy.chsb(0,1,[-1,-1,-1,1,13,0])
        psspy.run(0, 1.0, 1000, 1, 0)
        psspy.dist_machine_trip(i + 1, '1')
        psspy.run(0, 5.0, 1000, 1, 0)

    psspy.lines_per_page_one_device(
        2, 10000000
    )  #Integer DEVICE Indicates which of the four output devices is to be processed (input;
    #1 for disk files.
    #2 for the report window.
    #3 for the first primary hard copy output device.
    #4 for the second primary hard copy output device.
    psspy.progress_output(1, "", [0, 0])
    return outfile, prgfile
예제 #4
0
       

    # check for non-convergence
    outputStr = output.getvalue()
    if "Network not converged" in outputStr:
        print('For ' + event + ':')
        print('Network did not converge between fault clearance and gen trip, skipping...')
        
        continue

    # gen trips ##############################################################
    output = StringIO.StringIO()
    with silence(output):
        for genbus, triptime in sorted(bustripdict.iteritems(), key=lambda (k,v): v): 
            ierr = psspy.run(0,triptime,1,1,1) #fault off time
            ierr = psspy.dist_machine_trip(int(genbus),'1')

        
    
    # check for non-convergence
    outputStr = output.getvalue()
    if "Network not converged" in outputStr:
        print('For ' + event + ':')
        print('Network did not converge during gen trip, skipping...')
        skipsimulation.append(event)
        continue


    ################################################################################

def run_savnw_simulation(datapath, outfile1, outfile2, outfile3, prgfile):

    import psspy
    psspy.psseinit()

    savfile = 'savcnv.sav'
    snpfile = 'savnw.snp'

    if datapath:
        savfile = os.path.join(datapath, savfile)
        snpfile = os.path.join(datapath, snpfile)

    psspy.lines_per_page_one_device(1,90)
    psspy.progress_output(2,prgfile,[0,0]) # directly output to file
    

    ierr = psspy.case(savfile)
    if ierr:
        psspy.progress_output(1,"",[0,0])
        print(" psspy.case Error")
        return
    ierr = psspy.rstr(snpfile)
    if ierr:
        psspy.progress_output(1,"",[0,0])
        print(" psspy.rstr Error")
        return
    
# fault + line trip
    psspy.strt(0,outfile1)
    psspy.chsb(0,1, [-1,-1,-1,1,13,0])
    psspy.run(0, 1.0,1000,1,0)# start from 1 second, 1000 steps, and 1 writing for 1 output step
    psspy.dist_bus_fault(154,1, 230.0,[0.0,-0.2E+10]) # ibus, units, voltage kv
    psspy.run(0, 1.1,1000,1,0)# start from 1.1 second, 1000 steps, and 1 writing for 1 output step
    psspy.dist_clear_fault(1) 
    psspy.dist_branch_trip(3005,3007,'1')
    psspy.run(0,1.2,1000,1,0)
    psspy.dist_machine_trip(3018,'1')
    psspy.run(0, 5.0,1000,1,0)

# line trip (with faults) + generator trip   
    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0,outfile2)
    psspy.chsb(0,1, [-1,-1,-1,1,13,0])
    psspy.run(0, 1.0,1000,1,0)
    psspy.dist_bus_fault(3005,1,230.0,[0.0,-0.2E+10])
    psspy.run(0,1.1,1000,1,0)
    psspy.dist_clear_fault(1)
    psspy.run(0,1.2,1000,1,0)
    psspy.dist_machine_trip(3018,'1')
    psspy.run(0, 5.0,1000,1,0)

    psspy.case(savfile)
    psspy.rstr(snpfile)
    psspy.strt(0,outfile3)
    psspy.chsb(0,1, [-1,-1,-1,1,13,0])
    psspy.run(0, 1.0,1000,1,0)
    psspy.dist_branch_trip(3005,3007,'1')
    psspy.run(0, 5.0,1000,1,0)

    psspy.lines_per_page_one_device(2,10000000)
    psspy.progress_output(1,"",[0,0])
예제 #6
0
    # simulate generator outages
    print 'Simulating gen outages...'
    for genbus in GenDict:

        eventStr = 'R{}/G{}'.format(PL,genbus)
        cktID = GenDict[genbus]
        output = StringIO.StringIO()
        with silence(output):
            # load the sav and snp file
            psspy.case(savFile)
            psspy.rstr(snpFile)
        output = StringIO.StringIO()
        with silence(output):
            ierr = psspy.strt(0,settings['out_file'])
            ierr = psspy.run(0,0.1,1,1,1)
            ierr = psspy.dist_machine_trip(int(genbus),cktID)

        output = StringIO.StringIO()
        with silence(output):
            ierr = psspy.run(0,totSimTime,1,1,1) #simulation end time

        outputStr = output.getvalue()
        if "Network not converged" in outputStr:
            print('For ' + eventStr + ':')
            print('Network did not converge after gen trip, skipping...')
            continue


        outputData = dyntools.CHNF(settings['out_file'])

        data = outputData.get_data()