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