", Total Energy (mJ): " + str(round(total_energy, 1)) + \ "<br>Tx & Rx: " + str(int(t_transmit)) + " & " + str(int(t_received)) + \ ", Total Packet Loss: " + str(int(t_received_failed)) print comments # Create html/JS file for network Topology plotter.gethtmlScatter( xpositions, [anchpositions, positions], fname=filename, folder=folder, xlabel="X-coordinates", ylabel="Y-coordinates", labels=['Base Station', 'Sensor'], title="Topology-" + filename, axis_range={ 'xmin': 0, 'ymin': 0, 'xmax': w, 'ymax': h }, comment=comments, show_range=int(global_settings.COMM_RANGE), plot_options=["color: 'red', visible: true,", "color: 'blue',"]) plotter.gethtmlLine( [9, 25, 49, 81, 121], [c_power, [e[3] for e in n_power], [e[4] for e in n_power]], fname="Stat-" + filename, folder=folder, xlabel="Nodes",
sp.savetxt(get_path(folder, "Localization-%s.csv" % filename), position_stats, delimiter=",", fmt="%8.2f", comments='', header="Node,Xactual,Yactual,Xestimated,Yestimated,RMSerror") sp.savetxt(get_path(folder, "Localization2-%s.csv" % filename), position_stats2, delimiter=",", fmt="%8.2f", comments='', header="Node,Xactual,Yactual,Xestimated,Yestimated,RMSerror") # Create html/JS file for network Topology plotter.gethtmlScatter(xpositions, [anchpositions, positions, newpos], fname=filename, folder=folder, xlabel="X-coordinates", ylabel="Y-ccordinates", labels=['Anchor','Regular','Localized'], title="Topology-"+filename, open=1, axis_range={'xmin':0, 'ymin':0, 'xmax': w, 'ymax': h}, comment=comments, show_range=int(node.commRange),report=comments+"<br><br>" + str(stats), plot_options=["color: 'red', visible: false,", "color: 'blue',", "color: 'green', visible: true,"]) net.reset() # plotter.gethtmlLine(range(1,len(xpositions)), [xpositions, xestpositions, deltapos, esterror], # fname="X-"+filename, folder=folder, # xlabel="Node", ylabel="meters", labels=['Actual', 'Estimated', 'X-Error', 'Est. Error'], # title="X-"+filename, open=1, # comment=comments, # plot_options=["color: 'red',", "color: 'blue',", "type: 'areaspline', color: 'grey', visible: false,"]) # # plotter.gethtmlLine(range(1,len(xpositions)), [consume, [row[1] for row in message_stats]], # fname="Power-"+filename, folder=folder,
end_time = time.time() - start_time ntx = 345 comments = "Anchors: " + str(n_anchors) +"="+str(p_anchors) +"%"+ \ ", Runtime(sec): "+ str(round(end_time,2)) + \ ", No. of Tx: " + str(ntx) plotter.gethtmlScatter(xpositions, [anchpositions, positions, newpos], fname="Topology-" + net.name, folder=TOPOLOGY_DIR, xlabel="X", ylabel="Y", labels=['Anchor', 'Regular', 'Localized'], title="Topology-" + net.name, open=1, range={ 'xmin': 0, 'ymin': 0, 'xmax': w, 'ymax': h }, comment=comments, show_range=node.commRange, plot_options=[ "color: 'red', visible: false,", "color: 'blue',", "color: 'green', visible: false," ]) plotter.gethtmlLine( range(1, len(xpositions)), [xpositions, xestpositions, deltapos], fname="X-" + net.name, folder=TOPOLOGY_DIR, xlabel="Node",
get_path(folder, "LQI_Base_Station-%s" % n), title="LQI's",format='png', xlabel="Packet Number", ylabel="LQI") plotter.plot_bars(np.arange(1, n+1), consume, get_path(folder, "energy consumption-", prefix=n), ymax=1.1*max(consume), ymin=0.9*min(consume),format='png', title="Energy Consumption (%s nodes)" % n, xlabel="Nodes", ylabel="mJ") plotter.plot_bars(np.arange(1, n+1), loss, get_path(folder, "Loss Packets-", prefix=n), ymax=1.1*max(loss), ymin=0.9*min(loss),format='png', title="Loss Packets (%s nodes)" % n, xlabel="Nodes", ylabel="No.") sim.reset() # Create html/JS file for network Topology plotter.gethtmlScatter(xpositions, [anchpositions, positions], fname=filename, folder=folder, xlabel="X-coordinates", ylabel="Y-coordinates", labels=['Base Station','Sensor'], title="Topology-"+filename, open=1, axis_range={'xmin':0, 'ymin':0, 'xmax': w, 'ymax': h}, show_range=int(global_settings.COMM_RANGE), plot_options=["color: 'red', visible: true,", "color: 'blue',"]) plotter.gethtmlLine(np.arange(len(snr_base[1:])), [snr_base[1:]], fname="SNR-"+filename, folder=folder, xlabel="Packet", ylabel="SNR", labels=['SNR'], title="SNR-"+filename, open=1, plot_options=["color: 'red',"])
% (net_gen.name, net.__len__(), int(avg_deg), int(node.commRange)) net.savefig(fname=get_path(TOPOLOGY_DIR, net.name), title=net.name, format='pdf', x_label="X", y_label="Y", show_labels=False) print net.__len__(),avg_deg, node.commRange, n_anchors end_time = time.time() - start_time ntx = 345 comments = "Anchors: " + str(n_anchors) +"="+str(p_anchors) +"%"+ \ ", Runtime(sec): "+ str(round(end_time,2)) + \ ", No. of Tx: " + str(ntx) plotter.gethtmlScatter(xpositions, [anchpositions, positions, newpos], fname="Topology-"+net.name, folder=TOPOLOGY_DIR, xlabel="X", ylabel="Y", labels=['Anchor','Regular','Localized'], title="Topology-"+net.name, open=1, range={'xmin':0, 'ymin':0, 'xmax': w, 'ymax': h}, comment=comments, show_range=node.commRange, plot_options=["color: 'red', visible: false,", "color: 'blue',", "color: 'green', visible: false,"]) plotter.gethtmlLine(range(1,len(xpositions)), [xpositions, xestpositions, deltapos], fname="X-"+net.name, folder=TOPOLOGY_DIR, xlabel="Node", ylabel="X-Coordinate", labels=['Actual', 'Estimated', 'Error'], title="X-"+net.name, open=1, comment=comments, plot_options=["color: 'red','marker': {'symbol': 'circle', 'radius': '8'}", "color: 'blue',", "type: 'areaspline',color: 'grey', visible: false,"]) dt = [range(1,len(xpositions)+1), xpositions, xestpositions, deltapos] np.savetxt(get_path(TOPOLOGY_DIR, net.name+".csv"), np.column_stack((dt)),