OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Yufei Cheng | 3 * Copyright (c) 2011 Yufei Cheng |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #endif | 75 #endif |
76 | 76 |
77 SeedManager::SetSeed (99); | 77 SeedManager::SetSeed (99); |
78 SeedManager::SetRun (1); | 78 SeedManager::SetRun (1); |
79 | 79 |
80 double totalTime = 1000.0; | 80 double totalTime = 1000.0; |
81 double dataTime = 900.0; | 81 double dataTime = 900.0; |
82 double dataStart = 50.0; | 82 double dataStart = 50.0; |
83 uint32_t nWifis = 50; | 83 uint32_t nWifis = 50; |
84 uint32_t nSinks = 10; | 84 uint32_t nSinks = 10; |
85 double txp = 15.2045; | 85 double txp = 10.7675; |
86 double pauseTime = 0.0; | 86 double pauseTime = 0.0; |
87 double nodeSpeed = 10.0; | 87 double nodeSpeed = 10.0; |
88 double gridSize = 1000.0; | 88 double gridSize = 1000.0; |
89 uint32_t packetSize = 64; | 89 uint32_t packetSize = 64; |
90 std::string phyModeControl ("DsssRate11Mbps"); | 90 std::string phyModeControl ("DsssRate11Mbps"); |
91 std::string phyModeData ("DsssRate11Mbps"); | 91 std::string phyModeData ("DsssRate11Mbps"); |
92 std::string rate = "0.512kbps"; | 92 std::string rate = "0.512kbps"; |
93 double ppers = 1.0; | 93 double ppers = 1.0; |
94 /* | 94 /* |
95 * Define the DSR parameters | 95 * Define the DSR parameters |
96 */ | 96 */ |
97 uint32_t m_maxCacheLen = 64; | 97 uint32_t m_maxCacheLen = 64; |
98 Time m_maxCacheTime = Seconds (30); | 98 Time m_maxCacheTime = Seconds (30); |
99 Time m_nodeTraversalTime = MicroSeconds (1); | 99 Time m_nodeTraversalTime = MicroSeconds (2); |
100 Time m_passiveAckTimeout = MicroSeconds (2); | 100 Time m_passiveAckTimeout = MicroSeconds (4); |
101 uint32_t m_maxSendBuffLen = 64; | 101 uint32_t m_maxSendBuffLen = 64; |
102 Time m_sendBufferTimeout = Seconds (30); | 102 Time m_sendBufferTimeout = Seconds (30); |
103 uint32_t m_maxMaintainLen = 50; | 103 uint32_t m_maxMaintainLen = 50; |
104 Time m_maxMaintainTime = Seconds (30); | 104 Time m_maxMaintainTime = Seconds (30); |
105 uint32_t m_maintenanceRetries = 2; | 105 uint32_t m_maintenanceRetries = 2; |
106 | 106 |
107 //Allow users to override the default parameters and set it to new ones from C
ommandLine. | 107 //Allow users to override the default parameters and set it to new ones from C
ommandLine. |
108 CommandLine cmd; | 108 CommandLine cmd; |
109 cmd.AddValue ("MaxCacheLen", "Max route cache length.", m_maxCacheLen); | 109 cmd.AddValue ("MaxCacheLen", "Max route cache length.", m_maxCacheLen); |
110 cmd.AddValue ("RouteCacheTimeout", "Max route cache timeout.", m_maxCacheTime)
; | 110 cmd.AddValue ("RouteCacheTimeout", "Max route cache timeout.", m_maxCacheTime)
; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 apps_sink.Start (Seconds (0.0)); | 199 apps_sink.Start (Seconds (0.0)); |
200 apps_sink.Stop (Seconds (totalTime)); | 200 apps_sink.Stop (Seconds (totalTime)); |
201 | 201 |
202 OnOffHelper onoff1 ("ns3::UdpSocketFactory", Address (InetSocketAddress (a
dhocInterfaces.GetAddress (i), port))); | 202 OnOffHelper onoff1 ("ns3::UdpSocketFactory", Address (InetSocketAddress (a
dhocInterfaces.GetAddress (i), port))); |
203 onoff1.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)))
; | 203 onoff1.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)))
; |
204 onoff1.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))
); | 204 onoff1.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))
); |
205 onoff1.SetAttribute ("PacketSize", UintegerValue (packetSize)); | 205 onoff1.SetAttribute ("PacketSize", UintegerValue (packetSize)); |
206 onoff1.SetAttribute ("DataRate", DataRateValue (DataRate (rate))); | 206 onoff1.SetAttribute ("DataRate", DataRateValue (DataRate (rate))); |
207 | 207 |
208 ApplicationContainer apps1 = onoff1.Install (nodes.Get (i + nSinks)); | 208 ApplicationContainer apps1 = onoff1.Install (nodes.Get (i + nSinks)); |
209 UniformVariable var; | |
210 apps1.Start (Seconds (dataStart + i * randomStartTime)); | 209 apps1.Start (Seconds (dataStart + i * randomStartTime)); |
211 apps1.Stop (Seconds (dataTime)); | 210 apps1.Stop (Seconds (dataTime)); |
212 } | 211 } |
213 | 212 |
214 AsciiTraceHelper ascii; | 213 AsciiTraceHelper ascii; |
215 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("dsrtest.tr"); | 214 Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("dsrtest.tr"); |
216 wifiPhy.EnableAsciiAll (stream); | 215 wifiPhy.EnableAsciiAll (stream); |
217 | 216 |
218 NS_LOG_INFO ("Run Simulation."); | 217 NS_LOG_INFO ("Run Simulation."); |
219 Simulator::Stop (Seconds (totalTime)); | 218 Simulator::Stop (Seconds (totalTime)); |
220 Simulator::Run (); | 219 Simulator::Run (); |
221 Simulator::Destroy (); | 220 Simulator::Destroy (); |
222 } | 221 } |
OLD | NEW |