A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
WifiOfdmMaskSlopesTestCase Class Reference

Test checks if Wifi spectrum values for OFDM are generated properly. More...

+ Inheritance diagram for WifiOfdmMaskSlopesTestCase:
+ Collaboration diagram for WifiOfdmMaskSlopesTestCase:

Public Types

typedef std::pair< uint32_t, dBr_uIndexPowerPair
 typedef for a pair of sub-band index and relative power value
 
typedef std::vector< IndexPowerPairIndexPowerVect
 typedef for a vector of pairs of sub-band index and relative power value
 
- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 

Public Member Functions

 WifiOfdmMaskSlopesTestCase (const std::string &name, WifiStandard standard, WifiPhyBand band, MHz_u channelWidth, const std::vector< MHz_u > &centerFrequencies, const IndexPowerVect &maskRefs, dB_u tolerance, std::size_t precision, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
 Constructor.
 
 ~WifiOfdmMaskSlopesTestCase () override=default
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
void InterpolateAndAppendValues (IndexPowerVect &vect, IndexPowerPair start, IndexPowerPair stop) const
 Interpolate PSD values for indexes between provided start and stop and append to provided vector.
 

Private Attributes

Ptr< SpectrumValuem_actualSpectrum
 actual spectrum value
 
WifiPhyBand m_band
 the wifi PHY band to test
 
std::vector< MHz_um_centerFreqs
 the center frequency per contiguous segment to test
 
MHz_u m_channelWidth
 the total channel width to test
 
IndexPowerVect m_expectedPsd
 expected power values
 
std::size_t m_precision
 precision for double calculations (in decimals)
 
std::vector< bool > m_puncturedSubchannels
 bitmap indicating whether a 20 MHz subchannel is punctured or not (only used for 802.11ax and later)
 
WifiStandard m_standard
 the wifi standard to test
 
dB_u m_tolerance
 tolerance
 

Additional Inherited Members

- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Test checks if Wifi spectrum values for OFDM are generated properly.

Different test cases are configured by defining different standards and bandwidth.

Definition at line 31 of file wifi-transmit-mask-test.cc.

Member Typedef Documentation

◆ IndexPowerPair

typedef for a pair of sub-band index and relative power value

Definition at line 37 of file wifi-transmit-mask-test.cc.

◆ IndexPowerVect

typedef for a vector of pairs of sub-band index and relative power value

Definition at line 42 of file wifi-transmit-mask-test.cc.

Constructor & Destructor Documentation

◆ WifiOfdmMaskSlopesTestCase()

WifiOfdmMaskSlopesTestCase::WifiOfdmMaskSlopesTestCase ( const std::string & name,
WifiStandard standard,
WifiPhyBand band,
MHz_u channelWidth,
const std::vector< MHz_u > & centerFrequencies,
const IndexPowerVect & maskRefs,
dB_u tolerance,
std::size_t precision,
const std::vector< bool > & puncturedSubchannels = std::vector<bool>{} )

Constructor.

Parameters
nametest reference name
standardselected standard
bandselected PHY band
channelWidthtotal channel width
centerFrequenciesthe center frequency per contiguous segment
maskRefsvector of expected power values and corresponding indexes of generated PSD (only start and stop indexes/values given)
tolerancetolerance
precisionprecision (in decimals)
puncturedSubchannelsbitmap indicating whether a 20 MHz subchannel is punctured or not (only for 802.11ax and later)

Definition at line 100 of file wifi-transmit-mask-test.cc.

References NS_LOG_FUNCTION.

◆ ~WifiOfdmMaskSlopesTestCase()

WifiOfdmMaskSlopesTestCase::~WifiOfdmMaskSlopesTestCase ( )
overridedefault

Member Function Documentation

◆ DoRun()

void WifiOfdmMaskSlopesTestCase::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 276 of file wifi-transmit-mask-test.cc.

References m_actualSpectrum, m_expectedPsd, m_tolerance, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, and NS_TEST_EXPECT_MSG_EQ_TOL.

◆ DoSetup()

void WifiOfdmMaskSlopesTestCase::DoSetup ( )
overrideprivatevirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.

Reimplemented from ns3::TestCase.

Definition at line 126 of file wifi-transmit-mask-test.cc.

References ns3::WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(), ns3::WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity(), ns3::WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(), InterpolateAndAppendValues(), m_actualSpectrum, m_band, m_centerFreqs, m_channelWidth, m_expectedPsd, m_puncturedSubchannels, m_standard, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::WIFI_PHY_BAND_2_4GHZ, ns3::WIFI_PHY_BAND_5GHZ, ns3::WIFI_PHY_BAND_6GHZ, ns3::WIFI_STANDARD_80211a, ns3::WIFI_STANDARD_80211ac, ns3::WIFI_STANDARD_80211ax, ns3::WIFI_STANDARD_80211g, ns3::WIFI_STANDARD_80211n, and ns3::WIFI_STANDARD_80211p.

+ Here is the call graph for this function:

◆ InterpolateAndAppendValues()

void WifiOfdmMaskSlopesTestCase::InterpolateAndAppendValues ( IndexPowerVect & vect,
IndexPowerPair start,
IndexPowerPair stop ) const
private

Interpolate PSD values for indexes between provided start and stop and append to provided vector.

Parameters
vectvector of sub-band index and relative power value pairs to which interpolated values should be appended
startpair of sub-band index and relative power value for interval start
stoppair of sub-band index and relative power value for interval stop

Definition at line 246 of file wifi-transmit-mask-test.cc.

References m_precision, m_tolerance, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::TestDoubleIsEqual().

Referenced by DoSetup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_actualSpectrum

Ptr<SpectrumValue> WifiOfdmMaskSlopesTestCase::m_actualSpectrum
private

actual spectrum value

Definition at line 94 of file wifi-transmit-mask-test.cc.

Referenced by DoRun(), and DoSetup().

◆ m_band

WifiPhyBand WifiOfdmMaskSlopesTestCase::m_band
private

the wifi PHY band to test

Definition at line 88 of file wifi-transmit-mask-test.cc.

Referenced by DoSetup().

◆ m_centerFreqs

std::vector<MHz_u> WifiOfdmMaskSlopesTestCase::m_centerFreqs
private

the center frequency per contiguous segment to test

Definition at line 90 of file wifi-transmit-mask-test.cc.

Referenced by DoSetup().

◆ m_channelWidth

MHz_u WifiOfdmMaskSlopesTestCase::m_channelWidth
private

the total channel width to test

Definition at line 89 of file wifi-transmit-mask-test.cc.

Referenced by DoSetup().

◆ m_expectedPsd

IndexPowerVect WifiOfdmMaskSlopesTestCase::m_expectedPsd
private

expected power values

Definition at line 95 of file wifi-transmit-mask-test.cc.

Referenced by DoRun(), and DoSetup().

◆ m_precision

std::size_t WifiOfdmMaskSlopesTestCase::m_precision
private

precision for double calculations (in decimals)

Definition at line 97 of file wifi-transmit-mask-test.cc.

Referenced by InterpolateAndAppendValues().

◆ m_puncturedSubchannels

std::vector<bool> WifiOfdmMaskSlopesTestCase::m_puncturedSubchannels
private

bitmap indicating whether a 20 MHz subchannel is punctured or not (only used for 802.11ax and later)

Definition at line 92 of file wifi-transmit-mask-test.cc.

Referenced by DoSetup().

◆ m_standard

WifiStandard WifiOfdmMaskSlopesTestCase::m_standard
private

the wifi standard to test

Definition at line 87 of file wifi-transmit-mask-test.cc.

Referenced by DoSetup().

◆ m_tolerance

dB_u WifiOfdmMaskSlopesTestCase::m_tolerance
private

tolerance

Definition at line 96 of file wifi-transmit-mask-test.cc.

Referenced by DoRun(), and InterpolateAndAppendValues().


The documentation for this class was generated from the following file: