unlocalized.append([node.id, node.memory.get('I')]) xestpositions.append(newx) esterror.append(err) deltapos.append(net.pos[node][0] - newx) # Summary of simulation result/Metrics comments = "Runtime(s): "+ str(round(end_time,2)) + \ ", Nodes Localized: " + str(k) + "/" + str(len(unlocalized)) + \ ", Avg. error: " + str(round(err_sum/k, 2)) + \ "<br>Tx/Rx per node: " + str(int(total_tx/nn)) + "/" + \ str(int(total_rx/nn)) + \ ", Energy/node (mJ): " + str(round(1000*total_energy/nn, 2)) print(comments) stats = "Simulation Start at: " + getDateStr( sim.sim_start) + " UTC <br><br>" position_stats.append(np.round(np.mean(position_stats, axis=0), 2)) position_stats.append(np.round(np.min(position_stats, axis=0), 2)) position_stats.append(np.round(np.max(position_stats, axis=0), 2)) position_stats.append(np.round(np.std(position_stats, axis=0), 2)) stats += "Localization: [xr, yr, xl, yl, error]" \ "<br>Avg: " + str(position_stats[-4][1:]) + \ "<br>Min: " + str(position_stats[-3][1:]) + \ "<br>Max: " + str(position_stats[-2][1:]) + \ "<br>Std: " + str(position_stats[-1][1:]) + "<br>" message_stats.append(np.round(np.mean(message_stats, axis=0), 2)) message_stats.append(np.round(np.min(message_stats, axis=0), 2)) message_stats.append(np.round(np.max(message_stats, axis=0), 2))
# Summary of simulation result/Metrics comments = "Runtime(s): "+ str(round(end_time,2)) + "(" + \ str(round(end_time/nn,3)) + ")"+ \ ", Nodes Localized: " + str(k) + "/" + str(len(unlocalized)) + \ ", Avg. error: " + str(round(err_sum/k, 2)) + \ "<br>Tx/Rx per node: " + str(int(total_tx/nn)) + "/" + \ str(int(total_rx/nn)) + \ ", Energy/node (mJ): " + str(round(1000*total_energy/nn, 2)) + \ ", |Err>R|: " + str(len(X2[X2>comm_range])) if maxHop: comments += ", MaxHop: " + str(maxHop) else: comments += ", " + method print (comments) stats = "Simulation Start at: " + getDateStr(sim.sim_start) + " UTC <br><br>" position_stats.append(np.round(np.mean(position_stats, axis=0),2)) position_stats.append(np.round(np.min(position_stats, axis=0),2)) position_stats.append(np.round(np.max(position_stats, axis=0),2)) position_stats.append(np.round(np.std(position_stats, axis=0),2)) stats += "Localization: [xr, yr, xl, yl, error, hops]" \ "<br>Avg: " + str(position_stats[-4][1:]) + \ "<br>Min: " + str(position_stats[-3][1:]) + \ "<br>Max: " + str(position_stats[-2][1:]) + \ "<br>Std: " + str(position_stats[-1][1:]) + "<br>" message_stats.append(np.round(np.mean(message_stats, axis=0),2)) message_stats.append(np.round(np.min(message_stats, axis=0),2)) message_stats.append(np.round(np.max(message_stats, axis=0),2))