telosb中RSSI與距離的分析

In certain experiments, the robots are configured with TelosB devices, which contain cc2420 radios. The TelosB devices are programmed to transmit and receive 802.15.4 wireless beacons. Each time a beacon is received, the RSSI (received signal strength indicator) and LQI (link quality indicator) of the reception are recorded. Since the robots are continuously recording their GPS coordinates, correlations between RSSI/LQI can be investigated. This page covers how to extract and visualize this information. It uses the Pharos Middleware and gnuPlot.

Extracting the cc2420 Signal Strength Data From All Nodes in an Experiment

The program used to extract the signal strength vs. distance data is pharoslabut.logger.analyzer.SignalStrengthVsDist. Its command line usage is as follows:

$ java -classpath "path/to/PharosMiddleware.jar" pharoslabut.logger.analyzer.SignalStrengthVsDist \
  -telos -expDir [directory containing experiment data] -output [output file in which results are saved]

For example, the following command will extract the signal strength vs. distance for Mission 15, Experiment 1, and save it in file M15-Exp1-SSvD-All-cc2420.data:

$ java -classpath "path/to/PharosMiddleware.jar" \
  pharoslabut.logger.analyzer.SignalStrengthVsDist -telos -expDir Results/M15-Exp1/ \
  -output M15-Exp1-SSvD-All-cc2420.data

Plotting the Data to Visualize it

Once you have extracted the data, you can plot it using gnuPlot. For example, the following script generates two plots, RSSI vs. distance and LQI vs. distance for all nodes in Mission 15, Experiment 1. It assumes that the data is stored in M15-Exp1-SSvD-All-cc2420.data.

set title "M15-Exp1 cc2420 RSSI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "RSSI (dBm)"
plot "M15-Exp1-SSvD-All-cc2420.data" using 5:7 notitle lc rgb "blue"
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-RSSI.png"
replot

set title "M15-Exp1 cc2420 LQI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "LQI"
plot "M15-Exp1-SSvD-All-cc2420.data" using 5:6 notitle lc rgb "blue"
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-LQI.png"
replot

Assuming the above script is saved in file M15-Exp1-SSvD-All-cc2420.gnuplot, you can generate the graphs using the following command. Note that both M15-Exp1-SSvD-All-cc2420.data and M15-Exp1-SSvD-All-cc2420.gnuplot must be in the local directory from which you are executing gnuplot.

$ gnuplot M15-Exp1-SSvD-All-cc2420.gnuplot

Here are the resulting graphs:

M15-Exp1-SSvD-All-cc2420-RSSI.png M15-Exp1-SSvD-All-cc2420-LQI.png

Generating Averages and Confidence Intervals

Suppose that instead of plotting every data point separately, you want to plot averages and confidence intervals. To do this, you can feed the original data file generated above to program pharoslabut.logger.analyzer.ssvd.TelosBSSvDAvgGenerator. Its command line usage is as follows:

$ java -classpath "path/to/PharosMiddleware.jar" pharoslabut.logger.analyzer.ssvd.TelosBSSvDAvgGenerator \
  -intput [input file] -output [output file]

The [input file] is the output of pharoslabut.logger.analyzer.SignalStrengthVsDist.

Plotting the Averages on a Graph

Once you have generated the averages, you can plot it using the following gnuplot script. The following script assumes that the raw data is stored in file M15-Exp1-SSvD-All-cc2420.data and the average data is stored in files M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data and M15-Exp1-SSvD-All-cc2420-Avg-LQI.data.

set title "M15-Exp1 cc2420 RSSI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "RSSI (dBm)"
plot "M15-Exp1-SSvD-All-cc2420.data" using 5:7 notitle lc rgb "blue", \
     "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" smooth csplines notitle with lines 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" notitle with errorbars 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" notitle with points 1 5
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-RSSI.png"
replot

set title "M15-Exp1 cc2420 LQI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "LQI"
plot "M15-Exp1-SSvD-All-cc2420.data" using 5:6 notitle lc rgb "blue", \
     "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" smooth csplines notitle with lines 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" notitle with errorbars 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" notitle with points 1 5
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-LQI.png"
replot

set title "M15-Exp1 cc2420 Average RSSI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "RSSI (dBm)"
plot "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" smooth csplines notitle with lines 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" notitle with errorbars 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-RSSI.data" notitle with points 1 5
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-RSSI-Avg.png"
replot

set title "M15-Exp1 cc2420 Average LQI vs Distance of All Nodes"
set xlabel "Distance (m)"
set ylabel "LQI"
set yrange [50:110]
plot "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" smooth csplines notitle with lines 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" notitle with errorbars 1 5, \
     "M15-Exp1-SSvD-All-cc2420-Avg-LQI.data" notitle with points 1 5
set terminal png
set output "M15-Exp1-SSvD-All-cc2420-LQI-Avg.png"
replot

The script above will generate four plots. Two plots will have the averages super-imposed on all of the data, while the other two plots will be just the averages with confidence intervals. The four plots generated by the script above for Mission 15, Experiment 1.

M15-Exp1-SSvD-All-cc2420-RSSI-AllAvg.png M15-Exp1-SSvD-All-cc2420-LQI-AllAvg.png M15-Exp1-SSvD-All-cc2420-RSSI-Avg.png M15-Exp1-SSvD-All-cc2420-LQI-Avg.png

Generating a Histogram of the Data

Suppose you want to view a histogram of the signal-strength vs. distance data. To do this, you can feed the original data file generated bypharoslabut.logger.analyzer.SignalStrengthVsDist to pharoslabut.logger.analyzer.ssvd.TelosBSSvDHistogramGenerator. Its command line usage is as follows:

$ java -classpath "path/to/PharosMiddleware.jar" pharoslabut.logger.analyzer.ssvd.TelosBSSvDHistogramGenerator \
  -intput [input file] -output [output file]

The [input file] is the output of pharoslabut.logger.analyzer.SignalStrengthVsDist.

For example, the following command will generate a histogram of the cc2420 receptions for Mission 15, Experiment 1:

java -classpath "path/to/PharosMiddleware.jar" pharoslabut.logger.analyzer.ssvd.TelosBSSvDHistogramGenerator -input M15-Exp1-SSvD-All-cc2420.data -output M15-Exp1-SSvD-All-cc2420-hist

Note that the output does not include a file extension. Instead, the program will automatically create two files with different extensions:

  1. M15-Exp1-SSvD-All-cc2420-hist.data
  2. M15-Exp1-SSvD-All-cc2420-hist.gnuplot

The second file is actually a gnuplot script that is used to generate the chart. Here is the chart for Mission 15, Experiment 1:

M15-Exp1-SSvD-All-cc2420-hist.png


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章