Beispiel #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
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 
    

    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

    # branches
    ibus,jbus,id=read_rawdata.branch_bus()
    for i,gener in enumerate(all_gener):
        psspy.case(savfile)
        psspy.rstr(snpfile)
        psspy.strt(0,outfile[i]) 
        psspy.run(0, 1.0,1000,1,0)
        dist_branch_fault(ibus[i], jbus[i], id[i])
        psspy.run(0, 1.2,1000,1,0)
        psspy.dist_clear_fault(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
Beispiel #5
0
    savFile = rawFileName + '.sav'
    snpFile = rawFileName + '.snp'


    print('Event: {}'.format(event))
    # get the nominal voltages as well as the fault impedance in ohms
    FaultBusNomVolt = float(BusDataDict[str(FaultBus)].NominalVolt)
    Zbase = FaultBusNomVolt**2/Sbase  # float since Sbase is a float
    Rohm = FaultRpu*Zbase # fault impedance in ohms 
             
    # run simulation till just before the fault
    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,out_file)
        ierr = psspy.run(0,0.1,1,1,1)
        ierr = psspy.dist_branch_trip(L1Bus1, L1Bus2, L1cktID)

    #output = StringIO.StringIO()
    with silence(output):
        ierr = psspy.run(0,0.2,1,1,1) #fault on time

    outputStr = output.getvalue()
    if "Network not converged" in outputStr:
        print('For ' + event + ':')
        print('Network did not converge between branch 1 trip and fault application, skipping...')
        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])
Beispiel #7
0
def run_savnw_simulation(datapath, outfile1, outfile2, outfile3, prgfile):
    _F1_start=100
    _F1_end=100+70*1/60.0;

    _F2_start = 300
    _F2_end = 400;

    _runto=300;
    import psspy
    psspy.psseinit()

    savfile = 'IEEE 9 Bus_modifiedj4ab.sav'
    snpfile = 'IEEE 9 Bus_modifiedj4ab.snp'
    _i = psspy.getdefaultint()
    _f = psspy.getdefaultreal()
    _s = psspy.getdefaultchar()
    INTGAR = [_i] * 7
    REALAR = [_f] * 8

    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])  #Use this API to specify the progress output device.

    ierr = psspy.case(savfile)   #Use this API to open a PSSE Saved Case file and transfers its data into the PSSE working case
    if ierr:
        psspy.progress_output(1,"",[0,0])
        print(" psspy.case Error")
        return
    ierr = psspy.rstr(snpfile)#Use this API to read a dynamics Snapshot File into PSSE working memory (activity RSTR).
    if ierr:
        psspy.progress_output(1,"",[0,0])
        print(" psspy.rstr Error")
        return

    psspy.strt(0,outfile1)  #strt(option, outfile)   #Use this API to initialize a PSSE dynamic simulation for state-space simulations (i.e., in preparation for activity RUN) and to specify the Channel Output File into which the output channel values are to be recorded during the dynamic simulation (activity STRT).
    psspy.run(0, _F1_start,5000,1,0) #Use this API to calculate PSSE state-space dynamic simulations (activity RUN).
    #psspy.dist_bus_fault(8,1, 230.0,[0.0,-0.2E+10]) #Use this API routine to apply a fault at a bus during dynamic simulations. (Note: use DIST_BUS_FAULT_2 if phase voltages are to be calculated during the simulation.)


    businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1)
    print businfo
    psspy.dist_branch_fault(8,9, '1',3,0.0,[0.0,0.000001])
    ##psspy.dist_branch_trip(8, 7, '1')
    ##psspy.load_chng_5(11, r"""1""", [0, _i, _i, _i, _i, _i, _i], [_f, _f, _f, _f, _f, _f, _f, _f])
    businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1)
    print businfo

    psspy.run(0, _F1_end+1.5*1/60,5000,1,0)
    businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1)
    print businfo



    #psspy.dist_branch_close(8,7,'1')
   ## psspy.load_chng_5(11, r"""1""", [1, _i, _i, _i, _i, _i, _i], [_f, _f, _f, _f, _f, _f, _f, _f])
    psspy.dist_clear_fault(1)
    psspy.run(0, _F1_end+2.0, 5000, 1, 0)
    businfo = subsystem_info('bus', ['NUMBER', 'NAME', 'PU'], sid=-1)
    print businfo

    #psspy.dist_clear_fault(1)  #Use this API to clear a fault during dynamic simulations. The fault must have previously been applied using one of the following APIs:
    psspy.run(0, _runto,5000,1,0)
#trigger machine
#    psspy.case(savfile)    #Use this API to open a PSSE Saved Case file and transfers its data into the PSSE working case
#    psspy.rstr(snpfile)     #Use this API to read a dynamics Snapshot File into PSSE working memory (activity RSTR).
#    psspy.strt(0,outfile2)
#    psspy.run(0, 1.0,1000,1,0)
#    psspy.dist_machine_trip(2,'1')
#    psspy.run(0, 10.0,1000,1,0)
#trigger line
#    psspy.case(savfile)
#    psspy.rstr(snpfile)
#    psspy.strt(0,outfile3)
#    psspy.run(0, 1.0,1000,1,0)
#    psspy.dist_branch_trip(7,8,'1')
#    psspy.run(0, 10.0,1000,1,0)

    psspy.lines_per_page_one_device(2,10000000)
    psspy.progress_output(1,"",[0,0])