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) 2005,2006,2007 INRIA | 3 * Copyright (c) 2005,2006,2007 INRIA |
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined"); | 191 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined"); |
192 break; | 192 break; |
193 } | 193 } |
194 | 194 |
195 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); | 195 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); |
196 } | 196 } |
197 else if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLA
SS_VHT) | 197 else if (item->modClass == WIFI_MOD_CLASS_HT || item->modClass == WIFI_MOD_CLA
SS_VHT) |
198 { | 198 { |
199 if (item->modClass == WIFI_MOD_CLASS_VHT) | 199 if (item->modClass == WIFI_MOD_CLASS_VHT) |
200 { | 200 { |
201 NS_ASSERT_MSG (IsAllowed (channelWidth, nss), "VHT MCS " << (uint16_t)
item->mcsValue << " forbidden at " << (uint16_t)channelWidth << " MHz when NSS i
s " << (uint16_t)nss); | 201 NS_ASSERT_MSG (IsAllowed (channelWidth, nss), "VHT MCS " << static_cas
t<uint16_t> (item->mcsValue) << " forbidden at " << static_cast<uint16_t> (chann
elWidth) << " MHz when NSS is " << static_cast<uint16_t> (nss)); |
202 } | 202 } |
203 | 203 |
204 NS_ASSERT (guardInterval == 800 || guardInterval == 400); | 204 NS_ASSERT (guardInterval == 800 || guardInterval == 400); |
205 symbolRate = (1 / (3.2 + ((double)guardInterval / 1000))) * 1e6; | 205 symbolRate = (1 / (3.2 + (static_cast<double> (guardInterval) / 1000))) *
1e6; |
206 | 206 |
207 if (item->modClass == WIFI_MOD_CLASS_HT) | 207 if (item->modClass == WIFI_MOD_CLASS_HT) |
208 { | 208 { |
209 switch (channelWidth) | 209 switch (channelWidth) |
210 { | 210 { |
211 case 20: | 211 case 20: |
212 default: | 212 default: |
213 usableSubCarriers = 52; | 213 usableSubCarriers = 52; |
214 break; | 214 break; |
215 case 40: | 215 case 40: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 codingRate = (3.0 / 4.0); | 248 codingRate = (3.0 / 4.0); |
249 break; | 249 break; |
250 case WIFI_CODE_RATE_2_3: | 250 case WIFI_CODE_RATE_2_3: |
251 codingRate = (2.0 / 3.0); | 251 codingRate = (2.0 / 3.0); |
252 break; | 252 break; |
253 case WIFI_CODE_RATE_1_2: | 253 case WIFI_CODE_RATE_1_2: |
254 codingRate = (1.0 / 2.0); | 254 codingRate = (1.0 / 2.0); |
255 break; | 255 break; |
256 case WIFI_CODE_RATE_UNDEFINED: | 256 case WIFI_CODE_RATE_UNDEFINED: |
257 default: | 257 default: |
258 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined with nss: " << (uint16_t) nss); | 258 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined with nss: " << static_cast<uint16_t> (nss)); |
259 break; | 259 break; |
260 } | 260 } |
261 | 261 |
262 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); | 262 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); |
263 } | 263 } |
264 else if (item->modClass == WIFI_MOD_CLASS_HE) | 264 else if (item->modClass == WIFI_MOD_CLASS_HE) |
265 { | 265 { |
266 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval
== 3200); | 266 NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval
== 3200); |
267 symbolRate = (1 / (12.8 + ((double)guardInterval / 1000))) * 1e6; | 267 symbolRate = (1 / (12.8 + (static_cast<double> (guardInterval) / 1000))) *
1e6; |
268 | 268 |
269 switch (channelWidth) | 269 switch (channelWidth) |
270 { | 270 { |
271 case 20: | 271 case 20: |
272 default: | 272 default: |
273 usableSubCarriers = 234; | 273 usableSubCarriers = 234; |
274 break; | 274 break; |
275 case 40: | 275 case 40: |
276 usableSubCarriers = 468; | 276 usableSubCarriers = 468; |
277 break; | 277 break; |
(...skipping 14 matching lines...) Expand all Loading... |
292 codingRate = (3.0 / 4.0); | 292 codingRate = (3.0 / 4.0); |
293 break; | 293 break; |
294 case WIFI_CODE_RATE_2_3: | 294 case WIFI_CODE_RATE_2_3: |
295 codingRate = (2.0 / 3.0); | 295 codingRate = (2.0 / 3.0); |
296 break; | 296 break; |
297 case WIFI_CODE_RATE_1_2: | 297 case WIFI_CODE_RATE_1_2: |
298 codingRate = (1.0 / 2.0); | 298 codingRate = (1.0 / 2.0); |
299 break; | 299 break; |
300 case WIFI_CODE_RATE_UNDEFINED: | 300 case WIFI_CODE_RATE_UNDEFINED: |
301 default: | 301 default: |
302 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined with nss: " << (uint16_t) nss); | 302 NS_FATAL_ERROR ("trying to get datarate for a mcs without any coding r
ate defined with nss: " << static_cast<uint16_t> (nss)); |
303 break; | 303 break; |
304 } | 304 } |
305 | 305 |
306 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); | 306 dataRate = lrint (ceil (symbolRate * usableSubCarriers * numberOfBitsPerSu
bcarrier * codingRate)); |
307 } | 307 } |
308 else | 308 else |
309 { | 309 { |
310 NS_ASSERT ("undefined datarate for the modulation class!"); | 310 NS_ASSERT ("undefined datarate for the modulation class!"); |
311 } | 311 } |
312 dataRate *= nss; // number of spatial streams | 312 dataRate *= nss; // number of spatial streams |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 uint32_t j = 0; | 779 uint32_t j = 0; |
780 for (WifiModeItemList::const_iterator i = m_itemList.begin (); | 780 for (WifiModeItemList::const_iterator i = m_itemList.begin (); |
781 i != m_itemList.end (); i++) | 781 i != m_itemList.end (); i++) |
782 { | 782 { |
783 if (i->uniqueUid == uniqueUid) | 783 if (i->uniqueUid == uniqueUid) |
784 { | 784 { |
785 return j; | 785 return j; |
786 } | 786 } |
787 j++; | 787 j++; |
788 } | 788 } |
789 uint32_t uid = m_itemList.size (); | 789 uint32_t uid = static_cast<uint32_t>(m_itemList.size ()); |
790 m_itemList.push_back (WifiModeItem ()); | 790 m_itemList.push_back (WifiModeItem ()); |
791 return uid; | 791 return uid; |
792 } | 792 } |
793 | 793 |
794 WifiModeFactory::WifiModeItem * | 794 WifiModeFactory::WifiModeItem * |
795 WifiModeFactory::Get (uint32_t uid) | 795 WifiModeFactory::Get (uint32_t uid) |
796 { | 796 { |
797 NS_ASSERT (uid < m_itemList.size ()); | 797 NS_ASSERT (uid < m_itemList.size ()); |
798 return &m_itemList[uid]; | 798 return &m_itemList[uid]; |
799 } | 799 } |
(...skipping 12 matching lines...) Expand all Loading... |
812 item->constellationSize = 0; | 812 item->constellationSize = 0; |
813 item->codingRate = WIFI_CODE_RATE_UNDEFINED; | 813 item->codingRate = WIFI_CODE_RATE_UNDEFINED; |
814 item->isMandatory = false; | 814 item->isMandatory = false; |
815 item->mcsValue = 0; | 815 item->mcsValue = 0; |
816 isFirstTime = false; | 816 isFirstTime = false; |
817 } | 817 } |
818 return &factory; | 818 return &factory; |
819 } | 819 } |
820 | 820 |
821 } //namespace ns3 | 821 } //namespace ns3 |
LEFT | RIGHT |