A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::BleRadioEnergyModel Class Reference

A BLE radio energy model. More...

#include "ble-radio-energy-model.h"

+ Inheritance diagram for ns3::BleRadioEnergyModel:
+ Collaboration diagram for ns3::BleRadioEnergyModel:

Public Types

typedef Callback< void > BleRadioEnergyDepletionCallback
 Callback type for energy depletion handling. More...
 
typedef Callback< void > BleRadioEnergyRechargedCallback
 Callback for energy recharged handling. More...
 
- Public Types inherited from ns3::DeviceEnergyModel
typedef Callback< void, int > ChangeStateCallback
 Callback type for ChangeState function. More...
 

Public Member Functions

 BleRadioEnergyModel ()
 
virtual ~BleRadioEnergyModel ()
 
virtual void ChangeState (int newState)
 Changes state of the BleRadioEnergyMode. More...
 
void ChangeState (BlePhy::BlePhyState oldState, BlePhy::BlePhyState newState)
 
BlePhy::BlePhyState GetCurrentState (void) const
 
double GetIdleCurrentA (void) const
 
double GetOffCurrentA (void) const
 
double GetRxCurrentA (void) const
 
virtual double GetTotalEnergyConsumption (void) const
 
double GetTxCurrentA (void) const
 
virtual void HandleEnergyDepletion (void)
 Handles energy depletion. More...
 
virtual void HandleEnergyRecharged (void)
 Handles energy recharged. More...
 
void SetEnergyDepletionCallback (BleRadioEnergyDepletionCallback callback)
 
void SetEnergyRechargedCallback (BleRadioEnergyRechargedCallback callback)
 
virtual void SetEnergySource (Ptr< EnergySource > source)
 Sets pointer to Energy Source instaleld on node. More...
 
void SetIdleCurrentA (double idleCurrentA)
 
void SetOffCurrentA (double offCurrentA)
 
virtual void SetPhy (Ptr< BlePhy > phy)
 Sets pointer to PHY on node. More...
 
void SetRxCurrentA (double rxCurrentA)
 
void SetTxCurrentA (double txCurrentA)
 
- Public Member Functions inherited from ns3::DeviceEnergyModel
 DeviceEnergyModel ()
 
virtual ~DeviceEnergyModel ()
 
double GetCurrentA (void) const
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Implement the GetInstanceTypeId method defined in ObjectBase. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::DeviceEnergyModel
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

void DoDispose (void)
 Destructor implementation. More...
 
virtual double DoGetCurrentA (void) const
 
void SetBleRadioState (const BlePhy::BlePhyState state)
 

Private Attributes

BlePhy::BlePhyState m_currentState
 
BleRadioEnergyDepletionCallback m_energyDepletionCallback
 
BleRadioEnergyRechargedCallback m_energyRechargedCallback
 
double m_idleCurrentA
 
bool m_isSupersededChangeState
 
Time m_lastUpdateTime
 
uint8_t m_nPendingChangeState
 
double m_offCurrentA
 
Ptr< BlePhym_phy
 
double m_rxCurrentA
 
Ptr< EnergySourcem_source
 
TracedValue< double > m_totalEnergyConsumption
 
double m_txCurrentA
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

A BLE radio energy model.

Introspection did not find any typical Config paths.

4 states are defined for the radio: BUSY_TX, BUSY_RX, IDLE. Default state is IDLE.

Energy calculation: For each transaction, this model notifies EnergySource object. The EnergySource object will query this model for the total current. Then the EnergySource object uses the total current to calculate energy.

Specifications of

  1. NRF51822: $ I_{tx} = 0.01 $ $ I_{rx} = 0.0097 $ RxSensitivity = -93 dBm TxPower = 0 dBm
  2. CC2650: – Default values $ I_{tx} = 0.0061 $ $ I_{rx} = 0.0059 $ RxSensitivity = -97 dBm TxPower = 0 dBm


Attributes

  • OffCurrentA: The default radio Off Current in Amp.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1e-07
    • Flags: construct write read
  • IdleCurrentA: The default radio Idle Current in Amp.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1e-06
    • Flags: construct write read
  • TxCurrentA: The default radio Tx Current in Amp.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.0061
    • Flags: construct write read
  • RxCurrentA: The default radio Rx Current in Amp.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.0059
    • Flags: construct write read

TraceSources

  • TotalEnergyConsumption: Total energy consumption of the radio device.
    Callback signature: ns3::TraceValueCallback::Double

Size of this type is 144 bytes (on a 64-bit architecture).

Definition at line 55 of file ble-radio-energy-model.h.

Member Typedef Documentation

Callback type for energy depletion handling.

Definition at line 61 of file ble-radio-energy-model.h.

Callback for energy recharged handling.

Definition at line 65 of file ble-radio-energy-model.h.

Constructor & Destructor Documentation

ns3::BleRadioEnergyModel::~BleRadioEnergyModel ( )
virtual

Definition at line 86 of file ble-radio-energy-model.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

void ns3::BleRadioEnergyModel::ChangeState ( int  newState)
virtual
void ns3::BleRadioEnergyModel::ChangeState ( BlePhy::BlePhyState  oldState,
BlePhy::BlePhyState  newState 
)

Definition at line 199 of file ble-radio-energy-model.cc.

References ChangeState(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleRadioEnergyModel::DoDispose ( void  )
privatevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 298 of file ble-radio-energy-model.cc.

References m_energyDepletionCallback, m_source, NS_LOG_FUNCTION, and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Nullify().

+ Here is the call graph for this function:

double ns3::BleRadioEnergyModel::DoGetCurrentA ( void  ) const
privatevirtual
BlePhy::BlePhyState ns3::BleRadioEnergyModel::GetCurrentState ( void  ) const
Returns
Current state

Definition at line 168 of file ble-radio-energy-model.cc.

References m_currentState, and NS_LOG_FUNCTION.

double ns3::BleRadioEnergyModel::GetIdleCurrentA ( void  ) const

Definition at line 127 of file ble-radio-energy-model.cc.

References m_idleCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

double ns3::BleRadioEnergyModel::GetOffCurrentA ( void  ) const

Definition at line 114 of file ble-radio-energy-model.cc.

References m_offCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

double ns3::BleRadioEnergyModel::GetRxCurrentA ( void  ) const

Definition at line 154 of file ble-radio-energy-model.cc.

References m_rxCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

double ns3::BleRadioEnergyModel::GetTotalEnergyConsumption ( void  ) const
virtual
Returns
Total energy consumption of the wifi device Implements DeviceEnergyModel::GetTotalEnergyConsumption

Implements ns3::DeviceEnergyModel.

Definition at line 107 of file ble-radio-energy-model.cc.

References m_totalEnergyConsumption, and NS_LOG_FUNCTION.

double ns3::BleRadioEnergyModel::GetTxCurrentA ( void  ) const

Definition at line 140 of file ble-radio-energy-model.cc.

References m_txCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::BleRadioEnergyModel::HandleEnergyDepletion ( void  )
virtual

Handles energy depletion.

Implements DeviceEnergyModel::HandleEnergyDepletion

Implements ns3::DeviceEnergyModel.

Definition at line 270 of file ble-radio-energy-model.cc.

References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_energyDepletionCallback, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleRadioEnergyModel::HandleEnergyRecharged ( void  )
virtual

Handles energy recharged.

Implements DeviceEnergyModel::HandleEnergyRecharged

Implements ns3::DeviceEnergyModel.

Definition at line 282 of file ble-radio-energy-model.cc.

References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_energyRechargedCallback, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleRadioEnergyModel::SetBleRadioState ( const BlePhy::BlePhyState  state)
private
Parameters
stateNew state the radio device is currently in.

Sets current state. This function is private so that only the energy model can change its own state.

Definition at line 327 of file ble-radio-energy-model.cc.

References ns3::BlePhy::BUSY_RX, ns3::BlePhy::BUSY_TX, ns3::BlePhy::IDLE, ns3::BlePhy::LISTEN, m_currentState, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::BlePhy::OFF, and ns3::BlePhy::TRANS.

Referenced by ChangeState().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::BleRadioEnergyModel::SetEnergyDepletionCallback ( BleRadioEnergyDepletionCallback  callback)
Parameters
callbackCallback function Sets callback for energy depletion handling

Definition at line 175 of file ble-radio-energy-model.cc.

References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_energyDepletionCallback, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleRadioEnergyModel::SetEnergyRechargedCallback ( BleRadioEnergyRechargedCallback  callback)
Parameters
callbackCallback function.

Sets callback for energy recharged handling.

Definition at line 187 of file ble-radio-energy-model.cc.

References ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_energyRechargedCallback, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleRadioEnergyModel::SetEnergySource ( Ptr< EnergySource source)
virtual

Sets pointer to Energy Source instaleld on node.

Parameters
sourcePointer to Energy Source installed on node. Implements DeviceEnergyModel::SetEnergySource

Implements ns3::DeviceEnergyModel.

Definition at line 99 of file ble-radio-energy-model.cc.

References m_source, NS_ASSERT, and NS_LOG_FUNCTION.

void ns3::BleRadioEnergyModel::SetIdleCurrentA ( double  idleCurrentA)

Definition at line 133 of file ble-radio-energy-model.cc.

References m_idleCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::BleRadioEnergyModel::SetOffCurrentA ( double  offCurrentA)

Definition at line 120 of file ble-radio-energy-model.cc.

References m_offCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::BleRadioEnergyModel::SetPhy ( Ptr< BlePhy phy)
virtual

Sets pointer to PHY on node.

Parameters
phyPointer to PHY installed on node.

Definition at line 92 of file ble-radio-energy-model.cc.

References m_phy, NS_ASSERT, NS_LOG_FUNCTION, and third::phy.

void ns3::BleRadioEnergyModel::SetRxCurrentA ( double  rxCurrentA)

Definition at line 161 of file ble-radio-energy-model.cc.

References m_rxCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::BleRadioEnergyModel::SetTxCurrentA ( double  txCurrentA)

Definition at line 147 of file ble-radio-energy-model.cc.

References m_txCurrentA, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Member Data Documentation

BlePhy::BlePhyState ns3::BleRadioEnergyModel::m_currentState
private
BleRadioEnergyDepletionCallback ns3::BleRadioEnergyModel::m_energyDepletionCallback
private
BleRadioEnergyRechargedCallback ns3::BleRadioEnergyModel::m_energyRechargedCallback
private

Definition at line 183 of file ble-radio-energy-model.h.

Referenced by HandleEnergyRecharged(), and SetEnergyRechargedCallback().

double ns3::BleRadioEnergyModel::m_idleCurrentA
private
bool ns3::BleRadioEnergyModel::m_isSupersededChangeState
private

Definition at line 177 of file ble-radio-energy-model.h.

Referenced by BleRadioEnergyModel(), and ChangeState().

Time ns3::BleRadioEnergyModel::m_lastUpdateTime
private

Definition at line 174 of file ble-radio-energy-model.h.

Referenced by BleRadioEnergyModel(), and ChangeState().

uint8_t ns3::BleRadioEnergyModel::m_nPendingChangeState
private

Definition at line 176 of file ble-radio-energy-model.h.

Referenced by BleRadioEnergyModel(), and ChangeState().

double ns3::BleRadioEnergyModel::m_offCurrentA
private
Ptr<BlePhy> ns3::BleRadioEnergyModel::m_phy
private

Definition at line 186 of file ble-radio-energy-model.h.

Referenced by SetPhy().

double ns3::BleRadioEnergyModel::m_rxCurrentA
private

Definition at line 165 of file ble-radio-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetRxCurrentA(), and SetRxCurrentA().

Ptr<EnergySource> ns3::BleRadioEnergyModel::m_source
private
TracedValue<double> ns3::BleRadioEnergyModel::m_totalEnergyConsumption
private

Definition at line 170 of file ble-radio-energy-model.h.

Referenced by ChangeState(), GetTotalEnergyConsumption(), and GetTypeId().

double ns3::BleRadioEnergyModel::m_txCurrentA
private

Definition at line 164 of file ble-radio-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetTxCurrentA(), and SetTxCurrentA().


The documentation for this class was generated from the following files: