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-sinr-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-handover-algorithm.h>
47 #include <ns3/lte-anr.h>
48 #include <ns3/lte-rlc.h>
49 #include <ns3/lte-rlc-um.h>
50 #include <ns3/lte-rlc-am.h>
51 #include <ns3/epc-enb-s1-sap.h>
52 #include <ns3/lte-rrc-protocol-ideal.h>
53 #include <ns3/lte-rrc-protocol-real.h>
54 #include <ns3/mac-stats-calculator.h>
55 #include <ns3/phy-stats-calculator.h>
56 #include <ns3/phy-tx-stats-calculator.h>
57 #include <ns3/phy-rx-stats-calculator.h>
58 #include <ns3/epc-helper.h>
59 #include <iostream>
60 #include <ns3/buildings-propagation-loss-model.h>
61 #include <ns3/lte-spectrum-value-helper.h>
62 #include <ns3/epc-x2.h>
63 
64 NS_LOG_COMPONENT_DEFINE ("LteHelper");
65 
66 namespace ns3 {
67 
69  ;
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 ("HandoverAlgorithm",
156  "The type of handover algorithm to be used for eNBs. "
157  "The allowed values for this attributes are the type names "
158  "of any class inheriting from ns3::HandoverAlgorithm.",
159  StringValue ("ns3::NoOpHandoverAlgorithm"),
160  MakeStringAccessor (&LteHelper::SetHandoverAlgorithmType,
162  MakeStringChecker ())
163  .AddAttribute ("PathlossModel",
164  "The type of pathloss model to be used. "
165  "The allowed values for this attributes are the type names "
166  "of any class inheriting from ns3::PropagationLossModel.",
167  StringValue ("ns3::FriisPropagationLossModel"),
168  MakeStringAccessor (&LteHelper::SetPathlossModelType),
169  MakeStringChecker ())
170  .AddAttribute ("FadingModel",
171  "The type of fading model to be used."
172  "The allowed values for this attributes are the type names "
173  "of any class inheriting from ns3::SpectrumPropagationLossModel."
174  "If the type is set to an empty string, no fading model is used.",
175  StringValue (""),
176  MakeStringAccessor (&LteHelper::SetFadingModel),
177  MakeStringChecker ())
178  .AddAttribute ("UseIdealRrc",
179  "If true, LteRrcProtocolIdeal will be used for RRC signaling. "
180  "If false, LteRrcProtocolReal will be used.",
181  BooleanValue (true),
182  MakeBooleanAccessor (&LteHelper::m_useIdealRrc),
183  MakeBooleanChecker ())
184  .AddAttribute ("AnrEnabled",
185  "Activate or deactivate Automatic Neighbour Relation function",
186  BooleanValue (true),
187  MakeBooleanAccessor (&LteHelper::m_isAnrEnabled),
188  MakeBooleanChecker ())
189  ;
190  return tid;
191 }
192 
193 void
195 {
196  NS_LOG_FUNCTION (this);
197  m_downlinkChannel = 0;
198  m_uplinkChannel = 0;
200 }
201 
202 
203 void
205 {
206  NS_LOG_FUNCTION (this << h);
207  m_epcHelper = h;
208 }
209 
210 void
211 LteHelper::SetSchedulerType (std::string type)
212 {
213  NS_LOG_FUNCTION (this << type);
216 }
217 
218 std::string
220 {
221  return m_schedulerFactory.GetTypeId ().GetName ();
222 }
223 
224 void
226 {
227  NS_LOG_FUNCTION (this << n);
228  m_schedulerFactory.Set (n, v);
229 }
230 
231 std::string
233 {
235 }
236 
237 void
239 {
240  NS_LOG_FUNCTION (this << type);
243 }
244 
245 void
247 {
248  NS_LOG_FUNCTION (this << n);
250 }
251 
252 
253 void
255 {
256  NS_LOG_FUNCTION (this << type);
261 }
262 
263 void
265 {
266  NS_LOG_FUNCTION (this << n);
269 }
270 
271 void
273 {
274  NS_LOG_FUNCTION (this);
275  m_enbNetDeviceFactory.Set (n, v);
276 }
277 
278 
279 void
281 {
282  NS_LOG_FUNCTION (this);
284 }
285 
286 void
288 {
289  NS_LOG_FUNCTION (this);
291 }
292 
293 void
295 {
296  NS_LOG_FUNCTION (this);
297  m_ueNetDeviceFactory.Set (n, v);
298 }
299 
300 void
302 {
303  NS_LOG_FUNCTION (this);
305 }
306 
307 void
309 {
310  NS_LOG_FUNCTION (this);
312 }
313 
314 void
315 LteHelper::SetFadingModel (std::string type)
316 {
317  NS_LOG_FUNCTION (this << type);
318  m_fadingModelType = type;
319  if (!type.empty ())
320  {
323  }
324 }
325 
326 void
328 {
329  m_fadingModelFactory.Set (n, v);
330 }
331 
332 void
334 {
335  NS_LOG_FUNCTION (this << type);
337 }
338 
339 void
341 {
342  m_channelFactory.Set (n, v);
343 }
344 
345 
348 {
349  NS_LOG_FUNCTION (this);
350  Initialize (); // will run DoInitialize () if necessary
352  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
353  {
354  Ptr<Node> node = *i;
355  Ptr<NetDevice> device = InstallSingleEnbDevice (node);
356  devices.Add (device);
357  }
358  return devices;
359 }
360 
363 {
364  NS_LOG_FUNCTION (this);
366  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
367  {
368  Ptr<Node> node = *i;
369  Ptr<NetDevice> device = InstallSingleUeDevice (node);
370  devices.Add (device);
371  }
372  return devices;
373 }
374 
375 
378 {
379 
380  NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num eNBs exceeded");
381  uint16_t cellId = ++m_cellIdCounter;
382 
383  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
384  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
385 
386  Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
387 
388  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
389  dlPhy->SetHarqPhyModule (harq);
390  ulPhy->SetHarqPhyModule (harq);
391  phy->SetHarqPhyModule (harq);
392 
393  Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> ());
394  ulPhy->AddCtrlSinrChunkProcessor (pCtrl); // for evaluating SRS UL-CQI
395 
396  Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (ulPhy, phy);
397  ulPhy->AddDataSinrChunkProcessor (pData); // for evaluating PUSCH UL-CQI
398 
399  Ptr<LteInterferencePowerChunkProcessor> pInterf = Create<LteInterferencePowerChunkProcessor> (phy);
400  ulPhy->AddInterferenceDataChunkProcessor (pInterf); // for interference power tracing
401 
402  dlPhy->SetChannel (m_downlinkChannel);
403  ulPhy->SetChannel (m_uplinkChannel);
404 
406  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
407  dlPhy->SetMobility (mm);
408  ulPhy->SetMobility (mm);
409 
410  Ptr<AntennaModel> antenna = (m_enbAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
411  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
412  dlPhy->SetAntenna (antenna);
413  ulPhy->SetAntenna (antenna);
414 
415  Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
418  Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
419 
420  if (m_useIdealRrc)
421  {
422  Ptr<LteEnbRrcProtocolIdeal> rrcProtocol = CreateObject<LteEnbRrcProtocolIdeal> ();
423  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
424  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
425  rrc->AggregateObject (rrcProtocol);
426  rrcProtocol->SetCellId (cellId);
427  }
428  else
429  {
430  Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal> ();
431  rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
432  rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
433  rrc->AggregateObject (rrcProtocol);
434  rrcProtocol->SetCellId (cellId);
435  }
436 
437  if (m_epcHelper != 0)
438  {
439  EnumValue epsBearerToRlcMapping;
440  rrc->GetAttribute ("EpsBearerToRlcMapping", epsBearerToRlcMapping);
441  // it does not make sense to use RLC/SM when also using the EPC
442  if (epsBearerToRlcMapping.Get () == LteEnbRrc::RLC_SM_ALWAYS)
443  {
444  rrc->SetAttribute ("EpsBearerToRlcMapping", EnumValue (LteEnbRrc::RLC_UM_ALWAYS));
445  }
446  }
447 
448  rrc->SetLteEnbCmacSapProvider (mac->GetLteEnbCmacSapProvider ());
449  mac->SetLteEnbCmacSapUser (rrc->GetLteEnbCmacSapUser ());
450  rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
451 
452  rrc->SetLteHandoverManagementSapProvider (handoverAlgorithm->GetLteHandoverManagementSapProvider ());
453  handoverAlgorithm->SetLteHandoverManagementSapUser (rrc->GetLteHandoverManagementSapUser ());
454 
455  mac->SetFfMacSchedSapProvider (sched->GetFfMacSchedSapProvider ());
456  mac->SetFfMacCschedSapProvider (sched->GetFfMacCschedSapProvider ());
457 
458  sched->SetFfMacSchedSapUser (mac->GetFfMacSchedSapUser ());
459  sched->SetFfMacCschedSapUser (mac->GetFfMacCschedSapUser ());
460 
461  phy->SetLteEnbPhySapUser (mac->GetLteEnbPhySapUser ());
462  mac->SetLteEnbPhySapProvider (phy->GetLteEnbPhySapProvider ());
463 
464  phy->SetLteEnbCphySapUser (rrc->GetLteEnbCphySapUser ());
465  rrc->SetLteEnbCphySapProvider (phy->GetLteEnbCphySapProvider ());
466 
468  dev->SetNode (n);
469  dev->SetAttribute ("CellId", UintegerValue (cellId));
470  dev->SetAttribute ("LteEnbPhy", PointerValue (phy));
471  dev->SetAttribute ("LteEnbMac", PointerValue (mac));
472  dev->SetAttribute ("FfMacScheduler", PointerValue (sched));
473  dev->SetAttribute ("LteEnbRrc", PointerValue (rrc));
474  dev->SetAttribute ("LteHandoverAlgorithm", PointerValue (handoverAlgorithm));
475 
476  if (m_isAnrEnabled)
477  {
478  Ptr<LteAnr> anr = CreateObject<LteAnr> (cellId);
479  rrc->SetLteAnrSapProvider (anr->GetLteAnrSapProvider ());
480  anr->SetLteAnrSapUser (rrc->GetLteAnrSapUser ());
481  dev->SetAttribute ("LteAnr", PointerValue (anr));
482  }
483 
484  phy->SetDevice (dev);
485  dlPhy->SetDevice (dev);
486  ulPhy->SetDevice (dev);
487 
488  n->AddDevice (dev);
489  ulPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
490  ulPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteEnbPhy::ReceiveLteControlMessageList, phy));
491  ulPhy->SetLtePhyUlHarqFeedbackCallback (MakeCallback (&LteEnbPhy::ReceiveLteUlHarqFeedback, phy));
492  rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
493 
494  NS_LOG_LOGIC ("set the propagation model frequencies");
495  double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetDlEarfcn ());
496  NS_LOG_LOGIC ("DL freq: " << dlFreq);
497  bool dlFreqOk = m_downlinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq));
498  if (!dlFreqOk)
499  {
500  NS_LOG_WARN ("DL propagation model does not have a Frequency attribute");
501  }
502  double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency (dev->GetUlEarfcn ());
503  NS_LOG_LOGIC ("UL freq: " << ulFreq);
504  bool ulFreqOk = m_uplinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq));
505  if (!ulFreqOk)
506  {
507  NS_LOG_WARN ("UL propagation model does not have a Frequency attribute");
508  }
509 
510  dev->Initialize ();
511 
512  m_uplinkChannel->AddRx (ulPhy);
513 
514  if (m_epcHelper != 0)
515  {
516  NS_LOG_INFO ("adding this eNB to the EPC");
517  m_epcHelper->AddEnb (n, dev, dev->GetCellId ());
518  Ptr<EpcEnbApplication> enbApp = n->GetApplication (0)->GetObject<EpcEnbApplication> ();
519  NS_ASSERT_MSG (enbApp != 0, "cannot retrieve EpcEnbApplication");
520 
521  // S1 SAPs
522  rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
523  enbApp->SetS1SapUser (rrc->GetS1SapUser ());
524 
525  // X2 SAPs
526  Ptr<EpcX2> x2 = n->GetObject<EpcX2> ();
527  x2->SetEpcX2SapUser (rrc->GetEpcX2SapUser ());
528  rrc->SetEpcX2SapProvider (x2->GetEpcX2SapProvider ());
529  }
530 
531  return dev;
532 }
533 
536 {
537  NS_LOG_FUNCTION (this);
538  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
539  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
540 
541  Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
542 
543  Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
544  dlPhy->SetHarqPhyModule (harq);
545  ulPhy->SetHarqPhyModule (harq);
546  phy->SetHarqPhyModule (harq);
547 
548  Ptr<LteRsReceivedPowerChunkProcessor> pRs = Create<LteRsReceivedPowerChunkProcessor> (phy->GetObject<LtePhy> ());
549  dlPhy->AddRsPowerChunkProcessor (pRs);
550 
551  Ptr<LteInterferencePowerChunkProcessor> pInterf = Create<LteInterferencePowerChunkProcessor> (phy);
552  dlPhy->AddInterferenceCtrlChunkProcessor (pInterf); // for RSRQ evaluation of UE Measurements
553 
554  Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> (), dlPhy);
555  dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
556 
557  Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (dlPhy);
558  dlPhy->AddDataSinrChunkProcessor (pData);
559 
560  dlPhy->SetChannel (m_downlinkChannel);
561  ulPhy->SetChannel (m_uplinkChannel);
562 
564  NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
565  dlPhy->SetMobility (mm);
566  ulPhy->SetMobility (mm);
567 
568  Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.Create ())->GetObject<AntennaModel> ();
569  NS_ASSERT_MSG (antenna, "error in creating the AntennaModel object");
570  dlPhy->SetAntenna (antenna);
571  ulPhy->SetAntenna (antenna);
572 
573  Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
574  Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc> ();
575 
576  if (m_useIdealRrc)
577  {
578  Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal> ();
579  rrcProtocol->SetUeRrc (rrc);
580  rrc->AggregateObject (rrcProtocol);
581  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
582  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
583  }
584  else
585  {
586  Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal> ();
587  rrcProtocol->SetUeRrc (rrc);
588  rrc->AggregateObject (rrcProtocol);
589  rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
590  rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
591  }
592 
593  if (m_epcHelper != 0)
594  {
595  rrc->SetUseRlcSm (false);
596  }
597  Ptr<EpcUeNas> nas = CreateObject<EpcUeNas> ();
598 
599  nas->SetAsSapProvider (rrc->GetAsSapProvider ());
600  rrc->SetAsSapUser (nas->GetAsSapUser ());
601 
602  rrc->SetLteUeCmacSapProvider (mac->GetLteUeCmacSapProvider ());
603  mac->SetLteUeCmacSapUser (rrc->GetLteUeCmacSapUser ());
604  rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
605 
606  phy->SetLteUePhySapUser (mac->GetLteUePhySapUser ());
607  mac->SetLteUePhySapProvider (phy->GetLteUePhySapProvider ());
608 
609  phy->SetLteUeCphySapUser (rrc->GetLteUeCphySapUser ());
610  rrc->SetLteUeCphySapProvider (phy->GetLteUeCphySapProvider ());
611 
612  NS_ABORT_MSG_IF (m_imsiCounter >= 0xFFFFFFFF, "max num UEs exceeded");
613  uint64_t imsi = ++m_imsiCounter;
614 
616  dev->SetNode (n);
617  dev->SetAttribute ("Imsi", UintegerValue (imsi));
618  dev->SetAttribute ("LteUePhy", PointerValue (phy));
619  dev->SetAttribute ("LteUeMac", PointerValue (mac));
620  dev->SetAttribute ("LteUeRrc", PointerValue (rrc));
621  dev->SetAttribute ("EpcUeNas", PointerValue (nas));
622 
623  phy->SetDevice (dev);
624  dlPhy->SetDevice (dev);
625  ulPhy->SetDevice (dev);
626  nas->SetDevice (dev);
627 
628  n->AddDevice (dev);
629  dlPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
630  dlPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteUePhy::ReceiveLteControlMessageList, phy));
631  dlPhy->SetLtePhyRxPssCallback (MakeCallback (&LteUePhy::ReceivePss, phy));
632  dlPhy->SetLtePhyDlHarqFeedbackCallback (MakeCallback (&LteUePhy::ReceiveLteDlHarqFeedback, phy));
633  nas->SetForwardUpCallback (MakeCallback (&LteUeNetDevice::Receive, dev));
634 
635  if (m_epcHelper != 0)
636  {
637  m_epcHelper->AddUe (dev, dev->GetImsi ());
638  }
639 
640  dev->Initialize ();
641 
642  return dev;
643 }
644 
645 
646 void
648 {
649  NS_LOG_FUNCTION (this);
650  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
651  {
652  Attach (*i);
653  }
654 }
655 
656 void
658 {
659  NS_LOG_FUNCTION (this);
660 
661  if (m_epcHelper == 0)
662  {
663  NS_FATAL_ERROR ("This function is not valid without properly configured EPC");
664  }
665 
666  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
667  if (ueLteDevice == 0)
668  {
669  NS_FATAL_ERROR ("The passed NetDevice must be an LteUeNetDevice");
670  }
671 
672  // initiate cell selection
673  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
674  NS_ASSERT (ueNas != 0);
675  uint16_t dlEarfcn = ueLteDevice->GetDlEarfcn ();
676  ueNas->StartCellSelection (dlEarfcn);
677 
678  // instruct UE to immediately enter CONNECTED mode after camping
679  ueNas->Connect ();
680 
681  // activate default EPS bearer
682  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (),
683  EpcTft::Default (),
685 }
686 
687 void
689 {
690  NS_LOG_FUNCTION (this);
691  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
692  {
693  Attach (*i, enbDevice);
694  }
695 }
696 
697 void
699 {
700  NS_LOG_FUNCTION (this);
701  //enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
702 
703  Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
704  Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> ();
705 
706  Ptr<EpcUeNas> ueNas = ueLteDevice->GetNas ();
707  ueNas->Connect (enbLteDevice->GetCellId (), enbLteDevice->GetDlEarfcn ());
708 
709  if (m_epcHelper != 0)
710  {
711  // activate default EPS bearer
712  m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (), EpcTft::Default (), EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT));
713  }
714 
715  // tricks needed for the simplified LTE-only simulations
716  if (m_epcHelper == 0)
717  {
718  ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
719  }
720 }
721 
722 void
724 {
725  NS_LOG_FUNCTION (this);
726  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
727  {
728  AttachToClosestEnb (*i, enbDevices);
729  }
730 }
731 
732 void
734 {
735  NS_LOG_FUNCTION (this);
736  NS_ASSERT_MSG (enbDevices.GetN () > 0, "empty enb device container");
737  Vector uepos = ueDevice->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
738  double minDistance = std::numeric_limits<double>::infinity ();
739  Ptr<NetDevice> closestEnbDevice;
740  for (NetDeviceContainer::Iterator i = enbDevices.Begin (); i != enbDevices.End (); ++i)
741  {
742  Vector enbpos = (*i)->GetNode ()->GetObject<MobilityModel> ()->GetPosition ();
743  double distance = CalculateDistance (uepos, enbpos);
744  if (distance < minDistance)
745  {
746  minDistance = distance;
747  closestEnbDevice = *i;
748  }
749  }
750  NS_ASSERT (closestEnbDevice != 0);
751  Attach (ueDevice, closestEnbDevice);
752 }
753 
754 void
756 {
757  NS_LOG_FUNCTION (this);
758  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
759  {
760  ActivateDedicatedEpsBearer (*i, bearer, tft);
761  }
762 }
763 
764 
765 void
767 {
768  NS_LOG_FUNCTION (this);
769 
770  NS_ASSERT_MSG (m_epcHelper != 0, "dedicated EPS bearers cannot be set up when the EPC is not used");
771 
772  uint64_t imsi = ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
773  m_epcHelper->ActivateEpsBearer (ueDevice, imsi, tft, bearer);
774 }
775 
776 class DrbActivator : public SimpleRefCount<DrbActivator>
777 {
778 public:
779  DrbActivator (Ptr<NetDevice> ueDevice, EpsBearer bearer);
780  static void ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
781  void ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti);
782 private:
783  bool m_active;
786  uint64_t m_imsi;
787 };
788 
790  : m_active (false),
791  m_ueDevice (ueDevice),
792  m_bearer (bearer),
793  m_imsi (m_ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ())
794 {
795 }
796 
797 void
798 DrbActivator::ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
799 {
800  NS_LOG_FUNCTION (a << context << imsi << cellId << rnti);
801  a->ActivateDrb (imsi, cellId, rnti);
802 }
803 
804 void
805 DrbActivator::ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti)
806 {
807  NS_LOG_FUNCTION (this << imsi << cellId << rnti << m_active);
808  if ((!m_active) && (imsi == m_imsi))
809  {
810  Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
811  NS_ASSERT (ueRrc->GetState () == LteUeRrc::CONNECTED_NORMALLY);
812  uint16_t rnti = ueRrc->GetRnti ();
813  Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
814  Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
815  NS_ASSERT (ueRrc->GetCellId () == enbLteDevice->GetCellId ());
816  Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
817  NS_ASSERT (ueManager->GetState () == UeManager::CONNECTED_NORMALLY ||
818  ueManager->GetState () == UeManager::CONNECTION_RECONFIGURATION);
820  params.rnti = rnti;
821  params.bearer = m_bearer;
822  params.bearerId = 0;
823  params.gtpTeid = 0; // don't care
824  enbRrc->GetS1SapUser ()->DataRadioBearerSetupRequest (params);
825  m_active = true;
826  }
827 }
828 
829 
830 void
832 {
833  NS_LOG_FUNCTION (this << ueDevice);
834  NS_ASSERT_MSG (m_epcHelper == 0, "this method must not be used when the EPC is being used");
835 
836  // Normally it is the EPC that takes care of activating DRBs
837  // when the UE gets connected. When the EPC is not used, we achieve
838  // the same behavior by hooking a dedicated DRB activation function
839  // to the Enb RRC Connection Established trace source
840 
841 
842  Ptr<LteEnbNetDevice> enbLteDevice = ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
843 
844  std::ostringstream path;
845  path << "/NodeList/" << enbLteDevice->GetNode ()->GetId ()
846  << "/DeviceList/" << enbLteDevice->GetIfIndex ()
847  << "/LteEnbRrc/ConnectionEstablished";
848  Ptr<DrbActivator> arg = Create<DrbActivator> (ueDevice, bearer);
850 }
851 
852 void
854 {
855  NS_LOG_FUNCTION (this);
856 
857  NS_ASSERT_MSG (m_epcHelper != 0, "X2 interfaces cannot be set up when the EPC is not used");
858 
859  for (NodeContainer::Iterator i = enbNodes.Begin (); i != enbNodes.End (); ++i)
860  {
861  for (NodeContainer::Iterator j = i + 1; j != enbNodes.End (); ++j)
862  {
863  AddX2Interface (*i, *j);
864  }
865  }
866 }
867 
868 void
870 {
871  NS_LOG_FUNCTION (this);
872  NS_LOG_INFO ("setting up the X2 interface");
873 
874  m_epcHelper->AddX2Interface (enbNode1, enbNode2);
875 }
876 
877 void
879 {
880  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
881  NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
882  Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetEnbDev);
883 }
884 
885 void
887 {
888  NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
889 
890  uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice> ()->GetCellId ();
891  Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice> ()->GetRrc ();
892  uint16_t rnti = ueDev->GetObject<LteUeNetDevice> ()->GetRrc ()->GetRnti ();
893  sourceRrc->SendHandoverRequest (rnti, targetCellId);
894 }
895 
896 
897 
898 
899 
900 void
902 {
903  NS_LOG_FUNCTION (this);
904  for (NetDeviceContainer::Iterator i = ueDevices.Begin (); i != ueDevices.End (); ++i)
905  {
906  ActivateDataRadioBearer (*i, bearer);
907  }
908 }
909 
910 void
912 {
913  LogComponentEnable ("LteHelper", LOG_LEVEL_ALL);
914  LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
915  LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
916  LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
917  LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
918  LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
919  LogComponentEnable ("LteRlcUm", LOG_LEVEL_ALL);
920  LogComponentEnable ("LteRlcAm", LOG_LEVEL_ALL);
921  LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
922  LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL);
923 
924  LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
925  LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
926  LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
927  LogComponentEnable ("LteSpectrumValueHelper", LOG_LEVEL_ALL);
928  LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
929  LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
930  LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
931 
932  std::string propModelStr = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
933  LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
934  LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
935  LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
936 
937  LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
938  LogComponentEnable ("LteStatsCalculator", LOG_LEVEL_ALL);
939  LogComponentEnable ("MacStatsCalculator", LOG_LEVEL_ALL);
940  LogComponentEnable ("PhyTxStatsCalculator", LOG_LEVEL_ALL);
941  LogComponentEnable ("PhyRxStatsCalculator", LOG_LEVEL_ALL);
942  LogComponentEnable ("PhyStatsCalculator", LOG_LEVEL_ALL);
943 
944 
945 }
946 
947 void
949 {
950  EnablePhyTraces ();
951  EnableMacTraces ();
952  EnableRlcTraces ();
953  EnablePdcpTraces ();
954 }
955 
956 void
958 {
959  NS_ASSERT_MSG (m_rlcStats == 0, "please make sure that LteHelper::EnableRlcTraces is called at most once");
960  m_rlcStats = CreateObject<RadioBearerStatsCalculator> ("RLC");
962 }
963 
964 int64_t
966 {
967  int64_t currentStream = stream;
968  if ((m_fadingModule != 0) && (m_fadingStreamsAssigned == false))
969  {
971  if (tflm != 0)
972  {
973  currentStream += tflm->AssignStreams (currentStream);
975  }
976  }
977  Ptr<NetDevice> netDevice;
978  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
979  {
980  netDevice = (*i);
981  Ptr<LteEnbNetDevice> lteEnb = DynamicCast<LteEnbNetDevice> (netDevice);
982  if (lteEnb)
983  {
984  Ptr<LteSpectrumPhy> dlPhy = lteEnb->GetPhy ()->GetDownlinkSpectrumPhy ();
985  Ptr<LteSpectrumPhy> ulPhy = lteEnb->GetPhy ()->GetUplinkSpectrumPhy ();
986  currentStream += dlPhy->AssignStreams (currentStream);
987  currentStream += ulPhy->AssignStreams (currentStream);
988  }
989  Ptr<LteUeNetDevice> lteUe = DynamicCast<LteUeNetDevice> (netDevice);
990  if (lteUe)
991  {
992  Ptr<LteSpectrumPhy> dlPhy = lteUe->GetPhy ()->GetDownlinkSpectrumPhy ();
993  Ptr<LteSpectrumPhy> ulPhy = lteUe->GetPhy ()->GetUplinkSpectrumPhy ();
994  Ptr<LteUeMac> ueMac = lteUe->GetMac ();
995  currentStream += dlPhy->AssignStreams (currentStream);
996  currentStream += ulPhy->AssignStreams (currentStream);
997  currentStream += ueMac->AssignStreams (currentStream);
998  }
999  }
1000  return (currentStream - stream);
1001 }
1002 
1003 
1004 void
1006 {
1007  EnableDlPhyTraces ();
1008  EnableUlPhyTraces ();
1013 }
1014 
1015 void
1017 {
1018  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/DlPhyTransmission",
1020 }
1021 
1022 void
1024 {
1025  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/UlPhyTransmission",
1027 }
1028 
1029 void
1031 {
1032  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1034 }
1035 
1036 void
1038 {
1039  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1041 }
1042 
1043 
1044 void
1046 {
1047  EnableDlMacTraces ();
1048  EnableUlMacTraces ();
1049 }
1050 
1051 
1052 void
1054 {
1056  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/DlScheduling",
1058 }
1059 
1060 void
1062 {
1064  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbMac/UlScheduling",
1066 }
1067 
1068 void
1070 {
1072  Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpSinr",
1074 }
1075 
1076 void
1078 {
1080  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportUeSinr",
1082  Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/ReportInterference",
1084 
1085 }
1086 
1089 {
1090  return m_rlcStats;
1091 }
1092 
1093 void
1095 {
1096  NS_ASSERT_MSG (m_pdcpStats == 0, "please make sure that LteHelper::EnablePdcpTraces is called at most once");
1097  m_pdcpStats = CreateObject<RadioBearerStatsCalculator> ("PDCP");
1099 }
1100 
1103 {
1104  return m_pdcpStats;
1105 }
1106 
1107 } // namespace ns3
Parameters passed to DataRadioBearerSetupRequest ()
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:538
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the pathloss model to be created
Definition: lte-helper.cc:264
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:1030
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
RadioBearerStatsConnector m_radioBearerStatsConnector
Definition: lte-helper.h:564
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
Ptr< NetDevice > InstallSingleEnbDevice(Ptr< Node > n)
Create an eNodeB device (LteEnbNetDevice) on the given node.
Definition: lte-helper.cc:377
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:347
std::vector< Ptr< Node > >::const_iterator Iterator
void EnableLogComponents(void)
Enables logging for all components of the LENA architecture.
Definition: lte-helper.cc:911
hold variables of type string
Definition: string.h:19
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:878
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:556
ObjectFactory m_fadingModelFactory
Definition: lte-helper.h:554
static void ActivateCallback(Ptr< DrbActivator > a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Definition: lte-helper.cc:798
Hold a value for an Attribute.
Definition: attribute.h:56
void EnableDlPhyTraces(void)
Enable trace sinks for DL PHY layer.
Definition: lte-helper.cc:1069
uint16_t rnti
the RNTI identifying the UE for which the DataRadioBearer is to be created
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
Definition: lte-enb-phy.cc:448
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Build bound Callbacks which take varying numbers of arguments, and potentially returning a value...
Definition: callback.h:1463
static Vector GetPosition(Ptr< Node > node)
Definition: multirate.cc:315
DrbActivator(Ptr< NetDevice > ueDevice, EpsBearer bearer)
Definition: lte-helper.cc:789
void SetUeAntennaModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the AntennaModel to be used for the UEs
Definition: lte-helper.cc:308
void SetFadingModel(std::string model)
Definition: lte-helper.cc:315
NS_LOG_COMPONENT_DEFINE("LteHelper")
static Ptr< EpcTft > Default()
creates a TFT matching any traffic
Definition: epc-tft.cc:142
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)
Definition: assert.h:64
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:647
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void EnableRlcTraces(void)
Enable trace sinks for RLC layer.
Definition: lte-helper.cc:957
void SetTypeId(TypeId tid)
Ptr< PhyStatsCalculator > m_phyStats
Definition: lte-helper.h:558
void EnablePdcpStats(Ptr< RadioBearerStatsCalculator > pdcpStats)
Ptr< PhyRxStatsCalculator > m_phyRxStats
Definition: lte-helper.h:560
std::string m_fadingModelType
Definition: lte-helper.h:553
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:181
void SetUeDeviceAttribute(std::string n, const AttributeValue &v)
set an attribute for the LteUeNetDevice to be created
Definition: lte-helper.cc:294
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:336
#define NS_LOG_INFO(msg)
Definition: log.h:298
void SetUeAntennaModelType(std::string type)
Definition: lte-helper.cc:301
int Get(void) const
Definition: enum.cc:46
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition: log.h:309
Ptr< MacStatsCalculator > m_macStats
Definition: lte-helper.h:561
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:824
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:965
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:728
ObjectFactory m_ulPathlossModelFactory
Definition: lte-helper.h:549
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Call ActivateDataRadioBearer (ueDevice, bearer) for each UE device in a given set.
Definition: lte-helper.cc:901
ObjectFactory m_channelFactory
Definition: lte-helper.h:551
a 3d vector
Definition: vector.h:31
void SetHandoverAlgorithmType(std::string type)
Definition: lte-helper.cc:238
void EnableUlRxPhyTraces(void)
Enable trace sinks for UL reception PHY layer.
Definition: lte-helper.cc:1037
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
static TypeId GetTypeId(void)
void SetSchedulerType(std::string type)
Definition: lte-helper.cc:211
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Ptr< RadioBearerStatsCalculator > m_rlcStats
Definition: lte-helper.h:562
std::string GetHandoverAlgorithmType() const
Definition: lte-helper.cc:232
void EnablePdcpTraces(void)
Enable trace sinks for PDCP layer.
Definition: lte-helper.cc:1094
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:723
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.
Ptr< Object > m_downlinkPathlossModel
Definition: lte-helper.h:537
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
Definition: node.cc:158
Ptr< NetDevice > m_ueDevice
Definition: lte-helper.cc:784
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
set an attribute for the handover algorithm to be created
Definition: lte-helper.cc:246
hold variables of type 'enum'
Definition: enum.h:37
void DoHandoverRequest(Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
The actual function to trigger a manual handover.
Definition: lte-helper.cc:886
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:948
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:225
Ptr< NetDevice > InstallSingleUeDevice(Ptr< Node > n)
Create a UE device (LteUeNetDevice) on the given node.
Definition: lte-helper.cc:535
uint64_t m_imsiCounter
Definition: lte-helper.h:568
ObjectFactory m_enbAntennaModelFactory
Definition: lte-helper.h:544
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:569
void EnablePhyTraces(void)
Enable trace sinks for PHY layer.
Definition: lte-helper.cc:1005
bool m_isAnrEnabled
Definition: lte-helper.h:572
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1238
ObjectFactory m_handoverAlgorithmFactory
Definition: lte-helper.h:541
fading loss model based on precalculated fading traces
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
void SetEnbAntennaModelType(std::string type)
Definition: lte-helper.cc:280
ObjectFactory m_dlPathlossModelFactory
Definition: lte-helper.h:548
void SetSpectrumChannelType(std::string type)
Definition: lte-helper.cc:333
static TypeId GetTypeId(void)
void SetFadingModelAttribute(std::string n, const AttributeValue &v)
set an attribute of the fading model
Definition: lte-helper.cc:327
void EnableDlMacTraces(void)
Enable trace sinks for DL MAC layer.
Definition: lte-helper.cc:1053
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
Definition: lte-ue-phy.cc:1249
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:755
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:1023
Ptr< SpectrumChannel > m_uplinkChannel
Definition: lte-helper.h:535
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:853
std::string GetName(void) const
Definition: type-id.cc:658
void Set(std::string name, const AttributeValue &value)
ObjectFactory m_schedulerFactory
Definition: lte-helper.h:540
void EnableUlPhyTraces(void)
Enable trace sinks for UL PHY layer.
Definition: lte-helper.cc:1077
void EnableDlTxPhyTraces(void)
Enable trace sinks for DL transmission PHY layer.
Definition: lte-helper.cc:1016
friend class ObjectFactory
Definition: object.h:229
Ptr< SpectrumPropagationLossModel > m_fadingModule
Definition: lte-helper.h:555
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:1061
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)
Definition: assert.h:86
Ptr< EpcHelper > m_epcHelper
Definition: lte-helper.h:566
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
Definition: lte-helper.cc:1088
virtual ~LteHelper(void)
Definition: lte-helper.cc:135
NetDeviceContainer InstallUeDevice(NodeContainer c)
create a set of UE devices
Definition: lte-helper.cc:362
Ptr< PhyTxStatsCalculator > m_phyTxStats
Definition: lte-helper.h:559
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
Definition: lte-helper.cc:1102
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:194
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:204
uint32_t AddDevice(Ptr< NetDevice > device)
Definition: node.cc:118
EpsBearer m_bearer
Definition: lte-helper.cc:785
#define NS_LOG_WARN(msg)
Definition: log.h:280
void SetPathlossModelType(std::string type)
Definition: lte-helper.cc:254
std::vector< Ptr< NetDevice > >::const_iterator Iterator
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
Definition: lte-ue-phy.cc:727
void Initialize(void)
This method calls the virtual DoInitialize method on all the objects aggregated to this object...
Definition: object.cc:180
void ActivateDrb(uint64_t imsi, uint16_t cellId, uint16_t rnti)
Definition: lte-helper.cc:805
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Definition: lte-ue-phy.cc:874
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
set an attribute for the AntennaModel to be used for the eNBs
Definition: lte-helper.cc:287
ObjectFactory m_ueNetDeviceFactory
Definition: lte-helper.h:545
void SetSpectrumChannelAttribute(std::string n, const AttributeValue &v)
set an attribute for the SpectrumChannel to be used for the UEs
Definition: lte-helper.cc:340
Defines the interface for spectrum-aware channel implementations.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:371
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:1045
a base class which provides memory management and object aggregation
Definition: object.h:63
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
Definition: abort.h:98
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< RadioBearerStatsCalculator > m_pdcpStats
Definition: lte-helper.h:563
Hold a floating point type.
Definition: double.h:41
ObjectFactory m_ueAntennaModelFactory
Definition: lte-helper.h:546
The eNodeB device implementation.
Ptr< T > GetObject(void) const
Definition: object.h:361
A template-based reference counting class.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-enb-phy.cc:389
a unique identifier for an interface.
Definition: type-id.h:49
ObjectFactory m_enbNetDeviceFactory
Definition: lte-helper.h:543
Ptr< SpectrumChannel > m_downlinkChannel
Definition: lte-helper.h:534
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: object.cc:343
std::string GetSchedulerType() const
Definition: lte-helper.cc:219
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:52
void LogComponentEnable(char const *name, enum LogLevel level)
Definition: log.cc:311
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
set an attribute for the LteEnbNetDevice to be created
Definition: lte-helper.cc:272
bool m_useIdealRrc
Definition: lte-helper.h:571
The LteUeNetDevice class implements the UE net device.