Left: | ||
Right: |
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) 2015 | 3 * Copyright (c) 2015 |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 struct Input m_input; ///< input | 111 struct Input m_input; ///< input |
112 bool m_droppedA; ///< flag to indicate whether packet A has been dropped | 112 bool m_droppedA; ///< flag to indicate whether packet A has been dropped |
113 bool m_droppedB; ///< flag to indicate whether packet B has been dropped | 113 bool m_droppedB; ///< flag to indicate whether packet B has been dropped |
114 }; | 114 }; |
115 | 115 |
116 void | 116 void |
117 InterferenceExperiment::SendA (void) const | 117 InterferenceExperiment::SendA (void) const |
118 { | 118 { |
119 Ptr<Packet> p = Create<Packet> (m_input.packetSizeA); | 119 Ptr<Packet> p = Create<Packet> (m_input.packetSizeA); |
120 WifiTxVector txVector; | 120 WifiTxVector txVector; |
121 txVector.SetTxPowerLevel (static_cast<int8_t>(m_input.txPowerLevelA)); | 121 txVector.SetTxPowerLevel (0); //only one TX power level |
S. Deronne
2017/12/17 15:39:14
why int8_t? I think it is uint8_t
ammo6818-vandals.uidaho.edu
2018/02/18 05:13:08
cast eliminated
| |
122 txVector.SetMode (WifiMode (m_input.txModeA)); | 122 txVector.SetMode (WifiMode (m_input.txModeA)); |
123 txVector.SetPreambleType (m_input.preamble); | 123 txVector.SetPreambleType (m_input.preamble); |
124 m_txA->SendPacket (p, txVector); | 124 m_txA->SendPacket (p, txVector); |
125 } | 125 } |
126 | 126 |
127 void | 127 void |
128 InterferenceExperiment::SendB (void) const | 128 InterferenceExperiment::SendB (void) const |
129 { | 129 { |
130 Ptr<Packet> p = Create<Packet> (m_input.packetSizeB); | 130 Ptr<Packet> p = Create<Packet> (m_input.packetSizeB); |
131 WifiTxVector txVector; | 131 WifiTxVector txVector; |
132 txVector.SetTxPowerLevel (static_cast<uint8_t>(m_input.txPowerLevelB)); | 132 txVector.SetTxPowerLevel (0); //only one TX power level |
133 txVector.SetMode (WifiMode (m_input.txModeB)); | 133 txVector.SetMode (WifiMode (m_input.txModeB)); |
134 txVector.SetPreambleType (m_input.preamble); | 134 txVector.SetPreambleType (m_input.preamble); |
135 m_txB->SendPacket (p, txVector); | 135 m_txB->SendPacket (p, txVector); |
136 } | 136 } |
137 | 137 |
138 void | 138 void |
139 InterferenceExperiment::PacketDropped(Ptr<const Packet> packet) | 139 InterferenceExperiment::PacketDropped(Ptr<const Packet> packet) |
140 { | 140 { |
141 if (packet->GetUid () == 0) | 141 if (packet->GetUid () == 0) |
142 { | 142 { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 NS_LOG_ERROR ("Results are not expected!"); | 241 NS_LOG_ERROR ("Results are not expected!"); |
242 exit (1); | 242 exit (1); |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 int main (int argc, char *argv[]) | 246 int main (int argc, char *argv[]) |
247 { | 247 { |
248 InterferenceExperiment::Input input; | 248 InterferenceExperiment::Input input; |
249 std::string str_standard = "WIFI_PHY_STANDARD_80211a"; | 249 std::string str_standard = "WIFI_PHY_STANDARD_80211a"; |
250 std::string str_preamble = "WIFI_PREAMBLE_LONG"; | 250 std::string str_preamble = "WIFI_PREAMBLE_LONG"; |
251 double delay = 0; //microseconds | 251 uint64_t delay = 0; //microseconds |
252 | 252 |
253 CommandLine cmd; | 253 CommandLine cmd; |
254 cmd.AddValue ("delay", "Delay in microseconds between frame transmission from sender A and frame transmission from sender B", delay); | 254 cmd.AddValue ("delay", "Delay in microseconds between frame transmission from sender A and frame transmission from sender B", delay); |
255 cmd.AddValue ("xA", "The position of transmitter A (< 0)", input.xA); | 255 cmd.AddValue ("xA", "The position of transmitter A (< 0)", input.xA); |
256 cmd.AddValue ("xB", "The position of transmitter B (> 0)", input.xB); | 256 cmd.AddValue ("xB", "The position of transmitter B (> 0)", input.xB); |
257 cmd.AddValue ("packetSizeA", "Packet size in bytes of transmitter A", input.pa cketSizeA); | 257 cmd.AddValue ("packetSizeA", "Packet size in bytes of transmitter A", input.pa cketSizeA); |
258 cmd.AddValue ("packetSizeB", "Packet size in bytes of transmitter B", input.pa cketSizeB); | 258 cmd.AddValue ("packetSizeB", "Packet size in bytes of transmitter B", input.pa cketSizeB); |
259 cmd.AddValue ("txPowerA", "TX power level of transmitter A", input.txPowerLeve lA); | 259 cmd.AddValue ("txPowerA", "TX power level of transmitter A", input.txPowerLeve lA); |
260 cmd.AddValue ("txPowerB", "TX power level of transmitter B", input.txPowerLeve lB); | 260 cmd.AddValue ("txPowerB", "TX power level of transmitter B", input.txPowerLeve lB); |
261 cmd.AddValue ("txModeA", "Wifi mode used for payload transmission of sender A" , input.txModeA); | 261 cmd.AddValue ("txModeA", "Wifi mode used for payload transmission of sender A" , input.txModeA); |
262 cmd.AddValue ("txModeB", "Wifi mode used for payload transmission of sender B" , input.txModeB); | 262 cmd.AddValue ("txModeB", "Wifi mode used for payload transmission of sender B" , input.txModeB); |
263 cmd.AddValue ("standard", "IEEE 802.11 flavor", str_standard); | 263 cmd.AddValue ("standard", "IEEE 802.11 flavor", str_standard); |
264 cmd.AddValue ("preamble", "Type of preamble", str_preamble); | 264 cmd.AddValue ("preamble", "Type of preamble", str_preamble); |
265 cmd.AddValue ("enableCapture", "Enable/disable physical layer capture", input. captureEnabled); | 265 cmd.AddValue ("enableCapture", "Enable/disable physical layer capture", input. captureEnabled); |
266 cmd.AddValue ("captureMargin", "Margin used for physical layer capture", input .captureMargin); | 266 cmd.AddValue ("captureMargin", "Margin used for physical layer capture", input .captureMargin); |
267 cmd.AddValue ("checkResults", "Used to check results at the end of the test", checkResults); | 267 cmd.AddValue ("checkResults", "Used to check results at the end of the test", checkResults); |
268 cmd.AddValue ("expectRxASuccessfull", "Indicate whether packet A is expected t o be successfully received", expectRxASuccessfull); | 268 cmd.AddValue ("expectRxASuccessfull", "Indicate whether packet A is expected t o be successfully received", expectRxASuccessfull); |
269 cmd.AddValue ("expectRxBSuccessfull", "Indicate whether packet B is expected t o be successfully received", expectRxBSuccessfull); | 269 cmd.AddValue ("expectRxBSuccessfull", "Indicate whether packet B is expected t o be successfully received", expectRxBSuccessfull); |
270 cmd.Parse (argc, argv); | 270 cmd.Parse (argc, argv); |
271 | 271 |
272 LogComponentEnable ("WifiPhy", LOG_LEVEL_ALL); | 272 //LogComponentEnable ("WifiPhy", LOG_LEVEL_ALL); |
273 LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL); | 273 //LogComponentEnable ("YansWifiPhy", LOG_LEVEL_ALL); |
274 LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL); | 274 //LogComponentEnable ("InterferenceHelper", LOG_LEVEL_ALL); |
275 LogComponentEnable ("SimpleFrameCaptureModel", LOG_LEVEL_ALL); | 275 //LogComponentEnable ("SimpleFrameCaptureModel", LOG_LEVEL_ALL); |
S. Deronne
2018/02/18 08:06:44
I suggest to simply remove them
| |
276 | 276 |
277 input.interval = MicroSeconds (static_cast<uint64_t>(delay)); | 277 input.interval = MicroSeconds (delay); |
278 | 278 |
279 if (input.xA >= 0 || input.xB <= 0) | 279 if (input.xA >= 0 || input.xB <= 0) |
280 { | 280 { |
281 std::cout << "Value of xA must be smaller than 0 and value of xB must be b igger than 0!" << std::endl; | 281 std::cout << "Value of xA must be smaller than 0 and value of xB must be b igger than 0!" << std::endl; |
282 return 0; | 282 return 0; |
283 } | 283 } |
284 | 284 |
285 if (str_standard == "WIFI_PHY_STANDARD_80211a") | 285 if (str_standard == "WIFI_PHY_STANDARD_80211a") |
286 { | 286 { |
287 input.standard = WIFI_PHY_STANDARD_80211a; | 287 input.standard = WIFI_PHY_STANDARD_80211a; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 { | 331 { |
332 std::cout << "Preamble does not exist or is not compatible with the select ed standard!" << std::endl; | 332 std::cout << "Preamble does not exist or is not compatible with the select ed standard!" << std::endl; |
333 return 0; | 333 return 0; |
334 } | 334 } |
335 | 335 |
336 InterferenceExperiment experiment; | 336 InterferenceExperiment experiment; |
337 experiment.Run (input); | 337 experiment.Run (input); |
338 | 338 |
339 return 0; | 339 return 0; |
340 } | 340 } |
LEFT | RIGHT |