wifi: Fix InterferenceHelper to use non-HT for all calculations before payload

This commit is contained in:
Sébastien Deronne
2020-01-13 22:31:34 +01:00
committed by Sebastien Deronne
parent cd1522e5d1
commit 2d5713f6b5
2 changed files with 35 additions and 10 deletions

View File

@@ -262,6 +262,20 @@ InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiM
{
return 1.0;
}
uint64_t rate = mode.GetDataRate (txVector.GetChannelWidth ());
uint64_t nbits = static_cast<uint64_t> (rate * duration.GetSeconds ());
double csr = m_errorRateModel->GetChunkSuccessRate (mode, txVector, snir, nbits);
return csr;
}
double
InterferenceHelper::CalculatePayloadChunkSuccessRate (double snir, Time duration, WifiTxVector txVector) const
{
if (duration.IsZero ())
{
return 1.0;
}
WifiMode mode = txVector.GetMode ();
uint64_t rate = mode.GetDataRate (txVector);
uint64_t nbits = static_cast<uint64_t> (rate * duration.GetSeconds ());
if (txVector.GetMode ().GetModulationClass () >= WIFI_MOD_CLASS_HT)
@@ -303,21 +317,21 @@ InterferenceHelper::CalculatePayloadPer (Ptr<const Event> event, NiChanges *ni,
//Case 1: Both previous and current point to the windowed payload
if (previous >= windowStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
txVector.GetChannelWidth ()),
Min (windowEnd, current) - previous,
payloadMode, txVector);
psr *= CalculatePayloadChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
txVector.GetChannelWidth ()),
Min (windowEnd, current) - previous,
txVector);
NS_LOG_DEBUG ("Both previous and current point to the windowed payload: mode=" << payloadMode << ", psr=" << psr);
}
//Case 2: previous is before windowed payload and current is in the windowed payload
else if (current >= windowStart)
{
psr *= CalculateChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
txVector.GetChannelWidth ()),
Min (windowEnd, current) - windowStart,
payloadMode, txVector);
psr *= CalculatePayloadChunkSuccessRate (CalculateSnr (powerW,
noiseInterferenceW,
txVector.GetChannelWidth ()),
Min (windowEnd, current) - windowStart,
txVector);
NS_LOG_DEBUG ("previous is before windowed payload and current is in the windowed payload: mode=" << payloadMode << ", psr=" << psr);
}
noiseInterferenceW = j->second.GetPower () - powerW;

View File

@@ -306,6 +306,17 @@ private:
* \return the success rate
*/
double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, WifiTxVector txVector) const;
/**
* Calculate the success rate of the payload chunk given the SINR, duration, and Wi-Fi mode.
* The duration and mode are used to calculate how many bits are present in the chunk.
*
* \param snir SINR
* \param duration
* \param txVector
*
* \return the success rate
*/
double CalculatePayloadChunkSuccessRate (double snir, Time duration, WifiTxVector txVector) const;
/**
* Calculate the error rate of the given PLCP payload only in the provided time
* window (thus enabling per MPDU PER information). The PLCP payload can be divided into