About packets lost problem in LTE

473 views
Skip to first unread message

許朝評

unread,
Aug 27, 2014, 3:02:02 PM8/27/14
to ns-3-...@googlegroups.com
Hi,everyone:

                 I try to send packets to make sure that the throughput between Enbs and Ues can reach 6Mbps or over 6Mbps, but the results are not good.
The Ues lost many packets in the simulation.

like this

Flow 1 (1.0.0.2 -> 7.0.0.2)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 16189
  Rx Bytes:   20689542
  Throughput: 5.26162 Mbps
Flow 2 (1.0.0.2 -> 7.0.0.3)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 18960
  Rx Bytes:   24230880
  Throughput: 6.16223 Mbps
Flow 3 (1.0.0.2 -> 7.0.0.4)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 5484
  Rx Bytes:   7008552
  Throughput: 1.78237Mbps
Flow 4 (1.0.0.2 -> 7.0.0.5)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 11072
  Rx Bytes:   14150016
  Throughput: 3.59854 Mbps
Flow 5 (1.0.0.2 -> 7.0.0.6)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 19799
  Rx Bytes:   25303122
  Throughput: 6.43492 Mbps
Flow 6 (1.0.0.2 -> 7.0.0.7)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 13089
  Rx Bytes:   16727742
  Throughput: 4.25408 Mbps
Flow 7 (1.0.0.2 -> 7.0.0.8)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 10285
  Rx Bytes:   13144230
  Throughput: 3.34275 Mbps
Flow 8 (1.0.0.2 -> 7.0.0.9)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 8579
  Rx Bytes:   10963962
  Throughput: 2.78828 Mbps
Flow 9 (1.0.0.2 -> 7.0.0.10)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 15723
  Rx Bytes:   20093994
  Throughput: 5.11017 Mbps
Flow 10 (1.0.0.2 -> 7.0.0.11)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 13696
  Rx Bytes:   17503488
  Throughput: 4.45137 Mbps
Flow 11 (7.0.0.2 -> 1.0.0.2)
  Tx Packets: 20000
  Tx Bytes:   25560000
  TxOffered:  6.50024 Mbps
  Rx Packets: 12525
  Rx Bytes:   16006950
  Throughput: 4.07078 Mbps


 I can't find the problems. 

here is my attributes and code:

default ns3::LteUePhy::TxPower "20"
default ns3::LteUePhy::NoiseFigure "20"
default ns3::LteUePhy::TxMode1Gain "5"
default ns3::LteUePhy::TxMode2Gain "4.2"
default ns3::LteUePhy::TxMode3Gain "-2.8"
default ns3::LteUePhy::TxMode4Gain "0"
default ns3::LteUePhy::TxMode5Gain "0"
default ns3::LteUePhy::TxMode6Gain "0"
default ns3::LteUePhy::TxMode7Gain "0"
default ns3::LteUePhy::RsrpSinrSamplePeriod "1"
default ns3::LteEnbPhy::TxPower "35"

default ns3::LteEnbPhy::NoiseFigure "10"
default ns3::LteEnbPhy::MacToChannelDelay "2"
default ns3::LteEnbPhy::UeSinrSamplePeriod "1"
default ns3::LteEnbPhy::InterferenceSamplePeriod "1"
default ns3::LteNetDevice::Mtu "1500"

default ns3::LteEnbNetDevice::UlBandwidth "100"
default ns3::LteEnbNetDevice::DlBandwidth "100"
default ns3::UdpClient::PacketSize "1250"

default ns3::LteEnbNetDevice::CellId "0"
default ns3::LteEnbNetDevice::DlEarfcn "100"
default ns3::LteEnbNetDevice::UlEarfcn "18100"
default ns3::LteRlcAm::PollRetransmitTimer "+100000000.0ns"

default ns3::LteHelper::PathlossModel "ns3::Cost231PropagationLossModel"
default ns3::LteEnbRrc::SrsPeriodicity "40"
default ns3::LteEnbRrc::DefaultTransmissionMode "0"
default ns3::LteEnbRrc::EpsBearerToRlcMapping "RlcSmAlways"
default ns3::LteEnbRrc::SystemInformationPeriodicity "+40000000.0ns"
default ns3::LteRlcUm::MaxTxBufferSize "1024000"
default ns3::LteRlcTm::MaxTxBufferSize "20971520"
default ns3::LteHelper::Scheduler "ns3::PfFfMacScheduler"
default ns3::LteEnbRrc::ConnectionTimeoutDuration "+15000000.0ns"
default ns3::LteEnbRrc::ConnectionRejectedTimeoutDuration "+30000000.0ns"
default ns3::LteEnbRrc::HandoverJoiningTimeoutDuration "+200000000.0ns"
default ns3::LteEnbRrc::HandoverLeavingTimeoutDuration "+500000000.0ns"
default ns3::LteEnbRrc::QRxLevMin "-70"
default ns3::PointToPointNetDevice::DataRate "100000000bps"
default ns3::LteEnbRrc::AdmitHandoverRequest "true"
default ns3::LteEnbRrc::AdmitRrcConnectionRequest "true"


---------------------------------------------------CODE---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "ns3/core-module.h"
#include "ns3/csma-module.h"
#include "ns3/lte-helper.h"
#include "ns3/epc-helper.h"
#include <ns3/flow-monitor-helper.h>
#include "ns3/network-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/applications-module.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/config-store.h"
#include "ns3/radio-bearer-stats-calculator.h"
#include "ns3/lte-global-pathloss-database.h"
#include "ns3/internet-module.h"
#include "ns3/global-value.h" 
#include "ns3/netanim-module.h"  
#include <iomanip>
#include <string>
#include <fstream>
#include "ns3/log.h"
#include "ns3/flow-monitor-module.h"
#include "ns3/spectrum-module.h"
#include <ns3/buildings-helper.h>


//#include "ns3/gtk-config-store.h"

using namespace ns3;


/**
 * Sample simulation script for LTE+EPC. It instantiates several eNodeB,
 * attaches one UE per eNodeB starts a flow for each UE to  and from a remote host.
 * It also  starts yet another flow between each UE pair.
 */

void ThroughputMonitor (FlowMonitorHelper* fmhelper, Ptr<FlowMonitor> flowMon)
{
flowMon->CheckForLostPackets(); 
std::map<FlowId, FlowMonitor::FlowStats> flowStats = flowMon->GetFlowStats();
Ptr<Ipv4FlowClassifier> classing = DynamicCast<Ipv4FlowClassifier> (fmhelper->GetClassifier());
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator stats = flowStats.begin (); stats != flowStats.end (); ++stats)
{
Ipv4FlowClassifier::FiveTuple fiveTuple = classing->FindFlow (stats->first);
std::cout<<"Flow ID : " << stats->first <<" ; "<< fiveTuple.sourceAddress <<" -----> "<<fiveTuple.destinationAddress<<std::endl;
// std::cout<<"Tx Packets = " << stats->second.txPackets<<std::endl;
// std::cout<<"Rx Packets = " << stats->second.rxPackets<<std::endl;
std::cout<<"Duration : "<<stats->second.timeLastRxPacket.GetSeconds()-stats->second.timeFirstTxPacket.GetSeconds()<<std::endl;
std::cout<<"Last Received Packet : "<< stats->second.timeLastRxPacket.GetSeconds()<<" Seconds"<<std::endl;
std::cout<<"Throughput: " << stats->second.rxBytes * 8.0 / (stats->second.timeLastRxPacket.GetSeconds()-stats->second.timeFirstTxPacket.GetSeconds())/1024/1024  << " Mbps"<<std::endl;
std::cout<<"---------------------------------------------------------------------------"<<std::endl;
}
Simulator::Schedule(Seconds(1),&ThroughputMonitor, fmhelper, flowMon);
}

NS_LOG_COMPONENT_DEFINE ("EpcFirstExample");

int
main (int argc, char *argv[])
{

//
// Enable logging for UdpClient and
//
  
  
  LogComponentEnable ("MobilityHelper", LOG_LEVEL_INFO);
  

  
  double simTime = 30.0;
  double distance = 30.0;
  double interPacketInterval = 1;
  double radius = 20;
  uint32_t numUes = 10;

  // Command line arguments
  CommandLine cmd;
  
  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("input-defaults.txt"));
  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Load"));
  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));

  
  cmd.AddValue("simTime", "Total duration of the simulation [s])", simTime);
  cmd.AddValue("distance", "Distance between eNBs [m]", distance);
  cmd.AddValue("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
  cmd.AddValue ("radius", "the radius of the disc where UEs are placed around an eNB", radius);
  cmd.AddValue ("numUes", "how many UEs are attached to each eNB", numUes);
  cmd.Parse(argc, argv);

  
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
  Ptr<PointToPointEpcHelper>  epcHelper = CreateObject<PointToPointEpcHelper> ();
  lteHelper->SetEpcHelper (epcHelper);
  
  Ptr<PfFfMacScheduler> pfFfMacScheduler = CreateObject<PfFfMacScheduler> ();
  
  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler"); //PfFfMacScheduler
 
  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::Cost231PropagationLossModel"));


  ConfigStore inputConfig;
  inputConfig.ConfigureDefaults();

  // parse again so you can override default values from the command line
  cmd.Parse(argc, argv);


  // determine the string tag that identifies this simulation run
  // this tag is then appended to all filenames

  IntegerValue runValue;
  GlobalValue::GetValueByName ("RngRun", runValue);
  RngSeedManager::SetSeed(2);
  RngSeedManager::SetRun(7);
  


  Ptr<Node> pgw = epcHelper->GetPgwNode ();
   // Create a single RemoteHost
  NodeContainer remoteHostContainer;
  remoteHostContainer.Create (1);
  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
  InternetStackHelper internet;
  internet.Install (remoteHostContainer);

  // Create the Internet
  PointToPointHelper p2ph;
  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
  Ipv4AddressHelper ipv4h;
  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
  // interface 0 is localhost, 1 is the p2p device
  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);

  Ipv4StaticRoutingHelper ipv4RoutingHelper;
  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);

  NodeContainer ueNodes;
  NodeContainer enbNodes;
  enbNodes.Create(2);
  ueNodes.Create(numUes);
  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes);
  

  // Position of  eNB 2
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  positionAlloc->Add (Vector (10.0, 10.0, 0.0));
  positionAlloc->Add (Vector (distance,distance, 0.0));
  

  MobilityHelper enbmobility;
  enbmobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  enbmobility.SetPositionAllocator (positionAlloc);
  enbmobility.Install (enbNodes);


 // Position of UEs attached to eNB 

  MobilityHelper uemobility;
  for (uint16_t i = 0; i < numUes; i++)
    {
  uemobility.SetPositionAllocator ("ns3::RandomDiscPositionAllocator",
                                 "X", StringValue ("25.0"),
                                 "Y", StringValue ("25.0"),
                                 "Rho", StringValue ("ns3::UniformRandomVariable[Min=0|Max=20]"));
    }

  uemobility.Install (ueNodes);
 
  
  // Install LTE Devices to the nodes
  
  NetDeviceContainer enbLteDevs;
  NetDeviceContainer ueLteDevs;
 
  enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
  ueLteDevs = lteHelper->InstallUeDevice (ueNodes);


  
  // Install the IP stack on the UEs
  internet.Install (ueNodes);
  Ipv4InterfaceContainer ueIpIface;
  ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevs));
  
  // Assign IP address to UEs, and install applications
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
    {
      Ptr<Node> ueNode = ueNodes.Get (u);
      // Set the default gateway for the UE
      Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
      ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
    }

  
   // Attach all UEs to the first eNodeB
 
    for (uint16_t i = 0; i < numUes; i++)
      {
        lteHelper->Attach (ueLteDevs.Get (i),enbLteDevs.Get (1));  
        // side effect: the default EPS bearer will be activated
      }
 
 Ptr<LteEnbPhy> enb0Phy = enbLteDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ();
  enb0Phy->SetTxPower (35); 
Ptr<LteEnbPhy> enb1Phy = enbLteDevs.Get (1)->GetObject<LteEnbNetDevice> ()->GetPhy ();
  enb1Phy->SetTxPower (60); 

  // Install and start applications on UEs and remote host
  uint16_t dlPort = 1234;
  uint16_t ulPort = 2000;
  uint16_t otherPort = 3000;
 
  ApplicationContainer clientApps;
  ApplicationContainer serverApps;
  
 
 for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
    {
  
      ++ulPort;
      ++otherPort;

      PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
      PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
      PacketSinkHelper packetSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), otherPort));
      serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get(u)));
      serverApps.Add (ulPacketSinkHelper.Install (remoteHost));
      serverApps.Add (packetSinkHelper.Install (ueNodes.Get(u)));
              

      UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort);
      dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
      dlClient.SetAttribute ("MaxPackets", UintegerValue(20000));
    
      
      UdpClientHelper ulClient (remoteHostAddr, ulPort);
      ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
      ulClient.SetAttribute ("MaxPackets", UintegerValue(20000));
   

      UdpClientHelper client (ueIpIface.GetAddress (u), otherPort);
      client.SetAttribute ("Interval", TimeValue (MilliSeconds(interPacketInterval)));
      client.SetAttribute ("MaxPackets", UintegerValue(20000));
       
    
      clientApps.Add (dlClient.Install (remoteHost));
      clientApps.Add (ulClient.Install (ueNodes.Get(u)));
      if (u+1 < ueNodes.GetN ())
        {
          clientApps.Add (client.Install (ueNodes.Get(u+1)));
        }
      else
        {
          clientApps.Add (client.Install (ueNodes.Get(0)));
        }
        
    
    }
  serverApps.Start (Seconds (0.01));
  clientApps.Start (Seconds (0.01));
  
  // Uncomment to enable PCAP tracing
  //p2ph.EnablePcapAll("lena-epc-first");
  
  
  Simulator::Stop(Seconds(simTime));

  lteHelper->EnablePhyTraces ();
  lteHelper->EnableMacTraces ();
  lteHelper->EnableRlcTraces ();
  lteHelper->EnablePdcpTraces ();
  lteHelper->EnableUlMacTraces ();

  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("output-attributes.txt"));
  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
  ConfigStore outputConfig;
  outputConfig.ConfigureDefaults ();
  outputConfig.ConfigureAttributes ();
  
 FlowMonitorHelper flowmon;
 Ptr<FlowMonitor> monitor = flowmon.Install(ueNodes);
 monitor = flowmon.Install(remoteHost);
 monitor = flowmon.GetMonitor ();
 


  monitor->SetAttribute("DelayBinWidth", DoubleValue (0.001));

  monitor->SetAttribute("JitterBinWidth", DoubleValue (0.001));

  monitor->SetAttribute("PacketSizeBinWidth", DoubleValue (2000));

  monitor->SerializeToXmlFile("results.xml", true, true);


  AnimationInterface anim ("animation.xml");  // where "animation.xml" is any arbitrary filename
  
  
  Simulator::Run();

  //string xmlFileName = "flow-monitor-output.xml"
  monitor->SerializeToXmlFile ("results.xml",false,false); 

  //  Print per flow statistics
   monitor->CheckForLostPackets ();
  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
  for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
    {
      // first 2 FlowIds are for ECHO apps, we don't want to display them
      if (i->first > 0)
        {
          Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
          std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
          std::cout << "  Tx Packets: " << i->second.txPackets << "\n";
          std::cout << "  Tx Bytes:   " << i->second.txBytes << "\n";
          std::cout << "  TxOffered:  " << i->second.txBytes * 8.0 / simTime / 1024 / 1024  << " Mbps\n";
          std::cout << "  Rx Packets: " << i->second.rxPackets << "\n";
          std::cout << "  Rx Bytes:   " << i->second.rxBytes << "\n";
          std::cout << "  Throughput: " << i->second.rxBytes * 8.0 / simTime / 1024 / 1024  << " Mbps\n";
          }
    }

//string xmlFileName = "flow-monitor-output.xml"

 
    ThroughputMonitor(&flowmon ,monitor);

  /*GtkConfigStore config;
  config.ConfigureAttributes();*/
  
  // iterate our nodes and print their position.
  for (NodeContainer::Iterator j = allNodes.Begin ();
       j != allNodes.End (); ++j)
    {
      Ptr<Node> object = *j;
      Ptr<MobilityModel> position = object->GetObject<MobilityModel> ();
      NS_ASSERT (position != 0);
      Vector pos = position->GetPosition ();
      std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
    }

  Simulator::Destroy();
  return 0;

}

Is it any possible that the problem is on the buffer between remote host and Enb or somthing else?

need some idea, thanks



  
lena-simple-epc-2.cc
input-defaults.txt

Nicola Baldo

unread,
Aug 28, 2014, 6:02:29 AM8/28/14
to ns-3-...@googlegroups.com
Why do you expect to be able to reach 6Mbps?

許朝評

unread,
Aug 28, 2014, 9:29:32 AM8/28/14
to ns-3-...@googlegroups.com
 I need to make sure every user can have good quality of service through connecting with Enbs.
Just for example, some users want their data rate can reach 6Mbps and some users need the data rate over 10Mbps...etc

Nicola Baldo於 2014年8月28日星期四UTC+8下午6時02分29秒寫道:

Nicola Baldo

unread,
Sep 1, 2014, 9:15:26 AM9/1/14
to ns-3-...@googlegroups.com
Ok, but the fact that users want 6Mbps does not mean that they will get it...

許朝評

unread,
Sep 1, 2014, 12:50:03 PM9/1/14
to ns-3-...@googlegroups.com
Oh, I got it!

So it is not necessary to check the throughput about the full time.

All I need to do is check what time the server sent the packets and what time the client receive the packets, than I can estimate the achievable rate.

Should I use the packets trace? like enable the  pcap file or I can got these information from the Dlpdcp.txt...those trace file.

Is that right?

Nicola Baldo於 2014年9月1日星期一UTC+8下午9時15分26秒寫道:

Nicola Baldo

unread,
Sep 2, 2014, 4:25:07 AM9/2/14
to ns-3-...@googlegroups.com
If that works for you, great! Frankly I can't understand your problem from your description.

許朝評

unread,
Sep 3, 2014, 2:43:41 AM9/3/14
to ns-3-...@googlegroups.com
OK.... actually I'm doing the research about power saving.I prefer to shot down some Enbs at midnight.

So  I need choose which Enbs can be turned off. After turn off the Enbs, I want to make sure every Ue's data rate can still be almost the same as before.

That's why I want to test the data rate between Enb and Ue. 

Nicola Baldo於 2014年9月2日星期二UTC+8下午4時25分07秒寫道:
Reply all
Reply to author
Forward
0 new messages