00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef PHYLAYERBATTERY_H_
00017 #define PHYLAYERBATTERY_H_
00018
00019 #include "PhyLayer.h"
00020 #include "Decider80211Battery.h"
00021 #include "HostState.h"
00022 #include "MacToPhyControlInfo.h"
00023
00053 class PhyLayerBattery : public PhyLayer{
00054 protected:
00056 int numActivities;
00057
00060 double sleepCurrent, rxCurrent, decodingCurrentDelta, txCurrent;
00065 double setupRxCurrent, setupTxCurrent, rxTxCurrent, txRxCurrent;
00072 enum Activities {
00073 SLEEP_ACCT=0,
00074 RX_ACCT,
00075 TX_ACCT,
00076 SWITCHING_ACCT,
00077 DECIDER_ACCT,
00078 };
00079
00080 protected:
00092 virtual Decider* getDeciderFromName(std::string name, ParameterMap& params);
00093
00097 virtual Decider* initializeDecider80211Battery(ParameterMap& params);
00098
00102 virtual Decider* initializeDecider80211MultiChannel(ParameterMap& params);
00103
00115 virtual double calcTXCurrentForPacket(MacPkt* pkt, MacToPhyControlInfo* cInfo)
00116 { return -1.0; }
00117
00119 virtual void setRadioCurrent(int rs);
00120
00123 virtual void setSwitchingCurrent(int from, int to);
00124
00133 virtual void handleUpperMessage(cMessage* msg);
00134
00141 virtual void handleAirFrame(cMessage* msg);
00142
00149 virtual void handleHostState(const HostState& state);
00150
00154 virtual void finishRadioSwitching();
00155
00156 public:
00157 virtual void initialize(int stage);
00158
00168 virtual void drawCurrent(double amount, int activity);
00169
00173 virtual simtime_t setRadioState(int rs);
00174 };
00175
00176 #endif