21 #ifndef WIFI_RADIO_ENERGY_MODEL_H
22 #define WIFI_RADIO_ENERGY_MODEL_H
24 #include "ns3/device-energy-model.h"
25 #include "ns3/nstime.h"
26 #include "ns3/event-id.h"
27 #include "ns3/traced-value.h"
28 #include "ns3/wifi-phy.h"
32 class WifiTxCurrentModel;
void SetWifiRadioState(const WifiPhy::State state)
Simulation virtual time values and global simulation resolution.
static TypeId GetTypeId(void)
smart pointer class similar to boost::intrusive_ptr
virtual void HandleEnergyRecharged(void)
Handles energy recharged.
TracedValue< double > m_totalEnergyConsumption
Base class for device energy models.
State
The state of the PHY layer.
UpdateTxCurrentCallback m_updateTxCurrentCallback
Callback used to update the tx current stored in WifiRadioEnergyModel based on the nominal tx power u...
virtual void ChangeState(int newState)
Changes state of the WifiRadioEnergyMode.
WifiRadioEnergyModelPhyListener * m_listener
virtual ~WifiRadioEnergyModelPhyListener()
double GetSleepCurrentA(void) const
void SetSleepCurrentA(double sleepCurrentA)
virtual double GetTotalEnergyConsumption(void) const
WifiRadioEnergyModelPhyListener * GetPhyListener(void)
void SetUpdateTxCurrentCallback(UpdateTxCurrentCallback callback)
Sets the update tx current callback.
void SwitchToIdle(void)
A helper function that makes scheduling m_changeStateCallback possible.
void SetRxCurrentA(double rxCurrentA)
virtual void NotifyRxEndOk(void)
Switches the WifiRadioEnergyModel back to IDLE state.
Callback< void > WifiRadioEnergyRechargedCallback
Callback type for energy recharged handling.
Callback< void > WifiRadioEnergyDepletionCallback
Callback type for energy depletion handling.
void SetCcaBusyCurrentA(double ccaBusyCurrentA)
double GetCcaBusyCurrentA(void) const
void SetChangeStateCallback(DeviceEnergyModel::ChangeStateCallback callback)
Sets the change state callback.
WifiPhy::State m_currentState
Ptr< WifiTxCurrentModel > m_txCurrentModel
Ptr< EnergySource > m_source
virtual void NotifySwitchingStart(Time duration)
receive notifications about phy events.
virtual void NotifyMaybeCcaBusyStart(Time duration)
void SetTxCurrentFromModel(double txPowerDbm)
Calls the CalcTxCurrent method of the tx current model to compute the tx current based on such model...
void SetEnergyRechargedCallback(WifiRadioEnergyRechargedCallback callback)
WifiRadioEnergyModelPhyListener()
virtual void NotifyRxEndError(void)
Switches the WifiRadioEnergyModel back to IDLE state.
WifiPhy::State GetCurrentState(void) const
DeviceEnergyModel::ChangeStateCallback m_changeStateCallback
Change state callback used to notify the WifiRadioEnergyModel of a state change.
EventId m_switchToIdleEvent
virtual void NotifyTxStart(Time duration, double txPowerDbm)
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration.
virtual void SetEnergySource(Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
Callback< void, double > UpdateTxCurrentCallback
Callback type for updating the transmit current based on the nominal tx power.
virtual void NotifyWakeup(void)
Defined in ns3::WifiPhyListener.
double GetTxCurrentA(void) const
double GetRxCurrentA(void) const
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change...
void SetTxCurrentA(double txCurrentA)
virtual void NotifySleep(void)
Defined in ns3::WifiPhyListener.
A WiFi radio energy model.
virtual void NotifyRxStart(Time duration)
Switches the WifiRadioEnergyModel to RX state.
void SetEnergyDepletionCallback(WifiRadioEnergyDepletionCallback callback)
an identifier for simulation events.
void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
uint8_t m_nPendingChangeState
WifiRadioEnergyDepletionCallback m_energyDepletionCallback
double GetIdleCurrentA(void) const
void SetSwitchingCurrentA(double switchingCurrentA)
double m_switchingCurrentA
virtual double DoGetCurrentA(void) const
bool m_isSupersededChangeState
virtual ~WifiRadioEnergyModel()
a unique identifier for an interface.
void SetIdleCurrentA(double idleCurrentA)
WifiRadioEnergyRechargedCallback m_energyRechargedCallback
double GetSwitchingCurrentA(void) const
virtual void HandleEnergyDepletion(void)
Handles energy depletion.
void SetTxCurrentModel(Ptr< WifiTxCurrentModel > model)