diff --git a/src/lte/doc/source/lte-building-user.rst b/src/buildings/doc/source/lte-building-user.rst similarity index 100% rename from src/lte/doc/source/lte-building-user.rst rename to src/buildings/doc/source/lte-building-user.rst diff --git a/src/lte/doc/source/lte-pathloss-design.rst b/src/buildings/doc/source/lte-pathloss-design.rst similarity index 100% rename from src/lte/doc/source/lte-pathloss-design.rst rename to src/buildings/doc/source/lte-pathloss-design.rst diff --git a/src/lte/doc/source/lte-pathloss-testing.rst b/src/buildings/doc/source/lte-pathloss-testing.rst similarity index 100% rename from src/lte/doc/source/lte-pathloss-testing.rst rename to src/buildings/doc/source/lte-pathloss-testing.rst diff --git a/src/mobility/model/building.cc b/src/buildings/model/building.cc similarity index 100% rename from src/mobility/model/building.cc rename to src/buildings/model/building.cc diff --git a/src/mobility/model/building.h b/src/buildings/model/building.h similarity index 100% rename from src/mobility/model/building.h rename to src/buildings/model/building.h diff --git a/src/mobility/model/buildings-mobility-model.cc b/src/buildings/model/buildings-mobility-model.cc similarity index 100% rename from src/mobility/model/buildings-mobility-model.cc rename to src/buildings/model/buildings-mobility-model.cc diff --git a/src/mobility/model/buildings-mobility-model.h b/src/buildings/model/buildings-mobility-model.h similarity index 100% rename from src/mobility/model/buildings-mobility-model.h rename to src/buildings/model/buildings-mobility-model.h diff --git a/src/propagation/model/buildings-propagation-loss-model.cc b/src/buildings/model/buildings-propagation-loss-model.cc similarity index 100% rename from src/propagation/model/buildings-propagation-loss-model.cc rename to src/buildings/model/buildings-propagation-loss-model.cc diff --git a/src/propagation/model/buildings-propagation-loss-model.h b/src/buildings/model/buildings-propagation-loss-model.h similarity index 100% rename from src/propagation/model/buildings-propagation-loss-model.h rename to src/buildings/model/buildings-propagation-loss-model.h diff --git a/src/buildings/test/buildings-pathloss-test.cc b/src/buildings/test/buildings-pathloss-test.cc new file mode 100644 index 000000000..ec49515b2 --- /dev/null +++ b/src/buildings/test/buildings-pathloss-test.cc @@ -0,0 +1,262 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + */ + +#include + +#include + +#include +#include +#include +#include "ns3/string.h" +#include "ns3/double.h" +#include +#include + + +NS_LOG_COMPONENT_DEFINE ("BuildingsPathlossTest"); + +using namespace ns3; + + +/** + * Test 1.1 BuildingsPathlossModel Pathloss compound test + */ + +/** + * This TestSuite tests the BuildingPathlossModel by reproducing + * several communication scenarios + */ + + +BuildingsPathlossTestSuite::BuildingsPathlossTestSuite () + : TestSuite ("buildings-pathloss-test", SYSTEM) +{ + + 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 mm1 = CreateObject (); + mm1->SetPosition (Vector (0.0, 0.0, hb)); + + Ptr mm2 = CreateObject (); + mm2->SetPosition (Vector (distance, 0.0, hm)); + + AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city")); + + AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city")); + + 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")); + + // 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, mm1, mm2, 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")); + + // 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 mm3 = CreateObject (); + mm3->SetPosition (Vector (distance, 0.0, hm)); + AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm3, 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 mm4 = CreateObject (); + mm4->SetPosition (Vector (distance, 0.0, hm)); + AddTestCase (new BuildingsPathlossTestCase (freq, mm1, mm4, 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 mm5 = CreateObject (); + mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); + Ptr building1 = Create (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 mm6 = CreateObject (); + 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")); + + // 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 mm7 = CreateObject (); + 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")); + + // 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 mm8 = CreateObject (); + 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")); + + // 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 mm9 = CreateObject (); + mm9->SetPosition (Vector (0.0, 0.0, henbHeight)); + mm9->SetIndoor (building1); + mm9->SetFloorNumber (2); + Ptr mm10 = CreateObject (); + 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")); + + // 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 mm11 = CreateObject (); + 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")); + + +} + + + +static BuildingsPathlossTestSuite buildingsPathlossTestSuite; + + +/** + * TestCase + */ + +BuildingsPathlossTestCase::BuildingsPathlossTestCase (double freq, Ptr m1, Ptr 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_env (env), + m_city (city), + m_lossRef (refValue) +{ +} + +BuildingsPathlossTestCase::~BuildingsPathlossTestCase () +{ +} + +void +BuildingsPathlossTestCase::DoRun (void) +{ +// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); + +// LogComponentEnable ("LteEnbRrc", logLevel); +// LogComponentEnable ("LteUeRrc", logLevel); +// LogComponentEnable ("LteEnbMac", logLevel); +// LogComponentEnable ("LteUeMac", logLevel); +// LogComponentEnable ("LteRlc", logLevel); +// LogComponentEnable ("RrPacketScheduler", logLevel); +// +// LogComponentEnable ("LtePhy", logLevel); +// LogComponentEnable ("LteEnbPhy", logLevel); +// LogComponentEnable ("LteUePhy", logLevel); +// +// LogComponentEnable ("LteSpectrumPhy", logLevel); +// LogComponentEnable ("LteInterference", logLevel); +// LogComponentEnable ("LteSinrChunkProcessor", logLevel); +// +// LogComponentEnable ("LtePropagationLossModel", logLevel); +// LogComponentEnable ("LossModel", logLevel); +// LogComponentEnable ("ShadowingLossModel", logLevel); +// LogComponentEnable ("PenetrationLossModel", logLevel); +// LogComponentEnable ("MultipathLossModel", logLevel); +// LogComponentEnable ("PathLossModel", logLevel); +// +// LogComponentEnable ("LteNetDevice", logLevel); +// LogComponentEnable ("LteUeNetDevice", logLevel); +// LogComponentEnable ("LteEnbNetDevice", logLevel); + + LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); + NS_LOG_INFO ("Testing " << GetName()); + + Ptr m_downlinkChannel = CreateObject (); + Ptr m_uplinkChannel = CreateObject (); + Ptr m_downlinkPropagationLossModel = CreateObject (); + m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); + m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); + m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env)); + m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city)); + // cancel shadowing effect + m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); + m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); + m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); + Ptr m_uplinkPropagationLossModel = CreateObject (); + m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); + m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); + // cancel shadowing effect + m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); + m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); + m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); + m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel); + m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel); + + + + Simulator::Stop (Seconds (0.1)); + Simulator::Run (); + Simulator::Destroy (); + double loss = m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2); + + NS_LOG_INFO ("Calculated loss: " << loss); + NS_LOG_INFO ("Theoretical loss: " << m_lossRef); + + NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !"); +} + diff --git a/src/buildings/test/buildings-pathloss-test.h b/src/buildings/test/buildings-pathloss-test.h new file mode 100644 index 000000000..a8507edeb --- /dev/null +++ b/src/buildings/test/buildings-pathloss-test.h @@ -0,0 +1,62 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + */ + +#ifndef BUILDINGS_PATHLOSS_TEST_H +#define BUILDINGS_PATHLOSS_TEST_H + +#include +#include +#include + + +using namespace ns3; + + +/** +* Test 1.1 pathloss calculation +*/ +class BuildingsPathlossTestSuite : public TestSuite +{ +public: + BuildingsPathlossTestSuite (); +}; + + +class BuildingsPathlossTestCase : public TestCase +{ +public: + BuildingsPathlossTestCase (double freq, Ptr m1, Ptr m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name); + virtual ~BuildingsPathlossTestCase (); + +private: + virtual void DoRun (void); + + double m_freq; + Ptr m_node1; + Ptr m_node2; + BuildingsPropagationLossModel::Environment m_env; + BuildingsPropagationLossModel::CitySize m_city; + double m_lossRef; + +}; + + +#endif /* BUILDING_PATHLOSS_TEST_H */ + diff --git a/src/lte/test/lte-test-shadowing.cc b/src/buildings/test/buildings-shadowing-test.cc similarity index 64% rename from src/lte/test/lte-test-shadowing.cc rename to src/buildings/test/buildings-shadowing-test.cc index 68f8ca4ef..3b48efe08 100644 --- a/src/lte/test/lte-test-shadowing.cc +++ b/src/buildings/test/buildings-shadowing-test.cc @@ -19,35 +19,25 @@ */ #include "ns3/simulator.h" - #include "ns3/log.h" - -#include "ns3/spectrum-test.h" - -#include "ns3/lte-phy-tag.h" -#include "ns3/lte-test-ue-phy.h" -#include "ns3/lte-sinr-chunk-processor.h" - -#include "ns3/lte-test-shadowing.h" +#include "ns3/buildings-shadowing-test.h" #include -#include -#include -#include +#include #include #include "ns3/string.h" #include "ns3/double.h" #include #include -#include -#include -#include -#include -#include -#include -#include -#include "lte-test-sinr-chunk-processor.h" +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include -NS_LOG_COMPONENT_DEFINE ("LteShadowingTest"); +NS_LOG_COMPONENT_DEFINE ("BuildingsShadowingTest"); using namespace ns3; @@ -62,52 +52,12 @@ using namespace ns3; */ -LteShadowingTestSuite::LteShadowingTestSuite () -: TestSuite ("lte-shadowing-model", SYSTEM) +BuildingsShadowingTestSuite::BuildingsShadowingTestSuite () +: TestSuite ("buildings-shadowing-test", SYSTEM) { - // -------------- UNIT TESTS ---------------------------------- - - LogComponentEnable ("LteShadowingTest", LOG_LEVEL_ALL); - - // NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite"); - - Ptr lena = CreateObject (); - - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); - - // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB) - NodeContainer enbNodes; - NodeContainer henbNodes; - NodeContainer ueNodes; - NodeContainer hueNodes; - enbNodes.Create (1); - henbNodes.Create (2); - ueNodes.Create (5); - hueNodes.Create (3); - - // Install Mobility Model - MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); - mobility.Install (enbNodes); - mobility.Install (henbNodes); - mobility.Install (ueNodes); - mobility.Install (hueNodes); - - NetDeviceContainer enbDevs; - NetDeviceContainer henbDevs; - NetDeviceContainer ueDevs; - NetDeviceContainer hueDevs; - enbDevs = lena->InstallEnbDevice (enbNodes); - ueDevs = lena->InstallUeDevice (ueNodes); - henbDevs = lena->InstallEnbDevice (henbNodes); - hueDevs = lena->InstallUeDevice (hueNodes); - - - - lena->Attach (ueDevs, enbDevs.Get (0)); - lena->Attach (hueDevs, henbDevs.Get (0)); + LogComponentEnable ("BuildingsShadowingTest", LOG_LEVEL_ALL); // Test #1 Outdoor Model @@ -115,56 +65,56 @@ LteShadowingTestSuite::LteShadowingTestSuite () double hm = 1; double hb = 30; double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101 - Ptr mm1 = enbNodes.Get (0)->GetObject (); + Ptr mm1 = CreateObject (); mm1->SetPosition (Vector (0.0, 0.0, hb)); - Ptr mm2 = ueNodes.Get (0)->GetObject (); + Ptr mm2 = CreateObject (); mm2->SetPosition (Vector (distance, 0.0, hm)); - AddTestCase (new LteShadowingTestCase (mm1, mm2, 148.86, 7.0, "Outdoor Shadowing")); + AddTestCase (new BuildingsShadowingTestCase (mm1, mm2, 148.86, 7.0, "Outdoor Shadowing")); // Test #2 Indoor model distance = 30; freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 double henbHeight = 10.0; - Ptr mm5 = henbNodes.Get (0)->GetObject (); + Ptr mm5 = CreateObject (); mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); Ptr building1 = Create (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 mm6 = hueNodes.Get (0)->GetObject (); + Ptr mm6 = CreateObject (); mm6->SetPosition (Vector (distance, 0.0, hm)); mm6->SetIndoor (building1); mm6->SetFloorNumber (2); - AddTestCase (new LteShadowingTestCase (mm5, mm6, 88.5724, 8.0, "Indoor Shadowing")); + AddTestCase (new BuildingsShadowingTestCase (mm5, mm6, 88.5724, 8.0, "Indoor Shadowing")); // Test #3 Indoor -> Outdoor distance = 100; freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101 - Ptr mm9 = henbNodes.Get (1)->GetObject (); + Ptr mm9 = CreateObject (); mm9->SetPosition (Vector (0.0, 0.0, henbHeight)); mm9->SetIndoor (building1); mm9->SetFloorNumber (2); - Ptr mm10 = hueNodes.Get (1)->GetObject (); + Ptr mm10 = CreateObject (); 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 LteShadowingTestCase (mm9, mm10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing")); + AddTestCase (new BuildingsShadowingTestCase (mm9, mm10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing")); } -static LteShadowingTestSuite lteShadowingTestSuite; +static BuildingsShadowingTestSuite buildingsShadowingTestSuite; /** * TestCase */ -LteShadowingTestCase::LteShadowingTestCase (Ptr m1, Ptr m2, double refValue, double sigmaRef, std::string name) +BuildingsShadowingTestCase::BuildingsShadowingTestCase (Ptr m1, Ptr m2, double refValue, double sigmaRef, std::string name) : TestCase ("SHADOWING calculation: " + name), m_node1 (m1), m_node2 (m2), @@ -173,12 +123,12 @@ m_sigmaRef (sigmaRef) { } -LteShadowingTestCase::~LteShadowingTestCase () +BuildingsShadowingTestCase::~BuildingsShadowingTestCase () { } void -LteShadowingTestCase::DoRun (void) +BuildingsShadowingTestCase::DoRun (void) { // LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); @@ -210,6 +160,7 @@ LteShadowingTestCase::DoRun (void) // LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); NS_LOG_INFO ("Testing " << GetName()); + std::vector loss; double sum = 0.0; double sumSquared = 0.0; diff --git a/src/lte/test/lte-test-shadowing.h b/src/buildings/test/buildings-shadowing-test.h similarity index 74% rename from src/lte/test/lte-test-shadowing.h rename to src/buildings/test/buildings-shadowing-test.h index c9eda4d8f..66c4bf0c9 100644 --- a/src/lte/test/lte-test-shadowing.h +++ b/src/buildings/test/buildings-shadowing-test.h @@ -18,10 +18,8 @@ * Author: Marco Miozzo */ -#ifndef LTE_TEST_SHADOWING_MODEL_H -#define LTE_TEST_SHADOWING_MODEL_H - -#include "ns3/spectrum-value.h" +#ifndef BUILDINGS_SHADOWING_TEST_H +#define BUILDINGS_SHADOWING_TEST_H #include "ns3/test.h" @@ -35,18 +33,18 @@ using namespace ns3; /** * Test 1.1 shadowing calculation */ -class LteShadowingTestSuite : public TestSuite +class BuildingsShadowingTestSuite : public TestSuite { public: - LteShadowingTestSuite (); + BuildingsShadowingTestSuite (); }; -class LteShadowingTestCase : public TestCase +class BuildingsShadowingTestCase : public TestCase { public: - LteShadowingTestCase (Ptr m1, Ptr m2, double refValue, double sigmaRef, std::string name); - virtual ~LteShadowingTestCase (); + BuildingsShadowingTestCase (Ptr m1, Ptr m2, double refValue, double sigmaRef, std::string name); + virtual ~BuildingsShadowingTestCase (); private: virtual void DoRun (void); @@ -58,4 +56,4 @@ class LteShadowingTestCase : public TestCase }; -#endif /*LTE_TEST_SHADOWING_MODEL_H*/ \ No newline at end of file +#endif /*BUILDINGS_SHADOWING_TEST_H*/ \ No newline at end of file diff --git a/src/lte/doc/source/conf.py b/src/lte/doc/source/conf.py index 1fe12f278..14f4f47ab 100644 --- a/src/lte/doc/source/conf.py +++ b/src/lte/doc/source/conf.py @@ -182,9 +182,7 @@ latex_documents = [ # ('lte-design', 'lte-doc-design.tex', u'LTE Simulator Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), # ('lte-user', 'lte-doc-user.tex', u'LTE Simulator User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), #('lte', 'lte-sim-doc.tex', u'LTE Simulator Documentation', u'Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)', 'manual'), - ('lte-pathloss-design', 'lte-pathloss-design.tex', u'LTE Simulator Pathloss Desing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), - ('lte-pathloss-testing', 'lte-pathloss-testing.tex', u'LTE Simulator Pathloss Testing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), - ('lte-building-user', 'lte-building-user.tex', u'LTE Simulator Building Propagation User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + ('lte-fading-design', 'lte-fading-desing.tex', u'LTE Simulator Fadign Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/src/lte/doc/source/lte-fading-design.rst b/src/lte/doc/source/lte-fading-design.rst new file mode 100644 index 000000000..ed8adcf33 --- /dev/null +++ b/src/lte/doc/source/lte-fading-design.rst @@ -0,0 +1,67 @@ +.. include:: replace.txt + + +++++++++++++++++++++++++++++++++++++++ + Trace Fading Loss Model Documentation +++++++++++++++++++++++++++++++++++++++ + + +GSoC Model +++++++++++ + +The fading model of GSoC [Piro2011] is based on the Jakes Simulator. In order to limit the computational complexity, the fading is evaluated run-time by query pre-calculated traces. In detail, the simulator includes a set of fading traces 3 seconds long sampled at 1 ms for different values of speeds (i.e., 0, 3, 30, 60, 120 Kmph) and different number of signaling paths (e.g., 6, 8, 10 and 12). The traces are internally managed by loading a window (with default value of 0.5 seconds) picked up with a start instant uniformly distributed in the whole duration of a trace. The trace to be used is selected according to users' relative speed and the number of path are uniformly picked up among the available ones each window update. This implies that the traces are generated according to a specific speed and number of taps and then shared among users and RBs at the same time (by randomly select the beginning of the window). +The Jakes Simulator used for generating the traces is a proprietary implementation of the algorithm proposed by Jakes done in Matlab which is not part of the official GSoC release. + +Pros. + + * Reduce size of the traces (one trace shared among users and RBs) + * Already included in LENA + +Cons. + + * The frequency selectivity is modeled by randomly pick up the window in the traces (i.e., there is no correlation between adjacent RBs); this modelization does not have reference in literature + * the total length of the trace might be low (3 seconds) for generating independent windows which might be potentially 100 RBs x (no. of users x no. of BSs) + * the number of path used is randomly pick up each window actualization (0.5 seconds); therefore it changes during simulation run-time each window. + + +Proposed Model +++++++++++++++ + +We suggest the implementation of a similar model relaxing some assumptions. In detail, we propose a new trace format and trace management procedure. Regarding the model of the channel, we suggest the one provided by the ``rayleighchan`` function of Matlab since it provides a well accepted channel modelization both in time and frequency domain with the parameters we are considering, more information following the link: + +http://www.mathworks.es/help/toolbox/comm/ug/a1069449399.html#bq5zk36 + +We note that, this solution allows the realization of a matlab simulation script for allowing users the generation of new traces based on specific scenario tailored needs. + +Analyzing the possible channel parameters, we identified the following ones as representative for accurately simulating the channel in the simulator: + + * granularity in frequency, three options are available + + * one value for each RB + * one value per group of RBs (size to be dimensioned) + * the same trace for all RBs but using a random offset in the trace (as done in GSoC module) + + * length of the trace: ideally large as the simulation time, might be reduced by applying the window mechanism of GSoC + * granularity in time: the sampling time (1 ms in GSoC) of the fading might be tuned according scenario characteristics (i.e., channel low or high variable in time) + * speed values: speed affects the channel by varying the Doppler shift, a specific speed needs the generation of its correspondent traces + * number of set of taps: number of different path of the signal (scenario dependent) + +Since the number of variable it is pretty high, generate traces considering all of them might produce a high number of traces of huge size. The following formula express in detail the dimension: + +.. math:: + T_{SIZE} = 8 \times RB_{NUM} \times \frac{T_{total}}{T_{sample}} \times DopplerShift_{NUM} \times |Taps_{NUM}|\mbox{ [bytes]} + +where :math:`RB_{NUM}` is the number of RB or set of RBs to be considered, :math:`T_{total}` is the total length of the trace, :math:`T_{sample}` is the sampling period (1 ms for having a new sample each subframe), :math:`DopplerShift_{NUM}` is the number of Doppler frequencies to be used and :math:`Taps_{NUM}` is the number of taps. +According to the formula we have that a typical single channel realization (i.e., independent RB traces at a given speed and given set of number of taps with one sample per ms/TTI) implies the usage of 8,000,000 bytes (7.6294 MB) considering the precision of double (:math:`1\times10^{-308}` to :math:`1\times10^{308}`). This size can be halved by considering float numbers instead of double, reducing the precision to :math:`1\times10^{-37}` to :math:`1\times10^{37}` (and possibly increasing the computational complexity due to the cast operation between float and double, which is what is used in the simulator; this is compilator dependent and can be evaluated after implementation). +The number of taps seems to be limited to 7 in case of pedestrian scenario and 9 in case of vehicular and urban model, according to Annex B.2 of 3GPP TS 36.104. This implies, that we need at most 3 different taps configurations, which are static during the simulation. + +A typical set of traces for a simulation will result therefore in: + + * :math:`RB_{NUM}`: 100 + * :math:`T_{total}`: 10 secs + * :math:`T_{sample}`: 0.001 secs (1 ms as a subframe) + * :math:`DopplerShift_{NUM}`: 0, 10 and 50 Hz for modeling (static, pedestrian a slow vehicle) + * :math:`Taps_{NUM}`: 3 + +which results in 72,000,000 bytes (~6.86 MB) of traces with double precision. +If instead of using a single trace for all UEs (with random offset UE) we want to have one independent channel trace for each UE, we need to multiply that size by the desired number of independent traces. \ No newline at end of file diff --git a/src/lte/test/lte-test-pathloss-model.cc b/src/lte/test/lte-test-pathloss-model.cc deleted file mode 100644 index 8c23763fa..000000000 --- a/src/lte/test/lte-test-pathloss-model.cc +++ /dev/null @@ -1,559 +0,0 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Marco Miozzo - */ - -#include "ns3/simulator.h" - -#include "ns3/log.h" - -#include "ns3/spectrum-test.h" - -#include "ns3/lte-phy-tag.h" -#include "ns3/lte-test-ue-phy.h" -#include "ns3/lte-sinr-chunk-processor.h" - -#include "ns3/lte-test-pathloss-model.h" -#include -#include -#include -#include -#include -#include "ns3/string.h" -#include "ns3/double.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "lte-test-sinr-chunk-processor.h" - -NS_LOG_COMPONENT_DEFINE ("LtePathlossModelTest"); - -using namespace ns3; - - -/** - * Test 1.1 Pathloss compound test - */ - -/** - * This TestSuite tests the BuildingPathlossModel by reproducing - * several communication scenarios - */ - - -void -LteTestPathlossDlSchedCallback (LtePathlossModelSystemTestCase *testcase, std::string path, - uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, - uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) -{ - testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); -} - - - -LtePathlossModelTestSuite::LtePathlossModelTestSuite () - : TestSuite ("lte-pathloss-model", SYSTEM) -{ - - -// -------------- COMPOUND TESTS ---------------------------------- - - LogComponentEnable ("LtePathlossModelTest", LOG_LEVEL_ALL); - - // NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite"); - - Ptr lena = CreateObject (); - - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); - - // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB) - NodeContainer enbNodes; - NodeContainer henbNodes; - NodeContainer ueNodes; - NodeContainer hueNodes; - enbNodes.Create (1); - henbNodes.Create (2); - ueNodes.Create (5); - hueNodes.Create (3); - - // Install Mobility Model - MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); - mobility.Install (enbNodes); - mobility.Install (henbNodes); - mobility.Install (ueNodes); - mobility.Install (hueNodes); - - NetDeviceContainer enbDevs; - NetDeviceContainer henbDevs; - NetDeviceContainer ueDevs; - NetDeviceContainer hueDevs; - enbDevs = lena->InstallEnbDevice (enbNodes); - ueDevs = lena->InstallUeDevice (ueNodes); - henbDevs = lena->InstallEnbDevice (henbNodes); - hueDevs = lena->InstallUeDevice (hueNodes); - - - - lena->Attach (ueDevs, enbDevs.Get (0)); - lena->Attach (hueDevs, henbDevs.Get (0)); - -// Test #1 Okumura Hata Model (150 < freq < 1500 MHz) (Macro<->UE) - - 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 mm1 = enbNodes.Get (0)->GetObject (); - mm1->SetPosition (Vector (0.0, 0.0, hb)); - - Ptr mm2 = ueNodes.Get (0)->GetObject (); - mm2->SetPosition (Vector (distance, 0.0, hm)); - - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city = ??")); - - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city = ??")); - - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban")); - - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, 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 LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city")); - - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, 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 LtePathlossModelTestCase (freq, mm1, mm2, 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 mm3 = ueNodes.Get (1)->GetObject (); - mm3->SetPosition (Vector (distance, 0.0, hm)); - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm3, 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 mm4 = ueNodes.Get (2)->GetObject (); - mm4->SetPosition (Vector (distance, 0.0, hm)); - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm4, 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 mm5 = henbNodes.Get (0)->GetObject (); - mm5->SetPosition (Vector (0.0, 0.0, henbHeight)); - Ptr building1 = Create (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 mm6 = hueNodes.Get (0)->GetObject (); - mm6->SetPosition (Vector (distance, 0.0, hm)); - mm6->SetIndoor (building1); - mm6->SetFloorNumber (2); - AddTestCase (new LtePathlossModelTestCase (freq, mm5, mm6, 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 mm7 = ueNodes.Get (3)->GetObject (); - mm7->SetPosition (Vector (distance, 0.0, hm)); - mm7->SetIndoor (building1); - AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm7, 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 mm8 = ueNodes.Get (4)->GetObject (); - 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 LtePathlossModelTestCase (freq, mm1, mm8, 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 mm9 = henbNodes.Get (1)->GetObject (); - mm9->SetPosition (Vector (0.0, 0.0, henbHeight)); - mm9->SetIndoor (building1); - mm9->SetFloorNumber (2); - Ptr mm10 = hueNodes.Get (1)->GetObject (); - 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 LtePathlossModelTestCase (freq, mm9, mm10, 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 mm11 = hueNodes.Get (2)->GetObject (); - 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 LtePathlossModelTestCase (freq, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor")); - - -//------------------- SYSTEM TEST ------------------------------ - -LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); -// -// LogComponentEnable ("LenaHelper", logLevel); -LogComponentEnable ("LtePathlossModelTest", logLevel); -// LogComponentEnable ("BuildingsPropagationLossModel", logLevel); -// LogComponentEnable ("LteInterference", logLevel); -// LogComponentEnable ("LteSpectrumValueHelper", logLevel); - - -struct SnrEfficiencyMcs -{ - double snrDb; - double efficiency; - int mcsIndex; -}; - -/** -* Test vectors: SNRDB, Spectral Efficiency, MCS index -* From XXX -*/ -SnrEfficiencyMcs snrEfficiencyMcs[] = { - { -5.00000, 0.08024, -1}, - { -4.00000, 0.10030, -1}, - { -3.00000, 0.12518, -1}, - { -2.00000, 0.15589, 0}, - { -1.00000, 0.19365, 0}, - { 0.00000, 0.23983, 2}, - { 1.00000, 0.29593, 2}, - { 2.00000, 0.36360, 2}, - { 3.00000, 0.44451, 4}, - { 4.00000, 0.54031, 4}, - { 5.00000, 0.65251, 6}, - { 6.00000, 0.78240, 6}, - { 7.00000, 0.93086, 8}, - { 8.00000, 1.09835, 8}, - { 9.00000, 1.28485, 10}, - { 10.00000, 1.48981, 12}, - { 11.00000, 1.71229, 12}, - { 12.00000, 1.95096, 14}, - { 13.00000, 2.20429, 14}, - { 14.00000, 2.47062, 16}, - { 15.00000, 2.74826, 18}, - { 16.00000, 3.03560, 18}, - { 17.00000, 3.33115, 20}, - { 18.00000, 3.63355, 20}, - { 19.00000, 3.94163, 22}, - { 20.00000, 4.25439, 22}, - { 21.00000, 4.57095, 24}, - { 22.00000, 4.89060, 24}, - { 23.00000, 5.21276, 26}, - { 24.00000, 5.53693, 26}, - { 25.00000, 5.86271, 28}, - { 26.00000, 6.18980, 28}, - { 27.00000, 6.51792, 28}, - { 28.00000, 6.84687, 28}, - { 29.00000, 7.17649, 28}, - { 30.00000, 7.50663, 28}, -}; - - -double txPowerDbm = 30; // default eNB TX power over whole bandwdith -double txPowerLin = pow (10, (txPowerDbm - 30)/10); -double ktDbm = -174; // reference LTE noise PSD -double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units -double receiverNoiseFigureDb = 9.0; // default UE noise figure -double noiseLin = pow (10, (noisePowerDbm-30+receiverNoiseFigureDb)/10); -double loss[] = {81.021418, 134.038391, 144.190675}; -double dist[] = {100.0, 500.0, 1500}; - -int numOfTests = sizeof (loss) / sizeof (double); -for ( int i = 0 ; i < numOfTests; i++ ) -{ - // double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb; - double sinrLin = (txPowerLin/(pow(10, loss[i]/10))) / noiseLin; - // double sinrDb = txPowerDbm- noisePowerDbm - receiverNoiseFigureDb - loss[i]; - double sinrDb = 10*log10(sinrLin); - NS_LOG_INFO (" Ptx " << txPowerDbm << " Pn " << noisePowerDbm << " Fn " << receiverNoiseFigureDb << " Pl " << loss[i] << " dist " << dist[i]); - std::ostringstream name; - name << " snr= " << sinrDb << " dB, " - << " mcs= " << snrEfficiencyMcs[i].mcsIndex; - AddTestCase (new LtePathlossModelSystemTestCase (name.str (), sinrDb, dist[i], snrEfficiencyMcs[i].mcsIndex)); -} - - - - - -} - -static LtePathlossModelTestSuite ltePathlossModelTestSuite; - - -/** - * TestCase - */ - -LtePathlossModelTestCase::LtePathlossModelTestCase (double freq, Ptr m1, Ptr 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_env (env), - m_city (city), - m_lossRef (refValue) -{ -} - -LtePathlossModelTestCase::~LtePathlossModelTestCase () -{ -} - -void -LtePathlossModelTestCase::DoRun (void) -{ -// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); - -// LogComponentEnable ("LteEnbRrc", logLevel); -// LogComponentEnable ("LteUeRrc", logLevel); -// LogComponentEnable ("LteEnbMac", logLevel); -// LogComponentEnable ("LteUeMac", logLevel); -// LogComponentEnable ("LteRlc", logLevel); -// LogComponentEnable ("RrPacketScheduler", logLevel); -// -// LogComponentEnable ("LtePhy", logLevel); -// LogComponentEnable ("LteEnbPhy", logLevel); -// LogComponentEnable ("LteUePhy", logLevel); -// -// LogComponentEnable ("LteSpectrumPhy", logLevel); -// LogComponentEnable ("LteInterference", logLevel); -// LogComponentEnable ("LteSinrChunkProcessor", logLevel); -// -// LogComponentEnable ("LtePropagationLossModel", logLevel); -// LogComponentEnable ("LossModel", logLevel); -// LogComponentEnable ("ShadowingLossModel", logLevel); -// LogComponentEnable ("PenetrationLossModel", logLevel); -// LogComponentEnable ("MultipathLossModel", logLevel); -// LogComponentEnable ("PathLossModel", logLevel); -// -// LogComponentEnable ("LteNetDevice", logLevel); -// LogComponentEnable ("LteUeNetDevice", logLevel); -// LogComponentEnable ("LteEnbNetDevice", logLevel); - - LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); - NS_LOG_INFO ("Testing " << GetName()); - - Ptr m_downlinkChannel = CreateObject (); - Ptr m_uplinkChannel = CreateObject (); - Ptr m_downlinkPropagationLossModel = CreateObject (); - m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); - m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); - m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env)); - m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city)); - // cancel shadowing effect - m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); - m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); - m_downlinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); - Ptr m_uplinkPropagationLossModel = CreateObject (); - m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq)); - m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq)); - // cancel shadowing effect - m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); - m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); - m_uplinkPropagationLossModel->SetAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); - m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel); - m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel); - - - - Simulator::Stop (Seconds (0.1)); - Simulator::Run (); - Simulator::Destroy (); - double loss = m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2); - - NS_LOG_INFO ("Calculated loss: " << loss); - NS_LOG_INFO ("Theoretical loss: " << m_lossRef); - - NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !"); -} - - -//-------------------- SYSTEM TEST --------------------------------- - - -LtePathlossModelSystemTestCase::LtePathlossModelSystemTestCase (std::string name, double snrDb, double dist, uint16_t mcsIndex) -: TestCase (name), -m_snrDb (snrDb), -m_distance (dist), -m_mcsIndex (mcsIndex) -{ - std::ostringstream sstream1, sstream2; - sstream1 << " snr=" << snrDb - << " mcs=" << mcsIndex << " distance=" << dist; - - NS_LOG_INFO ("Creating LtePathlossModelSystemTestCase: " + sstream1.str ()); -} - -LtePathlossModelSystemTestCase::~LtePathlossModelSystemTestCase () -{ -} - -void -LtePathlossModelSystemTestCase::DoRun (void) -{ - /** - * Simulation Topology - */ -// LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); -// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL); -// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL); -// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL); -// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL); -// LogComponentEnable ("SingleModelSpectrumChannel", LOG_LEVEL_ALL); - LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); - LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL); -// LogComponentDisable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL); -// - Ptr lena = CreateObject (); - // lena->EnableLogComponents (); - lena->EnableMacTraces (); - lena->EnableRlcTraces (); - lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel")); - // set frequency - // this should not be done, since it is charge the Helper of this task using the netdevice settings (earfc parameter) - double freq = 2.114e+09; - lena->SetPropagationModelAttribute ("Frequency", DoubleValue (freq)); - lena->SetPropagationModelAttribute ("Lambda", DoubleValue (300000000.0 /freq)); - - // remove shadowing component - lena->SetPropagationModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0)); - lena->SetPropagationModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0)); - lena->SetPropagationModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0)); - - // Create Nodes: eNodeB and UE - NodeContainer enbNodes; - NodeContainer ueNodes; - enbNodes.Create (1); - ueNodes.Create (1); - NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes ); - - // Install Mobility Model - MobilityHelper mobility; - mobility.SetMobilityModel ("ns3::BuildingsMobilityModel"); - mobility.Install (allNodes); - - // Create Devices and install them in the Nodes (eNB and UE) - NetDeviceContainer enbDevs; - NetDeviceContainer ueDevs; - lena->SetSchedulerType ("ns3::RrFfMacScheduler"); - enbDevs = lena->InstallEnbDevice (enbNodes); - ueDevs = lena->InstallUeDevice (ueNodes); - - Ptr mm_enb = enbNodes.Get (0)->GetObject (); - mm_enb->SetPosition (Vector (0.0, 0.0, 30.0)); - Ptr mm_ue = ueNodes.Get (0)->GetObject (); - mm_ue->SetPosition (Vector (m_distance, 0.0, 1.0)); - - Ptr lteEnbDev = enbDevs.Get (0)->GetObject (); - Ptr enbPhy = lteEnbDev->GetPhy (); - enbPhy->SetAttribute ("TxPower", DoubleValue (30.0)); - enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0)); - - Ptr lteUeDev = ueDevs.Get (0)->GetObject (); - Ptr uePhy = lteUeDev->GetPhy (); - uePhy->SetAttribute ("TxPower", DoubleValue (23.0)); - uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0)); - - - // Attach a UE to a eNB - lena->Attach (ueDevs, enbDevs.Get (0)); - - - // Activate an EPS bearer - enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; - EpsBearer bearer (q); - lena->ActivateEpsBearer (ueDevs, bearer); - - // Use testing chunk processor in the PHY layer - // It will be used to test that the SNR is as intended - //Ptr uePhy = ueDevs.Get (0)->GetObject ()->GetPhy ()->GetObject (); - Ptr testSinr = Create (uePhy); - uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr); - -// Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", -// MakeBoundCallback (&LteTestPathlossDlSchedCallback, this)); - - Simulator::Stop (Seconds (0.005)); - Simulator::Run (); - - double calculatedSinrDb = 10.0 * log10 (testSinr->GetSinr ()[0]); - NS_LOG_INFO ("Distance " << m_distance << " Calculated SINR " << calculatedSinrDb << " ref " << m_snrDb); - Simulator::Destroy (); - NS_TEST_ASSERT_MSG_EQ_TOL (calculatedSinrDb, m_snrDb, 0.001, "Wrong SINR !"); -} - - -void -LtePathlossModelSystemTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, - uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) -{ - static bool firstTime = true; - - if ( firstTime ) - { - firstTime = false; - NS_LOG_INFO ("SNR\tRef_MCS\tCalc_MCS"); - } - - /** - * Note: - * For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated, - * because CQI feedback is still not available at the eNB. - */ - if ( (frameNo > 1) || (subframeNo > 4) ) - { - NS_LOG_INFO (m_snrDb << "\t" << m_mcsIndex << "\t" << (uint16_t)mcsTb1); - - NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcsTb1, m_mcsIndex, "Wrong MCS index"); - } -} - diff --git a/src/lte/test/lte-test-pathloss-model.h b/src/lte/test/lte-test-pathloss-model.h deleted file mode 100644 index 52537d213..000000000 --- a/src/lte/test/lte-test-pathloss-model.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Marco Miozzo - */ - -#ifndef LTE_TEST_PATHLOSS_MODEL_H -#define LTE_TEST_PATHLOSS_MODEL_H - -#include "ns3/spectrum-value.h" - -#include "ns3/test.h" - -#include -#include - - -using namespace ns3; - - -/** - * Test 1.1 pathloss calculation - */ -class LtePathlossModelTestSuite : public TestSuite -{ -public: - LtePathlossModelTestSuite (); -}; - - -class LtePathlossModelTestCase : public TestCase -{ -public: - LtePathlossModelTestCase (double freq, Ptr m1, Ptr m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name); - virtual ~LtePathlossModelTestCase (); - -private: - virtual void DoRun (void); - -// Ptr m_sv; -// Ptr m_sm; -// Ptr m_sinr; - double m_freq; - Ptr m_node1; - Ptr m_node2; - BuildingsPropagationLossModel::Environment m_env; - BuildingsPropagationLossModel::CitySize m_city; - double m_lossRef; - -}; - -class LtePathlossModelSystemTestCase : public TestCase -{ - public: - LtePathlossModelSystemTestCase (std::string name, double snrDb, double dist, uint16_t mcsIndex); - LtePathlossModelSystemTestCase (); - virtual ~LtePathlossModelSystemTestCase (); - - void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, - uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2); - - private: - virtual void DoRun (void); - - double m_snrDb; - double m_distance; - uint16_t m_mcsIndex; -}; - - -#endif /* LTE_TEST_PATHLOSS_MODEL_H */ - diff --git a/src/lte/wscript b/src/lte/wscript index 541c6d518..e4de4bd56 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -2,7 +2,7 @@ def build(bld): - module = bld.create_ns3_module('lte', ['core', 'network', 'spectrum', 'stats']) + module = bld.create_ns3_module('lte', ['core', 'network', 'spectrum', 'buildings', 'stats']) module.source = [ 'model/lte-common.cc', 'model/lte-spectrum-phy.cc', @@ -62,10 +62,9 @@ def build(bld): 'test/lte-test-pf-ff-mac-scheduler.cc', 'test/lte-test-earfcn.cc', 'test/lte-test-spectrum-value-helper.cc', - 'test/lte-test-pathloss-model.cc', 'test/epc-test-gtpu-v1.cc', - 'test/lte-test-shadowing.cc', 'test/lte-test-fading.cc', + 'test/lte-test-pathloss-model.cc' ] headers = bld.new_task_gen('ns3header') @@ -125,10 +124,9 @@ def build(bld): 'test/lte-test-rr-ff-mac-scheduler.h', 'test/lte-test-pf-ff-mac-scheduler.h', 'test/lte-test-pf-ff-mac-scheduler.h', - 'test/lte-test-pathloss-model.h', 'test/epc-test-gtpu-v1.h', - 'test/lte-test-shadowing.h', 'test/lte-test-fading.h', + 'test/lte-test-pathloss-model.h' ] if (bld.env['ENABLE_EXAMPLES']): diff --git a/src/mobility/wscript b/src/mobility/wscript index 461330c6c..da6f3fbd1 100644 --- a/src/mobility/wscript +++ b/src/mobility/wscript @@ -19,8 +19,6 @@ def build(bld): 'model/steady-state-random-waypoint-mobility-model.cc', 'model/waypoint.cc', 'model/waypoint-mobility-model.cc', - 'model/building.cc', - 'model/buildings-mobility-model.cc', 'helper/mobility-helper.cc', 'helper/ns2-mobility-helper.cc', ] @@ -50,8 +48,6 @@ def build(bld): 'model/random-waypoint-mobility-model.h', 'model/steady-state-random-waypoint-mobility-model.h', 'model/waypoint.h', - 'model/building.h', - 'model/buildings-mobility-model.h', 'model/waypoint-mobility-model.h', 'helper/mobility-helper.h', 'helper/ns2-mobility-helper.h', diff --git a/src/propagation/wscript b/src/propagation/wscript index 982f6ff6d..df7d068e4 100644 --- a/src/propagation/wscript +++ b/src/propagation/wscript @@ -8,7 +8,6 @@ def build(bld): 'model/propagation-loss-model.cc', 'model/jakes-propagation-loss-model.cc', 'model/cost231-propagation-loss-model.cc', - 'model/buildings-propagation-loss-model.cc', ] module_test = bld.create_ns3_module_test_library('propagation') @@ -23,7 +22,6 @@ def build(bld): 'model/propagation-loss-model.h', 'model/jakes-propagation-loss-model.h', 'model/cost231-propagation-loss-model.h', - 'model/buildings-propagation-loss-model.h', ] if (bld.env['ENABLE_EXAMPLES']): diff --git a/src/wscript b/src/wscript index 220ebabca..7d1a9e9e8 100644 --- a/src/wscript +++ b/src/wscript @@ -63,6 +63,7 @@ all_modules = [ 'point-to-point-layout', 'csma-layout', 'template', + 'buildings', ] def set_options(opt):