A Discrete-Event Network Simulator
API
lena-radio-link-failure.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 Fraunhofer ESK
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Vignesh Babu <ns3-dev@esk.fraunhofer.de>
19  */
20 
21 #include "ns3/core-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/internet-module.h"
24 #include "ns3/mobility-module.h"
25 #include "ns3/lte-module.h"
26 #include "ns3/applications-module.h"
27 #include "ns3/point-to-point-module.h"
28 #include <iostream>
29 #include <vector>
30 #include <stdio.h>
31 #include <iomanip>
32 
33 using namespace ns3;
34 
35 NS_LOG_COMPONENT_DEFINE ("LenaRadioLinkFailure");
36 
37 //Global values to check the simulation
38 //behavior during and after the simulation.
39 uint16_t counterN310FirsteNB = 0;
41 uint32_t ByteCounter = 0;
42 uint32_t oldByteCounter = 0;
43 
44 
45 void
46 PrintUePosition (uint64_t imsi)
47 {
48 
49  for (NodeList::Iterator it = NodeList::Begin (); it != NodeList::End (); ++it)
50  {
51  Ptr<Node> node = *it;
52  int nDevs = node->GetNDevices ();
53  for (int j = 0; j < nDevs; j++)
54  {
55  Ptr<LteUeNetDevice> uedev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
56  if (uedev)
57  {
58  if (imsi == uedev->GetImsi ())
59  {
60  Vector pos = node->GetObject<MobilityModel> ()->GetPosition ();
61  std::cout << "IMSI : " << uedev->GetImsi () << " at " << pos.x << "," << pos.y << std::endl;
62  }
63  }
64  }
65  }
66 }
67 
68 void
69 NotifyConnectionEstablishedUe (std::string context,
70  uint64_t imsi,
71  uint16_t cellid,
72  uint16_t rnti)
73 {
74  std::cout << Simulator::Now ().GetSeconds () << " " << context
75  << " UE IMSI " << imsi
76  << ": connected to cell id " << cellid
77  << " with RNTI " << rnti
78  << std::endl;
79 }
80 
81 void
82 NotifyConnectionEstablishedEnb (std::string context,
83  uint64_t imsi,
84  uint16_t cellId,
85  uint16_t rnti)
86 {
87  std::cout << Simulator::Now ().GetSeconds () << " " << context
88  << " eNB cell id " << cellId
89  << ": successful connection of UE with IMSI " << imsi
90  << " RNTI " << rnti
91  << std::endl;
92  //In this example, a UE should experience RLF at least one time in
93  //cell 1. For the case, when there is only one eNB with ideal RRC,
94  //a UE might reconnects to the eNB multiple times due to more than
95  //one RLF. To handle this, we reset the counter here so, even if the UE
96  //connects multiple time to cell 1 we count N310
97  //indication correctly, i.e., for each RLF UE RRC should receive
98  //configured number of N310 indications.
99  if (cellId == 1)
100  {
102  }
103 }
104 
106 static const std::string g_ueRrcStateName[LteUeRrc::NUM_STATES] =
107 {
108  "IDLE_START",
109  "IDLE_CELL_SEARCH",
110  "IDLE_WAIT_MIB_SIB1",
111  "IDLE_WAIT_MIB",
112  "IDLE_WAIT_SIB1",
113  "IDLE_CAMPED_NORMALLY",
114  "IDLE_WAIT_SIB2",
115  "IDLE_RANDOM_ACCESS",
116  "IDLE_CONNECTING",
117  "CONNECTED_NORMALLY",
118  "CONNECTED_HANDOVER",
119  "CONNECTED_PHY_PROBLEM",
120  "CONNECTED_REESTABLISHING"
121 };
122 
127 static const std::string & ToString (LteUeRrc::State s)
128 {
129  return g_ueRrcStateName[s];
130 }
131 
132 void
133 UeStateTransition (uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState)
134 {
135  std::cout << Simulator::Now ().GetSeconds ()
136  << " UE with IMSI " << imsi << " RNTI " << rnti << " connected to cell " << cellId <<
137  " transitions from " << ToString (oldState) << " to " << ToString (newState) << std::endl;
138 }
139 
140 void
141 EnbRrcTimeout (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause)
142 {
143  std::cout << Simulator::Now ().GetSeconds ()
144  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
145  << ", ENB RRC " << cause << std::endl;
146 }
147 
148 void
149 NotifyConnectionReleaseAtEnodeB (uint64_t imsi, uint16_t cellId, uint16_t rnti)
150 {
151  std::cout << Simulator::Now ()
152  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
153  << ", UE context destroyed at eNodeB" << std::endl;
154 }
155 
156 void PhySyncDetection (uint16_t n310, uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint8_t count)
157 {
158  std::cout << Simulator::Now ().GetSeconds ()
159  << " IMSI " << imsi << ", RNTI " << rnti
160  << ", Cell id " << cellId << ", " << type << ", no of sync indications: " << +count
161  << std::endl;
162 
163  if (type == "Notify out of sync" && cellId == 1)
164  {
166  if (counterN310FirsteNB == n310)
167  {
169  }
170  NS_LOG_DEBUG ("counterN310FirsteNB = " << counterN310FirsteNB);
171  }
172 }
173 
174 void RadioLinkFailure (Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti)
175 {
176  std::cout << Simulator::Now ()
177  << " IMSI " << imsi << ", RNTI " << rnti
178  << ", Cell id " << cellId << ", radio link failure detected"
179  << std::endl << std::endl;
180 
181  PrintUePosition (imsi);
182 
183  if (cellId == 1)
184  {
185  NS_ABORT_MSG_IF ((Simulator::Now () - t310StartTimeFirstEnb) != t310, "T310 timer expired at wrong time");
186  }
187 }
188 
189 void
190 NotifyRandomAccessErrorUe (uint64_t imsi, uint16_t cellId, uint16_t rnti)
191 {
192  std::cout << Simulator::Now ().GetSeconds ()
193  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
194  << ", UE RRC Random access Failed" << std::endl;
195 }
196 
197 void
198 NotifyConnectionTimeoutUe (uint64_t imsi, uint16_t cellId, uint16_t rnti,
199  uint8_t connEstFailCount)
200 {
201  std::cout << Simulator::Now ().GetSeconds ()
202  << " IMSI " << imsi << ", RNTI " << rnti
203  << ", Cell id " << cellId
204  << ", T300 expiration counter " << (uint16_t) connEstFailCount
205  << ", UE RRC Connection timeout" << std::endl;
206 }
207 
208 void
209 NotifyRaResponseTimeoutUe (uint64_t imsi, bool contention,
210  uint8_t preambleTxCounter,
211  uint8_t maxPreambleTxLimit)
212 {
213  std::cout << Simulator::Now ().GetSeconds ()
214  << " IMSI " << imsi << ", Contention flag " << contention
215  << ", preamble Tx Counter " << (uint16_t) preambleTxCounter
216  << ", Max Preamble Tx Limit " << (uint16_t) maxPreambleTxLimit
217  << ", UE RA response timeout" << std::endl;
218  NS_FATAL_ERROR ("NotifyRaResponseTimeoutUe");
219 }
220 
221 void
223 {
224  ByteCounter += packet->GetSize ();
225 }
226 
227 void
228 Throughput(bool firstWrite, Time binSize, std::string fileName)
229 {
230  std::ofstream output;
231 
232  if (firstWrite == true)
233  {
234  output.open (fileName.c_str (), std::ofstream::out);
235  firstWrite = false;
236  }
237  else
238  {
239  output.open (fileName.c_str (), std::ofstream::app);
240  }
241 
242  //Instantaneous throughput every 200 ms
243  double throughput = (ByteCounter - oldByteCounter)*8/binSize.GetSeconds ()/1024/1024;
244  output << Simulator::Now().GetSeconds() << " " << throughput << std::endl;
246  Simulator::Schedule (binSize, &Throughput, firstWrite, binSize, fileName);
247 }
248 
264 int
265 main (int argc, char *argv[])
266 {
267  // Configurable parameters
268  Time simTime = Seconds (25);
269  uint16_t numberOfEnbs = 1;
270  double interSiteDistance = 1200;
271  uint16_t n311 = 1;
272  uint16_t n310 = 1;
273  Time t310 = Seconds (1);
274  bool useIdealRrc = true;
275  bool enableCtrlErrorModel = true;
276  bool enableDataErrorModel = true;
277  bool enableNsLogs = false;
278 
280  cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)", simTime);
281  cmd.AddValue ("numberOfEnbs", "Number of eNBs", numberOfEnbs);
282  cmd.AddValue ("n311", "Number of in-synch indication", n311);
283  cmd.AddValue ("n310", "Number of out-of-synch indication", n310);
284  cmd.AddValue ("t310", "Timer for detecting the Radio link failure (in seconds)", t310);
285  cmd.AddValue ("interSiteDistance", "Inter-site distance in meter", interSiteDistance);
286  cmd.AddValue ("useIdealRrc", "Use ideal RRC protocol", useIdealRrc);
287  cmd.AddValue ("enableCtrlErrorModel", "Enable control error model", enableCtrlErrorModel);
288  cmd.AddValue ("enableDataErrorModel", "Enable data error model", enableDataErrorModel);
289  cmd.AddValue ("enableNsLogs", "Enable ns-3 logging (debug builds)", enableNsLogs);
290  cmd.Parse (argc, argv);
291 
292  if (enableNsLogs)
293  {
295  LogComponentEnable ("LteUeRrc", logLevel);
296  LogComponentEnable ("LteUeMac", logLevel);
297  LogComponentEnable ("LteUePhy", logLevel);
298 
299  LogComponentEnable ("LteEnbRrc", logLevel);
300  LogComponentEnable ("LteEnbMac", logLevel);
301  LogComponentEnable ("LteEnbPhy", logLevel);
302 
303  LogComponentEnable ("LenaRadioLinkFailure", logLevel);
304  }
305 
306  uint16_t numberOfUes = 1;
307  uint16_t numBearersPerUe = 1;
308  double eNodeB_txPower = 43;
309 
310  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (useIdealRrc));
311  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (enableCtrlErrorModel));
312  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (enableDataErrorModel));
313 
314  Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue (60 * 1024));
315 
316  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
317  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
318  lteHelper->SetEpcHelper (epcHelper);
319 
320  lteHelper->SetPathlossModelType (TypeId::LookupByName ("ns3::LogDistancePropagationLossModel"));
321  lteHelper->SetPathlossModelAttribute ("Exponent", DoubleValue (3.9));
322  lteHelper->SetPathlossModelAttribute ("ReferenceLoss", DoubleValue (38.57)); //ref. loss in dB at 1m for 2.025GHz
323  lteHelper->SetPathlossModelAttribute ("ReferenceDistance", DoubleValue (1));
324 
325  //----power related (equal for all base stations)----
326  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNodeB_txPower));
327  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (23));
328  Config::SetDefault ("ns3::LteUePhy::NoiseFigure", DoubleValue (7));
329  Config::SetDefault ("ns3::LteEnbPhy::NoiseFigure", DoubleValue (2));
330  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
331  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
332  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (true));
333 
334  //----frequency related----
335  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100)); //2120MHz
336  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100)); //1930MHz
337  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (25)); //5MHz
338  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (25)); //5MHz
339 
340  //----others----
341  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
342  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
343  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.01));
344  Config::SetDefault ("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue (true));
345 
346  Config::SetDefault ("ns3::FfMacScheduler::UlCqiFilter", EnumValue (FfMacScheduler::SRS_UL_CQI));
347 
348  //Radio link failure detection parameters
349  Config::SetDefault ("ns3::LteUeRrc::N310", UintegerValue (n310));
350  Config::SetDefault ("ns3::LteUeRrc::N311", UintegerValue (n311));
351  Config::SetDefault ("ns3::LteUeRrc::T310", TimeValue (t310));
352 
353  NS_LOG_INFO ("Create the internet");
354  Ptr<Node> pgw = epcHelper->GetPgwNode ();
355  // Create a single RemoteHost0x18ab460
356  NodeContainer remoteHostContainer;
357  remoteHostContainer.Create (1);
358  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
359  InternetStackHelper internet;
360  internet.Install (remoteHostContainer);
361  PointToPointHelper p2ph;
362  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
363  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
364  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
365  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
366  Ipv4AddressHelper ipv4h;
367  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
368  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
369  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
370  Ipv4StaticRoutingHelper ipv4RoutingHelper;
371  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
372  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
373 
374  NS_LOG_INFO ("Create eNodeB and UE nodes");
375  NodeContainer enbNodes;
376  NodeContainer ueNodes;
377  enbNodes.Create (numberOfEnbs);
378  ueNodes.Create (numberOfUes);
379 
380  NS_LOG_INFO ("Assign mobility");
381  Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator> ();
382 
383  for (uint16_t i = 0; i < numberOfEnbs; i++)
384  {
385  positionAllocEnb->Add (Vector (interSiteDistance * i, 0, 0));
386  }
388  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
389  mobility.SetPositionAllocator (positionAllocEnb);
390  mobility.Install (enbNodes);
391 
392  Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator> ();
393 
394  for (int i = 0; i < numberOfUes; i++)
395  {
396  positionAllocUe->Add (Vector (200, 0, 0));
397  }
398 
399  mobility.SetPositionAllocator (positionAllocUe);
400  mobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
401  mobility.Install (ueNodes);
402 
403  for (int i = 0; i < numberOfUes; i++)
404  {
405  ueNodes.Get (i)->GetObject<ConstantVelocityMobilityModel> ()->SetVelocity (Vector (30, 0.0, 0.0));
406  }
407 
408  NS_LOG_INFO ("Install LTE Devices in eNB and UEs and fix random number stream");
409  NetDeviceContainer enbDevs;
410  NetDeviceContainer ueDevs;
411 
412  int64_t randomStream = 1;
413 
414  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
415  randomStream += lteHelper->AssignStreams (enbDevs, randomStream);
416  ueDevs = lteHelper->InstallUeDevice (ueNodes);
417  randomStream += lteHelper->AssignStreams (ueDevs, randomStream);
418 
419 
420  NS_LOG_INFO ("Install the IP stack on the UEs");
421  internet.Install (ueNodes);
422  Ipv4InterfaceContainer ueIpIfaces;
423  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
424 
425  NS_LOG_INFO ("Attach a UE to a eNB");
426  lteHelper->Attach (ueDevs);
427 
428  NS_LOG_INFO ("Install and start applications on UEs and remote host");
429  uint16_t dlPort = 10000;
430  uint16_t ulPort = 20000;
431 
432  DataRateValue dataRateValue = DataRate ("18.6Mbps");
433 
434  uint64_t bitRate = dataRateValue.Get ().GetBitRate ();
435 
436  uint32_t packetSize = 1024; //bytes
437 
438  NS_LOG_DEBUG ("bit rate " << bitRate);
439 
440  double interPacketInterval = static_cast<double> (packetSize * 8) / bitRate;
441 
442  Time udpInterval = Seconds (interPacketInterval);
443 
444  NS_LOG_DEBUG ("UDP will use application interval " << udpInterval.GetSeconds () << " sec");
445 
446 
447  for (uint32_t u = 0; u < numberOfUes; ++u)
448  {
449  Ptr<Node> ue = ueNodes.Get (u);
450  // Set the default gateway for the UE
451  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
452  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
453 
454  for (uint32_t b = 0; b < numBearersPerUe; ++b)
455  {
456  ApplicationContainer ulClientApps;
457  ApplicationContainer ulServerApps;
458  ApplicationContainer dlClientApps;
459  ApplicationContainer dlServerApps;
460 
461  ++dlPort;
462  ++ulPort;
463 
464  NS_LOG_LOGIC ("installing UDP DL app for UE " << u + 1);
465  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
466  dlClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
467  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
468  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
469  dlClientApps.Add (dlClientHelper.Install (remoteHost));
470 
471  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
472  dlServerApps.Add (dlPacketSinkHelper.Install (ue));
473 
474  NS_LOG_LOGIC ("installing UDP UL app for UE " << u + 1);
475  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
476  ulClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
477  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
478  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
479  ulClientApps.Add (ulClientHelper.Install (ue));
480 
481  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
482  ulServerApps.Add (ulPacketSinkHelper.Install (remoteHost));
483 
484  Ptr<EpcTft> tft = Create<EpcTft> ();
486  dlpf.localPortStart = dlPort;
487  dlpf.localPortEnd = dlPort;
488  tft->Add (dlpf);
490  ulpf.remotePortStart = ulPort;
491  ulpf.remotePortEnd = ulPort;
492  tft->Add (ulpf);
494  lteHelper->ActivateDedicatedEpsBearer (ueDevs.Get (u), bearer, tft);
495 
496  dlServerApps.Start (Seconds (0.27));
497  dlClientApps.Start (Seconds (0.27));
498  ulServerApps.Start (Seconds (0.27));
499  ulClientApps.Start (Seconds (0.27));
500  } // end for b
501  }
502  NS_LOG_INFO ("Enable Lte traces and connect custom trace sinks");
503 
504  lteHelper->EnableTraces ();
505  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
506  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
507  Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats ();
508  pdcpStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
509 
510  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
512  Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
514  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
516  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
518  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
520  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
522  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
524  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
526  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
528  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeMac/RaResponseTimeout",
530 
531  //Trace sink for the packet sink of UE
532  std::ostringstream oss;
533  oss << "/NodeList/" << ueNodes.Get (0)->GetId () << "/ApplicationList/0/$ns3::PacketSink/Rx";
535 
536  bool firstWrite = true;
537  std::string rrcType = useIdealRrc == 1 ? "ideal_rrc":"real_rrc";
538  std::string fileName = "rlf_dl_thrput_" + std::to_string (enbNodes.GetN ()) + "_eNB_" + rrcType;
539  Time binSize = Seconds (0.2);
540  Simulator::Schedule (Seconds(0.47), &Throughput, firstWrite, binSize, fileName);
541 
542  NS_LOG_INFO ("Starting simulation...");
543 
544  Simulator::Stop (simTime);
545 
546  Simulator::Run ();
547 
548  NS_ABORT_MSG_IF (counterN310FirsteNB != n310, "UE RRC should receive "
549  << n310 << " out-of-sync indications in Cell 1."
550  " Total received = " << counterN310FirsteNB);
551 
553 
554  return 0;
555 }
holds a vector of ns3::Application pointers.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Definition: epc-tft.cc:240
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:393
Prefix all trace prints with simulation node.
Definition: log.h:119
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
uint32_t GetId(void) const
Definition: node.cc:107
holds a vector of std::pair of Ptr<Ipv4> and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:258
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:341
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:355
static void Run(void)
Run the simulation.
Definition: simulator.cc:170
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
Definition: lte-helper.cc:961
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:204
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:280
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
cmd
Definition: second.py:35
Build a set of PointToPointNetDevice objects.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
Definition: lte-helper.cc:1443
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
Definition: lte-helper.cc:1069
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:249
a polymophic address class
Definition: address.h:90
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:279
mobility
Definition: third.py:101
Class for representing data rates.
Definition: data-rate.h:88
Keep track of the current position and velocity of an object.
Non-GBR IMS Signalling.
Definition: eps-bearer.h:116
uint64_t GetImsi() const
Get the IMSI.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:369
Hold variables of type enum.
Definition: enum.h:54
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1389
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
AttributeValue implementation for Time.
Definition: nstime.h:1124
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1426
Hold an unsigned integer type.
Definition: uinteger.h:44
static Iterator End(void)
Definition: node-list.cc:235
holds a vector of ns3::NetDevice pointers
void SetPathlossModelType(TypeId type)
Set the type of path loss model to be used for both DL and UL channels.
Definition: lte-helper.cc:385
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:860
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:213
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:871
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:134
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:76
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
Prefix all trace prints with simulation time.
Definition: log.h:118
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:193
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
DataRate Get(void) const
Definition: data-rate.cc:30
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
LogLevel
Logging severity classes and levels.
Definition: log.h:93
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
Definition: lte-helper.cc:1572
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1586
State
The states of the UE RRC entity.
Definition: lte-ue-rrc.h:105
Helper class used to assign positions and mobility models to nodes.
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:50
void SetEpcHelper(Ptr< EpcHelper > h)
Set the EpcHelper to be used to setup the EPC network in conjunction with the setup of the LTE radio ...
Definition: lte-helper.cc:272
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
static Iterator Begin(void)
Definition: node-list.cc:229
Prefix all trace prints with function.
Definition: log.h:117
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:178
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:272
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1062
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:810
void Add(Vector v)
Add a position to the list of positions.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Print everything.
Definition: log.h:115
Mobility model for which the current speed does not change once it has been set and until it is set a...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static const uint32_t packetSize
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
static const std::string g_ueRrcStateName[LteUeRrc::NUM_STATES]
Map each of UE RRC states to its string representation.
Definition: lte-ue-rrc.cc:101
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
uint32_t GetNDevices(void) const
Definition: node.cc:150
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:74
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:400
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:824
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
The LteUeNetDevice class implements the UE net device.