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

Tracks and stores packets sent in the simulation and provides aggregation functionality. More...

#include "lora-packet-tracker.h"

+ Collaboration diagram for ns3::lorawan::LoraPacketTracker:

Public Member Functions

 LoraPacketTracker ()
 Default constructor.
 
 ~LoraPacketTracker ()
 Destructor.
 
std::string CountMacPacketsGlobally (Time startTime, Time stopTime)
 In a time interval, count packets to evaluate the global performance at MAC level of the whole network.
 
std::string CountMacPacketsGloballyCpsr (Time startTime, Time stopTime)
 In a time interval, count packets to evaluate the performance at MAC level of the whole network.
 
std::string CountMacPacketsPerGw (Time startTime, Time stopTime, int systemId)
 Count packets in a time interval to evaluate the performance at MAC level of a specific gateway.
 
std::vector< int > CountPhyPacketsPerGw (Time startTime, Time stopTime, int systemId)
 Count packets in a time interval to evaluate the performance at PHY level of a specific gateway.
 
std::string CountRetransmissions (Time startTime, Time stopTime)
 In a time interval, count the number of retransmissions that were needed to correctly deliver a packet and receive the corresponding acknowledgment.
 
void InterferenceCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a gateway packet loss caused by interference.
 
bool IsUplink (Ptr< const Packet > packet)
 Check whether a packet is uplink.
 
void LostBecauseTxCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a gateway packet loss caused by concurrent downlink transmission.
 
void MacGwReceptionCallback (Ptr< const Packet > packet)
 Trace a packet leaving a gateway's MAC layer to go up the stack and be delivered to the node's application.
 
void MacTransmissionCallback (Ptr< const Packet > packet)
 Trace a packet leaving a node's MAC layer to go down the stack and be sent by the PHY layer.
 
void NoMoreReceiversCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a gateway packet loss caused by lack of free reception paths.
 
void PacketReceptionCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a correct packet RX by the PHY layer of a gateway.
 
std::string PrintMacPacketsPerGw (Time startTime, Time stopTime, int systemId)
 Count packets in a time interval to evaluate the performance at MAC level of a specific gateway.
 
std::string PrintPhyPacketsPerGw (Time startTime, Time stopTime, int systemId)
 Count packets in a time interval to evaluate the performance at PHY level of a specific gateway.
 
void RequiredTransmissionsCallback (uint8_t reqTx, bool success, Time firstAttempt, Ptr< Packet > packet)
 Trace the exit status of a MAC layer packet retransmission process of an end device.
 
void TransmissionCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a packet TX start by the PHY layer of an end device.
 
void UnderSensitivityCallback (Ptr< const Packet > packet, uint32_t systemId)
 Trace a gateway packet loss caused by signal strength under sensitivity.
 

Private Attributes

MacPacketData m_macPacketTracker
 Packet map of MAC layer metrics.
 
PhyPacketData m_packetTracker
 Packet map of PHY layer metrics.
 
RetransmissionData m_reTransmissionTracker
 Packet map of retransmission process metrics.
 

Detailed Description

Tracks and stores packets sent in the simulation and provides aggregation functionality.

Definition at line 98 of file lora-packet-tracker.h.

Constructor & Destructor Documentation

◆ LoraPacketTracker()

ns3::lorawan::LoraPacketTracker::LoraPacketTracker ( )

Default constructor.

Definition at line 35 of file lora-packet-tracker.cc.

References NS_LOG_FUNCTION.

◆ ~LoraPacketTracker()

ns3::lorawan::LoraPacketTracker::~LoraPacketTracker ( )

Destructor.

Definition at line 40 of file lora-packet-tracker.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ CountMacPacketsGlobally()

std::string ns3::lorawan::LoraPacketTracker::CountMacPacketsGlobally ( Time  startTime,
Time  stopTime 
)

In a time interval, count packets to evaluate the global performance at MAC level of the whole network.

In this case, a MAC layer packet is labeled as successful if it was successful at at least one of the available gateways.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
Returns
Space-separated string containing two metrics: the number of sent packets and the number of packets that were received by at least one gateway.

Definition at line 324 of file lora-packet-tracker.cc.

References m_macPacketTracker, NS_LOG_FUNCTION, and stopTime.

Referenced by ns3::lorawan::LoraHelper::DoPrintGlobalPerformance().

+ Here is the caller graph for this function:

◆ CountMacPacketsGloballyCpsr()

std::string ns3::lorawan::LoraPacketTracker::CountMacPacketsGloballyCpsr ( Time  startTime,
Time  stopTime 
)

In a time interval, count packets to evaluate the performance at MAC level of the whole network.

In this case, a MAC layer packet is labeled as successful if it was successful at at least one of the available gateways, and if the corresponding acknowledgment was correctly delivered at the device.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
Returns
Space-separated string containing two metrics: the number of sent packets and the number of packets that generated a successful acknowledgment.

Definition at line 346 of file lora-packet-tracker.cc.

References m_reTransmissionTracker, NS_LOG_DEBUG, NS_LOG_FUNCTION, and stopTime.

◆ CountMacPacketsPerGw()

std::string ns3::lorawan::LoraPacketTracker::CountMacPacketsPerGw ( Time  startTime,
Time  stopTime,
int  systemId 
)

Count packets in a time interval to evaluate the performance at MAC level of a specific gateway.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
systemIdNode id of the gateway.
Returns
String of output values.
Todo:
Not implemented, this is a placeholder for future implementation.

◆ CountPhyPacketsPerGw()

std::vector< int > ns3::lorawan::LoraPacketTracker::CountPhyPacketsPerGw ( Time  startTime,
Time  stopTime,
int  systemId 
)

Count packets in a time interval to evaluate the performance at PHY level of a specific gateway.

It counts the total number of uplink packets sent over the radio medium, and - from the perspective of the specified gateway - the number of such packets correctly received, lost to interference, lost to unavailability of the gateway's reception paths, lost for being under the RSSI sensitivity threshold, and lost due to concurrent downlink transmission of the gateway.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
systemIdNode id of the gateway.
Returns
A vector comprised of the following fields: [totPacketsSent, receivedPackets, interferedPackets, noMoreGwPackets, underSensitivityPackets, lostBecauseTxPackets].

Definition at line 210 of file lora-packet-tracker.cc.

References ns3::lorawan::INTERFERED, ns3::lorawan::LOST_BECAUSE_TX, m_packetTracker, ns3::lorawan::NO_MORE_RECEIVERS, NS_LOG_DEBUG, ns3::lorawan::RECEIVED, stopTime, ns3::lorawan::UNDER_SENSITIVITY, and ns3::lorawan::UNSET.

◆ CountRetransmissions()

std::string ns3::lorawan::LoraPacketTracker::CountRetransmissions ( Time  startTime,
Time  stopTime 
)

In a time interval, count the number of retransmissions that were needed to correctly deliver a packet and receive the corresponding acknowledgment.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
Returns
String of output values.
Todo:
Not implemented, this is a placeholder for future implementation.

◆ InterferenceCallback()

void ns3::lorawan::LoraPacketTracker::InterferenceCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a gateway packet loss caused by interference.

Parameters
packetThe packet being lost.
systemIdId of the gateway losing the packet.

Definition at line 141 of file lora-packet-tracker.cc.

References ns3::lorawan::INTERFERED, IsUplink(), m_packetTracker, and NS_LOG_INFO.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ IsUplink()

bool ns3::lorawan::LoraPacketTracker::IsUplink ( Ptr< const Packet packet)

Check whether a packet is uplink.

Parameters
packetThe packet to be checked.
Returns
True if the packet is uplink, false otherwise.

Definition at line 195 of file lora-packet-tracker.cc.

References ns3::lorawan::LorawanMacHeader::IsUplink(), and NS_LOG_FUNCTION.

Referenced by InterferenceCallback(), LostBecauseTxCallback(), MacGwReceptionCallback(), MacTransmissionCallback(), NoMoreReceiversCallback(), PacketReceptionCallback(), TransmissionCallback(), and UnderSensitivityCallback().

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

◆ LostBecauseTxCallback()

void ns3::lorawan::LoraPacketTracker::LostBecauseTxCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a gateway packet loss caused by concurrent downlink transmission.

Parameters
packetThe packet being lost.
systemIdId of the gateway losing the packet.

Definition at line 180 of file lora-packet-tracker.cc.

References IsUplink(), ns3::lorawan::LOST_BECAUSE_TX, m_packetTracker, and NS_LOG_INFO.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ MacGwReceptionCallback()

void ns3::lorawan::LoraPacketTracker::MacGwReceptionCallback ( Ptr< const Packet packet)

Trace a packet leaving a gateway's MAC layer to go up the stack and be delivered to the node's application.

Parameters
packetThe packet being received.

Definition at line 86 of file lora-packet-tracker.cc.

References ns3::Simulator::GetContext(), IsUplink(), m_macPacketTracker, ns3::Simulator::Now(), NS_ABORT_MSG, and NS_LOG_INFO.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ MacTransmissionCallback()

void ns3::lorawan::LoraPacketTracker::MacTransmissionCallback ( Ptr< const Packet packet)

Trace a packet leaving a node's MAC layer to go down the stack and be sent by the PHY layer.

Remarks
This trace sink is normally connected to both end devices and gateways.
Parameters
packetThe packet being sent.

Definition at line 50 of file lora-packet-tracker.cc.

References ns3::Simulator::GetContext(), IsUplink(), m_macPacketTracker, ns3::Time::Max(), ns3::Simulator::Now(), NS_LOG_INFO, ns3::lorawan::MacPacketStatus::packet, ns3::lorawan::MacPacketStatus::receivedTime, ns3::lorawan::MacPacketStatus::senderId, and ns3::lorawan::MacPacketStatus::sendTime.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ NoMoreReceiversCallback()

void ns3::lorawan::LoraPacketTracker::NoMoreReceiversCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a gateway packet loss caused by lack of free reception paths.

Parameters
packetThe packet being lost.
systemIdId of the gateway losing the packet.

Definition at line 153 of file lora-packet-tracker.cc.

References IsUplink(), m_packetTracker, ns3::lorawan::NO_MORE_RECEIVERS, and NS_LOG_INFO.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ PacketReceptionCallback()

void ns3::lorawan::LoraPacketTracker::PacketReceptionCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a correct packet RX by the PHY layer of a gateway.

Parameters
packetThe packet being received.
systemIdId of the gateway receiving the packet.

Definition at line 128 of file lora-packet-tracker.cc.

References IsUplink(), m_packetTracker, NS_LOG_INFO, and ns3::lorawan::RECEIVED.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ PrintMacPacketsPerGw()

std::string ns3::lorawan::LoraPacketTracker::PrintMacPacketsPerGw ( Time  startTime,
Time  stopTime,
int  systemId 
)

Count packets in a time interval to evaluate the performance at MAC level of a specific gateway.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
systemIdNode id of the gateway.
Returns
String of output values.
Todo:
Not implemented, this is a placeholder for future implementation.

◆ PrintPhyPacketsPerGw()

std::string ns3::lorawan::LoraPacketTracker::PrintPhyPacketsPerGw ( Time  startTime,
Time  stopTime,
int  systemId 
)

Count packets in a time interval to evaluate the performance at PHY level of a specific gateway.

It counts the total number of uplink packets sent over the radio medium, and - from the perspective of the specified gateway - the number of such packets correctly received, lost to interference, lost to unavailability of the gateway's reception paths, lost for being under the RSSI sensitivity threshold, and lost due to concurrent downlink transmission of the gateway.

Parameters
startTimeTimestamp of the start of the measurement.
stopTimeTimestamp of the end of the measurement.
systemIdNode id of the gateway.
Returns
A vector comprised of the following fields: [totPacketsSent, receivedPackets, interferedPackets, noMoreGwPackets, underSensitivityPackets, lostBecauseTxPackets].
Values in the output vector are formatted into a space-separated string.

Definition at line 264 of file lora-packet-tracker.cc.

References ns3::lorawan::INTERFERED, ns3::lorawan::LOST_BECAUSE_TX, m_packetTracker, ns3::lorawan::NO_MORE_RECEIVERS, NS_LOG_DEBUG, ns3::lorawan::RECEIVED, stopTime, ns3::lorawan::UNDER_SENSITIVITY, and ns3::lorawan::UNSET.

Referenced by ns3::lorawan::LoraHelper::DoPrintPhyPerformance().

+ Here is the caller graph for this function:

◆ RequiredTransmissionsCallback()

void ns3::lorawan::LoraPacketTracker::RequiredTransmissionsCallback ( uint8_t  reqTx,
bool  success,
Time  firstAttempt,
Ptr< Packet packet 
)

Trace the exit status of a MAC layer packet retransmission process of an end device.

Parameters
reqTxNumber of transmissions attempted during the process.
successWhether the retransmission procedure was successful.
firstAttemptTimestamp of the initial transmission attempt.
packetThe packet being retransmitted.

Definition at line 67 of file lora-packet-tracker.cc.

References ns3::lorawan::RetransmissionStatus::finishTime, ns3::lorawan::RetransmissionStatus::firstAttempt, ns3::Time::GetSeconds(), m_reTransmissionTracker, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_INFO, ns3::lorawan::RetransmissionStatus::reTxAttempts, and ns3::lorawan::RetransmissionStatus::successful.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ TransmissionCallback()

void ns3::lorawan::LoraPacketTracker::TransmissionCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a packet TX start by the PHY layer of an end device.

Parameters
packetThe packet being transmitted.
systemIdId of end device transmitting the packet.

Definition at line 112 of file lora-packet-tracker.cc.

References IsUplink(), m_packetTracker, ns3::Simulator::Now(), NS_LOG_INFO, ns3::lorawan::PacketStatus::packet, ns3::lorawan::PacketStatus::senderId, and ns3::lorawan::PacketStatus::sendTime.

Referenced by ns3::lorawan::LoraHelper::Install().

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

◆ UnderSensitivityCallback()

void ns3::lorawan::LoraPacketTracker::UnderSensitivityCallback ( Ptr< const Packet packet,
uint32_t  systemId 
)

Trace a gateway packet loss caused by signal strength under sensitivity.

Parameters
packetThe packet being lost.
systemIdId of the gateway losing the packet.

Definition at line 166 of file lora-packet-tracker.cc.

References IsUplink(), m_packetTracker, NS_LOG_INFO, and ns3::lorawan::UNDER_SENSITIVITY.

Referenced by ns3::lorawan::LoraHelper::Install().

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

Member Data Documentation

◆ m_macPacketTracker

MacPacketData ns3::lorawan::LoraPacketTracker::m_macPacketTracker
private

Packet map of MAC layer metrics.

Definition at line 284 of file lora-packet-tracker.h.

Referenced by CountMacPacketsGlobally(), MacGwReceptionCallback(), and MacTransmissionCallback().

◆ m_packetTracker

◆ m_reTransmissionTracker

RetransmissionData ns3::lorawan::LoraPacketTracker::m_reTransmissionTracker
private

Packet map of retransmission process metrics.

Definition at line 285 of file lora-packet-tracker.h.

Referenced by CountMacPacketsGloballyCpsr(), and RequiredTransmissionsCallback().


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