Implementation of PhyLayer of BLE protocol. More...
#include "ble-phy.h"
Public Types | |
enum | BlePhyState { OFF, IDLE, LISTEN, BUSY_RX, TRANS, BUSY_TX } |
Public Member Functions | |
BlePhy (void) | |
virtual | ~BlePhy (void) |
Time | CalculateTxTime (Ptr< const Packet > packet) |
void | ChangeState () |
void | ChangeState (BlePhyState new_state) |
void | EndRx (Ptr< SpectrumSignalParameters > params) |
Finish the reception of a Packet. More... | |
void | EndTx (void) |
virtual Ptr< SpectrumChannel > | GetChannel () |
uint32_t | GetChannelNo (void) |
virtual Ptr< NetDevice > | GetDevice (void) const |
Get the associated NetDevice instance. More... | |
Ptr< SpectrumErrorModel > | GetErrorModel (void) const |
get the error model in use More... | |
virtual Ptr< MobilityModel > | GetMobility () |
Get the associated MobilityModel instance. More... | |
Ptr< const SpectrumValue > | GetNoisePowerSpectralDensity (void) |
Get the noise power spectral density. More... | |
virtual Ptr< AntennaModel > | GetRxAntenna () |
Get the AntennaModel used by the NetDevice for reception. More... | |
double | GetRxSensitivity (void) |
virtual Ptr< const SpectrumModel > | GetRxSpectrumModel () const |
BlePhyState | GetState (void) const |
double | GetTxPower (void) |
void | RxPacketFromLinkLayer (Ptr< Packet > pkt) |
void | SendPktToLinkLayer (Ptr< Packet > p, uint8_t channnelNo) |
virtual void | SetChannel (Ptr< SpectrumChannel > c) |
Set the channel attached to this device. More... | |
void | SetChannelNo (uint32_t channel_no) |
virtual void | SetDevice (Ptr< NetDevice > d) |
Set the associated NetDevice instance. More... | |
void | SetErrorModel (Ptr< SpectrumErrorModel > e) |
set the error model to use More... | |
void | SetIdleState () |
virtual void | SetMobility (Ptr< MobilityModel > m) |
Set the mobility model associated with this device. More... | |
void | SetNextPendingState (BlePhyState state) |
void | SetNoisePowerSpectralDensity (Ptr< const SpectrumValue > noisePsd) |
Set the noise power spectral density. More... | |
virtual void | SetRxAntenna (Ptr< AntennaModel > a) |
void | SetRxSensitivity (double rxSensitivity) |
void | SetTxPower (double txPower) |
virtual void | StartRx (Ptr< SpectrumSignalParameters > params) |
Notify the SpectrumPhy instance of an incoming signal. More... | |
void | StartTx (void) |
Public Member Functions inherited from ns3::SpectrumPhy | |
SpectrumPhy () | |
virtual | ~SpectrumPhy () |
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... | |
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 |
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) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::SpectrumPhy | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
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 | CheckInterference (void) |
Private Attributes | |
Ptr< AntennaModel > | m_antenna |
Ptr< SpectrumChannel > | m_channel |
uint32_t | m_channelNo |
std::pair< Ptr < BleSpectrumSignalParameters > , bool > | m_currentRxParam |
std::pair< Ptr < BleSpectrumSignalParameters > , bool > | m_currentTxParam |
Ptr< SpectrumErrorModel > | m_errorModel |
The error model describing the bit and packet error rates. More... | |
Ptr< MobilityModel > | m_mobility |
Ptr< NetDevice > | m_netDevice |
BlePhyState | m_nextPendingState |
Ptr< const SpectrumValue > | m_noise |
The spectral density for for the noise. More... | |
TracedCallback< Ptr< const Packet > > | m_phyRxBeginTrace |
The trace source fired when a packet begins the reception process from the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyRxDropTrace |
The trace source fired when the phy layer drops a packet it has received. More... | |
TracedCallback< Ptr< const Packet >, double > | m_phyRxEndTrace |
The trace source fired when a packet ends the reception process from the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxBeginTrace |
The trace source fired when a packet begins the transmission process on the medium. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxDropTrace |
The trace source fired when the phy layer drops a packet as it tries to transmit it. More... | |
TracedCallback< Ptr< const Packet > > | m_phyTxEndTrace |
The trace source fired when a packet ends the transmission process on the medium. More... | |
Ptr< UniformRandomVariable > | m_random |
Uniform random variable stream. More... | |
Time | m_recentSignalRx |
Timestamp of the most recently received signal. More... | |
double | m_rxSensitivity |
Ptr< BleInterferenceHelper > | m_signal |
The accumulated signals currently received by the transceiver, including the signal of a possibly received packet, as well as all signals considered noise. More... | |
TracedValue< BlePhyState > | m_state |
double | m_txPower |
Ptr< SpectrumValue > | m_txPsd |
The transmit power spectral density. More... | |
TracedCallback< Ptr< Packet > , uint8_t > | m_txToLLTrace |
The trace source fired when a packet transmitted to LinkLayer. More... | |
Static Private Attributes | |
static const double | g_dataRate = 1.00e6 |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoDispose (void) |
Destructor implementation. 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... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Implementation of PhyLayer of BLE protocol.
ns3::BlePhy is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
Size of this type is 312 bytes (on a 64-bit architecture).
ns3::BlePhy::BlePhy | ( | void | ) |
Definition at line 90 of file ble-phy.cc.
References ns3::BleSpectrumValueHelper::CreateNoisePowerSpectralDensity(), m_channelNo, m_currentRxParam, m_currentTxParam, m_noise, m_random, m_rxSensitivity, m_signal, m_state, m_txPower, NS_LOG_FUNCTION, OFF, and ns3::ObjectBase::SetAttribute().
|
virtual |
Definition at line 112 of file ble-phy.cc.
References NS_LOG_FUNCTION.
Definition at line 548 of file ble-phy.cc.
References g_dataRate, ns3::Packet::GetSize(), NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by RxPacketFromLinkLayer().
void ns3::BlePhy::ChangeState | ( | ) |
Definition at line 266 of file ble-phy.cc.
References m_nextPendingState, m_state, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::BleLLChangeState(), EndRx(), EndTx(), GenerateTraffic(), SendOnePacket(), SetIdleState(), StartRx(), and StartTx().
void ns3::BlePhy::ChangeState | ( | BlePhy::BlePhyState | new_state | ) |
Definition at line 280 of file ble-phy.cc.
References m_state, and NS_LOG_FUNCTION.
|
private |
Definition at line 356 of file ble-phy.cc.
References BUSY_RX, ns3::BleSpectrumValueHelper::CreateTxPowerSpectralDensity(), g_dataRate, ns3::Time::GetSeconds(), m_channelNo, m_currentRxParam, m_errorModel, m_noise, m_recentSignalRx, m_signal, m_state, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::BleSpectrumValueHelper::TotalAvgPower().
Referenced by EndRx().
void ns3::BlePhy::EndRx | ( | Ptr< SpectrumSignalParameters > | params | ) |
Finish the reception of a Packet.
This is called at the end of a packet reception, applying possibly pending PHY state changes and fireing the appropriate trace sources and indication callbacks to the LinkLayer. A packet destroyed by noise/interference is dropped here, but not during reception. This method is also called for every packet which only contributes to interference.
params | signal parameters of the packet |
Definition at line 409 of file ble-phy.cc.
References ChangeState(), CheckInterference(), ns3::Packet::GetUid(), IDLE, m_channelNo, m_currentRxParam, m_netDevice, m_phyRxDropTrace, m_signal, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and SendPktToLinkLayer().
Referenced by StartRx().
void ns3::BlePhy::EndTx | ( | void | ) |
Definition at line 518 of file ble-phy.cc.
References BUSY_TX, ChangeState(), IDLE, m_currentTxParam, m_phyTxDropTrace, m_phyTxEndTrace, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Simulator::Schedule().
Referenced by StartTx().
|
virtual |
Definition at line 216 of file ble-phy.cc.
References m_channel, and NS_LOG_FUNCTION.
uint32_t ns3::BlePhy::GetChannelNo | ( | void | ) |
Definition at line 143 of file ble-phy.cc.
References m_channelNo, and NS_LOG_FUNCTION.
Get the associated NetDevice instance.
Implements ns3::SpectrumPhy.
Definition at line 187 of file ble-phy.cc.
References m_netDevice, and NS_LOG_FUNCTION.
Ptr< SpectrumErrorModel > ns3::BlePhy::GetErrorModel | ( | void | ) | const |
get the error model in use
Definition at line 173 of file ble-phy.cc.
References m_errorModel, and NS_LOG_FUNCTION.
|
virtual |
Get the associated MobilityModel instance.
Implements ns3::SpectrumPhy.
Definition at line 201 of file ble-phy.cc.
References m_mobility, and NS_LOG_FUNCTION.
Ptr< const SpectrumValue > ns3::BlePhy::GetNoisePowerSpectralDensity | ( | void | ) |
Get the noise power spectral density.
Definition at line 566 of file ble-phy.cc.
References m_noise, and NS_LOG_FUNCTION.
|
virtual |
Get the AntennaModel used by the NetDevice for reception.
Implements ns3::SpectrumPhy.
Definition at line 241 of file ble-phy.cc.
References m_antenna, and NS_LOG_FUNCTION.
double ns3::BlePhy::GetRxSensitivity | ( | void | ) |
Definition at line 158 of file ble-phy.cc.
References m_rxSensitivity, and NS_LOG_FUNCTION.
|
virtual |
Implements ns3::SpectrumPhy.
Definition at line 223 of file ble-phy.cc.
References ns3::SpectrumValue::GetSpectrumModel(), m_txPsd, and NS_LOG_FUNCTION.
BlePhy::BlePhyState ns3::BlePhy::GetState | ( | void | ) | const |
Definition at line 248 of file ble-phy.cc.
References m_state, and NS_LOG_FUNCTION.
double ns3::BlePhy::GetTxPower | ( | void | ) |
Definition at line 127 of file ble-phy.cc.
References m_txPower, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 41 of file ble-phy.cc.
References m_phyRxBeginTrace, m_phyRxDropTrace, m_phyRxEndTrace, m_phyTxBeginTrace, m_phyTxDropTrace, m_phyTxEndTrace, m_state, m_txToLLTrace, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
Definition at line 468 of file ble-phy.cc.
References CalculateTxTime(), ns3::Packet::GetUid(), m_antenna, m_currentTxParam, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by GenerateTraffic(), and SendOnePacket().
Definition at line 461 of file ble-phy.cc.
References m_txToLLTrace, and NS_LOG_FUNCTION.
Referenced by EndRx().
|
virtual |
Set the channel attached to this device.
c | the channel |
Implements ns3::SpectrumPhy.
Definition at line 208 of file ble-phy.cc.
References m_channel, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetChannelNo | ( | uint32_t | channel_no | ) |
Definition at line 134 of file ble-phy.cc.
References m_channelNo, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Set the associated NetDevice instance.
d | the NetDevice instance |
Implements ns3::SpectrumPhy.
Definition at line 180 of file ble-phy.cc.
References m_netDevice, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetErrorModel | ( | Ptr< SpectrumErrorModel > | e | ) |
set the error model to use
e | pointer to SpectrumErrorModel to use |
Definition at line 165 of file ble-phy.cc.
References m_errorModel, NS_ASSERT, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetIdleState | ( | ) |
Definition at line 273 of file ble-phy.cc.
References ChangeState(), IDLE, and NS_LOG_FUNCTION.
|
virtual |
Set the mobility model associated with this device.
m | the mobility model |
Implements ns3::SpectrumPhy.
Definition at line 194 of file ble-phy.cc.
References m_mobility, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetNextPendingState | ( | BlePhy::BlePhyState | state | ) |
Definition at line 255 of file ble-phy.cc.
References m_nextPendingState, and NS_LOG_FUNCTION.
Referenced by ns3::BleLinkLayer::BleLLChangeState().
void ns3::BlePhy::SetNoisePowerSpectralDensity | ( | Ptr< const SpectrumValue > | noisePsd | ) |
Set the noise power spectral density.
noisePsd | the Noise Power Spectral Density in power units (Watt, Pascal...) per Hz. |
Definition at line 557 of file ble-phy.cc.
References m_noise, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
virtual |
Definition at line 234 of file ble-phy.cc.
References m_antenna, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetRxSensitivity | ( | double | rxSensitivity | ) |
Definition at line 150 of file ble-phy.cc.
References m_rxSensitivity, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
void ns3::BlePhy::SetTxPower | ( | double | txPower | ) |
Definition at line 118 of file ble-phy.cc.
References m_txPower, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
virtual |
Notify the SpectrumPhy instance of an incoming signal.
params | the parameters of the signals being received |
Implements ns3::SpectrumPhy.
Definition at line 287 of file ble-phy.cc.
References BUSY_RX, ChangeState(), EndRx(), LISTEN, m_channelNo, m_currentRxParam, m_phyRxBeginTrace, m_phyRxDropTrace, m_recentSignalRx, m_rxSensitivity, m_signal, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::BleSpectrumValueHelper::TotalAvgPower().
void ns3::BlePhy::StartTx | ( | void | ) |
Definition at line 485 of file ble-phy.cc.
References BUSY_TX, ChangeState(), ns3::BleSpectrumValueHelper::CreateTxPowerSpectralDensity(), EndTx(), m_channel, m_channelNo, m_currentTxParam, m_phyTxBeginTrace, m_phyTxDropTrace, m_state, m_txPower, m_txPsd, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::Simulator::Schedule(), and TRANS.
Referenced by GenerateTraffic(), and SendOnePacket().
|
staticprivate |
Definition at line 268 of file ble-phy.h.
Referenced by CalculateTxTime(), and CheckInterference().
|
private |
Definition at line 322 of file ble-phy.h.
Referenced by GetRxAntenna(), RxPacketFromLinkLayer(), and SetRxAntenna().
|
private |
Definition at line 321 of file ble-phy.h.
Referenced by GetChannel(), SetChannel(), and StartTx().
|
private |
Definition at line 278 of file ble-phy.h.
Referenced by BlePhy(), CheckInterference(), EndRx(), GetChannelNo(), SetChannelNo(), StartRx(), and StartTx().
|
private |
|
private |
|
private |
The error model describing the bit and packet error rates.
Definition at line 305 of file ble-phy.h.
Referenced by CheckInterference(), GetErrorModel(), and SetErrorModel().
|
private |
Definition at line 320 of file ble-phy.h.
Referenced by GetMobility(), and SetMobility().
Definition at line 323 of file ble-phy.h.
Referenced by EndRx(), GetDevice(), and SetDevice().
|
private |
Definition at line 263 of file ble-phy.h.
Referenced by ChangeState(), and SetNextPendingState().
|
private |
The spectral density for for the noise.
Definition at line 300 of file ble-phy.h.
Referenced by BlePhy(), CheckInterference(), GetNoisePowerSpectralDensity(), and SetNoisePowerSpectralDensity().
|
private |
The trace source fired when a packet begins the reception process from the medium.
Definition at line 362 of file ble-phy.h.
Referenced by GetTypeId(), and StartRx().
|
private |
The trace source fired when the phy layer drops a packet it has received.
Definition at line 377 of file ble-phy.h.
Referenced by EndRx(), GetTypeId(), and StartRx().
|
private |
The trace source fired when a packet ends the reception process from the medium.
Second quantity is received SINR.
Definition at line 370 of file ble-phy.h.
Referenced by GetTypeId().
|
private |
The trace source fired when a packet begins the transmission process on the medium.
Definition at line 338 of file ble-phy.h.
Referenced by GetTypeId(), and StartTx().
|
private |
The trace source fired when the phy layer drops a packet as it tries to transmit it.
Definition at line 354 of file ble-phy.h.
Referenced by EndTx(), GetTypeId(), and StartTx().
|
private |
The trace source fired when a packet ends the transmission process on the medium.
Definition at line 346 of file ble-phy.h.
Referenced by EndTx(), and GetTypeId().
|
private |
|
private |
Timestamp of the most recently received signal.
Hence, the slot when maximum interference occurred at receiving antenna.
Definition at line 388 of file ble-phy.h.
Referenced by CheckInterference(), and StartRx().
|
private |
Definition at line 273 of file ble-phy.h.
Referenced by BlePhy(), GetRxSensitivity(), SetRxSensitivity(), and StartRx().
|
private |
|
private |
Definition at line 259 of file ble-phy.h.
Referenced by BlePhy(), ChangeState(), CheckInterference(), EndTx(), GetState(), GetTypeId(), StartRx(), and StartTx().
|
private |
Definition at line 283 of file ble-phy.h.
Referenced by BlePhy(), GetTxPower(), SetTxPower(), and StartTx().
|
private |
The transmit power spectral density.
Definition at line 288 of file ble-phy.h.
Referenced by GetRxSpectrumModel(), and StartTx().
|
private |
The trace source fired when a packet transmitted to LinkLayer.
Definition at line 331 of file ble-phy.h.
Referenced by GetTypeId(), and SendPktToLinkLayer().