|
|
| 36 |
#include "vht-configuration.h" |
36 |
#include "vht-configuration.h" |
| 37 |
#include "he-configuration.h" |
37 |
#include "he-configuration.h" |
| 38 |
#include "wifi-net-device.h" |
38 |
#include "wifi-net-device.h" |
|
|
39 |
#include "tx-vector-tag.h" |
| 39 |
|
40 |
|
| 40 |
namespace ns3 { |
41 |
namespace ns3 { |
| 41 |
|
42 |
|
| 42 |
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
43 |
NS_LOG_COMPONENT_DEFINE ("WifiRemoteStationManager"); |
| 43 |
|
44 |
|
| 44 |
/** |
|
|
| 45 |
* HighLatencyDataTxVectorTag class |
| 46 |
*/ |
| 47 |
class HighLatencyDataTxVectorTag : public Tag |
| 48 |
{ |
| 49 |
public: |
| 50 |
HighLatencyDataTxVectorTag (); |
| 51 |
/** |
| 52 |
* Constructor |
| 53 |
* |
| 54 |
* \param dataTxVector TXVECTOR for data frames |
| 55 |
*/ |
| 56 |
HighLatencyDataTxVectorTag (WifiTxVector dataTxVector); |
| 57 |
/** |
| 58 |
* \returns the transmission mode to use to send this packet |
| 59 |
*/ |
| 60 |
WifiTxVector GetDataTxVector (void) const; |
| 61 |
|
| 62 |
/** |
| 63 |
* \brief Get the type ID. |
| 64 |
* \return the object TypeId |
| 65 |
*/ |
| 66 |
static TypeId GetTypeId (void); |
| 67 |
virtual TypeId GetInstanceTypeId (void) const; |
| 68 |
virtual uint32_t GetSerializedSize (void) const; |
| 69 |
virtual void Serialize (TagBuffer i) const; |
| 70 |
virtual void Deserialize (TagBuffer i); |
| 71 |
virtual void Print (std::ostream &os) const; |
| 72 |
|
| 73 |
private: |
| 74 |
WifiTxVector m_dataTxVector; ///< TXVECTOR for data frames |
| 75 |
}; |
| 76 |
|
| 77 |
HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag () |
| 78 |
{ |
| 79 |
} |
| 80 |
|
| 81 |
HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag (WifiTxVector dataTxVector) |
| 82 |
: m_dataTxVector (dataTxVector) |
| 83 |
{ |
| 84 |
} |
| 85 |
|
| 86 |
WifiTxVector |
| 87 |
HighLatencyDataTxVectorTag::GetDataTxVector (void) const |
| 88 |
{ |
| 89 |
return m_dataTxVector; |
| 90 |
} |
| 91 |
|
| 92 |
TypeId |
| 93 |
HighLatencyDataTxVectorTag::GetTypeId (void) |
| 94 |
{ |
| 95 |
static TypeId tid = TypeId ("ns3::HighLatencyDataTxVectorTag") |
| 96 |
.SetParent<Tag> () |
| 97 |
.SetGroupName ("Wifi") |
| 98 |
.AddConstructor<HighLatencyDataTxVectorTag> () |
| 99 |
; |
| 100 |
return tid; |
| 101 |
} |
| 102 |
|
| 103 |
TypeId |
| 104 |
HighLatencyDataTxVectorTag::GetInstanceTypeId (void) const |
| 105 |
{ |
| 106 |
return GetTypeId (); |
| 107 |
} |
| 108 |
|
| 109 |
uint32_t |
| 110 |
HighLatencyDataTxVectorTag::GetSerializedSize (void) const |
| 111 |
{ |
| 112 |
return sizeof (WifiTxVector); |
| 113 |
} |
| 114 |
|
| 115 |
void |
| 116 |
HighLatencyDataTxVectorTag::Serialize (TagBuffer i) const |
| 117 |
{ |
| 118 |
i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
| 119 |
} |
| 120 |
|
| 121 |
void |
| 122 |
HighLatencyDataTxVectorTag::Deserialize (TagBuffer i) |
| 123 |
{ |
| 124 |
i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
| 125 |
} |
| 126 |
|
| 127 |
void |
| 128 |
HighLatencyDataTxVectorTag::Print (std::ostream &os) const |
| 129 |
{ |
| 130 |
os << "Data=" << m_dataTxVector; |
| 131 |
} |
| 132 |
|
| 133 |
/** |
| 134 |
* HighLatencyRtsTxVectorTag class |
| 135 |
*/ |
| 136 |
class HighLatencyRtsTxVectorTag : public Tag |
| 137 |
{ |
| 138 |
public: |
| 139 |
HighLatencyRtsTxVectorTag (); |
| 140 |
/** |
| 141 |
* Constructor |
| 142 |
* |
| 143 |
* \param rtsTxVector TXVECTOR for RTS frames |
| 144 |
*/ |
| 145 |
HighLatencyRtsTxVectorTag (WifiTxVector rtsTxVector); |
| 146 |
/** |
| 147 |
* \returns the transmission mode to use to send the RTS prior to the |
| 148 |
* transmission of the data packet itself. |
| 149 |
*/ |
| 150 |
WifiTxVector GetRtsTxVector (void) const; |
| 151 |
|
| 152 |
/** |
| 153 |
* \brief Get the type ID. |
| 154 |
* \return the object TypeId |
| 155 |
*/ |
| 156 |
static TypeId GetTypeId (void); |
| 157 |
virtual TypeId GetInstanceTypeId (void) const; |
| 158 |
virtual uint32_t GetSerializedSize (void) const; |
| 159 |
virtual void Serialize (TagBuffer i) const; |
| 160 |
virtual void Deserialize (TagBuffer i); |
| 161 |
virtual void Print (std::ostream &os) const; |
| 162 |
|
| 163 |
private: |
| 164 |
WifiTxVector m_rtsTxVector; ///< TXVECTOR for data frames |
| 165 |
}; |
| 166 |
|
| 167 |
HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag () |
| 168 |
{ |
| 169 |
} |
| 170 |
|
| 171 |
HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag (WifiTxVector rtsTxVector) |
| 172 |
: m_rtsTxVector (rtsTxVector) |
| 173 |
{ |
| 174 |
} |
| 175 |
|
| 176 |
WifiTxVector |
| 177 |
HighLatencyRtsTxVectorTag::GetRtsTxVector (void) const |
| 178 |
{ |
| 179 |
return m_rtsTxVector; |
| 180 |
} |
| 181 |
|
| 182 |
TypeId |
| 183 |
HighLatencyRtsTxVectorTag::GetTypeId (void) |
| 184 |
{ |
| 185 |
static TypeId tid = TypeId ("ns3::HighLatencyRtsTxVectorTag") |
| 186 |
.SetParent<Tag> () |
| 187 |
.SetGroupName ("Wifi") |
| 188 |
.AddConstructor<HighLatencyRtsTxVectorTag> () |
| 189 |
; |
| 190 |
return tid; |
| 191 |
} |
| 192 |
|
| 193 |
TypeId |
| 194 |
HighLatencyRtsTxVectorTag::GetInstanceTypeId (void) const |
| 195 |
{ |
| 196 |
return GetTypeId (); |
| 197 |
} |
| 198 |
|
| 199 |
uint32_t |
| 200 |
HighLatencyRtsTxVectorTag::GetSerializedSize (void) const |
| 201 |
{ |
| 202 |
return sizeof (WifiTxVector); |
| 203 |
} |
| 204 |
|
| 205 |
void |
| 206 |
HighLatencyRtsTxVectorTag::Serialize (TagBuffer i) const |
| 207 |
{ |
| 208 |
i.Write ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector)); |
| 209 |
} |
| 210 |
|
| 211 |
void |
| 212 |
HighLatencyRtsTxVectorTag::Deserialize (TagBuffer i) |
| 213 |
{ |
| 214 |
i.Read ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector)); |
| 215 |
} |
| 216 |
|
| 217 |
void |
| 218 |
HighLatencyRtsTxVectorTag::Print (std::ostream &os) const |
| 219 |
{ |
| 220 |
os << "Rts=" << m_rtsTxVector; |
| 221 |
} |
| 222 |
|
| 223 |
/** |
| 224 |
* HighLatencyCtsToSelfTxVectorTag class |
| 225 |
*/ |
| 226 |
class HighLatencyCtsToSelfTxVectorTag : public Tag |
| 227 |
{ |
| 228 |
public: |
| 229 |
HighLatencyCtsToSelfTxVectorTag (); |
| 230 |
/** |
| 231 |
* Constructor |
| 232 |
* |
| 233 |
* \param ctsToSelfTxVector TXVECTOR for CTS-to-self frames |
| 234 |
*/ |
| 235 |
HighLatencyCtsToSelfTxVectorTag (WifiTxVector ctsToSelfTxVector); |
| 236 |
/** |
| 237 |
* \returns the transmission mode to use for the CTS-to-self. |
| 238 |
*/ |
| 239 |
WifiTxVector GetCtsToSelfTxVector (void) const; |
| 240 |
|
| 241 |
/** |
| 242 |
* \brief Get the type ID. |
| 243 |
* \return the object TypeId |
| 244 |
*/ |
| 245 |
static TypeId GetTypeId (void); |
| 246 |
virtual TypeId GetInstanceTypeId (void) const; |
| 247 |
virtual uint32_t GetSerializedSize (void) const; |
| 248 |
virtual void Serialize (TagBuffer i) const; |
| 249 |
virtual void Deserialize (TagBuffer i); |
| 250 |
virtual void Print (std::ostream &os) const; |
| 251 |
|
| 252 |
private: |
| 253 |
WifiTxVector m_ctsToSelfTxVector; ///< TXVECTOR for CTS-to-self frames |
| 254 |
}; |
| 255 |
|
| 256 |
HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag () |
| 257 |
{ |
| 258 |
} |
| 259 |
|
| 260 |
HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag (WifiTxVector ctsToSelfTxVector) |
| 261 |
: m_ctsToSelfTxVector (ctsToSelfTxVector) |
| 262 |
{ |
| 263 |
} |
| 264 |
|
| 265 |
WifiTxVector |
| 266 |
HighLatencyCtsToSelfTxVectorTag::GetCtsToSelfTxVector (void) const |
| 267 |
{ |
| 268 |
return m_ctsToSelfTxVector; |
| 269 |
} |
| 270 |
|
| 271 |
TypeId |
| 272 |
HighLatencyCtsToSelfTxVectorTag::GetTypeId (void) |
| 273 |
{ |
| 274 |
static TypeId tid = TypeId ("ns3::HighLatencyCtsToSelfTxVectorTag") |
| 275 |
.SetParent<Tag> () |
| 276 |
.SetGroupName ("Wifi") |
| 277 |
.AddConstructor<HighLatencyCtsToSelfTxVectorTag> () |
| 278 |
; |
| 279 |
return tid; |
| 280 |
} |
| 281 |
|
| 282 |
TypeId |
| 283 |
HighLatencyCtsToSelfTxVectorTag::GetInstanceTypeId (void) const |
| 284 |
{ |
| 285 |
return GetTypeId (); |
| 286 |
} |
| 287 |
|
| 288 |
uint32_t |
| 289 |
HighLatencyCtsToSelfTxVectorTag::GetSerializedSize (void) const |
| 290 |
{ |
| 291 |
return sizeof (WifiTxVector); |
| 292 |
} |
| 293 |
|
| 294 |
void |
| 295 |
HighLatencyCtsToSelfTxVectorTag::Serialize (TagBuffer i) const |
| 296 |
{ |
| 297 |
i.Write ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector)); |
| 298 |
} |
| 299 |
|
| 300 |
void |
| 301 |
HighLatencyCtsToSelfTxVectorTag::Deserialize (TagBuffer i) |
| 302 |
{ |
| 303 |
i.Read ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector)); |
| 304 |
} |
| 305 |
|
| 306 |
void |
| 307 |
HighLatencyCtsToSelfTxVectorTag::Print (std::ostream &os) const |
| 308 |
{ |
| 309 |
os << "Cts To Self=" << m_ctsToSelfTxVector; |
| 310 |
} |
| 311 |
|
| 312 |
} //namespace ns3 |
| 313 |
|
| 314 |
namespace ns3 { |
| 315 |
|
| 316 |
NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager); |
45 |
NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager); |
| 317 |
|
46 |
|
| 318 |
TypeId |
47 |
TypeId |
|
|
| 815 |
packet->AddPacketTag (ctstoselftag); |
544 |
packet->AddPacketTag (ctstoselftag); |
| 816 |
} |
545 |
} |
| 817 |
|
546 |
|
| 818 |
uint16_t |
|
|
| 819 |
WifiRemoteStationManager::GetChannelWidthForTransmission (WifiMode mode, uint16_t maxSupportedChannelWidth) |
| 820 |
{ |
| 821 |
NS_LOG_FUNCTION (mode << maxSupportedChannelWidth); |
| 822 |
WifiModulationClass modulationClass = mode.GetModulationClass (); |
| 823 |
if (maxSupportedChannelWidth > 20 |
| 824 |
&& (modulationClass == WifiModulationClass::WIFI_MOD_CLASS_OFDM // all non-HT OFDM control and management frames |
| 825 |
|| modulationClass == WifiModulationClass::WIFI_MOD_CLASS_ERP_OFDM)) // special case of beacons at 2.4 GHz |
| 826 |
{ |
| 827 |
NS_LOG_LOGIC ("Channel width reduced to 20 MHz"); |
| 828 |
return 20; |
| 829 |
} |
| 830 |
//at 2.4 GHz basic rate can be non-ERP DSSS |
| 831 |
if (modulationClass == WifiModulationClass::WIFI_MOD_CLASS_DSSS |
| 832 |
|| modulationClass == WifiModulationClass::WIFI_MOD_CLASS_HR_DSSS) |
| 833 |
{ |
| 834 |
return 22; |
| 835 |
} |
| 836 |
return maxSupportedChannelWidth; |
| 837 |
} |
| 838 |
|
| 839 |
WifiTxVector |
547 |
WifiTxVector |
| 840 |
WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHeader *header, Ptr<const Packet> packet) |
548 |
WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHeader *header, Ptr<const Packet> packet) |
| 841 |
{ |
549 |
{ |
|
|
| 845 |
WifiMode mode = GetNonUnicastMode (); |
553 |
WifiMode mode = GetNonUnicastMode (); |
| 846 |
WifiTxVector v; |
554 |
WifiTxVector v; |
| 847 |
v.SetMode (mode); |
555 |
v.SetMode (mode); |
| 848 |
v.SetPreambleType (GetPreambleForTransmission (mode, address)); |
556 |
v.SetPreambleType (GetPreambleForTransmission (mode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address))); |
| 849 |
v.SetTxPowerLevel (m_defaultTxPowerLevel); |
557 |
v.SetTxPowerLevel (m_defaultTxPowerLevel); |
| 850 |
v.SetChannelWidth (GetChannelWidthForTransmission (mode, m_wifiPhy->GetChannelWidth ())); |
558 |
v.SetChannelWidth (GetChannelWidthForTransmission (mode, m_wifiPhy->GetChannelWidth ())); |
| 851 |
v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()))); |
559 |
v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()))); |
|
|
| 876 |
mgtMode = GetDefaultMode (); |
584 |
mgtMode = GetDefaultMode (); |
| 877 |
} |
585 |
} |
| 878 |
txVector.SetMode (mgtMode); |
586 |
txVector.SetMode (mgtMode); |
| 879 |
txVector.SetPreambleType (GetPreambleForTransmission (mgtMode, address)); |
587 |
txVector.SetPreambleType (GetPreambleForTransmission (mgtMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address))); |
| 880 |
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ())); |
588 |
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ())); |
| 881 |
txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()))); |
589 |
txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ()))); |
| 882 |
} |
590 |
} |
|
|
| 1347 |
return isLast; |
1055 |
return isLast; |
| 1348 |
} |
1056 |
} |
| 1349 |
|
1057 |
|
| 1350 |
bool |
|
|
| 1351 |
WifiRemoteStationManager::IsAllowedControlAnswerModulationClass (WifiModulationClass modClassReq, WifiModulationClass modClassAnswer) const |
| 1352 |
{ |
| 1353 |
switch (modClassReq) |
| 1354 |
{ |
| 1355 |
case WIFI_MOD_CLASS_DSSS: |
| 1356 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS); |
| 1357 |
case WIFI_MOD_CLASS_HR_DSSS: |
| 1358 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS || modClassAnswer == WIFI_MOD_CLASS_HR_DSSS); |
| 1359 |
case WIFI_MOD_CLASS_ERP_OFDM: |
| 1360 |
return (modClassAnswer == WIFI_MOD_CLASS_DSSS || modClassAnswer == WIFI_MOD_CLASS_HR_DSSS || modClassAnswer == WIFI_MOD_CLASS_ERP_OFDM); |
| 1361 |
case WIFI_MOD_CLASS_OFDM: |
| 1362 |
return (modClassAnswer == WIFI_MOD_CLASS_OFDM); |
| 1363 |
case WIFI_MOD_CLASS_HT: |
| 1364 |
case WIFI_MOD_CLASS_VHT: |
| 1365 |
case WIFI_MOD_CLASS_HE: |
| 1366 |
return true; |
| 1367 |
default: |
| 1368 |
NS_FATAL_ERROR ("Modulation class not defined"); |
| 1369 |
return false; |
| 1370 |
} |
| 1371 |
} |
| 1372 |
|
| 1373 |
WifiMode |
1058 |
WifiMode |
| 1374 |
WifiRemoteStationManager::GetControlAnswerMode (WifiMode reqMode) |
1059 |
WifiRemoteStationManager::GetControlAnswerMode (WifiMode reqMode) |
| 1375 |
{ |
1060 |
{ |
|
|
| 1518 |
WifiMode ctsMode = GetControlAnswerMode (rtsMode); |
1203 |
WifiMode ctsMode = GetControlAnswerMode (rtsMode); |
| 1519 |
WifiTxVector v; |
1204 |
WifiTxVector v; |
| 1520 |
v.SetMode (ctsMode); |
1205 |
v.SetMode (ctsMode); |
| 1521 |
v.SetPreambleType (GetPreambleForTransmission (ctsMode, address)); |
1206 |
v.SetPreambleType (GetPreambleForTransmission (ctsMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address))); |
| 1522 |
v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode)); |
1207 |
v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, ctsMode)); |
| 1523 |
v.SetChannelWidth (GetChannelWidthForTransmission (ctsMode, DoGetCtsTxChannelWidth (address, ctsMode))); |
1208 |
v.SetChannelWidth (GetChannelWidthForTransmission (ctsMode, DoGetCtsTxChannelWidth (address, ctsMode))); |
| 1524 |
v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode)); |
1209 |
v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode)); |
|
|
| 1535 |
WifiMode ackMode = GetControlAnswerMode (dataMode); |
1220 |
WifiMode ackMode = GetControlAnswerMode (dataMode); |
| 1536 |
WifiTxVector v; |
1221 |
WifiTxVector v; |
| 1537 |
v.SetMode (ackMode); |
1222 |
v.SetMode (ackMode); |
| 1538 |
v.SetPreambleType (GetPreambleForTransmission (ackMode, address)); |
1223 |
v.SetPreambleType (GetPreambleForTransmission (ackMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address))); |
| 1539 |
v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode)); |
1224 |
v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, ackMode)); |
| 1540 |
v.SetChannelWidth (GetChannelWidthForTransmission (ackMode, DoGetAckTxChannelWidth (address, ackMode))); |
1225 |
v.SetChannelWidth (GetChannelWidthForTransmission (ackMode, DoGetAckTxChannelWidth (address, ackMode))); |
| 1541 |
v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode)); |
1226 |
v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode)); |
|
|
| 1552 |
WifiMode blockAckMode = GetControlAnswerMode (blockAckReqMode); |
1237 |
WifiMode blockAckMode = GetControlAnswerMode (blockAckReqMode); |
| 1553 |
WifiTxVector v; |
1238 |
WifiTxVector v; |
| 1554 |
v.SetMode (blockAckMode); |
1239 |
v.SetMode (blockAckMode); |
| 1555 |
v.SetPreambleType (GetPreambleForTransmission (blockAckMode, address)); |
1240 |
v.SetPreambleType (GetPreambleForTransmission (blockAckMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (address))); |
| 1556 |
v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode)); |
1241 |
v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, blockAckMode)); |
| 1557 |
v.SetChannelWidth (GetChannelWidthForTransmission (blockAckMode, DoGetBlockAckTxChannelWidth (address, blockAckMode))); |
1242 |
v.SetChannelWidth (GetChannelWidthForTransmission (blockAckMode, DoGetBlockAckTxChannelWidth (address, blockAckMode))); |
| 1558 |
v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode)); |
1243 |
v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode)); |
|
|
| 2256 |
} |
1941 |
} |
| 2257 |
|
1942 |
|
| 2258 |
uint8_t |
1943 |
uint8_t |
| 2259 |
WifiRemoteStationManager::GetNumberOfAntennas (void) |
1944 |
WifiRemoteStationManager::GetNumberOfAntennas (void) const |
| 2260 |
{ |
1945 |
{ |
| 2261 |
return m_wifiPhy->GetNumberOfAntennas (); |
1946 |
return m_wifiPhy->GetNumberOfAntennas (); |
| 2262 |
} |
1947 |
} |
| 2263 |
|
1948 |
|
| 2264 |
uint8_t |
1949 |
uint8_t |
| 2265 |
WifiRemoteStationManager::GetMaxNumberOfTransmitStreams (void) |
1950 |
WifiRemoteStationManager::GetMaxNumberOfTransmitStreams (void) const |
| 2266 |
{ |
1951 |
{ |
| 2267 |
return m_wifiPhy->GetMaxSupportedTxSpatialStreams (); |
1952 |
return m_wifiPhy->GetMaxSupportedTxSpatialStreams (); |
| 2268 |
} |
1953 |
} |
| 2269 |
|
1954 |
|
| 2270 |
WifiPreamble |
1955 |
bool |
| 2271 |
WifiRemoteStationManager::GetPreambleForTransmission (WifiMode mode, Mac48Address dest) |
1956 |
WifiRemoteStationManager::UseGreenfieldForDestination (Mac48Address dest) const |
| 2272 |
{ |
|
|
| 2273 |
NS_LOG_FUNCTION (this << mode << dest); |
| 2274 |
WifiPreamble preamble; |
| 2275 |
if (mode.GetModulationClass () == WIFI_MOD_CLASS_HE) |
| 2276 |
{ |
| 2277 |
preamble = WIFI_PREAMBLE_HE_SU; |
| 2278 |
} |
| 2279 |
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT) |
| 2280 |
{ |
| 2281 |
preamble = WIFI_PREAMBLE_VHT; |
| 2282 |
} |
| 2283 |
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT && GetGreenfieldSupported () && GetGreenfieldSupported (dest) && !GetUseGreenfieldProtection ()) |
| 2284 |
{ |
| 2285 |
//If protection for greenfield is used we go for HT_MF preamble which is the default protection for GF format defined in the standard. |
| 2286 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 2287 |
} |
| 2288 |
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2289 |
{ |
| 2290 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2291 |
} |
| 2292 |
else if (GetShortPreambleEnabled ()) |
| 2293 |
{ |
| 2294 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2295 |
} |
| 2296 |
else |
| 2297 |
{ |
| 2298 |
preamble = WIFI_PREAMBLE_LONG; |
| 2299 |
} |
| 2300 |
NS_LOG_DEBUG ("selected preamble=" << preamble); |
| 2301 |
return preamble; |
| 2302 |
} |
| 2303 |
|
| 2304 |
WifiRemoteStation::~WifiRemoteStation () |
| 2305 |
{ |
1957 |
{ |
| 2306 |
NS_LOG_FUNCTION (this); |
1958 |
return (GetGreenfieldSupported () && GetGreenfieldSupported (dest) && !GetUseGreenfieldProtection ()); |
| 2307 |
} |
|
|
| 2308 |
|
| 2309 |
WifiRemoteStationInfo::WifiRemoteStationInfo () |
| 2310 |
: m_memoryTime (Seconds (1.0)), |
| 2311 |
m_lastUpdate (Seconds (0.0)), |
| 2312 |
m_failAvg (0.0) |
| 2313 |
{ |
| 2314 |
NS_LOG_FUNCTION (this); |
| 2315 |
} |
| 2316 |
|
| 2317 |
double |
| 2318 |
WifiRemoteStationInfo::CalculateAveragingCoefficient () |
| 2319 |
{ |
| 2320 |
double retval = std::exp (static_cast<double> (m_lastUpdate.GetMicroSeconds () - Simulator::Now ().GetMicroSeconds ()) / m_memoryTime.GetMicroSeconds ()); |
| 2321 |
m_lastUpdate = Simulator::Now (); |
| 2322 |
return retval; |
| 2323 |
} |
| 2324 |
|
| 2325 |
void |
| 2326 |
WifiRemoteStationInfo::NotifyTxSuccess (uint32_t retryCounter) |
| 2327 |
{ |
| 2328 |
double coefficient = CalculateAveragingCoefficient (); |
| 2329 |
m_failAvg = static_cast<double> (retryCounter) / (1 + retryCounter) * (1 - coefficient) + coefficient * m_failAvg; |
| 2330 |
} |
| 2331 |
|
| 2332 |
void |
| 2333 |
WifiRemoteStationInfo::NotifyTxFailed () |
| 2334 |
{ |
| 2335 |
double coefficient = CalculateAveragingCoefficient (); |
| 2336 |
m_failAvg = (1 - coefficient) + coefficient * m_failAvg; |
| 2337 |
} |
| 2338 |
|
| 2339 |
double |
| 2340 |
WifiRemoteStationInfo::GetFrameErrorRate () const |
| 2341 |
{ |
| 2342 |
return m_failAvg; |
| 2343 |
} |
1959 |
} |
| 2344 |
|
1960 |
|
| 2345 |
} //namespace ns3 |
1961 |
} //namespace ns3 |