Helps to create LoraNetDevice objects. More...
#include "lora-helper.h"
Public Member Functions | |
LoraHelper () | |
Default constructor. | |
virtual | ~LoraHelper () |
Destructor. | |
void | DoPrintDeviceStatus (NodeContainer endDevices, NodeContainer gateways, std::string filename) |
Print a summary of the current status of input devices. | |
void | DoPrintGlobalPerformance (std::string filename) |
Print global performance as the total number of send and received packets since last performance update. | |
void | DoPrintPhyPerformance (NodeContainer gateways, std::string filename) |
Print the PHY-level performance of every gateway in the container since the last performance update. | |
void | EnablePacketTracking () |
Enable tracking of packets via trace sources. | |
void | EnablePeriodicDeviceStatusPrinting (NodeContainer endDevices, NodeContainer gateways, std::string filename, Time interval) |
Periodically prints the status of devices in the network to a file. | |
void | EnablePeriodicGlobalPerformancePrinting (std::string filename, Time interval) |
Periodically print global performance as the total number of send and received packets. | |
void | EnablePeriodicPhyPerformancePrinting (NodeContainer gateways, std::string filename, Time interval) |
Periodically prints PHY-level performance at every gateway in the container. | |
void | EnableSimulationTimePrinting (Time interval) |
Periodically prints the simulation time to the standard output. | |
LoraPacketTracker & | GetPacketTracker () |
Get a reference to the Packet Tracker object. | |
virtual NetDeviceContainer | Install (const LoraPhyHelper &phyHelper, const LorawanMacHelper &macHelper, NodeContainer c) const |
Install LoraNetDevices on a list of nodes. | |
virtual NetDeviceContainer | Install (const LoraPhyHelper &phyHelper, const LorawanMacHelper &macHelper, Ptr< Node > node) const |
Install LoraNetDevice on a single node. | |
Public Attributes | |
time_t | m_oldtime |
Real time (i.e., physical) of the last simulation time print. | |
LoraPacketTracker * | m_packetTracker = nullptr |
Pointer to the Packet Tracker object. | |
Private Member Functions | |
void | DoPrintSimulationTime (Time interval) |
Actually print the simulation time and re-schedule execution of this function. | |
Private Attributes | |
Time | m_lastGlobalPerformanceUpdate |
Timestamp of the last global performance update. | |
Time | m_lastPhyPerformanceUpdate |
Timestamp of the last PHY performance update. | |
Helps to create LoraNetDevice objects.
This class can help create a large set of similar LoraNetDevice objects and configure a large set of their attributes during creation.
Definition at line 36 of file lora-helper.h.
ns3::lorawan::LoraHelper::LoraHelper | ( | ) |
Default constructor.
Definition at line 22 of file lora-helper.cc.
|
virtual |
Destructor.
Definition at line 28 of file lora-helper.cc.
void ns3::lorawan::LoraHelper::DoPrintDeviceStatus | ( | NodeContainer | endDevices, |
NodeContainer | gateways, | ||
std::string | filename ) |
Print a summary of the current status of input devices.
For each input device print the current position, data rate and transmission power settings.
endDevices | The devices to track. |
gateways | The gateways in the network (this is only a placeholder parameter). |
filename | The output filename. |
Definition at line 178 of file lora-helper.cc.
References ns3::NodeContainer::Begin(), ns3::DynamicCast(), ns3::NodeContainer::End(), ns3::Time::GetSeconds(), ns3::Simulator::Now(), NS_ASSERT, and ns3::Seconds().
Referenced by EnablePeriodicDeviceStatusPrinting().
void ns3::lorawan::LoraHelper::DoPrintGlobalPerformance | ( | std::string | filename | ) |
Print global performance as the total number of send and received packets since last performance update.
filename | The output filename. |
Definition at line 289 of file lora-helper.cc.
References ns3::lorawan::LoraPacketTracker::CountMacPacketsGlobally(), ns3::Time::GetSeconds(), m_lastGlobalPerformanceUpdate, m_packetTracker, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by EnablePeriodicGlobalPerformancePrinting().
void ns3::lorawan::LoraHelper::DoPrintPhyPerformance | ( | NodeContainer | gateways, |
std::string | filename ) |
Print the PHY-level performance of every gateway in the container since the last performance update.
For each input gateway print counters for totPacketsSent, receivedPackets, interferedPackets, noMoreGwPackets, underSensitivityPackets and lostBecauseTxPackets.
gateways | The gateways to track. |
filename | The output filename. |
Definition at line 242 of file lora-helper.cc.
References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), ns3::Time::GetSeconds(), m_lastPhyPerformanceUpdate, m_packetTracker, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::lorawan::LoraPacketTracker::PrintPhyPacketsPerGw(), and ns3::Seconds().
Referenced by EnablePeriodicPhyPerformancePrinting().
|
private |
Actually print the simulation time and re-schedule execution of this function.
interval | The delay for next printing. |
Definition at line 317 of file lora-helper.cc.
References DoPrintSimulationTime(), ns3::Time::GetHours(), m_oldtime, ns3::Simulator::Now(), and ns3::Simulator::Schedule().
Referenced by DoPrintSimulationTime(), and EnableSimulationTimePrinting().
void ns3::lorawan::LoraHelper::EnablePacketTracking | ( | ) |
Enable tracking of packets via trace sources.
This method automatically connects to trace sources to computes relevant metrics.
Definition at line 134 of file lora-helper.cc.
References m_packetTracker, and NS_LOG_FUNCTION.
void ns3::lorawan::LoraHelper::EnablePeriodicDeviceStatusPrinting | ( | NodeContainer | endDevices, |
NodeContainer | gateways, | ||
std::string | filename, | ||
Time | interval ) |
Periodically prints the status of devices in the network to a file.
For each input device print the current position, data rate and transmission power settings.
endDevices | The devices to track. |
gateways | The gateways in the network (this is only a placeholder parameter). |
filename | The output filename. |
interval | The time interval for printing. |
Definition at line 158 of file lora-helper.cc.
References DoPrintDeviceStatus(), EnablePeriodicDeviceStatusPrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by EnablePeriodicDeviceStatusPrinting().
void ns3::lorawan::LoraHelper::EnablePeriodicGlobalPerformancePrinting | ( | std::string | filename, |
Time | interval ) |
Periodically print global performance as the total number of send and received packets.
filename | The output filename. |
interval | The time interval for printing. |
Definition at line 275 of file lora-helper.cc.
References DoPrintGlobalPerformance(), EnablePeriodicGlobalPerformancePrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by EnablePeriodicGlobalPerformancePrinting().
void ns3::lorawan::LoraHelper::EnablePeriodicPhyPerformancePrinting | ( | NodeContainer | gateways, |
std::string | filename, | ||
Time | interval ) |
Periodically prints PHY-level performance at every gateway in the container.
For each input gateway print counters for totPacketsSent, receivedPackets, interferedPackets, noMoreGwPackets, underSensitivityPackets and lostBecauseTxPackets.
gateways | The gateways to track. |
filename | The output filename. |
interval | The time interval for printing. |
Definition at line 225 of file lora-helper.cc.
References DoPrintPhyPerformance(), EnablePeriodicPhyPerformancePrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by EnablePeriodicPhyPerformancePrinting().
void ns3::lorawan::LoraHelper::EnableSimulationTimePrinting | ( | Time | interval | ) |
Periodically prints the simulation time to the standard output.
interval | The time period of the interval. |
Definition at line 151 of file lora-helper.cc.
References DoPrintSimulationTime(), m_oldtime, ns3::Simulator::Schedule(), and ns3::Seconds().
LoraPacketTracker & ns3::lorawan::LoraHelper::GetPacketTracker | ( | ) |
Get a reference to the Packet Tracker object.
Definition at line 143 of file lora-helper.cc.
References m_packetTracker, and NS_LOG_FUNCTION.
|
virtual |
Install LoraNetDevices on a list of nodes.
phyHelper | The PHY helper to create PHY objects. |
macHelper | The MAC helper to create MAC objects. |
c | The set of nodes on which a lora device will be installed. |
Definition at line 33 of file lora-helper.cc.
References ns3::NodeContainer::Begin(), ns3::lorawan::LoraPhyHelper::Create(), ns3::lorawan::LorawanMacHelper::Create(), ns3::CreateObject(), ns3::NodeContainer::End(), ns3::lorawan::LoraPhyHelper::GetDeviceType(), ns3::MobilityModel::GetPosition(), ns3::lorawan::LoraPacketTracker::InterferenceCallback(), ns3::TypeId::LookupByName(), ns3::lorawan::LoraPacketTracker::LostBecauseTxCallback(), m_packetTracker, ns3::lorawan::LoraPacketTracker::MacGwReceptionCallback(), ns3::lorawan::LoraPacketTracker::MacTransmissionCallback(), ns3::MakeCallback(), ns3::lorawan::LoraPacketTracker::NoMoreReceiversCallback(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, ns3::lorawan::LoraPacketTracker::PacketReceptionCallback(), ns3::lorawan::LoraPacketTracker::RequiredTransmissionsCallback(), ns3::lorawan::LoraPacketTracker::TransmissionCallback(), and ns3::lorawan::LoraPacketTracker::UnderSensitivityCallback().
Referenced by ns3::lorawan::CreateEndDevices(), ns3::lorawan::CreateGateways(), and Install().
|
virtual |
Install LoraNetDevice on a single node.
phyHelper | The PHY helper to create PHY objects. |
macHelper | The MAC helper to create MAC objects. |
node | The node on which a lora device will be installed. |
Definition at line 128 of file lora-helper.cc.
References Install().
|
private |
Timestamp of the last global performance update.
Definition at line 176 of file lora-helper.h.
Referenced by DoPrintGlobalPerformance().
|
private |
Timestamp of the last PHY performance update.
Definition at line 175 of file lora-helper.h.
Referenced by DoPrintPhyPerformance().
time_t ns3::lorawan::LoraHelper::m_oldtime |
Real time (i.e., physical) of the last simulation time print.
Definition at line 149 of file lora-helper.h.
Referenced by DoPrintSimulationTime(), and EnableSimulationTimePrinting().
LoraPacketTracker* ns3::lorawan::LoraHelper::m_packetTracker = nullptr |
Pointer to the Packet Tracker object.
Definition at line 148 of file lora-helper.h.
Referenced by DoPrintGlobalPerformance(), DoPrintPhyPerformance(), EnablePacketTracking(), GetPacketTracker(), and Install().