Beispiel #1
0
def get_Q_statcom():
    ierr, Q_s1 = psspy.macdat(statcom1_bus ,'1','Q')
    ierr, Q_s2 = psspy.macdat(statcom2_bus ,'1','Q')
    if Q_s1 < 0 and Q_s2 < 0:
        Q_s = min(Q_s1,Q_s2)
    elif Q_s1 > 0 and Q_s2 > 0:        
        Q_s = max(Q_s1,Q_s2)
    return Q_s, Q_s1, Q_s2
Beispiel #2
0
def read_mach_output(bus, ID):
    ierr, type = psspy.busint(bus, 'TYPE')
    if type < 4:
        ierr, Qgen_WT = psspy.macdat(bus, str(ID), 'Q')
        ierr, Pgen_WT = psspy.macdat(bus, str(ID), 'P')
    else:
        Qgen_WT = "None"
        Pgen_WT = "None"
    return Pgen_WT, Qgen_WT
Beispiel #3
0
 def loadGeneratorVA(self, ibus, entries):
     ierr, machs = psspy.amachcount(ibus, entries)
     print 'machs: ', machs
     #         imach= 0
     #         while imach< machs: # maquines < machs
     # returns machine identifier for each mach connected to bus ibus
     ierr, id = psspy.nxtmac(ibus)
     print 'id: ', id, ' ibus: ', ibus
     ''' P & Q values in complex format '''
     err, cmpval = psspy.gendat(ibus)
     print "gendat: ", cmpval
     ''' Machine static parameters '''
     err, rval = psspy.macdat(ibus, id, 'PMAX')
     print 'macdat: ', rval
     err, rval = psspy.macdat(ibus, id, 'MVA')
     print 'macdat: ', rval
Beispiel #4
0
def calcSCR(sizes, ret_params=False):
    '''
    ARGS: 
        sizes       : list of sizes of Sync. Conds  
   RETURNS:
        scr         : list of short circuit ratios
    Calculation:
        scr=sqrt(3)*i_sym*v_pu*v_kv*_UNIT_FACTOR/pmax
        _UNIT_FACTOR=1e-3
    '''
    # params
    pmax = []
    i_sym = []
    v_kv = []
    v_pu = []
    # non-verbose execution
    with silence():
        for idx in range(len(SC_IDS)):
            psspy.machine_data_2(i=SC_IDS[idx],
                                 id='1',
                                 intgar=[1, 0, 0, 0, 0, 0],
                                 realar=[
                                     0, 0, 500, -200, 0, 0, sizes[idx], 0,
                                     0.17, 0, 0, 1, 1, 1, 1, 1, 1
                                 ])
        # full newton-rafsan
        psspy.fnsl(options4=1, options5=1, options6=1)
        # get symmetric 3-phase fault currents
        all_currents = pssarrays.iecs_currents(all=1,
                                               flt3ph=1,
                                               optnftrc=2,
                                               vfactorc=1.0)
    # all bus pu voltage
    _, (__v_pu, ) = psspy.abusreal(sid=-1, string=["PU"])
    # all bus kv voltage
    _, (__v_kv, ) = psspy.abusreal(sid=-1, string=["BASE"])
    # get pmax
    for _id in MACHINE_IDS:
        _, _pmax = psspy.macdat(ibus=_id, id='1',
                                string='PMAX')  # find power of machine
        pmax.append(_pmax)
    # get v_pu,v_kv,i_sym
    for _id in BUS_IDS:
        v_pu.append(__v_pu[_id - 1])
        v_kv.append(__v_kv[_id - 1])
        i_sym.append(all_currents.flt3ph[_id - 1].ibsym.real)

    total_bus = len(pmax)
    scr = []
    _UNIT_FACTOR = 1e-3
    #LOG_INFO('Calculating SCR')
    for idx in range(total_bus):
        scr.append(
            math.sqrt(3) * i_sym[idx] * v_pu[idx] * v_kv[idx] * _UNIT_FACTOR /
            pmax[idx])

    if ret_params:
        return pmax, i_sym, v_kv, v_pu, scr
    else:
        return scr
def gen_data(bus_nbr, gen_id):
    temp = ['P', 'PMIN', 'PMAX', 'QMIN', 'QMAX']
    array_results = []

    for i in range(len(temp)):
        ierr, temp_value = psspy.macdat(bus_nbr, str(gen_id), temp[i])
        if ierr == 0:
            array_results.append(temp_value)

    return array_results
Beispiel #6
0
def getGeneratedPower():
    with silence():
        # initialize
        psspy.psseinit()
        # load case
        psspy.case(CASE_STUDY)
    PWR_GEN=[]
    for _id in MACHINE_IDS:
            _, _pmax = psspy.macdat(ibus=_id, id='1', string='PMAX') # find power of machine
            Pgen    =   P_gen*_pmax
            PWR_GEN.append(Pgen)
    return PWR_GEN
Beispiel #7
0
 def get_mvar(i):
     """
     Changes the voltage set point at the synchronous machine
     solves the case
     returns the the new reactive power output of the sync machine.
     """
     psspy.plant_data(busno, realar1=i)
     ierr = psspy.fnsl()
     val = psspy.solved()
     if val == 0:
         ierr, mvar = psspy.macdat(busno, str(genid), 'Q')
         return mvar
     else:
         return None
Beispiel #8
0
## Recorrer los buses de 132 kV con generador conectado y obtener el número de
## generadores y el id de cada uno.
#############################################################################
# Diferentes IDs de generadores localizados en zona Viesgo (10):
#1, 2, 3, 4, 5, 6, 7
#A, B, C, D, E
#PC, EO

GENERADORES_132 = []
lista_ids = [
    '1', '2', '3', '4', '5', '6', '7', 'A', 'B', 'C', 'D', 'E', 'PC', 'EO'
]
i = 0
for nb in BUSESGEN_132:
    for id_gen in lista_ids:
        ierr_P, rval_P = psspy.macdat(nb, id_gen, 'P')
        ierr_PMAX, rval_PMAX = psspy.macdat(nb, id_gen, 'PMAX')
        ierr_PMIN, rval_PMIN = psspy.macdat(nb, id_gen, 'PMIN')
        ierr_Q, rval_Q = psspy.macdat(nb, id_gen, 'Q')
        ierr_QMAX, rval_QMAX = psspy.macdat(nb, id_gen, 'QMAX')
        ierr_QMIN, rval_QMIN = psspy.macdat(nb, id_gen, 'QMIN')
        ierr_MBASE, rval_MBASE = psspy.macdat(nb, id_gen, 'MBASE')
        bus_i_area_num = psspy.busint(nb, 'AREA')
        if (ierr_P == 0 or ierr_P == 4 or ierr_P == 3):
            GENERADORES_132.append([
                nb,
                psspy.notona(nb)[1], bus_i_area_num[1], id_gen, ierr_P, rval_P,
                rval_PMAX, rval_PMIN, rval_Q, rval_QMAX, rval_QMIN, rval_MBASE
            ])
#    print(i, nb, ierr, rval)
#Columnas de la lista GENERADORES_132:
Beispiel #9
0
        else:
            print ('breaking')
            break
    
    psspy.fdns([1,0,0,1,0,0,0,0])
    psspy.fdns([1,0,0,1,1,0,0,0])
    psspy.fdns([1,0,0,1,1,0,0,0])
    psspy.fdns([1,0,0,1,1,0,0,0])

    # ierr, fs = psspy.busdt1(108,'YS','ACT')   
    Num_Reactors.append(i_sh-1)        
    Q_stat1.append(Q_s[1])
    Q_stat2.append(Q_s[2])

    
    ierr, P = psspy.macdat(POI_bus ,'1','P')
    P_POI.append(abs(P))

    ierr, Q = psspy.macdat(POI_bus ,'1','Q')
    Q_POI.append(Q)

    ierr, S = psspy.macdat(POI_bus ,'1','MVA')

    # ierr, P = psspy.brnmsc(110,109,'1','P')
    # P_POI.append(abs(P))
    # ierr, Q = psspy.brnmsc(110,109,'1','Q')
    # Q_POI.append(Q)
    # ierr, S = psspy.brnmsc(110,109,'1','MVA')
    PF.append(abs((P/S)))