15#include "ns3/command-line.h"
16#include "ns3/core-module.h"
17#include "ns3/forwarder-helper.h"
18#include "ns3/gateway-lora-phy.h"
20#include "ns3/lora-channel.h"
21#include "ns3/lora-device-address-generator.h"
22#include "ns3/lora-helper.h"
23#include "ns3/lora-phy-helper.h"
24#include "ns3/lorawan-mac-helper.h"
25#include "ns3/mobility-helper.h"
26#include "ns3/network-module.h"
27#include "ns3/network-server-helper.h"
28#include "ns3/one-shot-sender-helper.h"
29#include "ns3/periodic-sender-helper.h"
30#include "ns3/periodic-sender.h"
31#include "ns3/point-to-point-module.h"
32#include "ns3/string.h"
35using namespace lorawan;
40main(
int argc,
char* argv[])
45 cmd.AddValue(
"verbose",
"Whether to print output or not",
verbose);
46 cmd.Parse(argc, argv);
78 loss->SetPathLossExponent(3.76);
79 loss->SetReference(1, 7.7);
92 positionAllocEd->Add(Vector(6000.0, 0.0, 0.0));
93 positionAllocEd->Add(Vector(0.0, 100.0, 0.0));
99 positionAllocGw->Add(Vector(0.0, 0.0, 0.0));
100 positionAllocGw->Add(Vector(-2000.0, 0.0, 0.0));
101 positionAllocGw->Add(Vector(500.0, 0.0, 0.0));
120 mobilityEd.
Install(endDevices);
133 helper.
Install(phyHelper, macHelper, endDevices);
162 helper.
Install(phyHelper, macHelper, gateways);
179 for (
auto gw = gateways.
Begin(); gw != gateways.
End(); ++gw)
183 gwRegistration.emplace_back(serverP2PNetDev, *gw);
190 networkServerHelper.
Install(networkServer);
194 forwarderHelper.
Install(gateways);
Parse command-line arguments.
Helper class used to assign positions and mobility models to nodes.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetMobilityModel(std::string type, Ts &&... args)
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
This class can be used to install Forwarder applications on a set of gateways.
ApplicationContainer Install(NodeContainer c) const
Install a Forwarder application on each node of the input container configured with all the attribute...
Helps to create LoraNetDevice objects.
virtual NetDeviceContainer Install(const LoraPhyHelper &phyHelper, const LorawanMacHelper &macHelper, NodeContainer c) const
Install LoraNetDevices on a list of nodes.
Helper to install LoraPhy instances on multiple Nodes.
void SetDeviceType(enum DeviceType dt)
Set the kind of PHY this helper will create.
void SetChannel(Ptr< LoraChannel > channel)
Set the LoraChannel to connect the PHYs to.
Helper class for configuring and installing the LorawanMac class on devices and gateways.
void SetDeviceType(enum DeviceType dt)
Set the kind of MAC this helper will create.
void SetAddressGenerator(Ptr< LoraDeviceAddressGenerator > addrGen)
Set the address generator to use for creation of these nodes.
static std::vector< int > SetSpreadingFactorsUp(NodeContainer endDevices, NodeContainer gateways, Ptr< LoraChannel > channel)
Initialize the end devices' data rate parameter.
void SetRegion(enum Regions region)
Set the region in which the device is to operate.
This class can install a NetworkServer application on a node.
void SetGatewaysP2P(const P2PGwRegistration_t ®istration)
Register gateways connected with point-to-point to this network server.
void SetEndDevices(NodeContainer endDevices)
Set which end devices will be managed by this network server.
ApplicationContainer Install(Ptr< Node > node)
Create one lorawan network server application on the Node.
This class can be used to install OneShotSender applications on multiple nodes at once.
void SetSendTime(Time sendTime)
Set the send time of the applications.
ApplicationContainer Install(NodeContainer c) const
Install a OneShotSender application on each node of the input container configured with all the attri...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
std::list< std::pair< Ptr< PointToPointNetDevice >, Ptr< Node > > > P2PGwRegistration_t
Store network server app registration details for gateway nodes having a P2P link with the network se...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.