14#include "ns3/basic-energy-source-helper.h"
15#include "ns3/class-a-end-device-lorawan-mac.h"
16#include "ns3/command-line.h"
17#include "ns3/constant-position-mobility-model.h"
18#include "ns3/end-device-lora-phy.h"
19#include "ns3/file-helper.h"
20#include "ns3/gateway-lora-phy.h"
21#include "ns3/gateway-lorawan-mac.h"
23#include "ns3/lora-helper.h"
24#include "ns3/lora-radio-energy-model-helper.h"
25#include "ns3/mobility-helper.h"
27#include "ns3/node-container.h"
28#include "ns3/periodic-sender-helper.h"
29#include "ns3/position-allocator.h"
30#include "ns3/simulator.h"
36using namespace lorawan;
41main(
int argc,
char* argv[])
76 loss->SetPathLossExponent(3.76);
77 loss->SetReference(1, 7.7);
91 allocator->Add(Vector(100, 0, 0));
92 allocator->Add(Vector(0, 0, 0));
93 mobility.SetPositionAllocator(allocator);
94 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
132 mobility.SetPositionAllocator(allocator);
138 helper.
Install(phyHelper, macHelper, gateways);
154 periodicSenderHelper.
Install(endDevices);
164 basicSourceHelper.
Set(
"BasicEnergySourceInitialEnergyJ",
DoubleValue(10000));
165 basicSourceHelper.
Set(
"BasicEnergySupplyVoltageV",
DoubleValue(3.3));
182 radioEnergyHelper.
Install(endDevicesNetDevices, sources);
189 fileHelper.
WriteProbe(
"ns3::DoubleProbe",
"/Names/EnergySource/RemainingEnergy",
"Output");
Creates a BasicEnergySource object.
void Set(std::string name, const AttributeValue &v) override
energy::DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const
This class can be used to hold variables of floating point type such as 'double' or 'float'.
energy::EnergySourceContainer Install(Ptr< Node > node) const
Helper class used to put data values into a file.
void WriteProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource)
void ConfigureFile(const std::string &outputFileNameWithoutExtension, FileAggregator::FileType fileType=FileAggregator::SPACE_SEPARATED)
Helper class used to assign positions and mobility models to nodes.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
holds a vector of ns3::NetDevice pointers
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.
Holds a vector of ns3::DeviceEnergyModel pointers.
Holds a vector of ns3::EnergySource pointers.
Ptr< EnergySource > Get(uint32_t i) const
Get the i-th Ptr<EnergySource> stored in this container.
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.
Installs LoraRadioEnergyModel on devices.
void Set(std::string name, const AttributeValue &v) override
void SetTxCurrentModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
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 PeriodicSender applications on a wide range of nodes.
void SetPeriod(Time period)
Set the period to be used by the applications created by this helper.
ApplicationContainer Install(NodeContainer c) const
Install a PeriodicSender application on each node of the input container configured with all the attr...
#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.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.