Changeset 395 for vtcross/trunk/src/cognitive_engines/DSA_CE/examples
- Timestamp:
- 07/30/09 11:04:21 (15 years ago)
- Files:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/cognitive_engines/DSA_CE/examples/gnuradio-examples/benchmark_dsa.py
r392 r395 98 98 o[0].name = "energy" 99 99 100 print probe_level101 102 100 o[1].value = absent_time 103 101 o[1].name = "communication_time" … … 127 125 128 126 stats_array[int(p[0].value)] = stats_array[int(p[0].value)] + 1 129 print "Stats:: 1..",stats_array[1]," 2..",stats_array[2]," 3..",stats_array[3]," 4..",stats_array[4]130 127 return channel,hop_freq #returning the channel number and hop frequency 131 128 … … 153 150 ack_payload = struct.pack('!HsH', pktno & 0xffff,data,ch & 0xffff) #+ data 154 151 send_pkt(tb,ack_payload) #sending back the acknowledgement 155 #else:156 # print "sync packet not ok\n"157 152 ################################################################### 158 153 … … 168 163 send_pkt(tb,payload) 169 164 170 #else:171 # print "data packet not ok\n"172 165 ############################################################## 173 166 … … 175 168 if ok: 176 169 n_right += 1 177 178 #print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (179 # ok, pktno, n_rcvd, n_right)180 181 170 182 171 mods = modulation_utils.type_1_mods() … … 231 220 sys.exit(1) 232 221 233 #if options_tx.from_file is not None:234 # source_file = open(options_tx.from_file, 'r')235 236 222 parser_rx = OptionParser (option_class=eng_option, conflict_handler="resolve") 237 223 expert_grp_rx = parser_rx.add_option_group("Expert_rx") 238 #parser_rx.add_option("-m", "--modulation", type="choice", choices=demods.keys(),239 # default='gmsk',240 # help="Select modulation from: %s [default=%%default]"241 # % (', '.join(demods.keys()),))242 243 224 receive_path.add_options(parser_rx, expert_grp_rx) 244 225 245 #for mod in demods.values():246 # mod.add_options(expert_grp_rx)247 248 226 (options_rx, args_rx) = parser_rx.parse_args () 249 227 250 #if len(args_rx) != 0:251 # parser_rx.print_help(sys.stderr)252 # sys.exit(1)253 228 ############# Setting some default values for rx side of the block 254 229 options_rx.rx_freq = 462.5625e6 #setting default rx_freq value … … 260 235 ############# 261 236 262 #if options_rx.rx_freq is None:263 # sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")264 # parser_rx.print_help(sys.stderr)265 # sys.exit(1)266 267 237 # build the graph 268 238 … … 286 256 time.sleep(0.1) 287 257 258 print "\n[[ Scanning channels for network nodes ]]\n" 288 259 while running: 289 260 … … 329 300 330 301 else: 331 print " sync channel found..channel ",ch,"\n"302 print "\n\n[[ Network Node Found: Commencing communications on CHANNEL ", ch, " ]]\n"; 332 303 n_attempts_counter = 0 333 304 mode = "traffic" … … 359 330 360 331 send_pkt(tb,payload) 361 #print "printing payload",data,"**\n"362 332 n += len(payload) 363 333 sys.stderr.write('.') … … 379 349 _elapsed_time = start_time - stop_time 380 350 elapsed_time = _elapsed_time.seconds 381 print "primary user detected..moving out of this channel\n" 351 print "\n[[ Primary User Detected: Evacuating Current Channel ]]\n" 352 print "\n[[ Scanning channels for network nodes ]]\n" 382 353 mode = "sync" 383 354 return_flag = 1