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 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
474 ueDevs = lteHelper->InstallUeDevice(ueNodes);
475 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
476
477 NS_LOG_INFO("Install the IP stack on the UEs");
478 internet.Install(ueNodes);
479 Ipv4InterfaceContainer ueIpIfaces;
480 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
481
482 NS_LOG_INFO("Attach a UE to a eNB");
483 lteHelper->Attach(ueDevs);
484
485 NS_LOG_INFO("Install and start applications on UEs and remote host");
486 uint16_t dlPort = 10000;
487 uint16_t ulPort = 20000;
488
489 DataRateValue dataRateValue = DataRate("18.6Mbps");
490
491 uint64_t bitRate = dataRateValue.Get().GetBitRate();
492
493 uint32_t packetSize = 1024; // bytes
494
495 NS_LOG_DEBUG("bit rate " << bitRate);
496
497 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
498
499 Time udpInterval = Seconds(interPacketInterval);
500
501 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S) << " sec");
502
503 for (uint32_t u = 0; u < numberOfUes; ++u)
504 {
505 Ptr<Node> ue = ueNodes.Get(u);
506 // Set the default gateway for the UE
507 Ptr<Ipv4StaticRouting> ueStaticRouting =
508 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
509 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
510
511 for (uint32_t b = 0; b < numBearersPerUe; ++b)
512 {
513 ApplicationContainer ulClientApps;
514 ApplicationContainer ulServerApps;
515 ApplicationContainer dlClientApps;
516 ApplicationContainer dlServerApps;
517
518 ++dlPort;
519 ++ulPort;
520
521 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
522 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
523 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
524 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
525 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
526 dlClientApps.Add(dlClientHelper.Install(remoteHost));
527
528 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
530 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
531
532 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
533 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
534 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
535 dlClientHelper.SetAttribute("PacketSize", UintegerValue(packetSize));
536 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
537 ulClientApps.Add(ulClientHelper.Install(ue));
538
539 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
541 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
542
545 dlpf.localPortStart = dlPort;
546 dlpf.localPortEnd = dlPort;
547 tft->Add(dlpf);
549 ulpf.remotePortStart = ulPort;
550 ulpf.remotePortEnd = ulPort;
551 tft->Add(ulpf);
553 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
554
555 dlServerApps.Start(Seconds(0.27));
556 dlClientApps.Start(Seconds(0.27));
557 ulServerApps.Start(Seconds(0.27));
558 ulClientApps.Start(Seconds(0.27));
559 } // end for b
560 }
561 NS_LOG_INFO("Enable Lte traces and connect custom trace sinks");
562
563 lteHelper->EnableTraces();
564 Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats();
565 rlcStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
566 Ptr<RadioBearerStatsCalculator> pdcpStats = lteHelper->GetPdcpStats();
567 pdcpStats->SetAttribute("EpochDuration", TimeValue(Seconds(0.05)));
568
569 Config::Connect("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
571 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
573 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
575 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
577 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
579 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
581 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteEnbRrc/RrcTimeout",
583 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/RandomAccessError",
585 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
587 Config::ConnectWithoutContext("/NodeList/*/DeviceList/*/$ns3::LteUeNetDevice/"
588 "ComponentCarrierMapUe/*/LteUeMac/RaResponseTimeout",
590
591 // Trace sink for the packet sink of UE
592 std::ostringstream oss;
593 oss << "/NodeList/" << ueNodes.Get(0)->GetId() << "/ApplicationList/0/$ns3::PacketSink/Rx";
595
596 bool firstWrite = true;
597 std::string rrcType = useIdealRrc ? "ideal_rrc" : "real_rrc";
598 std::string fileName = "rlf_dl_thrput_" + std::to_string(enbNodes.GetN()) + "_eNB_" + rrcType;
599 Time binSize = Seconds(0.2);
600 Simulator::Schedule(Seconds(0.47), &Throughput, firstWrite, binSize, fileName);
601
602 NS_LOG_INFO("Starting simulation...");
603
604 Simulator::Stop(simTime);
605
607
609 "UE RRC should receive " << n310
610 << " out-of-sync indications in Cell 1."
611 " Total received = "
613
615
616 return 0;
617}
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.
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:234
AttributeValue implementation for DataRate.
Definition data-rate.h:285
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:89
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
AttributeValue implementation for Time.
Definition nstime.h:1431
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:1344
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.