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 
25 #include "lte-helper.h"
26 #include <ns3/string.h>
27 #include <ns3/log.h>
28 #include <ns3/abort.h>
29 #include <ns3/pointer.h>
30 #include <ns3/lte-enb-rrc.h>
31 #include <ns3/epc-ue-nas.h>
32 #include <ns3/epc-enb-application.h>
33 #include <ns3/lte-ue-rrc.h>
34 #include <ns3/lte-ue-mac.h>
35 #include <ns3/lte-enb-mac.h>
36 #include <ns3/lte-enb-net-device.h>
37 #include <ns3/lte-enb-phy.h>
38 #include <ns3/lte-ue-phy.h>
39 #include <ns3/lte-spectrum-phy.h>
40 #include <ns3/lte-chunk-processor.h>
41 #include <ns3/multi-model-spectrum-channel.h>
42 #include <ns3/friis-spectrum-propagation-loss.h>
43 #include <ns3/trace-fading-loss-model.h>
44 #include <ns3/isotropic-antenna-model.h>
45 #include <ns3/lte-enb-net-device.h>
46 #include <ns3/lte-ue-net-device.h>
47 #include <ns3/ff-mac-scheduler.h>
48 #include <ns3/lte-ffr-algorithm.h>
49 #include <ns3/lte-handover-algorithm.h>
50 #include <ns3/lte-enb-component-carrier-manager.h>
51 #include <ns3/lte-ue-component-carrier-manager.h>
52 #include <ns3/lte-anr.h>
53 #include <ns3/lte-rlc.h>
54 #include <ns3/lte-rlc-um.h>
55 #include <ns3/lte-rlc-am.h>
56 #include <ns3/epc-enb-s1-sap.h>
57 #include <ns3/lte-rrc-protocol-ideal.h>
58 #include <ns3/lte-rrc-protocol-real.h>
59 #include <ns3/mac-stats-calculator.h>
60 #include <ns3/phy-stats-calculator.h>
61 #include <ns3/phy-tx-stats-calculator.h>
62 #include <ns3/phy-rx-stats-calculator.h>
63 #include <ns3/epc-helper.h>
64 #include <iostream>
65 #include <ns3/buildings-propagation-loss-model.h>
66 #include <ns3/lte-spectrum-value-helper.h>
67 #include <ns3/epc-x2.h>
68 #include <ns3/pointer.h>
69 #include <ns3/object-map.h>
70 #include <ns3/object-factory.h>
71 
72 namespace ns3 {
73 
74 NS_LOG_COMPONENT_DEFINE ("LteHelper");
75 
76 NS_OBJECT_ENSURE_REGISTERED (LteHelper);
77 
79  : m_fadingStreamsAssigned (false),
80  m_imsiCounter (0),
81  m_cellIdCounter {1}
82 {
83  NS_LOG_FUNCTION (this);
84  m_enbNetDeviceFactory.SetTypeId (LteEnbNetDevice::GetTypeId ());
85  m_enbAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
86  m_ueNetDeviceFactory.SetTypeId (LteUeNetDevice::GetTypeId ());
87  m_ueAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
88  m_channelFactory.SetTypeId (MultiModelSpectrumChannel::GetTypeId ());
89 }
90 
91 void
93 {
94  NS_LOG_FUNCTION (this);
96  m_phyStats = CreateObject<PhyStatsCalculator> ();
97  m_phyTxStats = CreateObject<PhyTxStatsCalculator> ();
98  m_phyRxStats = CreateObject<PhyRxStatsCalculator> ();
99  m_macStats = CreateObject<MacStatsCalculator> ();
101 
102 }
103 
105 {
106  NS_LOG_FUNCTION (this);
107 }
108 
110 {
111  static TypeId
112  tid =
113  TypeId ("ns3::LteHelper")
114  .SetParent<Object> ()
115  .AddConstructor<LteHelper> ()
116  .AddAttribute ("Scheduler",
117  "The type of scheduler to be used for eNBs. "
118  "The allowed values for this attributes are the type names "
119  "of any class inheriting from ns3::FfMacScheduler.",
120  StringValue ("ns3::PfFfMacScheduler"),
124  .AddAttribute ("FfrAlgorithm",
125  "The type of FFR algorithm to be used for eNBs. "
126  "The allowed values for this attributes are the type names "
127  "of any class inheriting from ns3::LteFfrAlgorithm.",
128  StringValue ("ns3::LteFrNoOpAlgorithm"),
132  .AddAttribute ("HandoverAlgorithm",
133  "The type of handover algorithm to be used for eNBs. "
134  "The allowed values for this attributes are the type names "
135  "of any class inheriting from ns3::LteHandoverAlgorithm.",
136  StringValue ("ns3::NoOpHandoverAlgorithm"),
140  .AddAttribute ("PathlossModel",
141  "The type of pathloss model to be used. "
142  "The allowed values for this attributes are the type names "
143  "of any class inheriting from ns3::PropagationLossModel.",
147  .AddAttribute ("FadingModel",
148  "The type of fading model to be used."
149  "The allowed values for this attributes are the type names "
150  "of any class inheriting from ns3::SpectrumPropagationLossModel."
151  "If the type is set to an empty string, no fading model is used.",
152  StringValue (""),
155  .AddAttribute ("UseIdealRrc",
156  "If true, LteRrcProtocolIdeal will be used for RRC signaling. "
157  "If false, LteRrcProtocolReal will be used.",
158  BooleanValue (true),
161  .AddAttribute ("AnrEnabled",
162  "Activate or deactivate Automatic Neighbour Relation function",
163  BooleanValue (true),
166  .AddAttribute ("UsePdschForCqiGeneration",
167  "If true, DL-CQI will be calculated from PDCCH as signal and PDSCH as interference "
168  "If false, DL-CQI will be calculated from PDCCH as signal and PDCCH as interference ",
169  BooleanValue (true),
172  .AddAttribute ("EnbComponentCarrierManager",
173  "The type of Component Carrier Manager to be used for eNBs. "
174  "The allowed values for this attributes are the type names "
175  "of any class inheriting ns3::LteEnbComponentCarrierManager.",
176  StringValue ("ns3::NoOpComponentCarrierManager"),
180  .AddAttribute ("UeComponentCarrierManager",
181  "The type of Component Carrier Manager to be used for UEs. "
182  "The allowed values for this attributes are the type names "
183  "of any class inheriting ns3::LteUeComponentCarrierManager.",
184  StringValue ("ns3::SimpleUeComponentCarrierManager"),
188  .AddAttribute ("UseCa",
189  "If true, Carrier Aggregation feature is enabled and a valid Component Carrier Map is expected."
190  "If false, single carrier simulation.",
191  BooleanValue (false),
194  .AddAttribute ("NumberOfComponentCarriers",
195  "Set the number of Component carrier to use "
196  "If it is more than one and m_useCa is false, it will raise an error ",
197  UintegerValue (1),
199  MakeUintegerChecker<uint16_t> (MIN_NO_CC, MAX_NO_CC))
200  ;
201  return tid;
202 }
203 
204 void
206 {
207  NS_LOG_FUNCTION (this);
208  m_downlinkChannel = 0;
209  m_uplinkChannel = 0;
212 }
213 
216 {
217  return m_uplinkChannel;
218 }
219 
222 {
223  return m_downlinkChannel;
224 }
225 
226 void
228 {
229  // Channel Object (i.e. Ptr<SpectrumChannel>) are within a vector
230  // PathLossModel Objects are vectors --> in InstallSingleEnb we will set the frequency
231  NS_LOG_FUNCTION (this << m_noOfCcs);
232 
235 
237  Ptr<SpectrumPropagationLossModel> dlSplm = m_downlinkPathlossModel->GetObject<SpectrumPropagationLossModel> ();
238  if (dlSplm != 0)
239  {
240  NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in DL");
241  m_downlinkChannel->AddSpectrumPropagationLossModel (dlSplm);
242  }
243  else
244  {
245  NS_LOG_LOGIC (this << " using a PropagationLossModel in DL");
246  Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModel->GetObject<PropagationLossModel> ();
247  NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
248  m_downlinkChannel->AddPropagationLossModel (dlPlm);
249  }
250 
253  if (ulSplm != 0)
254  {
255  NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in UL");
256  m_uplinkChannel->AddSpectrumPropagationLossModel (ulSplm);
257  }
258  else
259  {
260  NS_LOG_LOGIC (this << " using a PropagationLossModel in UL");
262  NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
263  m_uplinkChannel->AddPropagationLossModel (ulPlm);
264  }
265  if (!m_fadingModelType.empty ())
266  {
268  m_fadingModule->Initialize ();
269  m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
271  }
272 }
273 
274 void
276 {
277  NS_LOG_FUNCTION (this << h);
278  m_epcHelper = h;
279 }
280 
281 void
282 LteHelper::SetSchedulerType (std::string type)
283 {
284  NS_LOG_FUNCTION (this << type);
287 }
288 
289 std::string
291 {
292  return m_schedulerFactory.GetTypeId ().GetName ();
293 }
294 
295 void
297 {
298  NS_LOG_FUNCTION (this << n);
299  m_schedulerFactory.Set (n, v);
300 }
301 
302 std::string
304 {
306 }
307 
308 void
310 {
311  NS_LOG_FUNCTION (this << type);
314 }
315 
316 void
318 {
319  NS_LOG_FUNCTION (this << n);
320  m_ffrAlgorithmFactory.Set (n, v);
321 }
322 
323 std::string
325 {
327 }
328 
329 void
331 {
332  NS_LOG_FUNCTION (this << type);
335 }
336 
337 void
339 {
340  NS_LOG_FUNCTION (this << n);
342 }
343 
344 
345 std::string
347 {
349 }
350 
351 void
353 {
354  NS_LOG_FUNCTION (this << type);
357 }
358 
359 void
361 {
362  NS_LOG_FUNCTION (this << n);
364 }
365 
366 std::string
368 {
370 }
371 
372 void
374 {
375  NS_LOG_FUNCTION (this << type);
378 }
379 
380 void
382 {
383  NS_LOG_FUNCTION (this << n);
385 }
386 
387 void
389 {
390  NS_LOG_FUNCTION (this << type);
393 }
394 
395 void
397 {
398  NS_LOG_FUNCTION (this << n);
400 }
401 
402 void
404 {
405  NS_LOG_FUNCTION (this);
406  m_enbNetDeviceFactory.Set (n, v);
407 }
408 
409 
410 void
412 {
413  NS_LOG_FUNCTION (this);
415 }
416 
417 void
419 {
420  NS_LOG_FUNCTION (this);
422 }
423 
424 void
426 {
427  NS_LOG_FUNCTION (this);
428  m_ueNetDeviceFactory.Set (n, v);
429 }
430 
431 void
433 {
434  NS_LOG_FUNCTION (this);
436 }
437 
438 void
440 {
441  NS_LOG_FUNCTION (this);
443 }
444 
445 void
446 LteHelper::SetFadingModel (std::string type)
447 {
448  NS_LOG_FUNCTION (this << type);
449  m_fadingModelType = type;
450  if (!type.empty ())
451  {
454  }
455 }
456 
457 void
459 {
460  m_fadingModelFactory.Set (n, v);
461 }
462 
463 void
465 {
466  NS_LOG_FUNCTION (this << type);
468 }
469 
470 void
472 {
473  m_channelFactory.Set (n, v);
474 }
475 
476 void
477 LteHelper::SetCcPhyParams ( std::map< uint8_t, ComponentCarrier> ccMapParams)
478 {
479  NS_LOG_FUNCTION (this);
480  m_componentCarrierPhyParams = ccMapParams;
481 }
482 
485 {
486  NS_LOG_FUNCTION (this);
487  Initialize (); // will run DoInitialize () if necessary
489  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
490  {
491  Ptr<Node> node = *i;
492  Ptr<NetDevice> device = InstallSingleEnbDevice (node);
493  devices.Add (device);
494  }
495  return devices;
496 }
497 
500 {
501  NS_LOG_FUNCTION (this);
503  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
504  {
505  Ptr<Node> node = *i;
506  Ptr<NetDevice> device = InstallSingleUeDevice (node);
507  devices.Add (device);
508  }
509  return devices;
510 }
511 
512 
515 {
516  uint16_t cellId = m_cellIdCounter; // \todo Remove, eNB has no cell ID
517 
520 
521  if (m_componentCarrierPhyParams.size() == 0)
522  {
524  }
525 
526  NS_ASSERT_MSG(m_componentCarrierPhyParams.size()!=0, "Cannot create enb ccm map.");
527  // create component carrier map for this eNb device
528  std::map<uint8_t,Ptr<ComponentCarrierEnb> > ccMap;
529  for (std::map<uint8_t, ComponentCarrier >::iterator it = m_componentCarrierPhyParams.begin (); it != m_componentCarrierPhyParams.end (); ++it)
530  {
531  Ptr <ComponentCarrierEnb> cc = CreateObject<ComponentCarrierEnb> ();
532  cc->SetUlBandwidth(it->second.GetUlBandwidth());
533  cc->SetDlBandwidth(it->second.GetDlBandwidth());
534  cc->SetDlEarfcn(it->second.GetDlEarfcn());
535  cc->SetUlEarfcn(it->second.GetUlEarfcn());
536  cc->SetAsPrimary(it->second.IsPrimary());
537  NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num cells exceeded");
538  cc->SetCellId (m_cellIdCounter++);
539  ccMap [it->first] = cc;
540  }
541  NS_ABORT_MSG_IF (m_useCa && ccMap.size()<2, "You have to either specify carriers or disable carrier aggregation");
542  NS_ASSERT (ccMap.size () == m_noOfCcs);
543 
544  for (std::map<uint8_t,Ptr<ComponentCarrierEnb> >::iterator it = ccMap.begin (); it != ccMap.end (); ++it)
545  {
546  NS_LOG_DEBUG (this << "component carrier map size " << (uint16_t) ccMap.size ());
547  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
548  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
549  Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
550 
551  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
552  dlPhy->SetHarqPhyModule (harq);
553  ulPhy->SetHarqPhyModule (harq);
554  phy->SetHarqPhyModule (harq);
555 
556  Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor> ();
557  pCtrl->AddCallback (MakeCallback (&LteEnbPhy::GenerateCtrlCqiReport, phy));
558  ulPhy->AddCtrlSinrChunkProcessor (pCtrl); // for evaluating SRS UL-CQI
559 
560  Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor> ();
561  pData->AddCallback (MakeCallback (&LteEnbPhy::GenerateDataCqiReport, phy));
562  pData->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, ulPhy));
563  ulPhy->AddDataSinrChunkProcessor (pData); // for evaluating PUSCH UL-CQI
564 
565  Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor> ();
566  pInterf->AddCallback (MakeCallback (&LteEnbPhy::ReportInterference, phy));
567  ulPhy->AddInterferenceDataChunkProcessor (pInterf); // for interference power tracing
568 
569  dlPhy->SetChannel (m_downlinkChannel);
570  ulPhy->SetChannel (m_uplinkChannel);
571 
573  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallEnbDevice ()");
574  dlPhy->SetMobility (mm);
575  ulPhy->SetMobility (mm);
576 
577  Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
578  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
579  dlPhy->SetAntenna (antenna);
580  ulPhy->SetAntenna (antenna);
581 
582  Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
585  it->second->SetMac (mac);
586  it->second->SetFfMacScheduler (sched);
587  it->second->SetFfrAlgorithm (ffrAlgorithm);
588 
589  it->second->SetPhy (phy);
590 
591  }
592 
593  Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
595  rrc->ConfigureCarriers (ccMap);
596 
597  //ComponentCarrierManager SAP
598  rrc->SetLteCcmRrcSapProvider (ccmEnbManager->GetLteCcmRrcSapProvider ());
599  ccmEnbManager->SetLteCcmRrcSapUser (rrc->GetLteCcmRrcSapUser ());
600  ccmEnbManager->SetNumberOfComponentCarriers (m_noOfCcs);
601  ccmEnbManager->SetRrc(rrc);
602 
603  if (m_useIdealRrc)
604  {
605  Ptr<LteEnbRrcProtocolIdeal> rrcProtocol = CreateObject<LteEnbRrcProtocolIdeal> ();
606  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
607  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
608  rrc->AggregateObject (rrcProtocol);
609  rrcProtocol->SetCellId (cellId);
610  }
611  else
612  {
613  Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal> ();
614  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
615  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
616  rrc->AggregateObject (rrcProtocol);
617  rrcProtocol->SetCellId (cellId);
618  }
619 
620  if (m_epcHelper != 0)
621  {
622  EnumValue epsBearerToRlcMapping;
623  rrc->GetAttribute ("EpsBearerToRlcMapping", epsBearerToRlcMapping);
624  // it does not make sense to use RLC/SM when also using the EPC
625  if (epsBearerToRlcMapping.Get () == LteEnbRrc::RLC_SM_ALWAYS)
626  {
627  rrc->SetAttribute ("EpsBearerToRlcMapping", EnumValue (LteEnbRrc::RLC_UM_ALWAYS));
628  }
629  }
630 
631  rrc->SetLteHandoverManagementSapProvider (handoverAlgorithm->GetLteHandoverManagementSapProvider ());
632  handoverAlgorithm->SetLteHandoverManagementSapUser (rrc->GetLteHandoverManagementSapUser ());
633 
634  // This RRC attribute is used to connect each new RLC instance with the MAC layer
635  // (for function such as TransmitPdu, ReportBufferStatusReport).
636  // Since in this new architecture, the component carrier manager acts a proxy, it
637  // will have its own LteMacSapProvider interface, RLC will see it as through original MAC
638  // interface LteMacSapProvider, but the function call will go now through LteEnbComponentCarrierManager
639  // instance that needs to implement functions of this interface, and its task will be to
640  // forward these calls to the specific MAC of some of the instances of component carriers. This
641  // decision will depend on the specific implementation of the component carrier manager.
642  rrc->SetLteMacSapProvider (ccmEnbManager->GetLteMacSapProvider ());
643 
644  bool ccmTest;
645  for (std::map<uint8_t,Ptr<ComponentCarrierEnb> >::iterator it = ccMap.begin (); it != ccMap.end (); ++it)
646  {
647  it->second->GetPhy ()->SetLteEnbCphySapUser (rrc->GetLteEnbCphySapUser (it->first));
648  rrc->SetLteEnbCphySapProvider (it->second->GetPhy ()->GetLteEnbCphySapProvider (), it->first);
649 
650  rrc->SetLteEnbCmacSapProvider (it->second->GetMac ()->GetLteEnbCmacSapProvider (),it->first );
651  it->second->GetMac ()->SetLteEnbCmacSapUser (rrc->GetLteEnbCmacSapUser (it->first));
652 
653  it->second->GetPhy ()->SetComponentCarrierId (it->first);
654  it->second->GetMac ()->SetComponentCarrierId (it->first);
655  //FFR SAP
656  it->second->GetFfMacScheduler ()->SetLteFfrSapProvider (it->second->GetFfrAlgorithm ()->GetLteFfrSapProvider ());
657  it->second->GetFfrAlgorithm ()->SetLteFfrSapUser (it->second->GetFfMacScheduler ()->GetLteFfrSapUser ());
658  rrc->SetLteFfrRrcSapProvider (it->second->GetFfrAlgorithm ()->GetLteFfrRrcSapProvider (), it->first);
659  it->second->GetFfrAlgorithm ()->SetLteFfrRrcSapUser (rrc->GetLteFfrRrcSapUser (it->first));
660  //FFR SAP END
661 
662  // PHY <--> MAC SAP
663  it->second->GetPhy ()->SetLteEnbPhySapUser (it->second->GetMac ()->GetLteEnbPhySapUser ());
664  it->second->GetMac ()->SetLteEnbPhySapProvider (it->second->GetPhy ()->GetLteEnbPhySapProvider ());
665  // PHY <--> MAC SAP END
666 
667  //Scheduler SAP
668  it->second->GetMac ()->SetFfMacSchedSapProvider (it->second->GetFfMacScheduler ()->GetFfMacSchedSapProvider ());
669  it->second->GetMac ()->SetFfMacCschedSapProvider (it->second->GetFfMacScheduler ()->GetFfMacCschedSapProvider ());
670 
671  it->second->GetFfMacScheduler ()->SetFfMacSchedSapUser (it->second->GetMac ()->GetFfMacSchedSapUser ());
672  it->second->GetFfMacScheduler ()->SetFfMacCschedSapUser (it->second->GetMac ()->GetFfMacCschedSapUser ());
673  // Scheduler SAP END
674 
675  it->second->GetMac ()->SetLteCcmMacSapUser (ccmEnbManager->GetLteCcmMacSapUser ());
676  ccmEnbManager->SetCcmMacSapProviders (it->first, it->second->GetMac ()->GetLteCcmMacSapProvider ());
677 
678  // insert the pointer to the LteMacSapProvider interface of the MAC layer of the specific component carrier
679  ccmTest = ccmEnbManager->SetMacSapProvider (it->first, it->second->GetMac ()->GetLteMacSapProvider());
680 
681  if (ccmTest == false)
682  {
683  NS_FATAL_ERROR ("Error in SetComponentCarrierMacSapProviders");
684  }
685  }
686 
687 
688 
689  dev->SetNode (n);
690  dev->SetAttribute ("CellId", UintegerValue (cellId));
691  dev->SetAttribute ("LteEnbComponentCarrierManager", PointerValue (ccmEnbManager));
692  dev->SetCcMap (ccMap);
693  std::map<uint8_t,Ptr<ComponentCarrierEnb> >::iterator it = ccMap.begin ();
694  dev->SetAttribute ("LteEnbRrc", PointerValue (rrc));
695  dev->SetAttribute ("LteHandoverAlgorithm", PointerValue (handoverAlgorithm));
696  dev->SetAttribute ("LteFfrAlgorithm", PointerValue (it->second->GetFfrAlgorithm ()));
697 
698  if (m_isAnrEnabled)
699  {
700  Ptr<LteAnr> anr = CreateObject<LteAnr> (cellId);
701  rrc->SetLteAnrSapProvider (anr->GetLteAnrSapProvider ());
702  anr->SetLteAnrSapUser (rrc->GetLteAnrSapUser ());
703  dev->SetAttribute ("LteAnr", PointerValue (anr));
704  }
705 
706  for (it = ccMap.begin (); it != ccMap.end (); ++it)
707  {
708  Ptr<LteEnbPhy> ccPhy = it->second->GetPhy ();
709  ccPhy->SetDevice (dev);
710  ccPhy->GetUlSpectrumPhy ()->SetDevice (dev);
711  ccPhy->GetDlSpectrumPhy ()->SetDevice (dev);
712  ccPhy->GetUlSpectrumPhy ()->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, ccPhy));
713  ccPhy->GetUlSpectrumPhy ()->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteEnbPhy::ReceiveLteControlMessageList, ccPhy));
714  ccPhy->GetUlSpectrumPhy ()->SetLtePhyUlHarqFeedbackCallback (MakeCallback (&LteEnbPhy::ReceiveLteUlHarqFeedback, ccPhy));
715  NS_LOG_LOGIC ("set the propagation model frequencies");
716  double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency (it->second->m_dlEarfcn);
717  NS_LOG_LOGIC ("DL freq: " << dlFreq);
718  bool dlFreqOk = m_downlinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq));
719  if (!dlFreqOk)
720  {
721  NS_LOG_WARN ("DL propagation model does not have a Frequency attribute");
722  }
723 
724  double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency (it->second->m_ulEarfcn);
725 
726  NS_LOG_LOGIC ("UL freq: " << ulFreq);
727  bool ulFreqOk = m_uplinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq));
728  if (!ulFreqOk)
729  {
730  NS_LOG_WARN ("UL propagation model does not have a Frequency attribute");
731  }
732  } //end for
733  rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
734  dev->Initialize ();
735  n->AddDevice (dev);
736 
737  for (it = ccMap.begin (); it != ccMap.end (); ++it)
738  {
739  m_uplinkChannel->AddRx (it->second->GetPhy ()->GetUlSpectrumPhy ());
740  }
741 
742  if (m_epcHelper != 0)
743  {
744  NS_LOG_INFO ("adding this eNB to the EPC");
745  m_epcHelper->AddEnb (n, dev, dev->GetCellId ());
747  NS_ASSERT_MSG (enbApp != 0, "cannot retrieve EpcEnbApplication");
748 
749  // S1 SAPs
750  rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
751  enbApp->SetS1SapUser (rrc->GetS1SapUser ());
752 
753  // X2 SAPs
754  Ptr<EpcX2> x2 = n->GetObject<EpcX2> ();
755  x2->SetEpcX2SapUser (rrc->GetEpcX2SapUser ());
756  rrc->SetEpcX2SapProvider (x2->GetEpcX2SapProvider ());
757  }
758 
759  return dev;
760 }
761 
764 {
765  NS_LOG_FUNCTION (this);
766 
767  NS_ABORT_MSG_IF (m_componentCarrierPhyParams.size() == 0 && m_useCa, "If CA is enabled, before call this method you need to install Enbs --> InstallEnbDevice()");
768 
770  std::map<uint8_t, Ptr<ComponentCarrierUe> > ueCcMap;
771 
772  for (std::map< uint8_t, ComponentCarrier >::iterator it = m_componentCarrierPhyParams.begin() ; it != m_componentCarrierPhyParams.end(); ++it)
773  {
774  Ptr <ComponentCarrierUe> cc = CreateObject<ComponentCarrierUe> ();
775  cc->SetUlBandwidth ( it->second.GetUlBandwidth ());
776  cc->SetDlBandwidth ( it->second.GetDlBandwidth ());
777  cc->SetDlEarfcn ( it->second.GetDlEarfcn ());
778  cc->SetUlEarfcn ( it->second.GetUlEarfcn ());
779  cc->SetAsPrimary (it->second.IsPrimary());
780  Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
781  cc->SetMac (mac);
782  // cc->GetPhy ()->Initialize (); // it is initialized within the LteUeNetDevice::DoInitialize ()
783  ueCcMap.insert (std::pair<uint8_t, Ptr<ComponentCarrierUe> > (it->first, cc));
784  }
785 
786  for (std::map<uint8_t, Ptr<ComponentCarrierUe> >::iterator it = ueCcMap.begin (); it != ueCcMap.end (); ++it)
787  {
788  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
789  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
790 
791  Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
792 
793  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
794  dlPhy->SetHarqPhyModule (harq);
795  ulPhy->SetHarqPhyModule (harq);
796  phy->SetHarqPhyModule (harq);
797 
798  Ptr<LteChunkProcessor> pRs = Create<LteChunkProcessor> ();
799  pRs->AddCallback (MakeCallback (&LteUePhy::ReportRsReceivedPower, phy));
800  dlPhy->AddRsPowerChunkProcessor (pRs);
801 
802  Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor> ();
803  pInterf->AddCallback (MakeCallback (&LteUePhy::ReportInterference, phy));
804  dlPhy->AddInterferenceCtrlChunkProcessor (pInterf); // for RSRQ evaluation of UE Measurements
805 
806  Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor> ();
807  pCtrl->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
808  dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
809 
810  Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor> ();
811  pData->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
812  dlPhy->AddDataSinrChunkProcessor (pData);
813 
815  {
816  // CQI calculation based on PDCCH for signal and PDSCH for interference
817  pCtrl->AddCallback (MakeCallback (&LteUePhy::GenerateMixedCqiReport, phy));
818  Ptr<LteChunkProcessor> pDataInterf = Create<LteChunkProcessor> ();
819  pDataInterf->AddCallback (MakeCallback (&LteUePhy::ReportDataInterference, phy));
820  dlPhy->AddInterferenceDataChunkProcessor (pDataInterf);
821  }
822  else
823  {
824  // CQI calculation based on PDCCH for both signal and interference
825  pCtrl->AddCallback (MakeCallback (&LteUePhy::GenerateCtrlCqiReport, phy));
826  }
827 
828  dlPhy->SetChannel (m_downlinkChannel);
829  ulPhy->SetChannel (m_uplinkChannel);
830 
832  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
833  dlPhy->SetMobility (mm);
834  ulPhy->SetMobility (mm);
835 
836  Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
837  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
838  dlPhy->SetAntenna (antenna);
839  ulPhy->SetAntenna (antenna);
840 
841  it->second->SetPhy(phy);
842  }
844  ccmUe->SetNumberOfComponentCarriers (m_noOfCcs);
845 
846  Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc> ();
847  rrc->m_numberOfComponentCarriers = m_noOfCcs;
848  // run intializeSap to create the proper number of sap provider/users
849  rrc->InitializeSap();
850  rrc->SetLteMacSapProvider (ccmUe->GetLteMacSapProvider ());
851  // setting ComponentCarrierManager SAP
852  rrc->SetLteCcmRrcSapProvider (ccmUe->GetLteCcmRrcSapProvider ());
853  ccmUe->SetLteCcmRrcSapUser (rrc->GetLteCcmRrcSapUser ());
854 
855  if (m_useIdealRrc)
856  {
857  Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal> ();
858  rrcProtocol->SetUeRrc (rrc);
859  rrc->AggregateObject (rrcProtocol);
860  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
861  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
862  }
863  else
864  {
865  Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal> ();
866  rrcProtocol->SetUeRrc (rrc);
867  rrc->AggregateObject (rrcProtocol);
868  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
869  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
870  }
871 
872  if (m_epcHelper != 0)
873  {
874  rrc->SetUseRlcSm (false);
875  }
876  Ptr<EpcUeNas> nas = CreateObject<EpcUeNas> ();
877 
878  nas->SetAsSapProvider (rrc->GetAsSapProvider ());
879  rrc->SetAsSapUser (nas->GetAsSapUser ());
880 
881  for (std::map<uint8_t, Ptr<ComponentCarrierUe> >::iterator it = ueCcMap.begin (); it != ueCcMap.end (); ++it)
882  {
883  rrc->SetLteUeCmacSapProvider (it->second->GetMac ()->GetLteUeCmacSapProvider (), it->first);
884  it->second->GetMac ()->SetLteUeCmacSapUser (rrc->GetLteUeCmacSapUser (it->first));
885  it->second->GetMac ()->SetComponentCarrierId (it->first);
886 
887  it->second->GetPhy ()->SetLteUeCphySapUser (rrc->GetLteUeCphySapUser (it->first));
888  rrc->SetLteUeCphySapProvider (it->second->GetPhy ()->GetLteUeCphySapProvider (), it->first);
889  it->second->GetPhy ()->SetComponentCarrierId (it->first);
890 
891  it->second->GetPhy ()->SetLteUePhySapUser (it->second->GetMac ()->GetLteUePhySapUser ());
892  it->second->GetMac ()->SetLteUePhySapProvider (it->second->GetPhy ()->GetLteUePhySapProvider ());
893 
894  bool ccmTest = ccmUe->SetComponentCarrierMacSapProviders (it->first, it->second->GetMac ()->GetLteMacSapProvider());
895 
896  if (ccmTest == false)
897  {
898  NS_FATAL_ERROR ("Error in SetComponentCarrierMacSapProviders");
899  }
900  }
901 
902  NS_ABORT_MSG_IF (m_imsiCounter >= 0xFFFFFFFF, "max num UEs exceeded");
903  uint64_t imsi = ++m_imsiCounter;
904 
905 
906  dev->SetNode (n);
907  dev->SetAttribute ("Imsi", UintegerValue (imsi));
908  dev->SetCcMap (ueCcMap);
909  dev->SetAttribute ("LteUeRrc", PointerValue (rrc));
910  dev->SetAttribute ("EpcUeNas", PointerValue (nas));
911  dev->SetAttribute ("LteUeComponentCarrierManager", PointerValue (ccmUe));
912 
913  for (std::map<uint8_t, Ptr<ComponentCarrierUe> >::iterator it = ueCcMap.begin (); it != ueCcMap.end (); ++it)
914  {
915  Ptr<LteUePhy> ccPhy = it->second->GetPhy ();
916  ccPhy->SetDevice (dev);
917  ccPhy->GetUlSpectrumPhy ()->SetDevice (dev);
918  ccPhy->GetDlSpectrumPhy ()->SetDevice (dev);
919  ccPhy->GetDlSpectrumPhy ()->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, ccPhy));
920  ccPhy->GetDlSpectrumPhy ()->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteUePhy::ReceiveLteControlMessageList, ccPhy));
921  ccPhy->GetDlSpectrumPhy ()->SetLtePhyRxPssCallback (MakeCallback (&LteUePhy::ReceivePss, ccPhy));
922  ccPhy->GetDlSpectrumPhy ()->SetLtePhyDlHarqFeedbackCallback (MakeCallback (&LteUePhy::ReceiveLteDlHarqFeedback, ccPhy));
923  }
924 
925  nas->SetDevice (dev);
926 
927  n->AddDevice (dev);
928 
929  nas->SetForwardUpCallback (MakeCallback (&LteUeNetDevice::Receive, dev));
930 
931  if (m_epcHelper != 0)
932  {
933  m_epcHelper->AddUe (dev, dev->GetImsi ());
934  }
935 
936  dev->Initialize ();
937 
938  return dev;
939 }
940 
941 
942 void
944 {
945  NS_LOG_FUNCTION (this);
946  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
947  {
948  Attach (*i);
949  }
950 }
951 
952 void
954 {
955  NS_LOG_FUNCTION (this);
956 
957  if (m_epcHelper == 0)
958  {
959  NS_FATAL_ERROR ("This function is not valid without properly configured EPC");
960  }
961 
962  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
963  if (ueLteDevice == 0)
964  {
965  NS_FATAL_ERROR ("The passed NetDevice must be an LteUeNetDevice");
966  }
967 
968  // initiate cell selection
969  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
970  NS_ASSERT (ueNas != 0);
971  uint32_t dlEarfcn = ueLteDevice->GetDlEarfcn ();
972  ueNas->StartCellSelection (dlEarfcn);
973 
974  // instruct UE to immediately enter CONNECTED mode after camping
975  ueNas->Connect ();
976 
977  // activate default EPS bearer
978  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (),
979  EpcTft::Default (),
981 }
982 
983 void
985 {
986  NS_LOG_FUNCTION (this);
987  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
988  {
989  Attach (*i, enbDevice);
990  }
991 }
992 
993 void
995 {
996  NS_LOG_FUNCTION (this);
997  //enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
998 
999  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
1000  Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> ();
1001 
1002  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
1003  ueNas->Connect (enbLteDevice->GetCellId (), enbLteDevice->GetDlEarfcn ());
1004 
1005  if (m_epcHelper != 0)
1006  {
1007  // activate default EPS bearer
1008  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (), EpcTft::Default (), EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT));
1009  }
1010 
1011  // tricks needed for the simplified LTE-only simulations
1012  if (m_epcHelper == 0)
1013  {
1014  ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
1015  }
1016 }
1017 
1018 void
1020 {
1021  NS_LOG_FUNCTION (this);
1022  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
1023  {
1024  AttachToClosestEnb (*i, enbDevices);
1025  }
1026 }
1027 
1028 void
1030 {
1031  NS_LOG_FUNCTION (this);
1032  NS_ASSERT_MSG (enbDevices.GetN () > 0, "empty enb device container");
1033  Vector uepos = ueDevice->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
1034  double minDistance = std::numeric_limits<double>::infinity ();
1035  Ptr<NetDevice> closestEnbDevice;
1036  for (NetDeviceContainer::Iterator i = enbDevices.Begin (); i != enbDevices.End (); ++i)
1037  {
1038  Vector enbpos = (*i)->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
1039  double distance = CalculateDistance (uepos, enbpos);
1040  if (distance < minDistance)
1041  {
1042  minDistance = distance;
1043  closestEnbDevice = *i;
1044  }
1045  }
1046  NS_ASSERT (closestEnbDevice != 0);
1047  Attach (ueDevice, closestEnbDevice);
1048 }
1049 
1050 uint8_t
1052 {
1053  NS_LOG_FUNCTION (this);
1054  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
1055  {
1056  uint8_t bearerId = ActivateDedicatedEpsBearer (*i, bearer, tft);
1057  return bearerId;
1058  }
1059  return 0;
1060 }
1061 
1062 
1063 uint8_t
1065 {
1066  NS_LOG_FUNCTION (this);
1067 
1068  NS_ASSERT_MSG (m_epcHelper != 0, "dedicated EPS bearers cannot be set up when the EPC is not used");
1069 
1070  uint64_t imsi = ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
1071  uint8_t bearerId = m_epcHelper->ActivateEpsBearer (ueDevice, imsi, tft, bearer);
1072  return bearerId;
1073 }
1074 
1084 class DrbActivator : public SimpleRefCount<DrbActivator>
1085 {
1086 public:
1093  DrbActivator (Ptr<NetDevice> ueDevice, EpsBearer bearer);
1094 
1105  static void ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
1106 
1117  void ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti);
1118 private:
1124  bool m_active;
1136  uint64_t m_imsi;
1137 };
1138 
1140  : m_active (false),
1141  m_ueDevice (ueDevice),
1142  m_bearer (bearer),
1143  m_imsi (m_ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ())
1144 {
1145 }
1146 
1147 void
1148 DrbActivator::ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
1149 {
1150  NS_LOG_FUNCTION (a << context << imsi << cellId << rnti);
1151  a->ActivateDrb (imsi, cellId, rnti);
1152 }
1153 
1154 void
1155 DrbActivator::ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti)
1156 {
1157  NS_LOG_FUNCTION (this << imsi << cellId << rnti << m_active);
1158  if ((!m_active) && (imsi == m_imsi))
1159  {
1160  Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
1161  NS_ASSERT (ueRrc->GetState () == LteUeRrc::CONNECTED_NORMALLY);
1162  uint16_t rnti = ueRrc->GetRnti ();
1163  Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
1164  Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
1165  NS_ASSERT (ueRrc->GetCellId () == enbLteDevice->GetCellId ());
1166  Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
1167  NS_ASSERT (ueManager->GetState () == UeManager::CONNECTED_NORMALLY
1168  || ueManager->GetState () == UeManager::CONNECTION_RECONFIGURATION);
1170  params.rnti = rnti;
1171  params.bearer = m_bearer;
1172  params.bearerId = 0;
1173  params.gtpTeid = 0; // don't care
1174  enbRrc->GetS1SapUser ()->DataRadioBearerSetupRequest (params);
1175  m_active = true;
1176  }
1177 }
1178 
1179 
1180 void
1182 {
1183  NS_LOG_FUNCTION (this << ueDevice);
1184  NS_ASSERT_MSG (m_epcHelper == 0, "this method must not be used when the EPC is being used");
1185 
1186  // Normally it is the EPC that takes care of activating DRBs
1187  // when the UE gets connected. When the EPC is not used, we achieve
1188  // the same behavior by hooking a dedicated DRB activation function
1189  // to the Enb RRC Connection Established trace source
1190 
1191 
1192  Ptr<LteEnbNetDevice> enbLteDevice = ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
1193 
1194  std::ostringstream path;
1195  path << "/NodeList/" << enbLteDevice->GetNode ()->GetId ()
1196  << "/DeviceList/" << enbLteDevice->GetIfIndex ()
1197  << "/LteEnbRrc/ConnectionEstablished";
1198  Ptr<DrbActivator> arg = Create<DrbActivator> (ueDevice, bearer);
1200 }
1201 
1202 void
1204 {
1205  NS_LOG_FUNCTION (this);
1206 
1207  NS_ASSERT_MSG (m_epcHelper != 0, "X2 interfaces cannot be set up when the EPC is not used");
1208 
1209  for (NodeContainer::Iterator i = enbNodes.Begin (); i != enbNodes.End (); ++i)
1210  {
1211  for (NodeContainer::Iterator j = i + 1; j != enbNodes.End (); ++j)
1212  {
1213  AddX2Interface (*i, *j);
1214  }
1215  }
1216 }
1217 
1218 void
1220 {
1221  NS_LOG_FUNCTION (this);
1222  NS_LOG_INFO ("setting up the X2 interface");
1223 
1224  m_epcHelper->AddX2Interface (enbNode1, enbNode2);
1225 }
1226 
1227 void
1229 {
1230  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
1231  NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
1232  uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice> ()->GetCellId ();
1233  Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetCellId);
1234 }
1235 
1236 void
1237 LteHelper::HandoverRequest (Time hoTime, Ptr<NetDevice> ueDev, Ptr<NetDevice> sourceEnbDev, uint16_t targetCellId)
1238 {
1239  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetCellId);
1240  NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
1241  Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetCellId);
1242 }
1243 
1244 void
1245 LteHelper::DoHandoverRequest (Ptr<NetDevice> ueDev, Ptr<NetDevice> sourceEnbDev, uint16_t targetCellId)
1246 {
1247  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetCellId);
1248 
1249  Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice> ()->GetRrc ();
1250  uint16_t rnti = ueDev->GetObject<LteUeNetDevice> ()->GetRrc ()->GetRnti ();
1251  sourceRrc->SendHandoverRequest (rnti, targetCellId);
1252 }
1253 
1254 void
1256 {
1257  NS_LOG_FUNCTION (this << ueDevice << bearerId);
1258  NS_ASSERT_MSG (m_epcHelper != 0, "Dedicated EPS bearers cannot be de-activated when the EPC is not used");
1259  NS_ASSERT_MSG (bearerId != 1, "Default bearer cannot be de-activated until and unless and UE is released");
1260 
1261  DoDeActivateDedicatedEpsBearer (ueDevice, enbDevice, bearerId);
1262 }
1263 
1264 void
1266 {
1267  NS_LOG_FUNCTION (this << ueDevice << bearerId);
1268 
1269  //Extract IMSI and rnti
1270  uint64_t imsi = ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
1271  uint16_t rnti = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ()->GetRnti ();
1272 
1273 
1274  Ptr<LteEnbRrc> enbRrc = enbDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
1275 
1276  enbRrc->DoSendReleaseDataRadioBearer (imsi,rnti,bearerId);
1277 }
1278 
1279 void
1280 LteHelper::DoComponentCarrierConfigure (uint32_t ulEarfcn, uint32_t dlEarfcn, uint8_t ulbw, uint8_t dlbw)
1281 {
1282  NS_ASSERT_MSG (m_componentCarrierPhyParams.size()==0, "Cc map already exists.");
1283  Ptr<CcHelper> ccHelper = CreateObject<CcHelper> ();
1284  ccHelper->SetNumberOfComponentCarriers (m_noOfCcs);
1285  ccHelper->SetUlEarfcn (ulEarfcn);
1286  ccHelper->SetDlEarfcn (dlEarfcn);
1287  ccHelper->SetDlBandwidth (dlbw);
1288  ccHelper->SetUlBandwidth (ulbw);
1289  m_componentCarrierPhyParams = ccHelper->EquallySpacedCcs ();
1290  m_componentCarrierPhyParams.at(0).SetAsPrimary(true);
1291 }
1292 
1293 void
1295 {
1296  NS_LOG_FUNCTION (this);
1297  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
1298  {
1299  ActivateDataRadioBearer (*i, bearer);
1300  }
1301 }
1302 
1303 void
1305 {
1306  LogComponentEnable ("LteHelper", LOG_LEVEL_ALL);
1307  LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
1308  LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
1309  LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
1310  LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
1311  LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
1312  LogComponentEnable ("LteRlcUm", LOG_LEVEL_ALL);
1313  LogComponentEnable ("LteRlcAm", LOG_LEVEL_ALL);
1314  LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
1315  LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
1316 
1317  LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
1318  LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
1319  LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
1320  LogComponentEnable ("LteSpectrumValueHelper", LOG_LEVEL_ALL);
1321  LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
1322  LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
1323  LogComponentEnable ("LteChunkProcessor", LOG_LEVEL_ALL);
1324 
1325  std::string propModelStr = m_pathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
1326  LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
1327  LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
1328  LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
1329 
1330  LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
1331  LogComponentEnable ("LteStatsCalculator", LOG_LEVEL_ALL);
1332  LogComponentEnable ("MacStatsCalculator", LOG_LEVEL_ALL);
1333  LogComponentEnable ("PhyTxStatsCalculator", LOG_LEVEL_ALL);
1334  LogComponentEnable ("PhyRxStatsCalculator", LOG_LEVEL_ALL);
1335  LogComponentEnable ("PhyStatsCalculator", LOG_LEVEL_ALL);
1336 
1337 
1338 }
1339 
1340 void
1342 {
1343  EnablePhyTraces ();
1344  EnableMacTraces ();
1345  EnableRlcTraces ();
1346  EnablePdcpTraces ();
1347 }
1348 
1349 void
1351 {
1352  NS_ASSERT_MSG (m_rlcStats == 0, "please make sure that LteHelper::EnableRlcTraces is called at most once");
1353  m_rlcStats = CreateObject<RadioBearerStatsCalculator> ("RLC");
1355 }
1356 
1357 int64_t
1359 {
1360  int64_t currentStream = stream;
1361  if ((m_fadingModule != 0) && (m_fadingStreamsAssigned == false))
1362  {
1364  if (tflm != 0)
1365  {
1366  currentStream += tflm->AssignStreams (currentStream);
1367  m_fadingStreamsAssigned = true;
1368  }
1369  }
1370  Ptr<NetDevice> netDevice;
1371  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
1372  {
1373  netDevice = (*i);
1374  Ptr<LteEnbNetDevice> lteEnb = DynamicCast<LteEnbNetDevice> (netDevice);
1375  if (lteEnb)
1376  {
1377  std::map< uint8_t, Ptr <ComponentCarrierEnb> > tmpMap = lteEnb->GetCcMap ();
1378  std::map< uint8_t, Ptr <ComponentCarrierEnb> >::iterator it;
1379  it = tmpMap.begin ();
1380  Ptr<LteSpectrumPhy> dlPhy = it->second->GetPhy ()->GetDownlinkSpectrumPhy ();
1381  Ptr<LteSpectrumPhy> ulPhy = it->second->GetPhy ()->GetUplinkSpectrumPhy ();
1382  currentStream += dlPhy->AssignStreams (currentStream);
1383  currentStream += ulPhy->AssignStreams (currentStream);
1384  }
1385  Ptr<LteUeNetDevice> lteUe = DynamicCast<LteUeNetDevice> (netDevice);
1386  if (lteUe)
1387  {
1388  std::map< uint8_t, Ptr <ComponentCarrierUe> > tmpMap = lteUe->GetCcMap ();
1389  std::map< uint8_t, Ptr <ComponentCarrierUe> >::iterator it;
1390  it = tmpMap.begin ();
1391  Ptr<LteSpectrumPhy> dlPhy = it->second->GetPhy ()->GetDownlinkSpectrumPhy ();
1392  Ptr<LteSpectrumPhy> ulPhy = it->second->GetPhy ()->GetUplinkSpectrumPhy ();
1393  Ptr<LteUeMac> ueMac = lteUe->GetMac ();
1394  currentStream += dlPhy->AssignStreams (currentStream);
1395  currentStream += ulPhy->AssignStreams (currentStream);
1396  currentStream += ueMac->AssignStreams (currentStream);
1397  }
1398  }
1399  return (currentStream - stream);
1400 }
1401 
1402 
1403 void
1405 {
1406  EnableDlPhyTraces ();
1407  EnableUlPhyTraces ();
1412 }
1413 
1414 void
1416 {
1417  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/DlPhyTransmission",
1419 }
1420 
1421 void
1423 {
1424  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/UlPhyTransmission",
1426 }
1427 
1428 void
1430 {
1431  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1433 }
1434 
1435 void
1437 {
1438  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1440 }
1441 
1442 
1443 void
1445 {
1446  EnableDlMacTraces ();
1447  EnableUlMacTraces ();
1448 }
1449 
1450 
1451 void
1453 {
1455  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/DlScheduling",
1457 }
1458 
1459 void
1461 {
1463  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbMac/UlScheduling",
1465 }
1466 
1467 void
1469 {
1471  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMapUe/*/LteUePhy/ReportCurrentCellRsrpSinr",
1473 }
1474 
1475 void
1477 {
1479  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportUeSinr",
1481  Config::Connect ("/NodeList/*/DeviceList/*/ComponentCarrierMap/*/LteEnbPhy/ReportInterference",
1483 
1484 }
1485 
1488 {
1489  return m_rlcStats;
1490 }
1491 
1492 void
1494 {
1495  NS_ASSERT_MSG (m_pdcpStats == 0, "please make sure that LteHelper::EnablePdcpTraces is called at most once");
1496  m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ("PDCP");
1498 }
1499 
1502 {
1503  return m_pdcpStats;
1504 }
1505 
1506 } // namespace ns3
void SetFadingModel(std::string type)
Set the type of fading model to be used in both DL and UL.
Definition: lte-helper.cc:446
Ptr< const AttributeChecker > MakeStringChecker(void)
Definition: string.cc:30
Parameters passed to DataRadioBearerSetupRequest ()
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
TypeId GetTypeId(void) const
Get the TypeId which will be created by this ObjectFactory.
Ptr< Object > m_uplinkPathlossModel
The path loss model used in the uplink channel.
Definition: lte-helper.h:751
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:396
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)=0
Add the single-frequency propagation loss model to be used.
void EnableDlRxPhyTraces(void)
Enable trace sinks for DL reception PHY layer.
Definition: lte-helper.cc:1429
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
RadioBearerStatsConnector m_radioBearerStatsConnector
Connects RLC and PDCP statistics containers to appropriate trace sources.
Definition: lte-helper.h:801
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Ptr< NetDevice > InstallSingleEnbDevice(Ptr< Node > n)
Create an eNodeB device (LteEnbNetDevice) on the given node.
Definition: lte-helper.cc:514
The abstract base class of a handover algorithm that operates using the Handover Management SAP inter...
static TypeId GetTypeId(void)
Register this type.
Definition: lte-helper.cc:109
AttributeValue implementation for Boolean.
Definition: boolean.h:36
tuple devices
Definition: first.py:32
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:484
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:614
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
uint16_t GetCellId() const
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetCcPhyParams(std::map< uint8_t, ComponentCarrier > ccmap)
This method is used to send the ComponentCarrier map created with CcHelper to the helper...
Definition: lte-helper.cc:477
void EnableLogComponents(void)
Enables full-blown logging for major components of the LENA architecture.
Definition: lte-helper.cc:1304
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:459
Hold variables of type string.
Definition: string.h:41
void HandoverRequest(Time hoTime, Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
Manually trigger an X2-based handover.
Definition: lte-helper.cc:1228
bool m_fadingStreamsAssigned
True if a random variable stream number has been assigned for the fading model.
Definition: lte-helper.h:786
ObjectFactory m_fadingModelFactory
Factory of fading model object for both the downlink and uplink channels.
Definition: lte-helper.h:779
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:1148
uint8_t GetUlBandwidth() const
virtual void SetNode(Ptr< Node > node)
Hold a value for an Attribute.
Definition: attribute.h:68
void EnableDlPhyTraces(void)
Enable trace sinks for DL PHY layer.
Definition: lte-helper.cc:1468
uint16_t rnti
the RNTI identifying the UE for which the DataRadioBearer is to be created
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:477
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:539
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:84
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:329
DrbActivator(Ptr< NetDevice > ueDevice, EpsBearer bearer)
DrbActivator Constructor.
Definition: lte-helper.cc:1139
Ptr< SpectrumChannel > GetUplinkSpectrumChannel(void) const
Definition: lte-helper.cc:215
void DoComponentCarrierConfigure(uint32_t ulEarfcn, uint32_t dlEarfcn, uint8_t ulbw, uint8_t dlbw)
A private function used for component carrier configuration.
Definition: lte-helper.cc:1280
void SetUeAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE antenna model to be created.
Definition: lte-helper.cc:439
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition: epc-tft.cc:155
#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
std::map< uint8_t, ComponentCarrier > m_componentCarrierPhyParams
This contains all the information about each component carrier.
Definition: lte-helper.h:851
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:943
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
void SetEnbComponentCarrierManagerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the enb component carrier manager to be created.
Definition: lte-helper.cc:360
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1350
bool m_usePdschForCqiGeneration
The UsePdschForCqiGeneration attribute.
Definition: lte-helper.h:838
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< PhyStatsCalculator > m_phyStats
Container of PHY layer statistics.
Definition: lte-helper.h:789
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Enables trace sinks for PDCP layer.
Ptr< PhyRxStatsCalculator > m_phyRxStats
Container of PHY layer statistics related to reception.
Definition: lte-helper.h:793
std::string m_fadingModelType
Name of fading model type, e.g., "ns3::TraceFadingLossModel".
Definition: lte-helper.h:777
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
Definition: object-base.cc:205
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the UE devices (LteUeNetDevice) to be created.
Definition: lte-helper.cc:425
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:277
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
void SetUeAntennaModelType(std::string type)
Set the type of antenna model to be used by UE devices.
Definition: lte-helper.cc:432
ObjectFactory m_enbComponentCarrierManagerFactory
Factory of enb component carrier manager object.
Definition: lte-helper.h:760
int Get(void) const
Definition: enum.cc:52
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Ptr< MacStatsCalculator > m_macStats
Container of MAC layer statistics.
Definition: lte-helper.h:795
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
Definition: lte-helper.cc:1358
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1294
void SetEnbComponentCarrierManagerType(std::string type)
Set the type of carrier component algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:352
ObjectFactory m_channelFactory
Factory of both the downlink and uplink LTE channels.
Definition: lte-helper.h:774
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:1051
void ChannelModelInitialization(void)
Function that performs a channel model initialization of all component carriers.
Definition: lte-helper.cc:227
std::string GetUeComponentCarrierManagerType() const
Definition: lte-helper.cc:367
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:330
void EnableUlRxPhyTraces(void)
Enable trace sinks for UL reception PHY layer.
Definition: lte-helper.cc:1436
void SetFfrAlgorithmType(std::string type)
Set the type of FFR algorithm to be used by eNodeB devices.
Definition: lte-helper.cc:309
static TypeId GetTypeId(void)
Get the type ID.
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:282
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
uint32_t GetUlEarfcn() const
Ptr< RadioBearerStatsCalculator > m_rlcStats
Container of RLC layer statistics.
Definition: lte-helper.h:797
std::string GetHandoverAlgorithmType() const
Definition: lte-helper.cc:324
void EnablePdcpTraces(void)
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1493
#define MIN_NO_CC
Definition: lte-enb-rrc.h:54
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:1019
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.
virtual Ptr< Node > GetNode(void) const
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-enb-phy.cc:842
Ptr< Object > m_downlinkPathlossModel
The path loss model used in the downlink channel.
Definition: lte-helper.h:749
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
ObjectFactory m_pathlossModelFactory
Factory of path loss model object.
Definition: lte-helper.h:772
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:1255
Ptr< Application > GetApplication(uint32_t index) const
Retrieve the index-th Application associated to this node.
Definition: node.cc:168
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:369
tuple phy
Definition: third.py:86
Ptr< NetDevice > m_ueDevice
UeNetDevice for which bearer will be activated.
Definition: lte-helper.cc:1128
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the handover algorithm to be created.
Definition: lte-helper.cc:338
Hold variables of type enum.
Definition: enum.h:54
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1375
virtual uint32_t GetIfIndex(void) const
void SetUeComponentCarrierManagerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the ue component carrier manager to be created.
Definition: lte-helper.cc:381
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:854
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:92
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
ObjectFactory m_ueComponentCarrierManagerFactory
Factory of ue component carrier manager object.
Definition: lte-helper.h:762
uint64_t m_imsi
imsi the unique UE identifier
Definition: lte-helper.cc:1136
void EnableRlcStats(Ptr< RadioBearerStatsCalculator > rlcStats)
Enables trace sinks for RLC layer.
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1341
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
Hold an unsigned integer type.
Definition: uinteger.h:44
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
Set an attribute for the scheduler to be created.
Definition: lte-helper.cc:296
Ptr< NetDevice > InstallSingleUeDevice(Ptr< Node > n)
Create a UE device (LteUeNetDevice) on the given node.
Definition: lte-helper.cc:763
static TypeId GetTypeId(void)
Get the type ID.
uint64_t m_imsiCounter
Keep track of the number of IMSI allocated.
Definition: lte-helper.h:815
ObjectFactory m_enbAntennaModelFactory
Factory of antenna object for eNodeB.
Definition: lte-helper.h:766
holds a vector of ns3::NetDevice pointers
void SetPathlossModelType(TypeId type)
Set the type of path loss model to be used for both DL and UL channels.
Definition: lte-helper.cc:388
virtual void AddSpectrumPropagationLossModel(Ptr< SpectrumPropagationLossModel > loss)=0
Add the frequency-dependent propagation loss model to be used.
AttributeValue implementation for TypeId.
Definition: type-id.h:608
uint16_t m_cellIdCounter
Keep track of the number of cell ID allocated.
Definition: lte-helper.h:821
void EnablePhyTraces(void)
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1404
bool m_isAnrEnabled
The AnrEnabled attribute.
Definition: lte-helper.h:832
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1489
void SetUeComponentCarrierManagerType(std::string type)
Set the type of Component Carrier Manager to be used by Ue devices.
Definition: lte-helper.cc:373
ObjectFactory m_handoverAlgorithmFactory
Factory of handover algorithm object.
Definition: lte-helper.h:758
fading loss model based on precalculated fading traces
DrbActivatior allows user to activate bearers for UEs when EPC is not used.
Definition: lte-helper.cc:1084
tuple mac
Definition: third.py:92
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:843
void SetEnbAntennaModelType(std::string type)
Set the type of antenna model to be used by eNodeB devices.
Definition: lte-helper.cc:411
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:862
static double GetCarrierFrequency(uint32_t earfcn)
Calculates the carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARFCN) acc...
void SetSpectrumChannelType(std::string type)
Set the type of spectrum channel to be used in both DL and UL.
Definition: lte-helper.cc:464
static TypeId GetTypeId(void)
Get the type ID.
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:458
void EnableDlMacTraces(void)
Enable trace sinks for DL MAC layer.
Definition: lte-helper.cc:1452
virtual void ReportDataInterference(const SpectrumValue &interf)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:670
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1432
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The abstract base class of a Frequency Reuse algorithm.
keep track of a set of node pointers.
uint32_t GetDlEarfcn() const
Hold objects of type Ptr.
Definition: pointer.h:36
This entity is installed inside an eNB and provides the functionality for the X2 interface.
Definition: epc-x2.h:99
void EnableUlTxPhyTraces(void)
Enable trace sinks for UL transmission PHY layer.
Definition: lte-helper.cc:1422
uint16_t m_noOfCcs
Number of component carriers that will be installed by default at eNodeB and UE devices.
Definition: lte-helper.h:856
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.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< SpectrumChannel > m_uplinkChannel
The uplink LTE channel used in the simulation.
Definition: lte-helper.h:747
static void DlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Definition: lte-helper.cc:1203
std::string GetName(void) const
Get the name.
Definition: type-id.cc:968
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
ObjectFactory m_schedulerFactory
Factory of MAC scheduler object.
Definition: lte-helper.h:754
void EnableUlPhyTraces(void)
Enable trace sinks for UL PHY layer.
Definition: lte-helper.cc:1476
void EnableDlTxPhyTraces(void)
Enable trace sinks for DL transmission PHY layer.
Definition: lte-helper.cc:1415
friend class ObjectFactory
Definition: object.h:319
Ptr< SpectrumPropagationLossModel > m_fadingModule
The fading model used in both the downlink and uplink channels.
Definition: lte-helper.h:781
static void DlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
void Receive(Ptr< Packet > p)
receive a packet from the lower layers in order to forward it to the upper layers ...
void EnableUlMacTraces(void)
Enable trace sinks for UL MAC layer.
Definition: lte-helper.cc:1460
static void UlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void SetCcMap(std::map< uint8_t, Ptr< ComponentCarrierEnb > > ccm)
Set the ComponentCarrier Map of the Enb.
This abstract base class identifies the interface by means of which the helper object can plug on the...
#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:90
Ptr< EpcHelper > m_epcHelper
Helper which provides implementation of core network.
Definition: lte-helper.h:808
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
Definition: lte-helper.cc:1487
virtual ~LteHelper(void)
Definition: lte-helper.cc:104
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:499
Ptr< PhyTxStatsCalculator > m_phyTxStats
Container of PHY layer statistics related to transmission.
Definition: lte-helper.h:791
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1501
static void UlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
Ptr< SpectrumChannel > GetDownlinkSpectrumChannel(void) const
Definition: lte-helper.cc:221
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-helper.cc:205
The abstract base class of a Component Carrier Manager* for UE that operates using the component carr...
Ptr< const AttributeAccessor > MakeTypeIdAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: type-id.h:608
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
Receive LTE control message list function.
Definition: lte-ue-phy.cc:869
ObjectFactory m_ffrAlgorithmFactory
Factory of FFR (frequency reuse) algorithm object.
Definition: lte-helper.h:756
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
void DoHandoverRequest(Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, uint16_t targetCellId)
The actual function to trigger a manual handover.
Definition: lte-helper.cc:1245
Models the propagation loss through a transmission medium.
static TypeId GetTypeId(void)
Get the type ID.
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:275
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:128
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
uint32_t GetId(void) const
Definition: node.cc:107
EpsBearer m_bearer
Configuration of bearer which will be activated.
Definition: lte-helper.cc:1132
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
The class implements Component Carrier Manager (CCM) that operates using the Component Carrier Manage...
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:269
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:1155
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Receive PSS function.
Definition: lte-ue-phy.cc:1023
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB antenna model to be created.
Definition: lte-helper.cc:418
ObjectFactory m_ueNetDeviceFactory
Factory for LteUeNetDevice objects.
Definition: lte-helper.h:768
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:471
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
trace sink
Print everything.
Definition: log.h:112
Defines the interface for spectrum-aware channel implementations.
uint8_t GetDlBandwidth() const
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:425
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, DlSchedulingCallbackInfo dlSchedulingCallbackInfo)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-helper.cc:92
bool m_useCa
The UseCa attribute.
Definition: lte-helper.h:846
spectrum-aware propagation loss model
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1444
A base class which provides memory management and object aggregation.
Definition: object.h:87
bool m_active
Bearer can be activated only once.
Definition: lte-helper.cc:1124
Ptr< const AttributeAccessor > MakeStringAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: string.h:42
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:679
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
std::map< uint8_t, Ptr< ComponentCarrierEnb > > GetCcMap(void)
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:1265
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Container of PDCP layer statistics.
Definition: lte-helper.h:799
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Definition: double.h:41
Ptr< const AttributeChecker > MakeTypeIdChecker(void)
Definition: type-id.cc:1224
ObjectFactory m_ueAntennaModelFactory
Factory of antenna object for UE.
Definition: lte-helper.h:770
std::string GetFfrAlgorithmType() const
Definition: lte-helper.cc:303
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
The eNodeB device implementation.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: uinteger.h:45
#define MAX_NO_CC
Definition: lte-enb-rrc.h:55
A template-based reference counting class.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:446
a unique identifier for an interface.
Definition: type-id.h:58
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the FFR algorithm to be created.
Definition: lte-helper.cc:317
ObjectFactory m_enbNetDeviceFactory
Factory of LteEnbNetDevice objects.
Definition: lte-helper.h:764
void UpdateSinrPerceived(const SpectrumValue &sinr)
Ptr< SpectrumChannel > m_downlinkChannel
This function create the component carrier based on provided configuration parameters.
Definition: lte-helper.h:745
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
std::string GetSchedulerType() const
Definition: lte-helper.cc:290
std::string GetEnbComponentCarrierManagerType() const
Definition: lte-helper.cc:346
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:662
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:403
bool m_useIdealRrc
The UseIdealRrc attribute.
Definition: lte-helper.h:827
The LteUeNetDevice class implements the UE net device.