From 3cccbabf1e4bf9ac1559f65e2c57889fcbc8621f Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 16 Mar 2011 10:00:28 +0100 Subject: [PATCH] added distance parameter to inter-cell-interference program --- src/lte/examples/inter-cell-interference.cc | 45 +++++++++++++++------ src/lte/examples/wscript | 3 ++ src/lte/model/lte-spectrum-phy.cc | 3 +- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/lte/examples/inter-cell-interference.cc b/src/lte/examples/inter-cell-interference.cc index 5d296ede3..4839aee2a 100644 --- a/src/lte/examples/inter-cell-interference.cc +++ b/src/lte/examples/inter-cell-interference.cc @@ -29,37 +29,56 @@ using namespace ns3; int main (int argc, char *argv[]) { + double enbDist = 5.0; + + CommandLine cmd; + cmd.AddValue ("enbDist", "distance between the two eNBs", enbDist); + + LenaHelper lena; - lena.EnableLogComponents (); + //lena.EnableLogComponents (); // Create Nodes: eNodeB and UE NodeContainer enbNodes; - NodeContainer ueNodes; - enbNodes.Create (1); - ueNodes.Create (1); + NodeContainer ueNodes1, ueNodes2; + enbNodes.Create (2); + ueNodes1.Create (1); + ueNodes2.Create (1); + + Ptr positionAlloc = CreateObject (); + positionAlloc->Add (Vector (0.0, 0.0, 0.0)); + positionAlloc->Add (Vector (enbDist, 0.0, 0.0)); + positionAlloc->Add (Vector (0.0, 0.0, 0.0)); + positionAlloc->Add (Vector (enbDist, 0.0, 0.0)); + + // Install Mobility Model MobilityHelper mobility; mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + mobility.SetPositionAllocator (positionAlloc); mobility.Install (enbNodes); - mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); - mobility.Install (ueNodes); + mobility.Install (ueNodes1); + mobility.Install (ueNodes2); // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; - NetDeviceContainer ueDevs; + NetDeviceContainer ueDevs1; + NetDeviceContainer ueDevs2; enbDevs = lena.InstallEnbDevice (enbNodes); - ueDevs = lena.InstallUeDevice (ueNodes); + ueDevs1 = lena.InstallUeDevice (ueNodes1); + ueDevs2 = lena.InstallUeDevice (ueNodes2); - // Attach a UE to a eNB - lena.Attach (ueDevs, enbDevs.Get (0)); + // Attach UEs to a eNB + lena.Attach (ueDevs1, enbDevs.Get (0)); + lena.Attach (ueDevs2, enbDevs.Get (1)); - // Activate an EPS bearer + // Activate an EPS bearer on all UEs enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; EpsBearer bearer (q); - lena.ActivateEpsBearer (ueDevs, bearer); - + lena.ActivateEpsBearer (ueDevs1, bearer); + lena.ActivateEpsBearer (ueDevs2, bearer); Simulator::Stop (Seconds (0.004)); diff --git a/src/lte/examples/wscript b/src/lte/examples/wscript index 62ec2168e..0a4382b32 100644 --- a/src/lte/examples/wscript +++ b/src/lte/examples/wscript @@ -4,3 +4,6 @@ def build(bld): obj = bld.create_ns3_program('lena-first-sim', ['lte']) obj.source = 'lena-first-sim.cc' + obj = bld.create_ns3_program('inter-cell-interference', + ['lte']) + obj.source = 'inter-cell-interference.cc' diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index ed6667968..08e49dceb 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -178,7 +178,6 @@ LteSpectrumPhy::SetTxPowerSpectralDensity (Ptr txPsd) NS_LOG_FUNCTION (this << txPsd); NS_ASSERT (txPsd); m_txPsd = txPsd; - NS_LOG_INFO ("\t computed tx_psd: " << *txPsd << "\t stored tx_psd: " << *m_txPsd); } @@ -186,7 +185,6 @@ void LteSpectrumPhy::SetNoisePowerSpectralDensity (Ptr noisePsd) { NS_LOG_FUNCTION (this << noisePsd); - NS_LOG_INFO ("\t computed noise_psd: " << *noisePsd ); NS_ASSERT (noisePsd); m_interference.SetNoisePowerSpectralDensity (noisePsd); } @@ -279,6 +277,7 @@ LteSpectrumPhy::StartTx (Ptr pb) NS_ASSERT (m_channel); double tti = 0.001; m_channel->StartTx (pb, m_txPsd, GetSpectrumType (), Seconds (tti), GetObject ()); + NS_LOG_LOGIC (this << " scheduling EndTx ()"); Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this); } return true;