A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  */
21 
22 
23 #include "lte-helper.h"
24 #include <ns3/string.h>
25 #include <ns3/log.h>
26 #include <ns3/abort.h>
27 #include <ns3/pointer.h>
28 #include <ns3/lte-enb-rrc.h>
29 #include <ns3/epc-ue-nas.h>
30 #include <ns3/epc-enb-application.h>
31 #include <ns3/lte-ue-rrc.h>
32 #include <ns3/lte-ue-mac.h>
33 #include <ns3/lte-enb-mac.h>
34 #include <ns3/lte-enb-net-device.h>
35 #include <ns3/lte-enb-phy.h>
36 #include <ns3/lte-ue-phy.h>
37 #include <ns3/lte-spectrum-phy.h>
38 #include <ns3/lte-chunk-processor.h>
39 #include <ns3/multi-model-spectrum-channel.h>
40 #include <ns3/friis-spectrum-propagation-loss.h>
41 #include <ns3/trace-fading-loss-model.h>
42 #include <ns3/isotropic-antenna-model.h>
43 #include <ns3/lte-enb-net-device.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-anr.h>
49 #include <ns3/lte-rlc.h>
50 #include <ns3/lte-rlc-um.h>
51 #include <ns3/lte-rlc-am.h>
52 #include <ns3/epc-enb-s1-sap.h>
53 #include <ns3/lte-rrc-protocol-ideal.h>
54 #include <ns3/lte-rrc-protocol-real.h>
55 #include <ns3/mac-stats-calculator.h>
56 #include <ns3/phy-stats-calculator.h>
57 #include <ns3/phy-tx-stats-calculator.h>
58 #include <ns3/phy-rx-stats-calculator.h>
59 #include <ns3/epc-helper.h>
60 #include <iostream>
61 #include <ns3/buildings-propagation-loss-model.h>
62 #include <ns3/lte-spectrum-value-helper.h>
63 #include <ns3/epc-x2.h>
64 
65 NS_LOG_COMPONENT_DEFINE ("LteHelper");
66 
67 namespace ns3 {
68 
69 NS_OBJECT_ENSURE_REGISTERED (LteHelper);
70 
72  : m_fadingStreamsAssigned (false),
73  m_imsiCounter (0),
74  m_cellIdCounter (0)
75 {
76  NS_LOG_FUNCTION (this);
82 }
83 
84 void
86 {
87  NS_LOG_FUNCTION (this);
90 
92  Ptr<SpectrumPropagationLossModel> dlSplm = m_downlinkPathlossModel->GetObject<SpectrumPropagationLossModel> ();
93  if (dlSplm != 0)
94  {
95  NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in DL");
96  m_downlinkChannel->AddSpectrumPropagationLossModel (dlSplm);
97  }
98  else
99  {
100  NS_LOG_LOGIC (this << " using a PropagationLossModel in DL");
101  Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModel->GetObject<PropagationLossModel> ();
102  NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
103  m_downlinkChannel->AddPropagationLossModel (dlPlm);
104  }
105 
108  if (ulSplm != 0)
109  {
110  NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in UL");
111  m_uplinkChannel->AddSpectrumPropagationLossModel (ulSplm);
112  }
113  else
114  {
115  NS_LOG_LOGIC (this << " using a PropagationLossModel in UL");
117  NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
118  m_uplinkChannel->AddPropagationLossModel (ulPlm);
119  }
120  if (!m_fadingModelType.empty ())
121  {
123  m_fadingModule->Initialize ();
124  m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
126  }
127  m_phyStats = CreateObject<PhyStatsCalculator> ();
128  m_phyTxStats = CreateObject<PhyTxStatsCalculator> ();
129  m_phyRxStats = CreateObject<PhyRxStatsCalculator> ();
130  m_macStats = CreateObject<MacStatsCalculator> ();
132 
133 }
134 
136 {
137  NS_LOG_FUNCTION (this);
138 }
139 
141 {
142  static TypeId
143  tid =
144  TypeId ("ns3::LteHelper")
145  .SetParent<Object> ()
146  .AddConstructor<LteHelper> ()
147  .AddAttribute ("Scheduler",
148  "The type of scheduler to be used for eNBs. "
149  "The allowed values for this attributes are the type names "
150  "of any class inheriting from ns3::FfMacScheduler.",
151  StringValue ("ns3::PfFfMacScheduler"),
152  MakeStringAccessor (&LteHelper::SetSchedulerType,
154  MakeStringChecker ())
155  .AddAttribute ("FfrAlgorithm",
156  "The type of FFR algorithm to be used for eNBs. "
157  "The allowed values for this attributes are the type names "
158  "of any class inheriting from ns3::LteFfrAlgorithm.",
159  StringValue ("ns3::LteFrNoOpAlgorithm"),
160  MakeStringAccessor (&LteHelper::SetFfrAlgorithmType,
162  MakeStringChecker ())
163  .AddAttribute ("HandoverAlgorithm",
164  "The type of handover algorithm to be used for eNBs. "
165  "The allowed values for this attributes are the type names "
166  "of any class inheriting from ns3::LteHandoverAlgorithm.",
167  StringValue ("ns3::NoOpHandoverAlgorithm"),
168  MakeStringAccessor (&LteHelper::SetHandoverAlgorithmType,
170  MakeStringChecker ())
171  .AddAttribute ("PathlossModel",
172  "The type of pathloss model to be used. "
173  "The allowed values for this attributes are the type names "
174  "of any class inheriting from ns3::PropagationLossModel.",
175  StringValue ("ns3::FriisPropagationLossModel"),
176  MakeStringAccessor (&LteHelper::SetPathlossModelType),
177  MakeStringChecker ())
178  .AddAttribute ("FadingModel",
179  "The type of fading model to be used."
180  "The allowed values for this attributes are the type names "
181  "of any class inheriting from ns3::SpectrumPropagationLossModel."
182  "If the type is set to an empty string, no fading model is used.",
183  StringValue (""),
184  MakeStringAccessor (&LteHelper::SetFadingModel),
185  MakeStringChecker ())
186  .AddAttribute ("UseIdealRrc",
187  "If true, LteRrcProtocolIdeal will be used for RRC signaling. "
188  "If false, LteRrcProtocolReal will be used.",
189  BooleanValue (true),
190  MakeBooleanAccessor (&LteHelper::m_useIdealRrc),
191  MakeBooleanChecker ())
192  .AddAttribute ("AnrEnabled",
193  "Activate or deactivate Automatic Neighbour Relation function",
194  BooleanValue (true),
195  MakeBooleanAccessor (&LteHelper::m_isAnrEnabled),
196  MakeBooleanChecker ())
197  .AddAttribute ("UsePdschForCqiGeneration",
198  "If true, DL-CQI will be calculated from PDCCH as signal and PDSCH as interference "
199  "If false, DL-CQI will be calculated from PDCCH as signal and PDCCH as interference ",
200  BooleanValue (true),
201  MakeBooleanAccessor (&LteHelper::m_usePdschForCqiGeneration),
202  MakeBooleanChecker ())
203  ;
204  return tid;
205 }
206 
207 void
209 {
210  NS_LOG_FUNCTION (this);
211  m_downlinkChannel = 0;
212  m_uplinkChannel = 0;
214 }
215 
216 
217 void
219 {
220  NS_LOG_FUNCTION (this << h);
221  m_epcHelper = h;
222 }
223 
224 void
225 LteHelper::SetSchedulerType (std::string type)
226 {
227  NS_LOG_FUNCTION (this << type);
230 }
231 
232 std::string
234 {
235  return m_schedulerFactory.GetTypeId ().GetName ();
236 }
237 
238 void
240 {
241  NS_LOG_FUNCTION (this << n);
242  m_schedulerFactory.Set (n, v);
243 }
244 
245 std::string
247 {
249 }
250 
251 void
253 {
254  NS_LOG_FUNCTION (this << type);
257 }
258 
259 void
261 {
262  NS_LOG_FUNCTION (this << n);
263  m_ffrAlgorithmFactory.Set (n, v);
264 }
265 
266 std::string
268 {
270 }
271 
272 void
274 {
275  NS_LOG_FUNCTION (this << type);
278 }
279 
280 void
282 {
283  NS_LOG_FUNCTION (this << n);
285 }
286 
287 
288 void
290 {
291  NS_LOG_FUNCTION (this << type);
296 }
297 
298 void
300 {
301  NS_LOG_FUNCTION (this << n);
304 }
305 
306 void
308 {
309  NS_LOG_FUNCTION (this);
310  m_enbNetDeviceFactory.Set (n, v);
311 }
312 
313 
314 void
316 {
317  NS_LOG_FUNCTION (this);
319 }
320 
321 void
323 {
324  NS_LOG_FUNCTION (this);
326 }
327 
328 void
330 {
331  NS_LOG_FUNCTION (this);
332  m_ueNetDeviceFactory.Set (n, v);
333 }
334 
335 void
337 {
338  NS_LOG_FUNCTION (this);
340 }
341 
342 void
344 {
345  NS_LOG_FUNCTION (this);
347 }
348 
349 void
350 LteHelper::SetFadingModel (std::string type)
351 {
352  NS_LOG_FUNCTION (this << type);
353  m_fadingModelType = type;
354  if (!type.empty ())
355  {
358  }
359 }
360 
361 void
363 {
364  m_fadingModelFactory.Set (n, v);
365 }
366 
367 void
369 {
370  NS_LOG_FUNCTION (this << type);
372 }
373 
374 void
376 {
377  m_channelFactory.Set (n, v);
378 }
379 
380 
383 {
384  NS_LOG_FUNCTION (this);
385  Initialize (); // will run DoInitialize () if necessary
387  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
388  {
389  Ptr<Node> node = *i;
390  Ptr<NetDevice> device = InstallSingleEnbDevice (node);
391  devices.Add (device);
392  }
393  return devices;
394 }
395 
398 {
399  NS_LOG_FUNCTION (this);
401  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
402  {
403  Ptr<Node> node = *i;
404  Ptr<NetDevice> device = InstallSingleUeDevice (node);
405  devices.Add (device);
406  }
407  return devices;
408 }
409 
410 
413 {
414 
415  NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num eNBs exceeded");
416  uint16_t cellId = ++m_cellIdCounter;
417 
418  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
419  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
420 
421  Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
422 
423  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
424  dlPhy->SetHarqPhyModule (harq);
425  ulPhy->SetHarqPhyModule (harq);
426  phy->SetHarqPhyModule (harq);
427 
428  Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor> ();
429  pCtrl->AddCallback (MakeCallback (&LteEnbPhy::GenerateCtrlCqiReport, phy));
430  ulPhy->AddCtrlSinrChunkProcessor (pCtrl); // for evaluating SRS UL-CQI
431 
432  Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor> ();
433  pData->AddCallback (MakeCallback (&LteEnbPhy::GenerateDataCqiReport, phy));
434  pData->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, ulPhy));
435  ulPhy->AddDataSinrChunkProcessor (pData); // for evaluating PUSCH UL-CQI
436 
437  Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor> ();
438  pInterf->AddCallback (MakeCallback (&LteEnbPhy::ReportInterference, phy));
439  ulPhy->AddInterferenceDataChunkProcessor (pInterf); // for interference power tracing
440 
441  dlPhy->SetChannel (m_downlinkChannel);
442  ulPhy->SetChannel (m_uplinkChannel);
443 
445  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
446  dlPhy->SetMobility (mm);
447  ulPhy->SetMobility (mm);
448 
449  Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
450  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
451  dlPhy->SetAntenna (antenna);
452  ulPhy->SetAntenna (antenna);
453 
454  Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
458  Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
459 
460  if (m_useIdealRrc)
461  {
462  Ptr<LteEnbRrcProtocolIdeal> rrcProtocol = CreateObject<LteEnbRrcProtocolIdeal> ();
463  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
464  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
465  rrc->AggregateObject (rrcProtocol);
466  rrcProtocol->SetCellId (cellId);
467  }
468  else
469  {
470  Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal> ();
471  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
472  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
473  rrc->AggregateObject (rrcProtocol);
474  rrcProtocol->SetCellId (cellId);
475  }
476 
477  if (m_epcHelper != 0)
478  {
479  EnumValue epsBearerToRlcMapping;
480  rrc->GetAttribute ("EpsBearerToRlcMapping", epsBearerToRlcMapping);
481  // it does not make sense to use RLC/SM when also using the EPC
482  if (epsBearerToRlcMapping.Get () == LteEnbRrc::RLC_SM_ALWAYS)
483  {
484  rrc->SetAttribute ("EpsBearerToRlcMapping", EnumValue (LteEnbRrc::RLC_UM_ALWAYS));
485  }
486  }
487 
488  rrc->SetLteEnbCmacSapProvider (mac->GetLteEnbCmacSapProvider ());
489  mac->SetLteEnbCmacSapUser (rrc->GetLteEnbCmacSapUser ());
490  rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
491 
492  rrc->SetLteHandoverManagementSapProvider (handoverAlgorithm->GetLteHandoverManagementSapProvider ());
493  handoverAlgorithm->SetLteHandoverManagementSapUser (rrc->GetLteHandoverManagementSapUser ());
494 
495  mac->SetFfMacSchedSapProvider (sched->GetFfMacSchedSapProvider ());
496  mac->SetFfMacCschedSapProvider (sched->GetFfMacCschedSapProvider ());
497 
498  sched->SetFfMacSchedSapUser (mac->GetFfMacSchedSapUser ());
499  sched->SetFfMacCschedSapUser (mac->GetFfMacCschedSapUser ());
500 
501  phy->SetLteEnbPhySapUser (mac->GetLteEnbPhySapUser ());
502  mac->SetLteEnbPhySapProvider (phy->GetLteEnbPhySapProvider ());
503 
504  phy->SetLteEnbCphySapUser (rrc->GetLteEnbCphySapUser ());
505  rrc->SetLteEnbCphySapProvider (phy->GetLteEnbCphySapProvider ());
506 
507  //FFR SAP
508  sched->SetLteFfrSapProvider (ffrAlgorithm->GetLteFfrSapProvider ());
509  ffrAlgorithm->SetLteFfrSapUser (sched->GetLteFfrSapUser ());
510 
511  rrc->SetLteFfrRrcSapProvider (ffrAlgorithm->GetLteFfrRrcSapProvider ());
512  ffrAlgorithm->SetLteFfrRrcSapUser (rrc->GetLteFfrRrcSapUser ());
513  //FFR SAP END
514 
516  dev->SetNode (n);
517  dev->SetAttribute ("CellId", UintegerValue (cellId));
518  dev->SetAttribute ("LteEnbPhy", PointerValue (phy));
519  dev->SetAttribute ("LteEnbMac", PointerValue (mac));
520  dev->SetAttribute ("FfMacScheduler", PointerValue (sched));
521  dev->SetAttribute ("LteEnbRrc", PointerValue (rrc));
522  dev->SetAttribute ("LteHandoverAlgorithm", PointerValue (handoverAlgorithm));
523  dev->SetAttribute ("LteFfrAlgorithm", PointerValue (ffrAlgorithm));
524 
525  if (m_isAnrEnabled)
526  {
527  Ptr<LteAnr> anr = CreateObject<LteAnr> (cellId);
528  rrc->SetLteAnrSapProvider (anr->GetLteAnrSapProvider ());
529  anr->SetLteAnrSapUser (rrc->GetLteAnrSapUser ());
530  dev->SetAttribute ("LteAnr", PointerValue (anr));
531  }
532 
533  phy->SetDevice (dev);
534  dlPhy->SetDevice (dev);
535  ulPhy->SetDevice (dev);
536 
537  n->AddDevice (dev);
538  ulPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
539  ulPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteEnbPhy::ReceiveLteControlMessageList, phy));
540  ulPhy->SetLtePhyUlHarqFeedbackCallback (MakeCallback (&LteEnbPhy::ReceiveLteUlHarqFeedback, phy));
541  rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
542 
543  NS_LOG_LOGIC ("set the propagation model frequencies");
545  NS_LOG_LOGIC ("DL freq: " << dlFreq);
546  bool dlFreqOk = m_downlinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq));
547  if (!dlFreqOk)
548  {
549  NS_LOG_WARN ("DL propagation model does not have a Frequency attribute");
550  }
552  NS_LOG_LOGIC ("UL freq: " << ulFreq);
553  bool ulFreqOk = m_uplinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq));
554  if (!ulFreqOk)
555  {
556  NS_LOG_WARN ("UL propagation model does not have a Frequency attribute");
557  }
558 
559  dev->Initialize ();
560 
561  m_uplinkChannel->AddRx (ulPhy);
562 
563  if (m_epcHelper != 0)
564  {
565  NS_LOG_INFO ("adding this eNB to the EPC");
566  m_epcHelper->AddEnb (n, dev, dev->GetCellId ());
568  NS_ASSERT_MSG (enbApp != 0, "cannot retrieve EpcEnbApplication");
569 
570  // S1 SAPs
571  rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
572  enbApp->SetS1SapUser (rrc->GetS1SapUser ());
573 
574  // X2 SAPs
575  Ptr<EpcX2> x2 = n->GetObject<EpcX2> ();
576  x2->SetEpcX2SapUser (rrc->GetEpcX2SapUser ());
577  rrc->SetEpcX2SapProvider (x2->GetEpcX2SapProvider ());
578  }
579 
580  return dev;
581 }
582 
585 {
586  NS_LOG_FUNCTION (this);
587  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
588  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
589 
590  Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
591 
592  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
593  dlPhy->SetHarqPhyModule (harq);
594  ulPhy->SetHarqPhyModule (harq);
595  phy->SetHarqPhyModule (harq);
596 
597  Ptr<LteChunkProcessor> pRs = Create<LteChunkProcessor> ();
598  pRs->AddCallback (MakeCallback (&LteUePhy::ReportRsReceivedPower, phy));
599  dlPhy->AddRsPowerChunkProcessor (pRs);
600 
601  Ptr<LteChunkProcessor> pInterf = Create<LteChunkProcessor> ();
602  pInterf->AddCallback (MakeCallback (&LteUePhy::ReportInterference, phy));
603  dlPhy->AddInterferenceCtrlChunkProcessor (pInterf); // for RSRQ evaluation of UE Measurements
604 
605  Ptr<LteChunkProcessor> pCtrl = Create<LteChunkProcessor> ();
606  pCtrl->AddCallback (MakeCallback (&LteUePhy::GenerateCtrlCqiReport, phy));
607  pCtrl->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
608  dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
609 
610  Ptr<LteChunkProcessor> pData = Create<LteChunkProcessor> ();
611  pData->AddCallback (MakeCallback (&LteSpectrumPhy::UpdateSinrPerceived, dlPhy));
612  dlPhy->AddDataSinrChunkProcessor (pData);
613 
614  Ptr<LteChunkProcessor> pDataInterf = Create<LteChunkProcessor> ();
616  {
617  pDataInterf->AddCallback (MakeCallback (&LteUePhy::ReportDataInterference, phy));
618  }
619 
620  dlPhy->AddInterferenceDataChunkProcessor (pDataInterf);
621 
622  dlPhy->SetChannel (m_downlinkChannel);
623  ulPhy->SetChannel (m_uplinkChannel);
624 
626  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
627  dlPhy->SetMobility (mm);
628  ulPhy->SetMobility (mm);
629 
630  Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
631  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
632  dlPhy->SetAntenna (antenna);
633  ulPhy->SetAntenna (antenna);
634 
635  Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
636  Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc> ();
637 
638  if (m_useIdealRrc)
639  {
640  Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal> ();
641  rrcProtocol->SetUeRrc (rrc);
642  rrc->AggregateObject (rrcProtocol);
643  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
644  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
645  }
646  else
647  {
648  Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal> ();
649  rrcProtocol->SetUeRrc (rrc);
650  rrc->AggregateObject (rrcProtocol);
651  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
652  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
653  }
654 
655  if (m_epcHelper != 0)
656  {
657  rrc->SetUseRlcSm (false);
658  }
659  Ptr<EpcUeNas> nas = CreateObject<EpcUeNas> ();
660 
661  nas->SetAsSapProvider (rrc->GetAsSapProvider ());
662  rrc->SetAsSapUser (nas->GetAsSapUser ());
663 
664  rrc->SetLteUeCmacSapProvider (mac->GetLteUeCmacSapProvider ());
665  mac->SetLteUeCmacSapUser (rrc->GetLteUeCmacSapUser ());
666  rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
667 
668  phy->SetLteUePhySapUser (mac->GetLteUePhySapUser ());
669  mac->SetLteUePhySapProvider (phy->GetLteUePhySapProvider ());
670 
671  phy->SetLteUeCphySapUser (rrc->GetLteUeCphySapUser ());
672  rrc->SetLteUeCphySapProvider (phy->GetLteUeCphySapProvider ());
673 
674  NS_ABORT_MSG_IF (m_imsiCounter >= 0xFFFFFFFF, "max num UEs exceeded");
675  uint64_t imsi = ++m_imsiCounter;
676 
678  dev->SetNode (n);
679  dev->SetAttribute ("Imsi", UintegerValue (imsi));
680  dev->SetAttribute ("LteUePhy", PointerValue (phy));
681  dev->SetAttribute ("LteUeMac", PointerValue (mac));
682  dev->SetAttribute ("LteUeRrc", PointerValue (rrc));
683  dev->SetAttribute ("EpcUeNas", PointerValue (nas));
684 
685  phy->SetDevice (dev);
686  dlPhy->SetDevice (dev);
687  ulPhy->SetDevice (dev);
688  nas->SetDevice (dev);
689 
690  n->AddDevice (dev);
691  dlPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
692  dlPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteUePhy::ReceiveLteControlMessageList, phy));
693  dlPhy->SetLtePhyRxPssCallback (MakeCallback (&LteUePhy::ReceivePss, phy));
694  dlPhy->SetLtePhyDlHarqFeedbackCallback (MakeCallback (&LteUePhy::ReceiveLteDlHarqFeedback, phy));
695  nas->SetForwardUpCallback (MakeCallback (&LteUeNetDevice::Receive, dev));
696 
697  if (m_epcHelper != 0)
698  {
699  m_epcHelper->AddUe (dev, dev->GetImsi ());
700  }
701 
702  dev->Initialize ();
703 
704  return dev;
705 }
706 
707 
708 void
710 {
711  NS_LOG_FUNCTION (this);
712  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
713  {
714  Attach (*i);
715  }
716 }
717 
718 void
720 {
721  NS_LOG_FUNCTION (this);
722 
723  if (m_epcHelper == 0)
724  {
725  NS_FATAL_ERROR ("This function is not valid without properly configured EPC");
726  }
727 
728  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
729  if (ueLteDevice == 0)
730  {
731  NS_FATAL_ERROR ("The passed NetDevice must be an LteUeNetDevice");
732  }
733 
734  // initiate cell selection
735  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
736  NS_ASSERT (ueNas != 0);
737  uint16_t dlEarfcn = ueLteDevice->GetDlEarfcn ();
738  ueNas->StartCellSelection (dlEarfcn);
739 
740  // instruct UE to immediately enter CONNECTED mode after camping
741  ueNas->Connect ();
742 
743  // activate default EPS bearer
744  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (),
745  EpcTft::Default (),
747 }
748 
749 void
751 {
752  NS_LOG_FUNCTION (this);
753  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
754  {
755  Attach (*i, enbDevice);
756  }
757 }
758 
759 void
761 {
762  NS_LOG_FUNCTION (this);
763  //enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
764 
765  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
766  Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> ();
767 
768  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
769  ueNas->Connect (enbLteDevice->GetCellId (), enbLteDevice->GetDlEarfcn ());
770 
771  if (m_epcHelper != 0)
772  {
773  // activate default EPS bearer
774  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (), EpcTft::Default (), EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT));
775  }
776 
777  // tricks needed for the simplified LTE-only simulations
778  if (m_epcHelper == 0)
779  {
780  ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
781  }
782 }
783 
784 void
786 {
787  NS_LOG_FUNCTION (this);
788  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
789  {
790  AttachToClosestEnb (*i, enbDevices);
791  }
792 }
793 
794 void
796 {
797  NS_LOG_FUNCTION (this);
798  NS_ASSERT_MSG (enbDevices.GetN () > 0, "empty enb device container");
799  Vector uepos = ueDevice->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
800  double minDistance = std::numeric_limits<double>::infinity ();
801  Ptr<NetDevice> closestEnbDevice;
802  for (NetDeviceContainer::Iterator i = enbDevices.Begin (); i != enbDevices.End (); ++i)
803  {
804  Vector enbpos = (*i)->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
805  double distance = CalculateDistance (uepos, enbpos);
806  if (distance < minDistance)
807  {
808  minDistance = distance;
809  closestEnbDevice = *i;
810  }
811  }
812  NS_ASSERT (closestEnbDevice != 0);
813  Attach (ueDevice, closestEnbDevice);
814 }
815 
816 void
818 {
819  NS_LOG_FUNCTION (this);
820  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
821  {
822  ActivateDedicatedEpsBearer (*i, bearer, tft);
823  }
824 }
825 
826 
827 void
829 {
830  NS_LOG_FUNCTION (this);
831 
832  NS_ASSERT_MSG (m_epcHelper != 0, "dedicated EPS bearers cannot be set up when the EPC is not used");
833 
834  uint64_t imsi = ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
835  m_epcHelper->ActivateEpsBearer (ueDevice, imsi, tft, bearer);
836 }
837 
838 class DrbActivator : public SimpleRefCount<DrbActivator>
839 {
840 public:
841  DrbActivator (Ptr<NetDevice> ueDevice, EpsBearer bearer);
842  static void ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
843  void ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti);
844 private:
845  bool m_active;
848  uint64_t m_imsi;
849 };
850 
852  : m_active (false),
853  m_ueDevice (ueDevice),
854  m_bearer (bearer),
855  m_imsi (m_ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ())
856 {
857 }
858 
859 void
860 DrbActivator::ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
861 {
862  NS_LOG_FUNCTION (a << context << imsi << cellId << rnti);
863  a->ActivateDrb (imsi, cellId, rnti);
864 }
865 
866 void
867 DrbActivator::ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti)
868 {
869  NS_LOG_FUNCTION (this << imsi << cellId << rnti << m_active);
870  if ((!m_active) && (imsi == m_imsi))
871  {
872  Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
873  NS_ASSERT (ueRrc->GetState () == LteUeRrc::CONNECTED_NORMALLY);
874  uint16_t rnti = ueRrc->GetRnti ();
875  Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
876  Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
877  NS_ASSERT (ueRrc->GetCellId () == enbLteDevice->GetCellId ());
878  Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
879  NS_ASSERT (ueManager->GetState () == UeManager::CONNECTED_NORMALLY ||
880  ueManager->GetState () == UeManager::CONNECTION_RECONFIGURATION);
882  params.rnti = rnti;
883  params.bearer = m_bearer;
884  params.bearerId = 0;
885  params.gtpTeid = 0; // don't care
886  enbRrc->GetS1SapUser ()->DataRadioBearerSetupRequest (params);
887  m_active = true;
888  }
889 }
890 
891 
892 void
894 {
895  NS_LOG_FUNCTION (this << ueDevice);
896  NS_ASSERT_MSG (m_epcHelper == 0, "this method must not be used when the EPC is being used");
897 
898  // Normally it is the EPC that takes care of activating DRBs
899  // when the UE gets connected. When the EPC is not used, we achieve
900  // the same behavior by hooking a dedicated DRB activation function
901  // to the Enb RRC Connection Established trace source
902 
903 
904  Ptr<LteEnbNetDevice> enbLteDevice = ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
905 
906  std::ostringstream path;
907  path << "/NodeList/" << enbLteDevice->GetNode ()->GetId ()
908  << "/DeviceList/" << enbLteDevice->GetIfIndex ()
909  << "/LteEnbRrc/ConnectionEstablished";
910  Ptr<DrbActivator> arg = Create<DrbActivator> (ueDevice, bearer);
912 }
913 
914 void
916 {
917  NS_LOG_FUNCTION (this);
918 
919  NS_ASSERT_MSG (m_epcHelper != 0, "X2 interfaces cannot be set up when the EPC is not used");
920 
921  for (NodeContainer::Iterator i = enbNodes.Begin (); i != enbNodes.End (); ++i)
922  {
923  for (NodeContainer::Iterator j = i + 1; j != enbNodes.End (); ++j)
924  {
925  AddX2Interface (*i, *j);
926  }
927  }
928 }
929 
930 void
932 {
933  NS_LOG_FUNCTION (this);
934  NS_LOG_INFO ("setting up the X2 interface");
935 
936  m_epcHelper->AddX2Interface (enbNode1, enbNode2);
937 }
938 
939 void
941 {
942  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
943  NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
944  Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetEnbDev);
945 }
946 
947 void
949 {
950  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
951 
952  uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice> ()->GetCellId ();
953  Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice> ()->GetRrc ();
954  uint16_t rnti = ueDev->GetObject<LteUeNetDevice> ()->GetRrc ()->GetRnti ();
955  sourceRrc->SendHandoverRequest (rnti, targetCellId);
956 }
957 
958 
959 
960 
961 
962 void
964 {
965  NS_LOG_FUNCTION (this);
966  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
967  {
968  ActivateDataRadioBearer (*i, bearer);
969  }
970 }
971 
972 void
974 {
975  LogComponentEnable ("LteHelper", LOG_LEVEL_ALL);
976  LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
977  LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
978  LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
979  LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
980  LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
981  LogComponentEnable ("LteRlcUm", LOG_LEVEL_ALL);
982  LogComponentEnable ("LteRlcAm", LOG_LEVEL_ALL);
983  LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
984  LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
985 
986  LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
987  LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
988  LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
989  LogComponentEnable ("LteSpectrumValueHelper", LOG_LEVEL_ALL);
990  LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
991  LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
992  LogComponentEnable ("LteChunkProcessor", LOG_LEVEL_ALL);
993 
994  std::string propModelStr = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
995  LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
996  LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
997  LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
998 
999  LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
1000  LogComponentEnable ("LteStatsCalculator", LOG_LEVEL_ALL);
1001  LogComponentEnable ("MacStatsCalculator", LOG_LEVEL_ALL);
1002  LogComponentEnable ("PhyTxStatsCalculator", LOG_LEVEL_ALL);
1003  LogComponentEnable ("PhyRxStatsCalculator", LOG_LEVEL_ALL);
1004  LogComponentEnable ("PhyStatsCalculator", LOG_LEVEL_ALL);
1005 
1006 
1007 }
1008 
1009 void
1011 {
1012  EnablePhyTraces ();
1013  EnableMacTraces ();
1014  EnableRlcTraces ();
1015  EnablePdcpTraces ();
1016 }
1017 
1018 void
1020 {
1021  NS_ASSERT_MSG (m_rlcStats == 0, "please make sure that LteHelper::EnableRlcTraces is called at most once");
1022  m_rlcStats = CreateObject<RadioBearerStatsCalculator> ("RLC");
1024 }
1025 
1026 int64_t
1028 {
1029  int64_t currentStream = stream;
1030  if ((m_fadingModule != 0) && (m_fadingStreamsAssigned == false))
1031  {
1033  if (tflm != 0)
1034  {
1035  currentStream += tflm->AssignStreams (currentStream);
1036  m_fadingStreamsAssigned = true;
1037  }
1038  }
1039  Ptr<NetDevice> netDevice;
1040  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
1041  {
1042  netDevice = (*i);
1043  Ptr<LteEnbNetDevice> lteEnb = DynamicCast<LteEnbNetDevice> (netDevice);
1044  if (lteEnb)
1045  {
1046  Ptr<LteSpectrumPhy> dlPhy = lteEnb->GetPhy ()->GetDownlinkSpectrumPhy ();
1047  Ptr<LteSpectrumPhy> ulPhy = lteEnb->GetPhy ()->GetUplinkSpectrumPhy ();
1048  currentStream += dlPhy->AssignStreams (currentStream);
1049  currentStream += ulPhy->AssignStreams (currentStream);
1050  }
1051  Ptr<LteUeNetDevice> lteUe = DynamicCast<LteUeNetDevice> (netDevice);
1052  if (lteUe)
1053  {
1054  Ptr<LteSpectrumPhy> dlPhy = lteUe->GetPhy ()->GetDownlinkSpectrumPhy ();
1055  Ptr<LteSpectrumPhy> ulPhy = lteUe->GetPhy ()->GetUplinkSpectrumPhy ();
1056  Ptr<LteUeMac> ueMac = lteUe->GetMac ();
1057  currentStream += dlPhy->AssignStreams (currentStream);
1058  currentStream += ulPhy->AssignStreams (currentStream);
1059  currentStream += ueMac->AssignStreams (currentStream);
1060  }
1061  }
1062  return (currentStream - stream);
1063 }
1064 
1065 
1066 void
1068 {
1069  EnableDlPhyTraces ();
1070  EnableUlPhyTraces ();
1075 }
1076 
1077 void
1079 {
1080  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/DlPhyTransmission",
1082 }
1083 
1084 void
1086 {
1087  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/UlPhyTransmission",
1089 }
1090 
1091 void
1093 {
1094  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1096 }
1097 
1098 void
1100 {
1101  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1103 }
1104 
1105 
1106 void
1108 {
1109  EnableDlMacTraces ();
1110  EnableUlMacTraces ();
1111 }
1112 
1113 
1114 void
1116 {
1118  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/DlScheduling",
1120 }
1121 
1122 void
1124 {
1126  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/UlScheduling",
1128 }
1129 
1130 void
1132 {
1134  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpSinr",
1136 }
1137 
1138 void
1140 {
1142  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportUeSinr",
1144  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportInterference",
1146 
1147 }
1148 
1151 {
1152  return m_rlcStats;
1153 }
1154 
1155 void
1157 {
1158  NS_ASSERT_MSG (m_pdcpStats == 0, "please make sure that LteHelper::EnablePdcpTraces is called at most once");
1159  m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ("PDCP");
1161 }
1162 
1165 {
1166  return m_pdcpStats;
1167 }
1168 
1169 } // namespace ns3
Parameters passed to DataRadioBearerSetupRequest ()
uint16_t GetDlEarfcn() const
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
TypeId GetTypeId(void) const
Ptr< Object > m_uplinkPathlossModel
Definition: lte-helper.h:558
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the pathloss model to be created
Definition: lte-helper.cc:299
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)=0
set the single-frequency propagation loss model to be used
void EnableDlRxPhyTraces(void)
Enable trace sinks for DL reception PHY layer.
Definition: lte-helper.cc:1092
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
RadioBearerStatsConnector m_radioBearerStatsConnector
Definition: lte-helper.h:585
#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:412
The abstract base class of a handover algorithm that operates using the Handover Management SAP inter...
static TypeId GetTypeId(void)
Definition: lte-helper.cc:140
Hold a bool native type.
Definition: boolean.h:38
tuple devices
Definition: first.py:32
NetDeviceContainer InstallEnbDevice(NodeContainer c)
create a set of eNB devices
Definition: lte-helper.cc:382
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
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 EnableLogComponents(void)
Enables logging for all components of the LENA architecture.
Definition: lte-helper.cc:973
hold variables of type string
Definition: string.h:18
void HandoverRequest(Time hoTime, Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
Manually trigger an X2-based handover of a UE between two eNBs at a specific simulation time...
Definition: lte-helper.cc:940
static void DlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
Trace sink for the ns3::LteEnbMac::DlScheduling trace source.
bool m_fadingStreamsAssigned
Definition: lte-helper.h:577
ObjectFactory m_fadingModelFactory
Definition: lte-helper.h:575
static void ActivateCallback(Ptr< DrbActivator > a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Definition: lte-helper.cc:860
virtual void SetNode(Ptr< Node > node)
Hold a value for an Attribute.
Definition: attribute.h:56
void EnableDlPhyTraces(void)
Enable trace sinks for DL PHY layer.
Definition: lte-helper.cc:1131
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:438
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:488
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1480
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:315
DrbActivator(Ptr< NetDevice > ueDevice, EpsBearer bearer)
Definition: lte-helper.cc:851
Ptr< LteEnbPhy > GetPhy(void) const
void SetUeAntennaModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the AntennaModel to be used for the UEs
Definition: lte-helper.cc:343
void SetFadingModel(std::string model)
Definition: lte-helper.cc:350
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition: epc-tft.cc:141
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
Notifies the stats calculator that an UE SINR report has occurred.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
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:709
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:1019
bool m_usePdschForCqiGeneration
Definition: lte-helper.h:595
void SetTypeId(TypeId tid)
Ptr< PhyStatsCalculator > m_phyStats
Definition: lte-helper.h:579
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Ptr< PhyRxStatsCalculator > m_phyRxStats
Definition: lte-helper.h:581
std::string m_fadingModelType
Definition: lte-helper.h:574
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Definition: object-base.cc:196
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
set an attribute for the LteUeNetDevice to be created
Definition: lte-helper.cc:329
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:335
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:223
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
void SetUeAntennaModelType(std::string type)
Definition: lte-helper.cc:336
int Get(void) const
Definition: enum.cc:46
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Ptr< MacStatsCalculator > m_macStats
Definition: lte-helper.h:582
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:825
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: lte-helper.cc:1027
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:738
ObjectFactory m_ulPathlossModelFactory
Definition: lte-helper.h:570
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Call ActivateDataRadioBearer (ueDevice, bearer) for each UE device in a given set.
Definition: lte-helper.cc:963
ObjectFactory m_channelFactory
Definition: lte-helper.h:572
a 3d vector
Definition: vector.h:31
void SetHandoverAlgorithmType(std::string type)
Definition: lte-helper.cc:273
void EnableUlRxPhyTraces(void)
Enable trace sinks for UL reception PHY layer.
Definition: lte-helper.cc:1099
void SetFfrAlgorithmType(std::string type)
Definition: lte-helper.cc:252
static TypeId GetTypeId(void)
void SetSchedulerType(std::string type)
Definition: lte-helper.cc:225
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Ptr< RadioBearerStatsCalculator > m_rlcStats
Definition: lte-helper.h:583
std::string GetHandoverAlgorithmType() const
Definition: lte-helper.cc:267
void EnablePdcpTraces(void)
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1156
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:785
static void ReportCurrentCellRsrpSinrCallback(Ptr< PhyStatsCalculator > phyStats, std::string path, uint16_t cellId, uint16_t rnti, double rsrp, double sinr)
trace sink
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:790
Ptr< Object > m_downlinkPathlossModel
Definition: lte-helper.h:557
static double GetCarrierFrequency(uint16_t earfcn)
Calculates the carrier frequency from the E-UTRA Absolute Radio Frequency Channel Number (EARFCN) acc...
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
Ptr< Application > GetApplication(uint32_t index) const
Retrieve the index-th Application associated to this node.
Definition: node.cc:160
Ptr< NetDevice > m_ueDevice
Definition: lte-helper.cc:846
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
set an attribute for the handover algorithm to be created
Definition: lte-helper.cc:281
hold variables of type 'enum'
Definition: enum.h:37
virtual uint32_t GetIfIndex(void) const
void DoHandoverRequest(Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
The actual function to trigger a manual handover.
Definition: lte-helper.cc:948
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:802
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:71
Ptr< Object > Create(void) const
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
void EnableRlcStats(Ptr< RadioBearerStatsCalculator > rlcStats)
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1010
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
Hold an unsigned integer type.
Definition: uinteger.h:46
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
set an attribute for the scheduler to be created
Definition: lte-helper.cc:239
Ptr< NetDevice > InstallSingleUeDevice(Ptr< Node > n)
Create a UE device (LteUeNetDevice) on the given node.
Definition: lte-helper.cc:584
uint64_t m_imsiCounter
Definition: lte-helper.h:589
ObjectFactory m_enbAntennaModelFactory
Definition: lte-helper.h:565
holds a vector of ns3::NetDevice pointers
virtual void AddSpectrumPropagationLossModel(Ptr< SpectrumPropagationLossModel > loss)=0
set the frequency-dependent propagation loss model to be used
uint16_t m_cellIdCounter
Definition: lte-helper.h:590
void EnablePhyTraces(void)
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1067
bool m_isAnrEnabled
Definition: lte-helper.h:593
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1283
ObjectFactory m_handoverAlgorithmFactory
Definition: lte-helper.h:562
fading loss model based on precalculated fading traces
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:233
void SetEnbAntennaModelType(std::string type)
Definition: lte-helper.cc:315
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:810
ObjectFactory m_dlPathlossModelFactory
Definition: lte-helper.h:569
void SetSpectrumChannelType(std::string type)
Definition: lte-helper.cc:368
static TypeId GetTypeId(void)
void SetFadingModelAttribute(std::string n, const AttributeValue &v)
set an attribute of the fading model
Definition: lte-helper.cc:362
void EnableDlMacTraces(void)
Enable trace sinks for DL MAC layer.
Definition: lte-helper.cc:1115
virtual void ReportDataInterference(const SpectrumValue &interf)
Definition: lte-ue-phy.cc:694
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1445
void ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
Definition: lte-helper.cc:817
The abstract base class of a Frequency Reuse algorithm.
keep track of a set of node pointers.
hold objects of type Ptr
Definition: pointer.h:33
This entity is installed inside an eNB and provides the functionality for the X2 interface.
Definition: epc-x2.h:70
void EnableUlTxPhyTraces(void)
Enable trace sinks for UL transmission PHY layer.
Definition: lte-helper.cc:1085
Ptr< SpectrumChannel > m_uplinkChannel
Definition: lte-helper.h:555
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:915
std::string GetName(void) const
Definition: type-id.cc:657
void Set(std::string name, const AttributeValue &value)
ObjectFactory m_schedulerFactory
Definition: lte-helper.h:560
void EnableUlPhyTraces(void)
Enable trace sinks for UL PHY layer.
Definition: lte-helper.cc:1139
uint16_t GetUlEarfcn() const
void EnableDlTxPhyTraces(void)
Enable trace sinks for DL transmission PHY layer.
Definition: lte-helper.cc:1078
friend class ObjectFactory
Definition: object.h:230
Ptr< SpectrumPropagationLossModel > m_fadingModule
Definition: lte-helper.h:576
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:1123
static void UlPhyReceptionCallback(Ptr< PhyRxStatsCalculator > phyRxStats, std::string path, PhyReceptionStatParameters params)
trace sink
static void UlSchedulingCallback(Ptr< MacStatsCalculator > macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t size)
Trace sink for the ns3::LteEnbMac::UlScheduling trace source.
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:84
Ptr< EpcHelper > m_epcHelper
Definition: lte-helper.h:587
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
Definition: lte-helper.cc:1150
virtual ~LteHelper(void)
Definition: lte-helper.cc:135
NetDeviceContainer InstallUeDevice(NodeContainer c)
create a set of UE devices
Definition: lte-helper.cc:397
Ptr< PhyTxStatsCalculator > m_phyTxStats
Definition: lte-helper.h:580
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1164
static void UlPhyTransmissionCallback(Ptr< PhyTxStatsCalculator > phyTxStats, std::string path, PhyTransmissionStatParameters params)
trace sink
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-helper.cc:208
ObjectFactory m_ffrAlgorithmFactory
Definition: lte-helper.h:561
This application is installed inside eNBs and provides the bridge functionality for user data plane p...
Modelize the propagation loss through a transmission medium.
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:218
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:120
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
Definition: abort.h:101
uint32_t GetId(void) const
Definition: node.cc:106
EpsBearer m_bearer
Definition: lte-helper.cc:847
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:203
void SetPathlossModelType(std::string type)
Definition: lte-helper.cc:289
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
Definition: lte-ue-phy.cc:891
void Initialize(void)
This method calls the virtual DoInitialize method on all the objects aggregated to this object...
Definition: object.cc:179
void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
Definition: lte-helper.cc:867
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:1043
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the AntennaModel to be used for the eNBs
Definition: lte-helper.cc:322
ObjectFactory m_ueNetDeviceFactory
Definition: lte-helper.h:566
void SetSpectrumChannelAttribute(std::string n, const AttributeValue &v)
set an attribute for the SpectrumChannel to be used for the UEs
Definition: lte-helper.cc:375
Defines the interface for spectrum-aware channel implementations.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:386
void ReportInterference(uint16_t cellId, Ptr< SpectrumValue > interference)
Notifies the stats calculator that an interference report has occurred.
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: lte-helper.cc:85
spectrum-aware propagation loss model
void EnableMacTraces(void)
Enable trace sinks for MAC layer.
Definition: lte-helper.cc:1107
a base class which provides memory management and object aggregation
Definition: object.h:64
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:703
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Definition: lte-helper.h:584
Hold a floating point type.
Definition: double.h:41
ObjectFactory m_ueAntennaModelFactory
Definition: lte-helper.h:567
std::string GetFfrAlgorithmType() const
Definition: lte-helper.cc:246
void SetAttribute(std::string name, const AttributeValue &value)
Definition: object-base.cc:176
The eNodeB device implementation.
Ptr< T > GetObject(void) const
Definition: object.h:362
A template-based reference counting class.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:395
a unique identifier for an interface.
Definition: type-id.h:49
void SetFfrAlgorithmAttribute(std::string n, const AttributeValue &v)
set an attribute for the FFR algorithm to be created
Definition: lte-helper.cc:260
ObjectFactory m_enbNetDeviceFactory
Definition: lte-helper.h:564
void UpdateSinrPerceived(const SpectrumValue &sinr)
Ptr< SpectrumChannel > m_downlinkChannel
Definition: lte-helper.h:554
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:342
std::string GetSchedulerType() const
Definition: lte-helper.cc:233
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:686
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:318
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
set an attribute for the LteEnbNetDevice to be created
Definition: lte-helper.cc:307
bool m_useIdealRrc
Definition: lte-helper.h:592
The LteUeNetDevice class implements the UE net device.