A Discrete-Event Network Simulator
API
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:
79  Experiment ();
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 
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.EnablePcapAll (GetOutputFileName ());
525  }
526 
527  if (enableTracing)
528  {
529  AsciiTraceHelper ascii;
530  phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
531  }
532 
533  FlowMonitorHelper flowmonHelper;
534 
535  if (enableFlowMon)
536  {
537  flowmonHelper.InstallAll ();
538  }
539 
540  Simulator::Stop (Seconds (totalTime));
541  Simulator::Run ();
542 
543  if (enableFlowMon)
544  {
545  flowmonHelper.SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
546  }
547 
548  Simulator::Destroy ();
549 
550  return m_output;
551 }
552 
553 bool
554 Experiment::CommandSetup (int argc, char **argv)
555 {
556  // for commandline input
558  cmd.AddValue ("packetSize", "packet size", packetSize);
559  cmd.AddValue ("totalTime", "simulation time", totalTime);
560  // according to totalTime, select an appropriate samplingPeriod automatically.
561  if (totalTime < 1.0)
562  {
563  samplingPeriod = 0.1;
564  }
565  else
566  {
567  samplingPeriod = 1.0;
568  }
569  // or user selects a samplingPeriod.
570  cmd.AddValue ("samplingPeriod", "sampling period", samplingPeriod);
571  cmd.AddValue ("rtsThreshold", "rts threshold", rtsThreshold);
572  cmd.AddValue ("rateManager", "type of rate", rateManager);
573  cmd.AddValue ("outputFileName", "output filename", outputFileName);
574  cmd.AddValue ("enableRouting", "enable Routing", enableRouting);
575  cmd.AddValue ("enableMobility", "enable Mobility", enableMobility);
576  cmd.AddValue ("scenario", "scenario ", scenario);
577 
578  cmd.Parse (argc, argv);
579  return true;
580 }
581 
582 int main (int argc, char *argv[])
583 {
584 
586  experiment = Experiment ("multirate");
587 
588  //for commandline input
589  experiment.CommandSetup (argc, argv);
590 
591  std::ofstream outfile ((experiment.GetOutputFileName () + ".plt").c_str ());
592 
594  Gnuplot gnuplot;
595  Gnuplot2dDataset dataset;
596 
598  WifiMacHelper wifiMac;
599  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
600  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
601 
602  wifiMac.SetType ("ns3::AdhocWifiMac",
603  "Ssid", StringValue ("Testbed"));
604  wifi.SetStandard (WIFI_PHY_STANDARD_holland);
605  wifi.SetRemoteStationManager (experiment.GetRateManager ());
606 
607  NS_LOG_INFO ("Scenario: " << experiment.GetScenario ());
608  NS_LOG_INFO ("Rts Threshold: " << experiment.GetRtsThreshold ());
609  NS_LOG_INFO ("Name: " << experiment.GetOutputFileName ());
610  NS_LOG_INFO ("Rate: " << experiment.GetRateManager ());
611  NS_LOG_INFO ("Routing: " << experiment.IsRouting ());
612  NS_LOG_INFO ("Mobility: " << experiment.IsMobility ());
613 
614  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility);
615 
616  gnuplot.AddDataset (dataset);
617  gnuplot.GenerateOutput (outfile);
618 
619  return 0;
620 }
double samplingPeriod
Definition: multirate.cc:127
Helper class for UAN CW MAC example.
bool enablePcap
Definition: multirate.cc:136
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:56
holds a vector of ns3::Application pointers.
bool enableFlowMon
Definition: multirate.cc:138
Manage ASCII trace files for device models.
Definition: trace-helper.h:161
std::string rateManager
Definition: multirate.cc:143
an Inet address class
void AssignNeighbors(NodeContainer c)
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific conta...
Definition: multirate.cc:216
NodeContainer containerA
Definition: multirate.cc:142
uint32_t gridSize
Definition: multirate.cc:131
uint32_t GetScenario()
Definition: multirate.cc:94
uint32_t GetId(void) const
Definition: node.cc:107
void CheckThroughput()
Definition: multirate.cc:199
Class to represent a 2D points plot.
Definition: gnuplot.h:117
holds a vector of std::pair of Ptr<Ipv4> and interface index.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
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: multirate.cc:302
Hold variables of type string.
Definition: string.h:41
Make it easy to create and manage PHY objects for the yans model.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
bool enablePcap
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:341
def start()
Definition: core.py:1858
void ReceivePacket(Ptr< Socket > socket)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
aggregate IP/TCP/UDP functionality to existing Nodes.
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:40
void AddDataset(const GnuplotDataset &dataset)
Definition: gnuplot.cc:756
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:280
cmd
Definition: second.py:35
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we&#39;ll use to write the traced bits. ...
uint32_t packetSize
Definition: multirate.cc:130
helps to create WifiNetDevice objects
Definition: wifi-helper.h:299
void ReceivePacket(Ptr< Socket > socket)
Definition: multirate.cc:189
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
uint16_t port
Definition: dsdv-manet.cc:45
a polymophic address class
Definition: address.h:90
Ptr< YansWifiChannel > Create(void) const
mobility
Definition: third.py:101
phy
Definition: third.py:86
AttributeValue implementation for Rectangle.
Definition: rectangle.h:97
Class for representing data rates.
Definition: data-rate.h:88
Keep track of the current position and velocity of an object.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
bool IsRouting()
Definition: multirate.cc:85
double Run(Parameters params)
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition: gnuplot.h:371
Hold an unsigned integer type.
Definition: uinteger.h:44
Vector3D Vector
Definition: vector.h:217
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:92
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Definition: gnuplot.cc:762
NodeContainer containerC
Definition: multirate.cc:142
void Add(double x, double y)
Definition: gnuplot.cc:359
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:213
#define list
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void SelectSrcDest(NodeContainer c)
Sources and destinations are randomly selected such that a node may be the source for multiple destin...
Definition: multirate.cc:279
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
NodeContainer containerD
Definition: multirate.cc:142
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string outputFileName
Definition: multirate.cc:143
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
keep track of a set of node pointers.
address
Definition: first.py:37
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
double totalTime
Definition: multirate.cc:125
bool enableMobility
Definition: multirate.cc:140
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())
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId)
Generate 1-hop and 2-hop neighbors of a node in grid topology.
Definition: multirate.cc:257
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Helper to enable IP flow monitoring on a set of Nodes.
Gnuplot2dDataset m_output
Definition: multirate.cc:123
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
Definition: olsr.py:1
void SetStyle(enum Style style)
Definition: gnuplot.cc:342
double expMean
Definition: multirate.cc:126
bool enableTracing
Definition: multirate.cc:137
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), 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(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
wifi
Definition: third.py:89
Helper class used to assign positions and mobility models to nodes.
void ApplicationSetup(Ptr< Node > client, Ptr< Node > server, double start, double stop)
Definition: multirate.cc:375
bool enableRouting
Definition: multirate.cc:139
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
AttributeValue implementation for Address.
Definition: address.h:278
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
void experiment(std::string queue_disc_type)
a class to store IPv4 address information on an interface
Helper class that adds ns3::Ipv4StaticRouting objects.
uint32_t scenario
Definition: multirate.cc:134
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...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:272
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1062
static std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
Definition: multirate.cc:348
uint32_t bytesTotal
Definition: multirate.cc:129
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
std::string GetOutputFileName()
Definition: multirate.cc:103
std::string GetRtsThreshold()
Definition: multirate.cc:99
Ipv4Address GetLocal(void) const
Get the local address.
std::string rtsThreshold
Definition: multirate.cc:143
Helper class that adds ns3::Ipv4ListRouting objects.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:309
bool CommandSetup(int argc, char **argv)
Definition: multirate.cc:554
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static const uint32_t packetSize
devices
Definition: first.py:32
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
std::string GetRateManager()
Definition: multirate.cc:107
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
bool IsMobility()
Definition: multirate.cc:89
a unique identifier for an interface.
Definition: type-id.h:58
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Definition: multirate.cc:177
a 2d rectangle
Definition: rectangle.h:34
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
uint32_t port
Definition: multirate.cc:133
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
NodeContainer containerB
Definition: multirate.cc:142
uint32_t nodeDistance
Definition: multirate.cc:132