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 = Seconds(0); //!< 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/// Map each of UE RRC states to its string representation.
104static const std::string g_ueRrcStateName[LteUeRrc::NUM_STATES] = {
105 "IDLE_START",
106 "IDLE_CELL_SEARCH",
107 "IDLE_WAIT_MIB_SIB1",
108 "IDLE_WAIT_MIB",
109 "IDLE_WAIT_SIB1",
110 "IDLE_CAMPED_NORMALLY",
111 "IDLE_WAIT_SIB2",
112 "IDLE_RANDOM_ACCESS",
113 "IDLE_CONNECTING",
114 "CONNECTED_NORMALLY",
115 "CONNECTED_HANDOVER",
116 "CONNECTED_PHY_PROBLEM",
117 "CONNECTED_REESTABLISHING",
118};
119
120/**
121 * \param s The UE RRC state.
122 * \return The string representation of the given state.
123 */
124static const std::string&
126{
127 return g_ueRrcStateName[s];
128}
129
130/**
131 * UE state transition tracer.
132 *
133 * \param imsi The IMSI.
134 * \param cellId The Cell ID.
135 * \param rnti The RNTI.
136 * \param oldState The old state.
137 * \param newState The new state.
138 */
139void
140UeStateTransition(uint64_t imsi,
141 uint16_t cellId,
142 uint16_t rnti,
143 LteUeRrc::State oldState,
144 LteUeRrc::State newState)
145{
146 std::cout << Simulator::Now().As(Time::S) << " UE with IMSI " << imsi << " RNTI " << rnti
147 << " connected to cell " << cellId << " transitions from " << ToString(oldState)
148 << " to " << ToString(newState) << std::endl;
149}
150
151/**
152 * eNB RRC timeout tracer.
153 *
154 * \param imsi The IMSI.
155 * \param rnti The RNTI.
156 * \param cellId The Cell ID.
157 * \param cause The reason for timeout.
158 */
159void
160EnbRrcTimeout(uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause)
161{
162 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
163 << ", Cell id " << cellId << ", ENB RRC " << cause << std::endl;
164}
165
166/**
167 * Notification of connection release at eNB.
168 *
169 * \param imsi The IMSI.
170 * \param cellId The Cell ID.
171 * \param rnti The RNTI.
172 */
173void
174NotifyConnectionReleaseAtEnodeB(uint64_t imsi, uint16_t cellId, uint16_t rnti)
175{
176 std::cout << Simulator::Now() << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
177 << ", UE context destroyed at eNodeB" << std::endl;
178}
179
180/**
181 * PHY sync detection tracer.
182 *
183 * \param n310 310 data.
184 * \param imsi The IMSI.
185 * \param rnti The RNTI.
186 * \param cellId The Cell ID.
187 * \param type The type.
188 * \param count The count.
189 */
190void
191PhySyncDetection(uint16_t n310,
192 uint64_t imsi,
193 uint16_t rnti,
194 uint16_t cellId,
195 std::string type,
196 uint8_t count)
197{
198 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
199 << ", Cell id " << cellId << ", " << type << ", no of sync indications: " << +count
200 << std::endl;
201
202 if (type == "Notify out of sync" && cellId == 1)
203 {
205 if (counterN310FirsteNB == n310)
206 {
208 }
209 NS_LOG_DEBUG("counterN310FirsteNB = " << counterN310FirsteNB);
210 }
211}
212
213/**
214 * Radio link failure tracer.
215 *
216 * \param t310 310 data.
217 * \param imsi The IMSI.
218 * \param cellId The Cell ID.
219 * \param rnti The RNTI.
220 */
221void
222RadioLinkFailure(Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti)
223{
224 std::cout << Simulator::Now() << " IMSI " << imsi << ", RNTI " << rnti << ", Cell id " << cellId
225 << ", radio link failure detected" << std::endl
226 << std::endl;
227
228 PrintUePosition(imsi);
229
230 if (cellId == 1)
231 {
233 "T310 timer expired at wrong time");
234 }
235}
236
237/**
238 * UE Random access error notification.
239 *
240 * \param imsi The IMSI.
241 * \param cellId The Cell ID.
242 * \param rnti The RNTI.
243 */
244void
245NotifyRandomAccessErrorUe(uint64_t imsi, uint16_t cellId, uint16_t rnti)
246{
247 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
248 << ", Cell id " << cellId << ", UE RRC Random access Failed" << std::endl;
249}
250
251/**
252 * UE Connection timeout notification.
253 *
254 * \param imsi The IMSI.
255 * \param cellId The Cell ID.
256 * \param rnti The RNTI.
257 * \param connEstFailCount Connection failure count.
258 */
259void
260NotifyConnectionTimeoutUe(uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount)
261{
262 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", RNTI " << rnti
263 << ", Cell id " << cellId << ", T300 expiration counter "
264 << (uint16_t)connEstFailCount << ", UE RRC Connection timeout" << std::endl;
265}
266
267/**
268 * UE RA response timeout notification.
269 *
270 * \param imsi The IMSI.
271 * \param contention Contention flag.
272 * \param preambleTxCounter Preamble Tx counter.
273 * \param maxPreambleTxLimit Max preamble Ts limit.
274 */
275void
277 bool contention,
278 uint8_t preambleTxCounter,
279 uint8_t maxPreambleTxLimit)
280{
281 std::cout << Simulator::Now().As(Time::S) << " IMSI " << imsi << ", Contention flag "
282 << contention << ", preamble Tx Counter " << (uint16_t)preambleTxCounter
283 << ", Max Preamble Tx Limit " << (uint16_t)maxPreambleTxLimit
284 << ", UE RA response timeout" << std::endl;
285}
286
287/**
288 * Receive a packet.
289 *
290 * \param packet The packet.
291 */
292void
294{
295 ByteCounter += packet->GetSize();
296}
297
298/**
299 * Write the throughput to file.
300 *
301 * \param firstWrite True if first time writing.
302 * \param binSize Bin size.
303 * \param fileName Output filename.
304 */
305void
306Throughput(bool firstWrite, Time binSize, std::string fileName)
307{
308 std::ofstream output;
309
310 if (firstWrite)
311 {
312 output.open(fileName, std::ofstream::out);
313 firstWrite = false;
314 }
315 else
316 {
317 output.open(fileName, std::ofstream::app);
318 }
319
320 // Instantaneous throughput every 200 ms
321
322 double throughput = (ByteCounter - oldByteCounter) * 8 / binSize.GetSeconds() / 1024 / 1024;
323 output << Simulator::Now().As(Time::S) << " " << throughput << std::endl;
325 Simulator::Schedule(binSize, &Throughput, firstWrite, binSize, fileName);
326}
327
328/**
329 * Sample simulation script for radio link failure.
330 * By default, only one eNodeB and one UE is considered for verifying
331 * radio link failure. The UE is initially in the coverage of
332 * eNodeB and a RRC connection gets established.
333 * As the UE moves away from the eNodeB, the signal degrades
334 * and out-of-sync indications are counted. When the T310 timer
335 * expires, radio link is considered to have failed and UE
336 * leaves the CONNECTED_NORMALLY state and performs cell
337 * selection again.
338 *
339 * The example can be run as follows:
340 *
341 * ./ns3 run "lena-radio-link-failure --numberOfEnbs=1 --simTime=25"
342 */
343int
344main(int argc, char* argv[])
345{
346 // Configurable parameters
347 Time simTime = Seconds(25);
348 uint16_t numberOfEnbs = 1;
349 double interSiteDistance = 1200;
350 uint16_t n311 = 1;
351 uint16_t n310 = 1;
352 Time t310 = Seconds(1);
353 bool useIdealRrc = true;
354 bool enableCtrlErrorModel = true;
355 bool enableDataErrorModel = true;
356 bool enableNsLogs = false;
357
358 CommandLine cmd(__FILE__);
359 cmd.AddValue("simTime", "Total duration of the simulation (in seconds)", simTime);
360 cmd.AddValue("numberOfEnbs", "Number of eNBs", numberOfEnbs);
361 cmd.AddValue("n311", "Number of in-synch indication", n311);
362 cmd.AddValue("n310", "Number of out-of-synch indication", n310);
363 cmd.AddValue("t310", "Timer for detecting the Radio link failure (in seconds)", t310);
364 cmd.AddValue("interSiteDistance", "Inter-site distance in meter", interSiteDistance);
365 cmd.AddValue("useIdealRrc", "Use ideal RRC protocol", useIdealRrc);
366 cmd.AddValue("enableCtrlErrorModel", "Enable control error model", enableCtrlErrorModel);
367 cmd.AddValue("enableDataErrorModel", "Enable data error model", enableDataErrorModel);
368 cmd.AddValue("enableNsLogs", "Enable ns-3 logging (debug builds)", enableNsLogs);
369 cmd.Parse(argc, argv);
370
371 if (enableNsLogs)
372 {
373 auto logLevel =
375 LogComponentEnable("LteUeRrc", logLevel);
376 LogComponentEnable("LteUeMac", logLevel);
377 LogComponentEnable("LteUePhy", logLevel);
378
379 LogComponentEnable("LteEnbRrc", logLevel);
380 LogComponentEnable("LteEnbMac", logLevel);
381 LogComponentEnable("LteEnbPhy", logLevel);
382
383 LogComponentEnable("LenaRadioLinkFailure", logLevel);
384 }
385
386 uint16_t numberOfUes = 1;
387 uint16_t numBearersPerUe = 1;
388 double eNodeB_txPower = 43;
389
390 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(useIdealRrc));
391 Config::SetDefault("ns3::LteSpectrumPhy::CtrlErrorModelEnabled",
392 BooleanValue(enableCtrlErrorModel));
393 Config::SetDefault("ns3::LteSpectrumPhy::DataErrorModelEnabled",
394 BooleanValue(enableDataErrorModel));
395
396 Config::SetDefault("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue(60 * 1024));
397
400 lteHelper->SetEpcHelper(epcHelper);
401
402 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
403 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
404 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
405 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
406 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
407
408 //----power related (equal for all base stations)----
409 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
410 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
411 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
412 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
413 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
414 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
415 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
416
417 //----frequency related----
418 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
419 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
420 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
421 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
422
423 //----others----
424 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
425 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
426 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
427 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
428
429 Config::SetDefault("ns3::FfMacScheduler::UlCqiFilter", EnumValue(FfMacScheduler::SRS_UL_CQI));
430
431 // Radio link failure detection parameters
432 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(n310));
433 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(n311));
434 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(t310));
435
436 NS_LOG_INFO("Create the internet");
437 Ptr<Node> pgw = epcHelper->GetPgwNode();
438 // Create a single RemoteHost0x18ab460
439 NodeContainer remoteHostContainer;
440 remoteHostContainer.Create(1);
441 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
443 internet.Install(remoteHostContainer);
445 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
446 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
447 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
448 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
449 Ipv4AddressHelper ipv4h;
450 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
451 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
452 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
453 Ipv4StaticRoutingHelper ipv4RoutingHelper;
454 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
455 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
456 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
457
458 NS_LOG_INFO("Create eNodeB and UE nodes");
459 NodeContainer enbNodes;
460 NodeContainer ueNodes;
461 enbNodes.Create(numberOfEnbs);
462 ueNodes.Create(numberOfUes);
463
464 NS_LOG_INFO("Assign mobility");
466
467 for (uint16_t i = 0; i < numberOfEnbs; i++)
468 {
469 positionAllocEnb->Add(Vector(interSiteDistance * i, 0, 0));
470 }
472 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
473 mobility.SetPositionAllocator(positionAllocEnb);
474 mobility.Install(enbNodes);
475
477
478 for (int i = 0; i < numberOfUes; i++)
479 {
480 positionAllocUe->Add(Vector(200, 0, 0));
481 }
482
483 mobility.SetPositionAllocator(positionAllocUe);
484 mobility.SetMobilityModel("ns3::ConstantVelocityMobilityModel");
485 mobility.Install(ueNodes);
486
487 for (int i = 0; i < numberOfUes; i++)
488 {
489 ueNodes.Get(i)->GetObject<ConstantVelocityMobilityModel>()->SetVelocity(
490 Vector(30, 0.0, 0.0));
491 }
492
493 NS_LOG_INFO("Install LTE Devices in eNB and UEs and fix random number stream");
494 NetDeviceContainer enbDevs;
495 NetDeviceContainer ueDevs;
496
497 int64_t randomStream = 1;
498
499 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
500 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
501 ueDevs = lteHelper->InstallUeDevice(ueNodes);
502 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
503
504 NS_LOG_INFO("Install the IP stack on the UEs");
505 internet.Install(ueNodes);
506 Ipv4InterfaceContainer ueIpIfaces;
507 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
508
509 NS_LOG_INFO("Attach a UE to a eNB");
510 lteHelper->Attach(ueDevs);
511
512 NS_LOG_INFO("Install and start applications on UEs and remote host");
513 uint16_t dlPort = 10000;
514 uint16_t ulPort = 20000;
515
516 DataRateValue dataRateValue = DataRate("18.6Mbps");
517
518 uint64_t bitRate = dataRateValue.Get().GetBitRate();
519
520 uint32_t packetSize = 1024; // bytes
521
522 NS_LOG_DEBUG("bit rate " << bitRate);
523
524 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
525
526 Time udpInterval = Seconds(interPacketInterval);
527
528 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S) << " sec");
529
530 for (uint32_t u = 0; u < numberOfUes; ++u)
531 {
532 Ptr<Node> ue = ueNodes.Get(u);
533 // Set the default gateway for the UE
534 Ptr<Ipv4StaticRouting> ueStaticRouting =
535 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
536 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
537
538 for (uint32_t b = 0; b < numBearersPerUe; ++b)
539 {
540 ApplicationContainer ulClientApps;
541 ApplicationContainer ulServerApps;
542 ApplicationContainer dlClientApps;
543 ApplicationContainer dlServerApps;
544
545 ++dlPort;
546 ++ulPort;
547
548 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
549 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
550 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
551 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
552 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
553 dlClientApps.Add(dlClientHelper.Install(remoteHost));
554
555 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
557 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
558
559 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
560 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
561 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
562 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
563 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
564 ulClientApps.Add(ulClientHelper.Install(ue));
565
566 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
568 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
569
572 dlpf.localPortStart = dlPort;
573 dlpf.localPortEnd = dlPort;
574 tft->Add(dlpf);
576 ulpf.remotePortStart = ulPort;
577 ulpf.remotePortEnd = ulPort;
578 tft->Add(ulpf);
580 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
581
582 dlServerApps.Start(Seconds(0.27));
583 dlClientApps.Start(Seconds(0.27));
584 ulServerApps.Start(Seconds(0.27));
585 ulClientApps.Start(Seconds(0.27));
586 } // end for b
587 }
588 NS_LOG_INFO("Enable Lte traces and connect custom trace sinks");
589
590 lteHelper->EnableTraces();
591 Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats();
592 rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
593 Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats();
594 pdcpStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
595
596 Config::Connect("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
598 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
600 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
602 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
604 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
606 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
608 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
610 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
612 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
614 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::LteUeNetDevice/"
615 "ComponentCarrierMapUe/*/LteUeMac/RaResponseTimeout",
617
618 // Trace sink for the packet sink of UE
619 std::ostringstream oss;
620 oss << "/NodeList/" << ueNodes.Get(0)->GetId() << "/ApplicationList/0/$ns3::PacketSink/Rx";
622
623 bool firstWrite = true;
624 std::string rrcType = useIdealRrc ? "ideal_rrc" : "real_rrc";
625 std::string fileName = "rlf_dl_thrput_" + std::to_string(enbNodes.GetN()) + "_eNB_" + rrcType;
626 Time binSize = Seconds(0.2);
627 Simulator::Schedule(Seconds(0.47), &Throughput, firstWrite, binSize, fileName);
628
629 NS_LOG_INFO("Starting simulation...");
630
631 Simulator::Stop(simTime);
632
634
636 "UE RRC should receive " << n310
637 << " out-of-sync indications in Cell 1."
638 " Total received = "
640
642
643 return 0;
644}
a polymophic address class
Definition address.h:90
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.
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:234
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:88
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:511
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.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
@ S
second
Definition nstime.h:105
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:872
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 SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:967
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition config.cc:943
#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:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition callback.h:745
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
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:291
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:684
LogLevel
Logging severity classes and levels.
Definition log.h:83
@ LOG_LEVEL_ALL
Print everything.
Definition log.h:105
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition log.h:107
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition log.h:108
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition log.h:109
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.