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), 
 virtual void DoRun(void)
Implementation to actually run this TestCase. 
Smart pointer class similar to boost::intrusive_ptr. 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static std::string Name(TvSpectrumTransmitter::TvType tvType, double startFrequency, double channelBandwidth, double basePsd)
virtual ~TvSpectrumTransmitterTestCase()
static TvSpectrumTransmitterTestSuite g_tvSpectrumTransmitterTestSuite
TvSpectrumTransmitter::TvType m_tvType
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
Values::const_iterator ConstValuesBegin() const
double m_channelBandwidth
static std::string Name(std::string str, uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t serverReadSize, uint32_t serverWriteSize, uint32_t sourceReadSize, bool useIpv6)
Hold variables of type enum. 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
TvSpectrumTransmitterTestSuite()
#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. 
TvSpectrumTransmitterTestCase(double startFrequency, double channelBandwidth, double basePsd, TvSpectrumTransmitter::TvType tvType)
Values::const_iterator ConstValuesEnd() const
static const double TOLERANCE
Tolerance used to check reciprocal of two numbers. 
Bands::const_iterator ConstBandsEnd() const
This class can be used to hold variables of floating point type such as 'double' or 'float'...
TvType
types of TV transmitters: analog, digital 8-VSB, or digital COFDM 
Bands::const_iterator ConstBandsBegin() const