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
19#include "ns3/gnuplot.h"
20#include "ns3/command-line.h"
21#include "ns3/config.h"
22#include "ns3/uinteger.h"
23#include "ns3/boolean.h"
24#include "ns3/double.h"
25#include "ns3/string.h"
26#include "ns3/log.h"
27#include "ns3/yans-wifi-helper.h"
28#include "ns3/mobility-helper.h"
29#include "ns3/internet-stack-helper.h"
30#include "ns3/ipv4-address-helper.h"
31#include "ns3/on-off-helper.h"
32#include "ns3/yans-wifi-channel.h"
33#include "ns3/mobility-model.h"
34#include "ns3/olsr-helper.h"
35#include "ns3/ipv4-static-routing-helper.h"
36#include "ns3/ipv4-list-routing-helper.h"
37#include "ns3/rectangle.h"
38#include "ns3/flow-monitor-helper.h"
39
40using namespace ns3;
41
42NS_LOG_COMPONENT_DEFINE ("multirate");
43
79class Experiment
80{
81public:
88 Experiment (std::string name);
99 const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility);
100
108 bool CommandSetup (int argc, char **argv);
109
115 bool IsRouting ()
116 {
117 return (m_enableRouting == 1) ? 1 : 0;
118 }
125 {
126 return (m_enableMobility == 1) ? 1 : 0;
127 }
128
135 {
136 return m_scenario;
137 }
143 std::string GetRtsThreshold ()
144 {
145 return m_rtsThreshold;
146 }
152 std::string GetOutputFileName ()
153 {
154 return m_outputFileName;
155 }
161 std::string GetRateManager ()
162 {
163 return m_rateManager;
164 }
165
166private:
181
190 void ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, double stop);
215 void CheckThroughput ();
224
226
227 double m_totalTime;
228 double m_expMean;
230
237
243
253 std::string m_rtsThreshold;
254 std::string m_rateManager;
255 std::string m_outputFileName;
256};
257
259{
260}
261
262Experiment::Experiment (std::string name)
263 : m_output (name),
264 m_totalTime (0.3),
265 m_expMean (0.1),
266 //flows being exponentially distributed
267 m_samplingPeriod (0.1),
268 m_bytesTotal (0),
269 m_packetSize (2000),
270 m_gridSize (10),
271 //10x10 grid for a total of 100 nodes
272 m_nodeDistance (30),
273 m_port (5000),
274 m_scenario (4),
275 m_enablePcap (false),
276 m_enableTracing (true),
277 m_enableFlowMon (false),
278 m_enableRouting (false),
279 m_enableMobility (false),
280 m_rtsThreshold ("2200"),
281 //0 for enabling rts/cts
282 m_rateManager ("ns3::MinstrelWifiManager"),
283 m_outputFileName ("minstrel")
284{
285 m_output.SetStyle (Gnuplot2dDataset::LINES);
286}
287
290{
291 TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
292 Ptr<Socket> sink = Socket::CreateSocket (node, tid);
293 InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), m_port);
294 sink->Bind (local);
295 sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
296
297 return sink;
298}
299
300void
302{
303 Ptr<Packet> packet;
304 while ((packet = socket->Recv ()))
305 {
306 m_bytesTotal += packet->GetSize ();
307 }
308}
309
310void
312{
313 double mbs = ((m_bytesTotal * 8.0) / 1000000 / m_samplingPeriod);
314 m_bytesTotal = 0;
315 m_output.Add ((Simulator::Now ()).GetSeconds (), mbs);
316
317 //check throughput every samplingPeriod second
318 Simulator::Schedule (Seconds (m_samplingPeriod), &Experiment::CheckThroughput, this);
319}
320
321void
323{
324 uint32_t totalNodes = c.GetN ();
325 for (uint32_t i = 0; i < totalNodes; i++)
326 {
327 if ( (i % m_gridSize) <= (m_gridSize / 2 - 1))
328 {
329 //lower left quadrant
330 if ( i < totalNodes / 2 )
331 {
332 m_containerA.Add (c.Get (i));
333 }
334
335 //upper left quadrant
336 if ( i >= (uint32_t)(4 * totalNodes) / 10 )
337 {
338 m_containerC.Add (c.Get (i));
339 }
340 }
341 if ( (i % m_gridSize) >= (m_gridSize / 2 - 1))
342 {
343 //lower right quadrant
344 if ( i < totalNodes / 2 )
345 {
346 m_containerB.Add (c.Get (i));
347 }
348
349 //upper right quadrant
350 if ( i >= (uint32_t)(4 * totalNodes) / 10 )
351 {
352 m_containerD.Add (c.Get (i));
353 }
354 }
355 }
356}
357
360{
361 NodeContainer nc;
362 uint32_t limit = senderId + 2;
363 for (uint32_t i = senderId - 2; i <= limit; i++)
364 {
365 //must ensure the boundaries for other topologies
366 nc.Add (c.Get (i));
367 nc.Add (c.Get (i + 10));
368 nc.Add (c.Get (i + 20));
369 nc.Add (c.Get (i - 10));
370 nc.Add (c.Get (i - 20));
371 }
372 return nc;
373}
374
375void
377{
378 uint32_t totalNodes = c.GetN ();
379 Ptr<UniformRandomVariable> uvSrc = CreateObject<UniformRandomVariable> ();
380 uvSrc->SetAttribute ("Min", DoubleValue (0));
381 uvSrc->SetAttribute ("Max", DoubleValue (totalNodes / 2 - 1));
382 Ptr<UniformRandomVariable> uvDest = CreateObject<UniformRandomVariable> ();
383 uvDest->SetAttribute ("Min", DoubleValue (totalNodes / 2));
384 uvDest->SetAttribute ("Max", DoubleValue (totalNodes));
385
386 for (uint32_t i = 0; i < totalNodes / 3; i++)
387 {
388 ApplicationSetup (c.Get (uvSrc->GetInteger ()), c.Get (uvDest->GetInteger ()), 0, m_totalTime);
389 }
390}
391
392void
394{
395
396 // UniformRandomVariable params: (Xrange, Yrange)
397 Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
398 uv->SetAttribute ("Min", DoubleValue (0));
399 uv->SetAttribute ("Max", DoubleValue (c.GetN ()));
400
401 // ExponentialRandomVariable params: (mean, upperbound)
402 Ptr<ExponentialRandomVariable> ev = CreateObject<ExponentialRandomVariable> ();
403 ev->SetAttribute ("Mean", DoubleValue (m_expMean));
404 ev->SetAttribute ("Bound", DoubleValue (m_totalTime));
405
406 double start = 0.0, stop;
407 uint32_t destIndex;
408
409 for (uint32_t i = 0; i < c.GetN (); i++)
410 {
411 stop = start + ev->GetValue ();
412 NS_LOG_DEBUG ("Start=" << start << " Stop=" << stop);
413
414 do
415 {
416 destIndex = (uint32_t) uv->GetValue ();
417 }
418 while ( (c.Get (destIndex))->GetId () == sender->GetId ());
419
420 ApplicationSetup (sender, c.Get (destIndex), start, stop);
421
422 start = stop;
423
424 if (start > m_totalTime)
425 {
426 break;
427 }
428 }
429}
430
431static inline Vector
433{
435 return mobility->GetPosition ();
436}
437
438static inline std::string
440{
441 Vector serverPos = GetPosition (server);
442 Vector clientPos = GetPosition (client);
443
444 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4> ();
445 Ptr<Ipv4> ipv4Client = client->GetObject<Ipv4> ();
446
447 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress (1,0);
448 Ipv4InterfaceAddress iaddrClient = ipv4Client->GetAddress (1,0);
449
450 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
451 Ipv4Address ipv4AddrClient = iaddrClient.GetLocal ();
452
453 std::ostringstream oss;
454 oss << "Set up Server Device " << (server->GetDevice (0))->GetAddress ()
455 << " with ip " << ipv4AddrServer
456 << " position (" << serverPos.x << "," << serverPos.y << "," << serverPos.z << ")";
457
458 oss << "Set up Client Device " << (client->GetDevice (0))->GetAddress ()
459 << " with ip " << ipv4AddrClient
460 << " position (" << clientPos.x << "," << clientPos.y << "," << clientPos.z << ")"
461 << "\n";
462 return oss.str ();
463}
464
465void
466Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start, double stop)
467{
468 Ptr<Ipv4> ipv4Server = server->GetObject<Ipv4> ();
469
470 Ipv4InterfaceAddress iaddrServer = ipv4Server->GetAddress (1,0);
471 Ipv4Address ipv4AddrServer = iaddrServer.GetLocal ();
472
473 NS_LOG_DEBUG (PrintPosition (client, server));
474
475 // Equipping the source node with OnOff Application used for sending
476 OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), m_port)));
477 onoff.SetConstantRate (DataRate (60000000));
478 onoff.SetAttribute ("PacketSize", UintegerValue (m_packetSize));
479 onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, m_port)));
480
481 ApplicationContainer apps = onoff.Install (client);
482 apps.Start (Seconds (start));
483 apps.Stop (Seconds (stop));
484
486
487}
488
491 const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
492{
493
494
495 uint32_t nodeSize = m_gridSize * m_gridSize;
497 c.Create (nodeSize);
498
499 YansWifiPhyHelper phy = wifiPhy;
500 phy.SetChannel (wifiChannel.Create ());
501
502 WifiMacHelper mac = wifiMac;
503 NetDeviceContainer devices = wifi.Install (phy, mac, c);
504
505
507 Ipv4StaticRoutingHelper staticRouting;
508
510
511 if (m_enableRouting)
512 {
513 list.Add (staticRouting, 0);
514 list.Add (olsr, 10);
515 }
516
517 InternetStackHelper internet;
518
519 if (m_enableRouting)
520 {
521 internet.SetRoutingHelper (list); // has effect on the next Install ()
522 }
523 internet.Install (c);
524
525
527 address.SetBase ("10.0.0.0", "255.255.255.0");
528
529 Ipv4InterfaceContainer ipInterfaces;
530 ipInterfaces = address.Assign (devices);
531
532 MobilityHelper mobil = mobility;
533 mobil.SetPositionAllocator ("ns3::GridPositionAllocator",
534 "MinX", DoubleValue (0.0),
535 "MinY", DoubleValue (0.0),
536 "DeltaX", DoubleValue (m_nodeDistance),
537 "DeltaY", DoubleValue (m_nodeDistance),
538 "GridWidth", UintegerValue (m_gridSize),
539 "LayoutType", StringValue ("RowFirst"));
540
541 mobil.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
542
544 {
545 //Rectangle (xMin, xMax, yMin, yMax)
546 mobil.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
547 "Bounds", RectangleValue (Rectangle (0, 500, 0, 500)),
548 "Speed", StringValue ("ns3::ConstantRandomVariable[Constant=10]"),
549 "Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"));
550 }
551 mobil.Install (c);
552
553 if ( m_scenario == 1 && m_enableRouting)
554 {
555 SelectSrcDest (c);
556 }
557 else if ( m_scenario == 2)
558 {
559 //All flows begin at the same time
560 for (uint32_t i = 0; i < nodeSize - 1; i = i + 2)
561 {
562 ApplicationSetup (c.Get (i), c.Get (i + 1), 0, m_totalTime);
563 }
564 }
565 else if ( m_scenario == 3)
566 {
567 AssignNeighbors (c);
568 //Note: these senders are hand-picked in order to ensure good coverage
569 //for 10x10 grid, basically one sender for each quadrant
570 //you might have to change these values for other grids
571 NS_LOG_DEBUG (">>>>>>>>>region A<<<<<<<<<");
573
574 NS_LOG_DEBUG (">>>>>>>>>region B<<<<<<<<<");
576
577 NS_LOG_DEBUG (">>>>>>>>>region C<<<<<<<<<");
579
580 NS_LOG_DEBUG (">>>>>>>>>region D<<<<<<<<<");
582 }
583 else if ( m_scenario == 4)
584 {
585 //GenerateNeighbors(NodeContainer, uint32_t sender)
586 //Note: these senders are hand-picked in order to ensure good coverage
587 //you might have to change these values for other grids
588 NodeContainer c1, c2, c3, c4, c5, c6, c7, c8, c9;
589
590 c1 = GenerateNeighbors (c, 22);
591 c2 = GenerateNeighbors (c, 24);
592 c3 = GenerateNeighbors (c, 26);
593 c4 = GenerateNeighbors (c, 42);
594 c5 = GenerateNeighbors (c, 44);
595 c6 = GenerateNeighbors (c, 46);
596 c7 = GenerateNeighbors (c, 62);
597 c8 = GenerateNeighbors (c, 64);
598 c9 = GenerateNeighbors (c, 66);
599
600 SendMultiDestinations (c.Get (22), c1);
601 SendMultiDestinations (c.Get (24), c2);
602 SendMultiDestinations (c.Get (26), c3);
603 SendMultiDestinations (c.Get (42), c4);
604 SendMultiDestinations (c.Get (44), c5);
605 SendMultiDestinations (c.Get (46), c6);
606 SendMultiDestinations (c.Get (62), c7);
607 SendMultiDestinations (c.Get (64), c8);
608 SendMultiDestinations (c.Get (66), c9);
609 }
610
612
613 if (m_enablePcap)
614 {
615 phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
616 phy.EnablePcapAll (GetOutputFileName ());
617 }
618
619 if (m_enableTracing)
620 {
621 AsciiTraceHelper ascii;
622 phy.EnableAsciiAll (ascii.CreateFileStream (GetOutputFileName () + ".tr"));
623 }
624
625 FlowMonitorHelper flowmonHelper;
626
627 if (m_enableFlowMon)
628 {
629 flowmonHelper.InstallAll ();
630 }
631
632 Simulator::Stop (Seconds (m_totalTime));
633 Simulator::Run ();
634
635 if (m_enableFlowMon)
636 {
637 flowmonHelper.SerializeToXmlFile ((GetOutputFileName () + ".flomon"), false, false);
638 }
639
640 Simulator::Destroy ();
641
642 return m_output;
643}
644
645bool
646Experiment::CommandSetup (int argc, char **argv)
647{
648 // for commandline input
649 CommandLine cmd (__FILE__);
650 cmd.AddValue ("packetSize", "packet size", m_packetSize);
651 cmd.AddValue ("totalTime", "simulation time", m_totalTime);
652 // according to totalTime, select an appropriate samplingPeriod automatically.
653 if (m_totalTime < 1.0)
654 {
655 m_samplingPeriod = 0.1;
656 }
657 else
658 {
659 m_samplingPeriod = 1.0;
660 }
661 // or user selects a samplingPeriod.
662 cmd.AddValue ("samplingPeriod", "sampling period", m_samplingPeriod);
663 cmd.AddValue ("rtsThreshold", "rts threshold", m_rtsThreshold);
664 cmd.AddValue ("rateManager", "type of rate", m_rateManager);
665 cmd.AddValue ("outputFileName", "output filename", m_outputFileName);
666 cmd.AddValue ("enableRouting", "enable Routing", m_enableRouting);
667 cmd.AddValue ("enableMobility", "enable Mobility", m_enableMobility);
668 cmd.AddValue ("scenario", "scenario ", m_scenario);
669
670 cmd.Parse (argc, argv);
671 return true;
672}
673
674int main (int argc, char *argv[])
675{
676
678 experiment = Experiment ("multirate");
679
680 //for commandline input
681 experiment.CommandSetup (argc, argv);
682
683 std::ofstream outfile ((experiment.GetOutputFileName () + ".plt").c_str ());
684
686 Gnuplot gnuplot;
687 Gnuplot2dDataset dataset;
688
690 WifiMacHelper wifiMac;
691 YansWifiPhyHelper wifiPhy;
692 YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
693
694 wifiMac.SetType ("ns3::AdhocWifiMac",
695 "Ssid", StringValue ("Testbed"));
696 wifi.SetStandard (WIFI_STANDARD_80211a);
697 wifi.SetRemoteStationManager (experiment.GetRateManager ());
698
699 NS_LOG_INFO ("Scenario: " << experiment.GetScenario ());
700 NS_LOG_INFO ("Rts Threshold: " << experiment.GetRtsThreshold ());
701 NS_LOG_INFO ("Name: " << experiment.GetOutputFileName ());
702 NS_LOG_INFO ("Rate: " << experiment.GetRateManager ());
703 NS_LOG_INFO ("Routing: " << experiment.IsRouting ());
704 NS_LOG_INFO ("Mobility: " << experiment.IsMobility ());
705
706 dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel, mobility);
707
708 gnuplot.AddDataset (dataset);
709 gnuplot.GenerateOutput (outfile);
710
711 return 0;
712}
WiFi adhoc experiment class.
Definition: wifi-adhoc.cc:46
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.
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.
Definition: wifi-adhoc.cc:160
std::string m_rtsThreshold
Rts threshold.
NodeContainer m_containerD
Node containers for each quadrant.
uint32_t m_bytesTotal
The number of received bytes.
Definition: wifi-adhoc.cc:95
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.
void SelectSrcDest(NodeContainer c)
Sources and destinations are randomly selected such that a node may be the source for multiple destin...
uint32_t GetScenario()
Get the Scenario number.
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 GetRateManager()
Get the Rate Manager.
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:96
NodeContainer m_containerA
Node containers for each quadrant.
bool m_enableFlowMon
True if FlowMon is enabled.
NodeContainer m_containerB
Node containers for each quadrant.
std::string GetRtsThreshold()
Get the RTS Threshold.
bool CommandSetup(int argc, char **argv)
Setup the experiment from the command line arguments.
bool IsMobility()
Check if mobility is enabled.
Ptr< Socket > SetupPacketReceive(Ptr< Node > node)
Setup the receiving socket.
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
Scnario number.
bool IsRouting()
Check if routing is enabled.
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.
std::string GetOutputFileName()
Get the Output File Name.
a polymophic address class
Definition: address.h:91
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop(Time stop)
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.
Definition: trace-helper.h:163
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.
Definition: command-line.h:229
Class for representing data rates.
Definition: data-rate.h:89
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
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:118
void SetStyle(enum Style style)
Definition: gnuplot.cc:344
void Add(double x, double y)
Definition: gnuplot.cc:361
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition: gnuplot.h:372
void AddDataset(const GnuplotDataset &dataset)
Definition: gnuplot.cc:758
void GenerateOutput(std::ostream &os)
Writes gnuplot commands and data values to a single output stream.
Definition: gnuplot.cc:764
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
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.
Definition: ipv4-address.h:41
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
a class to store IPv4 address information on an interface
Ipv4Address GetLocal(void) const
Get the local address.
Ipv4Address GetAddress(void) 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 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())
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
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(void) 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(NodeContainer other)
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.
uint32_t GetId(void) const
Definition: node.cc:109
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:144
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
Helper class that adds OLSR routing to nodes.
Definition: olsr-helper.h:41
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:43
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
a 2d rectangle
Definition: rectangle.h:35
AttributeValue implementation for Rectangle.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
Hold variables of type string.
Definition: string.h:41
a unique identifier for an interface.
Definition: type-id.h:59
Hold an unsigned integer type.
Definition: uinteger.h:44
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value, as an unsigned integer in the specified range .
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
Definition: vector.h:324
helps to create WifiNetDevice objects
Definition: wifi-helper.h:274
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
manage and create wifi channel objects for the YANS model.
Ptr< YansWifiChannel > Create(void) 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:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
@ WIFI_STANDARD_80211a
address
Definition: first.py:44
devices
Definition: first.py:39
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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:1648
Definition: olsr.py:1
cmd
Definition: second.py:35
mac
Definition: third.py:96
wifi
Definition: third.py:99
mobility
Definition: third.py:107
phy
Definition: third.py:93
def start()
Definition: core.py:1853
#define list
static std::string PrintPosition(Ptr< Node > client, Ptr< Node > server)
static Vector GetPosition(Ptr< Node > node)
Ptr< PacketSink > sink
Definition: wifi-tcp.cc:56