Added a radio duty cycle tab; made packet reception chart have integer labels

This commit is contained in:
adamdunkels 2010-09-14 14:23:58 +00:00
parent 4b0ffb0739
commit 3a4b479704
3 changed files with 38 additions and 17 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: CollectServer.java,v 1.14 2010/09/14 11:27:23 nifi Exp $ * $Id: CollectServer.java,v 1.15 2010/09/14 14:23:58 adamdunkels Exp $
* *
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* *
@ -34,8 +34,8 @@
* *
* Authors : Joakim Eriksson, Niclas Finne * Authors : Joakim Eriksson, Niclas Finne
* Created : 3 jul 2008 * Created : 3 jul 2008
* Updated : $Date: 2010/09/14 11:27:23 $ * Updated : $Date: 2010/09/14 14:23:58 $
* $Revision: 1.14 $ * $Revision: 1.15 $
*/ */
package se.sics.contiki.collect; package se.sics.contiki.collect;
@ -236,8 +236,7 @@ public class CollectServer {
new String[] { "LPM", "CPU", "Radio listen", "Radio transmit" }) { new String[] { "LPM", "CPU", "Radio listen", "Radio transmit" }) {
{ {
ValueAxis axis = chart.getCategoryPlot().getRangeAxis(); ValueAxis axis = chart.getCategoryPlot().getRangeAxis();
axis.setLowerBound(0.0); ((NumberAxis)axis).setAutoRangeIncludesZero(true);
axis.setUpperBound(75.0);
} }
protected void addSensorData(SensorData data) { protected void addSensorData(SensorData data) {
Node node = data.getNode(); Node node = data.getNode();
@ -249,13 +248,29 @@ public class CollectServer {
dataset.addValue(aggregator.getTransmitPower(), categories[3], nodeName); dataset.addValue(aggregator.getTransmitPower(), categories[3], nodeName);
} }
}, },
new BarChartPanel(this, "Radio Duty Cycle", "Average Radio Duty Cycle",
"Nodes", "Duty Cycle (%)",
new String[] { "Radio listen", "Radio transmit" }) {
{
ValueAxis axis = chart.getCategoryPlot().getRangeAxis();
((NumberAxis)axis).setAutoRangeIncludesZero(true);
}
protected void addSensorData(SensorData data) {
Node node = data.getNode();
String nodeName = node.getName();
SensorDataAggregator aggregator = node.getSensorDataAggregator();
dataset.addValue(100 * aggregator.getAverageDutyCycle(SensorInfo.TIME_LISTEN),
categories[0], nodeName);
dataset.addValue(100 * aggregator.getAverageDutyCycle(SensorInfo.TIME_TRANSMIT),
categories[1], nodeName);
}
},
new BarChartPanel(this, "Instantaneous Power", new BarChartPanel(this, "Instantaneous Power",
"Instantaneous Power Consumption", "Nodes", "Power (mW)", "Instantaneous Power Consumption", "Nodes", "Power (mW)",
new String[] { "LPM", "CPU", "Radio listen", "Radio transmit" }) { new String[] { "LPM", "CPU", "Radio listen", "Radio transmit" }) {
{ {
ValueAxis axis = chart.getCategoryPlot().getRangeAxis(); ValueAxis axis = chart.getCategoryPlot().getRangeAxis();
axis.setLowerBound(0.0); ((NumberAxis)axis).setAutoRangeIncludesZero(true);
axis.setUpperBound(75.0);
} }
protected void addSensorData(SensorData data) { protected void addSensorData(SensorData data) {
Node node = data.getNode(); Node node = data.getNode();
@ -268,7 +283,9 @@ public class CollectServer {
}, },
new TimeChartPanel(this, "Power History", "Historical Power Consumption", "Time", "mW") { new TimeChartPanel(this, "Power History", "Historical Power Consumption", "Time", "mW") {
{ {
/* ValueAxis axis = chart.getCategoryPlot().getRangeAxis();*/
setMaxItemCount(defaultMaxItemCount); setMaxItemCount(defaultMaxItemCount);
/* ((NumberAxis)axis).setAutoRangeIncludesZero(true);*/
} }
protected double getSensorDataValue(SensorData data) { protected double getSensorDataValue(SensorData data) {
return data.getAveragePower(); return data.getAveragePower();
@ -351,8 +368,7 @@ public class CollectServer {
new TimeChartPanel(this, "Network Hops (Over Time)", "Network Hops", "Time", "Hops") { new TimeChartPanel(this, "Network Hops (Over Time)", "Network Hops", "Time", "Hops") {
{ {
ValueAxis axis = chart.getXYPlot().getRangeAxis(); ValueAxis axis = chart.getXYPlot().getRangeAxis();
axis.setLowerBound(0.0); ((NumberAxis)axis).setAutoRangeIncludesZero(true);
axis.setUpperBound(4.0);
axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
setMaxItemCount(defaultMaxItemCount); setMaxItemCount(defaultMaxItemCount);
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: SensorDataAggregator.java,v 1.5 2010/09/08 12:40:18 nifi Exp $ * $Id: SensorDataAggregator.java,v 1.6 2010/09/14 14:23:58 adamdunkels Exp $
* *
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* *
@ -34,8 +34,8 @@
* *
* Authors : Joakim Eriksson, Niclas Finne * Authors : Joakim Eriksson, Niclas Finne
* Created : 20 aug 2008 * Created : 20 aug 2008
* Updated : $Date: 2010/09/08 12:40:18 $ * Updated : $Date: 2010/09/14 14:23:58 $
* $Revision: 1.5 $ * $Revision: 1.6 $
*/ */
package se.sics.contiki.collect; package se.sics.contiki.collect;
@ -72,8 +72,8 @@ public class SensorDataAggregator implements SensorInfo {
return values[index]; return values[index];
} }
public long getAverageValue(int index) { public double getAverageValue(int index) {
return dataCount > 0 ? values[index] / dataCount : 0; return dataCount > 0 ? (double)values[index] / (double)dataCount : 0;
} }
public int getValueCount() { public int getValueCount() {
@ -197,6 +197,10 @@ public class SensorDataAggregator implements SensorInfo {
/ (values[TIME_CPU] + values[TIME_LPM]); / (values[TIME_CPU] + values[TIME_LPM]);
} }
public double getAverageDutyCycle(int index) {
return (double)(values[index]) / (double)(values[TIME_CPU] + values[TIME_LPM]);
}
public long getPowerMeasureTime() { public long getPowerMeasureTime() {
return (1000L * (values[TIME_CPU] + values[TIME_LPM])) / TICKS_PER_SECOND; return (1000L * (values[TIME_CPU] + values[TIME_LPM])) / TICKS_PER_SECOND;
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: PacketChartPanel.java,v 1.5 2010/09/14 11:27:24 nifi Exp $ * $Id: PacketChartPanel.java,v 1.6 2010/09/14 14:23:58 adamdunkels Exp $
* *
* ----------------------------------------------------------------- * -----------------------------------------------------------------
* *
@ -34,8 +34,8 @@
* *
* Authors : Joakim Eriksson, Niclas Finne * Authors : Joakim Eriksson, Niclas Finne
* Created : 6 sep 2010 * Created : 6 sep 2010
* Updated : $Date: 2010/09/14 11:27:24 $ * Updated : $Date: 2010/09/14 14:23:58 $
* $Revision: 1.5 $ * $Revision: 1.6 $
*/ */
package se.sics.contiki.collect.gui; package se.sics.contiki.collect.gui;
@ -90,6 +90,7 @@ public class PacketChartPanel extends JPanel implements Visualizer {
false, true, false false, true, false
); );
((NumberAxis)chart.getXYPlot().getRangeAxis()).setAutoRangeIncludesZero(true); ((NumberAxis)chart.getXYPlot().getRangeAxis()).setAutoRangeIncludesZero(true);
((NumberAxis)chart.getXYPlot().getRangeAxis()).setStandardTickUnits(NumberAxis.createIntegerTickUnits());
this.chartPanel = new ChartPanel(chart); this.chartPanel = new ChartPanel(chart);
this.chartPanel.setPreferredSize(new Dimension(500, 270)); this.chartPanel.setPreferredSize(new Dimension(500, 270));
setBaseShapeVisible(false); setBaseShapeVisible(false);