removing obsolete method previously used for estimating contiki's energy consumption.

This commit is contained in:
fros4943 2010-02-05 08:49:18 +00:00
parent b749a560cc
commit a32035dc14
8 changed files with 18 additions and 156 deletions

View File

@ -26,19 +26,26 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiBeeper.java,v 1.10 2009/05/26 14:24:20 fros4943 Exp $
* $Id: ContikiBeeper.java,v 1.11 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.*;
import javax.swing.*;
import java.util.Collection;
import java.util.Observable;
import java.util.Observer;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
import org.jdom.Element;
import se.sics.cooja.*;
import se.sics.cooja.Mote;
import se.sics.cooja.SectionMoteMemory;
import se.sics.cooja.contikimote.ContikiMoteInterface;
import se.sics.cooja.interfaces.Beeper;
import se.sics.cooja.interfaces.PolledAfterActiveTicks;
@ -67,15 +74,6 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
private SectionMoteMemory moteMem = null;
private static Logger logger = Logger.getLogger(ContikiBeeper.class);
/**
* Assuming beep always lasts for 0.1 seconds. ESB measured energy
* consumption: 16.69 mA. Total energy consumption of a beep is then:
* 0.1*16.69
*/
private final double ENERGY_CONSUMPTION_BEEP;
private double myEnergyConsumption = 0.0;
/**
* Creates an interface to the beeper at mote.
*
@ -85,10 +83,6 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
* @see se.sics.cooja.MoteInterfaceHandler
*/
public ContikiBeeper(Mote mote) {
// Read class configurations of this mote type
ENERGY_CONSUMPTION_BEEP = mote.getType().getConfig().getDoubleValue(
ContikiBeeper.class, "BEEP_CONSUMPTION_mQ");
this.mote = mote;
this.moteMem = (SectionMoteMemory) mote.getMemory();
}
@ -101,23 +95,12 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
return new String[]{"beep_interface"};
}
private TimeEvent stopBeepEvent = new MoteTimeEvent(mote, 0) {
public void execute(long t) {
myEnergyConsumption = 0.0;
}
};
public void doActionsAfterTick() {
if (moteMem.getByteValueOf("simBeeped") == 1) {
myEnergyConsumption = ENERGY_CONSUMPTION_BEEP;
this.setChanged();
this.notifyObservers(mote);
moteMem.setByteValueOf("simBeeped", (byte) 0);
/* Schedule stop beeping (reset energy consumption) */
mote.getSimulation().scheduleEvent(stopBeepEvent, mote.getSimulation().getSimulationTime()+Simulation.MILLISECOND);
}
}
@ -162,10 +145,6 @@ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, Polle
this.deleteObserver(observer);
}
public double energyConsumption() {
return myEnergyConsumption;
}
public Collection<Element> getConfigXML() {
return null;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiButton.java,v 1.15 2009/11/14 11:09:41 fros4943 Exp $
* $Id: ContikiButton.java,v 1.16 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -182,10 +182,6 @@ public class ContikiButton extends Button implements ContikiMoteInterface {
public void releaseInterfaceVisualizer(JPanel panel) {
}
public double energyConsumption() {
return 0.0;
}
public Collection<Element> getConfigXML() {
return null;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiClock.java,v 1.12 2009/09/17 11:06:35 fros4943 Exp $
* $Id: ContikiClock.java,v 1.13 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -153,10 +153,6 @@ public class ContikiClock extends Clock implements ContikiMoteInterface, PolledB
public void releaseInterfaceVisualizer(JPanel panel) {
}
public double energyConsumption() {
return 0.0;
}
public Collection<Element> getConfigXML() {
return null;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiIPAddress.java,v 1.6 2009/04/01 17:43:18 fros4943 Exp $
* $Id: ContikiIPAddress.java,v 1.7 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -76,9 +76,4 @@ public class ContikiIPAddress extends IPAddress implements ContikiMoteInterface
/*return new String[]{"ip_interface"};*/
return null;
}
public double energyConsumption() {
// Virtual interface, does not require any energy
return 0.0;
}
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiLED.java,v 1.7 2009/02/25 14:46:24 fros4943 Exp $
* $Id: ContikiLED.java,v 1.8 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -79,34 +79,7 @@ public class ContikiLED extends LED implements ContikiMoteInterface, PolledAfter
private static final Color YELLOW = new Color(255, 255, 0);
private static final Color RED = new Color(255, 0, 0);
private double myEnergyConsumption = 0.0;
/**
* Approximate energy consumption of a green led (mA). ESB measured value:
* 5.69 mA. TODO Measure energy consumption
*/
public final double ENERGY_CONSUMPTION_GREEN_LED;
/**
* Approximate energy consumption of a yellow led (mA). ESB measured value:
* 5.69 mA. TODO Measure energy consumption
*/
public final double ENERGY_CONSUMPTION_YELLOW_LED;
/**
* Approximate energy consumption of a red led (mA). ESB measured value: 5.69
* mA.
*/
public final double ENERGY_CONSUMPTION_RED_LED;
private double energyOfGreenLedPerTick = -1;
private double energyOfYellowLedPerTick = -1;
private double energyOfRedLedPerTick = -1;
public ContikiLED() {
ENERGY_CONSUMPTION_GREEN_LED = 0;
ENERGY_CONSUMPTION_YELLOW_LED = 0;
ENERGY_CONSUMPTION_RED_LED = 0;
}
/**
@ -118,22 +91,8 @@ public class ContikiLED extends LED implements ContikiMoteInterface, PolledAfter
* @see se.sics.cooja.MoteInterfaceHandler
*/
public ContikiLED(Mote mote) {
// Read class configurations of this mote type
ENERGY_CONSUMPTION_GREEN_LED = mote.getType().getConfig()
.getDoubleValue(ContikiLED.class, "GREEN_LED_CONSUMPTION_mA");
ENERGY_CONSUMPTION_YELLOW_LED = mote.getType().getConfig()
.getDoubleValue(ContikiLED.class, "YELLOW_LED_CONSUMPTION_mA");
ENERGY_CONSUMPTION_RED_LED = mote.getType().getConfig()
.getDoubleValue(ContikiLED.class, "RED_LED_CONSUMPTION_mA");
this.mote = mote;
this.moteMem = (SectionMoteMemory) mote.getMemory();
if (energyOfGreenLedPerTick < 0) {
energyOfGreenLedPerTick = ENERGY_CONSUMPTION_GREEN_LED * 0.001;
energyOfYellowLedPerTick = ENERGY_CONSUMPTION_YELLOW_LED * 0.001;
energyOfRedLedPerTick = ENERGY_CONSUMPTION_RED_LED * 0.001;
}
}
public static String[] getCoreInterfaceDependencies() {
@ -166,17 +125,6 @@ public class ContikiLED extends LED implements ContikiMoteInterface, PolledAfter
ledChanged = false;
}
myEnergyConsumption = 0.0;
if ((newLedsValue & LEDS_GREEN) > 0) {
myEnergyConsumption += energyOfGreenLedPerTick;
}
if ((newLedsValue & LEDS_YELLOW) > 0) {
myEnergyConsumption += energyOfYellowLedPerTick;
}
if ((newLedsValue & LEDS_RED) > 0) {
myEnergyConsumption += energyOfRedLedPerTick;
}
currentLedValue = newLedsValue;
if (ledChanged) {
this.setChanged();
@ -255,10 +203,6 @@ public class ContikiLED extends LED implements ContikiMoteInterface, PolledAfter
this.deleteObserver(observer);
}
public double energyConsumption() {
return myEnergyConsumption;
}
public Collection<Element> getConfigXML() {
return null;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiMoteID.java,v 1.6 2009/02/25 14:46:24 fros4943 Exp $
* $Id: ContikiMoteID.java,v 1.7 2010/02/05 08:49:18 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -126,10 +126,6 @@ public class ContikiMoteID extends MoteID implements ContikiMoteInterface {
this.deleteObserver(observer);
}
public double energyConsumption() {
return 0.0;
}
public Collection<Element> getConfigXML() {
Vector<Element> config = new Vector<Element>();
Element element;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiPIR.java,v 1.9 2010/01/14 19:06:14 nifi Exp $
* $Id: ContikiPIR.java,v 1.10 2010/02/05 08:49:42 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -65,17 +65,8 @@ import se.sics.cooja.interfaces.PIR;
*/
public class ContikiPIR extends PIR implements ContikiMoteInterface {
/**
* Approximate energy consumption of an active PIR sensor. ESB measured energy
* consumption is 0.4 mA. TODO Measure energy consumption
*/
public final double ENERGY_CONSUMPTION_PIR_mA;
private double energyActivePerTick = -1;
private ContikiMote mote;
private SectionMoteMemory moteMem;
private double myEnergyConsumption = 0.0;
/**
* Creates an interface to the PIR at mote.
@ -86,16 +77,8 @@ public class ContikiPIR extends PIR implements ContikiMoteInterface {
* @see se.sics.cooja.MoteInterfaceHandler
*/
public ContikiPIR(Mote mote) {
// Read class configurations of this mote type
ENERGY_CONSUMPTION_PIR_mA = mote.getType().getConfig().getDoubleValue(
ContikiPIR.class, "ACTIVE_CONSUMPTION_mA");
this.mote = (ContikiMote) mote;
this.moteMem = (SectionMoteMemory) mote.getMemory();
if (energyActivePerTick < 0) {
energyActivePerTick = ENERGY_CONSUMPTION_PIR_mA * 0.001;
}
}
public static String[] getCoreInterfaceDependencies() {
@ -121,8 +104,6 @@ public class ContikiPIR extends PIR implements ContikiMoteInterface {
}
}
/* TODO Energy consumption of active PIR */
public JPanel getInterfaceVisualizer() {
JPanel panel = new JPanel();
final JButton clickButton = new JButton("Signal PIR");
@ -141,10 +122,6 @@ public class ContikiPIR extends PIR implements ContikiMoteInterface {
public void releaseInterfaceVisualizer(JPanel panel) {
}
public double energyConsumption() {
return myEnergyConsumption;
}
public Collection<Element> getConfigXML() {
return null;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiVib.java,v 1.9 2010/01/14 19:06:14 nifi Exp $
* $Id: ContikiVib.java,v 1.10 2010/02/05 08:49:42 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -67,17 +67,8 @@ import se.sics.cooja.contikimote.ContikiMoteInterface;
@ClassDescription("Vibration sensor")
public class ContikiVib extends MoteInterface implements ContikiMoteInterface {
/**
* Approximate energy consumption of an active vibration sensor. ESB measured
* energy consumption is 1.58 mA.
*/
public final double ENERGY_CONSUMPTION_VIB_mA;
private double energyActiveVibPerTick = -1;
private ContikiMote mote;
private SectionMoteMemory moteMem;
private double myEnergyConsumption = 0.0;
/**
* Creates an interface to the vibration sensor at mote.
@ -88,16 +79,8 @@ public class ContikiVib extends MoteInterface implements ContikiMoteInterface {
* @see se.sics.cooja.MoteInterfaceHandler
*/
public ContikiVib(Mote mote) {
// Read class configurations of this mote type
ENERGY_CONSUMPTION_VIB_mA = mote.getType().getConfig().getDoubleValue(
ContikiVib.class, "ACTIVE_CONSUMPTION_mA");
this.mote = (ContikiMote) mote;
this.moteMem = (SectionMoteMemory) mote.getMemory();
if (energyActiveVibPerTick < 0) {
energyActiveVibPerTick = ENERGY_CONSUMPTION_VIB_mA * 0.001;
}
}
public static String[] getCoreInterfaceDependencies() {
@ -143,10 +126,6 @@ public class ContikiVib extends MoteInterface implements ContikiMoteInterface {
public void releaseInterfaceVisualizer(JPanel panel) {
}
public double energyConsumption() {
return myEnergyConsumption;
}
public Collection<Element> getConfigXML() {
return null;
}