18 #include "ns3/applications-module.h"
19 #include "ns3/basic-energy-source.h"
20 #include "ns3/core-module.h"
21 #include "ns3/csma-module.h"
22 #include "ns3/internet-module.h"
23 #include "ns3/mobility-module.h"
24 #include "ns3/netanim-module.h"
25 #include "ns3/network-module.h"
26 #include "ns3/point-to-point-module.h"
27 #include "ns3/simple-device-energy-model.h"
29 #include "ns3/wifi-radio-energy-model.h"
30 #include "ns3/yans-wifi-helper.h"
37 main(
int argc,
char* argv[])
41 cmd.AddValue(
"nWifi",
"Number of wifi STA devices",
nWifi);
43 cmd.Parse(argc, argv);
60 mac.SetType(
"ns3::StaWifiMac",
"Ssid", SsidValue(
ssid),
"ActiveProbing",
BooleanValue(
false));
64 mac.SetType(
"ns3::ApWifiMac",
"Ssid", SsidValue(
ssid));
96 mobility.SetPositionAllocator(
"ns3::GridPositionAllocator",
109 mobility.SetMobilityModel(
"ns3::RandomWalk2dMobilityModel",
111 RectangleValue(
Rectangle(-50, 50, -25, 50)));
113 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
122 energyModel->SetEnergySource(energySource);
126 wifiApNode.Get(0)->AggregateObject(energySource);
131 stack.Install(allNodes);
136 address.SetBase(
"10.1.1.0",
"255.255.255.0");
139 address.SetBase(
"10.1.2.0",
"255.255.255.0");
142 address.SetBase(
"10.1.3.0",
"255.255.255.0");
171 for (uint32_t i = 0; i <
wifiApNode.GetN(); ++i)
176 for (uint32_t i = 0; i <
csmaNodes.GetN(); ++i)
Interface to network animator.
AnimationInterface & EnableIpv4RouteTracking(std::string fileName, Time startTime, Time stopTime, Time pollInterval=Seconds(5))
Enable tracking of the Ipv4 routing table for all Nodes.
void EnableWifiPhyCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Phy Counters such as TxDrop, RxDrop.
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
void EnableWifiMacCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Mac Counters such as Tx, TxDrop, Rx, RxDrop.
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
holds a vector of ns3::Application pointers.
void SetInitialEnergy(double initialEnergyJ)
Parse command-line arguments.
build a set of CsmaNetDevice objects
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
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 Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Build a set of PointToPointNetDevice objects.
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.
The IEEE 802.11 SSID Information Element.
Hold variables of type string.
Create an application which sends a UDP packet and waits for an echo of this packet.
Create a server application which waits for input UDP packets and sends them back to the original sen...
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
AnimationInterface * anim
Every class exported by the ns3 library is enclosed in the ns3 namespace.