author | Yufei Cheng <yfcheng@ittc.ku.edu> |
Fri, 27 Jan 2012 15:15:48 -0800 | |
changeset 8751 | efad81f3cb47 |
parent 7733 | abd63101a73a |
child 8752 | 2da1fab73114 |
permissions | -rw-r--r-- |
7248 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2011 University of Kansas |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Justin Rohrer <rohrej@ittc.ku.edu> |
|
19 |
* |
|
20 |
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
|
21 |
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
|
22 |
* Information and Telecommunication Technology Center (ITTC) |
|
23 |
* and Department of Electrical Engineering and Computer Science |
|
24 |
* The University of Kansas Lawrence, KS USA. |
|
25 |
* |
|
26 |
* Work supported in part by NSF FIND (Future Internet Design) Program |
|
27 |
* under grant CNS-0626918 (Postmodern Internet Architecture), |
|
28 |
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI), |
|
29 |
* US Department of Defense (DoD), and ITTC at The University of Kansas. |
|
30 |
*/ |
|
31 |
||
32 |
/* |
|
33 |
* This example program allows one to run ns-3 DSDV, AODV, or OLSR under |
|
34 |
* a typical random waypoint mobility model. |
|
35 |
* |
|
36 |
* By default, the simulation runs for 200 simulated seconds, of which |
|
37 |
* the first 50 are used for start-up time. The number of nodes is 50. |
|
38 |
* Nodes move according to RandomWaypointMobilityModel with a speed of |
|
39 |
* 20 m/s and no pause time within a 300x1500 m region. The WiFi is |
|
40 |
* in ad hoc mode with a 2 Mb/s rate (802.11b) and a Friis loss model. |
|
41 |
* The transmit power is set to 7.5 dBm. |
|
42 |
* |
|
43 |
* It is possible to change the mobility and density of the network by |
|
44 |
* directly modifying the speed and the number of nodes. It is also |
|
45 |
* possible to change the characteristics of the network by changing |
|
46 |
* the transmit power (as power increases, the impact of mobility |
|
47 |
* decreases and the effective density increases). |
|
48 |
* |
|
49 |
* By default, OLSR is used, but specifying a value of 2 for the protocol |
|
50 |
* will cause AODV to be used, and specifying a value of 3 will cause |
|
51 |
* DSDV to be used. |
|
52 |
* |
|
53 |
* By default, there are 10 source/sink data pairs sending UDP data |
|
54 |
* at an application rate of 2.048 Kb/s each. This is typically done |
|
55 |
* at a rate of 4 64-byte packets per second. Application data is |
|
56 |
* started at a random time between 50 and 51 seconds and continues |
|
57 |
* to the end of the simulation. |
|
58 |
* |
|
59 |
* The program outputs a few items: |
|
60 |
* - packet receptions are notified to stdout such as: |
|
61 |
* <timestamp> <node-id> received one packet from <src-address> |
|
62 |
* - each second, the data reception statistics are tabulated and output |
|
63 |
* to a comma-separated value (csv) file |
|
64 |
* - some tracing and flow monitor configuration that used to work is |
|
65 |
* left commented inline in the program |
|
66 |
*/ |
|
67 |
||
68 |
#include <fstream> |
|
69 |
#include <iostream> |
|
70 |
#include "ns3/core-module.h" |
|
71 |
#include "ns3/network-module.h" |
|
72 |
#include "ns3/internet-module.h" |
|
73 |
#include "ns3/mobility-module.h" |
|
74 |
#include "ns3/wifi-module.h" |
|
75 |
#include "ns3/aodv-module.h" |
|
76 |
#include "ns3/olsr-module.h" |
|
77 |
#include "ns3/dsdv-module.h" |
|
8751 | 78 |
#include "ns3/dsr-module.h" |
7248 | 79 |
#include "ns3/applications-module.h" |
80 |
||
81 |
using namespace ns3; |
|
8751 | 82 |
using namespace dsr; |
7248 | 83 |
|
84 |
NS_LOG_COMPONENT_DEFINE ("manet-routing-compare"); |
|
85 |
||
86 |
class RoutingExperiment |
|
87 |
{ |
|
88 |
public: |
|
89 |
RoutingExperiment (); |
|
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
90 |
void Run (int nSinks, double txp, std::string CSVfileName); |
7248 | 91 |
//static void SetMACParam (ns3::NetDeviceContainer & devices, |
92 |
// int slotDistance); |
|
93 |
std::string CommandSetup (int argc, char **argv); |
|
94 |
||
95 |
private: |
|
96 |
Ptr<Socket> SetupPacketReceive (Ipv4Address addr, Ptr<Node> node); |
|
97 |
void ReceivePacket (Ptr<Socket> socket); |
|
98 |
void CheckThroughput (); |
|
99 |
||
100 |
uint32_t port; |
|
101 |
uint32_t bytesTotal; |
|
102 |
uint32_t packetsReceived; |
|
103 |
||
104 |
std::string m_CSVfileName; |
|
105 |
int m_nSinks; |
|
106 |
std::string m_protocolName; |
|
107 |
double m_txp; |
|
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
108 |
bool m_traceMobility; |
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
109 |
uint32_t m_protocol; |
7248 | 110 |
}; |
111 |
||
112 |
RoutingExperiment::RoutingExperiment () |
|
113 |
: port (9), |
|
114 |
bytesTotal (0), |
|
115 |
packetsReceived (0), |
|
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
116 |
m_CSVfileName ("manet-routing.output.csv"), |
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
117 |
m_traceMobility (false), |
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
118 |
m_protocol (2) // AODV |
7248 | 119 |
{ |
120 |
} |
|
121 |
||
7704
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
122 |
std::string |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
123 |
PrintReceivedPacket (Ptr<Socket> socket, Ptr<Packet> packet) |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
124 |
{ |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
125 |
SocketAddressTag tag; |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
126 |
bool found; |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
127 |
found = packet->PeekPacketTag (tag); |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
128 |
std::ostringstream oss; |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
129 |
|
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
130 |
oss << Simulator::Now ().GetSeconds () << " " << socket->GetNode ()->GetId (); |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
131 |
|
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
132 |
if (found) |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
133 |
{ |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
134 |
InetSocketAddress addr = InetSocketAddress::ConvertFrom (tag.GetAddress ()); |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
135 |
oss << " received one packet from " << addr.GetIpv4 (); |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
136 |
} |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
137 |
else |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
138 |
{ |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
139 |
oss << " received one packet!"; |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
140 |
} |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
141 |
return oss.str (); |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
142 |
} |
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
143 |
|
7248 | 144 |
void |
145 |
RoutingExperiment::ReceivePacket (Ptr<Socket> socket) |
|
146 |
{ |
|
147 |
Ptr<Packet> packet; |
|
7733
abd63101a73a
Add parenthesis in while (packet = socket->Recv ()) to make clang++ (LLVM) happy
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7704
diff
changeset
|
148 |
while ((packet = socket->Recv ())) |
7248 | 149 |
{ |
150 |
bytesTotal += packet->GetSize (); |
|
151 |
packetsReceived += 1; |
|
7704
aef733235832
Bug 1170: Formulate best practices for dealing with unused debug variables.
Andrey Mazo <mazo@iitp.ru>
parents:
7588
diff
changeset
|
152 |
NS_LOG_UNCOND (PrintReceivedPacket (socket, packet)); |
7248 | 153 |
} |
154 |
} |
|
155 |
||
156 |
void |
|
157 |
RoutingExperiment::CheckThroughput () |
|
158 |
{ |
|
159 |
double kbs = (bytesTotal * 8.0) / 1000; |
|
160 |
bytesTotal = 0; |
|
161 |
||
162 |
std::ofstream out (m_CSVfileName.c_str (), std::ios::app); |
|
163 |
||
164 |
out << (Simulator::Now ()).GetSeconds () << "," |
|
165 |
<< kbs << "," |
|
166 |
<< packetsReceived << "," |
|
167 |
<< m_nSinks << "," |
|
168 |
<< m_protocolName << "," |
|
169 |
<< m_txp << "" |
|
170 |
<< std::endl; |
|
171 |
||
172 |
out.close (); |
|
173 |
packetsReceived = 0; |
|
174 |
Simulator::Schedule (Seconds (1.0), &RoutingExperiment::CheckThroughput, this); |
|
175 |
} |
|
176 |
||
177 |
Ptr<Socket> |
|
178 |
RoutingExperiment::SetupPacketReceive (Ipv4Address addr, Ptr<Node> node) |
|
179 |
{ |
|
180 |
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); |
|
181 |
Ptr<Socket> sink = Socket::CreateSocket (node, tid); |
|
182 |
InetSocketAddress local = InetSocketAddress (addr, port); |
|
183 |
sink->Bind (local); |
|
184 |
sink->SetRecvCallback (MakeCallback (&RoutingExperiment::ReceivePacket, this)); |
|
185 |
||
186 |
return sink; |
|
187 |
} |
|
188 |
||
189 |
std::string |
|
190 |
RoutingExperiment::CommandSetup (int argc, char **argv) |
|
191 |
{ |
|
192 |
CommandLine cmd; |
|
193 |
cmd.AddValue ("CSVfileName", "The name of the CSV output file name", m_CSVfileName); |
|
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
194 |
cmd.AddValue ("traceMobility", "Enable mobility tracing", m_traceMobility); |
8751 | 195 |
cmd.AddValue ("protocol", "1=OLSR;2=AODV;3=DSDV;4=DSR", m_protocol); |
7248 | 196 |
cmd.Parse (argc, argv); |
197 |
return m_CSVfileName; |
|
198 |
} |
|
199 |
||
200 |
int |
|
201 |
main (int argc, char *argv[]) |
|
202 |
{ |
|
203 |
RoutingExperiment experiment; |
|
204 |
std::string CSVfileName = experiment.CommandSetup (argc,argv); |
|
205 |
||
206 |
//blank out the last output file and write the column headers |
|
207 |
std::ofstream out (CSVfileName.c_str ()); |
|
208 |
out << "SimulationSecond," << |
|
209 |
"ReceiveRate," << |
|
210 |
"PacketsReceived," << |
|
211 |
"NumberOfSinks," << |
|
212 |
"RoutingProtocol," << |
|
213 |
"TransmissionPower" << |
|
214 |
std::endl; |
|
215 |
out.close (); |
|
216 |
||
217 |
int nSinks = 10; |
|
218 |
double txp = 7.5; |
|
219 |
||
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
220 |
experiment.Run (nSinks, txp, CSVfileName); |
7248 | 221 |
} |
222 |
||
223 |
void |
|
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
224 |
RoutingExperiment::Run (int nSinks, double txp, std::string CSVfileName) |
7248 | 225 |
{ |
226 |
Packet::EnablePrinting (); |
|
227 |
m_nSinks = nSinks; |
|
228 |
m_txp = txp; |
|
229 |
m_CSVfileName = CSVfileName; |
|
230 |
||
231 |
int nWifis = 50; |
|
232 |
||
233 |
double TotalTime = 200.0; |
|
234 |
std::string rate ("2048bps"); |
|
235 |
std::string phyMode ("DsssRate11Mbps"); |
|
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
236 |
std::string tr_name ("manet-routing-compare"); |
7248 | 237 |
int nodeSpeed = 20; //in m/s |
238 |
int nodePause = 0; //in s |
|
239 |
m_protocolName = "protocol"; |
|
240 |
||
241 |
Config::SetDefault ("ns3::OnOffApplication::PacketSize",StringValue ("64")); |
|
242 |
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (rate)); |
|
243 |
||
244 |
//Set Non-unicastMode rate to unicast mode |
|
245 |
Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",StringValue (phyMode)); |
|
246 |
||
247 |
NodeContainer adhocNodes; |
|
248 |
adhocNodes.Create (nWifis); |
|
249 |
||
250 |
// setting up wifi phy and channel using helpers |
|
251 |
WifiHelper wifi; |
|
252 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211b); |
|
253 |
||
254 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
|
255 |
YansWifiChannelHelper wifiChannel; |
|
256 |
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
|
257 |
wifiChannel.AddPropagationLoss ("ns3::FriisPropagationLossModel"); |
|
258 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
|
259 |
||
260 |
// Add a non-QoS upper mac, and disable rate control |
|
261 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
|
262 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
|
263 |
"DataMode",StringValue (phyMode), |
|
264 |
"ControlMode",StringValue (phyMode)); |
|
265 |
||
266 |
wifiPhy.Set ("TxPowerStart",DoubleValue (txp)); |
|
267 |
wifiPhy.Set ("TxPowerEnd", DoubleValue (txp)); |
|
268 |
||
269 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
|
270 |
NetDeviceContainer adhocDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes); |
|
271 |
||
272 |
AodvHelper aodv; |
|
273 |
OlsrHelper olsr; |
|
274 |
DsdvHelper dsdv; |
|
8751 | 275 |
DsrHelper dsr; |
276 |
DsrMainHelper dsrMain; |
|
7248 | 277 |
Ipv4ListRoutingHelper list; |
8751 | 278 |
InternetStackHelper internet; |
7248 | 279 |
|
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
280 |
switch (m_protocol) |
7248 | 281 |
{ |
282 |
case 1: |
|
283 |
list.Add (olsr, 100); |
|
284 |
m_protocolName = "OLSR"; |
|
285 |
break; |
|
286 |
case 2: |
|
287 |
list.Add (aodv, 100); |
|
288 |
m_protocolName = "AODV"; |
|
289 |
break; |
|
290 |
case 3: |
|
291 |
list.Add (dsdv, 100); |
|
292 |
m_protocolName = "DSDV"; |
|
293 |
break; |
|
8751 | 294 |
case 4: |
295 |
m_protocolName = "DSR"; |
|
296 |
break; |
|
7248 | 297 |
default: |
7588
92191520182a
add protocol selection as command-line argument
Tom Henderson <tomh@tomh.org>
parents:
7587
diff
changeset
|
298 |
NS_FATAL_ERROR ("No such protocol:" << m_protocol); |
7248 | 299 |
} |
300 |
||
8751 | 301 |
if (m_protocol < 4) |
302 |
{ |
|
303 |
internet.SetRoutingHelper (list); |
|
304 |
internet.Install (adhocNodes); |
|
305 |
} |
|
306 |
else if (m_protocol == 4) |
|
307 |
{ |
|
308 |
internet.Install (adhocNodes); |
|
309 |
dsrMain.Install (dsr, adhocNodes); |
|
310 |
} |
|
7248 | 311 |
|
312 |
NS_LOG_INFO ("assigning ip address"); |
|
313 |
||
314 |
Ipv4AddressHelper addressAdhoc; |
|
315 |
addressAdhoc.SetBase ("10.1.1.0", "255.255.255.0"); |
|
316 |
Ipv4InterfaceContainer adhocInterfaces; |
|
317 |
adhocInterfaces = addressAdhoc.Assign (adhocDevices); |
|
318 |
||
319 |
MobilityHelper mobilityAdhoc; |
|
320 |
||
321 |
ObjectFactory pos; |
|
322 |
pos.SetTypeId ("ns3::RandomRectanglePositionAllocator"); |
|
323 |
pos.Set ("X", RandomVariableValue (UniformVariable (0.0, 300.0))); |
|
324 |
pos.Set ("Y", RandomVariableValue (UniformVariable (0.0, 1500.0))); |
|
325 |
||
326 |
Ptr<PositionAllocator> taPositionAlloc = pos.Create ()->GetObject<PositionAllocator> (); |
|
327 |
mobilityAdhoc.SetMobilityModel ("ns3::RandomWaypointMobilityModel", |
|
328 |
"Speed", RandomVariableValue (UniformVariable (0.0, nodeSpeed)), |
|
329 |
"Pause", RandomVariableValue (ConstantVariable (nodePause)), |
|
330 |
"PositionAllocator", PointerValue (taPositionAlloc)); |
|
331 |
mobilityAdhoc.SetPositionAllocator (taPositionAlloc); |
|
332 |
mobilityAdhoc.Install (adhocNodes); |
|
333 |
||
334 |
OnOffHelper onoff1 ("ns3::UdpSocketFactory",Address ()); |
|
335 |
onoff1.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1))); |
|
336 |
onoff1.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); |
|
337 |
||
338 |
for (int i = 0; i <= nSinks - 1; i++) |
|
339 |
{ |
|
340 |
Ptr<Socket> sink = SetupPacketReceive (adhocInterfaces.GetAddress (i), adhocNodes.Get (i)); |
|
341 |
||
342 |
AddressValue remoteAddress (InetSocketAddress (adhocInterfaces.GetAddress (i), port)); |
|
343 |
onoff1.SetAttribute ("Remote", remoteAddress); |
|
344 |
||
345 |
UniformVariable var; |
|
346 |
ApplicationContainer temp = onoff1.Install (adhocNodes.Get (i + nSinks)); |
|
347 |
temp.Start (Seconds (var.GetValue (50.0,51.0))); |
|
348 |
temp.Stop (Seconds (TotalTime)); |
|
349 |
} |
|
350 |
||
351 |
std::stringstream ss; |
|
352 |
ss << nWifis; |
|
353 |
std::string nodes = ss.str (); |
|
354 |
||
355 |
std::stringstream ss2; |
|
356 |
ss2 << nodeSpeed; |
|
357 |
std::string sNodeSpeed = ss2.str (); |
|
358 |
||
359 |
std::stringstream ss3; |
|
360 |
ss3 << nodePause; |
|
361 |
std::string sNodePause = ss3.str (); |
|
362 |
||
363 |
std::stringstream ss4; |
|
364 |
ss4 << rate; |
|
365 |
std::string sRate = ss4.str (); |
|
366 |
||
367 |
//NS_LOG_INFO ("Configure Tracing."); |
|
368 |
//tr_name = tr_name + "_" + m_protocolName +"_" + nodes + "nodes_" + sNodeSpeed + "speed_" + sNodePause + "pause_" + sRate + "rate"; |
|
369 |
||
7465
ed1e4ae79208
update manet-routing-compare example to use current tracing API
Tom Henderson <tomh@tomh.org>
parents:
7260
diff
changeset
|
370 |
//AsciiTraceHelper ascii; |
ed1e4ae79208
update manet-routing-compare example to use current tracing API
Tom Henderson <tomh@tomh.org>
parents:
7260
diff
changeset
|
371 |
//Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (tr_name + ".tr").c_str()); |
ed1e4ae79208
update manet-routing-compare example to use current tracing API
Tom Henderson <tomh@tomh.org>
parents:
7260
diff
changeset
|
372 |
//wifiPhy.EnableAsciiAll (osw); |
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
373 |
std::ofstream os; |
8751 | 374 |
os.open ((tr_name + ".mob").c_str ()); |
7587
2bfdf6e82f51
enable optional mobility tracing on example
Tom Henderson <tomh@tomh.org>
parents:
7465
diff
changeset
|
375 |
MobilityHelper::EnableAsciiAll (os); |
7248 | 376 |
|
377 |
//Ptr<FlowMonitor> flowmon; |
|
378 |
//FlowMonitorHelper flowmonHelper; |
|
379 |
//flowmon = flowmonHelper.InstallAll (); |
|
380 |
||
381 |
||
382 |
NS_LOG_INFO ("Run Simulation."); |
|
383 |
||
384 |
CheckThroughput (); |
|
385 |
||
386 |
Simulator::Stop (Seconds (TotalTime)); |
|
387 |
Simulator::Run (); |
|
388 |
||
389 |
//flowmon->SerializeToXmlFile ((tr_name + ".flowmon").c_str(), false, false); |
|
390 |
||
391 |
Simulator::Destroy (); |
|
392 |
} |
|
393 |