23 #include <ns3/spectrum-value.h>
25 #include <ns3/double.h>
26 #include <ns3/tv-spectrum-transmitter.h>
48 double channelBandwidth,
54 virtual void DoRun (
void);
56 double startFrequency,
57 double channelBandwidth,
69 double startFrequency,
70 double channelBandwidth,
73 std::ostringstream oss;
74 oss <<
"TV type = " << tvType <<
", "
75 <<
"start frequency = " << startFrequency <<
" Hz, "
76 <<
"channel bandwidth = " << channelBandwidth <<
" Hz, "
77 <<
"base PSD = " << basePsd <<
" dBm per Hz";
82 double channelBandwidth,
85 :
TestCase (
Name (tvType, startFrequency, channelBandwidth, basePsd)),
86 m_startFrequency (startFrequency),
87 m_channelBandwidth (channelBandwidth),
116 if (*psdIter > maxValue)
122 double basePsdWattsHz = pow (10.0, (
m_basePsd - 30) / 10.0);
123 if (
m_tvType == TvSpectrumTransmitter::TVTYPE_8VSB)
125 double expectedPsd = (0.502 * basePsdWattsHz) + (21.577 * basePsdWattsHz);
130 "peak PSD value (" << maxValue <<
") is incorrect");
138 "peak PSD value (" << maxValue <<
") is incorrect");
148 "start frequency value (" << (*bandStart).fc <<
") is incorrect");
153 "end frequency value (" << (*(bandEnd - 1)).fc <<
") is incorrect");
164 :
TestSuite (
"tv-spectrum-transmitter", UNIT)
166 NS_LOG_INFO (
"creating TvSpectrumTransmitterTestSuite");
167 for (
double startFreq = 100; startFreq < 1e15; startFreq *= 10)
169 for (
double bandwidth = 100; bandwidth < 1e15; bandwidth *= 10)
171 for (
double psd = -100; psd <= 100; psd += 20)
176 TvSpectrumTransmitter::TVTYPE_8VSB),
181 for (
double startFreq = 100; startFreq < 1e15; startFreq *= 10)
183 for (
double bandwidth = 100; bandwidth < 1e15; bandwidth *= 10)
185 for (
double psd = -100; psd <= 100; psd += 20)
190 TvSpectrumTransmitter::TVTYPE_COFDM),
195 for (
double startFreq = 100; startFreq < 1e15; startFreq *= 10)
197 for (
double bandwidth = 100; bandwidth < 1e15; bandwidth *= 10)
199 for (
double psd = -100; psd <= 100; psd += 20)
204 TvSpectrumTransmitter::TVTYPE_ANALOG),
TvSpectrumTransmitterTestCase(double startFrequency, double channelBandwidth, double basePsd, TvSpectrumTransmitter::TvType tvType)
TvSpectrumTransmitter::TvType m_tvType
virtual ~TvSpectrumTransmitterTestCase()
static std::string Name(TvSpectrumTransmitter::TvType tvType, double startFrequency, double channelBandwidth, double basePsd)
virtual void DoRun(void)
Implementation to actually run this TestCase.
double m_channelBandwidth
TvSpectrumTransmitterTestSuite()
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Smart pointer class similar to boost::intrusive_ptr.
Values::const_iterator ConstValuesBegin() const
Bands::const_iterator ConstBandsEnd() const
Bands::const_iterator ConstBandsBegin() const
Values::const_iterator ConstValuesEnd() const
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
TvType
types of TV transmitters: analog, digital 8-VSB, or digital COFDM
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const double TOLERANCE
Tolerance used to check reciprocal of two numbers.
static std::string Name(std::string str, uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t serverReadSize, uint32_t serverWriteSize, uint32_t sourceReadSize, bool useIpv6)
static TvSpectrumTransmitterTestSuite g_tvSpectrumTransmitterTestSuite