examples/wifi-adhoc.cc
author Tom Henderson <tomh@tomh.org>
Thu, 02 Jul 2009 21:57:00 -0700
changeset 4646 c25ca2e38845
parent 4406 39f119de91ef
permissions -rw-r--r--
some fixes to the manual for IPv4 refactoring
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005,2006,2007 INRIA
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
2739
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    21
#include "ns3/core-module.h"
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    22
#include "ns3/common-module.h"
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    23
#include "ns3/node-module.h"
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    24
#include "ns3/helper-module.h"
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    25
#include "ns3/mobility-module.h"
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
    26
#include "ns3/contrib-module.h"
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
#include <iostream>
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    30
NS_LOG_COMPONENT_DEFINE ("Main");
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    32
using namespace ns3;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    33
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    34
class Experiment
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    36
public:
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    37
  Experiment ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    38
  Experiment (std::string name);
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
    39
  Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
    40
                        const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    41
private:
3100
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    42
  void ReceivePacket (Ptr<Socket> socket);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    43
  void SetPosition (Ptr<Node> node, Vector position);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    44
  Vector GetPosition (Ptr<Node> node);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    45
  void AdvancePosition (Ptr<Node> node);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    46
  Ptr<Socket> SetupPacketReceive (Ptr<Node> node);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    47
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    48
  uint32_t m_bytesTotal;
4061
359e0a1b5cf8 extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3912
diff changeset
    49
  Gnuplot2dDataset m_output;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    50
};
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    51
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    52
Experiment::Experiment ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    53
{}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    54
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    55
Experiment::Experiment (std::string name)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    56
  : m_output (name)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    57
{
4061
359e0a1b5cf8 extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3912
diff changeset
    58
  m_output.SetStyle (Gnuplot2dDataset::LINES);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
}
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    61
void
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    62
Experiment::SetPosition (Ptr<Node> node, Vector position)
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
{
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
    64
  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
2115
4be7e10e471e merge with Position -> Vector rename
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2084
diff changeset
    65
  mobility->SetPosition (position);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
}
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    68
Vector
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    69
Experiment::GetPosition (Ptr<Node> node)
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
{
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
    71
  Ptr<MobilityModel> mobility = node->GetObject<MobilityModel> ();
2115
4be7e10e471e merge with Position -> Vector rename
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2084
diff changeset
    72
  return mobility->GetPosition ();
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
}
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    75
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    76
Experiment::AdvancePosition (Ptr<Node> node) 
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
{
2115
4be7e10e471e merge with Position -> Vector rename
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2084
diff changeset
    78
  Vector pos = GetPosition (node);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    79
  double mbs = ((m_bytesTotal * 8.0) / 1000000);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    80
  m_bytesTotal = 0;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    81
  m_output.Add (pos.x, mbs);
2082
d041fc198aad a real test
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2081
diff changeset
    82
  pos.x += 1.0;
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
    83
  if (pos.x >= 210.0) 
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
    84
    {
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
    85
      return;
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
    86
    }
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  SetPosition (node, pos);
1971
2f9ca80a8d74 fix position printing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1964
diff changeset
    88
  //std::cout << "x="<<pos.x << std::endl;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    89
  Simulator::Schedule (Seconds (1.0), &Experiment::AdvancePosition, this, node);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
}
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
    92
void
3100
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    93
Experiment::ReceivePacket (Ptr<Socket> socket)
2068
af5f03746dbe add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2019
diff changeset
    94
{
3100
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    95
  Ptr<Packet> packet;
3103
91c6fce46125 overloaded Recv() method suggested by Gustavo
Tom Henderson <tomh@tomh.org>
parents: 3102
diff changeset
    96
  while (packet = socket->Recv ())
3100
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    97
    {
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    98
      m_bytesTotal += packet->GetSize ();
70b98532fe5c remove previous socket receive methods
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    99
    }
2068
af5f03746dbe add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2019
diff changeset
   100
}
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   102
Ptr<Socket>
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   103
Experiment::SetupPacketReceive (Ptr<Node> node)
2068
af5f03746dbe add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2019
diff changeset
   104
{
3166
f65af41d30db the TypeId for Packet sockets is PacketSocketFactory, not PacketSocket. fix bug introduced by changeset c33b6d2775b7.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3116
diff changeset
   105
  TypeId tid = TypeId::LookupByName ("ns3::PacketSocketFactory");
3116
c33b6d2775b7 Move API for socket factory to a Socket::CreateSocket () factory method
Tom Henderson <tomh@tomh.org>
parents: 3103
diff changeset
   106
  Ptr<Socket> sink = Socket::CreateSocket (node, tid);
2152
5c6c0f580aca use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2149
diff changeset
   107
  sink->Bind ();
3102
a225be367c1d more cleanup
Tom Henderson <tomh@tomh.org>
parents: 3100
diff changeset
   108
  sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this));
2068
af5f03746dbe add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2019
diff changeset
   109
  return sink;
af5f03746dbe add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2019
diff changeset
   110
}
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
4061
359e0a1b5cf8 extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3912
diff changeset
   112
Gnuplot2dDataset
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   113
Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   114
                 const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   116
  m_bytesTotal = 0;
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   117
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   118
  NodeContainer c;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   119
  c.Create (2);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
2739
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
   121
  PacketSocketHelper packetSocket;
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   122
  packetSocket.Install (c);
2739
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
   123
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   124
  YansWifiPhyHelper phy = wifiPhy;
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   125
  phy.SetChannel (wifiChannel.Create ());
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   126
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   127
  NqosWifiMacHelper mac = wifiMac;
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   128
  NetDeviceContainer devices = wifi.Install (phy, mac, c);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   129
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   130
  MobilityHelper mobility;
2592
3ebf97150166 get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2575
diff changeset
   131
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   132
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   133
  positionAlloc->Add (Vector (5.0, 0.0, 0.0));
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   134
  mobility.SetPositionAllocator (positionAlloc);
4257
3e8f8052e155 StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4061
diff changeset
   135
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   136
2995
b72805b3ca69 Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents: 2890
diff changeset
   137
  mobility.Install (c);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   139
  PacketSocketAddress socket;
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   140
  socket.SetSingleDevice(devices.Get (0)->GetIfIndex ());
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   141
  socket.SetPhysicalAddress (devices.Get (1)->GetAddress ());
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   142
  socket.SetProtocol (1);
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   143
3166
f65af41d30db the TypeId for Packet sockets is PacketSocketFactory, not PacketSocket. fix bug introduced by changeset c33b6d2775b7.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3116
diff changeset
   144
  OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   145
  onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (250)));
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   146
  onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   147
  onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   148
  onoff.SetAttribute ("PacketSize", UintegerValue (2000));
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
   149
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2784
diff changeset
   150
  ApplicationContainer apps = onoff.Install (c.Get (0));
2739
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
   151
  apps.Start (Seconds (0.5));
5234783968ff convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2700
diff changeset
   152
  apps.Stop (Seconds (250.0));
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   154
  Simulator::Schedule (Seconds (1.5), &Experiment::AdvancePosition, this, c.Get (1));
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   155
  Ptr<Socket> recvSink = SetupPacketReceive (c.Get (1));
1973
96673851351e configure correctly the ipv4 layer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1971
diff changeset
   156
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
  Simulator::Run ();
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
  Simulator::Destroy ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   160
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   161
  return m_output;
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   162
}
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   163
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   164
int main (int argc, char *argv[])
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   165
{
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   166
  // disable fragmentation
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   167
  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   168
  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   169
2575
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2559
diff changeset
   170
  CommandLine cmd;
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2559
diff changeset
   171
  cmd.Parse (argc, argv);
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   172
2152
5c6c0f580aca use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2149
diff changeset
   173
  Gnuplot gnuplot = Gnuplot ("reference-rates.png");
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   174
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   175
  Experiment experiment;
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   176
  WifiHelper wifi = WifiHelper::Default ();
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   177
  NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   178
  YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   179
  YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
4061
359e0a1b5cf8 extend gnuplot classes
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3912
diff changeset
   180
  Gnuplot2dDataset dataset;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   181
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   182
  wifiMac.SetType ("ns3::AdhocWifiMac");
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   183
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   184
  NS_LOG_DEBUG ("54");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   185
  experiment = Experiment ("54mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   186
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   187
                                "DataMode", StringValue ("wifia-54mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   188
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   189
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   190
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   191
  NS_LOG_DEBUG ("48");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   192
  experiment = Experiment ("48mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   193
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   194
                                "DataMode", StringValue ("wifia-48mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   195
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   196
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   197
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   198
  NS_LOG_DEBUG ("36");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   199
  experiment = Experiment ("36mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   200
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   201
                                "DataMode", StringValue ("wifia-36mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   202
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   203
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   204
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   205
  NS_LOG_DEBUG ("24");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   206
  experiment = Experiment ("24mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   207
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   208
                                "DataMode", StringValue ("wifia-24mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   209
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   210
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   211
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   212
  NS_LOG_DEBUG ("18");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   213
  experiment = Experiment ("18mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   214
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   215
                                "DataMode", StringValue ("wifia-18mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   216
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   217
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   218
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   219
  NS_LOG_DEBUG ("12");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   220
  experiment = Experiment ("12mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   221
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   222
                                "DataMode", StringValue ("wifia-12mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   223
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   224
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   225
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   226
  NS_LOG_DEBUG ("9");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   227
  experiment = Experiment ("9mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   228
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   229
                                "DataMode", StringValue ("wifia-9mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   230
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   231
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   232
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   233
  NS_LOG_DEBUG ("6");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   234
  experiment = Experiment ("6mb");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   235
  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   236
                                "DataMode", StringValue ("wifia-6mbs"));
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   237
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   238
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   239
2152
5c6c0f580aca use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2149
diff changeset
   240
  gnuplot.GenerateOutput (std::cout);
5c6c0f580aca use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2149
diff changeset
   241
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   242
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   243
  gnuplot = Gnuplot ("rate-control.png");
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3166
diff changeset
   244
  Config::SetDefault ("ns3::YansWifiPhy::Standard", StringValue ("holland"));
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   245
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   246
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   247
  NS_LOG_DEBUG ("arf");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   248
  experiment = Experiment ("arf");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   249
  wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   250
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   251
  gnuplot.AddDataset (dataset);
2149
6bf08d8a8eff plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2115
diff changeset
   252
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   253
  NS_LOG_DEBUG ("aarf");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   254
  experiment = Experiment ("aarf");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   255
  wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   256
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   257
  gnuplot.AddDataset (dataset);
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   258
4334
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4257
diff changeset
   259
  NS_LOG_DEBUG ("aarf-cd");
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4257
diff changeset
   260
  experiment = Experiment ("aarf-cd");
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4257
diff changeset
   261
  wifi.SetRemoteStationManager ("ns3::AarfcdWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   262
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
4334
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4257
diff changeset
   263
  gnuplot.AddDataset (dataset);
12b3fcf84fc5 bug 536: aarf-cd rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4257
diff changeset
   264
4342
a7636758695f cara rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4334
diff changeset
   265
  NS_LOG_DEBUG ("cara");
a7636758695f cara rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4334
diff changeset
   266
  experiment = Experiment ("cara");
a7636758695f cara rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4334
diff changeset
   267
  wifi.SetRemoteStationManager ("ns3::CaraWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   268
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
4342
a7636758695f cara rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4334
diff changeset
   269
  gnuplot.AddDataset (dataset);
a7636758695f cara rate control
Federico Maguolo <maguolof@dei.unipd.it>
parents: 4334
diff changeset
   270
4351
4b42ad1b0e12 output rraa simulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4342
diff changeset
   271
  NS_LOG_DEBUG ("rraa");
4b42ad1b0e12 output rraa simulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4342
diff changeset
   272
  experiment = Experiment ("rraa");
4b42ad1b0e12 output rraa simulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4342
diff changeset
   273
  wifi.SetRemoteStationManager ("ns3::RraaWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   274
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
4351
4b42ad1b0e12 output rraa simulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4342
diff changeset
   275
  gnuplot.AddDataset (dataset);
4b42ad1b0e12 output rraa simulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4342
diff changeset
   276
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   277
  NS_LOG_DEBUG ("ideal");
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   278
  experiment = Experiment ("ideal");
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   279
  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
4406
39f119de91ef Add WifiMacHelper
Mirko Banchi <mk.banchi@gmail.com>
parents: 4351
diff changeset
   280
  dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2494
diff changeset
   281
  gnuplot.AddDataset (dataset);
2152
5c6c0f580aca use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2149
diff changeset
   282
2079
673a34d2e3d7 use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2075
diff changeset
   283
  gnuplot.GenerateOutput (std::cout);
1884
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
  return 0;
6056f112404c build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   286
}