TCP-over LTE : Mobility performance evaluation

430 views
Skip to first unread message

Lee JooHyung

unread,
Jul 17, 2014, 2:42:24 AM7/17/14
to ns-3-...@googlegroups.com
Dear all,
I am ns-3 beginner, and have been trying to evaluate TCP performance over LTE when user has mobility.

Scenario is that 

//       UE -----eNB--------EPC------remote-host
//                              10 Mbps
//                               10 ms

Even though I consider randomwalk model, I always received same mean throughput such as 1.61578 Mbps. In addition, when I checked MAC tracing file, it shows that MCS level is always same.

Furthermore, When I want to check the eNB delay, should I see the PDCP delay or RLC delay?? There are two types of delay performance in tracing. 

I would like to attach my source file as follows; I would like to get your kind help or comments from.

Thanks

--------------------------------------------------------------------------------------

 
#include <string>
#include <fstream>
#include <iomanip>
#include <ns3/log.h>
#include "ns3/point-to-point-module.h"
#include "ns3/lte-helper.h"
#include "ns3/epc-helper.h"
#include "ns3/core-module.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/packet-sink.h"
#include "ns3/flow-monitor-helper.h"
#include "ns3/netanim-module.h"
#include "ns3/radio-bearer-stats-calculator.h"
#include "ns3/lte-global-pathloss-database.h"



using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("LteTcpSingleFlow");

static void 
CwndChange (Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
{
  //NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t" << newCwnd);
  *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << newCwnd << std::endl;
}

static void
TraceCwnd ()
{
  // Trace changes to the congestion window
  AsciiTraceHelper ascii;
  Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream ("lte-tcp-single-flow.cwnd");
  Config::ConnectWithoutContext ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&CwndChange,stream));
}

int
main (int argc, char *argv[])
{
  uint32_t maxBytes = 0;
  //uint32_t queueSize = 100;
  DataRate linkRate("1Gbps");
  std::string protocol = "TcpNewReno";    
  double simTime = 5.0;
  
  CommandLine cmd;
  //cmd.AddValue("queueSize","queue size",queueSize);
  cmd.AddValue("linkRate","link rate",linkRate);
  cmd.AddValue("protocol","protocol",protocol);
  cmd.Parse(argc,argv);

    // Set TCP defaults
  Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue (1460));
  Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue (0));
  // Config::SetDefault("ns3::TcpSocket::SndBufSize", UintegerValue (524288));
  // Config::SetDefault("ns3::TcpSocket::RcvBufSize", UintegerValue (524288));
  // Config::SetDefault("ns3::TcpSocket::SlowStartThreshold", UintegerValue (1000000));
  if (protocol == "TcpTahoe")
    Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpTahoe"));
  else
    Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpNewReno"));

  FlowMonitorHelper fl;
  Ptr<FlowMonitor> monitor;

  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
  lteHelper->SetEpcHelper (epcHelper);
  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);

  Ptr<Node> pgw = epcHelper->GetPgwNode ();

   // Create a single RemoteHost
  NodeContainer remoteHostContainer;
  remoteHostContainer.Create (1);
  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
  

  // Create the Internet
  PointToPointHelper p2ph;
  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate (linkRate)));
  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
  //p2ph.SetQueue("ns3::DropTailQueue","MaxPackets",UintegerValue(queueSize));
  p2ph.SetChannelAttribute ("Delay", StringValue ("1ms"));
  
  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
  
  // Install the internet stack on the nodes
  InternetStackHelper internet;
  internet.Install (remoteHostContainer); 
  
  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(1);
  ueNodes.Create(1);

  // Install Static Mobility Model
// Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();

// positionAlloc->Add (Vector(0, 0, 0));
// MobilityHelper mobility;
 //mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
 //mobility.SetPositionAllocator(positionAlloc);
 //mobility.Install(enbNodes);
 //mobility.Install(ueNodes);


 // Position of eNBs
  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
  MobilityHelper enbMobility;
  enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  enbMobility.SetPositionAllocator (positionAlloc);
  enbMobility.Install (enbNodes);

  MobilityHelper mobility;
  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
                                 "MinX", DoubleValue (0.0),
                                 "MinY", DoubleValue (0.0),
                                 "DeltaX", DoubleValue (5.0),
                                 "DeltaY", DoubleValue (10.0),
                                 "GridWidth", UintegerValue (3),
                                 "LayoutType", StringValue ("RowFirst"));
  mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel","Bounds", RectangleValue (Rectangle (-1000, 1000, -1000, 1000)));
  mobility.Install (ueNodes);
  
  MobilityHelper mobility2;
  mobility2.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  mobility2.Install (pgw);
  mobility2.Install (remoteHost);

  // Install LTE Devices to the nodes
  NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
  NetDeviceContainer 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

  Ptr<Node> ueNode = ueNodes.Get (0);
  // Set the default gateway for the UE
  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);

 // Attach one UE per eNodeB
  lteHelper->Attach (ueLteDevs.Get(0), enbLteDevs.Get(0));
  
 
  // Create a BulkSendApplication and install it on remote host
  uint16_t port = 8080;  // well-known echo port number
BulkSendHelper source ("ns3::TcpSocketFactory",
                         InetSocketAddress (ueIpIface.GetAddress (0), port));
  // Set the amount of data to send in bytes.  Zero is unlimited.
  source.SetAttribute ("MaxBytes", UintegerValue (maxBytes));
// Set the segment size
  source.SetAttribute ("SendSize", UintegerValue (1000));
  ApplicationContainer sourceApps = source.Install (remoteHostContainer.Get (0));
  sourceApps.Start (Seconds (0.0));
  sourceApps.Stop (Seconds (simTime));

// Create a PacketSinkApplication and install it on ueNode
  Address sinkAddress (InetSocketAddress (ueIpIface.GetAddress (0), port));
  PacketSinkHelper sink ("ns3::TcpSocketFactory",
                         InetSocketAddress (Ipv4Address::GetAny (), port));
  ApplicationContainer sinkApps = sink.Install (ueNodes.Get (0));
  sinkApps.Start (Seconds (0.0));
  sinkApps.Stop (Seconds (simTime));
 
  // Set up tracing
  AsciiTraceHelper ascii;
  p2ph.EnableAsciiAll (ascii.CreateFileStream ("lte-tcp-single-flow.tr"));
  p2ph.EnablePcapAll ("lte-tcp-single-flow", false);
  // Setup tracing for cwnd
  Simulator::Schedule(Seconds(0.00001),&TraceCwnd);
  Simulator::Stop (Seconds (simTime));


 // monitor = fl.Install(enbNodes);
 // monitor->SetAttribute ("DelayBinWidth", DoubleValue(0.001));
 // monitor->SetAttribute ("JitterBinWidth", DoubleValue(0.001));
 // monitor->SetAttribute ("PacketSizeBinWidth", DoubleValue(20));

lteHelper->EnablePdcpTraces ();
  lteHelper->EnableMacTraces ();
  lteHelper->EnableRlcTraces ();
lteHelper->EnablePhyTraces ();
   
  // Run the simulation
  Simulator::Run ();
 
  Ptr<PacketSink> sink1 = DynamicCast<PacketSink> (sinkApps.Get (0));
  std::cout << "Total Bytes Received (Byte): " << sink1->GetTotalRx () << std::endl; 
  std::cout << "Total Throughput (Mbps): " << sink1->GetTotalRx ()*8/simTime/1000000 << std::endl; 
Simulator::Destroy ();
 
}

José Fernando Salvago Duarte

unread,
Jul 17, 2014, 8:46:44 AM7/17/14
to ns-3-...@googlegroups.com
Hi Lee,

I've been working a bit with NS3 and I had a problem like this.
I think that MCS is always the same because you are always transmitting the same power. If you change the transmission power you can check it. The Uplink Power Control is a functionality that is not implemented yet, so the UE will always transmit with the same power and  because of this, with the same MCS.

Best regards.

Lee JooHyung

unread,
Jul 17, 2014, 9:08:53 PM7/17/14
to ns-3-...@googlegroups.com
Hi, Duarte,

Thanks for kind reply. Even though transmission of BS or UE is fixed, CQI value of UE could be changed according to the distance from BS. So I guess that MCS level also could be changed with varying CQI value.

Nevertheless, I think your intention is that if transmission of BS power is enough to cover the whole coverage, then MCS level is always selected by the highest value such as 28 MCS in NS3.

Could you let me know how to reduce BS transmission power in my source code directly??.

Thanks

From Joohyung Lee

2014년 7월 17일 목요일 오후 9시 46분 44초 UTC+9, José Fernando Salvago Duarte 님의 말:

Konstantinos

unread,
Jul 18, 2014, 11:01:33 AM7/18/14
to ns-3-...@googlegroups.com
Dear Joohyung,

Another thing you need to consider with the movement is how much you actually move.
From your scenario I see that your simulation time is 5sec and by using the default RandomWalkMobilityModel the speed is a uniform speed [2,4]m/s. 
So your UE could have changed his position only by max 20m and you are not sure if its direction is away from or towards the eNB. So I would not expect to see any difference for that type of mobility.

Regards,
K.

PS: Please do not post your code within the message, use attachments. 

Lee JooHyung

unread,
Jul 21, 2014, 5:51:23 AM7/21/14
to ns-3-...@googlegroups.com
Dear Konstantinos,

Thanks for your kind replay. Based on your comments, 1) I extended simulation run time and,

2) as another approach, I tried to do simulation according to varying distance from eNB instead of Random mobility model, still it turns out same MCS level (28).

In addition, another thing I found is that at some point, throughput is 0. From this, I think that LTE model only supports conncected and dis-connected depending on coverage in my scenario. However, I do not find which part is problem in my scenarios.

Thanks. 

2014년 7월 19일 토요일 오전 12시 1분 33초 UTC+9, Konstantinos 님의 말:

Nicola Baldo

unread,
Jul 22, 2014, 4:55:33 AM7/22/14
to ns-3-...@googlegroups.com
Hi JooHyung,

I think Konstantinos is right, and maybe your new changes are just not sufficient. Did you check what is the initial and final distance from the eNB, and what is the corresponding change in path loss that you would expect based on the propagation loss model that you are using?


Reply all
Reply to author
Forward
0 new messages