예제 #1
0
              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',"])
예제 #2
0
    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",
    ylabel="",
    comment=comments,
    labels=["Base Station (mJ)", "Received Packets", "Lost Packets"],
    title="Energy Consumption & Received Packet Stat",
    plot_options=["color: 'red',"])

#simulation level

plotter.plots(
    [9, 25, 49, 81, 121],
    c_power,  #[e[0] for e in n_power], [e[1] for e in n_power],
    get_path(folder, "energy-Base Station"),
    more_plots=[[e[3] for e in n_power], [e[4] for e in n_power]],
    labels=["Base Station (mJ)", "Received Packets", "Lost Packets"],
    title=project_name + "\nEnergy Consumption & Received Packet Stat",
           '    Anc%    Localized   Not    runtime  |err>R|  '
           'avg_err  max_err  std_err  TX      Rx       SNR     Energy',
           footer=net.name + "\n" + comments)

plotter.plots(vary_range, [e[4] * k for e in loc_err],
              get_path(folder, experiment + " " + filename),
              more_plots=[[e[6] * k for e in loc_err], [e[9] for e in loc_err],
                          [e[10] for e in loc_err], [e[12] for e in loc_err]],
              labels=[
                  "Runtime", "$f_1$ - Avg. Loc. Error", "$f_2$ - No. of Tx",
                  "Rx", "Energy"
              ],
              title=experiment + "\n" + filename,
              xlabel=vary_name,
              ylabel="",
              format='pdf')

plotter.gethtmlLine(
    vary_range, [[e[4] for e in loc_err], [e[6] for e in loc_err],
                 [e[9] for e in loc_err], [e[12] for e in loc_err]],
    fname=experiment + " " + filename,
    folder=folder,
    xlabel=vary_name,
    ylabel="",
    labels=['Runtime', 'Avg. Local. Error', 'No. of Tx', 'Energy'],
    title=experiment + "<br>" + filename,
    open=1,
    plot_options=[
        "color: 'cyan',", "color: 'blue',", "color: 'red',", "color: 'green',"
    ])
예제 #4
0
        comment=comments,
        show_range=int(node.commRange),
        report=area + "<br>" + comments + "<br><br>" + str(stats),
        plot_options=[
            "color: 'red', visible: false,", "color: 'blue',",
            "color: 'green', visible: true,"
        ])

    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,"
        ])

    sr += 1

print loc_err
sp.savetxt(
    get_path(folder, "%s-%s.csv" % (experiment, filename)),
    loc_err,
    delimiter=",",
예제 #5
0
                           '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)),
           delimiter=",",
           fmt="%s",
           comments='',
           header="Node,actual,estimated,error")
예제 #6
0
                       comment=comments,
                       show_range=int(node.commRange),
                       report=area + "<br>" + comments + "<br><br>" +
                       str(stats),
                       plot_options=[
                           "color: 'red', visible: true,", "color: 'blue',",
                           "color: 'green', visible: true,"
                       ])

plotter.gethtmlLine(range(1, len(xpositions)),
                    [esterror, [row[6] for row in position_stats]],
                    fname="Error-" + filename,
                    folder=folder,
                    xlabel="Node",
                    ylabel="meters",
                    labels=['Estimated Errors', 'Good Anchors'],
                    title="Error-" + filename,
                    comment=comments,
                    open=1,
                    plot_options=[
                        "color: 'red',",
                        "type: 'bar', color: 'grey', visible: false,"
                    ])

# plotter.gethtmlLine(range(1,len(xpositions)), [consume, [row[1] for row in message_stats]],
#                 fname="Power-"+filename, folder=folder,
#                 xlabel="Node", ylabel="mJ", labels=['Energy','No. of Tx'],
#                 open=1, comment=comments, plot_type='line',
#                 plot_options=["color: 'red',", "color: 'blue',", "type: 'areaspline', color: 'grey', visible: false,"])
#
#
try:
예제 #7
0
    #                 plot_options=["color: 'red',", "color: 'blue',", "type: 'areaspline', color: 'grey', visible: false,"])

    sr += 1

print loc_err
sp.savetxt(get_path(folder, "%s-%s.csv" % (experiment, filename)),
           loc_err,
           delimiter=",", fmt="%8.2f", comments='',
           header=vary_name + '    Anc%    Localized   Not    runtime  |err>R|  '
                              'avg_err  max_err  std_err  TX      Rx       SNR     Energy',
           footer=net.name + "\n" + comments)

plotter.plots(vary_range, [e[4] * k for e in loc_err],
              get_path(folder, experiment + " " + filename),
              more_plots=[[e[6] * k for e in loc_err],
                          [e[9] for e in loc_err],
                          [e[10] for e in loc_err],
                          [e[12] for e in loc_err]],
              labels=["Runtime", "$f_1$ - Avg. Loc. Error", "$f_2$ - No. of Tx", "Rx", "Energy"],
              title=experiment + "\n" + filename,
              xlabel=vary_name, ylabel="", format='pdf')

plotter.gethtmlLine(vary_range, [[e[4] for e in loc_err],
                                 [e[6] for e in loc_err],
                                 [e[9] for e in loc_err],
                                 [e[12] for e in loc_err]],
                    fname=experiment + " " + filename, folder=folder,
                    xlabel=vary_name, ylabel="", labels=['Runtime', 'Avg. Local. Error', 'No. of Tx', 'Energy'],
                    title=experiment + "<br>" + filename, open=1,
                    plot_options=["color: 'cyan',", "color: 'blue',", "color: 'red',", "color: 'green',"])
예제 #8
0
           footer=net.name + "\n" + comments)


# Create html/JS file for network Topology
plotter.gethtmlScatter(xpositions, [anchpositions, positions, newpos],
                fname=filename, folder=folder,
                xlabel="X-coordinates", ylabel="Y-coordinates", 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=area+"<br>"+comments+"<br><br>" + str(stats),
                plot_options=["color: 'red', visible: true,", "color: 'blue',",
                              "color: 'green', visible: true,"])

plotter.gethtmlLine(range(1,len(xpositions)), [esterror, [row[6] for row in position_stats]],
                fname="Error-"+filename, folder=folder,
                xlabel="Node", ylabel="meters", labels=['Estimated Errors', 'Good Anchors'],
                title="Error-"+filename, comment=comments, open=1,
                plot_options=["color: 'red',", "type: 'bar', color: 'grey', visible: false,"])

# plotter.gethtmlLine(range(1,len(xpositions)), [consume, [row[1] for row in message_stats]],
#                 fname="Power-"+filename, folder=folder,
#                 xlabel="Node", ylabel="mJ", labels=['Energy','No. of Tx'],
#                 open=1, comment=comments, plot_type='line',
#                 plot_options=["color: 'red',", "color: 'blue',", "type: 'areaspline', color: 'grey', visible: false,"])
#
#
try:
#
#     sp.savetxt(get_path(folder, "Energy-%s.csv" %filename),
#                list(zip(nnd, energys, consume)),
#                delimiter="\t", fmt="%s",
예제 #9
0
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)),
           delimiter=",", fmt="%s", comments='',
           header="Node,actual,estimated,error")

print("Execution time:  %s seconds ---" % round(end_time,2) )
예제 #10
0
파일: zigbee.py 프로젝트: SoonSYJ/pymote2.0
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", ylabel="",
                comment=comments,
                labels=["Base Station (mJ)","Received Packets", "Lost Packets"],
                title="Energy Consumption & Received Packet Stat",
                plot_options=["color: 'red',"])

#simulation level

plotter.plots([9, 25, 49, 81, 121], c_power,  #[e[0] for e in n_power], [e[1] for e in n_power],
              get_path(folder, "energy-Base Station"),
              more_plots=[
                          [e[3] for e in n_power],
                          [e[4] for e in n_power]],
              labels=["Base Station (mJ)",
                      "Received Packets", "Lost Packets"],
              title="Energy Consumption & Received Packet Stat",
              xlabel="Nodes", ylabel="", format='png')
예제 #11
0
               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-coordinates", 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=area+"<br>"+comments+"<br><br>" + str(stats),
                    plot_options=["color: 'red', visible: true,", "color: 'blue',",
                                  "color: 'green', visible: true,"])

    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,"])

    sr +=1

print loc_err
sp.savetxt(get_path(folder, "%s-%s.csv" % (experiment, filename)),
               loc_err,
               delimiter=",", fmt="%8.2f", comments='',
               header='   Degree    Anc% Localized   Not    runtime  |err>R|  avg_err  max_err  std_err  '
                      'TX      Rx       SNR     Energy',
               footer=net.name + "\n" + comments)