Helper for LoraPhy that manages interference calculations. More...
#include "lora-interference-helper.h"
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::Event > | Add (Time duration, double rxPower, uint8_t spreadingFactor, Ptr< Packet > packet, double frequencyMHz) |
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. | |
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 48 of file lora-interference-helper.h.
Enumeration of types of collision matrices.
Enumerator | |
---|---|
GOURSAUD | |
ALOHA |
Definition at line 145 of file lora-interference-helper.h.
ns3::lorawan::LoraInterferenceHelper::LoraInterferenceHelper | ( | ) |
Default constructor.
Definition at line 179 of file lora-interference-helper.cc.
References collisionMatrix, NS_LOG_FUNCTION, and SetCollisionMatrix().
|
virtual |
Ptr< LoraInterferenceHelper::Event > ns3::lorawan::LoraInterferenceHelper::Add | ( | Time | duration, |
double | rxPower, | ||
uint8_t | spreadingFactor, | ||
Ptr< Packet > | packet, | ||
double | frequencyMHz | ||
) |
Add an event to the InterferenceHelper.
duration | The duration of the packet. |
rxPower | The received power in dBm. |
spreadingFactor | The spreading factor used by the transmission. |
packet | The packet carried by this transmission. |
frequencyMHz | The frequency this event was sent at. |
Definition at line 195 of file lora-interference-helper.cc.
References CleanOldEvents(), ns3::Time::GetSeconds(), m_events, and NS_LOG_FUNCTION.
Referenced by InterferenceTest::DoRun(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::StartReceive().
void ns3::lorawan::LoraInterferenceHelper::CleanOldEvents | ( | ) |
Delete old events in this LoraInterferenceHelper.
Definition at line 225 of file lora-interference-helper.cc.
References m_events, ns3::Simulator::Now(), NS_LOG_FUNCTION, and oldEventThreshold.
Referenced by Add().
void ns3::lorawan::LoraInterferenceHelper::ClearAllEvents | ( | ) |
Delete all events in the LoraInterferenceHelper.
Definition at line 376 of file lora-interference-helper.cc.
References m_events, and NS_LOG_FUNCTION_NOARGS.
Referenced by InterferenceTest::DoRun().
std::list< Ptr< LoraInterferenceHelper::Event > > ns3::lorawan::LoraInterferenceHelper::GetInterferers | ( | ) |
Get a list of the interferers currently registered at this InterferenceHelper.
Definition at line 244 of file lora-interference-helper.cc.
References m_events.
Time ns3::lorawan::LoraInterferenceHelper::GetOverlapTime | ( | Ptr< LoraInterferenceHelper::Event > | event1, |
Ptr< LoraInterferenceHelper::Event > | event2 | ||
) |
Compute the time duration in which two given events are overlapping.
event1 | The first event. |
event2 | The second event. |
Definition at line 384 of file lora-interference-helper.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::Seconds().
Referenced by InterferenceTest::DoRun(), and IsDestroyedByInterference().
|
static |
Register this type.
Definition at line 171 of file lora-interference-helper.cc.
References ns3::TypeId::SetParent().
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.
event | The event for which to check the outcome. |
Definition at line 264 of file lora-interference-helper.cc.
References GetOverlapTime(), ns3::Time::GetSeconds(), m_collisionSnir, m_events, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by InterferenceTest::DoRun(), ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), and ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().
void ns3::lorawan::LoraInterferenceHelper::PrintEvents | ( | std::ostream & | stream | ) |
Print the events that are saved in this helper in a human readable format.
stream | The output stream. |
Definition at line 250 of file lora-interference-helper.cc.
References m_events, and NS_LOG_FUNCTION_NOARGS.
|
private |
Set the collision matrix.
collisionMatrix | The type of collision matrix to set. |
Definition at line 154 of file lora-interference-helper.cc.
References ALOHA, collisionMatrix, collisionSnirAloha, collisionSnirGoursaud, GOURSAUD, m_collisionSnir, and NS_LOG_DEBUG.
Referenced by LoraInterferenceHelper().
|
static |
Collision matrix type set by the constructor.
Definition at line 223 of file lora-interference-helper.h.
Referenced by LoraInterferenceHelper(), and SetCollisionMatrix().
|
static |
ALOHA collision matrix.
Definition at line 225 of file lora-interference-helper.h.
Referenced by SetCollisionMatrix().
|
static |
GOURSAUD collision matrix.
Definition at line 226 of file lora-interference-helper.h.
Referenced by SetCollisionMatrix().
|
private |
The matrix containing information about how packets survive interference.
Definition at line 238 of file lora-interference-helper.h.
Referenced by IsDestroyedByInterference(), and SetCollisionMatrix().
|
private |
List of the events this LoraInterferenceHelper is keeping track of.
Definition at line 241 of file lora-interference-helper.h.
Referenced by Add(), CleanOldEvents(), ClearAllEvents(), GetInterferers(), IsDestroyedByInterference(), and PrintEvents().
The threshold after which an event is considered old and removed from the list.
Definition at line 242 of file lora-interference-helper.h.
Referenced by CleanOldEvents().