14#include "ns3/command-line.h"
15#include "ns3/constant-position-mobility-model.h"
16#include "ns3/end-device-lora-phy.h"
17#include "ns3/end-device-lorawan-mac.h"
18#include "ns3/gateway-lora-phy.h"
19#include "ns3/gateway-lorawan-mac.h"
21#include "ns3/lora-helper.h"
22#include "ns3/mobility-helper.h"
23#include "ns3/node-container.h"
24#include "ns3/one-shot-sender-helper.h"
25#include "ns3/position-allocator.h"
26#include "ns3/simulator.h"
32using namespace lorawan;
37main(
int argc,
char* argv[])
71 loss->SetPathLossExponent(3.76);
72 loss->SetReference(1, 7.7);
86 allocator->Add(Vector(1000, 0, 0));
87 allocator->Add(Vector(0, 0, 0));
88 mobility.SetPositionAllocator(allocator);
89 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
117 helper.
Install(phyHelper, macHelper, endDevices);
132 helper.
Install(phyHelper, macHelper, gateways);
141 oneShotSenderHelper.
Install(endDevices);
146 std::vector<int> sfQuantity(6);
Helper class used to assign positions and mobility models to nodes.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
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.
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.
static std::vector< int > SetSpreadingFactorsUp(NodeContainer endDevices, NodeContainer gateways, Ptr< LoraChannel > channel)
Initialize the end devices' data rate parameter.
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.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
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.
Time Hours(double value)
Construct a Time in the indicated unit.
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.
@ 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.
@ LOG_LEVEL_INFO
LOG_INFO and above.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.