Changeset 372

Show
Ignore:
Timestamp:
07/26/09 21:15:22 (15 years ago)
Author:
sriram
Message:

Fixing bug and changing the threshold

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/branches/sriram/benchmark_txrxnode1.py

    r367 r372  
    170170    #tb.rxpath.disconnect(tb.rxpath.u, tb.rxpath.s2v,tb.rxpath.fft, tb.rxpath.c2mag, tb.rxpath.stats) 
    171171 
    172     nbytes = 5 #int(1e6 * .0003) 
     172     
    173173    #options_tx.size = 6 #2 bytes for packet size,2 bytes for the synchronization request(including redundant bit) and 2 bits to specify the channel number(including redundant bit) 
    174     pkt_size = 5 
    175     print "printing packet size",pkt_size,"pkt size\n" 
     174     
     175    #print "printing packet size",pkt_size,"pkt size\n" 
    176176     
    177177    myfile = file("logfile.txt", 'w') 
     
    185185        ################################################sync mode#################################### 
    186186        if mode == "sync": 
     187                #sync_status = "False" 
    187188                if sync_status != "True": 
    188                         ch = int(random.choice([1,7,8,14])) 
     189                        ch = int(random.choice([1])) 
    189190                        if ch < 8: 
    190191                                hop_freq = float(1e6 * (462.5625+(ch-1)*0.025))#setting the centre freq frequency for sending packets 
     
    205206                        avg_energy = total_energy/1 
    206207                        print "printing hop frequency ",hop_freq,"and energy is ",avg_energy,"\n" 
    207                         if int(avg_energy) > 1.50e8: #if primary user is there then dont transmit on this channel 
     208                        if int(avg_energy) > 2e7: #if primary user is there then dont transmit on this channel 
    208209                                #while  
    209210                                continue 
    210211                                #print "present" 
    211212                         
    212  
     213                        nbytes = 5 #int(1e6 * .0003) 
     214                        pkt_size = 5 
    213215                        n = 0 
    214216                        pktno = 0 
    215217                        while n < nbytes: 
    216                          
    217218                                if options_tx.from_file is None: 
    218219                                        #data = (pkt_size - 2) * chr(pktno & 0xff) #0xff is 255 
     
    227228         
    228229                                send_pkt(tb,payload) 
     230                                #print "sending this data ",data,"\n" 
    229231                                n += len(payload) 
    230232                                sys.stderr.write('.') 
     
    232234                                        time.sleep(1) 
    233235                                        pktno += 1 
    234                         time.sleep(0.05) 
     236                        time.sleep(0.1) 
    235237                #resend_count += 1  
    236238                else: 
     
    273275                        time.sleep(0.2) 
    274276                        ch_energy = tb.rxpath.probe.level() #check if primary user is present 
    275                         if int(ch_energy) > 1.50e8: #if primary user is there then dont transmit on this channel 
     277                        print "energy is ",ch_energy,"\n" 
     278                        if int(ch_energy) > 2e7: #if primary user is there then dont transmit on this channel 
     279                                print "primary user detected..moving out of this channel\n" 
    276280                                mode = "sync" 
    277281                                continue