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
28using namespace ns3;
29
30NS_LOG_COMPONENT_DEFINE("multirate");
31
32/**
33 * WiFi multirate experiment class.
34 *
35 * It handles the creation and run of an experiment.
36 *
37 * Scenarios: 100 nodes, multiple simultaneous flows, multi-hop ad hoc, routing,
38 * and mobility
39 *
40 * QUICK INSTRUCTIONS:
41 *
42 * To optimize build:
43 * ./ns3 configure -d optimized
44 * ./ns3
45 *
46 * To compile:
47 * ./ns3 run wifi-multirate
48 *
49 * To compile with command line(useful for varying parameters):
50 * ./ns3 run "wifi-multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager"
51 *
52 * To turn on NS_LOG:
53 * export NS_LOG=multirate=level_all
54 * (can only view log if built with ./ns3 configure -d debug)
55 *
56 * To debug:
57 * ./ns3 shell
58 * gdb ./build/debug/examples/wireless/wifi-multirate
59 *
60 * To view pcap files:
61 * tcpdump -nn -tt -r filename.pcap
62 *
63 * To monitor the files:
64 * tail -f filename.pcap
65 *
66 */
67class Experiment
68{
69 public:
71 /**
72 * \brief Construct a new Experiment object
73 *
74 * \param name The name of the experiment.
75 */
76 Experiment(std::string name);
77 /**
78 * Run an experiment.
79 * \param wifi The WifiHelper class.
80 * \param wifiPhy The YansWifiPhyHelper class.
81 * \param wifiMac The WifiMacHelper class.
82 * \param wifiChannel The YansWifiChannelHelper class.
83 * \param mobility The MobilityHelper class.
84 * \return a 2D dataset of the experiment data.
85 */
87 const YansWifiPhyHelper& wifiPhy,
88 const WifiMacHelper& wifiMac,
89 const YansWifiChannelHelper& wifiChannel,
90 const MobilityHelper& mobility);
91
92 /**
93 * \brief Setup the experiment from the command line arguments.
94 *
95 * \param argc The argument count.
96 * \param argv The argument vector.
97 * \return true
98 */
99 bool CommandSetup(int argc, char** argv);
100
101 /**
102 * \brief Check if routing is enabled.
103 *
104 * \return true if routing is enabled.
105 */
106 bool IsRouting() const
107 {
108 return m_enableRouting;
109 }
110
111 /**
112 * \brief Check if mobility is enabled.
113 *
114 * \return true if mobility is enabled.
115 */
116 bool IsMobility() const
117 {
118 return m_enableMobility;
119 }
120
121 /**
122 * \brief Get the Scenario number.
123 *
124 * \return the scenario number.
125 */
127 {
128 return m_scenario;
129 }
130
131 /**
132 * \brief Get the RTS Threshold.
133 *
134 * \return the RTS Threshold.
135 */
136 std::string GetRtsThreshold() const
137 {
138 return m_rtsThreshold;
139 }
140
141 /**
142 * \brief Get the Output File Name.
143 *
144 * \return the Output File Name.
145 */
146 std::string GetOutputFileName() const
147 {
148 return m_outputFileName;
149 }
150
151 /**
152 * \brief Get the Rate Manager.
153 *
154 * \return the Rate Manager.
155 */
156 std::string GetRateManager() const
157 {
158 return m_rateManager;
159 }
160
161 private:
162 /**
163 * \brief Setup the receiving socket.
164 *
165 * \param node The receiving node.
166 * \return the Rx socket.
167 */
169 /**
170 * Generate 1-hop and 2-hop neighbors of a node in grid topology
171 * \param c The node container.
172 * \param senderId The sender ID.
173 * \return the neighbor nodes.
174 */
176
177 /**
178 * \brief Setup the application in the nodes.
179 *
180 * \param client Client node.
181 * \param server Server node.
182 * \param start Start time.
183 * \param stop Stop time.
184 */
185 void ApplicationSetup(Ptr<Node> client, Ptr<Node> server, double start, double stop);
186 /**
187 * Take the grid map, divide it into 4 quadrants
188 * Assign all nodes from each quadrant to a specific container
189 *
190 * \param c The node container.
191 */
193 /**
194 * Sources and destinations are randomly selected such that a node
195 * may be the source for multiple destinations and a node maybe a destination
196 * for multiple sources.
197 *
198 * \param c The node container.
199 */
201 /**
202 * \brief Receive a packet.
203 *
204 * \param socket The receiving socket.
205 */
207 /**
208 * \brief Calculate the throughput.
209 */
210 void CheckThroughput();
211 /**
212 * A sender node will set up a flow to each of the its neighbors
213 * in its quadrant randomly. All the flows are exponentially distributed.
214 *
215 * \param sender The sender node.
216 * \param c The node neighbors.
217 */
219
220 Gnuplot2dDataset m_output; //!< Output dataset.
221
222 double m_totalTime; //!< Total experiment time.
223 double m_expMean; //!< Exponential parameter for sending packets.
224 double m_samplingPeriod; //!< Sampling period.
225
226 uint32_t m_bytesTotal; //!< Total number of received bytes.
227 uint32_t m_packetSize; //!< Packet size.
228 uint32_t m_gridSize; //!< Grid size.
229 uint32_t m_nodeDistance; //!< Node distance.
230 uint32_t m_port; //!< Listening port.
231 uint32_t m_scenario; //!< Scenario number.
232
233 bool m_enablePcap; //!< True if PCAP output is enabled.
234 bool m_enableTracing; //!< True if tracing output is enabled.
235 bool m_enableFlowMon; //!< True if FlowMon is enabled.
236 bool m_enableRouting; //!< True if routing is enabled.
237 bool m_enableMobility; //!< True if mobility is enabled.
238
239 /**
240 * Node containers for each quadrant.
241 * @{
242 */
247 /** @} */
248 std::string m_rtsThreshold; //!< Rts threshold.
249 std::string m_rateManager; //!< Rate manager.
250 std::string m_outputFileName; //!< Output file name.
251};
252
254{
255}
256
257Experiment::Experiment(std::string name)
258 : m_output(name),
259 m_totalTime(0.3),
260 m_expMean(0.1),
261 // flows being exponentially distributed
262 m_samplingPeriod(0.1),
263 m_bytesTotal(0),
264 m_packetSize(2000),
265 m_gridSize(10),
266 // 10x10 grid for a total of 100 nodes
267 m_nodeDistance(30),
268 m_port(5000),
269 m_scenario(4),
270 m_enablePcap(false),
271 m_enableTracing(true),
272 m_enableFlowMon(false),
273 m_enableRouting(false),
274 m_enableMobility(false),
275 m_rtsThreshold("2200"),
276 // 0 for enabling rts/cts
277 m_rateManager("ns3::MinstrelWifiManager"),
278 m_outputFileName("minstrel")
279{
281}
282
285{
286 TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory");
289 sink->Bind(local);
290 sink->SetRecvCallback(MakeCallback(&Experiment::ReceivePacket, this));
291
292 return sink;
293}
294
295void
297{
298 Ptr<Packet> packet;
299 while ((packet = socket->Recv()))
300 {
301 m_bytesTotal += packet->GetSize();
302 }
303}
304
305void
307{
308 double mbs = ((m_bytesTotal * 8.0) / 1000000 / m_samplingPeriod);
309 m_bytesTotal = 0;
310 m_output.Add((Simulator::Now()).GetSeconds(), mbs);
311
312 // check throughput every samplingPeriod second
314}
315
316void
318{
319 uint32_t totalNodes = c.GetN();
320 for (uint32_t i = 0; i < totalNodes; i++)
321 {
322 if ((i % m_gridSize) <= (m_gridSize / 2 - 1))
323 {
324 // lower left quadrant
325 if (i < totalNodes / 2)
326 {
327 m_containerA.Add(c.Get(i));
328 }
329
330 // upper left quadrant
331 if (i >= (uint32_t)(4 * totalNodes) / 10)
332 {
333 m_containerC.Add(c.Get(i));
334 }
335 }
336 if ((i % m_gridSize) >= (m_gridSize / 2 - 1))
337 {
338 // lower right quadrant
339 if (i < totalNodes / 2)
340 {
341 m_containerB.Add(c.Get(i));
342 }
343
344 // upper right quadrant
345 if (i >= (uint32_t)(4 * totalNodes) / 10)
346 {
347 m_containerD.Add(c.Get(i));
348 }
349 }
350 }
351}
352
355{
356 NodeContainer nc;
357 uint32_t limit = senderId + 2;
358 for (uint32_t i = senderId - 2; i <= limit; i++)
359 {
360 // must ensure the boundaries for other topologies
361 nc.Add(c.Get(i));
362 nc.Add(c.Get(i + 10));
363 nc.Add(c.Get(i + 20));
364 nc.Add(c.Get(i - 10));
365 nc.Add(c.Get(i - 20));
366 }
367 return nc;
368}
369
370void
372{
373 uint32_t totalNodes = c.GetN();
375 uvSrc->SetAttribute("Min", DoubleValue(0));
376 uvSrc->SetAttribute("Max", DoubleValue(totalNodes / 2 - 1));
378 uvDest->SetAttribute("Min", DoubleValue(totalNodes / 2));
379 uvDest->SetAttribute("Max", DoubleValue(totalNodes));
380
381 for (uint32_t i = 0; i < totalNodes / 3; i++)
382 {
383 ApplicationSetup(c.Get(uvSrc->GetInteger()), c.Get(uvDest->GetInteger()), 0, m_totalTime);
384 }
385}
386
387void
389{
390 // UniformRandomVariable params: (Xrange, Yrange)
392 uv->SetAttribute("Min", DoubleValue(0));
393 uv->SetAttribute("Max", DoubleValue(c.GetN()));
394
395 // ExponentialRandomVariable params: (mean, upperbound)
397 ev->SetAttribute("Mean", DoubleValue(m_expMean));
398 ev->SetAttribute("Bound", DoubleValue(m_totalTime));
399
400 double start = 0.0;
401 double stop;
402 uint32_t destIndex;
403
404 for (uint32_t i = 0; i < c.GetN(); i++)
405 {
406 stop = start + ev->GetValue();
407 NS_LOG_DEBUG("Start=" << start << " Stop=" << stop);
408
409 do
410 {
411 destIndex = (uint32_t)uv->GetValue();
412 } while ((c.Get(destIndex))->GetId() == sender->GetId());
413
414 ApplicationSetup(sender, c.Get(destIndex), start, stop);
415
416 start = stop;
417
418 if (start > m_totalTime)
419 {
420 break;
421 }
422 }
423}
424
425/**
426 * Print the position of two nodes.
427 *
428 * \param client Client node.
429 * \param server Server node.
430 * \return a string with the nodes data and positions
431 */
432static inline std::string
434{
435 Vector serverPos = server->GetObject<MobilityModel>()->GetPosition();
436 Vector clientPos = client->GetObject<MobilityModel>()->GetPosition();
437
438 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4>();
439 Ptr<Ipv4> ipv4Client = client->GetObject<Ipv4>();
440
441 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress(1, 0);
442 Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress(1, 0);
443
444 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal();
445 Ipv4Address ipv4AddrClient = iaddrClient.GetLocal();
446
447 std::ostringstream oss;
448 oss << "Set up Server Device " << (server->GetDevice(0))->GetAddress() << " with ip "
449 << ipv4AddrServer << " position (" << serverPos.x << "," << serverPos.y << ","
450 << serverPos.z << ")";
451
452 oss << "Set up Client Device " << (client->GetDevice(0))->GetAddress() << " with ip "
453 << ipv4AddrClient << " position (" << clientPos.x << "," << clientPos.y << ","
454 << clientPos.z << ")"
455 << "\n";
456 return oss.str();
457}
458
459void
460Experiment::ApplicationSetup(Ptr<Node> client, Ptr<Node> server, double start, double stop)
461{
462 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4>();
463
464 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress(1, 0);
465 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal();
466
467 NS_LOG_DEBUG(PrintPosition(client, server));
468
469 // Equipping the source node with OnOff Application used for sending
470 OnOffHelper onoff("ns3::UdpSocketFactory",
472 onoff.SetConstantRate(DataRate(54000000));
473 onoff.SetAttribute("PacketSize", UintegerValue(m_packetSize));
474 onoff.SetAttribute("Remote", AddressValue(InetSocketAddress(ipv4AddrServer, m_port)));
475
476 ApplicationContainer apps = onoff.Install(client);
477 apps.Start(Seconds(start));
478 apps.Stop(Seconds(stop));
479
481}
482
485 const YansWifiPhyHelper& wifiPhy,
486 const WifiMacHelper& wifiMac,
487 const YansWifiChannelHelper& wifiChannel,
488 const MobilityHelper& mobility)
489{
490 uint32_t nodeSize = m_gridSize * m_gridSize;
492 c.Create(nodeSize);
493
494 YansWifiPhyHelper phy = wifiPhy;
495 phy.SetChannel(wifiChannel.Create());
496
497 NetDeviceContainer devices = wifi.Install(phy, wifiMac, c);
498
500 Ipv4StaticRoutingHelper staticRouting;
501
503
504 if (m_enableRouting)
505 {
506 list.Add(staticRouting, 0);
507 list.Add(olsr, 10);
508 }
509
510 InternetStackHelper internet;
511
512 if (m_enableRouting)
513 {
514 internet.SetRoutingHelper(list); // has effect on the next Install ()
515 }
516 internet.Install(c);
517
518 Ipv4AddressHelper address;
519 address.SetBase("10.0.0.0", "255.255.255.0");
520
521 Ipv4InterfaceContainer ipInterfaces;
522 ipInterfaces = address.Assign(devices);
523
524 MobilityHelper mobil = mobility;
525 mobil.SetPositionAllocator("ns3::GridPositionAllocator",
526 "MinX",
527 DoubleValue(0.0),
528 "MinY",
529 DoubleValue(0.0),
530 "DeltaX",
532 "DeltaY",
534 "GridWidth",
536 "LayoutType",
537 StringValue("RowFirst"));
538
539 mobil.SetMobilityModel("ns3::ConstantPositionMobilityModel");
540
542 {
543 // Rectangle (xMin, xMax, yMin, yMax)
544 mobil.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
545 "Bounds",
546 RectangleValue(Rectangle(0, 500, 0, 500)),
547 "Speed",
548 StringValue("ns3::ConstantRandomVariable[Constant=10]"),
549 "Pause",
550 StringValue("ns3::ConstantRandomVariable[Constant=0.2]"));
551 }
552 mobil.Install(c);
553
554 if (m_scenario == 1 && m_enableRouting)
555 {
556 SelectSrcDest(c);
557 }
558 else if (m_scenario == 2)
559 {
560 // All flows begin at the same time
561 for (uint32_t i = 0; i < nodeSize - 1; i = i + 2)
562 {
563 ApplicationSetup(c.Get(i), c.Get(i + 1), 0, m_totalTime);
564 }
565 }
566 else if (m_scenario == 3)
567 {
569 // Note: these senders are hand-picked in order to ensure good coverage
570 // for 10x10 grid, basically one sender for each quadrant
571 // you might have to change these values for other grids
572 NS_LOG_DEBUG(">>>>>>>>>region A<<<<<<<<<");
574
575 NS_LOG_DEBUG(">>>>>>>>>region B<<<<<<<<<");
577
578 NS_LOG_DEBUG(">>>>>>>>>region C<<<<<<<<<");
580
581 NS_LOG_DEBUG(">>>>>>>>>region D<<<<<<<<<");
583 }
584 else if (m_scenario == 4)
585 {
586 // GenerateNeighbors(NodeContainer, uint32_t sender)
587 // Note: these senders are hand-picked in order to ensure good coverage
588 // you might have to change these values for other grids
589 NodeContainer c1;
590 NodeContainer c2;
591 NodeContainer c3;
592 NodeContainer c4;
593 NodeContainer c5;
594 NodeContainer c6;
595 NodeContainer c7;
596 NodeContainer c8;
597 NodeContainer c9;
598
599 c1 = GenerateNeighbors(c, 22);
600 c2 = GenerateNeighbors(c, 24);
601 c3 = GenerateNeighbors(c, 26);
602 c4 = GenerateNeighbors(c, 42);
603 c5 = GenerateNeighbors(c, 44);
604 c6 = GenerateNeighbors(c, 46);
605 c7 = GenerateNeighbors(c, 62);
606 c8 = GenerateNeighbors(c, 64);
607 c9 = GenerateNeighbors(c, 66);
608
609 SendMultiDestinations(c.Get(22), c1);
610 SendMultiDestinations(c.Get(24), c2);
611 SendMultiDestinations(c.Get(26), c3);
612 SendMultiDestinations(c.Get(42), c4);
613 SendMultiDestinations(c.Get(44), c5);
614 SendMultiDestinations(c.Get(46), c6);
615 SendMultiDestinations(c.Get(62), c7);
616 SendMultiDestinations(c.Get(64), c8);
617 SendMultiDestinations(c.Get(66), c9);
618 }
619
621
622 if (m_enablePcap)
623 {
624 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
625 phy.EnablePcapAll(GetOutputFileName());
626 }
627
628 if (m_enableTracing)
629 {
630 AsciiTraceHelper ascii;
631 phy.EnableAsciiAll(ascii.CreateFileStream(GetOutputFileName() + ".tr"));
632 }
633
634 FlowMonitorHelper flowmonHelper;
635
636 if (m_enableFlowMon)
637 {
638 flowmonHelper.InstallAll();
639 }
640
643
644 if (m_enableFlowMon)
645 {
646 flowmonHelper.SerializeToXmlFile((GetOutputFileName() + ".flomon"), false, false);
647 }
648
650
651 return m_output;
652}
653
654bool
655Experiment::CommandSetup(int argc, char** argv)
656{
657 // for commandline input
658 CommandLine cmd(__FILE__);
659 cmd.AddValue("packetSize", "packet size", m_packetSize);
660 cmd.AddValue("totalTime", "simulation time", m_totalTime);
661 // according to totalTime, select an appropriate samplingPeriod automatically.
662 if (m_totalTime < 1.0)
663 {
664 m_samplingPeriod = 0.1;
665 }
666 else
667 {
668 m_samplingPeriod = 1.0;
669 }
670 // or user selects a samplingPeriod.
671 cmd.AddValue("samplingPeriod", "sampling period", m_samplingPeriod);
672 cmd.AddValue("rtsThreshold", "rts threshold", m_rtsThreshold);
673 cmd.AddValue("rateManager", "type of rate", m_rateManager);
674 cmd.AddValue("outputFileName", "output filename", m_outputFileName);
675 cmd.AddValue("enableRouting", "enable Routing", m_enableRouting);
676 cmd.AddValue("enableMobility", "enable Mobility", m_enableMobility);
677 cmd.AddValue("scenario", "scenario ", m_scenario);
678
679 cmd.Parse(argc, argv);
680 return true;
681}
682
683int
684main(int argc, char* argv[])
685{
687 experiment = Experiment("multirate");
688
689 // for commandline input
690 experiment.CommandSetup(argc, argv);
691
692 std::ofstream outfile(experiment.GetOutputFileName() + ".plt");
693
694 MobilityHelper mobility;
695 Gnuplot gnuplot;
696 Gnuplot2dDataset dataset;
697
698 WifiHelper wifi;
699 WifiMacHelper wifiMac;
700 YansWifiPhyHelper wifiPhy;
702
703 wifiMac.SetType("ns3::AdhocWifiMac", "Ssid", StringValue("Testbed"));
704 wifi.SetStandard(WIFI_STANDARD_80211a);
705 wifi.SetRemoteStationManager(experiment.GetRateManager());
706
707 NS_LOG_INFO("Scenario: " << experiment.GetScenario());
708 NS_LOG_INFO("Rts Threshold: " << experiment.GetRtsThreshold());
709 NS_LOG_INFO("Name: " << experiment.GetOutputFileName());
710 NS_LOG_INFO("Rate: " << experiment.GetRateManager());
711 NS_LOG_INFO("Routing: " << experiment.IsRouting());
712 NS_LOG_INFO("Mobility: " << experiment.IsMobility());
713
714 dataset = experiment.Run(wifi, wifiPhy, wifiMac, wifiChannel, mobility);
715
716 gnuplot.AddDataset(dataset);
717 gnuplot.GenerateOutput(outfile);
718
719 return 0;
720}
WiFi adhoc experiment class.
Definition wifi-adhoc.cc:34
void ApplicationSetup(Ptr< Node > client, Ptr< Node > server, double start, double stop)
Setup the application in the nodes.
bool m_enableTracing
True if tracing output is enabled.
std::string GetRtsThreshold() const
Get the RTS Threshold.
bool m_enableMobility
True if mobility is enabled.
uint32_t m_packetSize
Packet size.
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
Run an experiment.
std::string m_rtsThreshold
Rts threshold.
uint32_t GetScenario() const
Get the Scenario number.
NodeContainer m_containerD
Node containers for each quadrant.
uint32_t m_bytesTotal
The number of received bytes.
Definition wifi-adhoc.cc:86
void AssignNeighbors(NodeContainer c)
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific conta...
std::string m_rateManager
Rate manager.
std::string GetRateManager() const
Get the Rate Manager.
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.
bool m_enableRouting
True if routing is enabled.
void ReceivePacket(Ptr< Socket > socket)
Receive a packet.
void CheckThroughput()
Calculate the throughput.
NodeContainer m_containerC
Node containers for each quadrant.
double m_expMean
Exponential parameter for sending packets.
std::string m_outputFileName
Output file name.
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId)
Generate 1-hop and 2-hop neighbors of a node in grid topology.
Gnuplot2dDataset m_output
The output dataset.
Definition wifi-adhoc.cc:87
NodeContainer m_containerA
Node containers for each quadrant.
bool m_enableFlowMon
True if FlowMon is enabled.
NodeContainer m_containerB
Node containers for each quadrant.
bool CommandSetup(int argc, char **argv)
Setup the experiment from the command line arguments.
bool IsMobility() const
Check if mobility is enabled.
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Setup the receiving socket.
bool IsRouting() const
Check if routing is enabled.
uint32_t m_port
Listening port.
uint32_t m_nodeDistance
Node distance.
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.
uint32_t m_scenario
Scenario number.
Experiment(std::string name)
Construct a new Experiment object.
double m_samplingPeriod
Sampling period.
uint32_t m_gridSize
Grid size.
double m_totalTime
Total experiment time.
bool m_enablePcap
True if PCAP output is enabled.
a polymophic address class
Definition address.h:90
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
void SetStyle(Style style)
Definition gnuplot.cc:348
void Add(double x, double y)
Definition gnuplot.cc:366
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.
void Add(const Ipv4RoutingHelper &routing, int16_t priority)
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.
a 2d rectangle
Definition rectangle.h:24
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
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:48
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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
@ WIFI_STANDARD_80211a
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...
Definition callback.h:684
Definition olsr.py:1
#define list
static std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
Print the position of two nodes.
Ptr< PacketSink > sink
Pointer to the packet sink application.
Definition wifi-tcp.cc:44