author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 17 Apr 2008 15:40:25 -0700 | |
changeset 2971 | 75780f899be3 |
parent 2965 | 4b28e9740e3b |
child 2997 | caf9d364c6fc |
permissions | -rw-r--r-- |
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); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
39 |
GnuplotDataset Run (const WifiHelper &wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
40 |
private: |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
41 |
void ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
42 |
void SetPosition (Ptr<Node> node, Vector position); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
43 |
Vector GetPosition (Ptr<Node> node); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
44 |
void AdvancePosition (Ptr<Node> node); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
45 |
Ptr<Socket> SetupPacketReceive (Ptr<Node> node); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
46 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
47 |
uint32_t m_bytesTotal; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
48 |
GnuplotDataset m_output; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
49 |
}; |
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 |
Experiment::Experiment () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
52 |
: m_output () |
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 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
58 |
m_output.SetStyle (GnuplotDataset::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 |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
93 |
Experiment::ReceivePacket (Ptr<Socket> socket, Ptr<Packet> packet, const Address &address) |
2068
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
94 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
95 |
m_bytesTotal += packet->GetSize (); |
2068
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
96 |
} |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
98 |
Ptr<Socket> |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
99 |
Experiment::SetupPacketReceive (Ptr<Node> node) |
2068
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
100 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
101 |
TypeId tid = TypeId::LookupByName ("ns3::PacketSocketFactory"); |
2257
71a58e70c671
QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2252
diff
changeset
|
102 |
Ptr<SocketFactory> socketFactory = node->GetObject<SocketFactory> (tid); |
2068
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
103 |
Ptr<Socket> sink = socketFactory->CreateSocket (); |
2152
5c6c0f580aca
use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2149
diff
changeset
|
104 |
sink->Bind (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
105 |
sink->SetRecvCallback (MakeCallback (&Experiment::ReceivePacket, this)); |
2068
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
106 |
return sink; |
af5f03746dbe
add throughput printer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2019
diff
changeset
|
107 |
} |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
109 |
GnuplotDataset |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
110 |
Experiment::Run (const WifiHelper &wifi) |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
112 |
m_bytesTotal = 0; |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
113 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
114 |
NodeContainer c; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
115 |
c.Create (2); |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
|
2739
5234783968ff
convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
117 |
PacketSocketHelper packetSocket; |
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
118 |
packetSocket.Install (c); |
2739
5234783968ff
convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
119 |
|
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
120 |
NetDeviceContainer devices = wifi.Install (c); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
121 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
122 |
MobilityHelper mobility; |
2592
3ebf97150166
get rid of CreateObjectWith
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2575
diff
changeset
|
123 |
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
124 |
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
|
125 |
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
|
126 |
mobility.SetPositionAllocator (positionAlloc); |
2615
09e459167dc3
use the right position attribute name.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2614
diff
changeset
|
127 |
mobility.SetMobilityModel ("ns3::StaticMobilityModel"); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
128 |
|
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2676
diff
changeset
|
129 |
mobility.Layout (c); |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
|
2890
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
131 |
PacketSocketAddress socket; |
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
132 |
socket.SetSingleDevice(devices.Get (0)->GetIfIndex ()); |
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
133 |
socket.SetPhysicalAddress (devices.Get (1)->GetAddress ()); |
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
134 |
socket.SetProtocol (1); |
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
135 |
|
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
onoff.SetAttribute ("PacketSize", UintegerValue (2000)); |
2890
172baa5960ff
rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents:
2887
diff
changeset
|
141 |
|
2887
9a637e6daee0
Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
142 |
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
|
143 |
apps.Start (Seconds (0.5)); |
5234783968ff
convert PacketSocket scripts to PacketSocketHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
144 |
apps.Stop (Seconds (250.0)); |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
|
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
Simulator::Run (); |
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
150 |
|
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
151 |
Simulator::Destroy (); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
152 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
153 |
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
|
154 |
} |
673a34d2e3d7
use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2075
diff
changeset
|
155 |
|
673a34d2e3d7
use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2075
diff
changeset
|
156 |
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
|
157 |
{ |
673a34d2e3d7
use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2075
diff
changeset
|
158 |
// disable fragmentation |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2890
diff
changeset
|
159 |
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
|
160 |
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
|
161 |
|
2575
1aae382e65e2
rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2559
diff
changeset
|
162 |
CommandLine cmd; |
1aae382e65e2
rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2559
diff
changeset
|
163 |
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
|
164 |
|
2152
5c6c0f580aca
use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2149
diff
changeset
|
165 |
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
|
166 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
167 |
Experiment experiment; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
168 |
WifiHelper wifi; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
169 |
GnuplotDataset dataset; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
170 |
|
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
171 |
wifi.SetMac ("ns3::AdhocWifiMac"); |
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
172 |
wifi.SetPhy ("ns3::WifiPhy"); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
173 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
174 |
NS_LOG_DEBUG ("54"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
175 |
experiment = Experiment ("54mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
176 |
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
|
177 |
"DataMode", StringValue ("wifia-54mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
178 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
179 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
180 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
181 |
NS_LOG_DEBUG ("48"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
182 |
experiment = Experiment ("48mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
183 |
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
|
184 |
"DataMode", StringValue ("wifia-48mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
185 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
186 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
187 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
188 |
NS_LOG_DEBUG ("36"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
189 |
experiment = Experiment ("36mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
190 |
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
|
191 |
"DataMode", StringValue ("wifia-36mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
192 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
193 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
194 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
195 |
NS_LOG_DEBUG ("24"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
196 |
experiment = Experiment ("24mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
197 |
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
|
198 |
"DataMode", StringValue ("wifia-24mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
199 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
200 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
201 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
202 |
NS_LOG_DEBUG ("18"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
203 |
experiment = Experiment ("18mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
204 |
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
|
205 |
"DataMode", StringValue ("wifia-18mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
206 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
207 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
208 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
209 |
NS_LOG_DEBUG ("12"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
210 |
experiment = Experiment ("12mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
211 |
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
|
212 |
"DataMode", StringValue ("wifia-12mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
213 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
214 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
215 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
216 |
NS_LOG_DEBUG ("9"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
217 |
experiment = Experiment ("9mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
218 |
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
|
219 |
"DataMode", StringValue ("wifia-9mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
220 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
221 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
222 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
223 |
NS_LOG_DEBUG ("6"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
224 |
experiment = Experiment ("6mb"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
225 |
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
|
226 |
"DataMode", StringValue ("wifia-6mbs")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
227 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
228 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
229 |
|
2152
5c6c0f580aca
use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2149
diff
changeset
|
230 |
gnuplot.GenerateOutput (std::cout); |
5c6c0f580aca
use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2149
diff
changeset
|
231 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
232 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
233 |
gnuplot = Gnuplot ("rate-control.png"); |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2890
diff
changeset
|
234 |
Config::SetDefault ("ns3::WifiPhy::Standard", StringValue ("holland")); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
235 |
|
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
236 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
237 |
NS_LOG_DEBUG ("arf"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
238 |
experiment = Experiment ("arf"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
239 |
wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
240 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
241 |
gnuplot.AddDataset (dataset); |
2149
6bf08d8a8eff
plot the goodput for each data rate separately
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2115
diff
changeset
|
242 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
243 |
NS_LOG_DEBUG ("aarf"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
244 |
experiment = Experiment ("aarf"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
245 |
wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
246 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
247 |
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
|
248 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
249 |
NS_LOG_DEBUG ("ideal"); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
250 |
experiment = Experiment ("ideal"); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
251 |
wifi.SetRemoteStationManager ("ns3::IdealWifiManager"); |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
252 |
dataset = experiment.Run (wifi); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2494
diff
changeset
|
253 |
gnuplot.AddDataset (dataset); |
2152
5c6c0f580aca
use packet sockets and generate all graphics
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2149
diff
changeset
|
254 |
|
2079
673a34d2e3d7
use the gnuplot machinery to output a set of plots
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2075
diff
changeset
|
255 |
gnuplot.GenerateOutput (std::cout); |
1884
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
256 |
|
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
257 |
return 0; |
6056f112404c
build wifi sample code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
258 |
} |