diff --git a/src/lte/examples/lena-x2-handover-measures.cc b/src/lte/examples/lena-x2-handover-measures.cc index 032193520..a51bff41b 100644 --- a/src/lte/examples/lena-x2-handover-measures.cc +++ b/src/lte/examples/lena-x2-handover-measures.cc @@ -69,17 +69,17 @@ main (int argc, char *argv[]) // change some default attributes so that they are reasonable for // this scenario, but do this before processing command line // arguments, so that the user is allowed to override these settings - Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds(10))); - Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue(1000000)); - Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue(true)); + Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds (10))); + Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (1000000)); + Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true)); // Command line arguments CommandLine cmd; - cmd.AddValue("simTime", "Total duration of the simulation (in seconds)", simTime); - cmd.AddValue("speed", "Speed of the UE (default = 20 m/s)", speed); - cmd.AddValue("enbTxPowerDbm", "TX power [dBm] used by HeNBs (defalut = 20.0)", enbTxPowerDbm); + cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)", simTime); + cmd.AddValue ("speed", "Speed of the UE (default = 20 m/s)", speed); + cmd.AddValue ("enbTxPowerDbm", "TX power [dBm] used by HeNBs (defalut = 20.0)", enbTxPowerDbm); - cmd.Parse(argc, argv); + cmd.Parse (argc, argv); Ptr lteHelper = CreateObject (); @@ -127,14 +127,14 @@ main (int argc, char *argv[]) enbPositionAlloc->Add (enbPosition); } MobilityHelper enbMobility; - enbMobility.SetMobilityModel("ns3::ConstantPositionMobilityModel"); - enbMobility.SetPositionAllocator(enbPositionAlloc); - enbMobility.Install(enbNodes); + enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + enbMobility.SetPositionAllocator (enbPositionAlloc); + enbMobility.Install (enbNodes); // Install Mobility Model in UE MobilityHelper ueMobility; ueMobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel"); - ueMobility.Install(ueNodes); + ueMobility.Install (ueNodes); ueNodes.Get (0)->GetObject ()->SetPosition (Vector (0, yForUe, 0)); ueNodes.Get (0)->GetObject ()->SetVelocity (Vector (speed, 0, 0)); @@ -160,12 +160,12 @@ main (int argc, char *argv[]) // Attach all UEs to the first eNodeB for (uint16_t i = 0; i < numberOfUes; i++) { - lteHelper->Attach (ueLteDevs.Get(i), enbLteDevs.Get(0)); + lteHelper->Attach (ueLteDevs.Get (i), enbLteDevs.Get (0)); } NS_LOG_LOGIC ("setting up applications"); - + // Install and start applications on UEs and remote host uint16_t dlPort = 10000; uint16_t ulPort = 20000; @@ -176,7 +176,7 @@ main (int argc, char *argv[]) Ptr startTimeSeconds = CreateObject (); startTimeSeconds->SetAttribute ("Min", DoubleValue (0)); startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010)); - + for (uint32_t u = 0; u < numberOfUes; ++u) { Ptr ue = ueNodes.Get (u); @@ -204,7 +204,7 @@ main (int argc, char *argv[]) clientApps.Add (ulClientHelper.Install (ue)); PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort)); - serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); + serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); Ptr tft = Create (); EpcTft::PacketFilter dlpf; @@ -229,11 +229,10 @@ main (int argc, char *argv[]) lteHelper->AddX2Interface (enbNodes); // X2-based Handover -// lteHelper->HandoverRequest (Seconds (0.100), ueLteDevs.Get (0), enbLteDevs.Get (0), enbLteDevs.Get (1)); - - + //lteHelper->HandoverRequest (Seconds (0.100), ueLteDevs.Get (0), enbLteDevs.Get (0), enbLteDevs.Get (1)); + // Uncomment to enable PCAP tracing - //p2ph.EnablePcapAll("lena-x2-handover"); + // p2ph.EnablePcapAll("lena-x2-handover-measures"); lteHelper->EnablePhyTraces (); lteHelper->EnableMacTraces (); @@ -245,13 +244,13 @@ main (int argc, char *argv[]) pdcpStats->SetAttribute ("EpochDuration", TimeValue (Seconds (1.0))); - Simulator::Stop(Seconds(simTime)); - Simulator::Run(); + Simulator::Stop (Seconds (simTime)); + Simulator::Run (); // GtkConfigStore config; - // config.ConfigureAttributes(); + // config.ConfigureAttributes (); - Simulator::Destroy(); + Simulator::Destroy (); return 0; } diff --git a/src/lte/examples/lena-x2-handover.cc b/src/lte/examples/lena-x2-handover.cc index 00d98159b..9084be944 100644 --- a/src/lte/examples/lena-x2-handover.cc +++ b/src/lte/examples/lena-x2-handover.cc @@ -147,22 +147,22 @@ main (int argc, char *argv[]) // change some default attributes so that they are reasonable for // this scenario, but do this before processing command line // arguments, so that the user is allowed to override these settings - Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds(10))); - Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue(1000000)); - Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue(false)); + Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MilliSeconds (10))); + Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (1000000)); + Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (false)); // Command line arguments CommandLine cmd; - cmd.AddValue("numberOfUes", "Number of UEs", numberOfUes); - cmd.AddValue("numberOfEnbs", "Number of eNodeBs", numberOfEnbs); - cmd.AddValue("simTime", "Total duration of the simulation (in seconds)",simTime); - cmd.Parse(argc, argv); + cmd.AddValue ("numberOfUes", "Number of UEs", numberOfUes); + cmd.AddValue ("numberOfEnbs", "Number of eNodeBs", numberOfEnbs); + cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)", simTime); + cmd.Parse (argc, argv); Ptr lteHelper = CreateObject (); Ptr epcHelper = CreateObject (); lteHelper->SetEpcHelper (epcHelper); - lteHelper->SetSchedulerType("ns3::RrFfMacScheduler"); + lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler"); Ptr pgw = epcHelper->GetPgwNode (); @@ -193,24 +193,24 @@ main (int argc, char *argv[]) NodeContainer ueNodes; NodeContainer enbNodes; - enbNodes.Create(numberOfEnbs); - ueNodes.Create(numberOfUes); + enbNodes.Create (numberOfEnbs); + ueNodes.Create (numberOfUes); // Install Mobility Model Ptr positionAlloc = CreateObject (); for (uint16_t i = 0; i < numberOfEnbs; i++) { - positionAlloc->Add (Vector(distance * 2*i - distance, 0, 0)); + positionAlloc->Add (Vector (distance * 2*i - distance, 0, 0)); } for (uint16_t i = 0; i < numberOfUes; i++) { - positionAlloc->Add (Vector(0, 0, 0)); + positionAlloc->Add (Vector (0, 0, 0)); } MobilityHelper mobility; - mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel"); - mobility.SetPositionAllocator(positionAlloc); - mobility.Install(enbNodes); - mobility.Install(ueNodes); + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + mobility.SetPositionAllocator (positionAlloc); + mobility.Install (enbNodes); + mobility.Install (ueNodes); // Install LTE Devices in eNB and UEs NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes); @@ -233,12 +233,12 @@ main (int argc, char *argv[]) // Attach all UEs to the first eNodeB for (uint16_t i = 0; i < numberOfUes; i++) { - lteHelper->Attach (ueLteDevs.Get(i), enbLteDevs.Get(0)); + lteHelper->Attach (ueLteDevs.Get (i), enbLteDevs.Get (0)); } NS_LOG_LOGIC ("setting up applications"); - + // Install and start applications on UEs and remote host uint16_t dlPort = 10000; uint16_t ulPort = 20000; @@ -249,7 +249,7 @@ main (int argc, char *argv[]) Ptr startTimeSeconds = CreateObject (); startTimeSeconds->SetAttribute ("Min", DoubleValue (0)); startTimeSeconds->SetAttribute ("Max", DoubleValue (0.010)); - + for (uint32_t u = 0; u < numberOfUes; ++u) { Ptr ue = ueNodes.Get (u); @@ -264,21 +264,21 @@ main (int argc, char *argv[]) ApplicationContainer clientApps; ApplicationContainer serverApps; - + NS_LOG_LOGIC ("installing UDP DL app for UE " << u); UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort); clientApps.Add (dlClientHelper.Install (remoteHost)); PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort)); serverApps.Add (dlPacketSinkHelper.Install (ue)); - + NS_LOG_LOGIC ("installing UDP UL app for UE " << u); UdpClientHelper ulClientHelper (remoteHostAddr, ulPort); clientApps.Add (ulClientHelper.Install (ue)); PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort)); - serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); - + serverApps.Add (ulPacketSinkHelper.Install (remoteHost)); + Ptr tft = Create (); EpcTft::PacketFilter dlpf; dlpf.localPortStart = dlPort; @@ -290,7 +290,7 @@ main (int argc, char *argv[]) tft->Add (ulpf); EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT); lteHelper->ActivateDedicatedEpsBearer (ueLteDevs.Get (u), bearer, tft); - + Time startTime = Seconds (startTimeSeconds->GetValue ()); serverApps.Start (startTime); clientApps.Start (startTime); @@ -304,8 +304,7 @@ main (int argc, char *argv[]) // X2-based Handover lteHelper->HandoverRequest (Seconds (0.100), ueLteDevs.Get (0), enbLteDevs.Get (0), enbLteDevs.Get (1)); - - + // Uncomment to enable PCAP tracing //p2ph.EnablePcapAll("lena-x2-handover"); @@ -333,13 +332,13 @@ main (int argc, char *argv[]) MakeCallback (&NotifyHandoverEndOkUe)); - Simulator::Stop(Seconds(simTime)); - Simulator::Run(); + Simulator::Stop (Seconds (simTime)); + Simulator::Run (); // GtkConfigStore config; - // config.ConfigureAttributes(); + // config.ConfigureAttributes (); - Simulator::Destroy(); + Simulator::Destroy (); return 0; }