WHOI micro-modem energy model. More...
#include <acoustic-modem-energy-model.h>
Public Types | |
typedef Callback< void > | AcousticModemEnergyDepletionCallback |
Callback type for energy depletion 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< Node > | GetNode (void) const |
Gets pointer to node. More... | |
double | GetRxPowerW (void) const |
Get the recieving 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 | HandleEnergyDepletion (void) |
Handles energy depletion. More... | |
void | SetEnergyDepletionCallback (AcousticModemEnergyDepletionCallback 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 () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. 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... | |
SimpleRefCount & | operator= (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 |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
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::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) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. 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... | |
double | m_idlePowerW |
The idle power, in watts. More... | |
Time | m_lastUpdateTime |
Time stamp of previous energy update. More... | |
Ptr< Node > | m_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< EnergySource > | m_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) | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
WHOI micro-modem energy model.
Doxygen 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
Definition at line 55 of file acoustic-modem-energy-model.h.
Callback type for energy depletion handling.
Definition at line 59 of file acoustic-modem-energy-model.h.
ns3::AcousticModemEnergyModel::AcousticModemEnergyModel | ( | ) |
Constructor.
Definition at line 74 of file acoustic-modem-energy-model.cc.
References ns3::UanPhy::IDLE, m_currentState, m_energyDepletionCallback, m_lastUpdateTime, m_node, m_source, NS_LOG_FUNCTION, and ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Nullify().
|
virtual |
Dummy destructor, see DoDispose.
Definition at line 84 of file acoustic-modem-energy-model.cc.
|
virtual |
Changes state of the AcousticModemEnergyModel.
newState | New state the modem is in. |
Implements ns3::DeviceEnergyModel.
Definition at line 193 of file acoustic-modem-energy-model.cc.
References ns3::Node::GetId(), ns3::Time::GetNanoSeconds(), ns3::Time::GetSeconds(), ns3::UanPhy::IDLE, m_currentState, m_idlePowerW, m_lastUpdateTime, m_node, m_rxPowerW, m_sleepPowerW, m_source, m_totalEnergyConsumption, m_txPowerW, ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::UanPhy::RX, SetMicroModemState(), ns3::UanPhy::SLEEP, and ns3::UanPhy::TX.
|
privatevirtual |
This method is called by Object::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 260 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().
|
privatevirtual |
Reimplemented from ns3::DeviceEnergyModel.
Definition at line 269 of file acoustic-modem-energy-model.cc.
References ns3::UanPhy::IDLE, m_currentState, m_idlePowerW, m_rxPowerW, m_sleepPowerW, m_source, m_txPowerW, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::UanPhy::RX, ns3::UanPhy::SLEEP, and ns3::UanPhy::TX.
int ns3::AcousticModemEnergyModel::GetCurrentState | ( | void | ) | const |
Get the current state of the modem.
Definition at line 174 of file acoustic-modem-energy-model.cc.
References m_currentState, and NS_LOG_FUNCTION.
double ns3::AcousticModemEnergyModel::GetIdlePowerW | ( | void | ) | const |
Get the idle power of the modem.
Definition at line 146 of file acoustic-modem-energy-model.cc.
References m_idlePowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
Gets pointer to node.
Definition at line 97 of file acoustic-modem-energy-model.cc.
References m_node.
double ns3::AcousticModemEnergyModel::GetRxPowerW | ( | void | ) | const |
Get the recieving power.
Definition at line 132 of file acoustic-modem-energy-model.cc.
References m_rxPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
double ns3::AcousticModemEnergyModel::GetSleepPowerW | ( | void | ) | const |
Get the sleep state power of the modem.
Definition at line 160 of file acoustic-modem-energy-model.cc.
References m_sleepPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
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.
double ns3::AcousticModemEnergyModel::GetTxPowerW | ( | void | ) | const |
Get the transmission power of the modem.
Definition at line 118 of file acoustic-modem-energy-model.cc.
References m_txPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
static |
Register this type.
Definition at line 38 of file acoustic-modem-energy-model.cc.
References GetIdlePowerW(), GetRxPowerW(), GetSleepPowerW(), GetTxPowerW(), m_totalEnergyConsumption, ns3::MakeTraceSourceAccessor(), SetIdlePowerW(), ns3::TypeId::SetParent(), SetRxPowerW(), SetSleepPowerW(), and SetTxPowerW().
|
virtual |
Handles energy depletion.
Implements ns3::DeviceEnergyModel.
Definition at line 240 of file acoustic-modem-energy-model.cc.
References ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_energyDepletionCallback, m_node, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
private |
destState | Modem state to switch to. |
This function checks if a given modem state transition is allowed.
Definition at line 298 of file acoustic-modem-energy-model.cc.
References NS_LOG_FUNCTION.
Referenced by SetMicroModemState().
void ns3::AcousticModemEnergyModel::SetEnergyDepletionCallback | ( | AcousticModemEnergyDepletionCallback | callback | ) |
callback | Callback 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.
|
virtual |
source | Pointer 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.
void ns3::AcousticModemEnergyModel::SetIdlePowerW | ( | double | idlePowerW | ) |
Set the idle state power of the modem.
idlePowerW | Idle 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().
|
private |
state | New 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 305 of file acoustic-modem-energy-model.cc.
References 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().
Sets pointer to node.
node | Pointer to node. |
Definition at line 89 of file acoustic-modem-energy-model.cc.
References m_node, NS_ASSERT, and NS_LOG_FUNCTION.
void ns3::AcousticModemEnergyModel::SetRxPowerW | ( | double | rxPowerW | ) |
Set the receiving power of the modem.
rxPowerW | Receiving power in watts |
Definition at line 139 of file acoustic-modem-energy-model.cc.
References m_rxPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::AcousticModemEnergyModel::SetSleepPowerW | ( | double | sleepPowerW | ) |
Set the sleep power of the modem.
sleepPowerW | Sleep 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().
void ns3::AcousticModemEnergyModel::SetTxPowerW | ( | double | txPowerW | ) |
Set the transmission power of the modem.
txPowerW | Transmission power in watts. |
Definition at line 125 of file acoustic-modem-energy-model.cc.
References m_txPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
private |
Current modem state.
Definition at line 211 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoGetCurrentA(), GetCurrentState(), and SetMicroModemState().
|
private |
Energy depletion callback.
Definition at line 215 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), DoDispose(), HandleEnergyDepletion(), and SetEnergyDepletionCallback().
|
private |
The idle power, in watts.
Definition at line 204 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetIdlePowerW(), and SetIdlePowerW().
|
private |
Time stamp of previous energy update.
Definition at line 212 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), and ChangeState().
The node hosting this transducer.
Definition at line 198 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoDispose(), GetNode(), HandleEnergyDepletion(), and SetNode().
|
private |
The receiver power, in watts.
Definition at line 203 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetRxPowerW(), and SetRxPowerW().
|
private |
The sleep power, in watts.
Definition at line 205 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetSleepPowerW(), and SetSleepPowerW().
|
private |
The energy source.
Definition at line 199 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoDispose(), DoGetCurrentA(), and SetEnergySource().
|
private |
The total energy consumed by this model.
Definition at line 208 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), GetTotalEnergyConsumption(), and GetTypeId().
|
private |
The transmitter power, in watts.
Definition at line 202 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetTxPowerW(), and SetTxPowerW().