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) 2009 MIRKO BANCHI | 3 * Copyright (c) 2009 MIRKO BANCHI |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mirko Banchi <mk.banchi@gmail.com> | 18 * Author:Ghada Badawy <gbadawy@gmail.com> |
19 */ | 19 */ |
20 #include "ns3/core-module.h" | 20 #include "ns3/core-module.h" |
21 #include "ns3/network-module.h" | 21 #include "ns3/network-module.h" |
22 #include "ns3/applications-module.h" | 22 #include "ns3/applications-module.h" |
23 #include "ns3/wifi-module.h" | 23 #include "ns3/wifi-module.h" |
24 #include "ns3/mobility-module.h" | 24 #include "ns3/mobility-module.h" |
25 #include "ns3/ipv4-global-routing-helper.h" | 25 #include "ns3/ipv4-global-routing-helper.h" |
26 #include "ns3/internet-module.h" | 26 #include "ns3/internet-module.h" |
27 | 27 |
28 //This is a simple example in order to show how 802.11n frame aggregation featur
e (A-MSDU) works. | 28 //This is a simple example in order to show how 802.11n works. |
29 // | 29 // |
30 //Network topology: | |
31 //· | |
32 // Wifi 192.168.1.0 | |
33 //· | |
34 // AP | |
35 // * * * | |
36 // | | | | |
37 // n1 n2 n3· | |
38 // | 30 // |
39 //Packets in this simulation aren't marked with a QosTag so they are considered | 31 //Packets in this simulation aren't marked with a QosTag so they are considered |
40 //belonging to BestEffort Access Class (AC_BE). | 32 //belonging to BestEffort Access Class (AC_BE). |
41 | 33 |
42 using namespace ns3; | 34 using namespace ns3; |
43 | 35 |
44 NS_LOG_COMPONENT_DEFINE ("DataRates"); | 36 NS_LOG_COMPONENT_DEFINE ("DataRates"); |
45 | 37 |
46 double rxBytessum=0; | 38 double rxBytessum=0; |
47 double throughput=0; | 39 double throughput=0; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 { | 105 { |
114 DataRate = StringValue("OfdmRate57_8MbpsBW20MHz"); | 106 DataRate = StringValue("OfdmRate57_8MbpsBW20MHz"); |
115 datarate = 57.8; | 107 datarate = 57.8; |
116 } | 108 } |
117 else if (i == 4) | 109 else if (i == 4) |
118 { | 110 { |
119 DataRate = StringValue("OfdmRate72_2MbpsBW20MHz"); | 111 DataRate = StringValue("OfdmRate72_2MbpsBW20MHz"); |
120 datarate = 72.2; | 112 datarate = 72.2; |
121 } | 113 } |
122 | 114 |
123 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", Dat
aRate, | 115 //wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", D
ataRate, |
124 "ControlMode", DataRate); | 116 // "ControlMode", DataRate); |
| 117 wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); |
125 mac.SetType ("ns3::StaWifiMac", | 118 mac.SetType ("ns3::StaWifiMac", |
126 "Ssid", SsidValue (ssid), | 119 "Ssid", SsidValue (ssid), |
127 "ActiveProbing", BooleanValue (false)); | 120 "ActiveProbing", BooleanValue (false)); |
128 ···· | 121 ···· |
129 NetDeviceContainer staDevices; | 122 NetDeviceContainer staDevices; |
130 staDevices = wifi.Install (phy, mac, wifiNodes); | 123 staDevices = wifi.Install (phy, mac, wifiNodes); |
131 | 124 |
132 mac.SetType ("ns3::ApWifiMac", | 125 mac.SetType ("ns3::ApWifiMac", |
133 "Ssid", SsidValue (ssid)); | 126 "Ssid", SsidValue (ssid)); |
134 ··· | 127 ··· |
135 NetDeviceContainer apDevice; | 128 NetDeviceContainer apDevice; |
136 apDevice = wifi.Install (phy, mac, wifiApNode); | 129 apDevice = wifi.Install (phy, mac, wifiApNode); |
137 /* Ptr<WifiRemoteStationManager> apStationManager = | 130 ·· |
138 DynamicCast<WifiNetDevice>(apDevice.Get (0))->GetRemoteStationMana
ger (); | |
139 apStationManager->AddBasicMode (WifiMode ("OfdmRate13MbpsBW20MHz")); | |
140 apStationManager->AddBasicMode (WifiMode ("OfdmRate19_5MbpsBW20MHz")); | |
141 apStationManager->AddBasicMode (WifiMode ("OfdmRate26MbpsBW20MHz")); | |
142 apStationManager->AddBasicMode (WifiMode ("OfdmRate39MbpsBW20MHz")); | |
143 Ptr<WifiRemoteStationManager> staStationManager = | |
144 DynamicCast<WifiNetDevice> (staDevices.Get (0))->GetRemoteStationM
anager (); | |
145 staStationManager->AddBasicMode (WifiMode ("OfdmRate13MbpsBW20MHz")); | |
146 staStationManager->AddBasicMode (WifiMode ("OfdmRate19_5MbpsBW20MHz")); | |
147 staStationManager->AddBasicMode (WifiMode ("OfdmRate26MbpsBW20MHz")); | |
148 staStationManager->AddBasicMode (WifiMode ("OfdmRate39MbpsBW20MHz"));*/ | |
149 ·············· | 131 ·············· |
150 // mobility. | 132 // mobility. |
151 MobilityHelper mobility; | 133 MobilityHelper mobility; |
152 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); | 134 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
153 mobility.Install (wifiNodes); | 135 mobility.Install (wifiNodes); |
154 mobility.Install (wifiApNode); | 136 mobility.Install (wifiApNode); |
155 ···· | 137 ···· |
156 SetPosition (wifiNodes.Get(0), Vector (1.0,0.0,0.0)); | 138 SetPosition (wifiNodes.Get(0), Vector (1.0,0.0,0.0)); |
157 SetPosition (wifiApNode.Get(0), Vector (0.0,0.0,0.0)); | 139 SetPosition (wifiApNode.Get(0), Vector (0.0,0.0,0.0)); |
158 · | 140 · |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 { | 217 { |
236 //TCP | 218 //TCP |
237 uint32_t totalPacketsThrough = DynamicCast<PacketSink>(sink1App.Get (0))-
>GetTotalRx (); | 219 uint32_t totalPacketsThrough = DynamicCast<PacketSink>(sink1App.Get (0))-
>GetTotalRx (); |
238 throughput=totalPacketsThrough*8/((t-3)*1000000.0); | 220 throughput=totalPacketsThrough*8/((t-3)*1000000.0); |
239 } | 221 } |
240 ·· | 222 ·· |
241 std::cout << datarate <<" " << throughput << '\n'; | 223 std::cout << datarate <<" " << throughput << '\n'; |
242 } | 224 } |
243 return 0; | 225 return 0; |
244 }· | 226 }· |
OLD | NEW |