10#ifndef WIFI_RADIO_ENERGY_MODEL_H
11#define WIFI_RADIO_ENERGY_MODEL_H
16#include "ns3/device-energy-model.h"
17#include "ns3/event-id.h"
18#include "ns3/nstime.h"
19#include "ns3/traced-value.h"
24class WifiTxCurrentModel;
63 const std::vector<Time>& per20MhzDurations)
override;
323 std::shared_ptr<WifiRadioEnergyModelPhyListener>
GetPhyListener();
An identifier for simulation events.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Trace classes with value semantics.
a unique identifier for an interface.
receive notifications about PHY events.
A WiFi radio energy model.
void HandleEnergyChanged() override
Handles energy changed.
WifiRadioEnergyDepletionCallback m_energyDepletionCallback
Energy depletion callback.
void SetSleepCurrentA(ampere_u sleepCurrentA)
Sets sleep current.
Callback< void > WifiRadioEnergyRechargedCallback
Callback type for energy recharged handling.
void SetRxCurrentA(ampere_u rxCurrentA)
Sets receive current.
WifiPhyState GetCurrentState() const
Ptr< energy::EnergySource > m_source
energy source
void ChangeState(int newState) override
Changes state of the WifiRadioEnergyMode.
ampere_u GetSleepCurrentA() const
Gets sleep current.
WifiRadioEnergyRechargedCallback m_energyRechargedCallback
Energy recharged callback.
ampere_u GetCcaBusyCurrentA() const
Gets CCA busy current.
void SetIdleCurrentA(ampere_u idleCurrentA)
Sets idle current.
TracedValue< double > m_totalEnergyConsumption
This variable keeps track of the total energy consumed by this model in watts.
void SetTxCurrentModel(const Ptr< WifiTxCurrentModel > model)
void SetTxCurrentFromModel(dBm_u txPower)
Calls the CalcTxCurrent method of the TX current model to compute the TX current based on such model.
EventId m_switchToOffEvent
switch to off event
void DoDispose() override
Destructor implementation.
void HandleEnergyRecharged() override
Handles energy recharged.
Time m_lastUpdateTime
time stamp of previous energy update
ampere_u GetSwitchingCurrentA() const
Gets switching current.
ampere_u m_switchingCurrent
switching current
ampere_u m_txCurrent
transmit current
ampere_u GetStateA(WifiPhyState state) const
ampere_u GetTxCurrentA() const
Gets transmit current.
std::shared_ptr< WifiRadioEnergyModelPhyListener > m_listener
WifiPhy listener.
void HandleEnergyDepletion() override
Handles energy depletion.
ampere_u m_idleCurrent
idle current
static TypeId GetTypeId()
Get the type ID.
ampere_u DoGetCurrentA() const override
void SetCcaBusyCurrentA(ampere_u ccaBusyCurrentA)
Sets CCA busy current.
~WifiRadioEnergyModel() override
void SetEnergyDepletionCallback(WifiRadioEnergyDepletionCallback callback)
std::shared_ptr< WifiRadioEnergyModelPhyListener > GetPhyListener()
ampere_u m_rxCurrent
receive current
WifiPhyState m_currentState
current state the radio is in
ampere_u GetIdleCurrentA() const
Gets idle current.
void SetWifiRadioState(const WifiPhyState state)
ampere_u m_ccaBusyCurrent
CCA busy current.
Time GetMaximumTimeInState(WifiPhyState state) const
void SetTxCurrentA(ampere_u txCurrentA)
Sets transmit current.
Ptr< WifiTxCurrentModel > m_txCurrentModel
current model
void SetSwitchingCurrentA(ampere_u switchingCurrentA)
Sets switching current.
ampere_u GetRxCurrentA() const
Gets receive current.
ampere_u m_sleepCurrent
sleep current
Watt_u GetTotalEnergyConsumption() const override
void SetEnergySource(const Ptr< energy::EnergySource > source) override
Sets pointer to EnergySource installed on node.
void SetEnergyRechargedCallback(WifiRadioEnergyRechargedCallback callback)
uint8_t m_nPendingChangeState
pending state change
Callback< void > WifiRadioEnergyDepletionCallback
Callback type for energy depletion handling.
A WifiPhy listener class for notifying the WifiRadioEnergyModel of Wifi radio state change.
energy::DeviceEnergyModel::ChangeStateCallback m_changeStateCallback
Change state callback used to notify the WifiRadioEnergyModel of a state change.
WifiRadioEnergyModelPhyListener()
void NotifySleep() override
Notify listeners that we went to sleep.
~WifiRadioEnergyModelPhyListener() override
void NotifyOff() override
Notify listeners that we went to switch off.
void NotifyRxStart(Time duration) override
void SetChangeStateCallback(energy::DeviceEnergyModel::ChangeStateCallback callback)
Sets the change state callback.
void NotifyRxEndError(const WifiTxVector &txVector) override
void NotifyRxEndOk() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
UpdateTxCurrentCallback m_updateTxCurrentCallback
Callback used to update the TX current stored in WifiRadioEnergyModel based on the nominal TX power u...
Callback< void, dBm_u > UpdateTxCurrentCallback
Callback type for updating the transmit current based on the nominal TX power.
void SetUpdateTxCurrentCallback(UpdateTxCurrentCallback callback)
Sets the update TX current callback.
void NotifyTxStart(Time duration, dBm_u txPower) override
void NotifySwitchingStart(Time duration) override
void SwitchToIdle()
A helper function that makes scheduling m_changeStateCallback possible.
void NotifyWakeup() override
Notify listeners that we woke up.
EventId m_switchToIdleEvent
switch to idle event
void NotifyOn() override
Notify listeners that we went to switch on.
void NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations) override
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Base class for device energy models.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.