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