A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-multirate.cc
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Author: Duy Nguyen <duy@soe.ucsc.edu>
5 */
6
7#include "ns3/boolean.h"
8#include "ns3/command-line.h"
9#include "ns3/config.h"
10#include "ns3/double.h"
11#include "ns3/flow-monitor-helper.h"
12#include "ns3/gnuplot.h"
13#include "ns3/internet-stack-helper.h"
14#include "ns3/ipv4-address-helper.h"
15#include "ns3/ipv4-list-routing-helper.h"
16#include "ns3/ipv4-static-routing-helper.h"
17#include "ns3/log.h"
18#include "ns3/mobility-helper.h"
19#include "ns3/mobility-model.h"
20#include "ns3/olsr-helper.h"
21#include "ns3/on-off-helper.h"
22#include "ns3/rectangle.h"
23#include "ns3/string.h"
24#include "ns3/uinteger.h"
25#include "ns3/yans-wifi-channel.h"
26#include "ns3/yans-wifi-helper.h"
27
28/**
29 * @file
30 * @ingroup wifi
31 * WiFi multirate experiment.
32 */
33
34using namespace ns3;
35
36NS_LOG_COMPONENT_DEFINE("multirate");
37
38/** Unnamed namespace, to disambiguate class Experiment. */
39namespace
40{
41
42/**
43 * WiFi multirate experiment class.
44 *
45 * It handles the creation and run of an experiment.
46 *
47 * Scenarios: 100 nodes, multiple simultaneous flows, multi-hop ad hoc, routing,
48 * and mobility
49 *
50 * QUICK INSTRUCTIONS:
51 *
52 * To optimize build:
53 * ./ns3 configure -d optimized
54 * ./ns3
55 *
56 * To compile:
57 * ./ns3 run wifi-multirate
58 *
59 * To compile with command line(useful for varying parameters):
60 * ./ns3 run "wifi-multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager"
61 *
62 * To turn on NS_LOG:
63 * export NS_LOG=multirate=level_all
64 * (can only view log if built with ./ns3 configure -d debug)
65 *
66 * To debug:
67 * ./ns3 shell
68 * gdb ./build/debug/examples/wireless/wifi-multirate
69 *
70 * To view pcap files:
71 * tcpdump -nn -tt -r filename.pcap
72 *
73 * To monitor the files:
74 * tail -f filename.pcap
75 *
76 */
78{
79 public:
80 Experiment();
81 /**
82 * @brief Construct a new Experiment object
83 *
84 * @param name The name of the experiment.
85 */
86 Experiment(std::string name);
87 /**
88 * Run an experiment.
89 * @param wifi The WifiHelper class.
90 * @param wifiPhy The YansWifiPhyHelper class.
91 * @param wifiMac The WifiMacHelper class.
92 * @param wifiChannel The YansWifiChannelHelper class.
93 * @param mobility The MobilityHelper class.
94 * @return a 2D dataset of the experiment data.
95 */
97 const YansWifiPhyHelper& wifiPhy,
98 const WifiMacHelper& wifiMac,
99 const YansWifiChannelHelper& wifiChannel,
100 const MobilityHelper& mobility);
101
102 /**
103 * @brief Setup the experiment from the command line arguments.
104 *
105 * @param argc The argument count.
106 * @param argv The argument vector.
107 * @return true
108 */
109 bool CommandSetup(int argc, char** argv);
110
111 /**
112 * @brief Check if routing is enabled.
113 *
114 * @return true if routing is enabled.
115 */
116 bool IsRouting() const
117 {
118 return m_enableRouting;
119 }
120
121 /**
122 * @brief Check if mobility is enabled.
123 *
124 * @return true if mobility is enabled.
125 */
126 bool IsMobility() const
127 {
128 return m_enableMobility;
129 }
130
131 /**
132 * @brief Get the Scenario number.
133 *
134 * @return the scenario number.
135 */
137 {
138 return m_scenario;
139 }
140
141 /**
142 * @brief Get the RTS Threshold.
143 *
144 * @return the RTS Threshold.
145 */
146 std::string GetRtsThreshold() const
147 {
148 return m_rtsThreshold;
149 }
150
151 /**
152 * @brief Get the Output File Name.
153 *
154 * @return the Output File Name.
155 */
156 std::string GetOutputFileName() const
157 {
158 return m_outputFileName;
159 }
160
161 /**
162 * @brief Get the Rate Manager.
163 *
164 * @return the Rate Manager.
165 */
166 std::string GetRateManager() const
167 {
168 return m_rateManager;
169 }
170
171 private:
172 /**
173 * @brief Setup the receiving socket.
174 *
175 * @param node The receiving node.
176 * @return the Rx socket.
177 */
179 /**
180 * Generate 1-hop and 2-hop neighbors of a node in grid topology
181 * @param c The node container.
182 * @param senderId The sender ID.
183 * @return the neighbor nodes.
184 */
185 NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId);
186
187 /**
188 * @brief Setup the application in the nodes.
189 *
190 * @param client Client node.
191 * @param server Server node.
192 * @param start Start time.
193 * @param stop Stop time.
194 */
195 void ApplicationSetup(Ptr<Node> client, Ptr<Node> server, double start, double stop);
196 /**
197 * Take the grid map, divide it into 4 quadrants
198 * Assign all nodes from each quadrant to a specific container
199 *
200 * @param c The node container.
201 */
202 void AssignNeighbors(NodeContainer c);
203 /**
204 * Sources and destinations are randomly selected such that a node
205 * may be the source for multiple destinations and a node maybe a destination
206 * for multiple sources.
207 *
208 * @param c The node container.
209 */
210 void SelectSrcDest(NodeContainer c);
211 /**
212 * @brief Receive a packet.
213 *
214 * @param socket The receiving socket.
215 */
216 void ReceivePacket(Ptr<Socket> socket);
217 /**
218 * @brief Calculate the throughput.
219 */
220 void CheckThroughput();
221 /**
222 * A sender node will set up a flow to each of the its neighbors
223 * in its quadrant randomly. All the flows are exponentially distributed.
224 *
225 * @param sender The sender node.
226 * @param c The node neighbors.
227 */
228 void SendMultiDestinations(Ptr<Node> sender, NodeContainer c);
229
230 Gnuplot2dDataset m_output; //!< Output dataset.
231
232 double m_totalTime; //!< Total experiment time.
233 double m_expMean; //!< Exponential parameter for sending packets.
234 double m_samplingPeriod; //!< Sampling period.
235
236 uint32_t m_bytesTotal; //!< Total number of received bytes.
237 uint32_t m_packetSize; //!< Packet size.
238 uint32_t m_gridSize; //!< Grid size.
239 uint32_t m_nodeDistance; //!< Node distance.
240 uint32_t m_port; //!< Listening port.
241 uint32_t m_scenario; //!< Scenario number.
242
243 bool m_enablePcap; //!< True if PCAP output is enabled.
244 bool m_enableTracing; //!< True if tracing output is enabled.
245 bool m_enableFlowMon; //!< True if FlowMon is enabled.
246 bool m_enableRouting; //!< True if routing is enabled.
247 bool m_enableMobility; //!< True if mobility is enabled.
248
249 /**
250 * Node containers for each quadrant.
251 * @{
252 */
257 /** @} */
258 std::string m_rtsThreshold; //!< Rts threshold.
259 std::string m_rateManager; //!< Rate manager.
260 std::string m_outputFileName; //!< Output file name.
261};
262
266
267Experiment::Experiment(std::string name)
268 : m_output(name),
269 m_totalTime(0.3),
270 m_expMean(0.1),
271 // flows being exponentially distributed
272 m_samplingPeriod(0.1),
273 m_bytesTotal(0),
274 m_packetSize(2000),
275 m_gridSize(10),
276 // 10x10 grid for a total of 100 nodes
277 m_nodeDistance(30),
278 m_port(5000),
279 m_scenario(4),
280 m_enablePcap(false),
281 m_enableTracing(true),
282 m_enableFlowMon(false),
283 m_enableRouting(false),
284 m_enableMobility(false),
285 m_rtsThreshold("2200"),
286 // 0 for enabling rts/cts
287 m_rateManager("ns3::MinstrelWifiManager"),
288 m_outputFileName("minstrel")
289{
291}
292
295{
296 TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory");
299 sink->Bind(local);
300 sink->SetRecvCallback(MakeCallback(&Experiment::ReceivePacket, this));
301
302 return sink;
303}
304
305void
307{
308 Ptr<Packet> packet;
309 while ((packet = socket->Recv()))
310 {
311 m_bytesTotal += packet->GetSize();
312 }
313}
314
315void
317{
318 double mbs = ((m_bytesTotal * 8.0) / 1000000 / m_samplingPeriod);
319 m_bytesTotal = 0;
320 m_output.Add((Simulator::Now()).GetSeconds(), mbs);
321
322 // check throughput every samplingPeriod second
324}
325
326void
328{
329 uint32_t totalNodes = c.GetN();
330 for (uint32_t i = 0; i < totalNodes; i++)
331 {
332 if ((i % m_gridSize) <= (m_gridSize / 2 - 1))
333 {
334 // lower left quadrant
335 if (i < totalNodes / 2)
336 {
337 m_containerA.Add(c.Get(i));
338 }
339
340 // upper left quadrant
341 if (i >= (uint32_t)(4 * totalNodes) / 10)
342 {
343 m_containerC.Add(c.Get(i));
344 }
345 }
346 if ((i % m_gridSize) >= (m_gridSize / 2 - 1))
347 {
348 // lower right quadrant
349 if (i < totalNodes / 2)
350 {
351 m_containerB.Add(c.Get(i));
352 }
353
354 // upper right quadrant
355 if (i >= (uint32_t)(4 * totalNodes) / 10)
356 {
357 m_containerD.Add(c.Get(i));
358 }
359 }
360 }
361}
362
365{
366 NodeContainer nc;
367 uint32_t limit = senderId + 2;
368 for (uint32_t i = senderId - 2; i <= limit; i++)
369 {
370 // must ensure the boundaries for other topologies
371 nc.Add(c.Get(i));
372 nc.Add(c.Get(i + 10));
373 nc.Add(c.Get(i + 20));
374 nc.Add(c.Get(i - 10));
375 nc.Add(c.Get(i - 20));
376 }
377 return nc;
378}
379
380void
382{
383 uint32_t totalNodes = c.GetN();
385 uvSrc->SetAttribute("Min", DoubleValue(0));
386 uvSrc->SetAttribute("Max", DoubleValue(totalNodes / 2 - 1));
388 uvDest->SetAttribute("Min", DoubleValue(totalNodes / 2));
389 uvDest->SetAttribute("Max", DoubleValue(totalNodes));
390
391 for (uint32_t i = 0; i < totalNodes / 3; i++)
392 {
393 ApplicationSetup(c.Get(uvSrc->GetInteger()), c.Get(uvDest->GetInteger()), 0, m_totalTime);
394 }
395}
396
397void
399{
400 // UniformRandomVariable params: (Xrange, Yrange)
402 uv->SetAttribute("Min", DoubleValue(0));
403 uv->SetAttribute("Max", DoubleValue(c.GetN()));
404
405 // ExponentialRandomVariable params: (mean, upperbound)
407 ev->SetAttribute("Mean", DoubleValue(m_expMean));
408 ev->SetAttribute("Bound", DoubleValue(m_totalTime));
409
410 double start = 0.0;
411 double stop;
412 uint32_t destIndex;
413
414 for (uint32_t i = 0; i < c.GetN(); i++)
415 {
416 stop = start + ev->GetValue();
417 NS_LOG_DEBUG("Start=" << start << " Stop=" << stop);
418
419 do
420 {
421 destIndex = (uint32_t)uv->GetValue();
422 } while ((c.Get(destIndex))->GetId() == sender->GetId());
423
424 ApplicationSetup(sender, c.Get(destIndex), start, stop);
425
426 start = stop;
427
428 if (start > m_totalTime)
429 {
430 break;
431 }
432 }
433}
434
435/**
436 * Print the position of two nodes.
437 *
438 * @param client Client node.
439 * @param server Server node.
440 * @return a string with the nodes data and positions
441 */
442inline std::string
444{
445 Vector serverPos = server->GetObject<MobilityModel>()->GetPosition();
446 Vector clientPos = client->GetObject<MobilityModel>()->GetPosition();
447
448 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4>();
449 Ptr<Ipv4> ipv4Client = client->GetObject<Ipv4>();
450
451 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress(1, 0);
452 Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress(1, 0);
453
454 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal();
455 Ipv4Address ipv4AddrClient = iaddrClient.GetLocal();
456
457 std::ostringstream oss;
458 oss << "Set up Server Device " << (server->GetDevice(0))->GetAddress() << " with ip "
459 << ipv4AddrServer << " position (" << serverPos.x << "," << serverPos.y << ","
460 << serverPos.z << ")";
461
462 oss << "Set up Client Device " << (client->GetDevice(0))->GetAddress() << " with ip "
463 << ipv4AddrClient << " position (" << clientPos.x << "," << clientPos.y << ","
464 << clientPos.z << ")"
465 << "\n";
466 return oss.str();
467}
468
469void
470Experiment::ApplicationSetup(Ptr<Node> client, Ptr<Node> server, double start, double stop)
471{
472 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4>();
473
474 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress(1, 0);
475 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal();
476
477 NS_LOG_DEBUG(PrintPosition(client, server));
478
479 // Equipping the source node with OnOff Application used for sending
480 OnOffHelper onoff("ns3::UdpSocketFactory",
482 onoff.SetConstantRate(DataRate(54000000));
483 onoff.SetAttribute("PacketSize", UintegerValue(m_packetSize));
484 onoff.SetAttribute("Remote", AddressValue(InetSocketAddress(ipv4AddrServer, m_port)));
485
486 ApplicationContainer apps = onoff.Install(client);
487 apps.Start(Seconds(start));
488 apps.Stop(Seconds(stop));
489
491}
492
495 const YansWifiPhyHelper& wifiPhy,
496 const WifiMacHelper& wifiMac,
497 const YansWifiChannelHelper& wifiChannel,
498 const MobilityHelper& mobility)
499{
500 uint32_t nodeSize = m_gridSize * m_gridSize;
502 c.Create(nodeSize);
503
504 YansWifiPhyHelper phy = wifiPhy;
505 phy.SetChannel(wifiChannel.Create());
506
507 NetDeviceContainer devices = wifi.Install(phy, wifiMac, c);
508
510 Ipv4StaticRoutingHelper staticRouting;
511
513
514 if (m_enableRouting)
515 {
516 list.Add(staticRouting, 0);
517 list.Add(olsr, 10);
518 }
519
520 InternetStackHelper internet;
521
522 if (m_enableRouting)
523 {
524 internet.SetRoutingHelper(list); // has effect on the next Install ()
525 }
526 internet.Install(c);
527
528 Ipv4AddressHelper address;
529 address.SetBase("10.0.0.0", "255.255.255.0");
530
531 Ipv4InterfaceContainer ipInterfaces;
532 ipInterfaces = address.Assign(devices);
533
534 MobilityHelper mobil = mobility;
535 mobil.SetPositionAllocator("ns3::GridPositionAllocator",
536 "MinX",
537 DoubleValue(0.0),
538 "MinY",
539 DoubleValue(0.0),
540 "DeltaX",
542 "DeltaY",
544 "GridWidth",
546 "LayoutType",
547 StringValue("RowFirst"));
548
549 mobil.SetMobilityModel("ns3::ConstantPositionMobilityModel");
550
552 {
553 // Rectangle (xMin, xMax, yMin, yMax)
554 mobil.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
555 "Bounds",
556 RectangleValue(Rectangle(0, 500, 0, 500)),
557 "Speed",
558 StringValue("ns3::ConstantRandomVariable[Constant=10]"),
559 "Pause",
560 StringValue("ns3::ConstantRandomVariable[Constant=0.2]"));
561 }
562 mobil.Install(c);
563
564 if (m_scenario == 1 && m_enableRouting)
565 {
566 SelectSrcDest(c);
567 }
568 else if (m_scenario == 2)
569 {
570 // All flows begin at the same time
571 for (uint32_t i = 0; i < nodeSize - 1; i = i + 2)
572 {
573 ApplicationSetup(c.Get(i), c.Get(i + 1), 0, m_totalTime);
574 }
575 }
576 else if (m_scenario == 3)
577 {
579 // Note: these senders are hand-picked in order to ensure good coverage
580 // for 10x10 grid, basically one sender for each quadrant
581 // you might have to change these values for other grids
582 NS_LOG_DEBUG(">>>>>>>>>region A<<<<<<<<<");
584
585 NS_LOG_DEBUG(">>>>>>>>>region B<<<<<<<<<");
587
588 NS_LOG_DEBUG(">>>>>>>>>region C<<<<<<<<<");
590
591 NS_LOG_DEBUG(">>>>>>>>>region D<<<<<<<<<");
593 }
594 else if (m_scenario == 4)
595 {
596 // GenerateNeighbors(NodeContainer, uint32_t sender)
597 // Note: these senders are hand-picked in order to ensure good coverage
598 // you might have to change these values for other grids
599 NodeContainer c1;
600 NodeContainer c2;
601 NodeContainer c3;
602 NodeContainer c4;
603 NodeContainer c5;
604 NodeContainer c6;
605 NodeContainer c7;
606 NodeContainer c8;
607 NodeContainer c9;
608
609 c1 = GenerateNeighbors(c, 22);
610 c2 = GenerateNeighbors(c, 24);
611 c3 = GenerateNeighbors(c, 26);
612 c4 = GenerateNeighbors(c, 42);
613 c5 = GenerateNeighbors(c, 44);
614 c6 = GenerateNeighbors(c, 46);
615 c7 = GenerateNeighbors(c, 62);
616 c8 = GenerateNeighbors(c, 64);
617 c9 = GenerateNeighbors(c, 66);
618
619 SendMultiDestinations(c.Get(22), c1);
620 SendMultiDestinations(c.Get(24), c2);
621 SendMultiDestinations(c.Get(26), c3);
622 SendMultiDestinations(c.Get(42), c4);
623 SendMultiDestinations(c.Get(44), c5);
624 SendMultiDestinations(c.Get(46), c6);
625 SendMultiDestinations(c.Get(62), c7);
626 SendMultiDestinations(c.Get(64), c8);
627 SendMultiDestinations(c.Get(66), c9);
628 }
629
631
632 if (m_enablePcap)
633 {
634 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
635 phy.EnablePcapAll(GetOutputFileName());
636 }
637
638 if (m_enableTracing)
639 {
640 AsciiTraceHelper ascii;
641 phy.EnableAsciiAll(ascii.CreateFileStream(GetOutputFileName() + ".tr"));
642 }
643
644 FlowMonitorHelper flowmonHelper;
645
646 if (m_enableFlowMon)
647 {
648 flowmonHelper.InstallAll();
649 }
650
653
654 if (m_enableFlowMon)
655 {
656 flowmonHelper.SerializeToXmlFile((GetOutputFileName() + ".flomon"), false, false);
657 }
658
660
661 return m_output;
662}
663
664bool
665Experiment::CommandSetup(int argc, char** argv)
666{
667 // for commandline input
668 CommandLine cmd(__FILE__);
669 cmd.AddValue("packetSize", "packet size", m_packetSize);
670 cmd.AddValue("totalTime", "simulation time", m_totalTime);
671 // according to totalTime, select an appropriate samplingPeriod automatically.
672 if (m_totalTime < 1.0)
673 {
674 m_samplingPeriod = 0.1;
675 }
676 else
677 {
678 m_samplingPeriod = 1.0;
679 }
680 // or user selects a samplingPeriod.
681 cmd.AddValue("samplingPeriod", "sampling period", m_samplingPeriod);
682 cmd.AddValue("rtsThreshold", "rts threshold", m_rtsThreshold);
683 cmd.AddValue("rateManager", "type of rate", m_rateManager);
684 cmd.AddValue("outputFileName", "output filename", m_outputFileName);
685 cmd.AddValue("enableRouting", "enable Routing", m_enableRouting);
686 cmd.AddValue("enableMobility", "enable Mobility", m_enableMobility);
687 cmd.AddValue("scenario", "scenario ", m_scenario);
688
689 cmd.Parse(argc, argv);
690 return true;
691}
692
693} // unnamed namespace
694
695int
696main(int argc, char* argv[])
697{
698 Experiment experiment;
699 experiment = Experiment("multirate");
700
701 // for commandline input
702 experiment.CommandSetup(argc, argv);
703
704 std::ofstream outfile(experiment.GetOutputFileName() + ".plt");
705
706 MobilityHelper mobility;
707 Gnuplot gnuplot;
708 Gnuplot2dDataset dataset;
709
710 WifiHelper wifi;
711 WifiMacHelper wifiMac;
712 YansWifiPhyHelper wifiPhy;
714
715 wifiMac.SetType("ns3::AdhocWifiMac", "Ssid", StringValue("Testbed"));
716 wifi.SetStandard(WIFI_STANDARD_80211a);
717 wifi.SetRemoteStationManager(experiment.GetRateManager());
718
719 NS_LOG_INFO("Scenario: " << experiment.GetScenario());
720 NS_LOG_INFO("Rts Threshold: " << experiment.GetRtsThreshold());
721 NS_LOG_INFO("Name: " << experiment.GetOutputFileName());
722 NS_LOG_INFO("Rate: " << experiment.GetRateManager());
723 NS_LOG_INFO("Routing: " << experiment.IsRouting());
724 NS_LOG_INFO("Mobility: " << experiment.IsMobility());
725
726 dataset = experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel, mobility);
727
728 gnuplot.AddDataset(dataset);
729 gnuplot.GenerateOutput(outfile);
730
731 return 0;
732}
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Create a socket and prepare it for packet reception.
void AssignNeighbors(NodeContainer c)
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific conta...
void SelectSrcDest(NodeContainer c)
Sources and destinations are randomly selected such that a node may be the source for multiple destin...
std::string GetOutputFileName() const
Get the Output File Name.
NodeContainer m_containerA
Node containers for each quadrant.
NodeContainer m_containerB
Node containers for each quadrant.
std::string GetRtsThreshold() const
Get the RTS Threshold.
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId)
Generate 1-hop and 2-hop neighbors of a node in grid topology.
bool m_enablePcap
True if PCAP output is enabled.
bool m_enableTracing
True if tracing output is enabled.
uint32_t m_bytesTotal
Total number of received bytes.
bool m_enableMobility
True if mobility is enabled.
void ReceivePacket(Ptr< Socket > socket)
Receive a packet.
NodeContainer m_containerC
Node containers for each quadrant.
uint32_t GetScenario() const
Get the Scenario number.
NodeContainer m_containerD
Node containers for each quadrant.
void ApplicationSetup(Ptr< Node > client, Ptr< Node > server, double start, double stop)
Setup the application in the nodes.
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Setup the receiving socket.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
Run an experiment.
bool IsMobility() const
Check if mobility is enabled.
double m_expMean
Exponential parameter for sending packets.
bool CommandSetup(int argc, char **argv)
Setup the experiment from the command line arguments.
std::string GetRateManager() const
Get the Rate Manager.
void SendMultiDestinations(Ptr< Node > sender, NodeContainer c)
A sender node will set up a flow to each of the its neighbors in its quadrant randomly.
bool IsRouting() const
Check if routing is enabled.
a polymophic address class
Definition address.h:114
AttributeValue implementation for Address.
Definition address.h:329
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Parse command-line arguments.
Class for representing data rates.
Definition data-rate.h:78
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Helper to enable IP flow monitoring on a set of Nodes.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Class to represent a 2D points plot.
Definition gnuplot.h:105
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition gnuplot.h:359
void AddDataset(const GnuplotDataset &dataset)
Definition gnuplot.cc:785
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Definition gnuplot.cc:791
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition ipv4.h:69
a class to store IPv4 address information on an interface
Ipv4Address GetAddress() const
Get the local address.
Ipv4Address GetLocal() const
Get the local address.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Helper class that adds ns3::Ipv4ListRouting objects.
Helper class that adds ns3::Ipv4StaticRouting objects.
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 the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Helper class that adds OLSR routing to nodes.
Definition olsr-helper.h:31
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
a 2d rectangle
Definition rectangle.h:24
AttributeValue implementation for Rectangle.
Definition rectangle.h:114
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition socket.cc:61
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:49
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:872
Hold an unsigned integer type.
Definition uinteger.h:34
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
Make it easy to create and manage PHY objects for the YANS model.
void experiment(std::string queue_disc_type)
void ReceivePacket(Ptr< Socket > socket)
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...
Definition callback.h:690
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:260
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:267
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1381
@ WIFI_STANDARD_80211a
std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
Print the position of two nodes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Definition olsr.py:1
Ptr< PacketSink > sink
Pointer to the packet sink application.
Definition wifi-tcp.cc:44