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 (NodeContainer::Iterator 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 (NodeContainer::Iterator 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 (std::map<uint8_t, ComponentCarrier>::iterator it = m_componentCarrierPhyParams.begin();
535 it != m_componentCarrierPhyParams.end();
536 ++it)
537 {
538 Ptr<ComponentCarrierEnb> cc = CreateObject<ComponentCarrierEnb>();
539 cc->SetUlBandwidth(it->second.GetUlBandwidth());
540 cc->SetDlBandwidth(it->second.GetDlBandwidth());
541 cc->SetDlEarfcn(it->second.GetDlEarfcn());
542 cc->SetUlEarfcn(it->second.GetUlEarfcn());
543 cc->SetAsPrimary(it->second.IsPrimary());
544 NS_ABORT_MSG_IF(m_cellIdCounter == 65535, "max num cells exceeded");
545 cc->SetCellId(m_cellIdCounter++);
546 ccMap[it->first] = cc;
547 }
548 // CC map is not needed anymore
550
551 NS_ABORT_MSG_IF(m_useCa && ccMap.size() < 2,
552 "You have to either specify carriers or disable carrier aggregation");
553 NS_ASSERT(ccMap.size() == m_noOfCcs);
554
555 for (auto it = ccMap.begin(); it != ccMap.end(); ++it)
556 {
557 NS_LOG_DEBUG(this << "component carrier map size " << (uint16_t)ccMap.size());
558 Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy>();
559 Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy>();
560 Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy>(dlPhy, ulPhy);
561
562 Ptr<LteHarqPhy> harq = Create<LteHarqPhy>();
563 dlPhy->SetHarqPhyModule(harq);
564 ulPhy->SetHarqPhyModule(harq);
565 phy->SetHarqPhyModule(harq);
566
567 Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor>();
568 pCtrl->AddCallback(MakeCallback(&LteEnbPhy::GenerateCtrlCqiReport, phy));
569 ulPhy->AddCtrlSinrChunkProcessor(pCtrl); // for evaluating SRS UL-CQI
570
571 Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor>();
572 pData->AddCallback(MakeCallback(&LteEnbPhy::GenerateDataCqiReport, phy));
573 pData->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, ulPhy));
574 ulPhy->AddDataSinrChunkProcessor(pData); // for evaluating PUSCH UL-CQI
575
576 Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor>();
577 pInterf->AddCallback(MakeCallback(&LteEnbPhy::ReportInterference, phy));
578 ulPhy->AddInterferenceDataChunkProcessor(pInterf); // for interference power tracing
579
580 dlPhy->SetChannel(m_downlinkChannel);
581 ulPhy->SetChannel(m_uplinkChannel);
582
583 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
585 mm,
586 "MobilityModel needs to be set on node before calling LteHelper::InstallEnbDevice ()");
587 dlPhy->SetMobility(mm);
588 ulPhy->SetMobility(mm);
589
590 Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create())->GetObject<AntennaModel>();
591 NS_ASSERT_MSG(antenna, "error in creating the AntennaModel object");
592 dlPhy->SetAntenna(antenna);
593 ulPhy->SetAntenna(antenna);
594
595 Ptr<LteEnbMac> mac = CreateObject<LteEnbMac>();
598 DynamicCast<ComponentCarrierEnb>(it->second)->SetMac(mac);
599 DynamicCast<ComponentCarrierEnb>(it->second)->SetFfMacScheduler(sched);
600 DynamicCast<ComponentCarrierEnb>(it->second)->SetFfrAlgorithm(ffrAlgorithm);
601 DynamicCast<ComponentCarrierEnb>(it->second)->SetPhy(phy);
602 }
603
604 Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc>();
607
608 // ComponentCarrierManager SAP
609 rrc->SetLteCcmRrcSapProvider(ccmEnbManager->GetLteCcmRrcSapProvider());
610 ccmEnbManager->SetLteCcmRrcSapUser(rrc->GetLteCcmRrcSapUser());
611 // Set number of component carriers. Note: eNB CCM would also set the
612 // number of component carriers in eNB RRC
613 ccmEnbManager->SetNumberOfComponentCarriers(m_noOfCcs);
614
615 rrc->ConfigureCarriers(ccMap);
616
617 if (m_useIdealRrc)
618 {
619 Ptr<LteEnbRrcProtocolIdeal> rrcProtocol = CreateObject<LteEnbRrcProtocolIdeal>();
620 rrcProtocol->SetLteEnbRrcSapProvider(rrc->GetLteEnbRrcSapProvider());
621 rrc->SetLteEnbRrcSapUser(rrcProtocol->GetLteEnbRrcSapUser());
622 rrc->AggregateObject(rrcProtocol);
623 rrcProtocol->SetCellId(cellId);
624 }
625 else
626 {
627 Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal>();
628 rrcProtocol->SetLteEnbRrcSapProvider(rrc->GetLteEnbRrcSapProvider());
629 rrc->SetLteEnbRrcSapUser(rrcProtocol->GetLteEnbRrcSapUser());
630 rrc->AggregateObject(rrcProtocol);
631 rrcProtocol->SetCellId(cellId);
632 }
633
634 if (m_epcHelper)
635 {
636 EnumValue epsBearerToRlcMapping;
637 rrc->GetAttribute("EpsBearerToRlcMapping", epsBearerToRlcMapping);
638 // it does not make sense to use RLC/SM when also using the EPC
639 if (epsBearerToRlcMapping.Get() == LteEnbRrc::RLC_SM_ALWAYS)
640 {
641 rrc->SetAttribute("EpsBearerToRlcMapping", EnumValue(LteEnbRrc::RLC_UM_ALWAYS));
642 }
643 }
644
645 rrc->SetLteHandoverManagementSapProvider(
646 handoverAlgorithm->GetLteHandoverManagementSapProvider());
647 handoverAlgorithm->SetLteHandoverManagementSapUser(rrc->GetLteHandoverManagementSapUser());
648
649 // This RRC attribute is used to connect each new RLC instance with the MAC layer
650 // (for function such as TransmitPdu, ReportBufferStatusReport).
651 // Since in this new architecture, the component carrier manager acts a proxy, it
652 // will have its own LteMacSapProvider interface, RLC will see it as through original MAC
653 // interface LteMacSapProvider, but the function call will go now through
654 // LteEnbComponentCarrierManager instance that needs to implement functions of this interface,
655 // and its task will be to forward these calls to the specific MAC of some of the instances of
656 // component carriers. This decision will depend on the specific implementation of the component
657 // carrier manager.
658 rrc->SetLteMacSapProvider(ccmEnbManager->GetLteMacSapProvider());
659
660 bool ccmTest;
661 for (auto it = ccMap.begin(); it != ccMap.end(); ++it)
662 {
663 DynamicCast<ComponentCarrierEnb>(it->second)
664 ->GetPhy()
665 ->SetLteEnbCphySapUser(rrc->GetLteEnbCphySapUser(it->first));
666 rrc->SetLteEnbCphySapProvider(
667 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetLteEnbCphySapProvider(),
668 it->first);
669
670 rrc->SetLteEnbCmacSapProvider(
671 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteEnbCmacSapProvider(),
672 it->first);
673 DynamicCast<ComponentCarrierEnb>(it->second)
674 ->GetMac()
675 ->SetLteEnbCmacSapUser(rrc->GetLteEnbCmacSapUser(it->first));
676
677 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->SetComponentCarrierId(it->first);
678 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->SetComponentCarrierId(it->first);
679 // FFR SAP
680 DynamicCast<ComponentCarrierEnb>(it->second)
681 ->GetFfMacScheduler()
682 ->SetLteFfrSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
683 ->GetFfrAlgorithm()
684 ->GetLteFfrSapProvider());
685 DynamicCast<ComponentCarrierEnb>(it->second)
686 ->GetFfrAlgorithm()
687 ->SetLteFfrSapUser(DynamicCast<ComponentCarrierEnb>(it->second)
688 ->GetFfMacScheduler()
689 ->GetLteFfrSapUser());
690 rrc->SetLteFfrRrcSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
691 ->GetFfrAlgorithm()
692 ->GetLteFfrRrcSapProvider(),
693 it->first);
694 DynamicCast<ComponentCarrierEnb>(it->second)
695 ->GetFfrAlgorithm()
696 ->SetLteFfrRrcSapUser(rrc->GetLteFfrRrcSapUser(it->first));
697 // FFR SAP END
698
699 // PHY <--> MAC SAP
700 DynamicCast<ComponentCarrierEnb>(it->second)
701 ->GetPhy()
702 ->SetLteEnbPhySapUser(
703 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteEnbPhySapUser());
704 DynamicCast<ComponentCarrierEnb>(it->second)
705 ->GetMac()
706 ->SetLteEnbPhySapProvider(
707 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetLteEnbPhySapProvider());
708 // PHY <--> MAC SAP END
709
710 // Scheduler SAP
711 DynamicCast<ComponentCarrierEnb>(it->second)
712 ->GetMac()
713 ->SetFfMacSchedSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
714 ->GetFfMacScheduler()
715 ->GetFfMacSchedSapProvider());
716 DynamicCast<ComponentCarrierEnb>(it->second)
717 ->GetMac()
718 ->SetFfMacCschedSapProvider(DynamicCast<ComponentCarrierEnb>(it->second)
719 ->GetFfMacScheduler()
720 ->GetFfMacCschedSapProvider());
721
722 DynamicCast<ComponentCarrierEnb>(it->second)
723 ->GetFfMacScheduler()
724 ->SetFfMacSchedSapUser(
725 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetFfMacSchedSapUser());
726 DynamicCast<ComponentCarrierEnb>(it->second)
727 ->GetFfMacScheduler()
728 ->SetFfMacCschedSapUser(
729 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetFfMacCschedSapUser());
730 // Scheduler SAP END
731
732 DynamicCast<ComponentCarrierEnb>(it->second)
733 ->GetMac()
734 ->SetLteCcmMacSapUser(ccmEnbManager->GetLteCcmMacSapUser());
735 ccmEnbManager->SetCcmMacSapProviders(
736 it->first,
737 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteCcmMacSapProvider());
738
739 // insert the pointer to the LteMacSapProvider interface of the MAC layer of the specific
740 // component carrier
741 ccmTest = ccmEnbManager->SetMacSapProvider(
742 it->first,
743 DynamicCast<ComponentCarrierEnb>(it->second)->GetMac()->GetLteMacSapProvider());
744
745 if (!ccmTest)
746 {
747 NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders");
748 }
749 }
750
751 dev->SetNode(n);
752 dev->SetAttribute("CellId", UintegerValue(cellId));
753 dev->SetAttribute("LteEnbComponentCarrierManager", PointerValue(ccmEnbManager));
754 dev->SetCcMap(ccMap);
755 std::map<uint8_t, Ptr<ComponentCarrierBaseStation>>::iterator it = ccMap.begin();
756 dev->SetAttribute("LteEnbRrc", PointerValue(rrc));
757 dev->SetAttribute("LteHandoverAlgorithm", PointerValue(handoverAlgorithm));
758 dev->SetAttribute(
759 "LteFfrAlgorithm",
760 PointerValue(DynamicCast<ComponentCarrierEnb>(it->second)->GetFfrAlgorithm()));
761
762 if (m_isAnrEnabled)
763 {
764 Ptr<LteAnr> anr = CreateObject<LteAnr>(cellId);
765 rrc->SetLteAnrSapProvider(anr->GetLteAnrSapProvider());
766 anr->SetLteAnrSapUser(rrc->GetLteAnrSapUser());
767 dev->SetAttribute("LteAnr", PointerValue(anr));
768 }
769
770 for (it = ccMap.begin(); it != ccMap.end(); ++it)
771 {
772 Ptr<LteEnbPhy> ccPhy = DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy();
773 ccPhy->SetDevice(dev);
774 ccPhy->GetUlSpectrumPhy()->SetDevice(dev);
775 ccPhy->GetDlSpectrumPhy()->SetDevice(dev);
776 ccPhy->GetUlSpectrumPhy()->SetLtePhyRxDataEndOkCallback(
778 ccPhy->GetUlSpectrumPhy()->SetLtePhyRxCtrlEndOkCallback(
780 ccPhy->GetUlSpectrumPhy()->SetLtePhyUlHarqFeedbackCallback(
782 NS_LOG_LOGIC("set the propagation model frequencies");
783 double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency(it->second->GetDlEarfcn());
784 NS_LOG_LOGIC("DL freq: " << dlFreq);
785 bool dlFreqOk =
787 if (!dlFreqOk)
788 {
789 NS_LOG_WARN("DL propagation model does not have a Frequency attribute");
790 }
791
792 double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency(it->second->GetUlEarfcn());
793
794 NS_LOG_LOGIC("UL freq: " << ulFreq);
795 bool ulFreqOk =
797 if (!ulFreqOk)
798 {
799 NS_LOG_WARN("UL propagation model does not have a Frequency attribute");
800 }
801 } // end for
802 rrc->SetForwardUpCallback(MakeCallback(&LteEnbNetDevice::Receive, dev));
803 dev->Initialize();
804 n->AddDevice(dev);
805
806 for (it = ccMap.begin(); it != ccMap.end(); ++it)
807 {
808 m_uplinkChannel->AddRx(
809 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetUlSpectrumPhy());
810 }
811
812 if (m_epcHelper)
813 {
814 NS_LOG_INFO("adding this eNB to the EPC");
815 m_epcHelper->AddEnb(n, dev, dev->GetCellIds());
816 Ptr<EpcEnbApplication> enbApp = n->GetApplication(0)->GetObject<EpcEnbApplication>();
817 NS_ASSERT_MSG(enbApp, "cannot retrieve EpcEnbApplication");
818
819 // S1 SAPs
820 rrc->SetS1SapProvider(enbApp->GetS1SapProvider());
821 enbApp->SetS1SapUser(rrc->GetS1SapUser());
822
823 // X2 SAPs
824 Ptr<EpcX2> x2 = n->GetObject<EpcX2>();
825 x2->SetEpcX2SapUser(rrc->GetEpcX2SapUser());
826 rrc->SetEpcX2SapProvider(x2->GetEpcX2SapProvider());
827 }
828
829 return dev;
830}
831
834{
835 NS_LOG_FUNCTION(this);
836
838
839 // Initialize the component carriers with default values in order to initialize MACs and PHYs
840 // of each component carrier. These values must be updated once the UE is attached to the
841 // eNB and receives RRC Connection Reconfiguration message. In case of primary carrier or
842 // a single carrier, these values will be updated once the UE will receive SIB2 and MIB.
843 NS_ABORT_MSG_IF(!m_componentCarrierPhyParams.empty(), "CC map is not clean");
844 DoComponentCarrierConfigure(dev->GetDlEarfcn() + 18000, dev->GetDlEarfcn(), 25, 25);
846 "CC map size (" << m_componentCarrierPhyParams.size()
847 << ") must be equal to number of carriers (" << m_noOfCcs
848 << ")");
849 std::map<uint8_t, Ptr<ComponentCarrierUe>> ueCcMap;
850
851 for (std::map<uint8_t, ComponentCarrier>::iterator it = m_componentCarrierPhyParams.begin();
852 it != m_componentCarrierPhyParams.end();
853 ++it)
854 {
855 Ptr<ComponentCarrierUe> cc = CreateObject<ComponentCarrierUe>();
856 cc->SetUlBandwidth(it->second.GetUlBandwidth());
857 cc->SetDlBandwidth(it->second.GetDlBandwidth());
858 cc->SetDlEarfcn(it->second.GetDlEarfcn());
859 cc->SetUlEarfcn(it->second.GetUlEarfcn());
860 cc->SetAsPrimary(it->second.IsPrimary());
861 Ptr<LteUeMac> mac = CreateObject<LteUeMac>();
862 cc->SetMac(mac);
863 // cc->GetPhy ()->Initialize (); // it is initialized within the
864 // LteUeNetDevice::DoInitialize ()
865 ueCcMap.insert(std::pair<uint8_t, Ptr<ComponentCarrierUe>>(it->first, cc));
866 }
867 // CC map is not needed anymore
869
870 for (std::map<uint8_t, Ptr<ComponentCarrierUe>>::iterator it = ueCcMap.begin();
871 it != ueCcMap.end();
872 ++it)
873 {
874 Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy>();
875 Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy>();
876
877 Ptr<LteUePhy> phy = CreateObject<LteUePhy>(dlPhy, ulPhy);
878
879 Ptr<LteHarqPhy> harq = Create<LteHarqPhy>();
880 dlPhy->SetHarqPhyModule(harq);
881 ulPhy->SetHarqPhyModule(harq);
882 phy->SetHarqPhyModule(harq);
883
884 Ptr<LteChunkProcessor> pRs = Create<LteChunkProcessor>();
885 pRs->AddCallback(MakeCallback(&LteUePhy::ReportRsReceivedPower, phy));
886 dlPhy->AddRsPowerChunkProcessor(pRs);
887
888 Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor>();
889 pInterf->AddCallback(MakeCallback(&LteUePhy::ReportInterference, phy));
890 dlPhy->AddInterferenceCtrlChunkProcessor(pInterf); // for RSRQ evaluation of UE Measurements
891
892 Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor>();
893 pCtrl->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
894 dlPhy->AddCtrlSinrChunkProcessor(pCtrl);
895
896 Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor>();
897 pData->AddCallback(MakeCallback(&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
898 dlPhy->AddDataSinrChunkProcessor(pData);
899
901 {
902 // CQI calculation based on PDCCH for signal and PDSCH for interference
903 // NOTE: Change in pCtrl chunk processor could impact the RLF detection
904 // since it is based on CTRL SINR.
905 pCtrl->AddCallback(MakeCallback(&LteUePhy::GenerateMixedCqiReport, phy));
906 Ptr<LteChunkProcessor> pDataInterf = Create<LteChunkProcessor>();
907 pDataInterf->AddCallback(MakeCallback(&LteUePhy::ReportDataInterference, phy));
908 dlPhy->AddInterferenceDataChunkProcessor(pDataInterf);
909 }
910 else
911 {
912 // CQI calculation based on PDCCH for both signal and interference
913 pCtrl->AddCallback(MakeCallback(&LteUePhy::GenerateCtrlCqiReport, phy));
914 }
915
916 dlPhy->SetChannel(m_downlinkChannel);
917 ulPhy->SetChannel(m_uplinkChannel);
918
919 Ptr<MobilityModel> mm = n->GetObject<MobilityModel>();
921 mm,
922 "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
923 dlPhy->SetMobility(mm);
924 ulPhy->SetMobility(mm);
925
926 Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create())->GetObject<AntennaModel>();
927 NS_ASSERT_MSG(antenna, "error in creating the AntennaModel object");
928 dlPhy->SetAntenna(antenna);
929 ulPhy->SetAntenna(antenna);
930
931 it->second->SetPhy(phy);
932 }
935
936 Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc>();
937 rrc->SetLteMacSapProvider(ccmUe->GetLteMacSapProvider());
938 // setting ComponentCarrierManager SAP
939 rrc->SetLteCcmRrcSapProvider(ccmUe->GetLteCcmRrcSapProvider());
940 ccmUe->SetLteCcmRrcSapUser(rrc->GetLteCcmRrcSapUser());
941 // Set number of component carriers. Note: UE CCM would also set the
942 // number of component carriers in UE RRC
943 ccmUe->SetNumberOfComponentCarriers(m_noOfCcs);
944
945 // run initializeSap to create the proper number of MAC and PHY control sap provider/users
946 rrc->InitializeSap();
947
948 if (m_useIdealRrc)
949 {
950 Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal>();
951 rrcProtocol->SetUeRrc(rrc);
952 rrc->AggregateObject(rrcProtocol);
953 rrcProtocol->SetLteUeRrcSapProvider(rrc->GetLteUeRrcSapProvider());
954 rrc->SetLteUeRrcSapUser(rrcProtocol->GetLteUeRrcSapUser());
955 }
956 else
957 {
958 Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal>();
959 rrcProtocol->SetUeRrc(rrc);
960 rrc->AggregateObject(rrcProtocol);
961 rrcProtocol->SetLteUeRrcSapProvider(rrc->GetLteUeRrcSapProvider());
962 rrc->SetLteUeRrcSapUser(rrcProtocol->GetLteUeRrcSapUser());
963 }
964
965 if (m_epcHelper)
966 {
967 rrc->SetUseRlcSm(false);
968 }
969 Ptr<EpcUeNas> nas = CreateObject<EpcUeNas>();
970
971 nas->SetAsSapProvider(rrc->GetAsSapProvider());
972 rrc->SetAsSapUser(nas->GetAsSapUser());
973
974 for (std::map<uint8_t, Ptr<ComponentCarrierUe>>::iterator it = ueCcMap.begin();
975 it != ueCcMap.end();
976 ++it)
977 {
978 rrc->SetLteUeCmacSapProvider(it->second->GetMac()->GetLteUeCmacSapProvider(), it->first);
979 it->second->GetMac()->SetLteUeCmacSapUser(rrc->GetLteUeCmacSapUser(it->first));
980 it->second->GetMac()->SetComponentCarrierId(it->first);
981
982 it->second->GetPhy()->SetLteUeCphySapUser(rrc->GetLteUeCphySapUser(it->first));
983 rrc->SetLteUeCphySapProvider(it->second->GetPhy()->GetLteUeCphySapProvider(), it->first);
984 it->second->GetPhy()->SetComponentCarrierId(it->first);
985 it->second->GetPhy()->SetLteUePhySapUser(it->second->GetMac()->GetLteUePhySapUser());
986 it->second->GetMac()->SetLteUePhySapProvider(
987 it->second->GetPhy()->GetLteUePhySapProvider());
988
989 bool ccmTest =
990 ccmUe->SetComponentCarrierMacSapProviders(it->first,
991 it->second->GetMac()->GetLteMacSapProvider());
992
993 if (!ccmTest)
994 {
995 NS_FATAL_ERROR("Error in SetComponentCarrierMacSapProviders");
996 }
997 }
998
999 NS_ABORT_MSG_IF(m_imsiCounter >= 0xFFFFFFFF, "max num UEs exceeded");
1000 uint64_t imsi = ++m_imsiCounter;
1001
1002 dev->SetNode(n);
1003 dev->SetAttribute("Imsi", UintegerValue(imsi));
1004 dev->SetCcMap(ueCcMap);
1005 dev->SetAttribute("LteUeRrc", PointerValue(rrc));
1006 dev->SetAttribute("EpcUeNas", PointerValue(nas));
1007 dev->SetAttribute("LteUeComponentCarrierManager", PointerValue(ccmUe));
1008 // \todo The UE identifier should be dynamically set by the EPC
1009 // when the default PDP context is created. This is a simplification.
1010 dev->SetAddress(Mac64Address::Allocate());
1011
1012 for (std::map<uint8_t, Ptr<ComponentCarrierUe>>::iterator it = ueCcMap.begin();
1013 it != ueCcMap.end();
1014 ++it)
1015 {
1016 Ptr<LteUePhy> ccPhy = it->second->GetPhy();
1017 ccPhy->SetDevice(dev);
1018 ccPhy->GetUlSpectrumPhy()->SetDevice(dev);
1019 ccPhy->GetDlSpectrumPhy()->SetDevice(dev);
1020 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxDataEndOkCallback(
1022 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxCtrlEndOkCallback(
1024 ccPhy->GetDlSpectrumPhy()->SetLtePhyRxPssCallback(
1026 ccPhy->GetDlSpectrumPhy()->SetLtePhyDlHarqFeedbackCallback(
1028 }
1029
1030 nas->SetDevice(dev);
1031
1032 n->AddDevice(dev);
1033
1034 nas->SetForwardUpCallback(MakeCallback(&LteUeNetDevice::Receive, dev));
1035
1036 if (m_epcHelper)
1037 {
1038 m_epcHelper->AddUe(dev, dev->GetImsi());
1039 }
1040
1041 dev->Initialize();
1042
1043 return dev;
1044}
1045
1046void
1048{
1049 NS_LOG_FUNCTION(this);
1050 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1051 {
1052 Attach(*i);
1053 }
1054}
1055
1056void
1058{
1059 NS_LOG_FUNCTION(this);
1060
1061 if (!m_epcHelper)
1062 {
1063 NS_FATAL_ERROR("This function is not valid without properly configured EPC");
1064 }
1065
1066 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
1067 if (!ueLteDevice)
1068 {
1069 NS_FATAL_ERROR("The passed NetDevice must be an LteUeNetDevice");
1070 }
1071
1072 // initiate cell selection
1073 Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas();
1074 NS_ASSERT(ueNas);
1075 uint32_t dlEarfcn = ueLteDevice->GetDlEarfcn();
1076 ueNas->StartCellSelection(dlEarfcn);
1077
1078 // instruct UE to immediately enter CONNECTED mode after camping
1079 ueNas->Connect();
1080
1081 // activate default EPS bearer
1082 m_epcHelper->ActivateEpsBearer(ueDevice,
1083 ueLteDevice->GetImsi(),
1086}
1087
1088void
1090{
1091 NS_LOG_FUNCTION(this);
1092 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1093 {
1094 Attach(*i, enbDevice);
1095 }
1096}
1097
1098void
1099LteHelper::Attach(Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice, uint8_t componentCarrierId)
1100{
1101 NS_LOG_FUNCTION(this);
1102 // enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
1103
1104 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
1105 Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice>();
1106
1107 Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas();
1108 Ptr<ComponentCarrierEnb> componentCarrier =
1109 DynamicCast<ComponentCarrierEnb>(enbLteDevice->GetCcMap().at(componentCarrierId));
1110 ueNas->Connect(componentCarrier->GetCellId(), componentCarrier->GetDlEarfcn());
1111
1112 if (m_epcHelper)
1113 {
1114 // activate default EPS bearer
1115 m_epcHelper->ActivateEpsBearer(ueDevice,
1116 ueLteDevice->GetImsi(),
1119 }
1120
1121 // tricks needed for the simplified LTE-only simulations
1122 if (!m_epcHelper)
1123 {
1124 ueDevice->GetObject<LteUeNetDevice>()->SetTargetEnb(
1125 enbDevice->GetObject<LteEnbNetDevice>());
1126 }
1127}
1128
1129void
1131{
1132 NS_LOG_FUNCTION(this);
1133 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1134 {
1135 AttachToClosestEnb(*i, enbDevices);
1136 }
1137}
1138
1139void
1141{
1142 NS_LOG_FUNCTION(this);
1143 NS_ASSERT_MSG(enbDevices.GetN() > 0, "empty enb device container");
1144 Vector uepos = ueDevice->GetNode()->GetObject<MobilityModel>()->GetPosition();
1145 double minDistance = std::numeric_limits<double>::infinity();
1146 Ptr<NetDevice> closestEnbDevice;
1147 for (NetDeviceContainer::Iterator i = enbDevices.Begin(); i != enbDevices.End(); ++i)
1148 {
1149 Vector enbpos = (*i)->GetNode()->GetObject<MobilityModel>()->GetPosition();
1150 double distance = CalculateDistance(uepos, enbpos);
1151 if (distance < minDistance)
1152 {
1153 minDistance = distance;
1154 closestEnbDevice = *i;
1155 }
1156 }
1157 NS_ASSERT(closestEnbDevice);
1158 Attach(ueDevice, closestEnbDevice);
1159}
1160
1161uint8_t
1163 EpsBearer bearer,
1164 Ptr<EpcTft> tft)
1165{
1166 NS_LOG_FUNCTION(this);
1167 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1168 {
1169 uint8_t bearerId = ActivateDedicatedEpsBearer(*i, bearer, tft);
1170 return bearerId;
1171 }
1172 return 0;
1173}
1174
1175uint8_t
1177{
1178 NS_LOG_FUNCTION(this);
1179
1180 NS_ASSERT_MSG(m_epcHelper, "dedicated EPS bearers cannot be set up when the EPC is not used");
1181
1182 uint64_t imsi = ueDevice->GetObject<LteUeNetDevice>()->GetImsi();
1183 uint8_t bearerId = m_epcHelper->ActivateEpsBearer(ueDevice, imsi, tft, bearer);
1184 return bearerId;
1185}
1186
1196class DrbActivator : public SimpleRefCount<DrbActivator>
1197{
1198 public:
1205 DrbActivator(Ptr<NetDevice> ueDevice, EpsBearer bearer);
1206
1217 static void ActivateCallback(Ptr<DrbActivator> a,
1218 std::string context,
1219 uint64_t imsi,
1220 uint16_t cellId,
1221 uint16_t rnti);
1222
1233 void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti);
1234
1235 private:
1253 uint64_t m_imsi;
1254};
1255
1257 : m_active(false),
1258 m_ueDevice(ueDevice),
1259 m_bearer(bearer),
1260 m_imsi(m_ueDevice->GetObject<LteUeNetDevice>()->GetImsi())
1261{
1262}
1263
1264void
1266 std::string context,
1267 uint64_t imsi,
1268 uint16_t cellId,
1269 uint16_t rnti)
1270{
1271 NS_LOG_FUNCTION(a << context << imsi << cellId << rnti);
1272 a->ActivateDrb(imsi, cellId, rnti);
1273}
1274
1275void
1276DrbActivator::ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
1277{
1278 NS_LOG_FUNCTION(this << imsi << cellId << rnti << m_active);
1279 if ((!m_active) && (imsi == m_imsi))
1280 {
1281 Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice>()->GetRrc();
1282 NS_ASSERT(ueRrc->GetState() == LteUeRrc::CONNECTED_NORMALLY);
1283 uint16_t rnti = ueRrc->GetRnti();
1284 Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice>()->GetTargetEnb();
1285 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice>()->GetRrc();
1286 NS_ASSERT(ueRrc->GetCellId() == enbLteDevice->GetCellId());
1287 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
1288 NS_ASSERT(ueManager->GetState() == UeManager::CONNECTED_NORMALLY ||
1289 ueManager->GetState() == UeManager::CONNECTION_RECONFIGURATION);
1291 params.rnti = rnti;
1292 params.bearer = m_bearer;
1293 params.bearerId = 0;
1294 params.gtpTeid = 0; // don't care
1295 enbRrc->GetS1SapUser()->DataRadioBearerSetupRequest(params);
1296 m_active = true;
1297 }
1298}
1299
1300void
1302{
1303 NS_LOG_FUNCTION(this << ueDevice);
1304 NS_ASSERT_MSG(!m_epcHelper, "this method must not be used when the EPC is being used");
1305
1306 // Normally it is the EPC that takes care of activating DRBs
1307 // when the UE gets connected. When the EPC is not used, we achieve
1308 // the same behavior by hooking a dedicated DRB activation function
1309 // to the Enb RRC Connection Established trace source
1310
1311 Ptr<LteEnbNetDevice> enbLteDevice = ueDevice->GetObject<LteUeNetDevice>()->GetTargetEnb();
1312
1313 std::ostringstream path;
1314 path << "/NodeList/" << enbLteDevice->GetNode()->GetId() << "/DeviceList/"
1315 << enbLteDevice->GetIfIndex() << "/LteEnbRrc/ConnectionEstablished";
1316 Ptr<DrbActivator> arg = Create<DrbActivator>(ueDevice, bearer);
1318}
1319
1320void
1322{
1323 NS_LOG_FUNCTION(this);
1324
1325 NS_ASSERT_MSG(m_epcHelper, "X2 interfaces cannot be set up when the EPC is not used");
1326
1327 for (NodeContainer::Iterator i = enbNodes.Begin(); i != enbNodes.End(); ++i)
1328 {
1329 for (NodeContainer::Iterator j = i + 1; j != enbNodes.End(); ++j)
1330 {
1331 AddX2Interface(*i, *j);
1332 }
1333 }
1334}
1335
1336void
1338{
1339 NS_LOG_FUNCTION(this);
1340 NS_LOG_INFO("setting up the X2 interface");
1341
1342 m_epcHelper->AddX2Interface(enbNode1, enbNode2);
1343}
1344
1345void
1347 Ptr<NetDevice> ueDev,
1348 Ptr<NetDevice> sourceEnbDev,
1349 Ptr<NetDevice> targetEnbDev)
1350{
1351 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetEnbDev);
1353 "Handover requires the use of the EPC - did you forget to call "
1354 "LteHelper::SetEpcHelper () ?");
1355 uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice>()->GetCellId();
1356 Simulator::Schedule(hoTime,
1358 this,
1359 ueDev,
1360 sourceEnbDev,
1361 targetCellId);
1362}
1363
1364void
1366 Ptr<NetDevice> ueDev,
1367 Ptr<NetDevice> sourceEnbDev,
1368 uint16_t targetCellId)
1369{
1370 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetCellId);
1372 "Handover requires the use of the EPC - did you forget to call "
1373 "LteHelper::SetEpcHelper () ?");
1374 Simulator::Schedule(hoTime,
1376 this,
1377 ueDev,
1378 sourceEnbDev,
1379 targetCellId);
1380}
1381
1382void
1384 Ptr<NetDevice> sourceEnbDev,
1385 uint16_t targetCellId)
1386{
1387 NS_LOG_FUNCTION(this << ueDev << sourceEnbDev << targetCellId);
1388
1389 Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice>()->GetRrc();
1390 uint16_t rnti = ueDev->GetObject<LteUeNetDevice>()->GetRrc()->GetRnti();
1391 sourceRrc->SendHandoverRequest(rnti, targetCellId);
1392}
1393
1394void
1396 Ptr<NetDevice> enbDevice,
1397 uint8_t bearerId)
1398{
1399 NS_LOG_FUNCTION(this << ueDevice << bearerId);
1401 "Dedicated EPS bearers cannot be de-activated when the EPC is not used");
1402 NS_ASSERT_MSG(bearerId != 1,
1403 "Default bearer cannot be de-activated until and unless and UE is released");
1404
1405 DoDeActivateDedicatedEpsBearer(ueDevice, enbDevice, bearerId);
1406}
1407
1408void
1410 Ptr<NetDevice> enbDevice,
1411 uint8_t bearerId)
1412{
1413 NS_LOG_FUNCTION(this << ueDevice << bearerId);
1414
1415 // Extract IMSI and rnti
1416 uint64_t imsi = ueDevice->GetObject<LteUeNetDevice>()->GetImsi();
1417 uint16_t rnti = ueDevice->GetObject<LteUeNetDevice>()->GetRrc()->GetRnti();
1418
1419 Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<LteEnbNetDevice>()->GetRrc();
1420
1421 enbRrc->DoSendReleaseDataRadioBearer(imsi, rnti, bearerId);
1422}
1423
1424void
1426 uint32_t dlEarfcn,
1427 uint16_t ulbw,
1428 uint16_t dlbw)
1429{
1430 NS_LOG_FUNCTION(this << ulEarfcn << dlEarfcn << ulbw << dlbw);
1431
1432 NS_ABORT_MSG_IF(!m_componentCarrierPhyParams.empty(), "CC map is not clean");
1433 Ptr<CcHelper> ccHelper = CreateObject<CcHelper>();
1434 ccHelper->SetNumberOfComponentCarriers(m_noOfCcs);
1435 ccHelper->SetUlEarfcn(ulEarfcn);
1436 ccHelper->SetDlEarfcn(dlEarfcn);
1437 ccHelper->SetDlBandwidth(dlbw);
1438 ccHelper->SetUlBandwidth(ulbw);
1439 m_componentCarrierPhyParams = ccHelper->EquallySpacedCcs();
1440 m_componentCarrierPhyParams.at(0).SetAsPrimary(true);
1441}
1442
1443void
1445{
1446 NS_LOG_FUNCTION(this);
1447 for (NetDeviceContainer::Iterator i = ueDevices.Begin(); i != ueDevices.End(); ++i)
1448 {
1449 ActivateDataRadioBearer(*i, bearer);
1450 }
1451}
1452
1453void
1455{
1459 // Model directory
1460 LogComponentEnable("A2A4RsrqHandoverAlgorithm", LOG_LEVEL_ALL);
1461 LogComponentEnable("A3RsrpHandoverAlgorithm", LOG_LEVEL_ALL);
1462 LogComponentEnable("Asn1Header", LOG_LEVEL_ALL);
1463 LogComponentEnable("ComponentCarrier", LOG_LEVEL_ALL);
1464 LogComponentEnable("ComponentCarrierEnb", LOG_LEVEL_ALL);
1465 LogComponentEnable("ComponentCarrierUe", LOG_LEVEL_ALL);
1466 LogComponentEnable("CqaFfMacScheduler", LOG_LEVEL_ALL);
1467 LogComponentEnable("EpcEnbApplication", LOG_LEVEL_ALL);
1468 LogComponentEnable("EpcMmeApplication", LOG_LEVEL_ALL);
1469 LogComponentEnable("EpcPgwApplication", LOG_LEVEL_ALL);
1470 LogComponentEnable("EpcSgwApplication", LOG_LEVEL_ALL);
1472 LogComponentEnable("EpcTftClassifier", LOG_LEVEL_ALL);
1473 LogComponentEnable("EpcUeNas", LOG_LEVEL_ALL);
1475 LogComponentEnable("EpcX2Header", LOG_LEVEL_ALL);
1476 LogComponentEnable("FdBetFfMacScheduler", LOG_LEVEL_ALL);
1477 LogComponentEnable("FdMtFfMacScheduler", LOG_LEVEL_ALL);
1478 LogComponentEnable("FdTbfqFfMacScheduler", LOG_LEVEL_ALL);
1479 LogComponentEnable("FfMacScheduler", LOG_LEVEL_ALL);
1480 LogComponentEnable("GtpuHeader", LOG_LEVEL_ALL);
1483 LogComponentEnable("LteChunkProcessor", LOG_LEVEL_ALL);
1484 LogComponentEnable("LteCommon", LOG_LEVEL_ALL);
1485 LogComponentEnable("LteControlMessage", LOG_LEVEL_ALL);
1486 LogComponentEnable("LteEnbComponentCarrierManager", LOG_LEVEL_ALL);
1487 LogComponentEnable("LteEnbMac", LOG_LEVEL_ALL);
1488 LogComponentEnable("LteEnbNetDevice", LOG_LEVEL_ALL);
1489 LogComponentEnable("LteEnbPhy", LOG_LEVEL_ALL);
1490 LogComponentEnable("LteEnbRrc", LOG_LEVEL_ALL);
1491 LogComponentEnable("LteFfrAlgorithm", LOG_LEVEL_ALL);
1492 LogComponentEnable("LteFfrDistributedAlgorithm", LOG_LEVEL_ALL);
1493 LogComponentEnable("LteFfrEnhancedAlgorithm", LOG_LEVEL_ALL);
1494 LogComponentEnable("LteFfrSoftAlgorithm", LOG_LEVEL_ALL);
1495 LogComponentEnable("LteFrHardAlgorithm", LOG_LEVEL_ALL);
1496 LogComponentEnable("LteFrNoOpAlgorithm", LOG_LEVEL_ALL);
1497 LogComponentEnable("LteFrSoftAlgorithm", LOG_LEVEL_ALL);
1498 LogComponentEnable("LteFrStrictAlgorithm", LOG_LEVEL_ALL);
1499 LogComponentEnable("LteHandoverAlgorithm", LOG_LEVEL_ALL);
1500 LogComponentEnable("LteHarqPhy", LOG_LEVEL_ALL);
1501 LogComponentEnable("LteInterference", LOG_LEVEL_ALL);
1502 LogComponentEnable("LteMiErrorModel", LOG_LEVEL_ALL);
1503 LogComponentEnable("LteNetDevice", LOG_LEVEL_ALL);
1505 LogComponentEnable("LtePdcpHeader", LOG_LEVEL_ALL);
1508 LogComponentEnable("LteRlcAm", LOG_LEVEL_ALL);
1509 LogComponentEnable("LteRlcAmHeader", LOG_LEVEL_ALL);
1510 LogComponentEnable("LteRlcHeader", LOG_LEVEL_ALL);
1511 LogComponentEnable("LteRlcTm", LOG_LEVEL_ALL);
1512 LogComponentEnable("LteRlcUm", LOG_LEVEL_ALL);
1513 LogComponentEnable("LteRrcProtocolIdeal", LOG_LEVEL_ALL);
1514 LogComponentEnable("LteRrcProtocolReal", LOG_LEVEL_ALL);
1515 LogComponentEnable("LteSpectrumPhy", LOG_LEVEL_ALL);
1516 LogComponentEnable("LteSpectrumSignalParameters", LOG_LEVEL_ALL);
1517 LogComponentEnable("LteSpectrumValueHelper", LOG_LEVEL_ALL);
1518 LogComponentEnable("LteUeComponentCarrierManager", LOG_LEVEL_ALL);
1519 LogComponentEnable("LteUeMac", LOG_LEVEL_ALL);
1520 LogComponentEnable("LteUeNetDevice", LOG_LEVEL_ALL);
1521 LogComponentEnable("LteUePhy", LOG_LEVEL_ALL);
1522 LogComponentEnable("LteUePowerControl", LOG_LEVEL_ALL);
1523 LogComponentEnable("LteUeRrc", LOG_LEVEL_ALL);
1524 LogComponentEnable("LteVendorSpecificParameters", LOG_LEVEL_ALL);
1525 LogComponentEnable("NoOpComponentCarrierManager", LOG_LEVEL_ALL);
1526 LogComponentEnable("NoOpHandoverAlgorithm", LOG_LEVEL_ALL);
1527 LogComponentEnable("PfFfMacScheduler", LOG_LEVEL_ALL);
1528 LogComponentEnable("PssFfMacScheduler", LOG_LEVEL_ALL);
1529 LogComponentEnable("RemSpectrumPhy", LOG_LEVEL_ALL);
1530 LogComponentEnable("RrcHeader", LOG_LEVEL_ALL);
1531 LogComponentEnable("RrFfMacScheduler", LOG_LEVEL_ALL);
1532 LogComponentEnable("SimpleUeComponentCarrierManager", LOG_LEVEL_ALL);
1533 LogComponentEnable("TdBetFfMacScheduler", LOG_LEVEL_ALL);
1534 LogComponentEnable("TdMtFfMacScheduler", LOG_LEVEL_ALL);
1535 LogComponentEnable("TdTbfqFfMacScheduler", LOG_LEVEL_ALL);
1536 LogComponentEnable("TraceFadingLossModel", LOG_LEVEL_ALL);
1537 LogComponentEnable("TtaFfMacScheduler", LOG_LEVEL_ALL);
1538 // Helper directory
1539 LogComponentEnable("CcHelper", LOG_LEVEL_ALL);
1540 LogComponentEnable("EmuEpcHelper", LOG_LEVEL_ALL);
1541 LogComponentEnable("EpcHelper", LOG_LEVEL_ALL);
1542 LogComponentEnable("LteGlobalPathlossDatabase", LOG_LEVEL_ALL);
1543 LogComponentEnable("LteHelper", LOG_LEVEL_ALL);
1544 LogComponentEnable("LteHexGridEnbTopologyHelper", LOG_LEVEL_ALL);
1545 LogComponentEnable("LteStatsCalculator", LOG_LEVEL_ALL);
1546 LogComponentEnable("MacStatsCalculator", LOG_LEVEL_ALL);
1547 LogComponentEnable("PhyRxStatsCalculator", LOG_LEVEL_ALL);
1548 LogComponentEnable("PhyStatsCalculator", LOG_LEVEL_ALL);
1549 LogComponentEnable("PhyTxStatsCalculator", LOG_LEVEL_ALL);
1550 LogComponentEnable("PointToPointEpcHelper", LOG_LEVEL_ALL);
1551 LogComponentEnable("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
1552 LogComponentEnable("RadioBearerStatsConnector", LOG_LEVEL_ALL);
1553 LogComponentEnable("RadioEnvironmentMapHelper", LOG_LEVEL_ALL);
1554}
1555
1556void
1558{
1563}
1564
1565void
1567{
1569 "please make sure that LteHelper::EnableRlcTraces is called at most once");
1570 m_rlcStats = CreateObject<RadioBearerStatsCalculator>("RLC");
1572}
1573
1574int64_t
1576{
1577 int64_t currentStream = stream;
1579 {
1581 if (tflm)
1582 {
1583 currentStream += tflm->AssignStreams(currentStream);
1585 }
1586 }
1587 Ptr<NetDevice> netDevice;
1588 for (NetDeviceContainer::Iterator i = c.Begin(); i != c.End(); ++i)
1589 {
1590 netDevice = (*i);
1591 Ptr<LteEnbNetDevice> lteEnb = DynamicCast<LteEnbNetDevice>(netDevice);
1592 if (lteEnb)
1593 {
1594 std::map<uint8_t, Ptr<ComponentCarrierBaseStation>> tmpMap = lteEnb->GetCcMap();
1595 std::map<uint8_t, Ptr<ComponentCarrierBaseStation>>::iterator it;
1596 it = tmpMap.begin();
1597 Ptr<LteSpectrumPhy> dlPhy =
1598 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetDownlinkSpectrumPhy();
1599 Ptr<LteSpectrumPhy> ulPhy =
1600 DynamicCast<ComponentCarrierEnb>(it->second)->GetPhy()->GetUplinkSpectrumPhy();
1601 currentStream += dlPhy->AssignStreams(currentStream);
1602 currentStream += ulPhy->AssignStreams(currentStream);
1603 }
1604 Ptr<LteUeNetDevice> lteUe = DynamicCast<LteUeNetDevice>(netDevice);
1605 if (lteUe)
1606 {
1607 std::map<uint8_t, Ptr<ComponentCarrierUe>> tmpMap = lteUe->GetCcMap();
1608 std::map<uint8_t, Ptr<ComponentCarrierUe>>::iterator it;
1609 it = tmpMap.begin();
1610 Ptr<LteSpectrumPhy> dlPhy = it->second->GetPhy()->GetDownlinkSpectrumPhy();
1611 Ptr<LteSpectrumPhy> ulPhy = it->second->GetPhy()->GetUplinkSpectrumPhy();
1612 Ptr<LteUeMac> ueMac = lteUe->GetMac();
1613 currentStream += dlPhy->AssignStreams(currentStream);
1614 currentStream += ulPhy->AssignStreams(currentStream);
1615 currentStream += ueMac->AssignStreams(currentStream);
1616 }
1617 }
1618 if (m_epcHelper)
1619 {
1620 currentStream += m_epcHelper->AssignStreams(currentStream);
1621 }
1622 return (currentStream - stream);
1623}
1624
1625void
1627{
1634}
1635
1636void
1638{
1640 "/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/DlPhyTransmission",
1642}
1643
1644void
1646{
1648 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/UlPhyTransmission",
1650}
1651
1652void
1654{
1656 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1658}
1659
1660void
1662{
1664 "/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1666}
1667
1668void
1670{
1673}
1674
1675void
1677{
1679 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/DlScheduling",
1681}
1682
1683void
1685{
1687 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/UlScheduling",
1689}
1690
1691void
1693{
1696 "/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/ReportCurrentCellRsrpSinr",
1698}
1699
1700void
1702{
1704 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportUeSinr",
1706 Config::Connect("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportInterference",
1708}
1709
1712{
1713 return m_rlcStats;
1714}
1715
1716void
1718{
1720 "please make sure that LteHelper::EnablePdcpTraces is called at most once");
1721 m_pdcpStats = CreateObject<RadioBearerStatsCalculator>("PDCP");
1723}
1724
1727{
1728 return m_pdcpStats;
1729}
1730
1731} // 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:1197
EpsBearer m_bearer
Configuration of bearer which will be activated.
Definition: lte-helper.cc:1249
uint64_t m_imsi
imsi the unique UE identifier
Definition: lte-helper.cc:1253
DrbActivator(Ptr< NetDevice > ueDevice, EpsBearer bearer)
DrbActivator Constructor.
Definition: lte-helper.cc:1256
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:1265
Ptr< NetDevice > m_ueDevice
UeNetDevice for which bearer will be activated.
Definition: lte-helper.cc:1245
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:1276
bool m_active
Bearer can be activated only once.
Definition: lte-helper.cc:1241
Hold variables of type enum.
Definition: enum.h:56
int Get() const
Definition: enum.cc:59
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:831
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:843
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:427
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:525
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:851
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:1454
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:1661
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:1711
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:1726
void EnableDlMacTraces()
Enable trace sinks for DL MAC layer.
Definition: lte-helper.cc:1676
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:1409
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:1626
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:1395
void HandoverRequest(Time hoTime, Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
Manually trigger an X2-based handover.
Definition: lte-helper.cc:1346
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:1717
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:1557
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:1383
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:1653
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:1047
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:1684
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:1701
void EnableDlTxPhyTraces()
Enable trace sinks for DL transmission PHY layer.
Definition: lte-helper.cc:1637
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:1566
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:1425
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:1645
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:1444
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:1669
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:1692
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1321
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:1575
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:1130
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:1162
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:833
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:803
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Receive PSS function.
Definition: lte-ue-phy.cc:1192
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:812
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
Receive LTE control message list function.
Definition: lte-ue-phy.cc:1028
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:1758
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:795
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:729
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.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
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.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
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:223
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:186
friend class ObjectFactory
Friends.
Definition: object.h:328
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:360
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:353
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
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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:568
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:936
std::string GetName() const
Get the name.
Definition: type-id.cc:996
AttributeValue implementation for TypeId.
Definition: type-id.h:598
@ CONNECTION_RECONFIGURATION
Definition: lte-enb-rrc.h:83
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:86
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:1255
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:975
#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:763
#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:702
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 ()