23#include "ns3/core-module.h"
24#include "ns3/internet-module.h"
25#include "ns3/mobility-module.h"
26#include "ns3/network-module.h"
27#include "ns3/stats-module.h"
28#include "ns3/wifi-module.h"
54 double distance = 50.0;
55 std::string
format(
"omnet");
58 std::string
strategy(
"wifi-default");
63 std::stringstream
sstr;
64 sstr <<
"run-" << time(
nullptr);
70 cmd.AddValue(
"distance",
"Distance apart to place nodes (in meters).", distance);
71 cmd.AddValue(
"format",
"Format to use for data output.",
format);
72 cmd.AddValue(
"experiment",
"Identifier for experiment.",
experiment);
73 cmd.AddValue(
"strategy",
"Identifier for strategy.",
strategy);
74 cmd.AddValue(
"run",
"Identifier for run.",
runID);
92 std::stringstream
sstr(
"");
104 NS_LOG_INFO(
"Installing WiFi and Internet stack.");
122 NS_LOG_INFO(
"Installing static mobility; distance " << distance <<
" .");
141 appSink->AddApplication(receiver);
142 receiver->SetStartTime(
Seconds(0));
144 Config::Set(
"/NodeList/*/ApplicationList/*/$Sender/Destination",
156 data.AddMetadata(
"author",
"tjkopena");
163 totalTx->SetKey(
"wifi-tx-frames");
164 totalTx->SetContext(
"node[0]");
165 Config::Connect(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
174 totalRx->SetKey(
"wifi-rx-frames");
175 totalRx->SetContext(
"node[1]");
176 Config::Connect(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
184 appTx->SetKey(
"sender-tx-packets");
185 appTx->SetContext(
"node[0]");
195 appRx->SetKey(
"receiver-rx-packets");
196 appRx->SetContext(
"node[1]");
197 receiver->SetCounter(
appRx);
250 NS_LOG_INFO(
"Creating omnet formatted data output.");
256 NS_LOG_INFO(
"Creating sqlite formatted data output.");
Parse command-line arguments.
Template class CounterCalculator.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
AttributeValue implementation for Ipv4Address.
Helper class used to assign positions and mobility models to nodes.
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.
static Ptr< Node > GetNode(uint32_t n)
void PacketUpdate(std::string path, Ptr< const Packet > packet)
Increments the packet counter by one.
void PacketUpdate(std::string path, Ptr< const Packet > packet)
Increments the packet stats by the size of the packet.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
void experiment(std::string queue_disc_type)
void Connect(std::string path, const CallbackBase &cb)
void Set(std::string path, const AttributeValue &value)
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#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.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void TxCallback(Ptr< CounterCalculator< uint32_t > > datac, std::string path, Ptr< const Packet > packet)
Function called when a packet is transmitted.