26 #include <ns3/boolean.h>
27 #include <ns3/spectrum-transmit-filter.h>
57 auto wifiRxParams = DynamicCast<const WifiSpectrumSignalParameters>(
params);
60 NS_LOG_DEBUG(
"Received a non Wi-Fi signal: do not filter");
67 NS_LOG_DEBUG(
"Sending a Wi-Fi signal to a non Wi-Fi device; do not filter");
71 auto wifiPhy = interface->GetSpectrumWifiPhy();
73 "WifiPhy should be valid if WifiSpectrumSignalParameters was found and sending "
74 "to a WifiSpectrumPhyInterface");
77 wifiPhy->GetAttribute(
"TrackSignalsFromInactiveInterfaces", trackSignalsInactiveInterfaces);
80 (interface == wifiPhy->GetCurrentInterface()),
81 "DoFilter should not be called for an inactive interface if "
82 "SpectrumWifiPhy::TrackSignalsFromInactiveInterfaces attribute is not enabled");
84 NS_ASSERT((interface != wifiPhy->GetCurrentInterface()) ||
85 (wifiPhy->GetOperatingChannel().GetFrequency() == interface->GetCenterFrequency()));
86 NS_ASSERT((interface != wifiPhy->GetCurrentInterface()) ||
87 (wifiPhy->GetOperatingChannel().GetWidth() == interface->GetChannelWidth()));
92 const auto rxCenterFreq = wifiRxParams->ppdu->GetTxCenterFreq();
93 const auto rxWidth = wifiRxParams->ppdu->GetTxVector().GetChannelWidth();
94 const auto guardBandwidth = wifiPhy->GetGuardBandwidth(rxWidth);
95 const auto operatingFrequency = interface->GetCenterFrequency();
96 const auto operatingChannelWidth = interface->GetChannelWidth();
98 const auto rxMinFreq = rxCenterFreq - rxWidth / 2 - guardBandwidth;
99 const auto rxMaxFreq = rxCenterFreq + rxWidth / 2 + guardBandwidth;
101 const auto channelMinFreq = operatingFrequency - operatingChannelWidth / 2;
102 const auto channelMaxFreq = operatingFrequency + operatingChannelWidth / 2;
135 auto 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.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.