|
|
| 19 |
*/ |
19 |
*/ |
| 20 |
|
20 |
|
| 21 |
// Test the operation of IdealWifiManager as the SNR is varied, and create |
21 |
// Test the operation of IdealWifiManager as the SNR is varied, and create |
| 22 |
// a gnuplot output file for plotting |
22 |
// a gnuplot output file for plotting. |
|
|
23 |
// |
| 24 |
// The test consists of a device acting as server and a device as client generating traffic. |
| 25 |
// |
| 26 |
// The output consists of a plot of the rate observed and selected at the client device. |
| 23 |
// |
27 |
// |
| 24 |
// By default, the 802.11b standard is plotted. Several command line |
28 |
// By default, the 802.11b standard is plotted. Several command line |
| 25 |
// arguments can change the following options: |
29 |
// arguments can change the following options: |
| 26 |
// --standard (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz) |
30 |
// --serverStandard and --clientStandard (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz) |
| 27 |
// --shortGuard (for 802.11n/ac) |
31 |
// --serverShortGuardInterval and --clientShortGuardInterval (for 802.11n/ac) |
| 28 |
// --nss (for 802.11n/ac) |
32 |
// --serverNss and --clientNss (for 802.11n/ac) |
| 29 |
// --channelWidth (for 802.11n/ac) |
33 |
// --serverChannelWidth and --clientChannelWidth (for 802.11n/ac) |
| 30 |
// --broadcast instead of unicast (default is unicast) |
34 |
// --broadcast instead of unicast (default is unicast) |
| 31 |
// --rtsThreshold (by default, value of 99999 disables it) |
35 |
// --rtsThreshold (by default, value of 99999 disables it) |
| 32 |
|
36 |
|
|
Lines 112-118
ChangeSignalAndReportRate (Ptr<FixedRssLossModel> rssModel, struct Step step, do
|
Link Here
|
|---|
|
| 112 |
|
116 |
|
| 113 |
int main (int argc, char *argv[]) |
117 |
int main (int argc, char *argv[]) |
| 114 |
{ |
118 |
{ |
| 115 |
std::vector <StandardInfo> standards; |
119 |
std::vector <StandardInfo> serverStandards; |
|
|
120 |
std::vector <StandardInfo> clientStandards; |
| 116 |
uint32_t steps; |
121 |
uint32_t steps; |
| 117 |
|
122 |
|
| 118 |
uint32_t rtsThreshold = 999999; // disabled even for large A-MPDU |
123 |
uint32_t rtsThreshold = 999999; // disabled even for large A-MPDU |
|
Lines 124-176
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 124 |
int ap1_y = 0; |
129 |
int ap1_y = 0; |
| 125 |
int sta1_x = 5; |
130 |
int sta1_x = 5; |
| 126 |
int sta1_y = 0; |
131 |
int sta1_y = 0; |
| 127 |
uint16_t nss = 1; |
132 |
uint16_t serverNss = 1; |
| 128 |
bool shortGuardInterval = false; |
133 |
uint16_t clientNss = 1; |
| 129 |
uint32_t channelWidth = 20; |
134 |
bool serverShortGuardInterval = false; |
| 130 |
std::string standard ("802.11b"); |
135 |
bool clientShortGuardInterval = false; |
| 131 |
StandardInfo selectedStandard; |
136 |
uint32_t serverChannelWidth = 20; |
|
|
137 |
uint32_t clientChannelWidth = 20; |
| 138 |
std::string serverStandard ("802.11b"); |
| 139 |
std::string clientStandard ("802.11b"); |
| 140 |
StandardInfo serverSelectedStandard; |
| 141 |
StandardInfo clientSelectedStandard; |
| 132 |
|
142 |
|
| 133 |
CommandLine cmd; |
143 |
CommandLine cmd; |
| 134 |
cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold); |
144 |
cmd.AddValue ("rtsThreshold", "RTS threshold", rtsThreshold); |
| 135 |
cmd.AddValue ("stepSize", "Power between steps (dBm)", stepSize); |
145 |
cmd.AddValue ("stepSize", "Power between steps (dBm)", stepSize); |
| 136 |
cmd.AddValue ("stepTime", "Time on each step (seconds)", stepTime); |
146 |
cmd.AddValue ("stepTime", "Time on each step (seconds)", stepTime); |
| 137 |
cmd.AddValue ("broadcast", "Send broadcast instead of unicast", broadcast); |
147 |
cmd.AddValue ("broadcast", "Send broadcast instead of unicast", broadcast); |
| 138 |
cmd.AddValue ("channelWidth", "Set channel width (valid only for 802.11n or ac)", channelWidth); |
148 |
cmd.AddValue ("serverChannelWidth", "Set channel width of the server (valid only for 802.11n or ac)", serverChannelWidth); |
| 139 |
cmd.AddValue ("nss", "Set nss (valid only for 802.11n or ac)", nss); |
149 |
cmd.AddValue ("clientChannelWidth", "Set channel width of the client (valid only for 802.11n or ac)", clientChannelWidth); |
| 140 |
cmd.AddValue ("shortGuard", "Set short guard interval (802.11n/ac)", shortGuardInterval); |
150 |
cmd.AddValue ("serverNss", "Set nss of the server (valid only for 802.11n or ac)", serverNss); |
| 141 |
cmd.AddValue ("standard", "Set standard (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz)", standard); |
151 |
cmd.AddValue ("clientNss", "Set nss of the client (valid only for 802.11n or ac)", clientNss); |
|
|
152 |
cmd.AddValue ("serverShortGuardInterval", "Set short guard interval of the server (802.11n/ac)", serverShortGuardInterval); |
| 153 |
cmd.AddValue ("cleintShortGuardInterval", "Set short guard interval of the client (802.11n/ac)", clientShortGuardInterval); |
| 154 |
cmd.AddValue ("serverStandard", "Set standard of the server (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz)", serverStandard); |
| 155 |
cmd.AddValue ("clientStandard", "Set standard of the client (802.11a, 802.11b, 802.11g, 802.11n-5GHz, 802.11n-2.4GHz, 802.11ac, 802.11-holland, 802.11-10MHz, 802.11-5MHz)", clientStandard); |
| 142 |
cmd.Parse (argc, argv); |
156 |
cmd.Parse (argc, argv); |
| 143 |
|
157 |
|
| 144 |
if (standard == "802.11b") |
158 |
if (serverStandard == "802.11b") |
|
|
159 |
{ |
| 160 |
NS_ABORT_MSG_IF (serverChannelWidth != 20 && serverChannelWidth != 22, "Invalid channel width for standard " << serverStandard); |
| 161 |
NS_ABORT_MSG_IF (serverNss != 1, "Invalid nss for standard " << serverStandard); |
| 162 |
} |
| 163 |
else if (serverStandard == "802.11a" || serverStandard == "802.11g") |
| 164 |
{ |
| 165 |
NS_ABORT_MSG_IF (serverChannelWidth != 20, "Invalid channel width for standard " << serverStandard); |
| 166 |
NS_ABORT_MSG_IF (serverNss != 1, "Invalid nss for standard " << serverStandard); |
| 167 |
} |
| 168 |
else if (serverStandard == "802.11n-5GHz" || serverStandard == "802.11n-2.4GHz") |
| 169 |
{ |
| 170 |
NS_ABORT_MSG_IF (serverChannelWidth != 20 && serverChannelWidth != 40, "Invalid channel width for standard " << serverStandard); |
| 171 |
NS_ABORT_MSG_IF (serverNss == 0 || serverNss > 4, "Invalid nss " << serverNss << " for standard " << serverStandard); |
| 172 |
} |
| 173 |
else if (serverStandard == "802.11ac") |
| 174 |
{ |
| 175 |
NS_ABORT_MSG_IF (serverChannelWidth != 20 && serverChannelWidth != 40 && serverChannelWidth != 80 && serverChannelWidth != 160, "Invalid channel width for standard " << serverStandard); |
| 176 |
NS_ABORT_MSG_IF (serverNss == 0 || serverNss > 4, "Invalid nss " << serverNss << " for standard " << serverStandard); |
| 177 |
} |
| 178 |
|
| 179 |
if (clientStandard == "802.11b") |
| 145 |
{ |
180 |
{ |
| 146 |
NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 22, "Invalid channel width for standard " << standard); |
181 |
NS_ABORT_MSG_IF (clientChannelWidth != 20 && clientChannelWidth != 22, "Invalid channel width for standard " << clientStandard); |
| 147 |
NS_ABORT_MSG_IF (nss != 1, "Invalid nss for standard " << standard); |
182 |
NS_ABORT_MSG_IF (clientNss != 1, "Invalid nss for standard " << clientStandard); |
| 148 |
} |
183 |
} |
| 149 |
else if (standard == "802.11a" || standard == "802.11g") |
184 |
else if (clientStandard == "802.11a" || clientStandard == "802.11g") |
| 150 |
{ |
185 |
{ |
| 151 |
NS_ABORT_MSG_IF (channelWidth != 20, "Invalid channel width for standard " << standard); |
186 |
NS_ABORT_MSG_IF (clientChannelWidth != 20, "Invalid channel width for standard " << clientStandard); |
| 152 |
NS_ABORT_MSG_IF (nss != 1, "Invalid nss for standard " << standard); |
187 |
NS_ABORT_MSG_IF (clientNss != 1, "Invalid nss for standard " << clientStandard); |
| 153 |
} |
188 |
} |
| 154 |
else if (standard == "802.11n-5GHz" || standard == "802.11n-2.4GHz") |
189 |
else if (clientStandard == "802.11n-5GHz" || clientStandard == "802.11n-2.4GHz") |
| 155 |
{ |
190 |
{ |
| 156 |
NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 40, "Invalid channel width for standard " << standard); |
191 |
NS_ABORT_MSG_IF (clientChannelWidth != 20 && clientChannelWidth != 40, "Invalid channel width for standard " << clientStandard); |
| 157 |
NS_ABORT_MSG_IF (nss == 0 || nss > 4, "Invalid nss " << nss << " for standard " << standard); |
192 |
NS_ABORT_MSG_IF (clientNss == 0 || clientNss > 4, "Invalid nss " << clientNss << " for standard " << clientStandard); |
| 158 |
} |
193 |
} |
| 159 |
else if (standard == "802.11ac") |
194 |
else if (clientStandard == "802.11ac") |
| 160 |
{ |
195 |
{ |
| 161 |
NS_ABORT_MSG_IF (channelWidth != 20 && channelWidth != 40 && channelWidth != 80 && channelWidth != 160, "Invalid channel width for standard " << standard); |
196 |
NS_ABORT_MSG_IF (clientChannelWidth != 20 && clientChannelWidth != 40 && clientChannelWidth != 80 && clientChannelWidth != 160, "Invalid channel width for standard " << clientStandard); |
| 162 |
NS_ABORT_MSG_IF (nss == 0 || nss > 4, "Invalid nss " << nss << " for standard " << standard); |
197 |
NS_ABORT_MSG_IF (clientNss == 0 || clientNss > 4, "Invalid nss " << clientNss << " for standard " << clientStandard); |
| 163 |
} |
198 |
} |
| 164 |
|
199 |
|
| 165 |
std::string plotName = "ideal-wifi-manager-example-"; |
200 |
std::string plotName = "ideal-wifi-manager-example-S-"; |
| 166 |
std::string dataName = "ideal-wifi-manager-example-"; |
201 |
std::string dataName = "ideal-wifi-manager-example-S-"; |
| 167 |
plotName += standard; |
202 |
plotName += serverStandard; |
| 168 |
dataName += standard; |
203 |
dataName += serverStandard; |
| 169 |
if (standard == "802.11n-5GHz" || standard == "802.11n-2.4GHz" || standard == "802.11ac") |
204 |
if (serverStandard == "802.11n-5GHz" || serverStandard == "802.11n-2.4GHz" || serverStandard == "802.11ac") |
| 170 |
{ |
205 |
{ |
| 171 |
std::ostringstream oss; |
206 |
std::ostringstream oss; |
| 172 |
std::string gi; |
207 |
std::string gi; |
| 173 |
if (shortGuardInterval) |
208 |
if (serverShortGuardInterval) |
| 174 |
{ |
209 |
{ |
| 175 |
gi = "SGI"; |
210 |
gi = "SGI"; |
| 176 |
} |
211 |
} |
|
Lines 178-184
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 178 |
{ |
213 |
{ |
| 179 |
gi = "LGI"; |
214 |
gi = "LGI"; |
| 180 |
} |
215 |
} |
| 181 |
oss << "-" << channelWidth << "MHz-" << gi << "-" << nss << "SS"; |
216 |
oss << "-" << serverChannelWidth << "MHz-" << gi << "-" << serverNss << "SS"; |
|
|
217 |
plotName += oss.str (); |
| 218 |
dataName += oss.str (); |
| 219 |
} |
| 220 |
plotName += "-C-"; |
| 221 |
dataName += "-C-"; |
| 222 |
plotName += clientStandard; |
| 223 |
dataName += clientStandard; |
| 224 |
if (clientStandard == "802.11n-5GHz" || clientStandard == "802.11n-2.4GHz" || clientStandard == "802.11ac") |
| 225 |
{ |
| 226 |
std::ostringstream oss; |
| 227 |
std::string gi; |
| 228 |
if (clientShortGuardInterval) |
| 229 |
{ |
| 230 |
gi = "SGI"; |
| 231 |
} |
| 232 |
else |
| 233 |
{ |
| 234 |
gi = "LGI"; |
| 235 |
} |
| 236 |
oss << "-" << clientChannelWidth << "MHz-" << gi << "-" << clientNss << "SS"; |
| 182 |
plotName += oss.str (); |
237 |
plotName += oss.str (); |
| 183 |
dataName += oss.str (); |
238 |
dataName += oss.str (); |
| 184 |
} |
239 |
} |
|
Lines 188-226
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 188 |
Gnuplot gnuplot = Gnuplot (plotName); |
243 |
Gnuplot gnuplot = Gnuplot (plotName); |
| 189 |
|
244 |
|
| 190 |
// As channel width increases, scale up plot's yRange value |
245 |
// As channel width increases, scale up plot's yRange value |
| 191 |
uint32_t channelRateFactor = channelWidth / 20; |
246 |
uint32_t channelRateFactor = std::max (clientChannelWidth, serverChannelWidth) / 20; |
| 192 |
channelRateFactor = channelRateFactor * nss; |
247 |
channelRateFactor = channelRateFactor * std::max (clientNss, serverNss); |
| 193 |
|
248 |
|
| 194 |
// The first number is channel width, second is minimum SNR, third is maximum |
249 |
// The first number is channel width, second is minimum SNR, third is maximum |
| 195 |
// SNR, fourth and fifth provide xrange axis limits, and sixth the yaxis |
250 |
// SNR, fourth and fifth provide xrange axis limits, and sixth the yaxis |
| 196 |
// maximum |
251 |
// maximum |
| 197 |
standards.push_back (StandardInfo ("802.11a", WIFI_PHY_STANDARD_80211a, 20, false, 3, 27, 0, 30, 60)); |
252 |
serverStandards.push_back (StandardInfo ("802.11a", WIFI_PHY_STANDARD_80211a, 20, false, 3, 27, 0, 30, 60)); |
| 198 |
standards.push_back (StandardInfo ("802.11b", WIFI_PHY_STANDARD_80211b, 22, false, -5, 11, -6, 15, 15)); |
253 |
serverStandards.push_back (StandardInfo ("802.11b", WIFI_PHY_STANDARD_80211b, 22, false, -5, 11, -6, 15, 15)); |
| 199 |
standards.push_back (StandardInfo ("802.11g", WIFI_PHY_STANDARD_80211g, 20, false, -5, 27, -6, 30, 60)); |
254 |
serverStandards.push_back (StandardInfo ("802.11g", WIFI_PHY_STANDARD_80211g, 20, false, -5, 27, -6, 30, 60)); |
| 200 |
standards.push_back (StandardInfo ("802.11n-5GHz", WIFI_PHY_STANDARD_80211n_5GHZ, channelWidth, shortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
255 |
serverStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_PHY_STANDARD_80211n_5GHZ, serverChannelWidth, serverShortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
| 201 |
standards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_PHY_STANDARD_80211n_2_4GHZ, channelWidth, shortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
256 |
serverStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_PHY_STANDARD_80211n_2_4GHZ, serverChannelWidth, serverShortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
| 202 |
standards.push_back (StandardInfo ("802.11ac", WIFI_PHY_STANDARD_80211ac, channelWidth, shortGuardInterval, 5, 35, 0, 40, 120 * channelRateFactor)); |
257 |
serverStandards.push_back (StandardInfo ("802.11ac", WIFI_PHY_STANDARD_80211ac, serverChannelWidth, serverShortGuardInterval, 5, 35, 0, 40, 120 * channelRateFactor)); |
| 203 |
standards.push_back (StandardInfo ("802.11-holland", WIFI_PHY_STANDARD_holland, 20, false, 3, 27, 0, 30, 60)); |
258 |
serverStandards.push_back (StandardInfo ("802.11-holland", WIFI_PHY_STANDARD_holland, 20, false, 3, 27, 0, 30, 60)); |
| 204 |
standards.push_back (StandardInfo ("802.11-10MHz", WIFI_PHY_STANDARD_80211_10MHZ, 10, false, 3, 27, 0, 30, 60)); |
259 |
serverStandards.push_back (StandardInfo ("802.11-10MHz", WIFI_PHY_STANDARD_80211_10MHZ, 10, false, 3, 27, 0, 30, 60)); |
| 205 |
standards.push_back (StandardInfo ("802.11-5MHz", WIFI_PHY_STANDARD_80211_5MHZ, 5, false, 3, 27, 0, 30, 60)); |
260 |
serverStandards.push_back (StandardInfo ("802.11-5MHz", WIFI_PHY_STANDARD_80211_5MHZ, 5, false, 3, 27, 0, 30, 60)); |
| 206 |
|
261 |
|
| 207 |
for (std::vector<StandardInfo>::size_type i = 0; i != standards.size (); i++) |
262 |
clientStandards.push_back (StandardInfo ("802.11a", WIFI_PHY_STANDARD_80211a, 20, false, 3, 27, 0, 30, 60)); |
|
|
263 |
clientStandards.push_back (StandardInfo ("802.11b", WIFI_PHY_STANDARD_80211b, 22, false, -5, 11, -6, 15, 15)); |
| 264 |
clientStandards.push_back (StandardInfo ("802.11g", WIFI_PHY_STANDARD_80211g, 20, false, -5, 27, -6, 30, 60)); |
| 265 |
clientStandards.push_back (StandardInfo ("802.11n-5GHz", WIFI_PHY_STANDARD_80211n_5GHZ, clientChannelWidth, clientShortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
| 266 |
clientStandards.push_back (StandardInfo ("802.11n-2.4GHz", WIFI_PHY_STANDARD_80211n_2_4GHZ, clientChannelWidth, clientShortGuardInterval, 3, 30, 0, 35, 80 * channelRateFactor)); |
| 267 |
clientStandards.push_back (StandardInfo ("802.11ac", WIFI_PHY_STANDARD_80211ac, clientChannelWidth, clientShortGuardInterval, 5, 35, 0, 40, 120 * channelRateFactor)); |
| 268 |
clientStandards.push_back (StandardInfo ("802.11-holland", WIFI_PHY_STANDARD_holland, 20, false, 3, 27, 0, 30, 60)); |
| 269 |
clientStandards.push_back (StandardInfo ("802.11-10MHz", WIFI_PHY_STANDARD_80211_10MHZ, 10, false, 3, 27, 0, 30, 60)); |
| 270 |
clientStandards.push_back (StandardInfo ("802.11-5MHz", WIFI_PHY_STANDARD_80211_5MHZ, 5, false, 3, 27, 0, 30, 60)); |
| 271 |
|
| 272 |
for (std::vector<StandardInfo>::size_type i = 0; i != serverStandards.size (); i++) |
| 273 |
{ |
| 274 |
if (serverStandard == serverStandards[i].m_name) |
| 275 |
{ |
| 276 |
serverSelectedStandard = serverStandards[i]; |
| 277 |
} |
| 278 |
} |
| 279 |
NS_ABORT_IF (serverSelectedStandard.m_name == "none"); |
| 280 |
std::cout << "Testing server " << serverSelectedStandard.m_name << "..." << std::endl; |
| 281 |
NS_ABORT_MSG_IF (serverSelectedStandard.m_snrLow >= serverSelectedStandard.m_snrHigh, "SNR values in wrong order"); |
| 282 |
uint32_t serverSteps = static_cast<uint32_t> (std::floor ((serverSelectedStandard.m_snrHigh - serverSelectedStandard.m_snrLow ) / stepSize)) + 1; |
| 283 |
|
| 284 |
for (std::vector<StandardInfo>::size_type i = 0; i != clientStandards.size (); i++) |
| 208 |
{ |
285 |
{ |
| 209 |
if (standard == standards[i].m_name) |
286 |
if (clientStandard == clientStandards[i].m_name) |
| 210 |
{ |
287 |
{ |
| 211 |
selectedStandard = standards[i]; |
288 |
clientSelectedStandard = clientStandards[i]; |
| 212 |
} |
289 |
} |
| 213 |
} |
290 |
} |
| 214 |
NS_ABORT_IF (selectedStandard.m_name == "none"); |
291 |
NS_ABORT_IF (clientSelectedStandard.m_name == "none"); |
| 215 |
std::cout << "Testing " << selectedStandard.m_name << "..." << std::endl; |
292 |
std::cout << "Testing client " << clientSelectedStandard.m_name << "..." << std::endl; |
| 216 |
NS_ABORT_MSG_IF (selectedStandard.m_snrLow >= selectedStandard.m_snrHigh, "SNR values in wrong order"); |
293 |
NS_ABORT_MSG_IF (clientSelectedStandard.m_snrLow >= clientSelectedStandard.m_snrHigh, "SNR values in wrong order"); |
| 217 |
steps = static_cast<uint32_t> (std::floor ((selectedStandard.m_snrHigh - selectedStandard.m_snrLow ) / stepSize)) + 1; |
294 |
uint32_t clientSteps = static_cast<uint32_t> (std::floor ((clientSelectedStandard.m_snrHigh - clientSelectedStandard.m_snrLow ) / stepSize)) + 1; |
| 218 |
NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << selectedStandard.m_snrLow << ":" << selectedStandard.m_snrHigh); |
295 |
|
|
|
296 |
if (clientSteps > serverSteps) |
| 297 |
{ |
| 298 |
steps = clientSteps; |
| 299 |
NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << clientSelectedStandard.m_snrLow << ":" << clientSelectedStandard.m_snrHigh); |
| 300 |
} |
| 301 |
else |
| 302 |
{ |
| 303 |
steps = serverSteps; |
| 304 |
NS_LOG_DEBUG ("Using " << steps << " steps for SNR range " << serverSelectedStandard.m_snrLow << ":" << serverSelectedStandard.m_snrHigh); |
| 305 |
} |
| 306 |
|
| 219 |
Ptr<Node> clientNode = CreateObject<Node> (); |
307 |
Ptr<Node> clientNode = CreateObject<Node> (); |
| 220 |
Ptr<Node> serverNode = CreateObject<Node> (); |
308 |
Ptr<Node> serverNode = CreateObject<Node> (); |
| 221 |
|
309 |
|
| 222 |
WifiHelper wifi; |
310 |
WifiHelper wifi; |
| 223 |
wifi.SetStandard (selectedStandard.m_standard); |
|
|
| 224 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
311 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
| 225 |
wifiPhy.Set ("RxGain", DoubleValue (0.0)); |
312 |
wifiPhy.Set ("RxGain", DoubleValue (0.0)); |
| 226 |
wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0)); |
313 |
wifiPhy.Set ("RxNoiseFigure", DoubleValue (0.0)); |
|
Lines 242-248
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 242 |
|
329 |
|
| 243 |
WifiMacHelper wifiMac; |
330 |
WifiMacHelper wifiMac; |
| 244 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
331 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
|
|
332 |
wifi.SetStandard (serverSelectedStandard.m_standard); |
| 245 |
serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode); |
333 |
serverDevice = wifi.Install (wifiPhy, wifiMac, serverNode); |
|
|
334 |
|
| 335 |
wifi.SetStandard (clientSelectedStandard.m_standard); |
| 246 |
clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode); |
336 |
clientDevice = wifi.Install (wifiPhy, wifiMac, clientNode); |
| 247 |
|
337 |
|
| 248 |
Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::IdealWifiManager/Rate", MakeCallback (&RateChange)); |
338 |
Config::ConnectWithoutContext ("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/RemoteStationManager/$ns3::IdealWifiManager/Rate", MakeCallback (&RateChange)); |
|
Lines 259-266
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 259 |
mobility.Install (clientNode); |
349 |
mobility.Install (clientNode); |
| 260 |
mobility.Install (serverNode); |
350 |
mobility.Install (serverNode); |
| 261 |
|
351 |
|
| 262 |
Gnuplot2dDataset rateDataset (selectedStandard.m_name + std::string ("-rate selected")); |
352 |
Gnuplot2dDataset rateDataset (clientSelectedStandard.m_name + std::string ("-rate selected")); |
| 263 |
Gnuplot2dDataset actualDataset (selectedStandard.m_name + std::string ("-observed")); |
353 |
Gnuplot2dDataset actualDataset (clientSelectedStandard.m_name + std::string ("-observed")); |
| 264 |
struct Step step; |
354 |
struct Step step; |
| 265 |
step.stepSize = stepSize; |
355 |
step.stepSize = stepSize; |
| 266 |
step.stepTime = stepTime; |
356 |
step.stepTime = stepTime; |
|
Lines 274-301
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 274 |
Ptr<WifiNetDevice> wndServer = ndServer->GetObject<WifiNetDevice> (); |
364 |
Ptr<WifiNetDevice> wndServer = ndServer->GetObject<WifiNetDevice> (); |
| 275 |
Ptr<WifiPhy> wifiPhyPtrClient = wndClient->GetPhy (); |
365 |
Ptr<WifiPhy> wifiPhyPtrClient = wndClient->GetPhy (); |
| 276 |
Ptr<WifiPhy> wifiPhyPtrServer = wndServer->GetPhy (); |
366 |
Ptr<WifiPhy> wifiPhyPtrServer = wndServer->GetPhy (); |
| 277 |
wifiPhyPtrClient->SetNumberOfAntennas (nss); |
367 |
wifiPhyPtrClient->SetNumberOfAntennas (clientNss); |
| 278 |
wifiPhyPtrClient->SetMaxSupportedTxSpatialStreams (nss); |
368 |
wifiPhyPtrClient->SetMaxSupportedTxSpatialStreams (clientNss); |
| 279 |
wifiPhyPtrClient->SetMaxSupportedRxSpatialStreams (nss); |
369 |
wifiPhyPtrClient->SetMaxSupportedRxSpatialStreams (clientNss); |
| 280 |
wifiPhyPtrServer->SetNumberOfAntennas (nss); |
370 |
wifiPhyPtrServer->SetNumberOfAntennas (serverNss); |
| 281 |
wifiPhyPtrServer->SetMaxSupportedTxSpatialStreams (nss); |
371 |
wifiPhyPtrServer->SetMaxSupportedTxSpatialStreams (serverNss); |
| 282 |
wifiPhyPtrServer->SetMaxSupportedRxSpatialStreams (nss); |
372 |
wifiPhyPtrServer->SetMaxSupportedRxSpatialStreams (serverNss); |
| 283 |
// Only set the channel width and guard interval for HT and VHT modes |
373 |
// Only set the channel width and guard interval for HT and VHT modes |
| 284 |
if (selectedStandard.m_name == "802.11n-5GHz" |
374 |
if (serverSelectedStandard.m_name == "802.11n-5GHz" |
| 285 |
|| selectedStandard.m_name == "802.11n-2.4GHz" |
375 |
|| serverSelectedStandard.m_name == "802.11n-2.4GHz" |
| 286 |
|| selectedStandard.m_name == "802.11ac") |
376 |
|| serverSelectedStandard.m_name == "802.11ac") |
| 287 |
{ |
377 |
{ |
| 288 |
wifiPhyPtrClient->SetChannelWidth (selectedStandard.m_width); |
378 |
wifiPhyPtrServer->SetChannelWidth (serverSelectedStandard.m_width); |
| 289 |
wifiPhyPtrServer->SetChannelWidth (selectedStandard.m_width); |
379 |
wifiPhyPtrServer->SetShortGuardInterval (serverShortGuardInterval); |
| 290 |
wifiPhyPtrClient->SetShortGuardInterval (shortGuardInterval); |
380 |
} |
| 291 |
wifiPhyPtrServer->SetShortGuardInterval (shortGuardInterval); |
381 |
if (clientSelectedStandard.m_name == "802.11n-5GHz" |
|
|
382 |
|| clientSelectedStandard.m_name == "802.11n-2.4GHz" |
| 383 |
|| clientSelectedStandard.m_name == "802.11ac") |
| 384 |
{ |
| 385 |
wifiPhyPtrClient->SetChannelWidth (clientSelectedStandard.m_width); |
| 386 |
wifiPhyPtrClient->SetShortGuardInterval (clientShortGuardInterval); |
| 292 |
} |
387 |
} |
| 293 |
NS_LOG_DEBUG ("Channel width " << wifiPhyPtrClient->GetChannelWidth () << " noiseDbm " << noiseDbm); |
388 |
NS_LOG_DEBUG ("Channel width " << wifiPhyPtrClient->GetChannelWidth () << " noiseDbm " << noiseDbm); |
| 294 |
NS_LOG_DEBUG ("NSS " << wifiPhyPtrClient->GetMaxSupportedTxSpatialStreams ()); |
389 |
NS_LOG_DEBUG ("NSS " << wifiPhyPtrClient->GetMaxSupportedTxSpatialStreams ()); |
| 295 |
|
390 |
|
| 296 |
// Configure signal and noise, and schedule first iteration |
391 |
// Configure signal and noise, and schedule first iteration |
| 297 |
noiseDbm += 10 * log10 (selectedStandard.m_width * 1000000); |
392 |
noiseDbm += 10 * log10 (clientSelectedStandard.m_width * 1000000); |
| 298 |
double rssCurrent = (selectedStandard.m_snrHigh + noiseDbm); |
393 |
double rssCurrent = (clientSelectedStandard.m_snrHigh + noiseDbm); |
| 299 |
rssLossModel->SetRss (rssCurrent); |
394 |
rssLossModel->SetRss (rssCurrent); |
| 300 |
NS_LOG_INFO ("Setting initial Rss to " << rssCurrent); |
395 |
NS_LOG_INFO ("Setting initial Rss to " << rssCurrent); |
| 301 |
//Move the STA by stepsSize meters every stepTime seconds |
396 |
//Move the STA by stepsSize meters every stepTime seconds |
|
Lines 327-333
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 327 |
client->SetAttribute ("PacketSize", UintegerValue (packetSize)); |
422 |
client->SetAttribute ("PacketSize", UintegerValue (packetSize)); |
| 328 |
|
423 |
|
| 329 |
// Set a maximum rate 10% above the yMax specified for the selected standard |
424 |
// Set a maximum rate 10% above the yMax specified for the selected standard |
| 330 |
double rate = selectedStandard.m_yMax * 1e6 * 1.10; |
425 |
double rate = clientSelectedStandard.m_yMax * 1e6 * 1.10; |
| 331 |
double clientInterval = static_cast<double> (packetSize) * 8 / rate; |
426 |
double clientInterval = static_cast<double> (packetSize) * 8 / rate; |
| 332 |
NS_LOG_DEBUG ("Setting interval to " << clientInterval << " sec for rate of " << rate << " bits/sec"); |
427 |
NS_LOG_DEBUG ("Setting interval to " << clientInterval << " sec for rate of " << rate << " bits/sec"); |
| 333 |
|
428 |
|
|
Lines 348-375
int main (int argc, char *argv[])
|
Link Here
|
|---|
|
| 348 |
|
443 |
|
| 349 |
std::ostringstream xMinStr, xMaxStr, yMaxStr; |
444 |
std::ostringstream xMinStr, xMaxStr, yMaxStr; |
| 350 |
std::string xRangeStr ("set xrange ["); |
445 |
std::string xRangeStr ("set xrange ["); |
| 351 |
xMinStr << selectedStandard.m_xMin; |
446 |
xMinStr << clientSelectedStandard.m_xMin; |
| 352 |
xRangeStr.append (xMinStr.str ()); |
447 |
xRangeStr.append (xMinStr.str ()); |
| 353 |
xRangeStr.append (":"); |
448 |
xRangeStr.append (":"); |
| 354 |
xMaxStr << selectedStandard.m_xMax; |
449 |
xMaxStr << clientSelectedStandard.m_xMax; |
| 355 |
xRangeStr.append (xMaxStr.str ()); |
450 |
xRangeStr.append (xMaxStr.str ()); |
| 356 |
xRangeStr.append ("]"); |
451 |
xRangeStr.append ("]"); |
| 357 |
std::string yRangeStr ("set yrange [0:"); |
452 |
std::string yRangeStr ("set yrange [0:"); |
| 358 |
yMaxStr << selectedStandard.m_yMax; |
453 |
yMaxStr << clientSelectedStandard.m_yMax; |
| 359 |
yRangeStr.append (yMaxStr.str ()); |
454 |
yRangeStr.append (yMaxStr.str ()); |
| 360 |
yRangeStr.append ("]"); |
455 |
yRangeStr.append ("]"); |
| 361 |
|
456 |
|
| 362 |
std::ostringstream widthStrStr; |
457 |
std::ostringstream serverWidthStrStr; |
| 363 |
std::ostringstream nssStrStr; |
458 |
std::ostringstream serverNssStrStr; |
| 364 |
std::string title ("Wi-Fi ideal rate control: "); |
459 |
std::string title ("Wi-Fi ideal rate control. Server: "); |
| 365 |
title.append (standard); |
460 |
title.append (serverStandard); |
|
|
461 |
title.append (" channel width: "); |
| 462 |
serverWidthStrStr << serverSelectedStandard.m_width; |
| 463 |
title.append (serverWidthStrStr.str ()); |
| 464 |
title.append (" MHz nss: "); |
| 465 |
serverNssStrStr << serverNss; |
| 466 |
title.append (serverNssStrStr.str ()); |
| 467 |
if (clientShortGuardInterval == true) |
| 468 |
{ |
| 469 |
title.append (" shortGuard: true"); |
| 470 |
} |
| 471 |
|
| 472 |
std::ostringstream clientWidthStrStr; |
| 473 |
std::ostringstream clientNssStrStr; |
| 474 |
title.append (". Client: "); |
| 475 |
title.append (clientStandard); |
| 366 |
title.append (" channel width: "); |
476 |
title.append (" channel width: "); |
| 367 |
widthStrStr << selectedStandard.m_width; |
477 |
clientWidthStrStr << clientSelectedStandard.m_width; |
| 368 |
title.append (widthStrStr.str ()); |
478 |
title.append (clientWidthStrStr.str ()); |
| 369 |
title.append (" MHz nss: "); |
479 |
title.append (" MHz nss: "); |
| 370 |
nssStrStr << nss; |
480 |
clientNssStrStr << clientNss; |
| 371 |
title.append (nssStrStr.str ()); |
481 |
title.append (clientNssStrStr.str ()); |
| 372 |
if (shortGuardInterval == true) |
482 |
if (clientShortGuardInterval == true) |
| 373 |
{ |
483 |
{ |
| 374 |
title.append (" shortGuard: true"); |
484 |
title.append (" shortGuard: true"); |
| 375 |
} |
485 |
} |