|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #ifndef WIFI_RADIO_ENERGY_MODEL_H
23 #define WIFI_RADIO_ENERGY_MODEL_H
25 #include "ns3/device-energy-model.h"
26 #include "ns3/traced-value.h"
27 #include "ns3/event-id.h"
28 #include "ns3/nstime.h"
34 class WifiTxCurrentModel;
a unique identifier for an interface.
void SetCcaBusyCurrentA(double ccaBusyCurrentA)
Sets CCA busy current in Amperes.
void SetEnergyDepletionCallback(WifiRadioEnergyDepletionCallback callback)
An identifier for simulation events.
void NotifyRxStart(Time duration) override
Switches the WifiRadioEnergyModel to RX state.
WifiRadioEnergyModelPhyListener * m_listener
WifiPhy listener.
void HandleEnergyDepletion(void)
Handles energy depletion.
void SwitchToIdle(void)
A helper function that makes scheduling m_changeStateCallback possible.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetTxCurrentFromModel(double txPowerDbm)
Calls the CalcTxCurrent method of the TX current model to compute the TX current based on such model.
WifiPhyState m_currentState
current state the radio is in
receive notifications about PHY events.
double GetCcaBusyCurrentA(void) const
Gets CCA busy current in Amperes.
void SetSwitchingCurrentA(double switchingCurrentA)
Sets switching current in Amperes.
void SetChangeStateCallback(DeviceEnergyModel::ChangeStateCallback callback)
Sets the change state callback.
Callback< void > WifiRadioEnergyRechargedCallback
Callback type for energy recharged handling.
EventId m_switchToOffEvent
switch to off event
double GetTxCurrentA(void) const
Gets transmit current in Amperes.
double GetTotalEnergyConsumption(void) const
double GetSleepCurrentA(void) const
Gets sleep current in Amperes.
double m_rxCurrentA
receive current in Amperes
void DoDispose(void)
Destructor implementation.
void SetWifiRadioState(const WifiPhyState state)
double m_sleepCurrentA
sleep current in Amperes
WifiPhyState GetCurrentState(void) const
double GetIdleCurrentA(void) const
Gets idle current in Amperes.
void ChangeState(int newState)
Changes state of the WifiRadioEnergyMode.
double m_txCurrentA
transmit current in Amperes
void SetEnergyRechargedCallback(WifiRadioEnergyRechargedCallback callback)
double DoGetCurrentA(void) const
void NotifyRxEndOk(void) override
Switches the WifiRadioEnergyModel back to IDLE state.
void SetUpdateTxCurrentCallback(UpdateTxCurrentCallback callback)
Sets the update TX current callback.
double GetRxCurrentA(void) const
Gets receive current in Amperes.
WifiRadioEnergyModelPhyListener * GetPhyListener(void)
void SetEnergySource(const Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
Smart pointer class similar to boost::intrusive_ptr.
void NotifySleep(void) override
Defined in ns3::WifiPhyListener.
void NotifyRxEndError(void) override
Switches the WifiRadioEnergyModel back to IDLE state.
UpdateTxCurrentCallback m_updateTxCurrentCallback
Callback used to update the TX current stored in WifiRadioEnergyModel based on the nominal TX power u...
DeviceEnergyModel::ChangeStateCallback m_changeStateCallback
Change state callback used to notify the WifiRadioEnergyModel of a state change.
WifiRadioEnergyRechargedCallback m_energyRechargedCallback
Energy recharged callback.
void HandleEnergyChanged(void)
Handles energy changed.
void NotifyMaybeCcaBusyStart(Time duration) override
double GetStateA(int state) const
static TypeId GetTypeId(void)
Get the type ID.
Simulation virtual time values and global simulation resolution.
void HandleEnergyRecharged(void)
Handles energy recharged.
void SetRxCurrentA(double rxCurrentA)
Sets receive current in Amperes.
Time m_lastUpdateTime
time stamp of previous energy update
void SetTxCurrentModel(const Ptr< WifiTxCurrentModel > model)
double m_switchingCurrentA
switching current in Amperes
TracedValue< double > m_totalEnergyConsumption
This variable keeps track of the total energy consumed by this model in watts.
virtual ~WifiRadioEnergyModel()
Time GetMaximumTimeInState(int state) const
WifiPhyState
The state of the PHY layer.
void NotifySwitchingStart(Time duration) override
WifiRadioEnergyDepletionCallback m_energyDepletionCallback
Energy depletion callback.
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.
Base class for device energy models.
virtual ~WifiRadioEnergyModelPhyListener()
Callback< void, double > UpdateTxCurrentCallback
Callback type for updating the transmit current based on the nominal TX power.
void NotifyTxStart(Time duration, double txPowerDbm) override
Switches the WifiRadioEnergyModel to TX state and switches back to IDLE after TX duration.
WifiRadioEnergyModelPhyListener()
A WiFi radio energy model.
void SetIdleCurrentA(double idleCurrentA)
Sets idle current in Amperes.
EventId m_switchToIdleEvent
switch to idle event
Ptr< WifiTxCurrentModel > m_txCurrentModel
current model
Ptr< EnergySource > m_source
energy source
void NotifyWakeup(void) override
Defined in ns3::WifiPhyListener.
double m_ccaBusyCurrentA
CCA busy current in Amperes.
uint8_t m_nPendingChangeState
pending state change
void NotifyOn(void) override
Defined in ns3::WifiPhyListener.
void NotifyOff(void) override
Defined in ns3::WifiPhyListener.
void SetSleepCurrentA(double sleepCurrentA)
Sets sleep current in Amperes.
void SetTxCurrentA(double txCurrentA)
Sets transmit current in Amperes.
double GetSwitchingCurrentA(void) const
Gets switching current in Amperes.
double m_idleCurrentA
idle current in Amperes
Callback< void > WifiRadioEnergyDepletionCallback
Callback type for energy depletion handling.