20 #include "ns3/abort.h" 
   22 #include "ns3/config.h" 
   23 #include "ns3/double.h" 
   24 #include "ns3/propagation-loss-model.h" 
   25 #include "ns3/constant-position-mobility-model.h" 
   26 #include "ns3/simulator.h" 
   44   virtual void DoRun (
void);
 
   57   : 
TestCase (
"Check to see that the ns-3 Friis propagation loss model provides correct received power"), m_testVectors ()
 
   78   double txPowerW = 0.05035702;
 
   79   double txPowerdBm = 10 * std::log10 (txPowerW) + 30;
 
   93   testVector.
m_pt = txPowerdBm;
 
   94   testVector.
m_pr = 4.98265e-10;
 
   99   testVector.
m_pt = txPowerdBm;
 
  100   testVector.
m_pr = 1.99306e-11;
 
  105   testVector.
m_pt = txPowerdBm;
 
  106   testVector.
m_pr = 4.98265e-12;
 
  111   testVector.
m_pt = txPowerdBm;
 
  112   testVector.
m_pr = 1.24566e-12;
 
  127       double resultdBm = lossModel->CalcRxPower (testVector.
m_pt, a, b);
 
  128       double resultW = std::pow (10.0, resultdBm/10.0)/1000;
 
  142   virtual void DoRun (
void);
 
  156   : 
TestCase (
"Check to see that the ns-3 TwoRayGround propagation loss model provides correct received power"),
 
  178   double txPowerW = 0.05035702;
 
  179   double txPowerdBm = 10 * std::log10 (txPowerW) + 30;
 
  194   testVector.
m_pt = txPowerdBm;
 
  195   testVector.
m_pr = 4.98265e-10;
 
  202   testVector.
m_pt = txPowerdBm;
 
  203   testVector.
m_pr = 4.07891862e-12;
 
  208   testVector.
m_pt = txPowerdBm;
 
  209   testVector.
m_pr = 2.5493241375e-13;
 
  214   testVector.
m_pt = txPowerdBm;
 
  215   testVector.
m_pr = 1.593327585938e-14;
 
  224   testVector.
m_pt = txPowerdBm;
 
  225   testVector.
m_pr = 1.13303295e-11;
 
  232   testVector.
m_pt = txPowerdBm;
 
  233   testVector.
m_pr = 3.42742467375e-12;
 
  240   testVector.
m_pt = txPowerdBm;
 
  241   testVector.
m_pr = 9.36522547734e-13;
 
  257       double resultdBm = lossModel->CalcRxPower (testVector.
m_pt, a, b);
 
  258       double resultW = std::pow (10.0, resultdBm / 10.0) / 1000;
 
  271   virtual void DoRun (
void);
 
  284   : 
TestCase (
"Check to see that the ns-3 Log Distance propagation loss model provides correct received power"), m_testVectors ()
 
  301   double txPowerW = 0.05035702;
 
  302   double txPowerdBm = 10 * std::log10 (txPowerW) + 30;
 
  313   testVector.
m_pt = txPowerdBm;
 
  314   testVector.
m_pr = 4.98265e-9;
 
  319   testVector.
m_pt = txPowerdBm;
 
  320   testVector.
m_pr = 6.22831e-10;
 
  325   testVector.
m_pt = txPowerdBm;
 
  326   testVector.
m_pr = 7.78539e-11;
 
  331   testVector.
m_pt = txPowerdBm;
 
  332   testVector.
m_pr = 9.73173e-12;
 
  345       double resultdBm = lossModel->CalcRxPower (testVector.
m_pt, a, b);
 
  346       double resultW = std::pow (10.0, resultdBm/10.0)/1000;
 
  358   virtual void DoRun (
void);
 
  362   : 
TestCase (
"Test MatrixPropagationLossModel")
 
  374   for (
int i = 0; i < 3; ++i)
 
  376       m[i] = CreateObject<ConstantPositionMobilityModel> ();
 
  385   loss.
SetLoss (m[0], m[2], 30,  
false);
 
  386   loss.
SetLoss (m[2], m[0], 100,  
false);
 
  396   Simulator::Destroy ();
 
  406   virtual void DoRun (
void);
 
  410   : 
TestCase (
"Test RangePropagationLossModel")
 
  429   double txPwrdBm = -80.0;
 
  430   double tolerance = 1e-6;
 
  431   double resultdBm = lossModel->
CalcRxPower (txPwrdBm, a, b);
 
  434   resultdBm = lossModel->
CalcRxPower (txPwrdBm, a, b);
 
  436   Simulator::Destroy ();
 
  446   : 
TestSuite (
"propagation-loss-model", UNIT)
 
virtual ~TwoRayGroundPropagationLossModelTestCase()
void SetDefaultLoss(double defaultLoss)
Set the default propagation loss (in dB, positive) to be used, infinity if not set. 
TestVectors< TestVector > m_testVectors
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
LogDistancePropagationLossModelTestCase()
A simple way to store test vectors (for stimulus or from responses) 
static PropagationLossModelsTestSuite propagationLossModelsTestSuite
MatrixPropagationLossModelTestCase()
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite. 
TestVectors< TestVector > m_testVectors
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not. 
virtual ~RangePropagationLossModelTestCase()
virtual ~MatrixPropagationLossModelTestCase()
virtual ~LogDistancePropagationLossModelTestCase()
double CalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const 
Returns the Rx Power taking into account all the PropagatinLossModel(s) chained to the current one...
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
TestVectors< TestVector > m_testVectors
RangePropagationLossModelTestCase()
FriisPropagationLossModelTestCase()
void SetPosition(const Vector &position)
virtual void DoRun(void)
Implementation to actually run this TestCase. 
void SetDefault(std::string name, const AttributeValue &value)
virtual ~FriisPropagationLossModelTestCase()
void SetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, double loss, bool symmetric=true)
Set loss (in dB, positive) between pair of ns-3 objects (typically, nodes). 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
virtual void DoRun(void)
Implementation to actually run this TestCase. 
The propagation loss is fixed for each pair of nodes and doesn't depend on their actual positions...
virtual void DoRun(void)
Implementation to actually run this TestCase. 
TwoRayGroundPropagationLossModelTestCase()
PropagationLossModelsTestSuite()
virtual void DoRun(void)
Implementation to actually run this TestCase.