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

Helps to create LoraNetDevice objects. More...

#include "lora-helper.h"

+ Collaboration diagram for ns3::lorawan::LoraHelper:

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.
 
LoraPacketTrackerGetPacketTracker ()
 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.
 
LoraPacketTrackerm_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.
 

Detailed Description

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 47 of file lora-helper.h.

Constructor & Destructor Documentation

◆ LoraHelper()

ns3::lorawan::LoraHelper::LoraHelper ( )

Default constructor.

Definition at line 33 of file lora-helper.cc.

◆ ~LoraHelper()

ns3::lorawan::LoraHelper::~LoraHelper ( )
virtual

Destructor.

Definition at line 39 of file lora-helper.cc.

Member Function Documentation

◆ DoPrintDeviceStatus()

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.

Parameters
endDevicesThe devices to track.
gatewaysThe gateways in the network (this is only a placeholder parameter).
filenameThe output filename.
Todo:
Remove unused parameter gateways.

Definition at line 189 of file lora-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), ns3::Time::GetSeconds(), ns3::Simulator::Now(), NS_ASSERT, and ns3::Seconds().

Referenced by EnablePeriodicDeviceStatusPrinting().

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

◆ DoPrintGlobalPerformance()

void ns3::lorawan::LoraHelper::DoPrintGlobalPerformance ( std::string  filename)

Print global performance as the total number of send and received packets since last performance update.

Parameters
filenameThe output filename.

Definition at line 300 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().

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

◆ DoPrintPhyPerformance()

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.

Parameters
gatewaysThe gateways to track.
filenameThe output filename.

Definition at line 253 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().

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

◆ DoPrintSimulationTime()

void ns3::lorawan::LoraHelper::DoPrintSimulationTime ( Time  interval)
private

Actually print the simulation time and re-schedule execution of this function.

Parameters
intervalThe delay for next printing.

Definition at line 328 of file lora-helper.cc.

References DoPrintSimulationTime(), ns3::Time::GetHours(), m_oldtime, ns3::Simulator::Now(), and ns3::Simulator::Schedule().

Referenced by DoPrintSimulationTime(), and EnableSimulationTimePrinting().

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

◆ EnablePacketTracking()

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 145 of file lora-helper.cc.

References m_packetTracker, and NS_LOG_FUNCTION.

◆ EnablePeriodicDeviceStatusPrinting()

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.

Parameters
endDevicesThe devices to track.
gatewaysThe gateways in the network (this is only a placeholder parameter).
filenameThe output filename.
intervalThe time interval for printing.
Todo:
Remove unused parameter gateways.

Definition at line 169 of file lora-helper.cc.

References DoPrintDeviceStatus(), EnablePeriodicDeviceStatusPrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by EnablePeriodicDeviceStatusPrinting().

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

◆ EnablePeriodicGlobalPerformancePrinting()

void ns3::lorawan::LoraHelper::EnablePeriodicGlobalPerformancePrinting ( std::string  filename,
Time  interval 
)

Periodically print global performance as the total number of send and received packets.

Parameters
filenameThe output filename.
intervalThe time interval for printing.

Definition at line 286 of file lora-helper.cc.

References DoPrintGlobalPerformance(), EnablePeriodicGlobalPerformancePrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by EnablePeriodicGlobalPerformancePrinting().

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

◆ EnablePeriodicPhyPerformancePrinting()

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.

Parameters
gatewaysThe gateways to track.
filenameThe output filename.
intervalThe time interval for printing.

Definition at line 236 of file lora-helper.cc.

References DoPrintPhyPerformance(), EnablePeriodicPhyPerformancePrinting(), NS_LOG_FUNCTION, and ns3::Simulator::Schedule().

Referenced by EnablePeriodicPhyPerformancePrinting().

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

◆ EnableSimulationTimePrinting()

void ns3::lorawan::LoraHelper::EnableSimulationTimePrinting ( Time  interval)

Periodically prints the simulation time to the standard output.

Parameters
intervalThe time period of the interval.

Definition at line 162 of file lora-helper.cc.

References DoPrintSimulationTime(), m_oldtime, ns3::Simulator::Schedule(), and ns3::Seconds().

+ Here is the call graph for this function:

◆ GetPacketTracker()

LoraPacketTracker & ns3::lorawan::LoraHelper::GetPacketTracker ( )

Get a reference to the Packet Tracker object.

Returns
the reference to the Packet Tracker object.

Definition at line 154 of file lora-helper.cc.

References m_packetTracker, and NS_LOG_FUNCTION.

◆ Install() [1/2]

NetDeviceContainer ns3::lorawan::LoraHelper::Install ( const LoraPhyHelper phyHelper,
const LorawanMacHelper macHelper,
NodeContainer  c 
) const
virtual

Install LoraNetDevices on a list of nodes.

Parameters
phyHelperThe PHY helper to create PHY objects.
macHelperThe MAC helper to create MAC objects.
cThe set of nodes on which a lora device will be installed.
Returns
A device container which contains all the devices created by this method.

Definition at line 44 of file lora-helper.cc.

References ns3::NodeContainer::Begin(), ns3::lorawan::LoraPhyHelper::Create(), ns3::lorawan::LorawanMacHelper::Create(), 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().

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

◆ Install() [2/2]

NetDeviceContainer ns3::lorawan::LoraHelper::Install ( const LoraPhyHelper phyHelper,
const LorawanMacHelper macHelper,
Ptr< Node node 
) const
virtual

Install LoraNetDevice on a single node.

Parameters
phyHelperThe PHY helper to create PHY objects.
macHelperThe MAC helper to create MAC objects.
nodeThe node on which a lora device will be installed.
Returns
A device container which contains all the devices created by this method.

Definition at line 139 of file lora-helper.cc.

References Install().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_lastGlobalPerformanceUpdate

Time ns3::lorawan::LoraHelper::m_lastGlobalPerformanceUpdate
private

Timestamp of the last global performance update.

Definition at line 187 of file lora-helper.h.

Referenced by DoPrintGlobalPerformance().

◆ m_lastPhyPerformanceUpdate

Time ns3::lorawan::LoraHelper::m_lastPhyPerformanceUpdate
private

Timestamp of the last PHY performance update.

Definition at line 186 of file lora-helper.h.

Referenced by DoPrintPhyPerformance().

◆ m_oldtime

time_t ns3::lorawan::LoraHelper::m_oldtime

Real time (i.e., physical) of the last simulation time print.

Definition at line 160 of file lora-helper.h.

Referenced by DoPrintSimulationTime(), and EnableSimulationTimePrinting().

◆ m_packetTracker

LoraPacketTracker* ns3::lorawan::LoraHelper::m_packetTracker = nullptr

Pointer to the Packet Tracker object.

Definition at line 159 of file lora-helper.h.

Referenced by DoPrintGlobalPerformance(), DoPrintPhyPerformance(), EnablePacketTracking(), GetPacketTracker(), and Install().


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