A Discrete-Event Network Simulator
API
wifi-multirate.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: Duy Nguyen <duy@soe.ucsc.edu>
17  */
18 
51 #include "ns3/gnuplot.h"
52 #include "ns3/command-line.h"
53 #include "ns3/config.h"
54 #include "ns3/uinteger.h"
55 #include "ns3/boolean.h"
56 #include "ns3/double.h"
57 #include "ns3/string.h"
58 #include "ns3/log.h"
59 #include "ns3/yans-wifi-helper.h"
60 #include "ns3/mobility-helper.h"
61 #include "ns3/internet-stack-helper.h"
62 #include "ns3/ipv4-address-helper.h"
63 #include "ns3/on-off-helper.h"
64 #include "ns3/yans-wifi-channel.h"
65 #include "ns3/mobility-model.h"
66 #include "ns3/olsr-helper.h"
67 #include "ns3/ipv4-static-routing-helper.h"
68 #include "ns3/ipv4-list-routing-helper.h"
69 #include "ns3/rectangle.h"
70 #include "ns3/flow-monitor-helper.h"
71 
72 using namespace ns3;
73 
74 NS_LOG_COMPONENT_DEFINE ("multirate");
75 
76 class Experiment
77 {
78 public:
80  Experiment (std::string name);
81  Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
82  const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility);
83 
84  bool CommandSetup (int argc, char **argv);
85  bool IsRouting ()
86  {
87  return (enableRouting == 1) ? 1 : 0;
88  }
89  bool IsMobility ()
90  {
91  return (enableMobility == 1) ? 1 : 0;
92  }
93 
94  uint32_t GetScenario ()
95  {
96  return scenario;
97  }
98 
99  std::string GetRtsThreshold ()
100  {
101  return rtsThreshold;
102  }
103  std::string GetOutputFileName ()
104  {
105  return outputFileName;
106  }
107  std::string GetRateManager ()
108  {
109  return rateManager;
110  }
111 
112 private:
114  NodeContainer GenerateNeighbors (NodeContainer c, uint32_t senderId);
115 
116  void ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, double stop);
117  void AssignNeighbors (NodeContainer c);
118  void SelectSrcDest (NodeContainer c);
119  void ReceivePacket (Ptr<Socket> socket);
120  void CheckThroughput ();
121  void SendMultiDestinations (Ptr<Node> sender, NodeContainer c);
122 
123  Gnuplot2dDataset m_output;
124 
125  double totalTime;
126  double expMean;
128 
129  uint32_t bytesTotal;
130  uint32_t packetSize;
131  uint32_t gridSize;
132  uint32_t nodeDistance;
133  uint32_t port;
134  uint32_t scenario;
135 
141 
142  NodeContainer containerA, containerB, containerC, containerD;
143  std::string rtsThreshold, rateManager, outputFileName;
144 };
145 
147 {
148 }
149 
150 Experiment::Experiment (std::string name)
151  : m_output (name),
152  totalTime (0.3),
153  expMean (0.1),
154  //flows being exponentially distributed
155  samplingPeriod (0.1),
156  bytesTotal (0),
157  packetSize (2000),
158  gridSize (10),
159  //10x10 grid for a total of 100 nodes
160  nodeDistance (30),
161  port (5000),
162  scenario (4),
163  enablePcap (false),
164  enableTracing (true),
165  enableFlowMon (false),
166  enableRouting (false),
167  enableMobility (false),
168  rtsThreshold ("2200"),
169  //0 for enabling rts/cts
170  rateManager ("ns3::MinstrelWifiManager"),
171  outputFileName ("minstrel")
172 {
173  m_output.SetStyle (Gnuplot2dDataset::LINES);
174 }
175 
178 {
179  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
180  Ptr<Socket> sink = Socket::CreateSocket (node, tid);
181  InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), port);
182  sink->Bind (local);
183  sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
184 
185  return sink;
186 }
187 
188 void
190 {
191  Ptr<Packet> packet;
192  while ((packet = socket->Recv ()))
193  {
194  bytesTotal += packet->GetSize ();
195  }
196 }
197 
198 void
200 {
201  double mbs = ((bytesTotal * 8.0) / 1000000 / samplingPeriod);
202  bytesTotal = 0;
203  m_output.Add ((Simulator::Now ()).GetSeconds (), mbs);
204 
205  //check throughput every samplingPeriod second
206  Simulator::Schedule (Seconds (samplingPeriod), &Experiment::CheckThroughput, this);
207 }
208 
215 void
217 {
218  uint32_t totalNodes = c.GetN ();
219  for (uint32_t i = 0; i < totalNodes; i++)
220  {
221  if ( (i % gridSize) <= (gridSize / 2 - 1))
222  {
223  //lower left quadrant
224  if ( i < totalNodes / 2 )
225  {
226  containerA.Add (c.Get (i));
227  }
228 
229  //upper left quadrant
230  if ( i >= (uint32_t)(4 * totalNodes) / 10 )
231  {
232  containerC.Add (c.Get (i));
233  }
234  }
235  if ( (i % gridSize) >= (gridSize / 2 - 1))
236  {
237  //lower right quadrant
238  if ( i < totalNodes / 2 )
239  {
240  containerB.Add (c.Get (i));
241  }
242 
243  //upper right quadrant
244  if ( i >= (uint32_t)(4 * totalNodes) / 10 )
245  {
246  containerD.Add (c.Get (i));
247  }
248  }
249  }
250 }
251 
258 {
259  NodeContainer nc;
260  uint32_t limit = senderId + 2;
261  for (uint32_t i = senderId - 2; i <= limit; i++)
262  {
263  //must ensure the boundaries for other topologies
264  nc.Add (c.Get (i));
265  nc.Add (c.Get (i + 10));
266  nc.Add (c.Get (i + 20));
267  nc.Add (c.Get (i - 10));
268  nc.Add (c.Get (i - 20));
269  }
270  return nc;
271 }
272 
278 void
280 {
281  uint32_t totalNodes = c.GetN ();
282  Ptr<UniformRandomVariable> uvSrc = CreateObject<UniformRandomVariable> ();
283  uvSrc->SetAttribute ("Min", DoubleValue (0));
284  uvSrc->SetAttribute ("Max", DoubleValue (totalNodes / 2 - 1));
285  Ptr<UniformRandomVariable> uvDest = CreateObject<UniformRandomVariable> ();
286  uvDest->SetAttribute ("Min", DoubleValue (totalNodes / 2));
287  uvDest->SetAttribute ("Max", DoubleValue (totalNodes));
288 
289  for (uint32_t i = 0; i < totalNodes / 3; i++)
290  {
291  ApplicationSetup (c.Get (uvSrc->GetInteger ()), c.Get (uvDest->GetInteger ()), 0, totalTime);
292  }
293 }
294 
301 void
303 {
304 
305  // UniformRandomVariable params: (Xrange, Yrange)
306  Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
307  uv->SetAttribute ("Min", DoubleValue (0));
308  uv->SetAttribute ("Max", DoubleValue (c.GetN ()));
309 
310  // ExponentialRandomVariable params: (mean, upperbound)
311  Ptr<ExponentialRandomVariable> ev = CreateObject<ExponentialRandomVariable> ();
312  ev->SetAttribute ("Mean", DoubleValue (expMean));
313  ev->SetAttribute ("Bound", DoubleValue (totalTime));
314 
315  double start = 0.0, stop;
316  uint32_t destIndex;
317 
318  for (uint32_t i = 0; i < c.GetN (); i++)
319  {
320  stop = start + ev->GetValue ();
321  NS_LOG_DEBUG ("Start=" << start << " Stop=" << stop);
322 
323  do
324  {
325  destIndex = (uint32_t) uv->GetValue ();
326  }
327  while ( (c.Get (destIndex))->GetId () == sender->GetId ());
328 
329  ApplicationSetup (sender, c.Get (destIndex), start, stop);
330 
331  start = stop;
332 
333  if (start > totalTime)
334  {
335  break;
336  }
337  }
338 }
339 
340 static inline Vector
342 {
344  return mobility->GetPosition ();
345 }
346 
347 static inline std::string
349 {
350  Vector serverPos = GetPosition (server);
351  Vector clientPos = GetPosition (client);
352 
353  Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4> ();
354  Ptr<Ipv4> ipv4Client = client->GetObject<Ipv4> ();
355 
356  Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress (1,0);
357  Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress (1,0);
358 
359  Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
360  Ipv4Address ipv4AddrClient = iaddrClient.GetLocal ();
361 
362  std::ostringstream oss;
363  oss << "Set up Server Device " << (server->GetDevice (0))->GetAddress ()
364  << " with ip " << ipv4AddrServer
365  << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")";
366 
367  oss << "Set up Client Device " << (client->GetDevice (0))->GetAddress ()
368  << " with ip " << ipv4AddrClient
369  << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")"
370  << "\n";
371  return oss.str ();
372 }
373 
374 void
375 Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, double stop)
376 {
377  Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4> ();
378 
379  Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress (1,0);
380  Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
381 
382  NS_LOG_DEBUG (PrintPosition (client, server));
383 
384  // Equipping the source node with OnOff Application used for sending
385  OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), port)));
386  onoff.SetConstantRate (DataRate (60000000));
387  onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
388  onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, port)));
389 
390  ApplicationContainer apps = onoff.Install (client);
391  apps.Start (Seconds (start));
392  apps.Stop (Seconds (stop));
393 
395 
396 }
397 
400  const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
401 {
402 
403 
404  uint32_t nodeSize = gridSize * gridSize;
405  NodeContainer c;
406  c.Create (nodeSize);
407 
408  YansWifiPhyHelper phy = wifiPhy;
409  phy.SetChannel (wifiChannel.Create ());
410 
411  WifiMacHelper mac = wifiMac;
412  NetDeviceContainer devices = wifi.Install (phy, mac, c);
413 
414 
416  Ipv4StaticRoutingHelper staticRouting;
417 
419 
420  if (enableRouting)
421  {
422  list.Add (staticRouting, 0);
423  list.Add (olsr, 10);
424  }
425 
426  InternetStackHelper internet;
427 
428  if (enableRouting)
429  {
430  internet.SetRoutingHelper (list); // has effect on the next Install ()
431  }
432  internet.Install (c);
433 
434 
436  address.SetBase ("10.0.0.0", "255.255.255.0");
437 
438  Ipv4InterfaceContainer ipInterfaces;
439  ipInterfaces = address.Assign (devices);
440 
441  MobilityHelper mobil = mobility;
442  mobil.SetPositionAllocator ("ns3::GridPositionAllocator",
443  "MinX", DoubleValue (0.0),
444  "MinY", DoubleValue (0.0),
445  "DeltaX", DoubleValue (nodeDistance),
446  "DeltaY", DoubleValue (nodeDistance),
447  "GridWidth", UintegerValue (gridSize),
448  "LayoutType", StringValue ("RowFirst"));
449 
450  mobil.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
451 
453  {
454  //Rectangle (xMin, xMax, yMin, yMax)
455  mobil.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
456  "Bounds", RectangleValue (Rectangle (0, 500, 0, 500)),
457  "Speed", StringValue ("ns3::ConstantRandomVariable[Constant=10]"),
458  "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"));
459  }
460  mobil.Install (c);
461 
462  if ( scenario == 1 && enableRouting)
463  {
464  SelectSrcDest (c);
465  }
466  else if ( scenario == 2)
467  {
468  //All flows begin at the same time
469  for (uint32_t i = 0; i < nodeSize - 1; i = i + 2)
470  {
471  ApplicationSetup (c.Get (i), c.Get (i + 1), 0, totalTime);
472  }
473  }
474  else if ( scenario == 3)
475  {
476  AssignNeighbors (c);
477  //Note: these senders are hand-picked in order to ensure good coverage
478  //for 10x10 grid, basically one sender for each quadrant
479  //you might have to change these values for other grids
480  NS_LOG_DEBUG (">>>>>>>>>region A<<<<<<<<<");
482 
483  NS_LOG_DEBUG (">>>>>>>>>region B<<<<<<<<<");
485 
486  NS_LOG_DEBUG (">>>>>>>>>region C<<<<<<<<<");
488 
489  NS_LOG_DEBUG (">>>>>>>>>region D<<<<<<<<<");
491  }
492  else if ( scenario == 4)
493  {
494  //GenerateNeighbors(NodeContainer, uint32_t sender)
495  //Note: these senders are hand-picked in order to ensure good coverage
496  //you might have to change these values for other grids
497  NodeContainer c1, c2, c3, c4, c5, c6, c7, c8, c9;
498 
499  c1 = GenerateNeighbors (c, 22);
500  c2 = GenerateNeighbors (c, 24);
501  c3 = GenerateNeighbors (c, 26);
502  c4 = GenerateNeighbors (c, 42);
503  c5 = GenerateNeighbors (c, 44);
504  c6 = GenerateNeighbors (c, 46);
505  c7 = GenerateNeighbors (c, 62);
506  c8 = GenerateNeighbors (c, 64);
507  c9 = GenerateNeighbors (c, 66);
508 
509  SendMultiDestinations (c.Get (22), c1);
510  SendMultiDestinations (c.Get (24), c2);
511  SendMultiDestinations (c.Get (26), c3);
512  SendMultiDestinations (c.Get (42), c4);
513  SendMultiDestinations (c.Get (44), c5);
514  SendMultiDestinations (c.Get (46), c6);
515  SendMultiDestinations (c.Get (62), c7);
516  SendMultiDestinations (c.Get (64), c8);
517  SendMultiDestinations (c.Get (66), c9);
518  }
519 
520  CheckThroughput ();
521 
522  if (enablePcap)
523  {
524  phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
525  phy.EnablePcapAll (GetOutputFileName ());
526  }
527 
528  if (enableTracing)
529  {
530  AsciiTraceHelper ascii;
531  phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
532  }
533 
534  FlowMonitorHelper flowmonHelper;
535 
536  if (enableFlowMon)
537  {
538  flowmonHelper.InstallAll ();
539  }
540 
541  Simulator::Stop (Seconds (totalTime));
542  Simulator::Run ();
543 
544  if (enableFlowMon)
545  {
546  flowmonHelper.SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
547  }
548 
549  Simulator::Destroy ();
550 
551  return m_output;
552 }
553 
554 bool
555 Experiment::CommandSetup (int argc, char **argv)
556 {
557  // for commandline input
558  CommandLine cmd (__FILE__);
559  cmd.AddValue ("packetSize", "packet size", packetSize);
560  cmd.AddValue ("totalTime", "simulation time", totalTime);
561  // according to totalTime, select an appropriate samplingPeriod automatically.
562  if (totalTime < 1.0)
563  {
564  samplingPeriod = 0.1;
565  }
566  else
567  {
568  samplingPeriod = 1.0;
569  }
570  // or user selects a samplingPeriod.
571  cmd.AddValue ("samplingPeriod", "sampling period", samplingPeriod);
572  cmd.AddValue ("rtsThreshold", "rts threshold", rtsThreshold);
573  cmd.AddValue ("rateManager", "type of rate", rateManager);
574  cmd.AddValue ("outputFileName", "output filename", outputFileName);
575  cmd.AddValue ("enableRouting", "enable Routing", enableRouting);
576  cmd.AddValue ("enableMobility", "enable Mobility", enableMobility);
577  cmd.AddValue ("scenario", "scenario ", scenario);
578 
579  cmd.Parse (argc, argv);
580  return true;
581 }
582 
583 int main (int argc, char *argv[])
584 {
585 
587  experiment = Experiment ("multirate");
588 
589  //for commandline input
590  experiment.CommandSetup (argc, argv);
591 
592  std::ofstream outfile ((experiment.GetOutputFileName () + ".plt").c_str ());
593 
595  Gnuplot gnuplot;
596  Gnuplot2dDataset dataset;
597 
599  WifiMacHelper wifiMac;
600  YansWifiPhyHelper wifiPhy;
601  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
602 
603  wifiMac.SetType ("ns3::AdhocWifiMac",
604  "Ssid", StringValue ("Testbed"));
605  wifi.SetStandard (WIFI_STANDARD_80211a);
606  wifi.SetRemoteStationManager (experiment.GetRateManager ());
607 
608  NS_LOG_INFO ("Scenario: " << experiment.GetScenario ());
609  NS_LOG_INFO ("Rts Threshold: " << experiment.GetRtsThreshold ());
610  NS_LOG_INFO ("Name: " << experiment.GetOutputFileName ());
611  NS_LOG_INFO ("Rate: " << experiment.GetRateManager ());
612  NS_LOG_INFO ("Routing: " << experiment.IsRouting ());
613  NS_LOG_INFO ("Mobility: " << experiment.IsMobility ());
614 
615  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility);
616 
617  gnuplot.AddDataset (dataset);
618  gnuplot.GenerateOutput (outfile);
619 
620  return 0;
621 }
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
Experiment::port
uint32_t port
Definition: wifi-multirate.cc:133
Experiment::CommandSetup
bool CommandSetup(int argc, char **argv)
Definition: wifi-multirate.cc:555
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::InetSocketAddress
an Inet address class
Definition: inet-socket-address.h:41
Experiment::gridSize
uint32_t gridSize
Definition: wifi-multirate.cc:131
ns3::Gnuplot2dDataset::SetStyle
void SetStyle(enum Style style)
Definition: gnuplot.cc:342
ns3::YansWifiPhyHelper
Make it easy to create and manage PHY objects for the YANS model.
Definition: yans-wifi-helper.h:161
ns3::CommandLine
Parse command-line arguments.
Definition: command-line.h:228
PrintPosition
static std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
Definition: wifi-multirate.cc:348
Experiment::SendMultiDestinations
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.
Definition: wifi-multirate.cc:302
Experiment::GetRateManager
std::string GetRateManager()
Definition: wifi-multirate.cc:107
Experiment::enablePcap
bool enablePcap
Definition: wifi-multirate.cc:136
Experiment::packetSize
uint32_t packetSize
Definition: wifi-multirate.cc:130
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Node::GetId
uint32_t GetId(void) const
Definition: node.cc:109
Experiment::containerA
NodeContainer containerA
Definition: wifi-multirate.cc:142
Experiment::ReceivePacket
void ReceivePacket(Ptr< Socket > socket)
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ApplicationContainer::Stop
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
Definition: application-container.cc:107
ns3::Ipv4ListRoutingHelper
Helper class that adds ns3::Ipv4ListRouting objects.
Definition: ipv4-list-routing-helper.h:38
ns3::Ipv4InterfaceAddress::GetAddress
Ipv4Address GetAddress(void) const
Get the local address.
Definition: ipv4-interface-address.cc:81
ns3::WifiHelper
helps to create WifiNetDevice objects
Definition: wifi-helper.h:323
Experiment::containerB
NodeContainer containerB
Definition: wifi-multirate.cc:142
ns3::Ipv4AddressHelper
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Definition: ipv4-address-helper.h:48
ns3::MobilityHelper::SetMobilityModel
void SetMobilityModel(std::string type, 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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
Definition: mobility-helper.cc:79
Experiment::CheckThroughput
void CheckThroughput()
Definition: wifi-multirate.cc:199
ns3::MobilityHelper::Install
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Definition: mobility-helper.cc:130
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
ns3::AddressValue
AttributeValue implementation for Address.
Definition: address.h:278
ns3::RectangleValue
AttributeValue implementation for Rectangle.
Definition: rectangle.h:97
ns3::Gnuplot
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition: gnuplot.h:372
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Experiment::GetScenario
uint32_t GetScenario()
Definition: wifi-multirate.cc:94
ns3::NodeContainer::GetN
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
Definition: node-container.cc:88
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ns3::Gnuplot::GenerateOutput
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Definition: gnuplot.cc:762
third.mac
mac
Definition: third.py:99
ns3::Gnuplot2dDataset::Add
void Add(double x, double y)
Definition: gnuplot.cc:359
ns3::UniformRandomVariable::GetInteger
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value, as an unsigned integer in the specified range .
Definition: random-variable-stream.cc:193
Experiment::IsRouting
bool IsRouting()
Definition: wifi-multirate.cc:85
ns3::Gnuplot2dDataset
Class to represent a 2D points plot.
Definition: gnuplot.h:118
first.devices
devices
Definition: first.py:39
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition: node-container.cc:98
Experiment::containerC
NodeContainer containerC
Definition: wifi-multirate.cc:142
ns3::OnOffHelper::SetConstantRate
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
Definition: on-off-helper.cc:100
ns3::NodeContainer::Add
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
Definition: node-container.cc:114
ns3::Ipv4
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
ns3::Ipv4StaticRoutingHelper
Helper class that adds ns3::Ipv4StaticRouting objects.
Definition: ipv4-static-routing-helper.h:43
third.wifi
wifi
Definition: third.py:96
GetPosition
static Vector GetPosition(Ptr< Node > node)
Definition: wifi-multirate.cc:341
ns3::Ptr< Socket >
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
visualizer.core.start
def start()
Definition: core.py:1855
ns3::FlowMonitorHelper
Helper to enable IP flow monitoring on a set of Nodes.
Definition: flow-monitor-helper.h:40
ns3::YansWifiChannelHelper::Create
Ptr< YansWifiChannel > Create(void) const
Definition: yans-wifi-helper.cc:99
experiment
void experiment(std::string queue_disc_type)
Definition: cobalt-vs-codel.cc:74
ns3::OlsrHelper
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:41
Experiment::totalTime
double totalTime
Definition: wifi-multirate.cc:125
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
ns3::MobilityHelper::SetPositionAllocator
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Definition: mobility-helper.cc:47
ns3::FlowMonitorHelper::InstallAll
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
Definition: flow-monitor-helper.cc:135
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Ipv4InterfaceAddress
a class to store IPv4 address information on an interface
Definition: ipv4-interface-address.h:44
Experiment::m_output
Gnuplot2dDataset m_output
Definition: wifi-adhoc.cc:55
ns3::InternetStackHelper::Install
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Definition: internet-stack-helper.cc:366
ns3::OnOffHelper
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:43
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::AsciiTraceHelper::CreateFileStream
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.
Definition: trace-helper.cc:191
Experiment::containerD
NodeContainer containerD
Definition: wifi-multirate.cc:142
ns3::WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211a
Definition: wifi-standards.h:127
ns3::Node::GetDevice
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:144
Experiment
Helper class for UAN CW MAC example.
Definition: wifi-adhoc.cc:41
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition: ipv4-interface-container.h:55
Experiment::expMean
double expMean
Definition: wifi-multirate.cc:126
ns3::NodeContainer::Get
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Definition: node-container.cc:93
first.address
address
Definition: first.py:44
Experiment::Run
Gnuplot2dDataset Run(const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
Definition: wifi-adhoc.cc:119
Experiment::GenerateNeighbors
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId)
Generate 1-hop and 2-hop neighbors of a node in grid topology.
Definition: wifi-multirate.cc:257
second.cmd
cmd
Definition: second.py:35
ns3::OnOffHelper::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Definition: on-off-helper.cc:40
list
#define list
Definition: openflow-interface.h:47
ns3::Gnuplot::AddDataset
void AddDataset(const GnuplotDataset &dataset)
Definition: gnuplot.cc:756
Experiment::SetupPacketReceive
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
ns3::Rectangle
a 2d rectangle
Definition: rectangle.h:35
sink
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:56
Experiment::outputFileName
std::string outputFileName
Definition: wifi-multirate.cc:143
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::FlowMonitorHelper::SerializeToXmlFile
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Definition: flow-monitor-helper.cc:169
Experiment::enableMobility
bool enableMobility
Definition: wifi-multirate.cc:140
Experiment::enableTracing
bool enableTracing
Definition: wifi-multirate.cc:137
ns3::AsciiTraceHelper
Manage ASCII trace files for device models.
Definition: trace-helper.h:163
Experiment::bytesTotal
uint32_t bytesTotal
Definition: wifi-multirate.cc:129
ns3::Ipv4::GetAddress
virtual Ipv4InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Because addresses can be removed, the addressIndex is not guaranteed to be static across calls to thi...
ns3::OnOffHelper::Install
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
Definition: on-off-helper.cc:59
Experiment::enableRouting
bool enableRouting
Definition: wifi-multirate.cc:139
Experiment::SelectSrcDest
void SelectSrcDest(NodeContainer c)
Sources and destinations are randomly selected such that a node may be the source for multiple destin...
Definition: wifi-multirate.cc:279
packetSize
static const uint32_t packetSize
Definition: wifi-power-adaptation-distance.cc:113
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Experiment::scenario
uint32_t scenario
Definition: wifi-multirate.cc:134
ns3::ApplicationContainer::Start
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
Definition: application-container.cc:87
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::InternetStackHelper::SetRoutingHelper
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
Definition: internet-stack-helper.cc:175
ns3::ApplicationContainer
holds a vector of ns3::Application pointers.
Definition: application-container.h:43
ns3::Vector3D::Vector
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Definition: vector.h:324
Experiment::ApplicationSetup
void ApplicationSetup(Ptr< Node > client, Ptr< Node > server, double start, double stop)
Definition: wifi-multirate.cc:375
Experiment::GetOutputFileName
std::string GetOutputFileName()
Definition: wifi-multirate.cc:103
Experiment::rtsThreshold
std::string rtsThreshold
Definition: wifi-multirate.cc:143
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition: mobility-model.h:40
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::Ipv4InterfaceAddress::GetLocal
Ipv4Address GetLocal(void) const
Get the local address.
Definition: ipv4-interface-address.cc:74
ns3::WifiMacHelper::SetType
void SetType(std::string type, Args &&... args)
Definition: wifi-mac-helper.h:130
olsr
Definition: olsr.py:1
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::YansWifiChannelHelper
manage and create wifi channel objects for the YANS model.
Definition: yans-wifi-helper.h:37
ns3::WifiMacHelper
create MAC layers for a ns3::WifiNetDevice.
Definition: wifi-mac-helper.h:48
Experiment::samplingPeriod
double samplingPeriod
Definition: wifi-multirate.cc:127
Experiment::enableFlowMon
bool enableFlowMon
Definition: wifi-multirate.cc:138
Experiment::GetRtsThreshold
std::string GetRtsThreshold()
Definition: wifi-multirate.cc:99
Experiment::IsMobility
bool IsMobility()
Definition: wifi-multirate.cc:89
ns3::InternetStackHelper
aggregate IP/TCP/UDP functionality to existing Nodes.
Definition: internet-stack-helper.h:88
ns3::ExponentialRandomVariable::GetValue
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
Definition: random-variable-stream.cc:407
Experiment::Experiment
Experiment(std::string name)
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
Experiment::nodeDistance
uint32_t nodeDistance
Definition: wifi-multirate.cc:132
Experiment::Experiment
Experiment()
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition: mobility-helper.h:43
third.mobility
mobility
Definition: third.py:108
third.phy
phy
Definition: third.py:93
enablePcap
bool enablePcap
Definition: tcp-nsc-comparison.cc:48
port
uint16_t port
Definition: dsdv-manet.cc:45
Experiment::SetupPacketReceive
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Definition: wifi-adhoc.cc:109
Experiment::rateManager
std::string rateManager
Definition: wifi-multirate.cc:143
ns3::Socket::Recv
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
Experiment::AssignNeighbors
void AssignNeighbors(NodeContainer c)
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific conta...
Definition: wifi-multirate.cc:216