Base class for PHY layers implementing the LoRa modulation scheme. More...
#include "lora-phy.h"
Public Types | |
| typedef Callback< void, Ptr< const Packet > > | RxFailedCallback |
| Type definition for a callback for when a packet reception fails. | |
| typedef Callback< void, Ptr< const Packet > > | RxOkCallback |
| Type definition for a callback for when a packet is correctly received. | |
| typedef Callback< void, Ptr< const Packet > > | TxFinishedCallback |
| Type definition for a callback to call when a packet has finished sending. | |
Public Member Functions | |
| LoraPhy () | |
| Default constructor. | |
| ~LoraPhy () override | |
| Destructor. | |
| Ptr< LoraChannel > | GetChannel () const |
| Get the channel instance associated to this PHY. | |
| Ptr< NetDevice > | GetDevice () const |
| Get the NetDevice associated to this PHY. | |
| Ptr< MobilityModel > | GetMobility () |
| Get the mobility model associated to this PHY. | |
| virtual bool | IsOnFrequency (uint32_t frequencyHz) const =0 |
| Whether this device is listening on the specified frequency or not. | |
| virtual bool | IsTransmitting () const =0 |
| Whether this device is transmitting or not. | |
| virtual void | Send (Ptr< Packet > packet, uint32_t frequencyHz, IQPolarity iqPolarity, const LoraTxParameters &txParams, double txPowerDbm)=0 |
| Instruct the PHY to send a packet according to some parameters. | |
| void | SetChannel (Ptr< LoraChannel > channel) |
| Set the LoraChannel instance PHY transmits on. | |
| void | SetDevice (Ptr< NetDevice > device) |
| Set the NetDevice that owns this PHY. | |
| void | SetMobility (Ptr< MobilityModel > mobility) |
| Set the mobility model associated to this PHY. | |
| void | SetReceiveFailedCallback (RxFailedCallback callback) |
| Set the callback to call upon failed reception of a packet we were previously locked on. | |
| void | SetReceiveOkCallback (RxOkCallback callback) |
| Set the callback to call upon successful reception of a packet. | |
| void | SetTxFinishedCallback (TxFinishedCallback callback) |
| Set the callback to call after transmission of a packet. | |
| virtual void | StartReceive (Ptr< Packet > packet, uint32_t frequencyHz, IQPolarity iqPolarity, uint8_t spreadingFactor, double rxPowerDbm, Time duration)=0 |
| Start receiving a packet. | |
| Public Member Functions inherited from ns3::Object | |
| Object () | |
| Caller graph was not generated because of its size. | |
| ~Object () override | |
| Destructor. | |
| void | AggregateObject (Ptr< Object > other) |
| Aggregate two Objects together. | |
| void | Dispose () |
| Dispose of this Object. | |
| AggregateIterator | GetAggregateIterator () const |
| Get an iterator to the Objects aggregated to this one. | |
| TypeId | GetInstanceTypeId () const final |
| Get the most derived TypeId for this Object. | |
| template<> | |
| Ptr< Object > | GetObject () const |
| Specialization of () for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject () const |
| Get a pointer to the requested aggregated Object. | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const |
| Specialization of (TypeId tid) for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject (TypeId tid) const |
| Get a pointer to the requested aggregated Object by TypeId. | |
| void | Initialize () |
| Invoke DoInitialize on all Objects aggregated to this one. | |
| bool | IsInitialized () const |
| Check if the object has been initialized. | |
| void | UnidirectionalAggregateObject (Ptr< Object > other) |
| Aggregate an Object to another Object. | |
| Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Default constructor. | |
| uint32_t | GetReferenceCount () const |
| Get the reference count of the object. | |
| SimpleRefCount & | operator= (const SimpleRefCount &o) |
| Assignment operator. | |
| void | Ref () const |
| Increment the reference count. | |
| void | Unref () const |
| Decrement the reference count. | |
| Public Member Functions inherited from ns3::ObjectBase | |
| virtual | ~ObjectBase () |
| Virtual destructor. | |
| void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
| Get the value of an attribute, raising fatal errors if unsuccessful. | |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
| Get the value of an attribute without raising errors. | |
| void | SetAttribute (std::string name, const AttributeValue &value) |
| Set a single attribute, raising fatal errors if unsuccessful. | |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
| Set a single attribute without raising errors. | |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
| Connect a TraceSource to a Callback with a context. | |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
| Connect a TraceSource to a Callback without a context. | |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected with a context. | |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
| static Time | GetTimeOnAir (uint32_t phyPayloadLen, const LoraTxParameters &txParams) |
| Compute the total transmission time for a physical packet based on modulation parameters. | |
| static Time | GetTSym (uint8_t spreadingFactor, uint32_t bandwidthHz) |
| Compute the symbol time from spreading factor and bandwidth. | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
Protected Attributes | |
| Ptr< LoraChannel > | m_channel |
| The channel this PHY transmits on. | |
| Ptr< NetDevice > | m_device |
| The net device this PHY is attached to. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_interferedPacket |
| The trace source fired when a packet cannot be correctly received because of interference. | |
| LoraInterferenceHelper | m_interference |
| The LoraInterferenceHelper associated to this PHY. | |
| TracedCallback< Ptr< const Packet > > | m_phyRxBeginTrace |
| The trace source fired when a packet begins the reception process from the medium. | |
| TracedCallback< Ptr< const Packet > > | m_phyRxEndTrace |
| The trace source fired when a packet reception ends. | |
| RxFailedCallback | m_rxFailedCallback |
| The callback to perform upon failed reception of a packet we were locked on. | |
| RxOkCallback | m_rxOkCallback |
| The callback to perform upon correct reception of a packet. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_startSending |
| The trace source fired when a packet is sent. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_successfullyReceivedPacket |
| The trace source fired when a packet was correctly received. | |
| TxFinishedCallback | m_txFinishedCallback |
| The callback to perform upon the end of a transmission. | |
| TracedCallback< Ptr< const Packet >, uint32_t > | m_underSensitivity |
| The trace source fired when a packet cannot be received because its power is below the sensitivity threshold. | |
Private Member Functions | |
| virtual void | EndReceive (Ptr< Packet > packet, Ptr< LoraInterferenceHelper::Event > event)=0 |
| Finish reception of a packet. | |
| virtual void | TxFinished (Ptr< const Packet > packet)=0 |
| Internal call when transmission of a packet finishes. | |
Private Attributes | |
| Ptr< MobilityModel > | m_mobility |
| The mobility model associated to this PHY. | |
Additional Inherited Members | |
| Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| Copy an Object. | |
| virtual void | DoDispose () |
| Destructor implementation. | |
| virtual void | DoInitialize () |
| Initialize() implementation. | |
| virtual void | NotifyNewAggregate () |
| Notify all Objects aggregated to this one of a new Object being aggregated. | |
| Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) |
| Complete construction of ObjectBase; invoked by derived classes. | |
| virtual void | NotifyConstructionCompleted () |
| Notifier called once the ObjectBase is fully constructed. | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Base class for PHY layers implementing the LoRa modulation scheme.
This class features common callbacks and defines the interfaces that are used to send and receive packets at the PHY layer. Furthermore, it features an implementation of the GetTimeOnAir function, used to compute the actual duration of a packet based on a series of parameters that are collected in LoraTxParameters objects.
Definition at line 101 of file lora-phy.h.
| typedef Callback<void, Ptr<const Packet> > ns3::lorawan::LoraPhy::RxFailedCallback |
Type definition for a callback for when a packet reception fails.
This callback can be set by an upper layer that wishes to be informed of failed reception events.
Definition at line 118 of file lora-phy.h.
| typedef Callback<void, Ptr<const Packet> > ns3::lorawan::LoraPhy::RxOkCallback |
Type definition for a callback for when a packet is correctly received.
This callback can be set by an upper layer that wishes to be informed of correct reception events.
Definition at line 110 of file lora-phy.h.
| typedef Callback<void, Ptr<const Packet> > ns3::lorawan::LoraPhy::TxFinishedCallback |
Type definition for a callback to call when a packet has finished sending.
This callback is used by the MAC layer, to determine when to open a receive window.
Definition at line 126 of file lora-phy.h.
| ns3::lorawan::LoraPhy::LoraPhy | ( | ) |
Default constructor.
Definition at line 199 of file lora-phy.cc.
Referenced by ns3::lorawan::EndDeviceLoraPhy::GetTypeId(), and ns3::lorawan::GatewayLoraPhy::GetTypeId().
|
override |
Destructor.
Definition at line 203 of file lora-phy.cc.
|
privatepure virtual |
Finish reception of a packet.
This method is scheduled by StartReceive, based on the packet duration. By passing a LoraInterferenceHelper Event to this method, the class will be able to identify the packet that is being received among all those that were registered as interference by StartReceive.
| Packet | The received packet. |
| event | The event tied to this packet in the LoraInterferenceHelper. |
Implemented in ns3::lorawan::EndDeviceLoraPhy, ns3::lorawan::GatewayLoraPhy, ns3::lorawan::SimpleEndDeviceLoraPhy, and ns3::lorawan::SimpleGatewayLoraPhy.
| Ptr< LoraChannel > ns3::lorawan::LoraPhy::GetChannel | ( | ) | const |
Get the channel instance associated to this PHY.
Definition at line 243 of file lora-phy.cc.
References m_channel, and NS_LOG_FUNCTION_NOARGS.
Get the NetDevice associated to this PHY.
Definition at line 259 of file lora-phy.cc.
References m_device.
| Ptr< MobilityModel > ns3::lorawan::LoraPhy::GetMobility | ( | ) |
Get the mobility model associated to this PHY.
Definition at line 226 of file lora-phy.cc.
References m_device, m_mobility, and NS_LOG_FUNCTION_NOARGS.
|
static |
Compute the total transmission time for a physical packet based on modulation parameters.
Besides from the ones saved in LoraTxParameters, the packet's payload (obtained through a Packet::GetSize() call to account for the presence of Headers and Trailers) also influences the packet transmit time.
| phyPayloadLen | The total number of Bytes that need to be transmitted. |
| txParams | The set of parameters that will be used for transmission. |
Definition at line 110 of file lora-phy.cc.
References ns3::lorawan::LoraTxParameters::bandwidthHz, ns3::lorawan::LoraTxParameters::codingRate, ns3::lorawan::LoraTxParameters::crcEnabled, ns3::Time::GetSeconds(), GetTSym(), ns3::lorawan::LoraTxParameters::implicitHeader, ns3::lorawan::LoraTxParameters::lowDataRateOptimize, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::lorawan::LoraTxParameters::preambleLenSymb, ns3::Seconds(), and ns3::lorawan::LoraTxParameters::spreadingFactor.
Referenced by TimeOnAirTest::DoRun(), ns3::lorawan::GatewayLorawanMac::Send(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), and ns3::lorawan::ClassAEndDeviceLorawanMac::SendToPhy().
Compute the symbol time from spreading factor and bandwidth.
| spreadingFactor | The spreading factor. |
| bandwidthHz | The bandwidth in Hz. |
Definition at line 102 of file lora-phy.cc.
References ns3::Seconds().
Referenced by GetTimeOnAir(), and ns3::lorawan::EndDeviceLoraPhy::RequestRxSingleMode().
|
static |
Register this type.
Definition at line 157 of file lora-phy.cc.
References ns3::Object::Object(), m_interferedPacket, m_phyRxBeginTrace, m_phyRxEndTrace, m_startSending, m_successfullyReceivedPacket, m_underSensitivity, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
|
pure virtual |
Whether this device is listening on the specified frequency or not.
| frequencyHz | The frequency [Hz] to query. |
Implemented in ns3::lorawan::EndDeviceLoraPhy, and ns3::lorawan::GatewayLoraPhy.
|
pure virtual |
Whether this device is transmitting or not.
Implemented in ns3::lorawan::EndDeviceLoraPhy, and ns3::lorawan::GatewayLoraPhy.
|
pure virtual |
Instruct the PHY to send a packet according to some parameters.
| Packet | The packet to send. |
| frequencyHz | The frequency on which to transmit. |
| iqPolarity | The transmission's I/Q polarity (uplink or downlink). |
| txParams | The desired transmission parameters. |
| txPowerDbm | The power in dBm with which to transmit the packet. |
Implemented in ns3::lorawan::EndDeviceLoraPhy, ns3::lorawan::GatewayLoraPhy, ns3::lorawan::SimpleEndDeviceLoraPhy, and ns3::lorawan::SimpleGatewayLoraPhy.
| void ns3::lorawan::LoraPhy::SetChannel | ( | Ptr< LoraChannel > | channel | ) |
Set the LoraChannel instance PHY transmits on.
Typically, there is only one instance per simulation.
| Channel | The LoraChannel instance this PHY will transmit on. |
Definition at line 251 of file lora-phy.cc.
References m_channel, and NS_LOG_FUNCTION.
Set the NetDevice that owns this PHY.
| device | The NetDevice this PHY will reference as its owner. |
Definition at line 265 of file lora-phy.cc.
References m_device, and NS_LOG_FUNCTION.
| void ns3::lorawan::LoraPhy::SetMobility | ( | Ptr< MobilityModel > | mobility | ) |
Set the mobility model associated to this PHY.
| Mobility | The mobility model to associate to this PHY. |
Definition at line 235 of file lora-phy.cc.
References m_mobility, and NS_LOG_FUNCTION_NOARGS.
| void ns3::lorawan::LoraPhy::SetReceiveFailedCallback | ( | RxFailedCallback | callback | ) |
Set the callback to call upon failed reception of a packet we were previously locked on.
This method is typically called by an upper MAC layer that wants to be notified after the failed reception of a packet.
| Callbacks | The RxFailedCallback instance. |
Definition at line 220 of file lora-phy.cc.
References m_rxFailedCallback.
| void ns3::lorawan::LoraPhy::SetReceiveOkCallback | ( | RxOkCallback | callback | ) |
Set the callback to call upon successful reception of a packet.
This method is typically called by an upper MAC layer that wants to be notified after the successful reception of a packet.
| Callbacks | The RxOkCallback instance. |
Definition at line 214 of file lora-phy.cc.
References m_rxOkCallback.
| void ns3::lorawan::LoraPhy::SetTxFinishedCallback | ( | TxFinishedCallback | callback | ) |
Set the callback to call after transmission of a packet.
This method is typically called by an upper MAC layer that wants to be notified after the transmission of a packet.
| Callbacks | The TxFinishedCallback instance. |
Definition at line 208 of file lora-phy.cc.
References m_txFinishedCallback.
|
pure virtual |
Start receiving a packet.
This method is typically called by LoraChannel.
| Packet | The packet that is arriving at this PHY layer. |
| frequencyHz | The frequency this packet is being transmitted on. |
| iqPolarity | The transmission's I/Q polarity (uplink or downlink). |
| spreadingFactor | The Spreading Factor of the arriving packet. |
| rxPowerDbm | The power of the arriving packet (assumed to be constant for the whole reception). |
| duration | The on air time of this packet. |
Implemented in ns3::lorawan::EndDeviceLoraPhy, ns3::lorawan::GatewayLoraPhy, ns3::lorawan::SimpleEndDeviceLoraPhy, and ns3::lorawan::SimpleGatewayLoraPhy.
Internal call when transmission of a packet finishes.
Calls to this function are typically scheduled by the Send function.
| Packet | A pointer to the packet that has been transmitted. |
Implemented in ns3::lorawan::EndDeviceLoraPhy, and ns3::lorawan::GatewayLoraPhy.
|
protected |
The channel this PHY transmits on.
Definition at line 308 of file lora-phy.h.
Referenced by GetChannel(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), and SetChannel().
The net device this PHY is attached to.
Definition at line 306 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), GetDevice(), GetMobility(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), SetDevice(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().
|
protected |
The trace source fired when a packet cannot be correctly received because of interference.
Definition at line 345 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), and GetTypeId().
|
protected |
The LoraInterferenceHelper associated to this PHY.
Definition at line 310 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().
|
private |
The mobility model associated to this PHY.
Definition at line 370 of file lora-phy.h.
Referenced by GetMobility(), and SetMobility().
|
protected |
The trace source fired when a packet begins the reception process from the medium.
Definition at line 323 of file lora-phy.h.
Referenced by GetTypeId(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().
|
protected |
The trace source fired when a packet reception ends.
Definition at line 328 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), and GetTypeId().
|
protected |
The callback to perform upon failed reception of a packet we were locked on.
Definition at line 302 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), and SetReceiveFailedCallback().
|
protected |
The callback to perform upon correct reception of a packet.
Definition at line 297 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), and SetReceiveOkCallback().
|
protected |
The trace source fired when a packet is sent.
Definition at line 317 of file lora-phy.h.
Referenced by GetTypeId(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), and ns3::lorawan::SimpleGatewayLoraPhy::Send().
|
protected |
The trace source fired when a packet was correctly received.
Definition at line 333 of file lora-phy.h.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), and GetTypeId().
|
protected |
The callback to perform upon the end of a transmission.
Definition at line 292 of file lora-phy.h.
Referenced by SetTxFinishedCallback(), and ns3::lorawan::EndDeviceLoraPhy::TxFinished().
|
protected |
The trace source fired when a packet cannot be received because its power is below the sensitivity threshold.
Definition at line 339 of file lora-phy.h.
Referenced by GetTypeId(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().