A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::AcousticModemEnergyModel Class Reference

WHOI micro-modem energy model. More...

#include "acoustic-modem-energy-model.h"

+ Inheritance diagram for ns3::AcousticModemEnergyModel:

Public Types

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

Public Member Functions

 AcousticModemEnergyModel ()
 Constructor. More...
 
virtual ~AcousticModemEnergyModel ()
 Dummy destructor, see DoDispose. More...
 
virtual void ChangeState (int newState)
 Changes state of the AcousticModemEnergyModel. More...
 
int GetCurrentState (void) const
 Get the current state of the modem. More...
 
double GetIdlePowerW (void) const
 Get the idle power of the modem. More...
 
virtual Ptr< NodeGetNode (void) const
 Gets pointer to node. More...
 
double GetRxPowerW (void) const
 Get the receiving power. More...
 
double GetSleepPowerW (void) const
 Get the sleep state power of the modem. More...
 
virtual double GetTotalEnergyConsumption (void) const
 
double GetTxPowerW (void) const
 Get the transmission power of the modem. More...
 
virtual void HandleEnergyChanged (void)
 Handles energy changed. More...
 
virtual void HandleEnergyDepletion (void)
 Handles energy depletion. More...
 
virtual void HandleEnergyRecharged (void)
 Handles energy recharged. More...
 
void SetEnergyDepletionCallback (AcousticModemEnergyDepletionCallback callback)
 
void SetEnergyRechargeCallback (AcousticModemEnergyRechargeCallback callback)
 
virtual void SetEnergySource (Ptr< EnergySource > source)
 
void SetIdlePowerW (double idlePowerW)
 Set the idle state power of the modem. More...
 
virtual void SetNode (Ptr< Node > node)
 Sets pointer to node. More...
 
void SetRxPowerW (double rxPowerW)
 Set the receiving power of the modem. More...
 
void SetSleepPowerW (double sleepPowerW)
 Set the sleep power of the modem. More...
 
void SetTxPowerW (double txPowerW)
 Set the transmission power of the modem. More...
 
- 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
 Get the most derived TypeId for this Object. 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...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default 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 operator. 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)
 Register this type. More...
 
- 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::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

void DoDispose (void)
 Destructor implementation. More...
 
virtual double DoGetCurrentA (void) const
 
bool IsStateTransitionValid (const int destState)
 
void SetMicroModemState (const int state)
 

Private Attributes

int m_currentState
 Current modem state. More...
 
AcousticModemEnergyDepletionCallback m_energyDepletionCallback
 Energy depletion callback. More...
 
AcousticModemEnergyRechargeCallback m_energyRechargeCallback
 Energy recharge callback. More...
 
double m_idlePowerW
 The idle power, in watts. More...
 
Time m_lastUpdateTime
 Time stamp of previous energy update. More...
 
Ptr< Nodem_node
 The node hosting this transducer. More...
 
double m_rxPowerW
 The receiver power, in watts. More...
 
double m_sleepPowerW
 The sleep power, in watts. More...
 
Ptr< EnergySourcem_source
 The energy source. More...
 
TracedValue< double > m_totalEnergyConsumption
 The total energy consumed by this model. More...
 
double m_txPowerW
 The transmitter power, in watts. More...
 

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

WHOI micro-modem energy model.


Introspection did not find any typical Config paths.

Basing on the Device Energy Model interface, has been implemented a specific energy model for the WHOI micro modem. The class follows pretty closely the RadioEnergyModel class as the transducer behaviour is pretty close to the one of a wifi radio, with identical states (rx, tx, idle, sleep).

The power consumption values implemented into the model are as follows [1]:

Modem State Power Consumption TX 50 W RX 158 mW Idle 158 mW Sleep 5.8 mW

References: [1] Freitag et al., The whoi micro-modem: an acoustic communications and navigation system for multiple platforms, in In Proc. IEEE OCEANS05 Conf, 2005. URL: http://ieeexplore.ieee.org/iel5/10918/34367/01639901.pdf


Attributes

TraceSources

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

Definition at line 55 of file acoustic-modem-energy-model.h.

Member Typedef Documentation

◆ AcousticModemEnergyDepletionCallback

Callback type for energy depletion handling.

Definition at line 59 of file acoustic-modem-energy-model.h.

◆ AcousticModemEnergyRechargeCallback

Callback type for energy recharge handling.

Definition at line 62 of file acoustic-modem-energy-model.h.

Constructor & Destructor Documentation

◆ AcousticModemEnergyModel()

ns3::AcousticModemEnergyModel::AcousticModemEnergyModel ( )

◆ ~AcousticModemEnergyModel()

ns3::AcousticModemEnergyModel::~AcousticModemEnergyModel ( )
virtual

Dummy destructor, see DoDispose.

Definition at line 84 of file acoustic-modem-energy-model.cc.

Member Function Documentation

◆ ChangeState()

void ns3::AcousticModemEnergyModel::ChangeState ( int  newState)
virtual

◆ DoDispose()

void ns3::AcousticModemEnergyModel::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 overridden 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 304 of file acoustic-modem-energy-model.cc.

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

◆ DoGetCurrentA()

double ns3::AcousticModemEnergyModel::DoGetCurrentA ( void  ) const
privatevirtual

◆ GetCurrentState()

int ns3::AcousticModemEnergyModel::GetCurrentState ( void  ) const

Get the current state of the modem.

Returns
Current state.

Definition at line 174 of file acoustic-modem-energy-model.cc.

References m_currentState, and NS_LOG_FUNCTION.

◆ GetIdlePowerW()

double ns3::AcousticModemEnergyModel::GetIdlePowerW ( void  ) const

Get the idle power of the modem.

Returns
The idle power in Watts

Definition at line 146 of file acoustic-modem-energy-model.cc.

References m_idlePowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ GetNode()

Ptr< Node > ns3::AcousticModemEnergyModel::GetNode ( void  ) const
virtual

Gets pointer to node.

Returns
Pointer to node.

Definition at line 97 of file acoustic-modem-energy-model.cc.

References m_node.

◆ GetRxPowerW()

double ns3::AcousticModemEnergyModel::GetRxPowerW ( void  ) const

Get the receiving power.

Returns
The receiving power in Watts

Definition at line 132 of file acoustic-modem-energy-model.cc.

References m_rxPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ GetSleepPowerW()

double ns3::AcousticModemEnergyModel::GetSleepPowerW ( void  ) const

Get the sleep state power of the modem.

Returns
Sleep power of the modem in Watts

Definition at line 160 of file acoustic-modem-energy-model.cc.

References m_sleepPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ GetTotalEnergyConsumption()

double ns3::AcousticModemEnergyModel::GetTotalEnergyConsumption ( void  ) const
virtual
Returns
Total energy consumption of the device.

DeviceEnergyModel records its own energy consumption during simulation.

Implements ns3::DeviceEnergyModel.

Definition at line 111 of file acoustic-modem-energy-model.cc.

References m_totalEnergyConsumption, and NS_LOG_FUNCTION.

◆ GetTxPowerW()

double ns3::AcousticModemEnergyModel::GetTxPowerW ( void  ) const

Get the transmission power of the modem.

Returns
The transmission power in Watts.

Definition at line 118 of file acoustic-modem-energy-model.cc.

References m_txPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ GetTypeId()

TypeId ns3::AcousticModemEnergyModel::GetTypeId ( void  )
static

◆ HandleEnergyChanged()

void ns3::AcousticModemEnergyModel::HandleEnergyChanged ( void  )
virtual

Handles energy changed.

Not implemented

Implements ns3::DeviceEnergyModel.

Definition at line 292 of file acoustic-modem-energy-model.cc.

References NS_LOG_FUNCTION.

◆ HandleEnergyDepletion()

void ns3::AcousticModemEnergyModel::HandleEnergyDepletion ( void  )
virtual

◆ HandleEnergyRecharged()

void ns3::AcousticModemEnergyModel::HandleEnergyRecharged ( void  )
virtual

◆ IsStateTransitionValid()

bool ns3::AcousticModemEnergyModel::IsStateTransitionValid ( const int  destState)
private
Parameters
destStateModem state to switch to.
Returns
True if the transition is allowed.

This function checks if a given modem state transition is allowed.

Definition at line 345 of file acoustic-modem-energy-model.cc.

References NS_LOG_FUNCTION.

Referenced by SetMicroModemState().

◆ SetEnergyDepletionCallback()

void ns3::AcousticModemEnergyModel::SetEnergyDepletionCallback ( AcousticModemEnergyDepletionCallback  callback)
Parameters
callbackCallback function.

Sets callback for energy depletion handling.

Definition at line 181 of file acoustic-modem-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.

◆ SetEnergyRechargeCallback()

void ns3::AcousticModemEnergyModel::SetEnergyRechargeCallback ( AcousticModemEnergyRechargeCallback  callback)
Parameters
callbackCallback function.

Sets callback for energy recharge handling.

Definition at line 193 of file acoustic-modem-energy-model.cc.

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

◆ SetEnergySource()

void ns3::AcousticModemEnergyModel::SetEnergySource ( Ptr< EnergySource source)
virtual
Parameters
sourcePointer to energy source installed on node.

This function sets the pointer to energy source installed on node. Should be called only by DeviceEnergyModel helper classes.

Implements ns3::DeviceEnergyModel.

Definition at line 103 of file acoustic-modem-energy-model.cc.

References m_source, NS_ASSERT, and NS_LOG_FUNCTION.

◆ SetIdlePowerW()

void ns3::AcousticModemEnergyModel::SetIdlePowerW ( double  idlePowerW)

Set the idle state power of the modem.

Parameters
idlePowerWIdle power of the modem in watts.

Definition at line 153 of file acoustic-modem-energy-model.cc.

References m_idlePowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ SetMicroModemState()

void ns3::AcousticModemEnergyModel::SetMicroModemState ( const int  state)
private
Parameters
stateNew state the modem is currently in.

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

Definition at line 352 of file acoustic-modem-energy-model.cc.

References ns3::UanPhy::DISABLED, ns3::UanPhy::IDLE, IsStateTransitionValid(), m_currentState, ns3::Simulator::Now(), NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::UanPhy::RX, ns3::UanPhy::SLEEP, and ns3::UanPhy::TX.

Referenced by ChangeState(), HandleEnergyDepletion(), and HandleEnergyRecharged().

◆ SetNode()

void ns3::AcousticModemEnergyModel::SetNode ( Ptr< Node node)
virtual

Sets pointer to node.

Parameters
nodePointer to node.

Definition at line 89 of file acoustic-modem-energy-model.cc.

References m_node, NS_ASSERT, and NS_LOG_FUNCTION.

◆ SetRxPowerW()

void ns3::AcousticModemEnergyModel::SetRxPowerW ( double  rxPowerW)

Set the receiving power of the modem.

Parameters
rxPowerWReceiving power in watts

Definition at line 139 of file acoustic-modem-energy-model.cc.

References m_rxPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ SetSleepPowerW()

void ns3::AcousticModemEnergyModel::SetSleepPowerW ( double  sleepPowerW)

Set the sleep power of the modem.

Parameters
sleepPowerWSleep power of the modem in watts.

Definition at line 167 of file acoustic-modem-energy-model.cc.

References m_sleepPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

◆ SetTxPowerW()

void ns3::AcousticModemEnergyModel::SetTxPowerW ( double  txPowerW)

Set the transmission power of the modem.

Parameters
txPowerWTransmission power in watts.

Definition at line 125 of file acoustic-modem-energy-model.cc.

References m_txPowerW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

Member Data Documentation

◆ m_currentState

int ns3::AcousticModemEnergyModel::m_currentState
private

◆ m_energyDepletionCallback

AcousticModemEnergyDepletionCallback ns3::AcousticModemEnergyModel::m_energyDepletionCallback
private

Energy depletion callback.

Definition at line 237 of file acoustic-modem-energy-model.h.

Referenced by AcousticModemEnergyModel(), DoDispose(), HandleEnergyDepletion(), and SetEnergyDepletionCallback().

◆ m_energyRechargeCallback

AcousticModemEnergyRechargeCallback ns3::AcousticModemEnergyModel::m_energyRechargeCallback
private

Energy recharge callback.

Definition at line 240 of file acoustic-modem-energy-model.h.

Referenced by HandleEnergyRecharged(), and SetEnergyRechargeCallback().

◆ m_idlePowerW

double ns3::AcousticModemEnergyModel::m_idlePowerW
private

The idle power, in watts.

Definition at line 226 of file acoustic-modem-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetIdlePowerW(), and SetIdlePowerW().

◆ m_lastUpdateTime

Time ns3::AcousticModemEnergyModel::m_lastUpdateTime
private

Time stamp of previous energy update.

Definition at line 234 of file acoustic-modem-energy-model.h.

Referenced by AcousticModemEnergyModel(), and ChangeState().

◆ m_node

Ptr<Node> ns3::AcousticModemEnergyModel::m_node
private

◆ m_rxPowerW

double ns3::AcousticModemEnergyModel::m_rxPowerW
private

The receiver power, in watts.

Definition at line 225 of file acoustic-modem-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetRxPowerW(), and SetRxPowerW().

◆ m_sleepPowerW

double ns3::AcousticModemEnergyModel::m_sleepPowerW
private

The sleep power, in watts.

Definition at line 227 of file acoustic-modem-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetSleepPowerW(), and SetSleepPowerW().

◆ m_source

Ptr<EnergySource> ns3::AcousticModemEnergyModel::m_source
private

The energy source.

Definition at line 221 of file acoustic-modem-energy-model.h.

Referenced by AcousticModemEnergyModel(), ChangeState(), DoDispose(), DoGetCurrentA(), and SetEnergySource().

◆ m_totalEnergyConsumption

TracedValue<double> ns3::AcousticModemEnergyModel::m_totalEnergyConsumption
private

The total energy consumed by this model.

Definition at line 230 of file acoustic-modem-energy-model.h.

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

◆ m_txPowerW

double ns3::AcousticModemEnergyModel::m_txPowerW
private

The transmitter power, in watts.

Definition at line 224 of file acoustic-modem-energy-model.h.

Referenced by ChangeState(), DoGetCurrentA(), GetTxPowerW(), and SetTxPowerW().


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