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