Changeset 372
- Timestamp:
- 07/26/09 21:15:22 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/sriram/benchmark_txrxnode1.py
r367 r372 170 170 #tb.rxpath.disconnect(tb.rxpath.u, tb.rxpath.s2v,tb.rxpath.fft, tb.rxpath.c2mag, tb.rxpath.stats) 171 171 172 nbytes = 5 #int(1e6 * .0003)172 173 173 #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 = 5175 print "printing packet size",pkt_size,"pkt size\n"174 175 #print "printing packet size",pkt_size,"pkt size\n" 176 176 177 177 myfile = file("logfile.txt", 'w') … … 185 185 ################################################sync mode#################################### 186 186 if mode == "sync": 187 #sync_status = "False" 187 188 if sync_status != "True": 188 ch = int(random.choice([1 ,7,8,14]))189 ch = int(random.choice([1])) 189 190 if ch < 8: 190 191 hop_freq = float(1e6 * (462.5625+(ch-1)*0.025))#setting the centre freq frequency for sending packets … … 205 206 avg_energy = total_energy/1 206 207 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 channel208 if int(avg_energy) > 2e7: #if primary user is there then dont transmit on this channel 208 209 #while 209 210 continue 210 211 #print "present" 211 212 212 213 nbytes = 5 #int(1e6 * .0003) 214 pkt_size = 5 213 215 n = 0 214 216 pktno = 0 215 217 while n < nbytes: 216 217 218 if options_tx.from_file is None: 218 219 #data = (pkt_size - 2) * chr(pktno & 0xff) #0xff is 255 … … 227 228 228 229 send_pkt(tb,payload) 230 #print "sending this data ",data,"\n" 229 231 n += len(payload) 230 232 sys.stderr.write('.') … … 232 234 time.sleep(1) 233 235 pktno += 1 234 time.sleep(0. 05)236 time.sleep(0.1) 235 237 #resend_count += 1 236 238 else: … … 273 275 time.sleep(0.2) 274 276 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" 276 280 mode = "sync" 277 281 continue