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 
75  std::cout << Simulator::Now ().As (Time::S) << " " << context
76  << " UE IMSI " << imsi
77  << ": connected to cell id " << cellid
78  << " with RNTI " << rnti
79  << std::endl;
80 }
81 
82 void
83 NotifyConnectionEstablishedEnb (std::string context,
84  uint64_t imsi,
85  uint16_t cellId,
86  uint16_t rnti)
87 {
88 
89  std::cout << Simulator::Now ().As (Time::S) << " " << context
90  << " eNB cell id " << cellId
91  << ": successful connection of UE with IMSI " << imsi
92  << " RNTI " << rnti
93  << std::endl;
94  //In this example, a UE should experience RLF at least one time in
95  //cell 1. For the case, when there is only one eNB with ideal RRC,
96  //a UE might reconnects to the eNB multiple times due to more than
97  //one RLF. To handle this, we reset the counter here so, even if the UE
98  //connects multiple time to cell 1 we count N310
99  //indication correctly, i.e., for each RLF UE RRC should receive
100  //configured number of N310 indications.
101  if (cellId == 1)
102  {
104  }
105 }
106 
108 static const std::string g_ueRrcStateName[LteUeRrc::NUM_STATES] =
109 {
110  "IDLE_START",
111  "IDLE_CELL_SEARCH",
112  "IDLE_WAIT_MIB_SIB1",
113  "IDLE_WAIT_MIB",
114  "IDLE_WAIT_SIB1",
115  "IDLE_CAMPED_NORMALLY",
116  "IDLE_WAIT_SIB2",
117  "IDLE_RANDOM_ACCESS",
118  "IDLE_CONNECTING",
119  "CONNECTED_NORMALLY",
120  "CONNECTED_HANDOVER",
121  "CONNECTED_PHY_PROBLEM",
122  "CONNECTED_REESTABLISHING"
123 };
124 
129 static const std::string & ToString (LteUeRrc::State s)
130 {
131  return g_ueRrcStateName[s];
132 }
133 
134 void
135 UeStateTransition (uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState)
136 {
137 
138  std::cout << Simulator::Now ().As (Time::S)
139  << " UE with IMSI " << imsi << " RNTI " << rnti
140  << " connected to cell " << cellId << " transitions from "
141  << ToString (oldState) << " to " << ToString (newState)
142  << std::endl;
143 }
144 
145 void
146 EnbRrcTimeout (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause)
147 {
148 
149  std::cout << Simulator::Now ().As (Time::S)
150  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
151  << ", ENB RRC " << cause << std::endl;
152 }
153 
154 void
155 NotifyConnectionReleaseAtEnodeB (uint64_t imsi, uint16_t cellId, uint16_t rnti)
156 {
157  std::cout << Simulator::Now ()
158  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
159  << ", UE context destroyed at eNodeB" << std::endl;
160 }
161 
162 void PhySyncDetection (uint16_t n310, uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint8_t count)
163 {
164 
165  std::cout << Simulator::Now ().As (Time::S)
166  << " IMSI " << imsi << ", RNTI " << rnti
167  << ", Cell id " << cellId << ", " << type << ", no of sync indications: " << +count
168  << std::endl;
169 
170  if (type == "Notify out of sync" && cellId == 1)
171  {
173  if (counterN310FirsteNB == n310)
174  {
176  }
177  NS_LOG_DEBUG ("counterN310FirsteNB = " << counterN310FirsteNB);
178  }
179 }
180 
181 void RadioLinkFailure (Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti)
182 {
183  std::cout << Simulator::Now ()
184  << " IMSI " << imsi << ", RNTI " << rnti
185  << ", Cell id " << cellId << ", radio link failure detected"
186  << std::endl << std::endl;
187 
188  PrintUePosition (imsi);
189 
190  if (cellId == 1)
191  {
192  NS_ABORT_MSG_IF ((Simulator::Now () - t310StartTimeFirstEnb) != t310, "T310 timer expired at wrong time");
193  }
194 }
195 
196 void
197 NotifyRandomAccessErrorUe (uint64_t imsi, uint16_t cellId, uint16_t rnti)
198 {
199  std::cout << Simulator::Now ().As (Time::S)
200  << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
201  << ", UE RRC Random access Failed" << std::endl;
202 }
203 
204 void
205 NotifyConnectionTimeoutUe (uint64_t imsi, uint16_t cellId, uint16_t rnti,
206  uint8_t connEstFailCount)
207 {
208  std::cout << Simulator::Now ().As (Time::S)
209  << " IMSI " << imsi << ", RNTI " << rnti
210  << ", Cell id " << cellId
211  << ", T300 expiration counter " << (uint16_t) connEstFailCount
212  << ", UE RRC Connection timeout" << std::endl;
213 }
214 
215 void
216 NotifyRaResponseTimeoutUe (uint64_t imsi, bool contention,
217  uint8_t preambleTxCounter,
218  uint8_t maxPreambleTxLimit)
219 {
220  std::cout << Simulator::Now ().As (Time::S)
221  << " IMSI " << imsi << ", Contention flag " << contention
222  << ", preamble Tx Counter " << (uint16_t) preambleTxCounter
223  << ", Max Preamble Tx Limit " << (uint16_t) maxPreambleTxLimit
224  << ", UE RA response timeout" << std::endl;
225  NS_FATAL_ERROR ("NotifyRaResponseTimeoutUe");
226 }
227 
228 void
230 {
231  ByteCounter += packet->GetSize ();
232 }
233 
234 void
235 Throughput (bool firstWrite, Time binSize, std::string fileName)
236 {
237  std::ofstream output;
238 
239  if (firstWrite == true)
240  {
241  output.open (fileName.c_str (), std::ofstream::out);
242  firstWrite = false;
243  }
244  else
245  {
246  output.open (fileName.c_str (), std::ofstream::app);
247  }
248 
249  //Instantaneous throughput every 200 ms
250 
251  double throughput = (ByteCounter - oldByteCounter) * 8 / binSize.GetSeconds () / 1024 / 1024;
252  output << Simulator::Now ().As (Time::S) << " " << throughput << std::endl;
254  Simulator::Schedule (binSize, &Throughput, firstWrite, binSize, fileName);
255 }
256 
272 int
273 main (int argc, char *argv[])
274 {
275  // Configurable parameters
276  Time simTime = Seconds (25);
277  uint16_t numberOfEnbs = 1;
278  double interSiteDistance = 1200;
279  uint16_t n311 = 1;
280  uint16_t n310 = 1;
281  Time t310 = Seconds (1);
282  bool useIdealRrc = true;
283  bool enableCtrlErrorModel = true;
284  bool enableDataErrorModel = true;
285  bool enableNsLogs = false;
286 
287  CommandLine cmd (__FILE__);
288  cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)", simTime);
289  cmd.AddValue ("numberOfEnbs", "Number of eNBs", numberOfEnbs);
290  cmd.AddValue ("n311", "Number of in-synch indication", n311);
291  cmd.AddValue ("n310", "Number of out-of-synch indication", n310);
292  cmd.AddValue ("t310", "Timer for detecting the Radio link failure (in seconds)", t310);
293  cmd.AddValue ("interSiteDistance", "Inter-site distance in meter", interSiteDistance);
294  cmd.AddValue ("useIdealRrc", "Use ideal RRC protocol", useIdealRrc);
295  cmd.AddValue ("enableCtrlErrorModel", "Enable control error model", enableCtrlErrorModel);
296  cmd.AddValue ("enableDataErrorModel", "Enable data error model", enableDataErrorModel);
297  cmd.AddValue ("enableNsLogs", "Enable ns-3 logging (debug builds)", enableNsLogs);
298  cmd.Parse (argc, argv);
299 
300  if (enableNsLogs)
301  {
303  LogComponentEnable ("LteUeRrc", logLevel);
304  LogComponentEnable ("LteUeMac", logLevel);
305  LogComponentEnable ("LteUePhy", logLevel);
306 
307  LogComponentEnable ("LteEnbRrc", logLevel);
308  LogComponentEnable ("LteEnbMac", logLevel);
309  LogComponentEnable ("LteEnbPhy", logLevel);
310 
311  LogComponentEnable ("LenaRadioLinkFailure", logLevel);
312  }
313 
314  uint16_t numberOfUes = 1;
315  uint16_t numBearersPerUe = 1;
316  double eNodeB_txPower = 43;
317 
318  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (useIdealRrc));
319  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (enableCtrlErrorModel));
320  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (enableDataErrorModel));
321 
322  Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue (60 * 1024));
323 
324  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
325  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
326  lteHelper->SetEpcHelper (epcHelper);
327 
328  lteHelper->SetPathlossModelType (TypeId::LookupByName ("ns3::LogDistancePropagationLossModel"));
329  lteHelper->SetPathlossModelAttribute ("Exponent", DoubleValue (3.9));
330  lteHelper->SetPathlossModelAttribute ("ReferenceLoss", DoubleValue (38.57)); //ref. loss in dB at 1m for 2.025GHz
331  lteHelper->SetPathlossModelAttribute ("ReferenceDistance", DoubleValue (1));
332 
333  //----power related (equal for all base stations)----
334  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNodeB_txPower));
335  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (23));
336  Config::SetDefault ("ns3::LteUePhy::NoiseFigure", DoubleValue (7));
337  Config::SetDefault ("ns3::LteEnbPhy::NoiseFigure", DoubleValue (2));
338  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
339  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
340  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (true));
341 
342  //----frequency related----
343  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100)); //2120MHz
344  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100)); //1930MHz
345  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (25)); //5MHz
346  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (25)); //5MHz
347 
348  //----others----
349  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
350  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
351  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.01));
352  Config::SetDefault ("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue (true));
353 
354  Config::SetDefault ("ns3::FfMacScheduler::UlCqiFilter", EnumValue (FfMacScheduler::SRS_UL_CQI));
355 
356  //Radio link failure detection parameters
357  Config::SetDefault ("ns3::LteUeRrc::N310", UintegerValue (n310));
358  Config::SetDefault ("ns3::LteUeRrc::N311", UintegerValue (n311));
359  Config::SetDefault ("ns3::LteUeRrc::T310", TimeValue (t310));
360 
361  NS_LOG_INFO ("Create the internet");
362  Ptr<Node> pgw = epcHelper->GetPgwNode ();
363  // Create a single RemoteHost0x18ab460
364  NodeContainer remoteHostContainer;
365  remoteHostContainer.Create (1);
366  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
367  InternetStackHelper internet;
368  internet.Install (remoteHostContainer);
369  PointToPointHelper p2ph;
370  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
371  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
372  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
373  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
374  Ipv4AddressHelper ipv4h;
375  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
376  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
377  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
378  Ipv4StaticRoutingHelper ipv4RoutingHelper;
379  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
380  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
381 
382  NS_LOG_INFO ("Create eNodeB and UE nodes");
383  NodeContainer enbNodes;
384  NodeContainer ueNodes;
385  enbNodes.Create (numberOfEnbs);
386  ueNodes.Create (numberOfUes);
387 
388  NS_LOG_INFO ("Assign mobility");
389  Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator> ();
390 
391  for (uint16_t i = 0; i < numberOfEnbs; i++)
392  {
393  positionAllocEnb->Add (Vector (interSiteDistance * i, 0, 0));
394  }
396  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
397  mobility.SetPositionAllocator (positionAllocEnb);
398  mobility.Install (enbNodes);
399 
400  Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator> ();
401 
402  for (int i = 0; i < numberOfUes; i++)
403  {
404  positionAllocUe->Add (Vector (200, 0, 0));
405  }
406 
407  mobility.SetPositionAllocator (positionAllocUe);
408  mobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
409  mobility.Install (ueNodes);
410 
411  for (int i = 0; i < numberOfUes; i++)
412  {
413  ueNodes.Get (i)->GetObject<ConstantVelocityMobilityModel> ()->SetVelocity (Vector (30, 0.0, 0.0));
414  }
415 
416  NS_LOG_INFO ("Install LTE Devices in eNB and UEs and fix random number stream");
417  NetDeviceContainer enbDevs;
418  NetDeviceContainer ueDevs;
419 
420  int64_t randomStream = 1;
421 
422  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
423  randomStream += lteHelper->AssignStreams (enbDevs, randomStream);
424  ueDevs = lteHelper->InstallUeDevice (ueNodes);
425  randomStream += lteHelper->AssignStreams (ueDevs, randomStream);
426 
427 
428  NS_LOG_INFO ("Install the IP stack on the UEs");
429  internet.Install (ueNodes);
430  Ipv4InterfaceContainer ueIpIfaces;
431  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
432 
433  NS_LOG_INFO ("Attach a UE to a eNB");
434  lteHelper->Attach (ueDevs);
435 
436  NS_LOG_INFO ("Install and start applications on UEs and remote host");
437  uint16_t dlPort = 10000;
438  uint16_t ulPort = 20000;
439 
440  DataRateValue dataRateValue = DataRate ("18.6Mbps");
441 
442  uint64_t bitRate = dataRateValue.Get ().GetBitRate ();
443 
444  uint32_t packetSize = 1024; //bytes
445 
446  NS_LOG_DEBUG ("bit rate " << bitRate);
447 
448  double interPacketInterval = static_cast<double> (packetSize * 8) / bitRate;
449 
450  Time udpInterval = Seconds (interPacketInterval);
451 
452  NS_LOG_DEBUG ("UDP will use application interval " << udpInterval.As (Time::S) << " sec");
453 
454 
455  for (uint32_t u = 0; u < numberOfUes; ++u)
456  {
457  Ptr<Node> ue = ueNodes.Get (u);
458  // Set the default gateway for the UE
459  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
460  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
461 
462  for (uint32_t b = 0; b < numBearersPerUe; ++b)
463  {
464  ApplicationContainer ulClientApps;
465  ApplicationContainer ulServerApps;
466  ApplicationContainer dlClientApps;
467  ApplicationContainer dlServerApps;
468 
469  ++dlPort;
470  ++ulPort;
471 
472  NS_LOG_LOGIC ("installing UDP DL app for UE " << u + 1);
473  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
474  dlClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
475  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
476  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
477  dlClientApps.Add (dlClientHelper.Install (remoteHost));
478 
479  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
480  dlServerApps.Add (dlPacketSinkHelper.Install (ue));
481 
482  NS_LOG_LOGIC ("installing UDP UL app for UE " << u + 1);
483  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
484  ulClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
485  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
486  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
487  ulClientApps.Add (ulClientHelper.Install (ue));
488 
489  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
490  ulServerApps.Add (ulPacketSinkHelper.Install (remoteHost));
491 
492  Ptr<EpcTft> tft = Create<EpcTft> ();
494  dlpf.localPortStart = dlPort;
495  dlpf.localPortEnd = dlPort;
496  tft->Add (dlpf);
498  ulpf.remotePortStart = ulPort;
499  ulpf.remotePortEnd = ulPort;
500  tft->Add (ulpf);
502  lteHelper->ActivateDedicatedEpsBearer (ueDevs.Get (u), bearer, tft);
503 
504  dlServerApps.Start (Seconds (0.27));
505  dlClientApps.Start (Seconds (0.27));
506  ulServerApps.Start (Seconds (0.27));
507  ulClientApps.Start (Seconds (0.27));
508  } // end for b
509  }
510  NS_LOG_INFO ("Enable Lte traces and connect custom trace sinks");
511 
512  lteHelper->EnableTraces ();
513  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
514  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
515  Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats ();
516  pdcpStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
517 
518  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
520  Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
522  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
524  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
526  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
528  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
530  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
532  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
534  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
536  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/$ns3::LteUeNetDevice/ComponentCarrierMapUe/*/LteUeMac/RaResponseTimeout",
538 
539  //Trace sink for the packet sink of UE
540  std::ostringstream oss;
541  oss << "/NodeList/" << ueNodes.Get (0)->GetId () << "/ApplicationList/0/$ns3::PacketSink/Rx";
543 
544  bool firstWrite = true;
545  std::string rrcType = useIdealRrc == 1 ? "ideal_rrc" : "real_rrc";
546  std::string fileName = "rlf_dl_thrput_" + std::to_string (enbNodes.GetN ()) + "_eNB_" + rrcType;
547  Time binSize = Seconds (0.2);
548  Simulator::Schedule (Seconds (0.47), &Throughput, firstWrite, binSize, fileName);
549 
550  NS_LOG_INFO ("Starting simulation...");
551 
552  Simulator::Stop (simTime);
553 
554  Simulator::Run ();
555 
556  NS_ABORT_MSG_IF (counterN310FirsteNB != n310, "UE RRC should receive "
557  << n310 << " out-of-sync indications in Cell 1."
558  " Total received = " << counterN310FirsteNB);
559 
561 
562  return 0;
563 }
holds a vector of ns3::Application pointers.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
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:103
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:120
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:109
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:269
static const uint32_t packetSize
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:144
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
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:205
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:281
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
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:1444
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
static Vector GetPosition(Ptr< Node > node)
Definition: wifi-ap.cc:96
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:241
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:108
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:361
Hold variables of type enum.
Definition: enum.h:54
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:1353
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:1427
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
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:899
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:227
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:918
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
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:470
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:119
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:195
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:1573
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1587
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:41
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:229
static Iterator Begin(void)
Definition: node-list.cc:229
Prefix all trace prints with function.
Definition: log.h:118
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
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:116
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.
second
Definition: nstime.h:115
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:100
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:260
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
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:152
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:830
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.