当前位置: 首页>>代码示例>>Python>>正文


Python transmitter.Transmitter类代码示例

本文整理汇总了Python中transmitter.Transmitter的典型用法代码示例。如果您正苦于以下问题:Python Transmitter类的具体用法?Python Transmitter怎么用?Python Transmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Transmitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    nrx=3
    # Create a tx
    ntx=3
    ta = None
    #ta = SampleRate()
    transmitter = Transmitter(ntx,ta)
    # Create a channel
    
    chan = TraceChan()
    num_chans=1
    length = chan.create_chan(transmitter.Ntx,nrx)

    #ta = OracleRA(chan)
    #transmitter.set_transmit_ra(ta)
    #receiver = Receiver(MaxTputRA(),nrx)
    #receiver = Receiver(MinEngRA(),nrx)
    receiver = Receiver(EngTputRA(),nrx)
    #receiver = Receiver(EffSnrRA(),nrx)
    #receiver = Receiver(RxSampleRate(),nrx)
    #receiver = Receiver(RxOracle(),nrx)

    #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,代码行数:34,代码来源:trace_simulation.py

示例2: test_set_transmitter_exactly_once

 def test_set_transmitter_exactly_once(self):
     tt = Transmitter()
     url = 'whee.com'
     username = 'boyhowdy'
     account = Account(url, username, None)
     tt.set_account(account)
     aa = ElyxerEntry()
     aa.set_transmitter(tt)
     self.assertRaises(TransmitterAlreadyExistsError, lambda: aa.set_transmitter(tt))
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:9,代码来源:test_entry.py

示例3: test_upload_entry

 def test_upload_entry(self):
     tt = Transmitter()
     tt.set_account(self.account_with_good_password)
     filename = 'test_files/entry_test'
     entry = ElyxerEntry()
     entry.set_transmitter(tt)
     entry.load(filename)
     entry.set_title('WoooYAH!')
     tt.publish_entry(entry)
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:9,代码来源:test_transmitter.py

示例4: main

def main():
    if len(sys.argv) == 6:
        filename = sys.argv[1]
        card_type = sys.argv[2]
        energy_constraint = sys.argv[3]
        chan_pred = eval(sys.argv[4])
        increment = eval(sys.argv[5])
        print "filename: " + str(filename)
    else:
        print "Correct usage: python simulate_maxtput.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)
    num_chans = 1
    length = chan.create_chan(transmitter.Ntx, nrx)

    extname = (
        filename.split("/")[-1].split(".")[0]
        + "_"
        + card_type
        + "_"
        + energy_constraint
        + "_pred"
        + str(chan_pred)
        + "_inc"
        + str(increment)
    )
    # print extname
    receiver = PPrReceiver(PPrMinEngRA(card_type, energy_constraint, chan_pred), nrx, extname)

    if length > 10000:
        length = 10000
    # length = 2

    for num in range(0, length):
        itr_tic = time.clock()
        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)
        itr_toc = time.clock()
开发者ID:yichao0319,项目名称:Energy-Aware-RA-Simulator,代码行数:54,代码来源:simulate_pprmineng.py

示例5: test_publish_image

 def test_publish_image(self):
     Image.set_abs_reference_dir_from_html_file(self.filename)
     account = AccountManager.get_default_account()
     tt = Transmitter()
     tt.set_account(account)
     image = Image("some <img src='Suzanne.jpg' /> string")
     before = image.get_remote_src()
     self.assertEqual(before, None)
     tt.publish_image(image)
     after = image.get_remote_src()
     self.assertNotEqual(after, None)
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:11,代码来源:test_transmitter.py

示例6: __init__

 def __init__(self):
     self.__transmitter = Transmitter()
     self.__configpath  = self.__set_configpath()
     self.__config      = self.__init_config()
     self.__default_account = AccountManager.get_default_account()
     self.__accounts    = []
     self.__load_accounts_from_config()
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:7,代码来源:account_manager.py

示例7: main

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

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

    if length > 10000: length = 10000

    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,代码行数:39,代码来源:simulate_engtput.py

示例8: main

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])
       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)
    num_chans=1
    length = chan.create_chan(transmitter.Ntx,nrx)
 
    extname=filename.split('/')[-1].split('.')[0]+"_"+card_type+"_"+energy_constraint+"_pred"+str(chan_pred)
    receiver = Receiver(EffSnrRAEng(card_type,energy_constraint,chan_pred),nrx,extname)

    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,代码行数:36,代码来源:simulate_effsnr_mineng.py

示例9: main

def main():

    if len(sys.argv) == 5:
       filename = sys.argv[1]
       card_type = sys.argv[2]
       energy_constraint = sys.argv[3]
       chan_pred = False
       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) chan_increment"
        sys.exit(1)

    nrx=3
    # Create a tx
    ntx=3
    ta = None
    transmitter = Transmitter(ntx,ta)
    # Create a channel
    
    chan = TraceChan(filename,increment)
    length = chan.create_chan(transmitter.Ntx,nrx)
 
    ta = OraclePPrMaxTputRA(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 = PPrReceiver(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,代码行数:49,代码来源:simulate_oracle_pprmaxtput.py

示例10: start

def start():
    get_arguments()

    # Transmitter.transmit returns the new size of a block
    new_block_size = Transmitter.transmit(parameter_dict[K],
                                          parameter_dict[F])

    # for T trials, repeat the simulation
    for i in range(parameter_dict[T]):
        # clear this trial's variables
        trials_time = 0
        trials_received_frames = 0
        trials_failed_frames = 0

        # Set the first seed for the simulation
        Simulator.set_seed(parameter_dict[TSeeds][i])

        while (trials_time <= parameter_dict[R]):
            trials_received_blocks = 0  # new frame
            trials_failed_blocks = 0    # new frame

            # set the number of blocks to be transmitted in this frame
            transmissions = parameter_dict[K]

            if (parameter_dict[K] == 0):
                transmissions = 1

            # For K blocks (or 1 if K == 0), simulate the transmission
            for j in range(transmissions):  # range starts at 0
                # frame_failure = 0 if block was transmitted successfully
                block_failure = handle_block(new_block_size,
                                             parameter_dict[E],
                                             parameter_dict[K])

                # record block success or failure
                if (block_failure > 0):
                    trials_failed_blocks += 1
                else:
                    trials_received_blocks += 1

            # set trials_time to number of bits and response overhead
            trials_time += (parameter_dict[F] +
                            (parameter_dict[K] * Transmitter.r)
                            + parameter_dict[A])
            # update number of transmitted frames
            Statistics.update(Statistics.total_frames)
            # frame failed, resend the frame
            if(trials_failed_blocks >= 1):
                trials_failed_frames += 1
            # the last frame being sent (no longer needed) see forums
            #elif(trials_time > parameter_dict[R]):
            #    pass
            # successful transmition
            else:
                Statistics.update(Statistics.correctly_received_frames)
                trials_received_frames += 1

        #a print("Trial number:", i)
        #a print("Received Frames", trials_received_frames)
        #a print("Failed Frames", trials_failed_frames)

        # Assume: Take all K*(F+r) trials_time units into account
        # even if in last frame
        Statistics.append(Statistics.throughput_averages,
                          ((parameter_dict[F] * trials_received_frames)
                           / trials_time))

        if(trials_received_frames != 0):
            # Assume: Take all frames into account, even last frame
            Statistics.append(Statistics.frame_averages,
                              (trials_received_frames + trials_failed_frames) /
                              trials_received_frames)
        else:
            Statistics.append(Statistics.frame_averages, 0)

        # Add to total time
        Statistics.statistics_dict[Statistics.total_time] += trials_time

    # Call Print Statements
    #a print()
    #a print("----------------------------------------------")
    print_input(sys.argv)
    Statistics.set_final_values(parameter_dict[F], parameter_dict[R])
    Statistics.print_frame_ci()
    Statistics.print_throughput_ci()
开发者ID:Solanar,项目名称:CMPUT313_Asn1,代码行数:85,代码来源:main.py

示例11: InitLogging

    logging.basicConfig(level=logging.DEBUG,
                    format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s",
                    datefmt="%Y-%m-%d %H:%M:%S",
                    filename=filename,
                    filemode="w")
    console = logging.StreamHandler()
    console.setLevel(logging.NOTSET)
    formatter = logging.Formatter("%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s")
    console.setFormatter(formatter)
    logging.getLogger('').addHandler(console)

if __name__ == '__main__':
    InitLogging()
    handler = Handler()
    receiver = Receiver()
    transmitter = Transmitter()
    receiver.connect()

    td1 = threading.Thread(target=handler.run)
    td2 = threading.Thread(target=receiver.run)
    td3 = threading.Thread(target=transmitter.run)
    td1.start()
    td2.start()
    td3.start()

    # main loop
    while True:
        if handler.is_runing() and receiver.is_runing() and transmitter.is_runing():
            msg = receiver.fetch()
            while msg != None:
                handler.push(msg)
开发者ID:fangbei,项目名称:email_robot,代码行数:31,代码来源:main.py

示例12: Transmitter

else:
	logging.debug("MC running NOT on RPi")

GPIO.setmode(GPIO.BCM)
GPIO.setup(LED, GPIO.OUT) # status LED
GPIO.output(LED, GPIO.HIGH) # switch on to indicate software startup
GPIO.setup(RELEASE, GPIO.OUT) # release pin
GPIO.output(RELEASE, GPIO.LOW) # disable release
GPIO.setup(RELEASE_FB, GPIO.IN) # release feedback pin
GPIO.setup(HEADSHOT, GPIO.OUT) # set shutoff to output
GPIO.output(HEADSHOT, GPIO.LOW) # disable shutoff
GPIO.setup(CAMERA, GPIO.OUT) # set cam power to output
GPIO.output(CAMERA, GPIO.HIGH) # enable camera power

# setup the transmitter thread
txthread = Transmitter()
txthread.setDaemon(True)
txthread.start()

# setup the GPS-listener thread
gpsthread = GPSListener()
gpsthread.setDaemon(True)
gpsthread.start()

# wait for at least a 2D-Fix from the GPS
while GPSListener.fix < 2:
	pass
logging.info("MC GPS fix OK")

# indicate GPS fix on LED 
for i in range(1,15):
开发者ID:loetlab-jena,项目名称:xplorer,代码行数:31,代码来源:missionctl.py

示例13: test_check_credentials_bogus

 def test_check_credentials_bogus(self):
     tt = Transmitter()
     tt.set_account(self.bogus_account)
     self.assertEquals(tt.check_credentials(), 'host not found') 
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:4,代码来源:test_transmitter.py

示例14: test_check_credentials_no_password

 def test_check_credentials_no_password(self):
     tt = Transmitter()
     tt.set_account(self.account_with_no_password)
     self.assertEquals(tt.check_credentials(), True) 
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:4,代码来源:test_transmitter.py

示例15: test_check_credentials_bad_password

 def test_check_credentials_bad_password(self):
     tt = Transmitter()
     tt.set_account(self.account_with_bad_password)
     self.assertEquals(tt.check_credentials(), 'username/password error') 
开发者ID:jackdesert,项目名称:lyxblogger_oo,代码行数:4,代码来源:test_transmitter.py


注:本文中的transmitter.Transmitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。