A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::lorawan::GatewayLoraPhy Class Referenceabstract

Class modeling a Lora SX1301 chip. More...

#include "gateway-lora-phy.h"

+ Inheritance diagram for ns3::lorawan::GatewayLoraPhy:
+ Collaboration diagram for ns3::lorawan::GatewayLoraPhy:

Classes

class  ReceptionPath
 This class represents a configurable reception path. More...
 

Public Member Functions

 GatewayLoraPhy ()
 Default constructor.
 
 ~GatewayLoraPhy () override
 Destructor.
 
void AddFrequency (double frequencyMHz)
 Add a frequency to the list of frequencies we are listening to.
 
void AddReceptionPath ()
 Add a reception path, locked on a specific frequency.
 
void EndReceive (Ptr< Packet > packet, Ptr< LoraInterferenceHelper::Event > event) override=0
 Finish reception of a packet.
 
bool IsOnFrequency (double frequencyMHz) override
 Check whether the GatewayLoraPhy is currently listening to the specified frequency.
 
bool IsTransmitting () override
 Whether this device is transmitting or not.
 
void ResetReceptionPaths ()
 Reset the list of reception paths.
 
void Send (Ptr< Packet > packet, LoraTxParameters txParams, double frequencyMHz, double txPowerDbm) override=0
 Instruct the PHY to send a packet according to some parameters.
 
void StartReceive (Ptr< Packet > packet, double rxPowerDbm, uint8_t sf, Time duration, double frequencyMHz) override=0
 Start receiving a packet.
 
- Public Member Functions inherited from ns3::lorawan::LoraPhy
 LoraPhy ()
 Default constructor.
 
 ~LoraPhy () override
 Destructor.
 
virtual void EndReceive (Ptr< Packet > packet, Ptr< LoraInterferenceHelper::Event > event)=0
 Finish reception of a packet.
 
Ptr< LoraChannelGetChannel () const
 Get the channel instance associated to this PHY.
 
Ptr< NetDeviceGetDevice () const
 Get the NetDevice associated to this PHY.
 
Ptr< MobilityModelGetMobility ()
 Get the mobility model associated to this PHY.
 
virtual bool IsOnFrequency (double frequency)=0
 Whether this device is listening on the specified frequency or not.
 
virtual bool IsTransmitting ()=0
 Whether this device is transmitting or not.
 
virtual void Send (Ptr< Packet > packet, LoraTxParameters txParams, double frequencyMHz, 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, double rxPowerDbm, uint8_t sf, Time duration, double frequencyMHz)=0
 Start receiving a packet.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~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 override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () 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.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
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.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (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) 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.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
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 TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::lorawan::LoraPhy
static Time GetOnAirTime (Ptr< Packet > packet, LoraTxParameters txParams)
 Compute the time that a packet with certain characteristics will take to be transmitted.
 
static Time GetTSym (LoraTxParameters txParams)
 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.
 

Static Public Attributes

static const double sensitivity [6] = {-130.0, -132.5, -135.0, -137.5, -140.0, -142.5}
 A vector containing the sensitivities required to correctly decode different spreading factors.
 

Protected Member Functions

void TxFinished (Ptr< const Packet > packet) override
 Signals the end of a transmission by the GatewayLoraPhy.
 
- 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.
 

Protected Attributes

std::list< doublem_frequencies
 List of frequencies the GatewayLoraPhy is listening to.
 
bool m_isTransmitting
 Flag indicating whether a transmission is going on.
 
TracedCallback< Ptr< const Packet >, uint32_tm_noMoreDemodulators
 Trace source fired when a packet cannot be received because all available ReceivePath instances are busy.
 
TracedCallback< Ptr< const Packet >, uint32_tm_noReceptionBecauseTransmitting
 Trace source fired when a packet cannot be received because the gateway is in transmission state.
 
TracedValue< int > m_occupiedReceptionPaths
 The number of occupied reception paths.
 
std::list< Ptr< ReceptionPath > > m_receptionPaths
 A list containing the various parallel receivers that are managed by this gateway.
 
- Protected Attributes inherited from ns3::lorawan::LoraPhy
Ptr< LoraChannelm_channel
 The channel this PHY transmits on.
 
Ptr< NetDevicem_device
 The net device this PHY is attached to.
 
TracedCallback< Ptr< const Packet >, uint32_tm_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_tm_startSending
 The trace source fired when a packet is sent.
 
TracedCallback< Ptr< const Packet >, uint32_tm_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_tm_underSensitivity
 The trace source fired when a packet cannot be received because its power is below the sensitivity threshold.
 

Additional Inherited Members

- Public Types inherited from ns3::lorawan::LoraPhy
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.
 

Detailed Description

Class modeling a Lora SX1301 chip.

This class models the behaviour of the chip employed in Lora gateways. These chips are characterized by the presence of 8 receive paths, or parallel receivers, which can be employed to listen to different channels simultaneously. This characteristic of the chip is modeled using the ReceivePath class, which describes a single parallel receiver. GatewayLoraPhy essentially holds and manages a collection of these objects.

Definition at line 53 of file gateway-lora-phy.h.

Constructor & Destructor Documentation

◆ GatewayLoraPhy()

ns3::lorawan::GatewayLoraPhy::GatewayLoraPhy ( )

Default constructor.

Definition at line 129 of file gateway-lora-phy.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ ~GatewayLoraPhy()

ns3::lorawan::GatewayLoraPhy::~GatewayLoraPhy ( )
override

Destructor.

Definition at line 135 of file gateway-lora-phy.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ AddFrequency()

void ns3::lorawan::GatewayLoraPhy::AddFrequency ( double  frequencyMHz)

Add a frequency to the list of frequencies we are listening to.

Parameters
frequencyMHzThe value of the frequency [MHz].

Definition at line 173 of file gateway-lora-phy.cc.

References m_frequencies, NS_ASSERT, and NS_LOG_FUNCTION.

◆ AddReceptionPath()

void ns3::lorawan::GatewayLoraPhy::AddReceptionPath ( )

Add a reception path, locked on a specific frequency.

Definition at line 145 of file gateway-lora-phy.cc.

References m_receptionPaths, and NS_LOG_FUNCTION_NOARGS.

◆ EndReceive()

void ns3::lorawan::GatewayLoraPhy::EndReceive ( Ptr< Packet packet,
Ptr< LoraInterferenceHelper::Event event 
)
overridepure 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.

Parameters
packetThe received packet.
eventThe event that is tied to this packet in the LoraInterferenceHelper.

Implements ns3::lorawan::LoraPhy.

Implemented in ns3::lorawan::SimpleGatewayLoraPhy.

◆ GetTypeId()

TypeId ns3::lorawan::GatewayLoraPhy::GetTypeId ( )
static

Register this type.

Returns
The object TypeId.

Definition at line 103 of file gateway-lora-phy.cc.

References m_noMoreDemodulators, m_noReceptionBecauseTransmitting, m_occupiedReceptionPaths, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ IsOnFrequency()

bool ns3::lorawan::GatewayLoraPhy::IsOnFrequency ( double  frequencyMHz)
overridevirtual

Check whether the GatewayLoraPhy is currently listening to the specified frequency.

Parameters
frequencyMHzThe value of the frequency [MHz].
Returns
True if the frequency is among the one being listened to, false otherwise.

Implements ns3::lorawan::LoraPhy.

Definition at line 183 of file gateway-lora-phy.cc.

References m_frequencies, and NS_LOG_FUNCTION.

◆ IsTransmitting()

bool ns3::lorawan::GatewayLoraPhy::IsTransmitting ( )
overridevirtual

Whether this device is transmitting or not.

Returns
True if the device is currently transmitting a packet, false otherwise.

Implements ns3::lorawan::LoraPhy.

Definition at line 167 of file gateway-lora-phy.cc.

References m_isTransmitting.

◆ ResetReceptionPaths()

void ns3::lorawan::GatewayLoraPhy::ResetReceptionPaths ( )

Reset the list of reception paths.

This method deletes all currently available ReceptionPath objects.

Definition at line 153 of file gateway-lora-phy.cc.

References m_receptionPaths, and NS_LOG_FUNCTION.

◆ Send()

void ns3::lorawan::GatewayLoraPhy::Send ( Ptr< Packet packet,
LoraTxParameters  txParams,
double  frequencyMHz,
double  txPowerDbm 
)
overridepure virtual

Instruct the PHY to send a packet according to some parameters.

Parameters
packetThe packet to send.
txParamsThe desired transmission parameters.
frequencyMHzThe frequency on which to transmit.
txPowerDbmThe power in dBm with which to transmit the packet.

Implements ns3::lorawan::LoraPhy.

Implemented in ns3::lorawan::SimpleGatewayLoraPhy.

◆ StartReceive()

void ns3::lorawan::GatewayLoraPhy::StartReceive ( Ptr< Packet packet,
double  rxPowerDbm,
uint8_t  sf,
Time  duration,
double  frequencyMHz 
)
overridepure virtual

Start receiving a packet.

This method is typically called by LoraChannel.

Parameters
packetThe packet that is arriving at this PHY layer.
rxPowerDbmThe power of the arriving packet (assumed to be constant for the whole reception).
sfThe Spreading Factor of the arriving packet.
durationThe on air time of this packet.
frequencyMHzThe frequency this packet is being transmitted on.

Implements ns3::lorawan::LoraPhy.

Implemented in ns3::lorawan::SimpleGatewayLoraPhy.

◆ TxFinished()

void ns3::lorawan::GatewayLoraPhy::TxFinished ( Ptr< const Packet packet)
overrideprotectedvirtual

Signals the end of a transmission by the GatewayLoraPhy.

Parameters
packetA pointer to the Packet transmitted.

Implements ns3::lorawan::LoraPhy.

Definition at line 161 of file gateway-lora-phy.cc.

References m_isTransmitting.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::Send().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_frequencies

std::list<double> ns3::lorawan::GatewayLoraPhy::m_frequencies
protected

List of frequencies the GatewayLoraPhy is listening to.

Definition at line 216 of file gateway-lora-phy.h.

Referenced by AddFrequency(), and IsOnFrequency().

◆ m_isTransmitting

bool ns3::lorawan::GatewayLoraPhy::m_isTransmitting
protected

Flag indicating whether a transmission is going on.

Definition at line 214 of file gateway-lora-phy.h.

Referenced by IsTransmitting(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), ns3::lorawan::SimpleGatewayLoraPhy::StartReceive(), and TxFinished().

◆ m_noMoreDemodulators

TracedCallback<Ptr<const Packet>, uint32_t> ns3::lorawan::GatewayLoraPhy::m_noMoreDemodulators
protected

Trace source fired when a packet cannot be received because all available ReceivePath instances are busy.

Definition at line 206 of file gateway-lora-phy.h.

Referenced by GetTypeId(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().

◆ m_noReceptionBecauseTransmitting

TracedCallback<Ptr<const Packet>, uint32_t> ns3::lorawan::GatewayLoraPhy::m_noReceptionBecauseTransmitting
protected

Trace source fired when a packet cannot be received because the gateway is in transmission state.

Definition at line 212 of file gateway-lora-phy.h.

Referenced by GetTypeId(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().

◆ m_occupiedReceptionPaths

TracedValue<int> ns3::lorawan::GatewayLoraPhy::m_occupiedReceptionPaths
protected

The number of occupied reception paths.

Definition at line 200 of file gateway-lora-phy.h.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), GetTypeId(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().

◆ m_receptionPaths

std::list<Ptr<ReceptionPath> > ns3::lorawan::GatewayLoraPhy::m_receptionPaths
protected

A list containing the various parallel receivers that are managed by this gateway.

Definition at line 197 of file gateway-lora-phy.h.

Referenced by AddReceptionPath(), ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), ResetReceptionPaths(), ns3::lorawan::SimpleGatewayLoraPhy::Send(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().

◆ sensitivity

const double ns3::lorawan::GatewayLoraPhy::sensitivity = {-130.0, -132.5, -135.0, -137.5, -140.0, -142.5}
static

A vector containing the sensitivities required to correctly decode different spreading factors.

Definition at line 107 of file gateway-lora-phy.h.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().


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