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) 2016 University of Washington | 3 * Copyright (c) 2016 University of Washington |
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 * \param width channel width | 99 * \param width channel width |
100 * \param snrLow SNR low | 100 * \param snrLow SNR low |
101 * \param snrHigh SNR high | 101 * \param snrHigh SNR high |
102 * \param xMin x minimum | 102 * \param xMin x minimum |
103 * \param xMax x maximum | 103 * \param xMax x maximum |
104 * \param yMax y maximum | 104 * \param yMax y maximum |
105 */ | 105 */ |
106 StandardInfo (std::string name, WifiPhyStandard standard, uint16_t width, doub
le snrLow, double snrHigh, double xMin, double xMax, double yMax) | 106 StandardInfo (std::string name, WifiPhyStandard standard, uint16_t width, doub
le snrLow, double snrHigh, double xMin, double xMax, double yMax) |
107 : m_name (name), | 107 : m_name (name), |
108 m_standard (standard), | 108 m_standard (standard), |
109 m_width (static_cast<uint8_t> (width)), | 109 m_width (width), |
110 m_snrLow (snrLow), | 110 m_snrLow (snrLow), |
111 m_snrHigh (snrHigh), | 111 m_snrHigh (snrHigh), |
112 m_xMin (xMin), | 112 m_xMin (xMin), |
113 m_xMax (xMax), | 113 m_xMax (xMax), |
114 m_yMax (yMax) | 114 m_yMax (yMax) |
115 { | 115 { |
116 } | 116 } |
117 std::string m_name; ///< name | 117 std::string m_name; ///< name |
118 WifiPhyStandard m_standard; ///< standard | 118 WifiPhyStandard m_standard; ///< standard |
119 uint8_t m_width; ///< channel width | 119 uint16_t m_width; ///< channel width |
120 double m_snrLow; ///< lowest SNR | 120 double m_snrLow; ///< lowest SNR |
121 double m_snrHigh; ///< highest SNR | 121 double m_snrHigh; ///< highest SNR |
122 double m_xMin; ///< X minimum | 122 double m_xMin; ///< X minimum |
123 double m_xMax; ///< X maximum | 123 double m_xMax; ///< X maximum |
124 double m_yMax; ///< Y maximum | 124 double m_yMax; ///< Y maximum |
125 }; | 125 }; |
126 | 126 |
127 void | 127 void |
128 ChangeSignalAndReportRate (Ptr<FixedRssLossModel> rssModel, struct Step step, do
uble rss, Gnuplot2dDataset& rateDataset, Gnuplot2dDataset& actualDataset) | 128 ChangeSignalAndReportRate (Ptr<FixedRssLossModel> rssModel, struct Step step, do
uble rss, Gnuplot2dDataset& rateDataset, Gnuplot2dDataset& actualDataset) |
129 { | 129 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 cmd.AddValue ("standard", "Set standard (802.11a, 802.11b, 802.11g, 802.11n-5G
Hz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz, 802.11a
x-5GHz, 802.11ax-2.4GHz)", standard); | 185 cmd.AddValue ("standard", "Set standard (802.11a, 802.11b, 802.11g, 802.11n-5G
Hz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz, 802.11a
x-5GHz, 802.11ax-2.4GHz)", standard); |
186 cmd.AddValue ("wifiManager", "Set wifi rate manager (Aarf, Aarfcd, Amrr, Arf,
Cara, Ideal, Minstrel, MinstrelHt, Onoe, Rraa)", wifiManager); | 186 cmd.AddValue ("wifiManager", "Set wifi rate manager (Aarf, Aarfcd, Amrr, Arf,
Cara, Ideal, Minstrel, MinstrelHt, Onoe, Rraa)", wifiManager); |
187 cmd.AddValue ("infrastructure", "Use infrastructure instead of adhoc", infrast
ructure); | 187 cmd.AddValue ("infrastructure", "Use infrastructure instead of adhoc", infrast
ructure); |
188 cmd.Parse (argc,argv); | 188 cmd.Parse (argc,argv); |
189 | 189 |
190 // Print out some explanation of what this program does | 190 // Print out some explanation of what this program does |
191 std::cout << std::endl << "This program demonstrates and plots the operation o
f different " << std::endl; | 191 std::cout << std::endl << "This program demonstrates and plots the operation o
f different " << std::endl; |
192 std::cout << "Wi-Fi rate controls on different station configurations," << std
::endl; | 192 std::cout << "Wi-Fi rate controls on different station configurations," << std
::endl; |
193 std::cout << "by stepping down the received signal strength across a wide rang
e" << std::endl; | 193 std::cout << "by stepping down the received signal strength across a wide rang
e" << std::endl; |
194 std::cout << "and observing the adjustment of the rate." << std::endl; | 194 std::cout << "and observing the adjustment of the rate." << std::endl; |
195 std::cout << "Run 'wifi-manager-example --PrintHelp' to show program options."
<< std::endl << std::endl; | 195 std::cout << "Run 'wifi-manager-example --PrintHelp' to show program options."
<< std::endl << std::endl; |
196 | 196 |
197 if (infrastructure == false) | 197 if (infrastructure == false) |
198 { | 198 { |
199 NS_ABORT_MSG_IF (serverNss != clientNss, "In ad hoc mode, we assume sender
and receiver are similarly configured"); | 199 NS_ABORT_MSG_IF (serverNss != clientNss, "In ad hoc mode, we assume sender
and receiver are similarly configured"); |
200 } | 200 } |
201 | 201 |
202 if (standard == "802.11b") | 202 if (standard == "802.11b") |
203 { | 203 { |
204 NS_ABORT_MSG_IF (serverChannelWidth != 22 && serverChannelWidth != 22, "In
valid channel width for standard " << standard); | 204 NS_ABORT_MSG_IF (serverChannelWidth != 22 && serverChannelWidth != 22, "In
valid channel width for standard " << standard); |
205 NS_ABORT_MSG_IF (serverNss != 1, "Invalid nss for standard " << standard); | 205 NS_ABORT_MSG_IF (serverNss != 1, "Invalid nss for standard " << standard); |
(...skipping 30 matching lines...) Expand all Loading... |
236 } | 236 } |
237 | 237 |
238 std::string plotName = "wifi-manager-example-"; | 238 std::string plotName = "wifi-manager-example-"; |
239 std::string dataName = "wifi-manager-example-"; | 239 std::string dataName = "wifi-manager-example-"; |
240 plotName += wifiManager; | 240 plotName += wifiManager; |
241 dataName += wifiManager; | 241 dataName += wifiManager; |
242 plotName += "-"; | 242 plotName += "-"; |
243 dataName += "-"; | 243 dataName += "-"; |
244 plotName += standard; | 244 plotName += standard; |
245 dataName += standard; | 245 dataName += standard; |
246 if (standard == "802.11n-5GHz" || | 246 if (standard == "802.11n-5GHz" |
247 standard == "802.11n-2.4GHz" || | 247 || standard == "802.11n-2.4GHz" |
248 standard == "802.11ac" || | 248 || standard == "802.11ac" |
249 standard == "802.11ax-5GHz" || | 249 || standard == "802.11ax-5GHz" |
250 standard == "802.11ax-2.4GHz") | 250 || standard == "802.11ax-2.4GHz") |
251 { | 251 { |
252 plotName += "-server="; | 252 plotName += "-server="; |
253 dataName += "-server="; | 253 dataName += "-server="; |
254 std::ostringstream oss; | 254 std::ostringstream oss; |
255 oss << serverChannelWidth << "MHz_" << serverShortGuardInterval << "ns_" <
< serverNss << "SS"; | 255 oss << serverChannelWidth << "MHz_" << serverShortGuardInterval << "ns_" <
< serverNss << "SS"; |
256 plotName += oss.str (); | 256 plotName += oss.str (); |
257 dataName += oss.str (); | 257 dataName += oss.str (); |
258 plotName += "-client="; | 258 plotName += "-client="; |
259 dataName += "-client="; | 259 dataName += "-client="; |
260 oss.str(""); | 260 oss.str (""); |
261 oss << clientChannelWidth << "MHz_" << clientShortGuardInterval << "ns_" <
< clientNss << "SS"; | 261 oss << clientChannelWidth << "MHz_" << clientShortGuardInterval << "ns_" <
< clientNss << "SS"; |
262 plotName += oss.str (); | 262 plotName += oss.str (); |
263 dataName += oss.str (); | 263 dataName += oss.str (); |
264 } | 264 } |
265 plotName += ".eps"; | 265 plotName += ".eps"; |
266 dataName += ".plt"; | 266 dataName += ".plt"; |
267 std::ofstream outfile (dataName.c_str ()); | 267 std::ofstream outfile (dataName.c_str ()); |
268 Gnuplot gnuplot = Gnuplot (plotName); | 268 Gnuplot gnuplot = Gnuplot (plotName); |
269 | 269 |
270 // As channel width increases, scale up plot's yRange value | 270 // As channel width increases, scale up plot's yRange value |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 NS_ABORT_IF (clientSelectedStandard.m_name == "none"); | 317 NS_ABORT_IF (clientSelectedStandard.m_name == "none"); |
318 std::cout << "Testing " << serverSelectedStandard.m_name << " with " << wifiMa
nager << " ..." << std::endl; | 318 std::cout << "Testing " << serverSelectedStandard.m_name << " with " << wifiMa
nager << " ..." << std::endl; |
319 NS_ABORT_MSG_IF (clientSelectedStandard.m_snrLow >= clientSelectedStandard.m_s
nrHigh, "SNR values in wrong order"); | 319 NS_ABORT_MSG_IF (clientSelectedStandard.m_snrLow >= clientSelectedStandard.m_s
nrHigh, "SNR values in wrong order"); |
320 steps = static_cast<uint32_t> (std::abs<double> ((clientSelectedStandard.m_snr
High - clientSelectedStandard.m_snrLow ) / stepSize) + 1); | 320 steps = static_cast<uint32_t> (std::abs<double> ((clientSelectedStandard.m_snr
High - clientSelectedStandard.m_snrLow ) / stepSize) + 1); |
321 NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << clientSelectedSt
andard.m_snrLow << ":" << clientSelectedStandard.m_snrHigh); | 321 NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << clientSelectedSt
andard.m_snrLow << ":" << clientSelectedStandard.m_snrHigh); |
322 Ptr<Node> clientNode = CreateObject<Node> (); | 322 Ptr<Node> clientNode = CreateObject<Node> (); |
323 Ptr<Node> serverNode = CreateObject<Node> (); | 323 Ptr<Node> serverNode = CreateObject<Node> (); |
324 | 324 |
325 Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSlrc", UintegerValue (m
axSlrc)); | 325 Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSlrc", UintegerValue (m
axSlrc)); |
326 Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSsrc", UintegerValue (m
axSsrc)); | 326 Config::SetDefault ("ns3::WifiRemoteStationManager::MaxSsrc", UintegerValue (m
axSsrc)); |
| 327 Config::SetDefault ("ns3::MinstrelWifiManager::PrintStats", BooleanValue (true
)); |
| 328 Config::SetDefault ("ns3::MinstrelWifiManager::PrintSamples", BooleanValue (tr
ue)); |
| 329 Config::SetDefault ("ns3::MinstrelHtWifiManager::PrintStats", BooleanValue (tr
ue)); |
327 | 330 |
328 WifiHelper wifi; | 331 WifiHelper wifi; |
329 wifi.SetStandard (serverSelectedStandard.m_standard); | 332 wifi.SetStandard (serverSelectedStandard.m_standard); |
330 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); | 333 YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
331 wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0)); | 334 wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0)); |
332 wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0)); | 335 wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (-110.0)); |
333 wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0)); | 336 wifiPhy.Set ("CcaMode1Threshold", DoubleValue (-110.0)); |
334 | 337 |
335 Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> (); | 338 Ptr<YansWifiChannel> wifiChannel = CreateObject<YansWifiChannel> (); |
336 Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpee
dPropagationDelayModel> (); | 339 Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpee
dPropagationDelayModel> (); |
(...skipping 23 matching lines...) Expand all Loading... |
360 else | 363 else |
361 { | 364 { |
362 wifiMac.SetType ("ns3::AdhocWifiMac", | 365 wifiMac.SetType ("ns3::AdhocWifiMac", |
363 "BE_MaxAmpduSize", UintegerValue (maxAmpduSize)); | 366 "BE_MaxAmpduSize", UintegerValue (maxAmpduSize)); |
364 serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode); | 367 serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode); |
365 clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode); | 368 clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode); |
366 } | 369 } |
367 | 370 |
368 RngSeedManager::SetSeed (1); | 371 RngSeedManager::SetSeed (1); |
369 RngSeedManager::SetRun (2); | 372 RngSeedManager::SetRun (2); |
370 wifi.AssignStreams(serverDevice, 100); | 373 wifi.AssignStreams (serverDevice, 100); |
371 wifi.AssignStreams(clientDevice, 100); | 374 wifi.AssignStreams (clientDevice, 100); |
372 | 375 |
373 if (wifiManager == "MinstrelHt") | 376 if (wifiManager == "MinstrelHt") |
374 { | 377 { |
375 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevi
ce/RemoteStationManager/$ns3::MinstrelHtWifiManager/RateChange", MakeCallback (&
RateChangeMinstrelHt)); | 378 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevi
ce/RemoteStationManager/$ns3::MinstrelHtWifiManager/RateChange", MakeCallback (&
RateChangeMinstrelHt)); |
376 } | 379 } |
377 else | 380 else |
378 { | 381 { |
379 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevi
ce/RemoteStationManager/$ns3::" + wifiManager + "WifiManager/Rate", MakeCallback
(&RateChange)); | 382 Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevi
ce/RemoteStationManager/$ns3::" + wifiManager + "WifiManager/Rate", MakeCallback
(&RateChange)); |
380 } | 383 } |
381 // Configure the mobility. | 384 // Configure the mobility. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 gnuplot.SetTitle (title); | 550 gnuplot.SetTitle (title); |
548 gnuplot.SetExtra (xRangeStr); | 551 gnuplot.SetExtra (xRangeStr); |
549 gnuplot.AppendExtra (yRangeStr); | 552 gnuplot.AppendExtra (yRangeStr); |
550 gnuplot.AppendExtra ("set key top left"); | 553 gnuplot.AppendExtra ("set key top left"); |
551 gnuplot.GenerateOutput (outfile); | 554 gnuplot.GenerateOutput (outfile); |
552 outfile.close (); | 555 outfile.close (); |
553 | 556 |
554 return 0; | 557 return 0; |
555 } | 558 } |
556 | 559 |
LEFT | RIGHT |