Connect BuldingsMobilityModel and BuildingsPropagationLossModel

This commit is contained in:
Marco Miozzo
2011-07-07 13:36:22 +02:00
parent 933945d1ed
commit f2db7e7334
4 changed files with 19 additions and 7 deletions

View File

@@ -51,7 +51,12 @@ int main (int argc, char *argv[])
// 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 @@ int main (int argc, char *argv[])
// 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 @@ int main (int argc, char *argv[])
lena->ActivateEpsBearer (ueDevs, bearer);
Simulator::Stop (Seconds (0.010));
Simulator::Stop (Seconds (0.005));
Simulator::Run ();

View File

@@ -45,6 +45,8 @@
#include <iostream>
#include <ns3/buildings-propagation-loss-model.h>
NS_LOG_COMPONENT_DEFINE ("LenaHelper");
@@ -67,6 +69,10 @@ LenaHelper::DoStart (void)
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 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
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> ();

View File

@@ -39,6 +39,7 @@ namespace ns3 {
class LteUePhy;
class LteEnbPhy;
class SpectrumChannel;
class PropagationLossModel;
/**
@@ -196,6 +197,9 @@ private:
Ptr<SpectrumChannel> m_downlinkChannel;
Ptr<SpectrumChannel> m_uplinkChannel;
Ptr<PropagationLossModel> m_downlinkPropagationLossModel;
Ptr<PropagationLossModel> m_uplinkPropagationLossModel;
ObjectFactory m_schedulerFactory;
ObjectFactory m_propagationModelFactory;

View File

@@ -270,7 +270,6 @@ BuildingsPropagationLossModel::BEWPL (Ptr<BuildingsMobilityModel> a) const
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 @@ BuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel>
double
BuildingsPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const
{
NS_LOG_INFO (this << " RX POWER");
return txPowerDbm + GetLoss (a, b);
}