diff --git a/src/wifi/model/wifi-bandwidth-filter.cc b/src/wifi/model/wifi-bandwidth-filter.cc index 245328778..ac086fc4b 100644 --- a/src/wifi/model/wifi-bandwidth-filter.cc +++ b/src/wifi/model/wifi-bandwidth-filter.cc @@ -82,58 +82,64 @@ WifiBandwidthFilter::DoFilter(Ptr params, "SpectrumWifiPhy::TrackSignalsFromInactiveInterfaces attribute is not enabled"); NS_ASSERT((interface != wifiPhy->GetCurrentInterface()) || - (wifiPhy->GetOperatingChannel().GetFrequency() == - interface->GetCenterFrequencies().front())); - NS_ASSERT((interface != wifiPhy->GetCurrentInterface()) || - (wifiPhy->GetOperatingChannel().GetWidth() == interface->GetChannelWidth())); + (wifiPhy->GetOperatingChannel().GetTotalWidth() == interface->GetChannelWidth())); + NS_ASSERT( + (interface != wifiPhy->GetCurrentInterface()) || + (wifiPhy->GetOperatingChannel().GetFrequencies() == interface->GetCenterFrequencies())); // The signal power is spread over a frequency interval that includes a guard // band on the left and a guard band on the right of the nominal TX band - - const auto rxCenterFreq = wifiRxParams->ppdu->GetTxCenterFreqs().front(); - const auto rxWidth = wifiRxParams->ppdu->GetTxVector().GetChannelWidth(); + const auto rxCenterFreqs = wifiRxParams->ppdu->GetTxCenterFreqs(); + // all segments have the same width + const auto rxWidth = + (wifiRxParams->ppdu->GetTxVector().GetChannelWidth() / rxCenterFreqs.size()); const auto guardBandwidth = wifiPhy->GetGuardBandwidth(rxWidth); - const auto operatingFrequency = interface->GetCenterFrequencies().front(); - const auto operatingChannelWidth = interface->GetChannelWidth(); - - const auto rxMinFreq = rxCenterFreq - rxWidth / 2 - guardBandwidth; - const auto rxMaxFreq = rxCenterFreq + rxWidth / 2 + guardBandwidth; - - const auto channelMinFreq = operatingFrequency - operatingChannelWidth / 2; - const auto channelMaxFreq = operatingFrequency + operatingChannelWidth / 2; - - /** - * The PPDU can be ignored if the two bands do not overlap. - * - * First non-overlapping case: - * - * ┌─────────┬─────────┬─────────┐ - * PPDU │ Guard │ Nominal │ Guard │ - * │ Band │ Band │ Band │ - * └─────────┴─────────┴─────────┘ - * rxMinFreq rxMaxFreq - * - * channelMinFreq channelMaxFreq - * ┌──────────────────────────────┐ - * │ Operating │ - * │ Channel │ - * └──────────────────────────────┘ - * - * Second non-overlapping case: - * - * ┌─────────┬─────────┬─────────┐ - * PPDU │ Guard │ Nominal │ Guard │ - * │ Band │ Band │ Band │ - * └─────────┴─────────┴─────────┘ - * rxMinFreq rxMaxFreq - * - * channelMinFreq channelMaxFreq - * ┌──────────────────────────────┐ - * │ Operating │ - * │ Channel │ - * └──────────────────────────────┘ - */ - auto filter = (rxMinFreq >= channelMaxFreq || rxMaxFreq <= channelMinFreq); + bool filter = true; + for (auto rxCenterFreq : rxCenterFreqs) + { + const auto rxMinFreq = rxCenterFreq - rxWidth / 2 - guardBandwidth; + const auto rxMaxFreq = rxCenterFreq + rxWidth / 2 + guardBandwidth; + const auto operatingFrequencies = interface->GetCenterFrequencies(); + const auto operatingChannelWidth = + interface->GetChannelWidth() / operatingFrequencies.size(); + for (auto operatingFrequency : operatingFrequencies) + { + const auto channelMinFreq = operatingFrequency - operatingChannelWidth / 2; + const auto channelMaxFreq = operatingFrequency + operatingChannelWidth / 2; + /** + * The PPDU can be ignored if the two bands do not overlap. + * + * First non-overlapping case: + * + * ┌─────────┬─────────┬─────────┐ + * PPDU │ Guard │ Nominal │ Guard │ + * │ Band │ Band │ Band │ + * └─────────┴─────────┴─────────┘ + * rxMinFreq rxMaxFreq + * + * channelMinFreq channelMaxFreq + * ┌──────────────────────────────┐ + * │ Operating │ + * │ Channel │ + * └──────────────────────────────┘ + * + * Second non-overlapping case: + * + * ┌─────────┬─────────┬─────────┐ + * PPDU │ Guard │ Nominal │ Guard │ + * │ Band │ Band │ Band │ + * └─────────┴─────────┴─────────┘ + * rxMinFreq rxMaxFreq + * + * channelMinFreq channelMaxFreq + * ┌──────────────────────────────┐ + * │ Operating │ + * │ Channel │ + * └──────────────────────────────┘ + */ + filter &= ((rxMinFreq >= channelMaxFreq) || (rxMaxFreq <= channelMinFreq)); + } + } NS_LOG_DEBUG("Returning " << filter); return filter; }