Tracks and stores packets sent in the simulation and provides aggregation functionality. More...
#include "lora-packet-tracker.h"
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. | |
Tracks and stores packets sent in the simulation and provides aggregation functionality.
Definition at line 98 of file lora-packet-tracker.h.
ns3::lorawan::LoraPacketTracker::LoraPacketTracker | ( | ) |
Default constructor.
Definition at line 35 of file lora-packet-tracker.cc.
References NS_LOG_FUNCTION.
ns3::lorawan::LoraPacketTracker::~LoraPacketTracker | ( | ) |
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
Definition at line 324 of file lora-packet-tracker.cc.
References m_macPacketTracker, NS_LOG_FUNCTION, and stopTime.
Referenced by ns3::lorawan::LoraHelper::DoPrintGlobalPerformance().
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
Definition at line 346 of file lora-packet-tracker.cc.
References m_reTransmissionTracker, NS_LOG_DEBUG, NS_LOG_FUNCTION, and stopTime.
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
systemId | Node id of the gateway. |
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
systemId | Node id of the gateway. |
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.
In a time interval, count the number of retransmissions that were needed to correctly deliver a packet and receive the corresponding acknowledgment.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
void ns3::lorawan::LoraPacketTracker::InterferenceCallback | ( | Ptr< const Packet > | packet, |
uint32_t | systemId | ||
) |
Trace a gateway packet loss caused by interference.
packet | The packet being lost. |
systemId | Id 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().
Check whether a packet is uplink.
packet | The packet to be checked. |
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().
void ns3::lorawan::LoraPacketTracker::LostBecauseTxCallback | ( | Ptr< const Packet > | packet, |
uint32_t | systemId | ||
) |
Trace a gateway packet loss caused by concurrent downlink transmission.
packet | The packet being lost. |
systemId | Id 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().
Trace a packet leaving a gateway's MAC layer to go up the stack and be delivered to the node's application.
packet | The 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().
Trace a packet leaving a node's MAC layer to go down the stack and be sent by the PHY layer.
packet | The 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().
void ns3::lorawan::LoraPacketTracker::NoMoreReceiversCallback | ( | Ptr< const Packet > | packet, |
uint32_t | systemId | ||
) |
Trace a gateway packet loss caused by lack of free reception paths.
packet | The packet being lost. |
systemId | Id 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().
void ns3::lorawan::LoraPacketTracker::PacketReceptionCallback | ( | Ptr< const Packet > | packet, |
uint32_t | systemId | ||
) |
Trace a correct packet RX by the PHY layer of a gateway.
packet | The packet being received. |
systemId | Id 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().
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
systemId | Node id of the gateway. |
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.
startTime | Timestamp of the start of the measurement. |
stopTime | Timestamp of the end of the measurement. |
systemId | Node id of the gateway. |
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().
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.
reqTx | Number of transmissions attempted during the process. |
success | Whether the retransmission procedure was successful. |
firstAttempt | Timestamp of the initial transmission attempt. |
packet | The 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().
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.
packet | The packet being transmitted. |
systemId | Id 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().
void ns3::lorawan::LoraPacketTracker::UnderSensitivityCallback | ( | Ptr< const Packet > | packet, |
uint32_t | systemId | ||
) |
Trace a gateway packet loss caused by signal strength under sensitivity.
packet | The packet being lost. |
systemId | Id 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().
|
private |
Packet map of MAC layer metrics.
Definition at line 284 of file lora-packet-tracker.h.
Referenced by CountMacPacketsGlobally(), MacGwReceptionCallback(), and MacTransmissionCallback().
|
private |
Packet map of PHY layer metrics.
Definition at line 283 of file lora-packet-tracker.h.
Referenced by CountPhyPacketsPerGw(), InterferenceCallback(), LostBecauseTxCallback(), NoMoreReceiversCallback(), PacketReceptionCallback(), PrintPhyPacketsPerGw(), TransmissionCallback(), and UnderSensitivityCallback().
|
private |
Packet map of retransmission process metrics.
Definition at line 285 of file lora-packet-tracker.h.
Referenced by CountMacPacketsGloballyCpsr(), and RequiredTransmissionsCallback().