15#include <ns3/boolean.h>
16#include <ns3/spectrum-transmit-filter.h>
49 NS_LOG_DEBUG(
"Received a non Wi-Fi signal: do not filter");
56 NS_LOG_DEBUG(
"Sending a Wi-Fi signal to a non Wi-Fi device; do not filter");
60 auto wifiPhy = interface->GetSpectrumWifiPhy();
62 "WifiPhy should be valid if WifiSpectrumSignalParameters was found and sending "
63 "to a WifiSpectrumPhyInterface");
66 wifiPhy->GetAttribute(
"TrackSignalsFromInactiveInterfaces", trackSignalsInactiveInterfaces);
69 (interface == wifiPhy->GetCurrentInterface()),
70 "DoFilter should not be called for an inactive interface if "
71 "SpectrumWifiPhy::TrackSignalsFromInactiveInterfaces attribute is not enabled");
73 NS_ASSERT((interface != wifiPhy->GetCurrentInterface()) ||
74 (wifiPhy->GetOperatingChannel().GetTotalWidth() == interface->GetChannelWidth()));
76 (interface != wifiPhy->GetCurrentInterface()) ||
77 (wifiPhy->GetOperatingChannel().GetFrequencies() == interface->GetCenterFrequencies()));
81 const auto rxCenterFreqs = wifiRxParams->ppdu->GetTxCenterFreqs();
84 (wifiRxParams->ppdu->GetTxVector().GetChannelWidth() / rxCenterFreqs.size());
85 const auto guardBandwidth = wifiPhy->GetGuardBandwidth(rxWidth);
87 for (
auto rxCenterFreq : rxCenterFreqs)
89 const auto rxMinFreq = rxCenterFreq - rxWidth / 2 - guardBandwidth;
90 const auto rxMaxFreq = rxCenterFreq + rxWidth / 2 + guardBandwidth;
91 const auto operatingFrequencies = interface->GetCenterFrequencies();
92 const auto operatingChannelWidth =
93 interface->GetChannelWidth() / operatingFrequencies.size();
94 for (
auto operatingFrequency : operatingFrequencies)
96 const auto channelMinFreq = operatingFrequency - operatingChannelWidth / 2;
97 const auto channelMaxFreq = operatingFrequency + operatingChannelWidth / 2;
129 filter &= ((rxMinFreq >= channelMaxFreq) || (rxMaxFreq <= channelMinFreq));
Smart pointer class similar to boost::intrusive_ptr.
spectrum-aware transmit filter object
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
bool DoFilter(Ptr< const SpectrumSignalParameters > params, Ptr< const SpectrumPhy > receiverPhy) override
Ignore the signal being received if it is a Wi-Fi PPDU whose TX band (including guard bands) does not...
This class is an adaptor between class SpectrumWifiPhy (which inherits from WifiPhy) and class Spectr...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.