Connect BuldingsMobilityModel and BuildingsPropagationLossModel
authorMarco Miozzo <marco.miozzo@cttc.es>
Thu, 07 Jul 2011 13:36:22 +0200
changeset 8190 3a2b83d7210d
parent 8189 dde497458c54
child 8191 02ce2fb4883b
Connect BuldingsMobilityModel and BuildingsPropagationLossModel
src/lte/examples/lena-first-sim.cc
src/lte/helper/lena-helper.cc
src/lte/helper/lena-helper.h
src/propagation/model/buildings-propagation-loss-model.cc
--- a/src/lte/examples/lena-first-sim.cc	Thu Jul 07 13:34:40 2011 +0200
+++ b/src/lte/examples/lena-first-sim.cc	Thu Jul 07 13:36:22 2011 +0200
@@ -51,7 +51,12 @@
   //   LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
   LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
   //   LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
-  LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
+//   LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
+  LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
+  LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
+  LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
+ 
+  lena->SetAttribute ("PropagationModel", StringValue ("ns3::SingleModelSpectrumChannel"));
 
   // Create Nodes: eNodeB and UE
   NodeContainer enbNodes;
@@ -61,9 +66,9 @@
 
   // Install Mobility Model
   MobilityHelper mobility;
-  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+  mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
   mobility.Install (enbNodes);
-  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+  mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
   mobility.Install (ueNodes);
 
   // Create Devices and install them in the Nodes (eNB and UE)
@@ -83,7 +88,7 @@
   lena->ActivateEpsBearer (ueDevs, bearer);
 
 
-  Simulator::Stop (Seconds (0.010));
+  Simulator::Stop (Seconds (0.005));
 
   Simulator::Run ();
 
--- a/src/lte/helper/lena-helper.cc	Thu Jul 07 13:34:40 2011 +0200
+++ b/src/lte/helper/lena-helper.cc	Thu Jul 07 13:36:22 2011 +0200
@@ -45,6 +45,8 @@
 
 #include <iostream>
 
+#include <ns3/buildings-propagation-loss-model.h>
+
 
 NS_LOG_COMPONENT_DEFINE ("LenaHelper");
 
@@ -67,6 +69,10 @@
   Ptr<SpectrumPropagationLossModel> ulPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
   m_downlinkChannel->AddSpectrumPropagationLossModel (dlPropagationModel);
   m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
+  m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+  m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
+  m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
+  m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
   m_macStats = CreateObject<MacStatsCalculator> ();
   m_rlcStats = CreateObject<RlcStatsCalculator> ();
   Object::DoStart ();
@@ -203,7 +209,6 @@
   NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LenaHelper::InstallUeDevice ()");
   dlPhy->SetMobility (mm);
   ulPhy->SetMobility (mm);
-
   m_uplinkChannel->AddRx (ulPhy);
 
   Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
--- a/src/lte/helper/lena-helper.h	Thu Jul 07 13:34:40 2011 +0200
+++ b/src/lte/helper/lena-helper.h	Thu Jul 07 13:36:22 2011 +0200
@@ -39,6 +39,7 @@
 class LteUePhy;
 class LteEnbPhy;
 class SpectrumChannel;
+class PropagationLossModel;
 
 
 /**
@@ -196,6 +197,9 @@
 
   Ptr<SpectrumChannel> m_downlinkChannel;
   Ptr<SpectrumChannel> m_uplinkChannel;
+  
+  Ptr<PropagationLossModel> m_downlinkPropagationLossModel;
+  Ptr<PropagationLossModel> m_uplinkPropagationLossModel;
 
   ObjectFactory m_schedulerFactory;
   ObjectFactory m_propagationModelFactory;
--- a/src/propagation/model/buildings-propagation-loss-model.cc	Thu Jul 07 13:34:40 2011 +0200
+++ b/src/propagation/model/buildings-propagation-loss-model.cc	Thu Jul 07 13:36:22 2011 +0200
@@ -270,7 +270,6 @@
 double
 BuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
 {
-  NS_LOG_INFO (this << " RX POWER");
   
   double distance = a->GetDistanceFrom (b);
   if (distance <= m_minDistance)
@@ -365,7 +364,6 @@
 double
 BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
 {
-  NS_LOG_INFO (this << " RX POWER");
   return txPowerDbm + GetLoss (a, b);
 }