From 7309767d060a3ab1c6b3415fdb6ba6ce2fea435f Mon Sep 17 00:00:00 2001 From: nifi Date: Sun, 24 Oct 2010 21:40:54 +0000 Subject: [PATCH] The collect view functions now take the node's routing metric, not the parent's routing metric. --- .../src/se/sics/contiki/collect/CollectServer.java | 8 ++++---- .../sics/contiki/collect/SensorDataAggregator.java | 12 ++++++------ .../src/se/sics/contiki/collect/SensorInfo.java | 8 ++++---- 3 files changed, 14 insertions(+), 14 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 1eb963a90..c7e38eb9c 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.30 2010/10/22 20:39:13 nifi Exp $ + * $Id: CollectServer.java,v 1.31 2010/10/24 21:40:54 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/10/22 20:39:13 $ - * $Revision: 1.30 $ + * Updated : $Date: 2010/10/24 21:40:54 $ + * $Revision: 1.31 $ */ package se.sics.contiki.collect; @@ -359,7 +359,7 @@ public class CollectServer implements SerialConnectionListener { axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } protected double getSensorDataValue(SensorData data) { - return data.getValue(SensorData.BEST_NEIGHBOR_RTMETRIC) + data.getBestNeighborETX(); + return data.getValue(SensorData.RTMETRIC); } }, new TimeChartPanel(this, NETWORK, "ETX (Over Time)", "ETX to Next Hop", "Time", "ETX") { 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 aa8bb45df..f103abe6f 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.11 2010/10/07 20:59:48 nifi Exp $ + * $Id: SensorDataAggregator.java,v 1.12 2010/10/24 21:40:54 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 20 aug 2008 - * Updated : $Date: 2010/10/07 20:59:48 $ - * $Revision: 1.11 $ + * Updated : $Date: 2010/10/24 21:40:54 $ + * $Revision: 1.12 $ */ package se.sics.contiki.collect; @@ -55,7 +55,7 @@ public class SensorDataAggregator implements SensorInfo { private int lost = 0; private int nodeRestartCount = 0; private int nextHopChangeCount = 0; - private int lastNextHop = 0; + private int lastNextHop = -1; private long shortestPeriod = Long.MAX_VALUE; private long longestPeriod = 0; @@ -93,7 +93,7 @@ public class SensorDataAggregator implements SensorInfo { int s = seqn + seqnoDelta; int bestNeighbor = data.getValue(BEST_NEIGHBOR); - if (lastNextHop != bestNeighbor && lastNextHop != 0) { + if (lastNextHop != bestNeighbor && lastNextHop >= 0) { nextHopChangeCount++; } lastNextHop = bestNeighbor; @@ -242,7 +242,7 @@ public class SensorDataAggregator implements SensorInfo { } public double getAverageRtmetric() { - return dataCount > 0 ? ((values[BEST_NEIGHBOR_RTMETRIC] + (values[BEST_NEIGHBOR_ETX] / 8.0)) / dataCount) : 0.0; + return getAverageValue(RTMETRIC); } public double getAverageRadioIntensity() { diff --git a/examples/sky-shell/src/se/sics/contiki/collect/SensorInfo.java b/examples/sky-shell/src/se/sics/contiki/collect/SensorInfo.java index a166fdbc8..54e9627eb 100644 --- a/examples/sky-shell/src/se/sics/contiki/collect/SensorInfo.java +++ b/examples/sky-shell/src/se/sics/contiki/collect/SensorInfo.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: SensorInfo.java,v 1.4 2010/10/12 11:39:10 adamdunkels Exp $ + * $Id: SensorInfo.java,v 1.5 2010/10/24 21:40:54 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 20 aug 2008 - * Updated : $Date: 2010/10/12 11:39:10 $ - * $Revision: 1.4 $ + * Updated : $Date: 2010/10/24 21:40:54 $ + * $Revision: 1.5 $ */ package se.sics.contiki.collect; @@ -70,7 +70,7 @@ public interface SensorInfo { public static final int TIME_LISTEN = 14; public static final int BEST_NEIGHBOR = 15; public static final int BEST_NEIGHBOR_ETX = 16; - public static final int BEST_NEIGHBOR_RTMETRIC = 17; + public static final int RTMETRIC = 17; public static final int NUM_NEIGHBORS = 18; public static final int BEACON_INTERVAL = 19; public static final int BATTERY_VOLTAGE = 20;