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

Helper for LoraPhy that manages interference calculations. More...

#include "lora-interference-helper.h"

+ Collaboration diagram for ns3::lorawan::LoraInterferenceHelper:

Classes

class  Event
 A class representing a signal in time. More...
 

Public Types

enum  CollisionMatrix { GOURSAUD , ALOHA }
 Enumeration of types of collision matrices. More...
 

Public Member Functions

 LoraInterferenceHelper ()
 Default constructor.
 
virtual ~LoraInterferenceHelper ()
 Destructor.
 
Ptr< LoraInterferenceHelper::EventAdd (Time duration, double rxPower, uint8_t spreadingFactor, Ptr< Packet > packet, uint32_t frequencyHz)
 Add an event to the InterferenceHelper.
 
void CleanOldEvents ()
 Delete old events in this LoraInterferenceHelper.
 
void ClearAllEvents ()
 Delete all events in the LoraInterferenceHelper.
 
std::list< Ptr< LoraInterferenceHelper::Event > > GetInterferers ()
 Get a list of the interferers currently registered at this InterferenceHelper.
 
Time GetOverlapTime (Ptr< LoraInterferenceHelper::Event > event1, Ptr< LoraInterferenceHelper::Event > event2)
 Compute the time duration in which two given events are overlapping.
 
uint8_t IsDestroyedByInterference (Ptr< LoraInterferenceHelper::Event > event)
 Determine whether the event was destroyed by interference or not.
 
void PrintEvents (std::ostream &stream)
 Print the events that are saved in this helper in a human readable format.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Register this type.
 

Static Public Attributes

static CollisionMatrix collisionMatrix
 Collision matrix type set by the constructor.
 
static std::vector< std::vector< double > > collisionSnirAloha
 ALOHA collision matrix.
 
static std::vector< std::vector< double > > collisionSnirGoursaud
 GOURSAUD collision matrix.
 

Private Member Functions

void SetCollisionMatrix (enum CollisionMatrix collisionMatrix)
 Set the collision matrix.
 

Private Attributes

std::vector< std::vector< double > > m_collisionSnir
 The matrix containing information about how packets survive interference.
 
std::list< Ptr< LoraInterferenceHelper::Event > > m_events
 List of the events this LoraInterferenceHelper is keeping track of.
 

Static Private Attributes

static Time oldEventThreshold = Seconds(2)
 The threshold after which an event is considered old and removed from the list.
 

Detailed Description

Helper for LoraPhy that manages interference calculations.

This class keeps a list of signals that are impinging on the antenna of the device, in order to compute which ones can be correctly received and which ones are lost due to interference.

Definition at line 37 of file lora-interference-helper.h.

Member Enumeration Documentation

◆ CollisionMatrix

Enumeration of types of collision matrices.

Enumerator
GOURSAUD 
ALOHA 

Definition at line 134 of file lora-interference-helper.h.

Constructor & Destructor Documentation

◆ LoraInterferenceHelper()

ns3::lorawan::LoraInterferenceHelper::LoraInterferenceHelper ( )

Default constructor.

Definition at line 168 of file lora-interference-helper.cc.

References LoraInterferenceHelper(), collisionMatrix, collisionSnirGoursaud, m_collisionSnir, NS_LOG_FUNCTION, and SetCollisionMatrix().

Referenced by LoraInterferenceHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~LoraInterferenceHelper()

ns3::lorawan::LoraInterferenceHelper::~LoraInterferenceHelper ( )
virtual

Destructor.

Definition at line 176 of file lora-interference-helper.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ Add()

Ptr< LoraInterferenceHelper::Event > ns3::lorawan::LoraInterferenceHelper::Add ( Time duration,
double rxPower,
uint8_t spreadingFactor,
Ptr< Packet > packet,
uint32_t frequencyHz )

Add an event to the InterferenceHelper.

Parameters
durationThe duration of the packet.
rxPowerThe received power in dBm.
spreadingFactorThe spreading factor used by the transmission.
packetThe packet carried by this transmission.
frequencyHzThe frequency [Hz] this event was sent at.
Returns
The newly created event.

Definition at line 184 of file lora-interference-helper.cc.

References ns3::Time::As(), CleanOldEvents(), ns3::Create(), m_events, ns3::Time::MS, and NS_LOG_FUNCTION.

Referenced by InterferenceTest::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CleanOldEvents()

void ns3::lorawan::LoraInterferenceHelper::CleanOldEvents ( )

Delete old events in this LoraInterferenceHelper.

Definition at line 214 of file lora-interference-helper.cc.

References m_events, ns3::Now(), NS_LOG_FUNCTION, and oldEventThreshold.

Referenced by Add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearAllEvents()

void ns3::lorawan::LoraInterferenceHelper::ClearAllEvents ( )

Delete all events in the LoraInterferenceHelper.

Definition at line 365 of file lora-interference-helper.cc.

References m_events, and NS_LOG_FUNCTION_NOARGS.

Referenced by InterferenceTest::DoRun().

+ Here is the caller graph for this function:

◆ GetInterferers()

std::list< Ptr< LoraInterferenceHelper::Event > > ns3::lorawan::LoraInterferenceHelper::GetInterferers ( )

Get a list of the interferers currently registered at this InterferenceHelper.

Returns
The list of pointers to interference Event objects.

Definition at line 233 of file lora-interference-helper.cc.

References m_events.

◆ GetOverlapTime()

Time ns3::lorawan::LoraInterferenceHelper::GetOverlapTime ( Ptr< LoraInterferenceHelper::Event > event1,
Ptr< LoraInterferenceHelper::Event > event2 )

Compute the time duration in which two given events are overlapping.

Parameters
event1The first event.
event2The second event.
Returns
The overlap time.

Definition at line 373 of file lora-interference-helper.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by InterferenceTest::DoRun(), and IsDestroyedByInterference().

+ Here is the caller graph for this function:

◆ GetTypeId()

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

Register this type.

Returns
The object TypeId.

Definition at line 160 of file lora-interference-helper.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ IsDestroyedByInterference()

uint8_t ns3::lorawan::LoraInterferenceHelper::IsDestroyedByInterference ( Ptr< LoraInterferenceHelper::Event > event)

Determine whether the event was destroyed by interference or not.

This is the method where the SNIR tables come into play and the computations regarding power are performed.

Parameters
eventThe event for which to check the outcome.
Returns
The sf of the packets that caused the loss, or 0 if there was no loss.

Definition at line 253 of file lora-interference-helper.cc.

References ns3::Time::As(), GetOverlapTime(), ns3::Time::GetSeconds(), m_collisionSnir, m_events, ns3::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Time::S.

Referenced by InterferenceTest::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintEvents()

void ns3::lorawan::LoraInterferenceHelper::PrintEvents ( std::ostream & stream)

Print the events that are saved in this helper in a human readable format.

Parameters
streamThe output stream.

Definition at line 239 of file lora-interference-helper.cc.

References m_events, and NS_LOG_FUNCTION_NOARGS.

◆ SetCollisionMatrix()

void ns3::lorawan::LoraInterferenceHelper::SetCollisionMatrix ( enum CollisionMatrix collisionMatrix)
private

Set the collision matrix.

Parameters
collisionMatrixThe type of collision matrix to set.
Todo
Redundant, only used by constructor which also sets the matrix directly. To be removed.

Definition at line 143 of file lora-interference-helper.cc.

References ALOHA, collisionMatrix, collisionSnirAloha, collisionSnirGoursaud, GOURSAUD, m_collisionSnir, and NS_LOG_DEBUG.

Referenced by LoraInterferenceHelper().

+ Here is the caller graph for this function:

Member Data Documentation

◆ collisionMatrix

LoraInterferenceHelper::CollisionMatrix ns3::lorawan::LoraInterferenceHelper::collisionMatrix
static
Initial value:

Collision matrix type set by the constructor.

Definition at line 212 of file lora-interference-helper.h.

Referenced by LoraInterferenceHelper(), and SetCollisionMatrix().

◆ collisionSnirAloha

std::vector< std::vector< double > > ns3::lorawan::LoraInterferenceHelper::collisionSnirAloha
static
Initial value:
= {
{inf, -inf, -inf, -inf, -inf, -inf},
{-inf, inf, -inf, -inf, -inf, -inf},
{-inf, -inf, inf, -inf, -inf, -inf},
{-inf, -inf, -inf, inf, -inf, -inf},
{-inf, -inf, -inf, -inf, inf, -inf},
{-inf, -inf, -inf, -inf, -inf, inf}
}

ALOHA collision matrix.

Definition at line 214 of file lora-interference-helper.h.

Referenced by SetCollisionMatrix().

◆ collisionSnirGoursaud

std::vector< std::vector< double > > ns3::lorawan::LoraInterferenceHelper::collisionSnirGoursaud
static
Initial value:
= {
{6, -16, -18, -19, -19, -20},
{-24, 6, -20, -22, -22, -22},
{-27, -27, 6, -23, -25, -25},
{-30, -30, -30, 6, -26, -28},
{-33, -33, -33, -33, 6, -29},
{-36, -36, -36, -36, -36, 6}
}

GOURSAUD collision matrix.

Definition at line 215 of file lora-interference-helper.h.

Referenced by LoraInterferenceHelper(), and SetCollisionMatrix().

◆ m_collisionSnir

std::vector<std::vector<double> > ns3::lorawan::LoraInterferenceHelper::m_collisionSnir
private

The matrix containing information about how packets survive interference.

Definition at line 227 of file lora-interference-helper.h.

Referenced by LoraInterferenceHelper(), IsDestroyedByInterference(), and SetCollisionMatrix().

◆ m_events

std::list<Ptr<LoraInterferenceHelper::Event> > ns3::lorawan::LoraInterferenceHelper::m_events
private

List of the events this LoraInterferenceHelper is keeping track of.

Definition at line 230 of file lora-interference-helper.h.

Referenced by Add(), CleanOldEvents(), ClearAllEvents(), GetInterferers(), IsDestroyedByInterference(), and PrintEvents().

◆ oldEventThreshold

Time ns3::lorawan::LoraInterferenceHelper::oldEventThreshold = Seconds(2)
staticprivate

The threshold after which an event is considered old and removed from the list.

Definition at line 231 of file lora-interference-helper.h.

Referenced by CleanOldEvents().


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