A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-helper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es> (re-wrote from scratch this helper)
18 * Giuseppe Piro <g.piro@poliba.it> (parts of the PHY & channel creation & configuration
19 * copied from the GSoC 2011 code) Modified by: Danilo Abrignani <danilo.abrignani@unibo.it>
20 * (Carrier Aggregation - GSoC 2015) Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
21 */
22
23#include "lte-helper.h"
24
25#include "cc-helper.h"
26#include "epc-helper.h"
31
32#include <ns3/abort.h>
33#include <ns3/buildings-propagation-loss-model.h>
34#include <ns3/epc-enb-application.h>
35#include <ns3/epc-enb-s1-sap.h>
36#include <ns3/epc-ue-nas.h>
37#include <ns3/epc-x2.h>
38#include <ns3/ff-mac-scheduler.h>
39#include <ns3/friis-spectrum-propagation-loss.h>
40#include <ns3/isotropic-antenna-model.h>
41#include <ns3/log.h>
42#include <ns3/lte-anr.h>
43#include <ns3/lte-chunk-processor.h>
44#include <ns3/lte-common.h>
45#include <ns3/lte-enb-component-carrier-manager.h>
46#include <ns3/lte-enb-mac.h>
47#include <ns3/lte-enb-net-device.h>
48#include <ns3/lte-enb-phy.h>
49#include <ns3/lte-enb-rrc.h>
50#include <ns3/lte-ffr-algorithm.h>
51#include <ns3/lte-handover-algorithm.h>
52#include <ns3/lte-rlc-am.h>
53#include <ns3/lte-rlc-um.h>
54#include <ns3/lte-rlc.h>
55#include <ns3/lte-rrc-protocol-ideal.h>
56#include <ns3/lte-rrc-protocol-real.h>
57#include <ns3/lte-spectrum-phy.h>
58#include <ns3/lte-spectrum-value-helper.h>
59#include <ns3/lte-ue-component-carrier-manager.h>
60#include <ns3/lte-ue-mac.h>
61#include <ns3/lte-ue-net-device.h>
62#include <ns3/lte-ue-phy.h>
63#include <ns3/lte-ue-rrc.h>
64#include <ns3/multi-model-spectrum-channel.h>
65#include <ns3/object-factory.h>
66#include <ns3/object-map.h>
67#include <ns3/pointer.h>
68#include <ns3/string.h>
69#include <ns3/trace-fading-loss-model.h>
70
71#include <iostream>
72
73namespace ns3
74{
75
76NS_LOG_COMPONENT_DEFINE("LteHelper");
77
79
81 : m_fadingStreamsAssigned(false),
82 m_imsiCounter(0),
83 m_cellIdCounter{1}
84{
85 NS_LOG_FUNCTION(this);
91}
92
93void
95{
96 NS_LOG_FUNCTION(this);
98 m_phyStats = CreateObject<PhyStatsCalculator>();
99 m_phyTxStats = CreateObject<PhyTxStatsCalculator>();
100 m_phyRxStats = CreateObject<PhyRxStatsCalculator>();
101 m_macStats = CreateObject<MacStatsCalculator>();
103}
104
106{
107 NS_LOG_FUNCTION(this);
108}
109
110TypeId
112{
113 static TypeId tid =
114 TypeId("ns3::LteHelper")
115 .SetParent<Object>()
116 .AddConstructor<LteHelper>()
117 .AddAttribute(
118 "Scheduler",
119 "The type of scheduler to be used for eNBs. "
120 "The allowed values for this attributes are the type names "
121 "of any class inheriting from ns3::FfMacScheduler.",
122 StringValue("ns3::PfFfMacScheduler"),
125 .AddAttribute("FfrAlgorithm",
126 "The type of FFR algorithm to be used for eNBs. "
127 "The allowed values for this attributes are the type names "
128 "of any class inheriting from ns3::LteFfrAlgorithm.",
129 StringValue("ns3::LteFrNoOpAlgorithm"),
133 .AddAttribute("HandoverAlgorithm",
134 "The type of handover algorithm to be used for eNBs. "
135 "The allowed values for this attributes are the type names "
136 "of any class inheriting from ns3::LteHandoverAlgorithm.",
137 StringValue("ns3::NoOpHandoverAlgorithm"),
141 .AddAttribute("PathlossModel",
142 "The type of pathloss model to be used. "
143 "The allowed values for this attributes are the type names "
144 "of any class inheriting from ns3::PropagationLossModel.",
148 .AddAttribute("FadingModel",
149 "The type of fading model to be used."
150 "The allowed values for this attributes are the type names "
151 "of any class inheriting from ns3::SpectrumPropagationLossModel."
152 "If the type is set to an empty string, no fading model is used.",
153 StringValue(""),
156 .AddAttribute("UseIdealRrc",
157 "If true, LteRrcProtocolIdeal will be used for RRC signaling. "
158 "If false, LteRrcProtocolReal will be used.",
159 BooleanValue(true),
162 .AddAttribute("AnrEnabled",
163 "Activate or deactivate Automatic Neighbour Relation function",
164 BooleanValue(true),
167 .AddAttribute("UsePdschForCqiGeneration",
168 "If true, DL-CQI will be calculated from PDCCH as signal and PDSCH as "
169 "interference. "
170 "If false, DL-CQI will be calculated from PDCCH as signal and PDCCH as "
171 "interference.",
172 BooleanValue(true),
175 .AddAttribute("EnbComponentCarrierManager",
176 "The type of Component Carrier Manager to be used for eNBs. "
177 "The allowed values for this attributes are the type names "
178 "of any class inheriting ns3::LteEnbComponentCarrierManager.",
179 StringValue("ns3::NoOpComponentCarrierManager"),
183 .AddAttribute("UeComponentCarrierManager",
184 "The type of Component Carrier Manager to be used for UEs. "
185 "The allowed values for this attributes are the type names "
186 "of any class inheriting ns3::LteUeComponentCarrierManager.",
187 StringValue("ns3::SimpleUeComponentCarrierManager"),
191 .AddAttribute("UseCa",
192 "If true, Carrier Aggregation feature is enabled and a valid Component "
193 "Carrier Map is expected. "
194 "If false, single carrier simulation.",
195 BooleanValue(false),
198 .AddAttribute("NumberOfComponentCarriers",
199 "Set the number of Component carrier to use. "
200 "If it is more than one and m_useCa is false, it will raise an error.",
201 UintegerValue(1),
203 MakeUintegerChecker<uint16_t>(MIN_NO_CC, MAX_NO_CC));
204 return tid;
205}
206
207void
209{
210 NS_LOG_FUNCTION(this);
211 m_downlinkChannel = nullptr;
212 m_uplinkChannel = nullptr;
215}
216
219{
220 return m_uplinkChannel;
221}
222
225{
226 return m_downlinkChannel;
227}
228
229void
231{
232 // Channel Object (i.e. Ptr<SpectrumChannel>) are within a vector
233 // PathLossModel Objects are vectors --> in InstallSingleEnb we will set the frequency
234 NS_LOG_FUNCTION(this << m_noOfCcs);
235
238
242 if (dlSplm)
243 {
244 NS_LOG_LOGIC(this << " using a SpectrumPropagationLossModel in DL");
245 m_downlinkChannel->AddSpectrumPropagationLossModel(dlSplm);
246 }
247 else
248 {
249 NS_LOG_LOGIC(this << " using a PropagationLossModel in DL");
252 NS_ASSERT_MSG(dlPlm,
254 << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
255 m_downlinkChannel->AddPropagationLossModel(dlPlm);
256 }
257
261 if (ulSplm)
262 {
263 NS_LOG_LOGIC(this << " using a SpectrumPropagationLossModel in UL");
264 m_uplinkChannel->AddSpectrumPropagationLossModel(ulSplm);
265 }
266 else
267 {
268 NS_LOG_LOGIC(this << " using a PropagationLossModel in UL");
270 NS_ASSERT_MSG(ulPlm,
272 << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
273 m_uplinkChannel->AddPropagationLossModel(ulPlm);
274 }
275 if (!m_fadingModelType.empty())
276 {
278 m_fadingModel->Initialize();
279 m_downlinkChannel->AddSpectrumPropagationLossModel(m_fadingModel);
280 m_uplinkChannel->AddSpectrumPropagationLossModel(m_fadingModel);
281 }
282}
283
284void
286{
287 NS_LOG_FUNCTION(this << h);
288 m_epcHelper = h;
289}
290
291void
293{
294 NS_LOG_FUNCTION(this << type);
297}
298
299std::string
301{
303}
304
305void
307{
308 NS_LOG_FUNCTION(this << n);
310}
311
312std::string
314{
316}
317
318void
320{
321 NS_LOG_FUNCTION(this << type);
324}
325
326void
328{
329 NS_LOG_FUNCTION(this << n);
331}
332
333std::string
335{
337}
338
339void
341{
342 NS_LOG_FUNCTION(this << type);
345}
346
347void
349{
350 NS_LOG_FUNCTION(this << n);
352}
353
354std::string
356{
358}
359
360void
362{
363 NS_LOG_FUNCTION(this << type);
366}
367
368void
370{
371 NS_LOG_FUNCTION(this << n);
373}
374
375std::string
377{
379}
380
381void
383{
384 NS_LOG_FUNCTION(this << type);
387}
388
389void
391{
392 NS_LOG_FUNCTION(this << n);
394}
395
396void
398{
399 NS_LOG_FUNCTION(this << type);
402}
403
404void
406{
407 NS_LOG_FUNCTION(this << n);
409}
410
411void
413{
414 NS_LOG_FUNCTION(this);
416}
417
418void
420{
421 NS_LOG_FUNCTION(this);
423}
424
425void
427{
428 NS_LOG_FUNCTION(this);
430}
431
432void
434{
435 NS_LOG_FUNCTION(this);
437}
438
439void
441{
442 NS_LOG_FUNCTION(this);
444}
445
446void
448{
449 NS_LOG_FUNCTION(this);
451}
452
453void
455{
456 NS_LOG_FUNCTION(this << type);
457 m_fadingModelType = type;
458 if (!type.empty())
459 {
462 }
463}
464
465void
467{
469}
470
471void
473{
474 NS_LOG_FUNCTION(this << type);
476}
477
478void
480{
481 m_channelFactory.Set(n, v);
482}
483
486{
487 NS_LOG_FUNCTION(this);
488 Initialize(); // will run DoInitialize () if necessary
489 NetDeviceContainer devices;
490 for (auto i = c.Begin(); i != c.End(); ++i)
491 {
492 Ptr<Node> node = *i;
494 devices.Add(device);
495 }
496 return devices;
497}
498
501{
502 NS_LOG_FUNCTION(this);
503 NetDeviceContainer devices;
504 for (auto i = c.Begin(); i != c.End(); ++i)
505 {
506 Ptr<Node> node = *i;
508 devices.Add(device);
509 }
510 return devices;
511}
512
515{
516 NS_LOG_FUNCTION(this << n);
517 uint16_t cellId = m_cellIdCounter; // \todo Remove, eNB has no cell ID
518
520 Ptr<LteHandoverAlgorithm> handoverAlgorithm =
522
523 NS_ABORT_MSG_IF(!m_componentCarrierPhyParams.empty(), "CC map is not clean");
524 DoComponentCarrierConfigure(dev->GetUlEarfcn(),
525 dev->GetDlEarfcn(),
526 dev->GetUlBandwidth(),
527 dev->GetDlBandwidth());
529 "CC map size (" << m_componentCarrierPhyParams.size()
530 << ") must be equal to number of carriers (" << m_noOfCcs
531 << ")");
532 // create component carrier map for this eNb device
533 std::map<uint8_t, Ptr<ComponentCarrierBaseStation>> ccMap;
534 for (auto it = m_componentCarrierPhyParams.begin(); it != m_componentCarrierPhyParams.end();
535 ++it)
536 {
537 Ptr<ComponentCarrierEnb> cc = CreateObject<ComponentCarrierEnb>();
538 cc->SetUlBandwidth(it->second.GetUlBandwidth());
539 cc->SetDlBandwidth(it->second.GetDlBandwidth());
540 cc->SetDlEarfcn(it->second.GetDlEarfcn());
541 cc->SetUlEarfcn(it->second.GetUlEarfcn());
542 cc->SetAsPrimary(it->second.IsPrimary());
543 NS_ABORT_MSG_IF(m_cellIdCounter == 65535, "max num cells exceeded");
544 cc->SetCellId(m_cellIdCounter++);
545 ccMap[it->first] = cc;
546 }
547 // CC map is not needed anymore
549
550 NS_ABORT_MSG_IF(m_useCa && ccMap.size() < 2,
551 "You have to either specify carriers or disable carrier aggregation");
552 NS_ASSERT(ccMap.size() == m_noOfCcs);
553
554 for (auto it = ccMap.begin(); it != ccMap.end(); ++it)
555 {
556 NS_LOG_DEBUG(this << "component carrier map size " << (uint16_t)ccMap.size());
557 Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy>();
558 Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy>();
559 Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy>(dlPhy, ulPhy);
560
561 Ptr<LteHarqPhy> harq = Create<LteHarqPhy>();
562 dlPhy->SetHarqPhyModule(harq);
563 ulPhy->SetHarqPhyModule(harq);
564 phy->SetHarqPhyModule(harq);
565
566 Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor>();
567 pCtrl->AddCallback(MakeCallback(&LteEnbPhy::GenerateCtrlCqiReport, phy));
568 ulPhy->AddCtrlSinrChunkProcessor(pCtrl); // for evaluating SRS UL-CQI
569
570 Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor>();
571 pData->AddCallback(MakeCallback(&LteEnbPhy::GenerateDataCqiReport, phy));
572 pData->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, ulPhy));
573 ulPhy->AddDataSinrChunkProcessor(pData); // for evaluating PUSCH UL-CQI
574
575 Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor>();
576 pInterf->AddCallback(MakeCallback(&LteEnbPhy::ReportInterference, phy));
577 ulPhy->AddInterferenceDataChunkProcessor(pInterf); // for interference power tracing
578
579 dlPhy->SetChannel(m_downlinkChannel);
580 ulPhy->SetChannel(m_uplinkChannel);
581
582 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
584 mm,
585 "MobilityModel needs to be set on node before calling LteHelper::InstallEnbDevice ()");
586 dlPhy->SetMobility(mm);
587 ulPhy->SetMobility(mm);
588
589 Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create())->GetObject<AntennaModel>();
590 NS_ASSERT_MSG(antenna, "error in creating the AntennaModel object");
591 dlPhy->SetAntenna(antenna);
592 ulPhy->SetAntenna(antenna);
593
594 Ptr<LteEnbMac> mac = CreateObject<LteEnbMac>();
597 DynamicCast<ComponentCarrierEnb>(it->second)->SetMac(mac);
598 DynamicCast<ComponentCarrierEnb>(it->second)->SetFfMacScheduler(sched);
599 DynamicCast<ComponentCarrierEnb>(it->second)->SetFfrAlgorithm(ffrAlgorithm);
600 DynamicCast<ComponentCarrierEnb>(it->second)->SetPhy(phy);
601 }
602
603 Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc>();
606
607 // ComponentCarrierManager SAP
608 rrc->SetLteCcmRrcSapProvider(ccmEnbManager->GetLteCcmRrcSapProvider());
609 ccmEnbManager->SetLteCcmRrcSapUser(rrc->GetLteCcmRrcSapUser());
610 // Set number of component carriers. Note: eNB CCM would also set the
611 // number of component carriers in eNB RRC
612 ccmEnbManager->SetNumberOfComponentCarriers(m_noOfCcs);
613
614 rrc->ConfigureCarriers(ccMap);
615
616 if (m_useIdealRrc)
617 {
618 Ptr<LteEnbRrcProtocolIdeal> rrcProtocol = CreateObject<LteEnbRrcProtocolIdeal>();
619 rrcProtocol->SetLteEnbRrcSapProvider(rrc->GetLteEnbRrcSapProvider());
620 rrc->SetLteEnbRrcSapUser(rrcProtocol->GetLteEnbRrcSapUser());
621 rrc->AggregateObject(rrcProtocol);
622 rrcProtocol->SetCellId(cellId);
623 }
624 else
625 {
626 Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal>();
627 rrcProtocol->SetLteEnbRrcSapProvider(rrc->GetLteEnbRrcSapProvider());
628 rrc->SetLteEnbRrcSapUser(rrcProtocol->GetLteEnbRrcSapUser());
629 rrc->AggregateObject(rrcProtocol);
630 rrcProtocol->SetCellId(cellId);
631 }
632
633 if (m_epcHelper)
634 {
636 rrc->GetAttribute("EpsBearerToRlcMapping", epsBearerToRlcMapping);
637 // it does not make sense to use RLC/SM when also using the EPC
638 if (epsBearerToRlcMapping.Get() == LteEnbRrc::RLC_SM_ALWAYS)
639 {
640 rrc->SetAttribute("EpsBearerToRlcMapping", EnumValue(LteEnbRrc::RLC_UM_ALWAYS));
641 }
642 }
643
644 rrc->SetLteHandoverManagementSapProvider(
645 handoverAlgorithm->GetLteHandoverManagementSapProvider());
646 handoverAlgorithm->SetLteHandoverManagementSapUser(rrc->GetLteHandoverManagementSapUser());
647
648 // This RRC attribute is used to connect each new RLC instance with the MAC layer
649 // (for function such as TransmitPdu, ReportBufferStatusReport).
650 // Since in this new architecture, the component carrier manager acts a proxy, it
651 // will have its own LteMacSapProvider interface, RLC will see it as through original MAC
652 // interface LteMacSapProvider, but the function call will go now through
653 // LteEnbComponentCarrierManager instance that needs to implement functions of this interface,
654 // and its task will be to forward these calls to the specific MAC of some of the instances of
655 // component carriers. This decision will depend on the specific implementation of the component
656 // carrier manager.
657 rrc->SetLteMacSapProvider(ccmEnbManager->GetLteMacSapProvider());
658
659 bool ccmTest;
660 for (auto it = ccMap.begin(); it != ccMap.end(); ++it)
661 {
662 DynamicCast<ComponentCarrierEnb>(it->second)
663 ->GetPhy()
664 ->SetLteEnbCphySapUser(rrc->GetLteEnbCphySapUser(it->first));
665 rrc->SetLteEnbCphySapProvider(
666 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetLteEnbCphySapProvider(),
667 it->first);
668
669 rrc->SetLteEnbCmacSapProvider(
670 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteEnbCmacSapProvider(),
671 it->first);
672 DynamicCast<ComponentCarrierEnb>(it->second)
673 ->GetMac()
674 ->SetLteEnbCmacSapUser(rrc->GetLteEnbCmacSapUser(it->first));
675
676 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->SetComponentCarrierId(it->first);
677 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->SetComponentCarrierId(it->first);
678 // FFR SAP
679 DynamicCast<ComponentCarrierEnb>(it->second)
680 ->GetFfMacScheduler()
681 ->SetLteFfrSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
682 ->GetFfrAlgorithm()
683 ->GetLteFfrSapProvider());
684 DynamicCast<ComponentCarrierEnb>(it->second)
685 ->GetFfrAlgorithm()
686 ->SetLteFfrSapUser(DynamicCast<ComponentCarrierEnb>(it->second)
687 ->GetFfMacScheduler()
688 ->GetLteFfrSapUser());
689 rrc->SetLteFfrRrcSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
690 ->GetFfrAlgorithm()
691 ->GetLteFfrRrcSapProvider(),
692 it->first);
693 DynamicCast<ComponentCarrierEnb>(it->second)
694 ->GetFfrAlgorithm()
695 ->SetLteFfrRrcSapUser(rrc->GetLteFfrRrcSapUser(it->first));
696 // FFR SAP END
697
698 // PHY <--> MAC SAP
699 DynamicCast<ComponentCarrierEnb>(it->second)
700 ->GetPhy()
701 ->SetLteEnbPhySapUser(
702 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteEnbPhySapUser());
703 DynamicCast<ComponentCarrierEnb>(it->second)
704 ->GetMac()
705 ->SetLteEnbPhySapProvider(
706 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetLteEnbPhySapProvider());
707 // PHY <--> MAC SAP END
708
709 // Scheduler SAP
710 DynamicCast<ComponentCarrierEnb>(it->second)
711 ->GetMac()
712 ->SetFfMacSchedSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
713 ->GetFfMacScheduler()
714 ->GetFfMacSchedSapProvider());
715 DynamicCast<ComponentCarrierEnb>(it->second)
716 ->GetMac()
717 ->SetFfMacCschedSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
718 ->GetFfMacScheduler()
719 ->GetFfMacCschedSapProvider());
720
721 DynamicCast<ComponentCarrierEnb>(it->second)
722 ->GetFfMacScheduler()
723 ->SetFfMacSchedSapUser(
724 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetFfMacSchedSapUser());
725 DynamicCast<ComponentCarrierEnb>(it->second)
726 ->GetFfMacScheduler()
727 ->SetFfMacCschedSapUser(
728 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetFfMacCschedSapUser());
729 // Scheduler SAP END
730
731 DynamicCast<ComponentCarrierEnb>(it->second)
732 ->GetMac()
733 ->SetLteCcmMacSapUser(ccmEnbManager->GetLteCcmMacSapUser());
734 ccmEnbManager->SetCcmMacSapProviders(
735 it->first,
736 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteCcmMacSapProvider());
737
738 // insert the pointer to the LteMacSapProvider interface of the MAC layer of the specific
739 // component carrier
740 ccmTest = ccmEnbManager->SetMacSapProvider(
741 it->first,
742 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteMacSapProvider());
743
744 if (!ccmTest)
745 {
746 NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders");
747 }
748 }
749
750 dev->SetNode(n);
751 dev->SetAttribute("CellId", UintegerValue(cellId));
752 dev->SetAttribute("LteEnbComponentCarrierManager", PointerValue(ccmEnbManager));
753 dev->SetCcMap(ccMap);
754 auto it = ccMap.begin();
755 dev->SetAttribute("LteEnbRrc", PointerValue(rrc));
756 dev->SetAttribute("LteHandoverAlgorithm", PointerValue(handoverAlgorithm));
757 dev->SetAttribute(
758 "LteFfrAlgorithm",
759 PointerValue(DynamicCast<ComponentCarrierEnb>(it->second)->GetFfrAlgorithm()));
760
761 if (m_isAnrEnabled)
762 {
763 Ptr<LteAnr> anr = CreateObject<LteAnr>(cellId);
764 rrc->SetLteAnrSapProvider(anr->GetLteAnrSapProvider());
765 anr->SetLteAnrSapUser(rrc->GetLteAnrSapUser());
766 dev->SetAttribute("LteAnr", PointerValue(anr));
767 }
768
769 for (it = ccMap.begin(); it != ccMap.end(); ++it)
770 {
771 Ptr<LteEnbPhy> ccPhy = DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy();
772 ccPhy->SetDevice(dev);
773 ccPhy->GetUlSpectrumPhy()->SetDevice(dev);
774 ccPhy->GetDlSpectrumPhy()->SetDevice(dev);
775 ccPhy->GetUlSpectrumPhy()->SetLtePhyRxDataEndOkCallback(
777 ccPhy->GetUlSpectrumPhy()->SetLtePhyRxCtrlEndOkCallback(
779 ccPhy->GetUlSpectrumPhy()->SetLtePhyUlHarqFeedbackCallback(
781 NS_LOG_LOGIC("set the propagation model frequencies");
782 double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency(it->second->GetDlEarfcn());
783 NS_LOG_LOGIC("DL freq: " << dlFreq);
784 bool dlFreqOk =
786 if (!dlFreqOk)
787 {
788 NS_LOG_WARN("DL propagation model does not have a Frequency attribute");
789 }
790
791 double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency(it->second->GetUlEarfcn());
792
793 NS_LOG_LOGIC("UL freq: " << ulFreq);
794 bool ulFreqOk =
796 if (!ulFreqOk)
797 {
798 NS_LOG_WARN("UL propagation model does not have a Frequency attribute");
799 }
800 } // end for
801 rrc->SetForwardUpCallback(MakeCallback(&LteEnbNetDevice::Receive, dev));
802 dev->Initialize();
803 n->AddDevice(dev);
804
805 for (it = ccMap.begin(); it != ccMap.end(); ++it)
806 {
807 m_uplinkChannel->AddRx(
808 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetUlSpectrumPhy());
809 }
810
811 if (m_epcHelper)
812 {
813 NS_LOG_INFO("adding this eNB to the EPC");
814 m_epcHelper->AddEnb(n, dev, dev->GetCellIds());
815 Ptr<EpcEnbApplication> enbApp = n->GetApplication(0)->GetObject<EpcEnbApplication>();
816 NS_ASSERT_MSG(enbApp, "cannot retrieve EpcEnbApplication");
817
818 // S1 SAPs
819 rrc->SetS1SapProvider(enbApp->GetS1SapProvider());
820 enbApp->SetS1SapUser(rrc->GetS1SapUser());
821
822 // X2 SAPs
823 Ptr<EpcX2> x2 = n->GetObject<EpcX2>();
824 x2->SetEpcX2SapUser(rrc->GetEpcX2SapUser());
825 rrc->SetEpcX2SapProvider(x2->GetEpcX2SapProvider());
826 }
827
828 return dev;
829}
830
833{
834 NS_LOG_FUNCTION(this);
835
837
838 // Initialize the component carriers with default values in order to initialize MACs and PHYs
839 // of each component carrier. These values must be updated once the UE is attached to the
840 // eNB and receives RRC Connection Reconfiguration message. In case of primary carrier or
841 // a single carrier, these values will be updated once the UE will receive SIB2 and MIB.
842 NS_ABORT_MSG_IF(!m_componentCarrierPhyParams.empty(), "CC map is not clean");
843 DoComponentCarrierConfigure(dev->GetDlEarfcn() + 18000, dev->GetDlEarfcn(), 25, 25);
845 "CC map size (" << m_componentCarrierPhyParams.size()
846 << ") must be equal to number of carriers (" << m_noOfCcs
847 << ")");
848 std::map<uint8_t, Ptr<ComponentCarrierUe>> ueCcMap;
849
850 for (auto it = m_componentCarrierPhyParams.begin(); it != m_componentCarrierPhyParams.end();
851 ++it)
852 {
853 Ptr<ComponentCarrierUe> cc = CreateObject<ComponentCarrierUe>();
854 cc->SetUlBandwidth(it->second.GetUlBandwidth());
855 cc->SetDlBandwidth(it->second.GetDlBandwidth());
856 cc->SetDlEarfcn(it->second.GetDlEarfcn());
857 cc->SetUlEarfcn(it->second.GetUlEarfcn());
858 cc->SetAsPrimary(it->second.IsPrimary());
859 Ptr<LteUeMac> mac = CreateObject<LteUeMac>();
860 cc->SetMac(mac);
861 // cc->GetPhy ()->Initialize (); // it is initialized within the
862 // LteUeNetDevice::DoInitialize ()
863 ueCcMap.insert(std::pair<uint8_t, Ptr<ComponentCarrierUe>>(it->first, cc));
864 }
865 // CC map is not needed anymore
867
868 for (auto it = ueCcMap.begin(); it != ueCcMap.end(); ++it)
869 {
870 Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy>();
871 Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy>();
872
873 Ptr<LteUePhy> phy = CreateObject<LteUePhy>(dlPhy, ulPhy);
874
875 Ptr<LteHarqPhy> harq = Create<LteHarqPhy>();
876 dlPhy->SetHarqPhyModule(harq);
877 ulPhy->SetHarqPhyModule(harq);
878 phy->SetHarqPhyModule(harq);
879
880 Ptr<LteChunkProcessor> pRs = Create<LteChunkProcessor>();
881 pRs->AddCallback(MakeCallback(&LteUePhy::ReportRsReceivedPower, phy));
882 dlPhy->AddRsPowerChunkProcessor(pRs);
883
884 Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor>();
885 pInterf->AddCallback(MakeCallback(&LteUePhy::ReportInterference, phy));
886 dlPhy->AddInterferenceCtrlChunkProcessor(pInterf); // for RSRQ evaluation of UE Measurements
887
888 Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor>();
889 pCtrl->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
890 dlPhy->AddCtrlSinrChunkProcessor(pCtrl);
891
892 Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor>();
893 pData->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
894 dlPhy->AddDataSinrChunkProcessor(pData);
895
897 {
898 // CQI calculation based on PDCCH for signal and PDSCH for interference
899 // NOTE: Change in pCtrl chunk processor could impact the RLF detection
900 // since it is based on CTRL SINR.
901 pCtrl->AddCallback(MakeCallback(&LteUePhy::GenerateMixedCqiReport, phy));
902 Ptr<LteChunkProcessor> pDataInterf = Create<LteChunkProcessor>();
903 pDataInterf->AddCallback(MakeCallback(&LteUePhy::ReportDataInterference, phy));
904 dlPhy->AddInterferenceDataChunkProcessor(pDataInterf);
905 }
906 else
907 {
908 // CQI calculation based on PDCCH for both signal and interference
909 pCtrl->AddCallback(MakeCallback(&LteUePhy::GenerateCtrlCqiReport, phy));
910 }
911
912 dlPhy->SetChannel(m_downlinkChannel);
913 ulPhy->SetChannel(m_uplinkChannel);
914
915 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
917 mm,
918 "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
919 dlPhy->SetMobility(mm);
920 ulPhy->SetMobility(mm);
921
922 Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create())->GetObject<AntennaModel>();
923 NS_ASSERT_MSG(antenna, "error in creating the AntennaModel object");
924 dlPhy->SetAntenna(antenna);
925 ulPhy->SetAntenna(antenna);
926
927 it->second->SetPhy(phy);
928 }
931
932 Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc>();
933 rrc->SetLteMacSapProvider(ccmUe->GetLteMacSapProvider());
934 // setting ComponentCarrierManager SAP
935 rrc->SetLteCcmRrcSapProvider(ccmUe->GetLteCcmRrcSapProvider());
936 ccmUe->SetLteCcmRrcSapUser(rrc->GetLteCcmRrcSapUser());
937 // Set number of component carriers. Note: UE CCM would also set the
938 // number of component carriers in UE RRC
939 ccmUe->SetNumberOfComponentCarriers(m_noOfCcs);
940
941 // run initializeSap to create the proper number of MAC and PHY control sap provider/users
942 rrc->InitializeSap();
943
944 if (m_useIdealRrc)
945 {
946 Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal>();
947 rrcProtocol->SetUeRrc(rrc);
948 rrc->AggregateObject(rrcProtocol);
949 rrcProtocol->SetLteUeRrcSapProvider(rrc->GetLteUeRrcSapProvider());
950 rrc->SetLteUeRrcSapUser(rrcProtocol->GetLteUeRrcSapUser());
951 }
952 else
953 {
954 Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal>();
955 rrcProtocol->SetUeRrc(rrc);
956 rrc->AggregateObject(rrcProtocol);
957 rrcProtocol->SetLteUeRrcSapProvider(rrc->GetLteUeRrcSapProvider());
958 rrc->SetLteUeRrcSapUser(rrcProtocol->GetLteUeRrcSapUser());
959 }
960
961 if (m_epcHelper)
962 {
963 rrc->SetUseRlcSm(false);
964 }
965 Ptr<EpcUeNas> nas = CreateObject<EpcUeNas>();
966
967 nas->SetAsSapProvider(rrc->GetAsSapProvider());
968 rrc->SetAsSapUser(nas->GetAsSapUser());
969
970 for (auto it = ueCcMap.begin(); it != ueCcMap.end(); ++it)
971 {
972 rrc->SetLteUeCmacSapProvider(it->second->GetMac()->GetLteUeCmacSapProvider(), it->first);
973 it->second->GetMac()->SetLteUeCmacSapUser(rrc->GetLteUeCmacSapUser(it->first));
974 it->second->GetMac()->SetComponentCarrierId(it->first);
975
976 it->second->GetPhy()->SetLteUeCphySapUser(rrc->GetLteUeCphySapUser(it->first));
977 rrc->SetLteUeCphySapProvider(it->second->GetPhy()->GetLteUeCphySapProvider(), it->first);
978 it->second->GetPhy()->SetComponentCarrierId(it->first);
979 it->second->GetPhy()->SetLteUePhySapUser(it->second->GetMac()->GetLteUePhySapUser());
980 it->second->GetMac()->SetLteUePhySapProvider(
981 it->second->GetPhy()->GetLteUePhySapProvider());
982
983 bool ccmTest =
984 ccmUe->SetComponentCarrierMacSapProviders(it->first,
985 it->second->GetMac()->GetLteMacSapProvider());
986
987 if (!ccmTest)
988 {
989 NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders");
990 }
991 }
992
993 NS_ABORT_MSG_IF(m_imsiCounter >= 0xFFFFFFFF, "max num UEs exceeded");
994 uint64_t imsi = ++m_imsiCounter;
995
996 dev->SetNode(n);
997 dev->SetAttribute("Imsi", UintegerValue(imsi));
998 dev->SetCcMap(ueCcMap);
999 dev->SetAttribute("LteUeRrc", PointerValue(rrc));
1000 dev->SetAttribute("EpcUeNas", PointerValue(nas));
1001 dev->SetAttribute("LteUeComponentCarrierManager", PointerValue(ccmUe));
1002 // \todo The UE identifier should be dynamically set by the EPC
1003 // when the default PDP context is created. This is a simplification.
1004 dev->SetAddress(Mac64Address::Allocate());
1005
1006 for (auto it = ueCcMap.begin(); it != ueCcMap.end(); ++it)
1007 {
1008 Ptr<LteUePhy> ccPhy = it->second->GetPhy();
1009 ccPhy->SetDevice(dev);
1010 ccPhy->GetUlSpectrumPhy()->SetDevice(dev);
1011 ccPhy->GetDlSpectrumPhy()->SetDevice(dev);
1012 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxDataEndOkCallback(
1014 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxCtrlEndOkCallback(
1016 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxPssCallback(
1018 ccPhy->GetDlSpectrumPhy()->SetLtePhyDlHarqFeedbackCallback(
1020 }
1021
1022 nas->SetDevice(dev);
1023
1024 n->AddDevice(dev);
1025
1026 nas->SetForwardUpCallback(MakeCallback(&LteUeNetDevice::Receive, dev));
1027
1028 if (m_epcHelper)
1029 {
1030 m_epcHelper->AddUe(dev, dev->GetImsi());
1031 }
1032
1033 dev->Initialize();
1034
1035 return dev;
1036}
1037
1038void
1040{
1041 NS_LOG_FUNCTION(this);
1042 for (auto i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1043 {
1044 Attach(*i);
1045 }
1046}
1047
1048void
1050{
1051 NS_LOG_FUNCTION(this);
1052
1053 if (!m_epcHelper)
1054 {
1055 NS_FATAL_ERROR("This function is not valid without properly configured EPC");
1056 }
1057
1058 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
1059 if (!ueLteDevice)
1060 {
1061 NS_FATAL_ERROR("The passed NetDevice must be an LteUeNetDevice");
1062 }
1063
1064 // initiate cell selection
1065 Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas();
1066 NS_ASSERT(ueNas);
1067 uint32_t dlEarfcn = ueLteDevice->GetDlEarfcn();
1068 ueNas->StartCellSelection(dlEarfcn);
1069
1070 // instruct UE to immediately enter CONNECTED mode after camping
1071 ueNas->Connect();
1072
1073 // activate default EPS bearer
1074 m_epcHelper->ActivateEpsBearer(ueDevice,
1075 ueLteDevice->GetImsi(),
1078}
1079
1080void
1082{
1083 NS_LOG_FUNCTION(this);
1084 for (auto i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1085 {
1086 Attach(*i, enbDevice);
1087 }
1088}
1089
1090void
1091LteHelper::Attach(Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice, uint8_t componentCarrierId)
1092{
1093 NS_LOG_FUNCTION(this);
1094 // enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
1095
1096 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
1097 Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice>();
1098
1099 Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas();
1100 Ptr<ComponentCarrierEnb> componentCarrier =
1101 DynamicCast<ComponentCarrierEnb>(enbLteDevice->GetCcMap().at(componentCarrierId));
1102 ueNas->Connect(componentCarrier->GetCellId(), componentCarrier->GetDlEarfcn());
1103
1104 if (m_epcHelper)
1105 {
1106 // activate default EPS bearer
1107 m_epcHelper->ActivateEpsBearer(ueDevice,
1108 ueLteDevice->GetImsi(),
1111 }
1112
1113 // tricks needed for the simplified LTE-only simulations
1114 if (!m_epcHelper)
1115 {
1116 ueDevice->GetObject<LteUeNetDevice>()->SetTargetEnb(
1117 enbDevice->GetObject<LteEnbNetDevice>());
1118 }
1119}
1120
1121void
1123{
1124 NS_LOG_FUNCTION(this);
1125 for (auto i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1126 {
1127 AttachToClosestEnb(*i, enbDevices);
1128 }
1129}
1130
1131void
1133{
1134 NS_LOG_FUNCTION(this);
1135 NS_ASSERT_MSG(enbDevices.GetN() > 0, "empty enb device container");
1136 Vector uepos = ueDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
1137 double minDistance = std::numeric_limits<double>::infinity();
1138 Ptr<NetDevice> closestEnbDevice;
1139 for (auto i = enbDevices.Begin(); i != enbDevices.End(); ++i)
1140 {
1141 Vector enbpos = (*i)->GetNode()->GetObject<MobilityModel>()->GetPosition();
1142 double distance = CalculateDistance(uepos, enbpos);
1143 if (distance < minDistance)
1144 {
1145 minDistance = distance;
1146 closestEnbDevice = *i;
1147 }
1148 }
1149 NS_ASSERT(closestEnbDevice);
1150 Attach(ueDevice, closestEnbDevice);
1151}
1152
1153uint8_t
1155 EpsBearer bearer,
1156 Ptr<EpcTft> tft)
1157{
1158 NS_LOG_FUNCTION(this);
1159 for (auto i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1160 {
1161 uint8_t bearerId = ActivateDedicatedEpsBearer(*i, bearer, tft);
1162 return bearerId;
1163 }
1164 return 0;
1165}
1166
1167uint8_t
1169{
1170 NS_LOG_FUNCTION(this);
1171
1172 NS_ASSERT_MSG(m_epcHelper, "dedicated EPS bearers cannot be set up when the EPC is not used");
1173
1174 uint64_t imsi = ueDevice->GetObject<LteUeNetDevice>()->GetImsi();
1175 uint8_t bearerId = m_epcHelper->ActivateEpsBearer(ueDevice, imsi, tft, bearer);
1176 return bearerId;
1177}
1178
1179/**
1180 * \ingroup lte
1181 *
1182 * DrbActivatior allows user to activate bearers for UEs
1183 * when EPC is not used. Activation function is hooked to
1184 * the Enb RRC Connection Established trace source. When
1185 * UE change its RRC state to CONNECTED_NORMALLY, activation
1186 * function is called and bearer is activated.
1187 */
1188class DrbActivator : public SimpleRefCount<DrbActivator>
1189{
1190 public:
1191 /**
1192 * DrbActivator Constructor
1193 *
1194 * \param ueDevice the UeNetDevice for which bearer will be activated
1195 * \param bearer the bearer configuration
1196 */
1197 DrbActivator(Ptr<NetDevice> ueDevice, EpsBearer bearer);
1198
1199 /**
1200 * Function hooked to the Enb RRC Connection Established trace source
1201 * Fired upon successful RRC connection establishment.
1202 *
1203 * \param a DrbActivator object
1204 * \param context
1205 * \param imsi
1206 * \param cellId
1207 * \param rnti
1208 */
1209 static void ActivateCallback(Ptr<DrbActivator> a,
1210 std::string context,
1211 uint64_t imsi,
1212 uint16_t cellId,
1213 uint16_t rnti);
1214
1215 /**
1216 * Procedure firstly checks if bearer was not activated, if IMSI
1217 * from trace source equals configured one and if UE is really
1218 * in RRC connected state. If all requirements are met, it performs
1219 * bearer activation.
1220 *
1221 * \param imsi
1222 * \param cellId
1223 * \param rnti
1224 */
1225 void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti);
1226
1227 private:
1228 /**
1229 * Bearer can be activated only once. This value stores state of
1230 * bearer. Initially is set to false and changed to true during
1231 * bearer activation.
1232 */
1234 /**
1235 * UeNetDevice for which bearer will be activated
1236 */
1238 /**
1239 * Configuration of bearer which will be activated
1240 */
1242 /**
1243 * imsi the unique UE identifier
1244 */
1245 uint64_t m_imsi;
1246};
1247
1249 : m_active(false),
1250 m_ueDevice(ueDevice),
1251 m_bearer(bearer),
1252 m_imsi(m_ueDevice->GetObject<LteUeNetDevice>()->GetImsi())
1253{
1254}
1255
1256void
1258 std::string context,
1259 uint64_t imsi,
1260 uint16_t cellId,
1261 uint16_t rnti)
1262{
1263 NS_LOG_FUNCTION(a << context << imsi << cellId << rnti);
1264 a->ActivateDrb(imsi, cellId, rnti);
1265}
1266
1267void
1268DrbActivator::ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
1269{
1270 NS_LOG_FUNCTION(this << imsi << cellId << rnti << m_active);
1271 if ((!m_active) && (imsi == m_imsi))
1272 {
1273 Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice>()->GetRrc();
1274 NS_ASSERT(ueRrc->GetState() == LteUeRrc::CONNECTED_NORMALLY);
1275 uint16_t rnti = ueRrc->GetRnti();
1276 Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice>()->GetTargetEnb();
1277 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice>()->GetRrc();
1278 NS_ASSERT(ueRrc->GetCellId() == enbLteDevice->GetCellId());
1279 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
1280 NS_ASSERT(ueManager->GetState() == UeManager::CONNECTED_NORMALLY ||
1281 ueManager->GetState() == UeManager::CONNECTION_RECONFIGURATION);
1283 params.rnti = rnti;
1284 params.bearer = m_bearer;
1285 params.bearerId = 0;
1286 params.gtpTeid = 0; // don't care
1287 enbRrc->GetS1SapUser()->DataRadioBearerSetupRequest(params);
1288 m_active = true;
1289 }
1290}
1291
1292void
1294{
1295 NS_LOG_FUNCTION(this << ueDevice);
1296 NS_ASSERT_MSG(!m_epcHelper, "this method must not be used when the EPC is being used");
1297
1298 // Normally it is the EPC that takes care of activating DRBs
1299 // when the UE gets connected. When the EPC is not used, we achieve
1300 // the same behavior by hooking a dedicated DRB activation function
1301 // to the Enb RRC Connection Established trace source
1302
1303 Ptr<LteEnbNetDevice> enbLteDevice = ueDevice->GetObject<LteUeNetDevice>()->GetTargetEnb();
1304
1305 std::ostringstream path;
1306 path << "/NodeList/" << enbLteDevice->GetNode()->GetId() << "/DeviceList/"
1307 << enbLteDevice->GetIfIndex() << "/LteEnbRrc/ConnectionEstablished";
1308 Ptr<DrbActivator> arg = Create<DrbActivator>(ueDevice, bearer);
1310}
1311
1312void
1314{
1315 NS_LOG_FUNCTION(this);
1316
1317 NS_ASSERT_MSG(m_epcHelper, "X2 interfaces cannot be set up when the EPC is not used");
1318
1319 for (auto i = enbNodes.Begin(); i != enbNodes.End(); ++i)
1320 {
1321 for (auto j = i + 1; j != enbNodes.End(); ++j)
1322 {
1323 AddX2Interface(*i, *j);
1324 }
1325 }
1326}
1327
1328void
1330{
1331 NS_LOG_FUNCTION(this);
1332 NS_LOG_INFO("setting up the X2 interface");
1333
1334 m_epcHelper->AddX2Interface(enbNode1, enbNode2);
1335}
1336
1337void
1339 Ptr<NetDevice> ueDev,
1340 Ptr<NetDevice> sourceEnbDev,
1341 Ptr<NetDevice> targetEnbDev)
1342{
1343 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetEnbDev);
1345 "Handover requires the use of the EPC - did you forget to call "
1346 "LteHelper::SetEpcHelper () ?");
1347 uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice>()->GetCellId();
1348 Simulator::Schedule(hoTime,
1350 this,
1351 ueDev,
1352 sourceEnbDev,
1353 targetCellId);
1354}
1355
1356void
1358 Ptr<NetDevice> ueDev,
1359 Ptr<NetDevice> sourceEnbDev,
1360 uint16_t targetCellId)
1361{
1362 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetCellId);
1364 "Handover requires the use of the EPC - did you forget to call "
1365 "LteHelper::SetEpcHelper () ?");
1366 Simulator::Schedule(hoTime,
1368 this,
1369 ueDev,
1370 sourceEnbDev,
1371 targetCellId);
1372}
1373
1374void
1376 Ptr<NetDevice> sourceEnbDev,
1377 uint16_t targetCellId)
1378{
1379 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetCellId);
1380
1381 Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice>()->GetRrc();
1382 uint16_t rnti = ueDev->GetObject<LteUeNetDevice>()->GetRrc()->GetRnti();
1383 sourceRrc->SendHandoverRequest(rnti, targetCellId);
1384}
1385
1386void
1388 Ptr<NetDevice> enbDevice,
1389 uint8_t bearerId)
1390{
1391 NS_LOG_FUNCTION(this << ueDevice << bearerId);
1393 "Dedicated EPS bearers cannot be de-activated when the EPC is not used");
1394 NS_ASSERT_MSG(bearerId != 1,
1395 "Default bearer cannot be de-activated until and unless and UE is released");
1396
1397 DoDeActivateDedicatedEpsBearer(ueDevice, enbDevice, bearerId);
1398}
1399
1400void
1402 Ptr<NetDevice> enbDevice,
1403 uint8_t bearerId)
1404{
1405 NS_LOG_FUNCTION(this << ueDevice << bearerId);
1406
1407 // Extract IMSI and rnti
1408 uint64_t imsi = ueDevice->GetObject<LteUeNetDevice>()->GetImsi();
1409 uint16_t rnti = ueDevice->GetObject<LteUeNetDevice>()->GetRrc()->GetRnti();
1410
1411 Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<LteEnbNetDevice>()->GetRrc();
1412
1413 enbRrc->DoSendReleaseDataRadioBearer(imsi, rnti, bearerId);
1414}
1415
1416void
1418 uint32_t dlEarfcn,
1419 uint16_t ulbw,
1420 uint16_t dlbw)
1421{
1422 NS_LOG_FUNCTION(this << ulEarfcn << dlEarfcn << ulbw << dlbw);
1423
1424 NS_ABORT_MSG_IF(!m_componentCarrierPhyParams.empty(), "CC map is not clean");
1425 Ptr<CcHelper> ccHelper = CreateObject<CcHelper>();
1426 ccHelper->SetNumberOfComponentCarriers(m_noOfCcs);
1427 ccHelper->SetUlEarfcn(ulEarfcn);
1428 ccHelper->SetDlEarfcn(dlEarfcn);
1429 ccHelper->SetDlBandwidth(dlbw);
1430 ccHelper->SetUlBandwidth(ulbw);
1431 m_componentCarrierPhyParams = ccHelper->EquallySpacedCcs();
1432 m_componentCarrierPhyParams.at(0).SetAsPrimary(true);
1433}
1434
1435void
1437{
1438 NS_LOG_FUNCTION(this);
1439 for (auto i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1440 {
1441 ActivateDataRadioBearer(*i, bearer);
1442 }
1443}
1444
1445void
1447{
1451 // Model directory
1452 LogComponentEnable("A2A4RsrqHandoverAlgorithm", LOG_LEVEL_ALL);
1453 LogComponentEnable("A3RsrpHandoverAlgorithm", LOG_LEVEL_ALL);
1454 LogComponentEnable("Asn1Header", LOG_LEVEL_ALL);
1455 LogComponentEnable("ComponentCarrier", LOG_LEVEL_ALL);
1456 LogComponentEnable("ComponentCarrierEnb", LOG_LEVEL_ALL);
1457 LogComponentEnable("ComponentCarrierUe", LOG_LEVEL_ALL);
1458 LogComponentEnable("CqaFfMacScheduler", LOG_LEVEL_ALL);
1459 LogComponentEnable("EpcEnbApplication", LOG_LEVEL_ALL);
1460 LogComponentEnable("EpcMmeApplication", LOG_LEVEL_ALL);
1461 LogComponentEnable("EpcPgwApplication", LOG_LEVEL_ALL);
1462 LogComponentEnable("EpcSgwApplication", LOG_LEVEL_ALL);
1464 LogComponentEnable("EpcTftClassifier", LOG_LEVEL_ALL);
1465 LogComponentEnable("EpcUeNas", LOG_LEVEL_ALL);
1467 LogComponentEnable("EpcX2Header", LOG_LEVEL_ALL);
1468 LogComponentEnable("FdBetFfMacScheduler", LOG_LEVEL_ALL);
1469 LogComponentEnable("FdMtFfMacScheduler", LOG_LEVEL_ALL);
1470 LogComponentEnable("FdTbfqFfMacScheduler", LOG_LEVEL_ALL);
1471 LogComponentEnable("FfMacScheduler", LOG_LEVEL_ALL);
1472 LogComponentEnable("GtpuHeader", LOG_LEVEL_ALL);
1475 LogComponentEnable("LteChunkProcessor", LOG_LEVEL_ALL);
1476 LogComponentEnable("LteCommon", LOG_LEVEL_ALL);
1477 LogComponentEnable("LteControlMessage", LOG_LEVEL_ALL);
1478 LogComponentEnable("LteEnbComponentCarrierManager", LOG_LEVEL_ALL);
1479 LogComponentEnable("LteEnbMac", LOG_LEVEL_ALL);
1480 LogComponentEnable("LteEnbNetDevice", LOG_LEVEL_ALL);
1481 LogComponentEnable("LteEnbPhy", LOG_LEVEL_ALL);
1482 LogComponentEnable("LteEnbRrc", LOG_LEVEL_ALL);
1483 LogComponentEnable("LteFfrAlgorithm", LOG_LEVEL_ALL);
1484 LogComponentEnable("LteFfrDistributedAlgorithm", LOG_LEVEL_ALL);
1485 LogComponentEnable("LteFfrEnhancedAlgorithm", LOG_LEVEL_ALL);
1486 LogComponentEnable("LteFfrSoftAlgorithm", LOG_LEVEL_ALL);
1487 LogComponentEnable("LteFrHardAlgorithm", LOG_LEVEL_ALL);
1488 LogComponentEnable("LteFrNoOpAlgorithm", LOG_LEVEL_ALL);
1489 LogComponentEnable("LteFrSoftAlgorithm", LOG_LEVEL_ALL);
1490 LogComponentEnable("LteFrStrictAlgorithm", LOG_LEVEL_ALL);
1491 LogComponentEnable("LteHandoverAlgorithm", LOG_LEVEL_ALL);
1492 LogComponentEnable("LteHarqPhy", LOG_LEVEL_ALL);
1493 LogComponentEnable("LteInterference", LOG_LEVEL_ALL);
1494 LogComponentEnable("LteMiErrorModel", LOG_LEVEL_ALL);
1495 LogComponentEnable("LteNetDevice", LOG_LEVEL_ALL);
1497 LogComponentEnable("LtePdcpHeader", LOG_LEVEL_ALL);
1500 LogComponentEnable("LteRlcAm", LOG_LEVEL_ALL);
1501 LogComponentEnable("LteRlcAmHeader", LOG_LEVEL_ALL);
1502 LogComponentEnable("LteRlcHeader", LOG_LEVEL_ALL);
1503 LogComponentEnable("LteRlcTm", LOG_LEVEL_ALL);
1504 LogComponentEnable("LteRlcUm", LOG_LEVEL_ALL);
1505 LogComponentEnable("LteRrcProtocolIdeal", LOG_LEVEL_ALL);
1506 LogComponentEnable("LteRrcProtocolReal", LOG_LEVEL_ALL);
1507 LogComponentEnable("LteSpectrumPhy", LOG_LEVEL_ALL);
1508 LogComponentEnable("LteSpectrumSignalParameters", LOG_LEVEL_ALL);
1509 LogComponentEnable("LteSpectrumValueHelper", LOG_LEVEL_ALL);
1510 LogComponentEnable("LteUeComponentCarrierManager", LOG_LEVEL_ALL);
1511 LogComponentEnable("LteUeMac", LOG_LEVEL_ALL);
1512 LogComponentEnable("LteUeNetDevice", LOG_LEVEL_ALL);
1513 LogComponentEnable("LteUePhy", LOG_LEVEL_ALL);
1514 LogComponentEnable("LteUePowerControl", LOG_LEVEL_ALL);
1515 LogComponentEnable("LteUeRrc", LOG_LEVEL_ALL);
1516 LogComponentEnable("LteVendorSpecificParameters", LOG_LEVEL_ALL);
1517 LogComponentEnable("NoOpComponentCarrierManager", LOG_LEVEL_ALL);
1518 LogComponentEnable("NoOpHandoverAlgorithm", LOG_LEVEL_ALL);
1519 LogComponentEnable("PfFfMacScheduler", LOG_LEVEL_ALL);
1520 LogComponentEnable("PssFfMacScheduler", LOG_LEVEL_ALL);
1521 LogComponentEnable("RemSpectrumPhy", LOG_LEVEL_ALL);
1522 LogComponentEnable("RrcHeader", LOG_LEVEL_ALL);
1523 LogComponentEnable("RrFfMacScheduler", LOG_LEVEL_ALL);
1524 LogComponentEnable("SimpleUeComponentCarrierManager", LOG_LEVEL_ALL);
1525 LogComponentEnable("TdBetFfMacScheduler", LOG_LEVEL_ALL);
1526 LogComponentEnable("TdMtFfMacScheduler", LOG_LEVEL_ALL);
1527 LogComponentEnable("TdTbfqFfMacScheduler", LOG_LEVEL_ALL);
1528 LogComponentEnable("TraceFadingLossModel", LOG_LEVEL_ALL);
1529 LogComponentEnable("TtaFfMacScheduler", LOG_LEVEL_ALL);
1530 // Helper directory
1531 LogComponentEnable("CcHelper", LOG_LEVEL_ALL);
1532 LogComponentEnable("EmuEpcHelper", LOG_LEVEL_ALL);
1533 LogComponentEnable("EpcHelper", LOG_LEVEL_ALL);
1534 LogComponentEnable("LteGlobalPathlossDatabase", LOG_LEVEL_ALL);
1535 LogComponentEnable("LteHelper", LOG_LEVEL_ALL);
1536 LogComponentEnable("LteHexGridEnbTopologyHelper", LOG_LEVEL_ALL);
1537 LogComponentEnable("LteStatsCalculator", LOG_LEVEL_ALL);
1538 LogComponentEnable("MacStatsCalculator", LOG_LEVEL_ALL);
1539 LogComponentEnable("PhyRxStatsCalculator", LOG_LEVEL_ALL);
1540 LogComponentEnable("PhyStatsCalculator", LOG_LEVEL_ALL);
1541 LogComponentEnable("PhyTxStatsCalculator", LOG_LEVEL_ALL);
1542 LogComponentEnable("PointToPointEpcHelper", LOG_LEVEL_ALL);
1543 LogComponentEnable("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
1544 LogComponentEnable("RadioBearerStatsConnector", LOG_LEVEL_ALL);
1545 LogComponentEnable("RadioEnvironmentMapHelper", LOG_LEVEL_ALL);
1546}
1547
1548void
1550{
1555}
1556
1557void
1559{
1561 "please make sure that LteHelper::EnableRlcTraces is called at most once");
1562 m_rlcStats = CreateObject<RadioBearerStatsCalculator>("RLC");
1564}
1565
1566int64_t
1568{
1569 int64_t currentStream = stream;
1571 {
1573 if (tflm)
1574 {
1575 currentStream += tflm->AssignStreams(currentStream);
1577 }
1578 }
1579 Ptr<NetDevice> netDevice;
1580 for (auto i = c.Begin(); i != c.End(); ++i)
1581 {
1582 netDevice = (*i);
1583 Ptr<LteEnbNetDevice> lteEnb = DynamicCast<LteEnbNetDevice>(netDevice);
1584 if (lteEnb)
1585 {
1586 std::map<uint8_t, Ptr<ComponentCarrierBaseStation>> tmpMap = lteEnb->GetCcMap();
1587 auto it = tmpMap.begin();
1588 Ptr<LteSpectrumPhy> dlPhy =
1589 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetDownlinkSpectrumPhy();
1590 Ptr<LteSpectrumPhy> ulPhy =
1591 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetUplinkSpectrumPhy();
1592 currentStream += dlPhy->AssignStreams(currentStream);
1593 currentStream += ulPhy->AssignStreams(currentStream);
1594 }
1595 Ptr<LteUeNetDevice> lteUe = DynamicCast<LteUeNetDevice>(netDevice);
1596 if (lteUe)
1597 {
1598 std::map<uint8_t, Ptr<ComponentCarrierUe>> tmpMap = lteUe->GetCcMap();
1599 auto it = tmpMap.begin();
1600 Ptr<LteSpectrumPhy> dlPhy = it->second->GetPhy()->GetDownlinkSpectrumPhy();
1601 Ptr<LteSpectrumPhy> ulPhy = it->second->GetPhy()->GetUplinkSpectrumPhy();
1602 Ptr<LteUeMac> ueMac = lteUe->GetMac();
1603 currentStream += dlPhy->AssignStreams(currentStream);
1604 currentStream += ulPhy->AssignStreams(currentStream);
1605 currentStream += ueMac->AssignStreams(currentStream);
1606 }
1607 }
1608 if (m_epcHelper)
1609 {
1610 currentStream += m_epcHelper->AssignStreams(currentStream);
1611 }
1612 return (currentStream - stream);
1613}
1614
1615void
1617{
1624}
1625
1626void
1628{
1630 "/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/DlPhyTransmission",
1632}
1633
1634void
1636{
1638 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/UlPhyTransmission",
1640}
1641
1642void
1644{
1646 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1648}
1649
1650void
1652{
1654 "/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1656}
1657
1658void
1660{
1663}
1664
1665void
1667{
1669 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/DlScheduling",
1671}
1672
1673void
1675{
1677 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/UlScheduling",
1679}
1680
1681void
1683{
1686 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/ReportCurrentCellRsrpSinr",
1688}
1689
1690void
1692{
1694 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportUeSinr",
1696 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportInterference",
1698}
1699
1702{
1703 return m_rlcStats;
1704}
1705
1706void
1708{
1710 "please make sure that LteHelper::EnablePdcpTraces is called at most once");
1711 m_pdcpStats = CreateObject<RadioBearerStatsCalculator>("PDCP");
1713}
1714
1717{
1718 return m_pdcpStats;
1719}
1720
1721} // namespace ns3
Hold a value for an Attribute.
Definition: attribute.h:70
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
DrbActivatior allows user to activate bearers for UEs when EPC is not used.
Definition: lte-helper.cc:1189
EpsBearer m_bearer
Configuration of bearer which will be activated.
Definition: lte-helper.cc:1241
uint64_t m_imsi
imsi the unique UE identifier
Definition: lte-helper.cc:1245
DrbActivator(Ptr< NetDevice > ueDevice, EpsBearer bearer)
DrbActivator Constructor.
Definition: lte-helper.cc:1248
static void ActivateCallback(Ptr< DrbActivator > a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Function hooked to the Enb RRC Connection Established trace source Fired upon successful RRC connecti...
Definition: lte-helper.cc:1257
Ptr< NetDevice > m_ueDevice
UeNetDevice for which bearer will be activated.
Definition: lte-helper.cc:1237
void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
Procedure firstly checks if bearer was not activated, if IMSI from trace source equals configured one...
Definition: lte-helper.cc:1268
bool m_active
Bearer can be activated only once.
Definition: lte-helper.cc:1233
Hold variables of type enum.
Definition: enum.h:62
T Get() const
Definition: enum.h:97
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition: epc-tft.cc:229
This entity is installed inside an eNB and provides the functionality for the X2 interface.
Definition: epc-x2.h:99
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
Definition: eps-bearer.h:126
This abstract base class identifies the interface by means of which the helper object can plug on the...
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
The class implements Component Carrier Manager (CCM) that operates using the Component Carrier Manage...
The eNodeB device implementation.
static TypeId GetTypeId()
Get the type ID.
virtual void ReportUlHarqFeedback(UlInfoListElement_s mes)
Report the uplink HARQ feedback generated by LteSpectrumPhy to MAC.
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:822
void GenerateDataCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
Definition: lte-enb-phy.cc:834
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:425
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:523
void ReportInterference(const SpectrumValue &interf) override
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-enb-phy.cc:842
The abstract base class of a Frequency Reuse algorithm.
The abstract base class of a handover algorithm that operates using the Handover Management SAP inter...
void SetFfrAlgorithmType(std::string type)
Set the type of FFR algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:319
Ptr< SpectrumPropagationLossModel > m_fadingModel
The fading model used in both the downlink and uplink channels.
Definition: lte-helper.h:785
Ptr< Object > m_uplinkPathlossModel
The path loss model used in the uplink channel.
Definition: lte-helper.h:755
void EnableLogComponents()
Enables full-blown logging for major components of the LENA architecture.
Definition: lte-helper.cc:1446
Ptr< SpectrumChannel > GetUplinkSpectrumChannel() const
Definition: lte-helper.cc:218
void SetEnbComponentCarrierManagerType(std::string type)
Set the type of carrier component algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:361
void EnableUlRxPhyTraces()
Enable trace sinks for UL reception PHY layer.
Definition: lte-helper.cc:1651
ObjectFactory m_schedulerFactory
Factory of MAC scheduler object.
Definition: lte-helper.h:758
void SetUeAntennaModelType(std::string type)
Set the type of antenna model to be used by UE devices.
Definition: lte-helper.cc:440
ObjectFactory m_ffrAlgorithmFactory
Factory of FFR (frequency reuse) algorithm object.
Definition: lte-helper.h:760
ObjectFactory m_channelFactory
Factory of both the downlink and uplink LTE channels.
Definition: lte-helper.h:778
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:285
Ptr< RadioBearerStatsCalculator > GetRlcStats()
Definition: lte-helper.cc:1701
ObjectFactory m_handoverAlgorithmFactory
Factory of handover algorithm object.
Definition: lte-helper.h:762
std::string m_fadingModelType
Name of fading model type, e.g., "ns3::TraceFadingLossModel".
Definition: lte-helper.h:781
Ptr< RadioBearerStatsCalculator > GetPdcpStats()
Definition: lte-helper.cc:1716
void EnableDlMacTraces()
Enable trace sinks for DL MAC layer.
Definition: lte-helper.cc:1666
ObjectFactory m_enbComponentCarrierManagerFactory
Factory of enb component carrier manager object.
Definition: lte-helper.h:764
void SetFadingModel(std::string type)
Set the type of fading model to be used in both DL and UL.
Definition: lte-helper.cc:454
void DoDeActivateDedicatedEpsBearer(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice, uint8_t bearerId)
The actual function to trigger a manual bearer de-activation.
Definition: lte-helper.cc:1401
std::string GetEnbComponentCarrierManagerType() const
Definition: lte-helper.cc:355
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:306
Ptr< SpectrumChannel > GetDownlinkSpectrumChannel() const
Definition: lte-helper.cc:224
~LteHelper() override
Definition: lte-helper.cc:105
std::map< uint8_t, ComponentCarrier > m_componentCarrierPhyParams
This contains all the information about each component carrier.
Definition: lte-helper.h:855
Ptr< MacStatsCalculator > m_macStats
Container of MAC layer statistics.
Definition: lte-helper.h:799
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the handover algorithm to be created.
Definition: lte-helper.cc:348
void EnablePhyTraces()
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1616
void DeActivateDedicatedEpsBearer(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice, uint8_t bearerId)
Manually trigger dedicated bearer de-activation at specific simulation time.
Definition: lte-helper.cc:1387
void HandoverRequest(Time hoTime, Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
Manually trigger an X2-based handover.
Definition: lte-helper.cc:1338
Ptr< SpectrumChannel > m_downlinkChannel
This function create the component carrier based on provided configuration parameters.
Definition: lte-helper.h:749
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:485
void SetUeComponentCarrierManagerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the ue component carrier manager to be created.
Definition: lte-helper.cc:390
uint16_t m_cellIdCounter
Keep track of the number of cell ID allocated.
Definition: lte-helper.h:825
std::string GetFfrAlgorithmType() const
Definition: lte-helper.cc:313
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:340
void SetPathlossModelType(TypeId type)
Set the type of path loss model to be used for both DL and UL channels.
Definition: lte-helper.cc:397
void EnablePdcpTraces()
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1707
Ptr< PhyTxStatsCalculator > m_phyTxStats
Container of PHY layer statistics related to transmission.
Definition: lte-helper.h:795
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
Definition: lte-helper.cc:419
void EnableTraces()
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1549
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
Definition: lte-helper.cc:327
void DoHandoverRequest(Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, uint16_t targetCellId)
The actual function to trigger a manual handover.
Definition: lte-helper.cc:1375
bool m_isAnrEnabled
The AnrEnabled attribute.
Definition: lte-helper.h:836
void SetEnbComponentCarrierManagerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the enb component carrier manager to be created.
Definition: lte-helper.cc:369
void DoInitialize() override
Initialize() implementation.
Definition: lte-helper.cc:94
Ptr< PhyRxStatsCalculator > m_phyRxStats
Container of PHY layer statistics related to reception.
Definition: lte-helper.h:797
void SetSpectrumChannelType(std::string type)
Set the type of spectrum channel to be used in both DL and UL.
Definition: lte-helper.cc:472
void EnableDlRxPhyTraces()
Enable trace sinks for DL reception PHY layer.
Definition: lte-helper.cc:1643
ObjectFactory m_pathlossModelFactory
Factory of path loss model object.
Definition: lte-helper.h:776
bool m_fadingStreamsAssigned
True if a random variable stream number has been assigned for the fading model.
Definition: lte-helper.h:790
std::string GetUeComponentCarrierManagerType() const
Definition: lte-helper.cc:376
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:292
RadioBearerStatsConnector m_radioBearerStatsConnector
Connects RLC and PDCP statistics containers to appropriate trace sources.
Definition: lte-helper.h:805
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:1039
void DoDispose() override
Destructor implementation.
Definition: lte-helper.cc:208
ObjectFactory m_enbNetDeviceFactory
Factory of LteEnbNetDevice objects.
Definition: lte-helper.h:768
void EnableUlMacTraces()
Enable trace sinks for UL MAC layer.
Definition: lte-helper.cc:1674
std::string GetHandoverAlgorithmType() const
Definition: lte-helper.cc:334
Ptr< PhyStatsCalculator > m_phyStats
Container of PHY layer statistics.
Definition: lte-helper.h:793
void EnableUlPhyTraces()
Enable trace sinks for UL PHY layer.
Definition: lte-helper.cc:1691
void EnableDlTxPhyTraces()
Enable trace sinks for DL transmission PHY layer.
Definition: lte-helper.cc:1627
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:405
void EnableRlcTraces()
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1558
bool m_useIdealRrc
The UseIdealRrc attribute.
Definition: lte-helper.h:831
ObjectFactory m_ueComponentCarrierManagerFactory
Factory of ue component carrier manager object.
Definition: lte-helper.h:766
void DoComponentCarrierConfigure(uint32_t ulEarfcn, uint32_t dlEarfcn, uint16_t ulbw, uint16_t dlbw)
Configure the component carriers.
Definition: lte-helper.cc:1417
Ptr< Object > m_downlinkPathlossModel
The path loss model used in the downlink channel.
Definition: lte-helper.h:753
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Container of PDCP layer statistics.
Definition: lte-helper.h:803
void ChannelModelInitialization()
Function that performs a channel model initialization of all component carriers.
Definition: lte-helper.cc:230
void EnableUlTxPhyTraces()
Enable trace sinks for UL transmission PHY layer.
Definition: lte-helper.cc:1635
bool m_usePdschForCqiGeneration
The UsePdschForCqiGeneration attribute.
Definition: lte-helper.h:842
void SetUeAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE antenna model to be created.
Definition: lte-helper.cc:447
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
Definition: lte-helper.cc:426
static TypeId GetTypeId()
Register this type.
Definition: lte-helper.cc:111
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:412
bool m_useCa
The UseCa attribute.
Definition: lte-helper.h:850
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1436
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:500
uint64_t m_imsiCounter
Keep track of the number of IMSI allocated.
Definition: lte-helper.h:819
ObjectFactory m_ueNetDeviceFactory
Factory for LteUeNetDevice objects.
Definition: lte-helper.h:772
ObjectFactory m_ueAntennaModelFactory
Factory of antenna object for UE.
Definition: lte-helper.h:774
Ptr< SpectrumChannel > m_uplinkChannel
The uplink LTE channel used in the simulation.
Definition: lte-helper.h:751
void EnableMacTraces()
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1659
void SetSpectrumChannelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the spectrum channel to be created (both DL and UL).
Definition: lte-helper.cc:479
void EnableDlPhyTraces()
Enable trace sinks for DL PHY layer.
Definition: lte-helper.cc:1682
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1313
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE devices (LteUeNetDevice) to be created.
Definition: lte-helper.cc:433
uint16_t m_noOfCcs
Number of component carriers that will be installed by default at eNodeB and UE devices.
Definition: lte-helper.h:860
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
Definition: lte-helper.cc:1567
void SetFadingModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the fading model to be created (both DL and UL).
Definition: lte-helper.cc:466
Ptr< EpcHelper > m_epcHelper
Helper which provides implementation of core network.
Definition: lte-helper.h:812
void AttachToClosestEnb(NetDeviceContainer ueDevices, NetDeviceContainer enbDevices)
Manual attachment of a set of UE devices to the network via the closest eNodeB (with respect to dista...
Definition: lte-helper.cc:1122
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:1154
ObjectFactory m_enbAntennaModelFactory
Factory of antenna object for eNodeB.
Definition: lte-helper.h:770
Ptr< RadioBearerStatsCalculator > m_rlcStats
Container of RLC layer statistics.
Definition: lte-helper.h:801
std::string GetSchedulerType() const
Definition: lte-helper.cc:300
Ptr< NetDevice > InstallSingleUeDevice(Ptr< Node > n)
Create a UE device (LteUeNetDevice) on the given node.
Definition: lte-helper.cc:832
Ptr< NetDevice > InstallSingleEnbDevice(Ptr< Node > n)
Create an eNodeB device (LteEnbNetDevice) on the given node.
Definition: lte-helper.cc:514
void SetUeComponentCarrierManagerType(std::string type)
Set the type of Component Carrier Manager to be used by Ue devices.
Definition: lte-helper.cc:382
ObjectFactory m_fadingModelFactory
Factory of fading model object for both the downlink and uplink channels.
Definition: lte-helper.h:783
void Receive(Ptr< Packet > p)
receive a packet from the lower layers in order to forward it to the upper layers
void UpdateSinrPerceived(const SpectrumValue &sinr)
static double GetCarrierFrequency(uint32_t earfcn)
Calculates the carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARFCN) acc...
The abstract base class of a Component Carrier Manager* for UE that operates using the component carr...
The LteUeNetDevice class implements the UE net device.
static TypeId GetTypeId()
Get the type ID.
virtual void ReportDataInterference(const SpectrumValue &interf)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:801
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Receive PSS function.
Definition: lte-ue-phy.cc:1185
void ReportRsReceivedPower(const SpectrumValue &power) override
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
Definition: lte-ue-phy.cc:810
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
Receive LTE control message list function.
Definition: lte-ue-phy.cc:1025
void GenerateCtrlCqiReport(const SpectrumValue &sinr) override
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:544
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:492
virtual void EnqueueDlHarqFeedback(DlInfoListElement_s mes)
Enqueue the downlink HARQ feedback generated by LteSpectrumPhy.
Definition: lte-ue-phy.cc:1749
void ReportInterference(const SpectrumValue &interf) override
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-ue-phy.cc:793
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:727
static Mac64Address Allocate()
Allocate a new Mac64Address.
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
static void UlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t size, uint8_t componentCarrierId)
Trace sink for the ns3::LteEnbMac::UlScheduling trace source.
Keep track of the current position and velocity of an object.
static TypeId GetTypeId()
Get the type ID.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
Definition: object-base.cc:234
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
TypeId GetTypeId() const
Get the TypeId which will be created by this ObjectFactory.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Definition: object.h:89
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:214
friend class ObjectFactory
Friends.
Definition: object.h:368
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:522
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:451
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:444
static void UlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
static void DlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
Notifies the stats calculator that an UE SINR report has occurred.
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
trace sink
static void DlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
static void UlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
AttributeValue implementation for Pointer.
Definition: pointer.h:48
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Enables trace sinks for PDCP layer.
void EnableRlcStats(Ptr< RadioBearerStatsCalculator > rlcStats)
Enables trace sinks for RLC layer.
A template-based reference counting class.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
Defines the interface for spectrum-aware channel implementations.
spectrum-aware propagation loss model
Hold variables of type string.
Definition: string.h:56
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
fading loss model based on precalculated fading traces
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
std::string GetName() const
Get the name.
Definition: type-id.cc:992
AttributeValue implementation for TypeId.
Definition: type-id.h:598
@ CONNECTION_RECONFIGURATION
Definition: lte-enb-rrc.h:84
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:81
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeChecker > MakeStringChecker()
Definition: string.cc:30
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Definition: string.h:57
Ptr< const AttributeChecker > MakeTypeIdChecker()
Definition: type-id.cc:1251
Ptr< const AttributeAccessor > MakeTypeIdAccessor(T1 a1)
Definition: type-id.h:598
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:978
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#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:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:767
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
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:302
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:706
constexpr uint32_t MIN_NO_CC
Minimum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:36
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39
@ 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
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:109
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:320
Parameters passed to DataRadioBearerSetupRequest ()