fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("BuildingsPathlossTest");
|
||||
|
||||
using namespace ns3;
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,118 +50,74 @@ BuildingsPathlossTestSuite::BuildingsPathlossTestSuite ()
|
||||
|
||||
LogComponentEnable ("BuildingsPathlossTest", LOG_LEVEL_ALL);
|
||||
|
||||
double distance = 2000;
|
||||
double hm = 1;
|
||||
double hb = 30;
|
||||
double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
|
||||
Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm1->SetPosition (Vector (0.0, 0.0, hb));
|
||||
double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm2->SetPosition (Vector (distance, 0.0, hm));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 110.21, "loss OH OpenAreas"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 110.21, "loss OH OpenAreas"));
|
||||
|
||||
// Test #2 COST231 Model (1500 < freq < 2000~2170 MHz) (Macro<->UE)
|
||||
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 150.64, "COST231 Urban small city and suburban"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 150.64, "COST231 Urban small city and suburban"));
|
||||
|
||||
// Test #3 2.6 GHz model (Macro<->UE)
|
||||
|
||||
freq = 2.620e9; // E_UTRA BAND #7 see table 5.5-1 of 36.101
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model"));
|
||||
|
||||
// Test #4 ITU1411 LOS model (Macro<->UE)
|
||||
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm3 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm3->SetPosition (Vector (distance, 0.0, hm));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS"));
|
||||
|
||||
// Test #5 ITU1411 NLOS model (Macro<->UE)
|
||||
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
distance = 900;
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm4 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm4->SetPosition (Vector (distance, 0.0, hm));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS"));
|
||||
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS"));
|
||||
|
||||
// Test #6 ITUP1238 (HeNB <-> UE)
|
||||
|
||||
distance = 30;
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
double henbHeight = 10.0;
|
||||
Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
|
||||
building1->SetBuildingType (Building::Residential);
|
||||
building1->SetExtWallsType (Building::ConcreteWithWindows);
|
||||
mm5->SetIndoor (building1);
|
||||
Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm6->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm6->SetIndoor (building1);
|
||||
mm6->SetFloorNumber (2);
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm5, mm6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 5, 6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238"));
|
||||
|
||||
// Test #7 Outdoor -> Indoor OkumuraHata (Macro<->UE)
|
||||
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
distance = 2000;
|
||||
// The loss is as in test #2 (large city) plus the building penetration loss
|
||||
// which for ConcreteWithWindows is equal to 7 dB -> 148.55 + 7 = 155.55
|
||||
Ptr<BuildingsMobilityModel> mm7 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm7->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm7->SetIndoor (building1);
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 155.55, "Okumura Hata Outdoor -> Indoor"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 155.55, "Okumura Hata Outdoor -> Indoor"));
|
||||
|
||||
// Test #8 Outdoor -> Indoor ITU1411 (Macro<->UE)
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm8 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm8->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm8->SetIndoor (building1);
|
||||
// The loss is as in test #4 plus the building penetration loss
|
||||
// which for ConcreteWithWindows is equal to 7 dB -> 81.000 + 7 = 88.000
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 1, 8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor"));
|
||||
|
||||
// Test #9 Indoor -> Outdoor LOS (HeNB <-> UE)
|
||||
|
||||
distance = 100;
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
mm9->SetIndoor (building1);
|
||||
mm9->SetFloorNumber (2);
|
||||
Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm10->SetPosition (Vector (distance, 0.0, hm));
|
||||
// The loss is similar of test #4 plus the building penetration loss
|
||||
// which for ConcreteWithWindows is equal to 7 dB and the height gain
|
||||
// (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm9, mm10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 9, 10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor"));
|
||||
|
||||
// Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE)
|
||||
|
||||
distance = 500;
|
||||
freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
|
||||
Ptr<BuildingsMobilityModel> mm11 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm11->SetPosition (Vector (distance, 0.0, hm));
|
||||
// The loss is similar as in test #4 plus the building penetration loss
|
||||
// which for ConcreteWithWindows is equal to 7 dB and the height gain
|
||||
// (2 floors x 2 dB/floor = 4) -> 180.90 + 7 - 4 = 183.90
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor"));
|
||||
AddTestCase (new BuildingsPathlossTestCase (freq, 9, 11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor"));
|
||||
|
||||
|
||||
}
|
||||
@@ -175,11 +131,11 @@ static BuildingsPathlossTestSuite buildingsPathlossTestSuite;
|
||||
* TestCase
|
||||
*/
|
||||
|
||||
BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name)
|
||||
BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name)
|
||||
: TestCase ("LOSS calculation: " + name),
|
||||
m_freq (freq),
|
||||
m_node1 (m1),
|
||||
m_node2 (m2),
|
||||
m_mobilityModelIndex1 (m1),
|
||||
m_mobilityModelIndex2 (m2),
|
||||
m_env (env),
|
||||
m_city (city),
|
||||
m_lossRef (refValue)
|
||||
@@ -222,7 +178,13 @@ BuildingsPathlossTestCase::DoRun (void)
|
||||
// LogComponentEnable ("LteEnbNetDevice", logLevel);
|
||||
|
||||
LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
|
||||
NS_LOG_INFO ("Testing ");
|
||||
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
Ptr<MobilityModel> mma = CreateMobilityModel (m_mobilityModelIndex1);
|
||||
Ptr<MobilityModel> mmb = CreateMobilityModel (m_mobilityModelIndex2);
|
||||
|
||||
|
||||
|
||||
|
||||
Ptr<BuildingsPropagationLossModel> propagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
|
||||
@@ -235,7 +197,7 @@ BuildingsPathlossTestCase::DoRun (void)
|
||||
propagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
|
||||
propagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
|
||||
|
||||
double loss = propagationLossModel->GetLoss (m_node1, m_node2);
|
||||
double loss = propagationLossModel->GetLoss (mma, mmb);
|
||||
|
||||
NS_LOG_INFO ("Calculated loss: " << loss);
|
||||
NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
|
||||
@@ -243,3 +205,131 @@ BuildingsPathlossTestCase::DoRun (void)
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !");
|
||||
}
|
||||
|
||||
Ptr<MobilityModel>
|
||||
BuildingsPathlossTestCase::CreateMobilityModel (uint16_t index)
|
||||
{
|
||||
|
||||
/*
|
||||
* The purpose of this method is to defer the creation of the
|
||||
* MobilityModel instances to when DoRun() is called. In a previous
|
||||
* version, MobilityModel instances where created directly in the
|
||||
* constructor of the test suite, which caused subtle bugs due to
|
||||
* "static initialization order fiasco". An example of such a subtle
|
||||
* bug is that logging via NS_LOG failed for some modules.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
double distance = 2000;
|
||||
double hm = 1;
|
||||
double hb = 30;
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm1->SetPosition (Vector (0.0, 0.0, hb));
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm2->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm3 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm3->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
distance = 900;
|
||||
Ptr<BuildingsMobilityModel> mm4 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm4->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
distance = 30;
|
||||
double henbHeight = 10.0;
|
||||
Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
|
||||
// this needs to be static otherwise it will look like a different building every time
|
||||
static Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
|
||||
building1->SetBuildingType (Building::Residential);
|
||||
building1->SetExtWallsType (Building::ConcreteWithWindows);
|
||||
mm5->SetIndoor (building1);
|
||||
Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm6->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm6->SetIndoor (building1);
|
||||
mm6->SetFloorNumber (2);
|
||||
|
||||
distance = 2000;
|
||||
Ptr<BuildingsMobilityModel> mm7 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm7->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm7->SetIndoor (building1);
|
||||
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm8 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm8->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm8->SetIndoor (building1);
|
||||
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
mm9->SetIndoor (building1);
|
||||
mm9->SetFloorNumber (2);
|
||||
Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm10->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
distance = 500;
|
||||
Ptr<BuildingsMobilityModel> mm11 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm11->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
return mm1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return mm2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return mm3;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return mm4;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
return mm5;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return mm6;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
return mm7;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
return mm8;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
return mm9;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
return mm10;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
return mm11;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
#include <ns3/buildings-propagation-loss-model.h>
|
||||
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* Test 1.1 pathloss calculation
|
||||
@@ -42,15 +41,16 @@ public:
|
||||
class BuildingsPathlossTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
BuildingsPathlossTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name);
|
||||
BuildingsPathlossTestCase (double freq, uint16_t m1, uint16_t m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name);
|
||||
virtual ~BuildingsPathlossTestCase ();
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<MobilityModel> CreateMobilityModel (uint16_t index);
|
||||
|
||||
double m_freq;
|
||||
Ptr<BuildingsMobilityModel> m_node1;
|
||||
Ptr<BuildingsMobilityModel> m_node2;
|
||||
uint16_t m_mobilityModelIndex1;
|
||||
uint16_t m_mobilityModelIndex2;
|
||||
BuildingsPropagationLossModel::Environment m_env;
|
||||
BuildingsPropagationLossModel::CitySize m_city;
|
||||
double m_lossRef;
|
||||
@@ -60,3 +60,5 @@ private:
|
||||
|
||||
#endif /* BUILDING_PATHLOSS_TEST_H */
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -45,52 +45,17 @@ using namespace ns3;
|
||||
BuildingsShadowingTestSuite::BuildingsShadowingTestSuite ()
|
||||
: TestSuite ("buildings-shadowing-test", SYSTEM)
|
||||
{
|
||||
|
||||
|
||||
|
||||
LogComponentEnable ("BuildingsShadowingTest", LOG_LEVEL_ALL);
|
||||
|
||||
// Test #1 Outdoor Model
|
||||
|
||||
double distance = 2000;
|
||||
double hm = 1;
|
||||
double hb = 30;
|
||||
Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm1->SetPosition (Vector (0.0, 0.0, hb));
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm2->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
AddTestCase (new BuildingsShadowingTestCase (mm1, mm2, 148.86, 7.0, "Outdoor Shadowing"));
|
||||
// Test #1 Outdoor Model
|
||||
AddTestCase (new BuildingsShadowingTestCase (1, 2, 148.86, 7.0, "Outdoor Shadowing"));
|
||||
|
||||
// Test #2 Indoor model
|
||||
|
||||
distance = 30;
|
||||
double henbHeight = 10.0;
|
||||
Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
|
||||
building1->SetBuildingType (Building::Residential);
|
||||
building1->SetExtWallsType (Building::ConcreteWithWindows);
|
||||
mm5->SetIndoor (building1);
|
||||
Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm6->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm6->SetIndoor (building1);
|
||||
mm6->SetFloorNumber (2);
|
||||
AddTestCase (new BuildingsShadowingTestCase (mm5, mm6, 88.5724, 8.0, "Indoor Shadowing"));
|
||||
AddTestCase (new BuildingsShadowingTestCase (5, 6, 88.5724, 8.0, "Indoor Shadowing"));
|
||||
|
||||
// Test #3 Indoor -> Outdoor
|
||||
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
mm9->SetIndoor (building1);
|
||||
mm9->SetFloorNumber (2);
|
||||
Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm10->SetPosition (Vector (distance, 0.0, hm));
|
||||
// The loss is similar of test #4 plus the building penetration loss
|
||||
// which for ConcreteWithWindows is equal to 7 dB and the height gain
|
||||
// (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838
|
||||
AddTestCase (new BuildingsShadowingTestCase (mm9, mm10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing"));
|
||||
AddTestCase (new BuildingsShadowingTestCase (9, 10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing"));
|
||||
|
||||
}
|
||||
|
||||
@@ -101,10 +66,10 @@ static BuildingsShadowingTestSuite buildingsShadowingTestSuite;
|
||||
* TestCase
|
||||
*/
|
||||
|
||||
BuildingsShadowingTestCase::BuildingsShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name)
|
||||
BuildingsShadowingTestCase::BuildingsShadowingTestCase ( uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name)
|
||||
: TestCase ("SHADOWING calculation: " + name),
|
||||
m_node1 (m1),
|
||||
m_node2 (m2),
|
||||
m_mobilityModelIndex1 (m1),
|
||||
m_mobilityModelIndex2 (m2),
|
||||
m_lossRef (refValue),
|
||||
m_sigmaRef (sigmaRef)
|
||||
{
|
||||
@@ -146,6 +111,10 @@ BuildingsShadowingTestCase::DoRun (void)
|
||||
// LogComponentEnable ("LteEnbNetDevice", logLevel);
|
||||
|
||||
// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
Ptr<MobilityModel> mma = CreateMobilityModel (m_mobilityModelIndex1);
|
||||
Ptr<MobilityModel> mmb = CreateMobilityModel (m_mobilityModelIndex2);
|
||||
|
||||
std::vector<double> loss;
|
||||
double sum = 0.0;
|
||||
@@ -154,7 +123,7 @@ BuildingsShadowingTestCase::DoRun (void)
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
Ptr<BuildingsPropagationLossModel> propagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
|
||||
loss.push_back (propagationLossModel->GetLoss (m_node1, m_node2) - m_lossRef);
|
||||
loss.push_back (propagationLossModel->GetLoss (mma, mmb) - m_lossRef);
|
||||
sum += loss.at (loss.size()-1);
|
||||
sumSquared += (loss.at (loss.size()-1)*loss.at (loss.size()-1));
|
||||
}
|
||||
@@ -167,3 +136,84 @@ BuildingsShadowingTestCase::DoRun (void)
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL(fabs(mean), 0.0, ci, "Wrong shadowing distribution !");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ptr<MobilityModel>
|
||||
BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index)
|
||||
{
|
||||
/*
|
||||
* The purpose of this method is to defer the creation of the
|
||||
* MobilityModel instances to when DoRun() is called. In a previous
|
||||
* version, MobilityModel instances where created directly in the
|
||||
* constructor of the test suite, which caused subtle bugs due to
|
||||
* "static initialization order fiasco". An example of such a subtle
|
||||
* bug is that logging via NS_LOG failed for some modules.
|
||||
*
|
||||
*/
|
||||
|
||||
double distance = 2000;
|
||||
double hm = 1;
|
||||
double hb = 30;
|
||||
Ptr<BuildingsMobilityModel> mm1 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm1->SetPosition (Vector (0.0, 0.0, hb));
|
||||
|
||||
Ptr<BuildingsMobilityModel> mm2 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm2->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
|
||||
distance = 30;
|
||||
double henbHeight = 10.0;
|
||||
Ptr<BuildingsMobilityModel> mm5 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
static Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
|
||||
building1->SetBuildingType (Building::Residential);
|
||||
building1->SetExtWallsType (Building::ConcreteWithWindows);
|
||||
mm5->SetIndoor (building1);
|
||||
Ptr<BuildingsMobilityModel> mm6 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm6->SetPosition (Vector (distance, 0.0, hm));
|
||||
mm6->SetIndoor (building1);
|
||||
mm6->SetFloorNumber (2);
|
||||
|
||||
|
||||
distance = 100;
|
||||
Ptr<BuildingsMobilityModel> mm9 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
|
||||
mm9->SetIndoor (building1);
|
||||
mm9->SetFloorNumber (2);
|
||||
Ptr<BuildingsMobilityModel> mm10 = CreateObject<BuildingsMobilityModel> ();
|
||||
mm10->SetPosition (Vector (distance, 0.0, hm));
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
return mm1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return mm2;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
return mm5;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return mm6;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
return mm9;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
return mm10;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -43,17 +43,18 @@ class BuildingsShadowingTestSuite : public TestSuite
|
||||
class BuildingsShadowingTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
BuildingsShadowingTestCase (Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, double refValue, double sigmaRef, std::string name);
|
||||
BuildingsShadowingTestCase (uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name);
|
||||
virtual ~BuildingsShadowingTestCase ();
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
|
||||
Ptr<BuildingsMobilityModel> m_node1;
|
||||
Ptr<BuildingsMobilityModel> m_node2;
|
||||
Ptr<MobilityModel> CreateMobilityModel (uint16_t index);
|
||||
|
||||
uint16_t m_mobilityModelIndex1;
|
||||
uint16_t m_mobilityModelIndex2;
|
||||
double m_lossRef; // pathloss value (without shadowing)
|
||||
double m_sigmaRef;
|
||||
|
||||
};
|
||||
|
||||
#endif /*BUILDINGS_SHADOWING_TEST_H*/
|
||||
#endif /*BUILDINGS_SHADOWING_TEST_H*/
|
||||
|
||||
Reference in New Issue
Block a user