Tmin = 6.0 Trx = 25.0 #time needed for a transmition to sink Ttx = 3.0 + 3.0 + 20 #cca + trans+ack + post(20ms) Tpost=20.0 Tipi = 1000*60.0 Tibi = 8*1000*60.0 y = [] for test in FileCollection_orw: if not TWIST: FileDict['OrwDebug'] = reader.loadDebug(base_path + test, FileNames['OrwDebug']) else: FileDict['OrwDebug'], FileDict['OrwNt'], _, _ = Treader.load(base_path + test) prop_orw = calprop.prop_orw(FileDict, result) templist = [] d1, d2, d3 = Seperate_Avg(prop_orw['Avg_Total_dc'], prop_orw['Dir_Neig'], prop_orw['Relay'], prop_orw['Leaf']) y.append((d1, d2, d3)) print "Dir_Neig:{:.2f} Relay:{:.2f} Leaf:{:.2f}".format(d1, d2, d3) fig = pl.figure() ax = fig.add_subplot(1,1,1) ym = np.array(y) ax.plot(wakeup, ym[:,0], ls='--', color='b', label='ORW_SN') ax.plot(wakeup, ym[:,1], ls='--', color='r',label='ORW_RL')
die_order_ctp = defaultdict(dict) total_count_ctp = [[] for i in range(0, numfiles)] connect_count_ctp = [[] for i in range(0, numfiles)] die_time_ctp = [[] for i in range(0, numfiles)] for i, logfile in enumerate(files_ctp): ''' if i == 0: FileNames['OrwDebug'] = ('23739.dat',) FileNames['CtpDebug'] = ('26099.dat',) else: FileNames['OrwDebug'] = ('26108.dat',) FileNames['CtpDebug'] = ('26102.dat',) ''' CtpDebugMsgs = reader.loadDebug(base_path+logfile, FileNames['CtpDebug']) #first iteration: construct the network connectivity graph G_ctp = nx.Graph() for msg in CtpDebugMsgs: if msg.type == NET_C_FE_SENT_MSG or msg.type == NET_C_FE_FWD_MSG: G_ctp.add_edge(msg.node, msg.dbg__c) total_connected = len(nx.shortest_path(G_ctp,SINK_ID)) - 1 total_count_ctp[i].append(total_connected) connect_count_ctp[i].append(total_connected) die_time_ctp[i].append(0) connect_list = nx.shortest_path(G_ctp,SINK_ID) print "Total connected nodes: {:3d}".format(total_connected) #Then remove the node one by one for msg in CtpDebugMsgs: if msg.type == NET_C_DIE:
#parameters Tmin = 6.0 Trx = 25.0 #time needed for a transmition to sink Ttx = 3.0 + 3.0 + 20 #cca + trans+ack + post(20ms) Tpost = 20.0 Tipi = 1000 * 60.0 Tibi = 8 * 1000 * 60.0 y = [] for test in FileCollection_orw: if not TWIST: FileDict['OrwDebug'] = reader.loadDebug(base_path + test, FileNames['OrwDebug']) else: FileDict['OrwDebug'], FileDict['OrwNt'], _, _ = Treader.load( base_path + test) prop_orw = calprop.prop_orw(FileDict, result) templist = [] d1, d2, d3 = Seperate_Avg(prop_orw['Avg_Total_dc'], prop_orw['Dir_Neig'], prop_orw['Relay'], prop_orw['Leaf']) y.append((d1, d2, d3)) print "Dir_Neig:{:.2f} Relay:{:.2f} Leaf:{:.2f}".format(d1, d2, d3) fig = pl.figure() ax = fig.add_subplot(1, 1, 1) ym = np.array(y) ax.plot(wakeup, ym[:, 0], ls='--', color='b', label='ORW_SN')