當前位置: 首頁>>代碼示例>>Python>>正文


Python Transmitter.set_transmit_ra方法代碼示例

本文整理匯總了Python中transmitter.Transmitter.set_transmit_ra方法的典型用法代碼示例。如果您正苦於以下問題:Python Transmitter.set_transmit_ra方法的具體用法?Python Transmitter.set_transmit_ra怎麽用?Python Transmitter.set_transmit_ra使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在transmitter.Transmitter的用法示例。


在下文中一共展示了Transmitter.set_transmit_ra方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from transmitter import Transmitter [as 別名]
# 或者: from transmitter.Transmitter import set_transmit_ra [as 別名]
def main():

    if len(sys.argv) == 5:
       filename = sys.argv[1]
       card_type = sys.argv[2]
       energy_constraint = sys.argv[3]
       chan_pred = eval(sys.argv[4])
       increment = 1
       print "filename: "+str(filename)
    elif len(sys.argv) == 6:
       filename = sys.argv[1]
       card_type = sys.argv[2]
       energy_constraint = sys.argv[3]
       chan_pred = False
       increment = eval(sys.argv[5])
       print "filename: "+str(filename)
    else:
        print "Correct usage: python simulate_effsnr.py trace_file card_type tx/rx pred(True/False)"
        sys.exit(1)

    nrx=3
    # Create a tx
    ntx=3
    ta = None
    transmitter = Transmitter(ntx,ta)
    # Create a channel
    
    chan = TraceChan(filename, increment)
    num_chans=1
    length = chan.create_chan(transmitter.Ntx,nrx)
 
    ta = OracleEffSnrRA(card_type,energy_constraint,chan)
    transmitter.set_transmit_ra(ta)
    extname=ta.name+"_"+filename.split('/')[-1].split('.')[0]+"_"+card_type+"_"+energy_constraint+"_pred"+str(chan_pred)+"_inc"+str(increment)
    receiver = Receiver(RxOracle(card_type,energy_constraint),nrx,extname)

    if length > 10000: length = 10000
    #length =10
    for num in range(0,length):
        pkt = transmitter.transmit_pkt()
        chan.apply_channel(pkt)
        #print chan.curr_chan
        #print pkt
        
        # Create receiver
        receiver.receive_pkt(pkt)
        ack_pkt = receiver.get_feedback_pkt()
        
        transmitter.process_ack(ack_pkt)
開發者ID:yichao0319,項目名稱:Energy-Aware-RA-Simulator,代碼行數:51,代碼來源:simulate_oracle_effsnr.py


注:本文中的transmitter.Transmitter.set_transmit_ra方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。