NET_C_FE_RCV_MSG = 0x21 #:next hop receive:msg uid, origin, last_hop NET_C_FE_FWD_MSG = 0x22 #:fwd msg :msg uid, origin, next_hop NET_C_FE_DST_MSG = 0x23 #:base app. recv :msg_uid, origin, last_hop NET_DC_REPORT = 0x60 #duty cycle report :uint16_t dutyCycle, uint16_t time NET_LL_DUPLICATE = 0x61 #dropped duplicate packet seen in cache:dsn, source, accept NET_LPL_SENDDONE = 0x62 #report duration of send duty cycle #Filters a dict by only permitting certain keys. NET_APP_SENT = 0x70 #app. send :msg uid, origin NET_C_DIE = 0x71 NET_DC_REPORT = 0x60 #trace_20140420_212823.2 orw 0x1000 2 hour #trace_20140420_234914.3 path = '/home/nagatoyuki/Desktop/Thesis/Twist/trace_20140420_212823.2.txt' OrwdebugMsgs, _, _, _ = treader.load(path) path = '/home/nagatoyuki/Desktop/Thesis/Twist/trace_20140420_234914.3.txt' CtpdebugMsgs, _, _, CtpDataMsgs = treader.load(path) children_orw = defaultdict(set) num_fwd_orw = defaultdict(int) num_init_orw = defaultdict(int) route_hist_orw = defaultdict(set) DutyCycle_orw = defaultdict(list) dir_neig_orw = set() # This is the time when packet is generated timeline_orw = [] # this is every transmission timeline_transmit_orw = defaultdict(list) node_transmit_orw = defaultdict(list) PRR_orw = []
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') ax.plot(wakeup, ym[:,2], ls='--', color='g',label='ORW_LF')
NET_C_FE_RCV_MSG = 0x21 #:next hop receive:msg uid, origin, last_hop NET_C_FE_FWD_MSG = 0x22 #:fwd msg :msg uid, origin, next_hop NET_C_FE_DST_MSG = 0x23 #:base app. recv :msg_uid, origin, last_hop NET_DC_REPORT = 0x60 #duty cycle report :uint16_t dutyCycle, uint16_t time NET_LL_DUPLICATE = 0x61 #dropped duplicate packet seen in cache:dsn, source, accept NET_LPL_SENDDONE = 0x62 #report duration of send duty cycle #Filters a dict by only permitting certain keys. NET_APP_SENT = 0x70 #app. send :msg uid, origin NET_C_DIE = 0x71 NET_DC_REPORT = 0x60 #trace_20140420_212823.2 orw 0x1000 2 hour #trace_20140420_234914.3 path = '/home/nagatoyuki/Desktop/Thesis/Twist/trace_20140420_212823.2.txt' OrwdebugMsgs, _, _, _= treader.load(path) path = '/home/nagatoyuki/Desktop/Thesis/Twist/trace_20140420_234914.3.txt' CtpdebugMsgs, _, _, CtpDataMsgs= treader.load(path) children_orw = defaultdict(set) num_fwd_orw = defaultdict(int) num_init_orw = defaultdict(int) route_hist_orw = defaultdict(set) DutyCycle_orw = defaultdict(list) dir_neig_orw = set() # This is the time when packet is generated timeline_orw = [] # this is every transmission timeline_transmit_orw = defaultdict(list) node_transmit_orw = defaultdict(list)
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') ax.plot(wakeup, ym[:, 2], ls='--', color='g', label='ORW_LF')