A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lena-radio-link-failure.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Fraunhofer ESK
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Vignesh Babu <ns3-dev@esk.fraunhofer.de>
7 */
8
9#include "ns3/applications-module.h"
10#include "ns3/core-module.h"
11#include "ns3/internet-module.h"
12#include "ns3/lte-module.h"
13#include "ns3/mobility-module.h"
14#include "ns3/network-module.h"
15#include "ns3/point-to-point-module.h"
16
17#include <iomanip>
18#include <iostream>
19#include <stdio.h>
20#include <vector>
21
22using namespace ns3;
23
24NS_LOG_COMPONENT_DEFINE("LenaRadioLinkFailure");
25
26// Global values to check the simulation
27// behavior during and after the simulation.
28uint16_t counterN310FirsteNB = 0; //!< Counter of N310 indications.
29Time t310StartTimeFirstEnb; //!< Time of first N310 indication.
30uint32_t ByteCounter = 0; //!< Byte counter.
31uint32_t oldByteCounter = 0; //!< Old Byte counter,
32
33/**
34 * Print the position of a UE with given IMSI.
35 *
36 * @param imsi The IMSI.
37 */
38void
39PrintUePosition(uint64_t imsi)
40{
41 for (auto it = NodeList::Begin(); it != NodeList::End(); ++it)
42 {
43 Ptr<Node> node = *it;
44 int nDevs = node->GetNDevices();
45 for (int j = 0; j < nDevs; j++)
46 {
47 Ptr<LteUeNetDevice> uedev = node->GetDevice(j)->GetObject<LteUeNetDevice>();
48 if (uedev)
49 {
50 if (imsi == uedev->GetImsi())
51 {
52 Vector pos = node->GetObject<MobilityModel>()->GetPosition();
53 std::cout << "IMSI : " << uedev->GetImsi() << " at " << pos.x << "," << pos.y
54 << std::endl;
55 }
56 }
57 }
58 }
59}
60
61/**
62 * UE Notify connection established.
63 *
64 * @param context The context.
65 * @param imsi The IMSI.
66 * @param cellid The Cell ID.
67 * @param rnti The RNTI.
68 */
69void
70NotifyConnectionEstablishedUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
71{
72 std::cout << Simulator::Now().As(Time::S) << " " << context << " UE IMSI " << imsi
73 << ": connected to cell id " << cellid << " with RNTI " << rnti << std::endl;
74}
75
76/**
77 * eNB Notify connection established.
78 *
79 * @param context The context.
80 * @param imsi The IMSI.
81 * @param cellId The Cell ID.
82 * @param rnti The RNTI.
83 */
84void
85NotifyConnectionEstablishedEnb(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
86{
87 std::cout << Simulator::Now().As(Time::S) << " " << context << " eNB cell id " << cellId
88 << ": successful connection of UE with IMSI " << imsi << " RNTI " << rnti
89 << std::endl;
90 // In this example, a UE should experience RLF at least one time in
91 // cell 1. For the case, when there is only one eNB with ideal RRC,
92 // a UE might reconnects to the eNB multiple times due to more than
93 // one RLF. To handle this, we reset the counter here so, even if the UE
94 // connects multiple time to cell 1 we count N310
95 // indication correctly, i.e., for each RLF UE RRC should receive
96 // configured number of N310 indications.
97 if (cellId == 1)
98 {
100 }
101}
102
103/**
104 * UE state transition tracer.
105 *
106 * @param imsi The IMSI.
107 * @param cellId The Cell ID.
108 * @param rnti The RNTI.
109 * @param oldState The old state.
110 * @param newState The new state.
111 */
112void
113UeStateTransition(uint64_t imsi,
114 uint16_t cellId,
115 uint16_t rnti,
116 LteUeRrc::State oldState,
117 LteUeRrc::State newState)
118{
119 std::cout << Simulator::Now().As(Time::S) << " UE with IMSI " << imsi << " RNTI " << rnti
120 << " connected to cell " << cellId << " transitions from " << oldState << " to "
121 << newState << std::endl;
122}
123
124/**
125 * eNB RRC timeout tracer.
126 *
127 * @param imsi The IMSI.
128 * @param rnti The RNTI.
129 * @param cellId The Cell ID.
130 * @param cause The reason for timeout.
131 */
132void
133EnbRrcTimeout(uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause)
134{
135 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
136 << ", Cell id " << cellId << ", ENB RRC " << cause << std::endl;
137}
138
139/**
140 * Notification of connection release at eNB.
141 *
142 * @param imsi The IMSI.
143 * @param cellId The Cell ID.
144 * @param rnti The RNTI.
145 */
146void
147NotifyConnectionReleaseAtEnodeB(uint64_t imsi, uint16_t cellId, uint16_t rnti)
148{
149 std::cout << Simulator::Now() << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
150 << ", UE context destroyed at eNodeB" << std::endl;
151}
152
153/**
154 * PHY sync detection tracer.
155 *
156 * @param n310 310 data.
157 * @param imsi The IMSI.
158 * @param rnti The RNTI.
159 * @param cellId The Cell ID.
160 * @param type The type.
161 * @param count The count.
162 */
163void
164PhySyncDetection(uint16_t n310,
165 uint64_t imsi,
166 uint16_t rnti,
167 uint16_t cellId,
168 std::string type,
169 uint8_t count)
170{
171 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
172 << ", Cell id " << cellId << ", " << type << ", no of sync indications: " << +count
173 << std::endl;
174
175 if (type == "Notify out of sync" && cellId == 1)
176 {
178 if (counterN310FirsteNB == n310)
179 {
181 }
182 NS_LOG_DEBUG("counterN310FirsteNB = " << counterN310FirsteNB);
183 }
184}
185
186/**
187 * Radio link failure tracer.
188 *
189 * @param t310 310 data.
190 * @param imsi The IMSI.
191 * @param cellId The Cell ID.
192 * @param rnti The RNTI.
193 */
194void
195RadioLinkFailure(Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti)
196{
197 std::cout << Simulator::Now() << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
198 << ", radio link failure detected" << std::endl
199 << std::endl;
200
201 PrintUePosition(imsi);
202
203 if (cellId == 1)
204 {
206 "T310 timer expired at wrong time");
207 }
208}
209
210/**
211 * UE Random access error notification.
212 *
213 * @param imsi The IMSI.
214 * @param cellId The Cell ID.
215 * @param rnti The RNTI.
216 */
217void
218NotifyRandomAccessErrorUe(uint64_t imsi, uint16_t cellId, uint16_t rnti)
219{
220 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
221 << ", Cell id " << cellId << ", UE RRC Random access Failed" << std::endl;
222}
223
224/**
225 * UE Connection timeout notification.
226 *
227 * @param imsi The IMSI.
228 * @param cellId The Cell ID.
229 * @param rnti The RNTI.
230 * @param connEstFailCount Connection failure count.
231 */
232void
233NotifyConnectionTimeoutUe(uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount)
234{
235 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
236 << ", Cell id " << cellId << ", T300 expiration counter "
237 << (uint16_t)connEstFailCount << ", UE RRC Connection timeout" << std::endl;
238}
239
240/**
241 * UE RA response timeout notification.
242 *
243 * @param imsi The IMSI.
244 * @param contention Contention flag.
245 * @param preambleTxCounter Preamble Tx counter.
246 * @param maxPreambleTxLimit Max preamble Ts limit.
247 */
248void
250 bool contention,
251 uint8_t preambleTxCounter,
252 uint8_t maxPreambleTxLimit)
253{
254 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", Contention flag "
255 << contention << ", preamble Tx Counter " << (uint16_t)preambleTxCounter
256 << ", Max Preamble Tx Limit " << (uint16_t)maxPreambleTxLimit
257 << ", UE RA response timeout" << std::endl;
258}
259
260/**
261 * Receive a packet.
262 *
263 * @param packet The packet.
264 */
265void
267{
268 ByteCounter += packet->GetSize();
269}
270
271/**
272 * Write the throughput to file.
273 *
274 * @param firstWrite True if first time writing.
275 * @param binSize Bin size.
276 * @param fileName Output filename.
277 */
278void
279Throughput(bool firstWrite, Time binSize, std::string fileName)
280{
281 std::ofstream output;
282
283 if (firstWrite)
284 {
285 output.open(fileName, std::ofstream::out);
286 firstWrite = false;
287 }
288 else
289 {
290 output.open(fileName, std::ofstream::app);
291 }
292
293 // Instantaneous throughput every 200 ms
294
295 double throughput = (ByteCounter - oldByteCounter) * 8 / binSize.GetSeconds() / 1024 / 1024;
296 output << Simulator::Now().As(Time::S) << " " << throughput << std::endl;
298 Simulator::Schedule(binSize, &Throughput, firstWrite, binSize, fileName);
299}
300
301/**
302 * Sample simulation script for radio link failure.
303 * By default, only one eNodeB and one UE is considered for verifying
304 * radio link failure. The UE is initially in the coverage of
305 * eNodeB and a RRC connection gets established.
306 * As the UE moves away from the eNodeB, the signal degrades
307 * and out-of-sync indications are counted. When the T310 timer
308 * expires, radio link is considered to have failed and UE
309 * leaves the CONNECTED_NORMALLY state and performs cell
310 * selection again.
311 *
312 * The example can be run as follows:
313 *
314 * ./ns3 run "lena-radio-link-failure --numberOfEnbs=1 --simTime=25"
315 */
316int
317main(int argc, char* argv[])
318{
319 // Configurable parameters
320 Time simTime = Seconds(25);
321 uint16_t numberOfEnbs = 1;
322 double interSiteDistance = 1200;
323 uint16_t n311 = 1;
324 uint16_t n310 = 1;
325 Time t310 = Seconds(1);
326 bool useIdealRrc = true;
327 bool enableCtrlErrorModel = true;
328 bool enableDataErrorModel = true;
329 bool enableNsLogs = false;
330
331 CommandLine cmd(__FILE__);
332 cmd.AddValue("simTime", "Total duration of the simulation (in seconds)", simTime);
333 cmd.AddValue("numberOfEnbs", "Number of eNBs", numberOfEnbs);
334 cmd.AddValue("n311", "Number of in-synch indication", n311);
335 cmd.AddValue("n310", "Number of out-of-synch indication", n310);
336 cmd.AddValue("t310", "Timer for detecting the Radio link failure (in seconds)", t310);
337 cmd.AddValue("interSiteDistance", "Inter-site distance in meter", interSiteDistance);
338 cmd.AddValue("useIdealRrc", "Use ideal RRC protocol", useIdealRrc);
339 cmd.AddValue("enableCtrlErrorModel", "Enable control error model", enableCtrlErrorModel);
340 cmd.AddValue("enableDataErrorModel", "Enable data error model", enableDataErrorModel);
341 cmd.AddValue("enableNsLogs", "Enable ns-3 logging (debug builds)", enableNsLogs);
342 cmd.Parse(argc, argv);
343
344 if (enableNsLogs)
345 {
346 auto logLevel =
348 LogComponentEnable("LteUeRrc", logLevel);
349 LogComponentEnable("LteUeMac", logLevel);
350 LogComponentEnable("LteUePhy", logLevel);
351
352 LogComponentEnable("LteEnbRrc", logLevel);
353 LogComponentEnable("LteEnbMac", logLevel);
354 LogComponentEnable("LteEnbPhy", logLevel);
355
356 LogComponentEnable("LenaRadioLinkFailure", logLevel);
357 }
358
359 uint16_t numberOfUes = 1;
360 uint16_t numBearersPerUe = 1;
361 double eNodeB_txPower = 43;
362
363 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(useIdealRrc));
364 Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled",
365 BooleanValue(enableCtrlErrorModel));
366 Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled",
367 BooleanValue(enableDataErrorModel));
368
369 Config::SetDefault("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(60 * 1024));
370
373 lteHelper->SetEpcHelper(epcHelper);
374
375 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
376 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
377 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
378 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
379 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
380
381 //----power related (equal for all base stations)----
382 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
383 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
384 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
385 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
386 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
387 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
388 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
389
390 //----frequency related----
391 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
392 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
393 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
394 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
395
396 //----others----
397 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
398 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
399 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
400 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
401
402 Config::SetDefault("ns3::FfMacScheduler::UlCqiFilter", EnumValue(FfMacScheduler::SRS_UL_CQI));
403
404 // Radio link failure detection parameters
405 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(n310));
406 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(n311));
407 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(t310));
408
409 NS_LOG_INFO("Create the internet");
410 Ptr<Node> pgw = epcHelper->GetPgwNode();
411 // Create a single RemoteHost0x18ab460
412 NodeContainer remoteHostContainer;
413 remoteHostContainer.Create(1);
414 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
416 internet.Install(remoteHostContainer);
418 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
419 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
420 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
421 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
422 Ipv4AddressHelper ipv4h;
423 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
424 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
425 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
426 Ipv4StaticRoutingHelper ipv4RoutingHelper;
427 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
428 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
429 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
430
431 NS_LOG_INFO("Create eNodeB and UE nodes");
432 NodeContainer enbNodes;
433 NodeContainer ueNodes;
434 enbNodes.Create(numberOfEnbs);
435 ueNodes.Create(numberOfUes);
436
437 NS_LOG_INFO("Assign mobility");
439
440 for (uint16_t i = 0; i < numberOfEnbs; i++)
441 {
442 positionAllocEnb->Add(Vector(interSiteDistance * i, 0, 0));
443 }
445 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
446 mobility.SetPositionAllocator(positionAllocEnb);
447 mobility.Install(enbNodes);
448
450
451 for (int i = 0; i < numberOfUes; i++)
452 {
453 positionAllocUe->Add(Vector(200, 0, 0));
454 }
455
456 mobility.SetPositionAllocator(positionAllocUe);
457 mobility.SetMobilityModel("ns3::ConstantVelocityMobilityModel");
458 mobility.Install(ueNodes);
459
460 for (int i = 0; i < numberOfUes; i++)
461 {
462 ueNodes.Get(i)->GetObject<ConstantVelocityMobilityModel>()->SetVelocity(
463 Vector(30, 0.0, 0.0));
464 }
465
466 NS_LOG_INFO("Install LTE Devices in eNB and UEs and fix random number stream");
467 NetDeviceContainer enbDevs;
468 NetDeviceContainer ueDevs;
469
470 int64_t randomStream = 1;
471
472 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
473 // Call AssignStreams in the EpcHelper only once by setting 'assignEpcStreams' only once
474 // Then, increment the stream value by 1000 (a magic number that should ensure that there
475 // are no overlapping stream assignments) each time that AssignStreams is called,
476 // to lessen the possibility that random variable stream assignment changes propagate
477 // to other objects.
478 lteHelper->AssignStreams(enbDevs, randomStream, false);
479 randomStream += 1000;
480 ueDevs = lteHelper->InstallUeDevice(ueNodes);
481 lteHelper->AssignStreams(ueDevs, randomStream, true);
482 randomStream += 1000;
483
484 NS_LOG_INFO("Install the IP stack on the UEs");
485 internet.Install(ueNodes);
486 Ipv4InterfaceContainer ueIpIfaces;
487 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
488
489 NS_LOG_INFO("Attach a UE to a eNB");
490 lteHelper->Attach(ueDevs);
491
492 NS_LOG_INFO("Install and start applications on UEs and remote host");
493 uint16_t dlPort = 10000;
494 uint16_t ulPort = 20000;
495
496 DataRateValue dataRateValue = DataRate("18.6Mbps");
497
498 uint64_t bitRate = dataRateValue.Get().GetBitRate();
499
500 uint32_t packetSize = 1024; // bytes
501
502 NS_LOG_DEBUG("bit rate " << bitRate);
503
504 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
505
506 Time udpInterval = Seconds(interPacketInterval);
507
508 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S) << " sec");
509
510 for (uint32_t u = 0; u < numberOfUes; ++u)
511 {
512 Ptr<Node> ue = ueNodes.Get(u);
513 // Set the default gateway for the UE
514 Ptr<Ipv4StaticRouting> ueStaticRouting =
515 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
516 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
517
518 for (uint32_t b = 0; b < numBearersPerUe; ++b)
519 {
520 ApplicationContainer ulClientApps;
521 ApplicationContainer ulServerApps;
522 ApplicationContainer dlClientApps;
523 ApplicationContainer dlServerApps;
524
525 ++dlPort;
526 ++ulPort;
527
528 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
529 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
530 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
531 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
532 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
533 dlClientApps.Add(dlClientHelper.Install(remoteHost));
534
535 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
537 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
538
539 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
540 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
541 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
542 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
543 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
544 ulClientApps.Add(ulClientHelper.Install(ue));
545
546 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
548 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
549
552 dlpf.localPortStart = dlPort;
553 dlpf.localPortEnd = dlPort;
554 tft->Add(dlpf);
556 ulpf.remotePortStart = ulPort;
557 ulpf.remotePortEnd = ulPort;
558 tft->Add(ulpf);
560 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
561
562 dlServerApps.Start(Seconds(0.27));
563 dlClientApps.Start(Seconds(0.27));
564 ulServerApps.Start(Seconds(0.27));
565 ulClientApps.Start(Seconds(0.27));
566 }
567 }
568 NS_LOG_INFO("Enable Lte traces and connect custom trace sinks");
569
570 lteHelper->EnableTraces();
571 Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats();
572 rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
573 Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats();
574 pdcpStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
575
576 Config::Connect("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
578 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
580 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
582 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
584 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
586 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
588 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
590 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
592 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
594 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::LteUeNetDevice/"
595 "ComponentCarrierMapUe/*/LteUeMac/RaResponseTimeout",
597
598 // Trace sink for the packet sink of UE
599 std::ostringstream oss;
600 oss << "/NodeList/" << ueNodes.Get(0)->GetId() << "/ApplicationList/0/$ns3::PacketSink/Rx";
602
603 bool firstWrite = true;
604 std::string rrcType = useIdealRrc ? "ideal_rrc" : "real_rrc";
605 std::string fileName = "rlf_dl_thrput_" + std::to_string(enbNodes.GetN()) + "_eNB_" + rrcType;
606 Time binSize = Seconds(0.2);
607 Simulator::Schedule(Seconds(0.47), &Throughput, firstWrite, binSize, fileName);
608
609 NS_LOG_INFO("Starting simulation...");
610
611 Simulator::Stop(simTime);
612
614
616 "UE RRC should receive " << n310
617 << " out-of-sync indications in Cell 1."
618 " Total received = "
620
622
623 return 0;
624}
uint32_t u
a polymophic address class
Definition address.h:114
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start 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:26
Parse command-line arguments.
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:78
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition data-rate.cc:198
AttributeValue implementation for DataRate.
Definition data-rate.h:252
DataRate Get() const
Definition data-rate.cc:20
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Hold variables of type enum.
Definition enum.h:52
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
@ NGBR_IMS
Non-GBR IMS Signalling.
Definition eps-bearer.h:109
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
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.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition ipv4.h:69
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
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...
The LteUeNetDevice class implements the UE net device.
State
The states of the UE RRC entity.
Definition lte-ue-rrc.h:71
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.
keep track of a set of node pointers.
uint32_t GetN() 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() const
Definition node.cc:106
static Iterator Begin()
Definition node-list.cc:226
static Iterator End()
Definition node-list.cc:233
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition object.h:518
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)
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:408
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:398
@ S
second
Definition nstime.h:106
AttributeValue implementation for Time.
Definition nstime.h:1375
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:870
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:34
void ReceivePacket(Ptr< Socket > socket)
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition callback.h:690
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:886
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:970
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:946
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:260
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:274
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:267
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition callback.h:753
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:454
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1273
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition log.cc:279
LogLevel
Logging severity classes and levels.
Definition log.h:86
@ LOG_LEVEL_ALL
Print everything.
Definition log.h:108
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition log.h:110
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition log.h:111
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition log.h:112
mobility
Definition third.py:92
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition epc-tft.h:60
uint16_t localPortEnd
end of the port number range of the UE
Definition epc-tft.h:121
uint16_t remotePortEnd
end of the port number range of the remote host
Definition epc-tft.h:119
uint16_t remotePortStart
start of the port number range of the remote host
Definition epc-tft.h:118
uint16_t localPortStart
start of the port number range of the UE
Definition epc-tft.h:120
std::ofstream throughput
static const uint32_t packetSize
Packet size generated at the AP.