wifi: Add methods to convert L-SIG length to HE TB PPDU duration and vice versa

This commit is contained in:
Sébastien Deronne
2019-08-22 13:49:40 +02:00
parent feaee7fed9
commit 7ee21c2cf8
2 changed files with 48 additions and 0 deletions

View File

@@ -4845,6 +4845,37 @@ WifiPhy::GetBand (uint16_t /*bandWidth*/, uint8_t /*bandIndex*/)
return band;
}
uint16_t
WifiPhy::ConvertHeTbPpduDurationToLSigLength (Time ppduDuration, WifiPhyBand band)
{
uint8_t sigExtension = 0;
if (band == WIFI_PHY_BAND_2_4GHZ)
{
sigExtension = 6;
}
uint8_t m = 2; //HE TB PPDU so m is set to 2
uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
return length;
}
Time
WifiPhy::ConvertLSigLengthToHeTbPpduDuration (uint16_t length, WifiTxVector txVector, WifiPhyBand band)
{
Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
Time preambleDuration = CalculatePhyPreambleAndHeaderDuration (txVector);
uint8_t sigExtension = 0;
if (band == WIFI_PHY_BAND_2_4GHZ)
{
sigExtension = 6;
}
uint8_t m = 2; //HE TB PPDU so m is set to 2
//Equation 27-11 of IEEE P802.11ax/D4.0
Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (length + 3 + m) / 3)) * 4) + 20 + sigExtension);
uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.GetNanoSeconds ());
Time ppduDuration = preambleDuration + (nSymbols * tSymbol) + MicroSeconds (sigExtension);
return ppduDuration;
}
int64_t
WifiPhy::AssignStreams (int64_t stream)
{

View File

@@ -340,6 +340,23 @@ public:
*/
Time GetLastRxEndTime (void) const;
/**
* \param ppduDuration the duration of the HE TB PPDU
* \param band the frequency band being used
*
* \return the L-SIG length value corresponding to that HE TB PPDU duration.
*/
static uint16_t ConvertHeTbPpduDurationToLSigLength (Time ppduDuration, WifiPhyBand band);
/**
* \param length the L-SIG length value
* \param txVector the TXVECTOR used for the transmission of this HE TB PPDU
* \param band the frequency band being used
*
* \return the duration of the HE TB PPDU corresponding to that L-SIG length value.
*/
static Time ConvertLSigLengthToHeTbPpduDuration (uint16_t length, WifiTxVector txVector, WifiPhyBand band);
/**
* \param size the number of bytes in the packet to send
* \param txVector the TXVECTOR used for the transmission of this packet