예제 #1
0
    def loadBranchZ(self, ibus, entries):
        ''' retrieve the information of inductances and admittances of branches of the model
        ibus - bus number to start searching
        entries - int number to retrieve either 1) only forward branches or 2) forward and backward branches
        '''
        sid = -1
        flag = 2
        string = ['NUMBER', 'TYPE']
        ierr, buslist = psspy.abusint(sid, flag, string)
        ''' retrive info from the branch starting at bus ibus '''
        branchlist = []
        psspy.inibrn(ibus, entries)
        ierr, tobus, ckt = psspy.nxtbrn(ibus)
        branchlist.append((ibus, tobus, ckt))
        #         print 'branchlist: ', branchlist
        ''' retrieve info from the branch model 
        Resistance, reactance, admittance sending end, admittance receiving end'''
        branchParam = []
        for branch in branchlist:  #get branch data
            frombus, tobus, ckt = branch
            '''load impedance Z'''
            ierr, cmprx = psspy.brndt2(frombus, tobus, ckt, 'RX')
            #             print 'cmprx: ', cmprx, 'ierr: ', ierr
            branchParam.append(cmprx)
            '''load conductance G'''
            ierr, cmpishunt = psspy.brndt2(frombus, tobus, ckt, 'ISHNT')
            #             print 'cmpishunt: ', cmpishunt, 'ierr: ', ierr
            branchParam.append(cmpishunt)
            '''load susceptance B'''
            ierr, cmpjshunt = psspy.brndt2(frombus, tobus, ckt, 'JSHNT')
            #             print 'cmpjshunt: ', cmpjshunt, 'ierr: ', ierr
            branchParam.append(cmpjshunt)
            if ierr != 0:
                break
#             print 'pflow: ', pflow
#             print 'branchParam: ', branchParam
            self.branchData[branch] = branchParam
        print 'branchData: ', self.branchData
예제 #2
0
    voltage_f = busvoltages[0][bus_index]
    name_f = busnames[0][bus_index]

    bus_f_area_num = psspy.busint(bus_f, 'AREA')

    R_line = 0
    X_line = 0
    RZ_line = 0
    XZ_line = 0
    line_length = 0.0
    ierr, line_length = psspy.brndat(bus_i, bus_f, ckt, 'LENGTH')

    ierr, rate_1 = psspy.brndat(bus_i, bus_f, ckt, 'RATEA')

    ierr, line_B = psspy.brndat(bus_i, bus_f, ckt, 'CHARG')
    ierr, line_rx = psspy.brndt2(bus_i, bus_f, ckt, 'RX')
    if ierr == 0:
        R_line = line_rx.real
        X_line = line_rx.imag
    ierr, line_rxz = psspy.brndt2(bus_i, bus_f, ckt, 'RXZ')
    if ierr == 0:
        RZ_line = line_rxz.real
        XZ_line = line_rxz.imag
    # print( str(bus_i) + ' ' + name_i + ' ; ' + str(bus_f) + ' ' + name_f + ' ' +  str(line_rx) + ' ' + str(line_length))
    worksheet.write(row, col, bus_i)
    col += 1
    worksheet.write(row, col, name_i)
    col += 1

    worksheet.write(row, col, bus_i_area_num[1])
    col += 1
예제 #3
0
    if test < 10:
        OutputFilePath = FigurePath + '02. Deep Fault Test' + "\\" + 'Test0' + str(
            test) + '_' + FileName + '_Vflt0.01_Tflt0.12' + '_sFac' + str(
                acceleration) + '_dT' + str(integration_step) + '.out'
    else:
        OutputFilePath = FigurePath + '02. Deep Fault Test' + "\\" + 'Test' + str(
            test) + '_' + FileName + '_Vflt0.01_Tflt0.12' + '_sFac' + str(
                acceleration) + '_dT' + str(integration_step) + '.out'
    # ! Setup Dynamic Simulation parameters
    psspy.dynamics_solution_param_2(
        [n_iteration, _i, _i, _i, _i, _i, _i, _i],
        [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
    psspy.fdns([0, 0, 1, 1, 0, 0, 99, 0])

    # Calculate fault admittance needed to create specified voltage dip
    ierr, Zsys1 = psspy.brndt2(107, 969, '1', 'RX')
    fault_B = ((1 - Vflt) / (Vflt * Zsys1)).imag * 100
    fault_G = ((1 - Vflt) / (Vflt * Zsys1)).real

    # convert load , do not change
    psspy.cong(0)
    psspy.conl(0, 1, 1, [0, 0], [100.0, 0.0, 0.0, 100.0])
    psspy.conl(0, 1, 2, [0, 0], [100.0, 0.0, 0.0, 100.0])
    psspy.conl(0, 1, 3, [0, 0], [100.0, 0.0, 0.0, 100.0])
    psspy.ordr(0)  # Order the matrix: ORDR
    psspy.fact()  # Factorize the matrix: FACT
    psspy.tysl(0)  # TYSL

    psspy.bus_frequency_channel([1, 969], r"""System frequency""")
    psspy.voltage_channel([2, -1, -1, 969], r"""IB_Voltage""")
    psspy.voltage_channel([3, -1, -1, 100], r"""UUT_Voltage""")
    bus_IDTRF = 108

    # OPEN PSSE
    _i = psspy.getdefaultint()
    _f = psspy.getdefaultreal()
    _s = psspy.getdefaultchar()
    redirect.psse2py()
    psspy.psseinit(50000)

    FileName = f_list[case[test - 1]-1]
    psspy.case(CasePath + FileName)
    psspy.resq(CasePath + "Tamworth_SMIB.seq")
    psspy.addmodellibrary(CasePath + 'SMASC_E161_SMAPPC_E130_342_IVF150.dll')
    psspy.dyre_new([1, 1, 1, 1], CasePath + "Tamworth_SMIB_E161_E130.dyr", '', '', '')
    psspy.branch_data(bus_flt, bus_inf, '1', realar1=0, realar2=0.0001)
    ierr, line_rx = psspy.brndt2(bus_flt, bus_inf, '1', 'RX')
    psspy.ltap(bus_flt, bus_inf, r"""1""", 0.0001, bus_IDTRF, r"""IDTRF""", _f)
    psspy.plant_data(bus_inf, realar1=1.0)
    psspy.purgbrn(bus_IDTRF, bus_flt, r"""1""")
    psspy.two_winding_data_3(bus_flt, bus_IDTRF, r"""1""",
                             [1, bus_flt, 1, 0, 0, 0, 33, 0, bus_flt, 0, 1, 0, 1, 1, 1],
                             [0.0, 0.0001, 100.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0,
                              0.0, 1.1, 0.9, 1.1, 0.9, 0.0, 0.0, 0.0], r"""IDTRF""")

    OutputFilePath = FigurePath + '07. Grid Voltage Step Test' + "\\" + 'Test' + str(
        test+42) + '_' + FileName + '_sFac' + str(acceleration) + '_dT' + str(
        integration_step) + '_Grid Voltage Step Test.out'
    # ! Setup Dynamic Simulation parameters
    psspy.dynamics_solution_param_2([n_iteration, _i, _i, _i, _i, _i, _i, _i],
                                    [acceleration, tolerance, integration_step, _f, _f, _f, _f, _f])
    psspy.fdns([0, 0, 1, 1, 0, 0, 99, 0])