LEFT | RIGHT |
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) 2013· | 3 * Copyright (c) 2013· |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 mobility->SetPosition (position); | 65 mobility->SetPosition (position); |
66 } | 66 } |
67 | 67 |
68 //========================================================================== | 68 //========================================================================== |
69 //========================================================================== | 69 //========================================================================== |
70 | 70 |
71 int main (int argc, char *argv[]) | 71 int main (int argc, char *argv[]) |
72 { | 72 { |
73 std::cout << "AggregationSize" <<" " << "Throughput" << " " << "Utilization"
<< '\n'; | 73 std::cout << "AggregationSize" <<" " << "Throughput" << " " << "Utilization"
<< '\n'; |
74 bool udp = true; | 74 bool udp = true; |
75 int ampduSize = 0; | 75 int ampduSize = 2; |
76 for (;ampduSize <= 64; ampduSize+= 4) | 76 for (;ampduSize <= 16; ampduSize+= 2) |
77 { | 77 { |
78 uint32_t nWifi = 1; | 78 uint32_t nWifi = 1; |
79 CommandLine cmd; | 79 CommandLine cmd; |
80 cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi); | 80 cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi); |
81 cmd.Parse (argc,argv); | 81 cmd.Parse (argc,argv); |
82 Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", S
tringValue ("990000")); | 82 Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", S
tringValue ("990000")); |
83 // disable rts cts all the time. | 83 // disable rts cts all the time. |
84 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringVa
lue ("99000")); | 84 Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringVa
lue ("99000")); |
85 NodeContainer wifiNodes; | 85 NodeContainer wifiNodes; |
86 wifiNodes.Create (1); | 86 wifiNodes.Create (1); |
87 NodeContainer wifiApNode; | 87 NodeContainer wifiApNode; |
88 wifiApNode.Create (1); | 88 wifiApNode.Create (1); |
89 · | 89 · |
90 YansWifiChannelHelper channel = YansWifiChannelHelper::Default (); | 90 YansWifiChannelHelper channel = YansWifiChannelHelper::Default (); |
91 YansWifiPhyHelper phy = YansWifiPhyHelper::Default (); | 91 YansWifiPhyHelper phy = YansWifiPhyHelper::Default (); |
92 phy.SetChannel (channel.Create ()); | 92 phy.SetChannel (channel.Create ()); |
93 //phy.Set ("ShortGuardEnabled",BooleanValue(true)); | 93 //phy.Set ("ShortGuardEnabled",BooleanValue(true)); |
94 //phy.Set ("GreenfieldEnabled",BooleanValue(true)); | 94 //phy.Set ("GreenfieldEnabled",BooleanValue(true)); |
95 | 95 |
96 WifiHelper wifi = WifiHelper::Default (); | 96 WifiHelper wifi = WifiHelper::Default (); |
97 wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ); | 97 wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ); |
98 HtWifiMacHelper mac = HtWifiMacHelper::Default (); | 98 HtWifiMacHelper mac = HtWifiMacHelper::Default (); |
99 · | 99 · |
100 | 100 |
101 Ssid ssid = Ssid ("ns380211n"); | 101 Ssid ssid = Ssid ("ns380211n"); |
102 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", Strin
gValue("OfdmRate65MbpsBW20MHz"), | 102 wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", Strin
gValue("OfdmRate65MbpsBW20MHz"), |
103 "ControlMode", StringValue ("OfdmRate65MbpsBW
20MHz")); | 103 "ControlMode", StringValue ("OfdmRate65MbpsBW
20MHz")); |
| 104 //wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); |
104 mac.SetType ("ns3::StaWifiMac", | 105 mac.SetType ("ns3::StaWifiMac", |
105 "Ssid", SsidValue (ssid), | 106 "Ssid", SsidValue (ssid), |
106 "ActiveProbing", BooleanValue (false)); | 107 "ActiveProbing", BooleanValue (false)); |
107 mac.SetBlockAckThresholdForAc (AC_BE, 2); | 108 mac.SetBlockAckThresholdForAc (AC_BE, 2); |
108 | 109 |
109 mac.SetMpduAggregatorForAc ("ns3::MpduStandardAggregator",· | 110 mac.SetMpduAggregatorForAc ("ns3::MpduStandardAggregator",· |
110 "MaxAmpduSize", UintegerValue (ampduSize*1584)); | 111 "MaxAmpduSize", UintegerValue (ampduSize*1584)); |
111 | 112 |
112 NetDeviceContainer staDevices; | 113 NetDeviceContainer staDevices; |
113 staDevices = wifi.Install (phy, mac, wifiNodes); | 114 staDevices = wifi.Install (phy, mac, wifiNodes); |
114 | 115 |
115 mac.SetType ("ns3::ApWifiMac", | 116 mac.SetType ("ns3::ApWifiMac", |
116 "Ssid", SsidValue (ssid)); | 117 "Ssid", SsidValue (ssid)); |
117 mac.SetBlockAckThresholdForAc (AC_BE, 2); | 118 mac.SetBlockAckThresholdForAc (AC_BE, 2); |
118 | 119 |
119 mac.SetMpduAggregatorForAc ("ns3::MpduStandardAggregator",· | 120 mac.SetMpduAggregatorForAc ("ns3::MpduStandardAggregator",· |
120 "MaxAmpduSize", UintegerValue (ampduSize*1584)); | 121 "MaxAmpduSize", UintegerValue (ampduSize*1584)); |
121 | 122 |
122 NetDeviceContainer apDevice; | 123 NetDeviceContainer apDevice; |
123 apDevice = wifi.Install (phy, mac, wifiApNode); | 124 apDevice = wifi.Install (phy, mac, wifiApNode); |
124 ·· | 125 ·············· |
125 ·············· | |
126 // mobility. | 126 // mobility. |
127 MobilityHelper mobility; | 127 MobilityHelper mobility; |
128 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); | 128 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
129 mobility.Install (wifiNodes); | 129 mobility.Install (wifiNodes); |
130 mobility.Install (wifiApNode); | 130 mobility.Install (wifiApNode); |
131 ···· | 131 ···· |
132 SetPosition (wifiNodes.Get(0), Vector (1.0,0.0,0.0)); | 132 SetPosition (wifiNodes.Get(0), Vector (1.0,0.0,0.0)); |
133 SetPosition (wifiApNode.Get(0), Vector (0.0,0.0,0.0)); | 133 SetPosition (wifiApNode.Get(0), Vector (0.0,0.0,0.0)); |
134 · | 134 · |
135 | 135 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 { | 212 { |
213 //TCP | 213 //TCP |
214 uint32_t totalPacketsThrough = DynamicCast<PacketSink>(sink1App.Get (0))->
GetTotalRx (); | 214 uint32_t totalPacketsThrough = DynamicCast<PacketSink>(sink1App.Get (0))->
GetTotalRx (); |
215 throughput=totalPacketsThrough*8/((t-3)*1000000.0); | 215 throughput=totalPacketsThrough*8/((t-3)*1000000.0); |
216 } | 216 } |
217 ·· | 217 ·· |
218 std::cout << ampduSize <<" " << throughput << " " << throughput/65<< '\n'; | 218 std::cout << ampduSize <<" " << throughput << " " << throughput/65<< '\n'; |
219 } | 219 } |
220 return 0; | 220 return 0; |
221 } | 221 } |
LEFT | RIGHT |