⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opt.py

📁 最优化寻找程序
💻 PY
📖 第 1 页 / 共 2 页
字号:
        print value_to_poke
        e.setEnvOffFrac(value_to_poke, 'high','nom')
        print 'low'
        e.burstPsk(ch, padr)
        ###e.setEnvOffFrac(value_to_poke, 'high','nom')            
        #Tx8PskModMask(ch, sh, i)
        #Tx8PskEVM(ch,sh, i)
        p1 = Tx8PskSpec(ch)
        e.zeroAm()
        p2 = Tx8PskSpec(ch)
        e.resetAm()
        writeToCell(sh,i,9,p1)
        writeToCell(sh,i,10,p2)
 
    sh = None
    FileClose(wb)

def PskTxIcpTest (ch, padr=0x68):
    SetSwitch(ch)
    e.burstPsk(ch, padr)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("PSK_TxICP")
    for i in range(2,20):
        sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
        value_to_poke = readFromCell(sh,i,1)
        e.burstPsk(ch, padr)
        print value_to_poke
        e.poke(0x7e, int(value_to_poke,16))           
        Tx8PskModMask(ch, sh, i)
        Tx8PskEVM(ch,sh, i)

    sh = None
    FileClose(wb)
    
def GmskTxIcpTest (ch):
    SetSwitch(ch)
    e.burstGmsk(ch)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("GMSK_TxICP")
    for i in range(2,20):
        sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
        value_to_poke = readFromCell(sh,i,1)
        e.burstGmsk(ch, 0x7c)
        print value_to_poke
        e.poke(0x65, int(value_to_poke,16))           
        TxGmskModMask(ch, sh, i)
        TxGmskPhaseError(ch,sh, i)

    sh = None
    FileClose(wb)
def GmskVCOTest (ch):
    SetSwitch(ch)
    e.burstGmsk(ch)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("VCO")
    for i in range(8):
        for j in range(4):
            sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
            writeToCell(sh,i*4+j+2,1, str(i)+'/'+str(j))
            e.burstGmsk(ch, 0x7c)
            print (str(i)+'/'+str(j))
            e.pokeTxIndrBits(0xC5,j,9,8)
            e.pokeTxIndrBits(0xC5,j,11,10)
            e.pokeTxIndrBits(0xC1,i,14,12)
            e.pokeTxIndrBits(0xC1,i,17,15)
                     
            TxGmskModMask(ch, sh, i*4+j+2)
            TxGmskPhaseError(ch,sh, i*4+j+2)

    sh = None
    FileClose(wb)
def PskVCOTest (ch, padr=0x68):
    SetSwitch(ch)
    e.burstPsk(ch, padr)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("VCO")
    for i in range(8):
        for j in range(4):
            sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
            writeToCell(sh,i*4+j+2,1, str(i)+'/'+str(j))
            e.burstPsk(ch, padr)
            print (str(i)+'/'+str(j))
            e.pokeTxIndrBits(0xC5,j,9,8)
            e.pokeTxIndrBits(0xC5,j,11,10)
            e.pokeTxIndrBits(0xC1,i,14,12)
            e.pokeTxIndrBits(0xC1,i,17,15)
                     
            Tx8PskModMask(ch, sh, i*4+j+2)
            Tx8PskEVM(ch,sh, i*4+j+2)

    sh = None
    FileClose(wb)
def GmskLDOTest (ch):
    SetSwitch(ch)
    e.burstGmsk(ch)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("LDO")
    for i in range(2,10):
        sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
        value_to_poke = readFromCell(sh,i,1)
        e.burstGmsk(ch, 0x7c)
        print value_to_poke
        ##e.pokeBits(0x63, int(value_to_poke),6,4)
        e.pokeBits(0x41, int(value_to_poke),6,4) 
        TxGmskModMask(ch, sh, i)
        TxGmskPhaseError(ch,sh, i)

    sh = None
    FileClose(wb)       

def PskLDOTest (ch, padr=0x68):
    SetSwitch(ch)
    e.burstPsk(ch, padr)
    fname = "Y:\\AlanWang\\AutoTests\\AutoTest_Tx\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("LDO")
    for i in range(2,10):
        sa.write("*rst")
       ## self.pokeTxIndrBits(0xc0,0x1,2,0)   # EGSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3       ## self.pokeTxIndrBits(0xc5,0x3,13,12) # EGSM - tx_padr1 - RF input bias set to 1.64V from default of 2V       ## self.pokeTxIndrBits(0xc0,0x1,5,3)   # GSM - tx_vco_ib_egsm_nom set to 0x1 from default of 0x3
        value_to_poke = readFromCell(sh,i,1)
        e.burstPsk(ch, padr)
        print value_to_poke
        ##e.pokeBits(0x63, int(value_to_poke),6,4)
        e.pokeBits(0x41, int(value_to_poke),6,4) 
        Tx8PskModMask(ch, sh, i)
        Tx8PskEVM(ch,sh, i)

    sh = None
    FileClose(wb)   

def Delay_Sweep_Opt():
    fname = "Y:\\AlanWang\\My Work Collection\\AutoTests\\2G\\Zeus\\AutoTest\\opt.xls"
    wb = ConfigFileOpen(fname)
    sh = wb.Sheets("Delay_Sweep")
    loop_idx_2_offset_freq = {0:-400,1:-250,2:-200,3:-100,4:100,5:200,6:250,7:400}
    offset_freq_2_data_idx_std = {-100:4,100:6,-200:8,200:10,-250:12,250:14,-400:16,400:18}
    offset_freq_2_data_idx_custom = {-400:4,400:6}

    delay_range = range(0,1001,25)
    i = 0
    while i < 41:
        delay_range[i] = delay_range[i]/1000.0
        i = i + 1
    temp_range = [25]
    ##ch_freq_range =  [825,830,835,840,845,881,886,891,896,901,906,911]
    ##ch_freq_range =  [891,896,901,906,911]
    padr = 0x7c
    ch_freq_range = []
    for i in [1]:
##    for i in range(1,28):
        ch_freq_range.append(readFromCell(sh,i,7))
    
    SA_Setting("eorf", sa)
    sa.write("SENSe:EORF:LIST:MOD:FREQ 0.0, 4.0e5")
    sa.write("eorf:list:sel cust")    
    current_row = 2
    
    for temp in temp_range:
        for ch in ch_freq_range:
            SetSwitch(ch)
            print "Current ch freq = %4.2g" %float(ch)
            for delay in delay_range:
                e.burstPsk(ch, padr, temp, delay)
                successful = 0
                retries = 0
                while successful == 0 and retries == 0: 
                    sa.timeout = 40
                    sa.write("freq:cent %f MHz" %float(ch))
                    sa.write("init:cont off")
                    sleep(1)
                    data2 = sa.ask("read:eorf1?")
                    data_2 = data2.split(',')                   
                    if len(data_2) >= 19:
                        ##for i in range(8):
                        for i in [0,7]:
                        #data text file to be converted into a pivot table
                            writeToCell(sh,current_row,1,str(temp))
                            writeToCell(sh,current_row,2,str(ch))
                            writeToCell(sh,current_row,3,str(delay))
                            offset_freq = loop_idx_2_offset_freq[i]
                            writeToCell(sh,current_row,4,str(offset_freq))
                            data_idx = offset_freq_2_data_idx_custom[offset_freq]
                            writeToCell(sh,current_row,5,float(data_2[data_idx]))
                            current_row = current_row+1
                    
            
                        #print on screen
                        print "Current delay value = %f" %float(delay)
                        print "orfs 8psk at +400KHz offset is %f" %float(data_2[offset_freq_2_data_idx_custom[400]])
                        print "orfs 8psk at -400KHz offset is %f" %float(data_2[offset_freq_2_data_idx_custom[-400]])
                        ##print "orfs 8psk at +200KHz offset is %f" %float(data_2[10])
                        ##print "orfs 8psk at -200KHz offset is %f" %float(data_2[8])
                        successful = 1
                
                    else:
                        e.burstPsk(ch, padr, temp, delay)
                        SA_Setting("eorf", sa)
                        sa.write("eorf:list:sel cust")
                        print "retrying"
                        retries = retries + 1
                    sa.write("init:cont on")
                    data2 = None
                    data_2 = None
                    
    ps.write("outp off")
    sh = None
    #FileClose(wb) 

    sh = None
    FileClose(wb)
    return    
        
        
    
         

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -