WHOI micro-modem energy model. More...
#include <acoustic-modem-energy-model.h>
Public Types | |
typedef Callback< void > | AcousticModemEnergyDepletionCallback |
![]() | |
typedef Callback< void, int > | ChangeStateCallback |
Public Member Functions | |
AcousticModemEnergyModel () | |
virtual | ~AcousticModemEnergyModel () |
virtual void | ChangeState (int newState) |
Changes state of the AcousticModemEnergyModel. | |
int | GetCurrentState (void) const |
double | GetIdlePowerW (void) const |
virtual Ptr< Node > | GetNode (void) const |
Gets pointer to node. | |
double | GetRxPowerW (void) const |
double | GetSleepPowerW (void) const |
virtual double | GetTotalEnergyConsumption (void) const |
double | GetTxPowerW (void) const |
virtual void | HandleEnergyDepletion (void) |
Handles energy depletion. | |
void | SetEnergyDepletionCallback (AcousticModemEnergyDepletionCallback callback) |
virtual void | SetEnergySource (Ptr< EnergySource > source) |
Sets pointer to EnergySouce installed on node. | |
void | SetIdlePowerW (double idlePowerW) |
virtual void | SetNode (Ptr< Node > node) |
Sets pointer to node. | |
void | SetRxPowerW (double rxPowerW) |
void | SetSleepPowerW (double sleepPowerW) |
void | SetTxPowerW (double txPowerW) |
![]() | |
DeviceEnergyModel () | |
virtual | ~DeviceEnergyModel () |
double | GetCurrentA (void) const |
![]() | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
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 | Start (void) |
![]() | |
SimpleRefCount () | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
![]() | |
virtual | ~ObjectBase () |
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) |
This method returns the TypeId associated to ns3::AcousticModemEnergyModel. |
Private Member Functions | |
void | DoDispose (void) |
virtual double | DoGetCurrentA (void) const |
bool | IsStateTransitionValid (const int destState) |
void | SetMicroModemState (const int state) |
Private Attributes | |
int | m_currentState |
AcousticModemEnergyDepletionCallback | m_energyDepletionCallback |
double | m_idlePowerW |
Time | m_lastUpdateTime |
Ptr< Node > | m_node |
double | m_rxPowerW |
double | m_sleepPowerW |
Ptr< EnergySource > | m_source |
TracedValue< double > | m_totalEnergyConsumption |
double | m_txPowerW |
Additional Inherited Members | |
![]() | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
virtual void | DoStart (void) |
virtual void | NotifyNewAggregate (void) |
WHOI micro-modem energy model.
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 52 of file acoustic-modem-energy-model.h.
Callback type for energy depletion handling.
Definition at line 58 of file acoustic-modem-energy-model.h.
ns3::AcousticModemEnergyModel::AcousticModemEnergyModel | ( | ) |
Definition at line 73 of file acoustic-modem-energy-model.cc.
References ns3::IDLE, m_currentState, m_energyDepletionCallback, m_lastUpdateTime, m_node, m_source, NS_LOG_FUNCTION, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::Nullify(), and ns3::Seconds().
|
virtual |
Definition at line 83 of file acoustic-modem-energy-model.cc.
|
virtual |
Changes state of the AcousticModemEnergyModel.
newState | New state the modem is in. |
Implements DeviceEnergyModel::ChangeState.
Implements ns3::DeviceEnergyModel.
Definition at line 192 of file acoustic-modem-energy-model.cc.
References ns3::Node::GetId(), ns3::Time::GetNanoSeconds(), ns3::Time::GetSeconds(), ns3::EnergySource::GetSupplyVoltage(), ns3::UanPhy::IDLE, m_currentState, m_idlePowerW, m_lastUpdateTime, m_node, m_rxPowerW, m_sleepPowerW, m_source, m_totalEnergyConsumption, m_txPowerW, ns3::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::UanPhy::RX, SetMicroModemState(), ns3::UanPhy::SLEEP, ns3::UanPhy::TX, and ns3::EnergySource::UpdateEnergySource().
|
private |
Definition at line 259 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 |
Implements DeviceEnergyModel::GetCurrentA.
Definition at line 268 of file acoustic-modem-energy-model.cc.
References ns3::EnergySource::GetSupplyVoltage(), 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 |
Definition at line 173 of file acoustic-modem-energy-model.cc.
References m_currentState, and NS_LOG_FUNCTION.
double ns3::AcousticModemEnergyModel::GetIdlePowerW | ( | void | ) | const |
Definition at line 145 of file acoustic-modem-energy-model.cc.
References m_idlePowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
Gets pointer to node.
Implements DeviceEnergyModel::GetNode.
Definition at line 96 of file acoustic-modem-energy-model.cc.
References m_node.
double ns3::AcousticModemEnergyModel::GetRxPowerW | ( | void | ) | const |
Definition at line 131 of file acoustic-modem-energy-model.cc.
References m_rxPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
double ns3::AcousticModemEnergyModel::GetSleepPowerW | ( | void | ) | const |
Definition at line 159 of file acoustic-modem-energy-model.cc.
References m_sleepPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Implements DeviceEnergyModel::GetTotalEnergyConsumption.
Implements ns3::DeviceEnergyModel.
Definition at line 110 of file acoustic-modem-energy-model.cc.
References m_totalEnergyConsumption, and NS_LOG_FUNCTION.
double ns3::AcousticModemEnergyModel::GetTxPowerW | ( | void | ) | const |
Definition at line 117 of file acoustic-modem-energy-model.cc.
References m_txPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
static |
This method returns the TypeId associated to ns3::AcousticModemEnergyModel.
Attributes defined for this type:
TraceSources defined for this type:
Reimplemented from ns3::DeviceEnergyModel.
Definition at line 37 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 DeviceEnergyModel::HandleEnergyDepletion
Implements ns3::DeviceEnergyModel.
Definition at line 239 of file acoustic-modem-energy-model.cc.
References ns3::UanPhy::EnergyDepletionHandler(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Object::GetObject(), ns3::UanNetDevice::GetPhy(), 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 297 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 180 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 |
Sets pointer to EnergySouce installed on node.
source | Pointer to EnergySource installed on node. |
Implements DeviceEnergyModel::SetEnergySource.
Implements ns3::DeviceEnergyModel.
Definition at line 102 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 power of the modem
idlePowerW | Idle power of the modem in watts |
Definition at line 152 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 304 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. |
Implements DeviceEnergyModel::SetNode.
Definition at line 88 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 of the modem in watts |
Definition at line 138 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 166 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 of the modem in watts |
Definition at line 124 of file acoustic-modem-energy-model.cc.
References m_txPowerW, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
private |
Definition at line 220 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoGetCurrentA(), GetCurrentState(), and SetMicroModemState().
|
private |
Definition at line 224 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), DoDispose(), HandleEnergyDepletion(), and SetEnergyDepletionCallback().
|
private |
Definition at line 213 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetIdlePowerW(), and SetIdlePowerW().
|
private |
Definition at line 221 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), and ChangeState().
Definition at line 207 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoDispose(), GetNode(), HandleEnergyDepletion(), and SetNode().
|
private |
Definition at line 212 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetRxPowerW(), and SetRxPowerW().
|
private |
Definition at line 214 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetSleepPowerW(), and SetSleepPowerW().
|
private |
Definition at line 208 of file acoustic-modem-energy-model.h.
Referenced by AcousticModemEnergyModel(), ChangeState(), DoDispose(), DoGetCurrentA(), and SetEnergySource().
|
private |
Definition at line 217 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), GetTotalEnergyConsumption(), and GetTypeId().
|
private |
Definition at line 211 of file acoustic-modem-energy-model.h.
Referenced by ChangeState(), DoGetCurrentA(), GetTxPowerW(), and SetTxPowerW().