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 }
226 
227 void
229 {
230  ByteCounter += packet->GetSize ();
231 }
232 
233 void
234 Throughput (bool firstWrite, Time binSize, std::string fileName)
235 {
236  std::ofstream output;
237 
238  if (firstWrite == true)
239  {
240  output.open (fileName.c_str (), std::ofstream::out);
241  firstWrite = false;
242  }
243  else
244  {
245  output.open (fileName.c_str (), std::ofstream::app);
246  }
247 
248  //Instantaneous throughput every 200 ms
249 
250  double throughput = (ByteCounter - oldByteCounter) * 8 / binSize.GetSeconds () / 1024 / 1024;
251  output << Simulator::Now ().As (Time::S) << " " << throughput << std::endl;
253  Simulator::Schedule (binSize, &Throughput, firstWrite, binSize, fileName);
254 }
255 
271 int
272 main (int argc, char *argv[])
273 {
274  // Configurable parameters
275  Time simTime = Seconds (25);
276  uint16_t numberOfEnbs = 1;
277  double interSiteDistance = 1200;
278  uint16_t n311 = 1;
279  uint16_t n310 = 1;
280  Time t310 = Seconds (1);
281  bool useIdealRrc = true;
282  bool enableCtrlErrorModel = true;
283  bool enableDataErrorModel = true;
284  bool enableNsLogs = false;
285 
286  CommandLine cmd (__FILE__);
287  cmd.AddValue ("simTime", "Total duration of the simulation (in seconds)", simTime);
288  cmd.AddValue ("numberOfEnbs", "Number of eNBs", numberOfEnbs);
289  cmd.AddValue ("n311", "Number of in-synch indication", n311);
290  cmd.AddValue ("n310", "Number of out-of-synch indication", n310);
291  cmd.AddValue ("t310", "Timer for detecting the Radio link failure (in seconds)", t310);
292  cmd.AddValue ("interSiteDistance", "Inter-site distance in meter", interSiteDistance);
293  cmd.AddValue ("useIdealRrc", "Use ideal RRC protocol", useIdealRrc);
294  cmd.AddValue ("enableCtrlErrorModel", "Enable control error model", enableCtrlErrorModel);
295  cmd.AddValue ("enableDataErrorModel", "Enable data error model", enableDataErrorModel);
296  cmd.AddValue ("enableNsLogs", "Enable ns-3 logging (debug builds)", enableNsLogs);
297  cmd.Parse (argc, argv);
298 
299  if (enableNsLogs)
300  {
302  LogComponentEnable ("LteUeRrc", logLevel);
303  LogComponentEnable ("LteUeMac", logLevel);
304  LogComponentEnable ("LteUePhy", logLevel);
305 
306  LogComponentEnable ("LteEnbRrc", logLevel);
307  LogComponentEnable ("LteEnbMac", logLevel);
308  LogComponentEnable ("LteEnbPhy", logLevel);
309 
310  LogComponentEnable ("LenaRadioLinkFailure", logLevel);
311  }
312 
313  uint16_t numberOfUes = 1;
314  uint16_t numBearersPerUe = 1;
315  double eNodeB_txPower = 43;
316 
317  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (useIdealRrc));
318  Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (enableCtrlErrorModel));
319  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (enableDataErrorModel));
320 
321  Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue (60 * 1024));
322 
323  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
324  Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
325  lteHelper->SetEpcHelper (epcHelper);
326 
327  lteHelper->SetPathlossModelType (TypeId::LookupByName ("ns3::LogDistancePropagationLossModel"));
328  lteHelper->SetPathlossModelAttribute ("Exponent", DoubleValue (3.9));
329  lteHelper->SetPathlossModelAttribute ("ReferenceLoss", DoubleValue (38.57)); //ref. loss in dB at 1m for 2.025GHz
330  lteHelper->SetPathlossModelAttribute ("ReferenceDistance", DoubleValue (1));
331 
332  //----power related (equal for all base stations)----
333  Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNodeB_txPower));
334  Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (23));
335  Config::SetDefault ("ns3::LteUePhy::NoiseFigure", DoubleValue (7));
336  Config::SetDefault ("ns3::LteEnbPhy::NoiseFigure", DoubleValue (2));
337  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
338  Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
339  Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (true));
340 
341  //----frequency related----
342  lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100)); //2120MHz
343  lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100)); //1930MHz
344  lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (25)); //5MHz
345  lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (25)); //5MHz
346 
347  //----others----
348  lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
349  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
350  Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.01));
351  Config::SetDefault ("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue (true));
352 
353  Config::SetDefault ("ns3::FfMacScheduler::UlCqiFilter", EnumValue (FfMacScheduler::SRS_UL_CQI));
354 
355  //Radio link failure detection parameters
356  Config::SetDefault ("ns3::LteUeRrc::N310", UintegerValue (n310));
357  Config::SetDefault ("ns3::LteUeRrc::N311", UintegerValue (n311));
358  Config::SetDefault ("ns3::LteUeRrc::T310", TimeValue (t310));
359 
360  NS_LOG_INFO ("Create the internet");
361  Ptr<Node> pgw = epcHelper->GetPgwNode ();
362  // Create a single RemoteHost0x18ab460
363  NodeContainer remoteHostContainer;
364  remoteHostContainer.Create (1);
365  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
366  InternetStackHelper internet;
367  internet.Install (remoteHostContainer);
368  PointToPointHelper p2ph;
369  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
370  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
371  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
372  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
373  Ipv4AddressHelper ipv4h;
374  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
375  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
376  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
377  Ipv4StaticRoutingHelper ipv4RoutingHelper;
378  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
379  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
380 
381  NS_LOG_INFO ("Create eNodeB and UE nodes");
382  NodeContainer enbNodes;
383  NodeContainer ueNodes;
384  enbNodes.Create (numberOfEnbs);
385  ueNodes.Create (numberOfUes);
386 
387  NS_LOG_INFO ("Assign mobility");
388  Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator> ();
389 
390  for (uint16_t i = 0; i < numberOfEnbs; i++)
391  {
392  positionAllocEnb->Add (Vector (interSiteDistance * i, 0, 0));
393  }
395  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
396  mobility.SetPositionAllocator (positionAllocEnb);
397  mobility.Install (enbNodes);
398 
399  Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator> ();
400 
401  for (int i = 0; i < numberOfUes; i++)
402  {
403  positionAllocUe->Add (Vector (200, 0, 0));
404  }
405 
406  mobility.SetPositionAllocator (positionAllocUe);
407  mobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
408  mobility.Install (ueNodes);
409 
410  for (int i = 0; i < numberOfUes; i++)
411  {
412  ueNodes.Get (i)->GetObject<ConstantVelocityMobilityModel> ()->SetVelocity (Vector (30, 0.0, 0.0));
413  }
414 
415  NS_LOG_INFO ("Install LTE Devices in eNB and UEs and fix random number stream");
416  NetDeviceContainer enbDevs;
417  NetDeviceContainer ueDevs;
418 
419  int64_t randomStream = 1;
420 
421  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
422  randomStream += lteHelper->AssignStreams (enbDevs, randomStream);
423  ueDevs = lteHelper->InstallUeDevice (ueNodes);
424  randomStream += lteHelper->AssignStreams (ueDevs, randomStream);
425 
426 
427  NS_LOG_INFO ("Install the IP stack on the UEs");
428  internet.Install (ueNodes);
429  Ipv4InterfaceContainer ueIpIfaces;
430  ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
431 
432  NS_LOG_INFO ("Attach a UE to a eNB");
433  lteHelper->Attach (ueDevs);
434 
435  NS_LOG_INFO ("Install and start applications on UEs and remote host");
436  uint16_t dlPort = 10000;
437  uint16_t ulPort = 20000;
438 
439  DataRateValue dataRateValue = DataRate ("18.6Mbps");
440 
441  uint64_t bitRate = dataRateValue.Get ().GetBitRate ();
442 
443  uint32_t packetSize = 1024; //bytes
444 
445  NS_LOG_DEBUG ("bit rate " << bitRate);
446 
447  double interPacketInterval = static_cast<double> (packetSize * 8) / bitRate;
448 
449  Time udpInterval = Seconds (interPacketInterval);
450 
451  NS_LOG_DEBUG ("UDP will use application interval " << udpInterval.As (Time::S) << " sec");
452 
453 
454  for (uint32_t u = 0; u < numberOfUes; ++u)
455  {
456  Ptr<Node> ue = ueNodes.Get (u);
457  // Set the default gateway for the UE
458  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
459  ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
460 
461  for (uint32_t b = 0; b < numBearersPerUe; ++b)
462  {
463  ApplicationContainer ulClientApps;
464  ApplicationContainer ulServerApps;
465  ApplicationContainer dlClientApps;
466  ApplicationContainer dlServerApps;
467 
468  ++dlPort;
469  ++ulPort;
470 
471  NS_LOG_LOGIC ("installing UDP DL app for UE " << u + 1);
472  UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
473  dlClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
474  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
475  dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
476  dlClientApps.Add (dlClientHelper.Install (remoteHost));
477 
478  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
479  dlServerApps.Add (dlPacketSinkHelper.Install (ue));
480 
481  NS_LOG_LOGIC ("installing UDP UL app for UE " << u + 1);
482  UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
483  ulClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
484  dlClientHelper.SetAttribute ("PacketSize", UintegerValue (packetSize));
485  ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
486  ulClientApps.Add (ulClientHelper.Install (ue));
487 
488  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
489  ulServerApps.Add (ulPacketSinkHelper.Install (remoteHost));
490 
491  Ptr<EpcTft> tft = Create<EpcTft> ();
493  dlpf.localPortStart = dlPort;
494  dlpf.localPortEnd = dlPort;
495  tft->Add (dlpf);
497  ulpf.remotePortStart = ulPort;
498  ulpf.remotePortEnd = ulPort;
499  tft->Add (ulpf);
501  lteHelper->ActivateDedicatedEpsBearer (ueDevs.Get (u), bearer, tft);
502 
503  dlServerApps.Start (Seconds (0.27));
504  dlClientApps.Start (Seconds (0.27));
505  ulServerApps.Start (Seconds (0.27));
506  ulClientApps.Start (Seconds (0.27));
507  } // end for b
508  }
509  NS_LOG_INFO ("Enable Lte traces and connect custom trace sinks");
510 
511  lteHelper->EnableTraces ();
512  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
513  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
514  Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats ();
515  pdcpStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.05)));
516 
517  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
519  Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
521  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
523  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
525  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
527  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
529  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
531  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
533  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
535  Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/$ns3::LteUeNetDevice/ComponentCarrierMapUe/*/LteUeMac/RaResponseTimeout",
537 
538  //Trace sink for the packet sink of UE
539  std::ostringstream oss;
540  oss << "/NodeList/" << ueNodes.Get (0)->GetId () << "/ApplicationList/0/$ns3::PacketSink/Rx";
542 
543  bool firstWrite = true;
544  std::string rrcType = useIdealRrc == 1 ? "ideal_rrc" : "real_rrc";
545  std::string fileName = "rlf_dl_thrput_" + std::to_string (enbNodes.GetN ()) + "_eNB_" + rrcType;
546  Time binSize = Seconds (0.2);
547  Simulator::Schedule (Seconds (0.47), &Throughput, firstWrite, binSize, fileName);
548 
549  NS_LOG_INFO ("Starting simulation...");
550 
551  Simulator::Stop (simTime);
552 
553  Simulator::Run ();
554 
555  NS_ABORT_MSG_IF (counterN310FirsteNB != n310, "UE RRC should receive "
556  << n310 << " out-of-sync indications in Cell 1."
557  " Total received = " << counterN310FirsteNB);
558 
560 
561  return 0;
562 }
a polymophic address class
Definition: address.h:91
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Parse command-line arguments.
Definition: command-line.h:229
Mobility model for which the current speed does not change once it has been set and until it is set a...
Class for representing data rates.
Definition: data-rate.h:89
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:287
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
DataRate Get(void) const
Definition: data-rate.cc:30
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
Hold variables of type enum.
Definition: enum.h:55
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
@ NGBR_IMS
Non-GBR IMS Signalling.
Definition: eps-bearer.h:116
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
static Ipv4Address GetAny(void)
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
Helper class that adds ns3::Ipv4StaticRouting objects.
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...
@ PiroEW2010
Definition: lte-amc.h:63
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1586
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
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
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
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
Definition: lte-helper.cc:1572
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:279
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:959
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:393
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:400
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
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 EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1426
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:1068
The LteUeNetDevice class implements the UE net device.
State
The states of the UE RRC entity.
Definition: lte-ue-rrc.h:106
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual Ptr< Node > GetPgwNode() const
Get the PGW node.
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
keep track of a set of node pointers.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t GetId(void) const
Definition: node.cc:109
uint32_t GetNDevices(void) const
Definition: node.cc:152
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:144
static Iterator End(void)
Definition: node-list.cc:235
static Iterator Begin(void)
Definition: node-list.cc:229
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
@ S
second
Definition: nstime.h:114
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:418
AttributeValue implementation for Time.
Definition: nstime.h:1308
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:829
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Hold an unsigned integer type.
Definition: uinteger.h:44
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:901
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:329
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.h:25255
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:50
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
LogLevel
Logging severity classes and levels.
Definition: log.h:94
@ LOG_LEVEL_ALL
Print everything.
Definition: log.h:116
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition: log.h:118
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition: log.h:119
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition: log.h:120
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
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:1648
cmd
Definition: second.py:35
mobility
Definition: third.py:108
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:75
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:140
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
static Vector GetPosition(Ptr< Node > node)
Definition: wifi-ap.cc:96
static const uint32_t packetSize