From 2642a5517410b5d3602f6915ec33829dd515046d Mon Sep 17 00:00:00 2001 From: nifi Date: Thu, 30 Sep 2010 22:24:45 +0000 Subject: [PATCH] Added Routing Metric and ETX --- .../sics/contiki/collect/CollectServer.java | 28 +++++++++++++-- .../src/se/sics/contiki/collect/Node.java | 9 ++--- .../contiki/collect/SensorDataAggregator.java | 10 ++++-- .../contiki/collect/gui/NodeInfoPanel.java | 34 ++++++++++++------- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/examples/sky-shell/src/se/sics/contiki/collect/CollectServer.java b/examples/sky-shell/src/se/sics/contiki/collect/CollectServer.java index e03d216f6..dc5089602 100644 --- a/examples/sky-shell/src/se/sics/contiki/collect/CollectServer.java +++ b/examples/sky-shell/src/se/sics/contiki/collect/CollectServer.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: CollectServer.java,v 1.21 2010/09/28 23:12:16 nifi Exp $ + * $Id: CollectServer.java,v 1.22 2010/09/30 22:24:45 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/09/28 23:12:16 $ - * $Revision: 1.21 $ + * Updated : $Date: 2010/09/30 22:24:45 $ + * $Revision: 1.22 $ */ package se.sics.contiki.collect; @@ -331,6 +331,28 @@ public class CollectServer { dataset.addValue(data.getNode().getSensorDataAggregator().getAverageValue(SensorData.HOPS), categories[1], data.getNode().getName()); } }, + new TimeChartPanel(this, NETWORK, "Routing Metric (Over Time)", "Routing Metric", "Time", "Routing Metric") { + { + ValueAxis axis = chart.getXYPlot().getRangeAxis(); + ((NumberAxis)axis).setAutoRangeIncludesZero(true); + axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + setMaxItemCount(defaultMaxItemCount); + } + protected double getSensorDataValue(SensorData data) { + return data.getValue(SensorData.BEST_NEIGHBOR_RTMETRIC) + data.getValue(SensorData.BEST_NEIGHBOR_ETX); + } + }, + new TimeChartPanel(this, NETWORK, "ETX (Over Time)", "ETX to Next Hop", "Time", "ETX") { + { + ValueAxis axis = chart.getXYPlot().getRangeAxis(); + ((NumberAxis)axis).setAutoRangeIncludesZero(true); + axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + setMaxItemCount(defaultMaxItemCount); + } + protected double getSensorDataValue(SensorData data) { + return data.getValue(SensorData.BEST_NEIGHBOR_ETX); + } + }, new AggregatedTimeChartPanel(this, NETWORK, "Next Hop (Over Time)", "Time", "Next Hop Changes") { { diff --git a/examples/sky-shell/src/se/sics/contiki/collect/Node.java b/examples/sky-shell/src/se/sics/contiki/collect/Node.java index dc8bae5a7..33d749bb5 100644 --- a/examples/sky-shell/src/se/sics/contiki/collect/Node.java +++ b/examples/sky-shell/src/se/sics/contiki/collect/Node.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: Node.java,v 1.5 2010/09/14 22:40:59 nifi Exp $ + * $Id: Node.java,v 1.6 2010/09/30 22:24:45 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/09/14 22:40:59 $ - * $Revision: 1.5 $ + * Updated : $Date: 2010/09/30 22:24:45 $ + * $Revision: 1.6 $ */ package se.sics.contiki.collect; @@ -56,7 +56,8 @@ public class Node implements Comparable { private final String id; private final String name; - private int x = -1, y = -1; + public int x = -1; + public int y = -1; private Hashtable objectTable; diff --git a/examples/sky-shell/src/se/sics/contiki/collect/SensorDataAggregator.java b/examples/sky-shell/src/se/sics/contiki/collect/SensorDataAggregator.java index 98da6bd59..c2f089d2d 100644 --- a/examples/sky-shell/src/se/sics/contiki/collect/SensorDataAggregator.java +++ b/examples/sky-shell/src/se/sics/contiki/collect/SensorDataAggregator.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SensorDataAggregator.java,v 1.9 2010/09/24 05:54:04 nifi Exp $ + * $Id: SensorDataAggregator.java,v 1.10 2010/09/30 22:24:45 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 20 aug 2008 - * Updated : $Date: 2010/09/24 05:54:04 $ - * $Revision: 1.9 $ + * Updated : $Date: 2010/09/30 22:24:45 $ + * $Revision: 1.10 $ */ package se.sics.contiki.collect; @@ -241,6 +241,10 @@ public class SensorDataAggregator implements SensorInfo { return dataCount > 0 ? (-39.6 + 0.01 * (values[TEMPERATURE] / dataCount)) : 0.0; } + public double getAverageRtmetric() { + return dataCount > 0 ? ((values[BEST_NEIGHBOR_RTMETRIC] + values[BEST_NEIGHBOR_ETX]) / dataCount) : 0.0; + } + public double getAverageRadioIntensity() { return getAverageValue(RSSI); } diff --git a/examples/sky-shell/src/se/sics/contiki/collect/gui/NodeInfoPanel.java b/examples/sky-shell/src/se/sics/contiki/collect/gui/NodeInfoPanel.java index e0ffd8287..634f2dacc 100644 --- a/examples/sky-shell/src/se/sics/contiki/collect/gui/NodeInfoPanel.java +++ b/examples/sky-shell/src/se/sics/contiki/collect/gui/NodeInfoPanel.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: NodeInfoPanel.java,v 1.7 2010/09/26 21:48:21 nifi Exp $ + * $Id: NodeInfoPanel.java,v 1.8 2010/09/30 22:24:45 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 6 sep 2010 - * Updated : $Date: 2010/09/26 21:48:21 $ - * $Revision: 1.7 $ + * Updated : $Date: 2010/09/30 22:24:45 $ + * $Revision: 1.8 $ */ package se.sics.contiki.collect.gui; @@ -113,6 +113,16 @@ public class NodeInfoPanel extends JPanel implements Visualizer, Configurable { return node.getSensorDataAggregator().getAverageValue(SensorData.HOPS); } }, + new TableData("Average Rtmetric", "Average Routing Metric", Double.class) { + public Object getValue(Node node) { + return node.getSensorDataAggregator().getAverageRtmetric(); + } + }, + new TableData("Average ETX", "Average ETX to Next Hop", Double.class) { + public Object getValue(Node node) { + return node.getSensorDataAggregator().getAverageValue(SensorData.BEST_NEIGHBOR_ETX); + } + }, new TableData("Next Hop Changes", "Next Hop Change Count", Integer.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getNextHopChangeCount(); @@ -123,50 +133,50 @@ public class NodeInfoPanel extends JPanel implements Visualizer, Configurable { public Object getValue(Node node) { return node.getSensorDataAggregator().getEstimatedRestarts(); } - }.setVisible(false), + }, // Power new TableData("CPU Power", "Average CPU Power Consumption", Double.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getCPUPower(); } - }.setVisible(false), + }, new TableData("LPM Power", "Average LPM Power Consumption", Double.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getLPMPower(); } - }.setVisible(false), + }, new TableData("Listen Power", "Average Radio Listen Power Consumption", Double.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getListenPower(); } - }.setVisible(false), + }, new TableData("Transmit Power", "Average Radio Transmit Power Consumption", Double.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getTransmitPower(); } - }.setVisible(false), + }, new TableData("Power", "Average Power Consumption", Double.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getAveragePower(); } - }.setVisible(false), + }, new TableData("Power Time", "Power Measure Time", Long.class) { public Object getValue(Node node) { return node.getSensorDataAggregator().getPowerMeasureTime(); } - }.setVisible(false), + }, new TableData("Listen Duty Cycle", "Average Radio Listen Duty Cycle (%)", Double.class) { public Object getValue(Node node) { return 100 * node.getSensorDataAggregator().getAverageDutyCycle(SensorInfo.TIME_LISTEN); } - }.setVisible(false), + }, new TableData("Transmit Duty Cycle", "Average Radio Transmit Duty Cycle (%)", Double.class) { public Object getValue(Node node) { return 100 * node.getSensorDataAggregator().getAverageDutyCycle(SensorInfo.TIME_TRANSMIT); } - }.setVisible(false), + }, // Inter-packet times new TableData("Average Inter-packet Time", Long.class) {