23 #include "lte-helper.h"
24 #include <ns3/string.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/isotropic-antenna-model.h>
42 #include <ns3/lte-enb-net-device.h>
43 #include <ns3/lte-ue-net-device.h>
44 #include <ns3/ff-mac-scheduler.h>
45 #include <ns3/lte-rlc.h>
46 #include <ns3/lte-rlc-um.h>
47 #include <ns3/lte-rlc-am.h>
48 #include <ns3/epc-enb-s1-sap.h>
49 #include <ns3/lte-rrc-protocol-ideal.h>
50 #include <ns3/lte-rrc-protocol-real.h>
52 #include <ns3/epc-helper.h>
54 #include <ns3/buildings-propagation-loss-model.h>
55 #include <ns3/lte-spectrum-value-helper.h>
56 #include <ns3/epc-x2.h>
62 NS_OBJECT_ENSURE_REGISTERED (LteHelper);
64 LteHelper::LteHelper (
void)
69 m_enbNetDeviceFactory.SetTypeId (LteEnbNetDevice::GetTypeId ());
70 m_enbAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
71 m_ueAntennaModelFactory.SetTypeId (IsotropicAntennaModel::GetTypeId ());
72 m_channelFactory.SetTypeId (MultiModelSpectrumChannel::GetTypeId ());
82 m_downlinkPathlossModel = m_dlPathlossModelFactory.
Create ();
86 NS_LOG_LOGIC (
this <<
" using a SpectrumPropagationLossModel in DL");
87 m_downlinkChannel->AddSpectrumPropagationLossModel (dlSplm);
91 NS_LOG_LOGIC (
this <<
" using a PropagationLossModel in DL");
93 NS_ASSERT_MSG (dlPlm != 0,
" " << m_downlinkPathlossModel <<
" is neither PropagationLossModel nor SpectrumPropagationLossModel");
94 m_downlinkChannel->AddPropagationLossModel (dlPlm);
97 m_uplinkPathlossModel = m_ulPathlossModelFactory.
Create ();
101 NS_LOG_LOGIC (
this <<
" using a SpectrumPropagationLossModel in UL");
106 NS_LOG_LOGIC (
this <<
" using a PropagationLossModel in UL");
108 NS_ASSERT_MSG (ulPlm != 0,
" " << m_uplinkPathlossModel <<
" is neither PropagationLossModel nor SpectrumPropagationLossModel");
111 if (!m_fadingModelType.empty ())
115 m_fadingModule->Initialize ();
116 m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
119 m_phyStats = CreateObject<PhyStatsCalculator> ();
120 m_phyTxStats = CreateObject<PhyTxStatsCalculator> ();
121 m_phyRxStats = CreateObject<PhyRxStatsCalculator> ();
122 m_macStats = CreateObject<MacStatsCalculator> ();
127 LteHelper::~LteHelper (
void)
132 TypeId LteHelper::GetTypeId (
void)
136 TypeId (
"ns3::LteHelper")
137 .SetParent<Object> ()
138 .AddConstructor<LteHelper> ()
139 .AddAttribute (
"Scheduler",
140 "The type of scheduler to be used for eNBs",
141 StringValue (
"ns3::PfFfMacScheduler"),
143 MakeStringChecker ())
144 .AddAttribute (
"PathlossModel",
145 "The type of pathloss model to be used",
146 StringValue (
"ns3::FriisPropagationLossModel"),
148 MakeStringChecker ())
149 .AddAttribute (
"FadingModel",
150 "The type of fading model to be used. If the type is set "
151 "to an empty string, no fading model is used.",
154 MakeStringChecker ())
155 .AddAttribute (
"UseIdealRrc",
156 "If true, LteRrcProtocolIdeal will be used for RRC signaling. "
157 "If false, LteRrcProtocolReal will be used.",
159 MakeBooleanAccessor (&LteHelper::m_useIdealRrc),
160 MakeBooleanChecker ())
169 m_downlinkChannel = 0;
194 m_schedulerFactory.
Set (n, v);
203 m_dlPathlossModelFactory.
SetTypeId (type);
205 m_ulPathlossModelFactory.
SetTypeId (type);
212 m_dlPathlossModelFactory.
Set (n, v);
213 m_ulPathlossModelFactory.
Set (n, v);
220 m_enbNetDeviceFactory.
Set (n, v);
228 m_enbAntennaModelFactory.
SetTypeId (type);
235 m_enbAntennaModelFactory.
Set (n, v);
242 m_ueAntennaModelFactory.
SetTypeId (type);
249 m_ueAntennaModelFactory.
Set (n, v);
256 m_fadingModelType = type;
267 m_fadingModelFactory.
Set (n, v);
280 m_channelFactory.
Set (n, v);
290 for (NodeContainer::Iterator i = c.
Begin (); i != c.
End (); ++i)
294 devices.
Add (device);
304 for (NodeContainer::Iterator i = c.
Begin (); i != c.
End (); ++i)
308 devices.
Add (device);
315 LteHelper::InstallSingleEnbDevice (
Ptr<Node> n)
319 uint16_t cellId = ++m_cellIdCounter;
327 dlPhy->SetHarqPhyModule (harq);
328 ulPhy->SetHarqPhyModule (harq);
329 phy->SetHarqPhyModule (harq);
332 ulPhy->AddCtrlSinrChunkProcessor (pCtrl);
335 ulPhy->AddDataSinrChunkProcessor (pData);
338 ulPhy->AddInterferenceChunkProcessor (pInterf);
340 dlPhy->SetChannel (m_downlinkChannel);
341 ulPhy->SetChannel (m_uplinkChannel);
344 NS_ASSERT_MSG (mm,
"MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
345 dlPhy->SetMobility (mm);
346 ulPhy->SetMobility (mm);
349 NS_ASSERT_MSG (antenna,
"error in creating the AntennaModel object");
350 dlPhy->SetAntenna (antenna);
351 ulPhy->SetAntenna (antenna);
360 rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
361 rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
362 rrc->AggregateObject (rrcProtocol);
363 rrcProtocol->SetCellId (cellId);
367 Ptr<LteEnbRrcProtocolReal> rrcProtocol = CreateObject<LteEnbRrcProtocolReal> ();
368 rrcProtocol->SetLteEnbRrcSapProvider (rrc->GetLteEnbRrcSapProvider ());
369 rrc->SetLteEnbRrcSapUser (rrcProtocol->GetLteEnbRrcSapUser ());
370 rrc->AggregateObject (rrcProtocol);
371 rrcProtocol->SetCellId (cellId);
374 if (m_epcHelper != 0)
376 EnumValue epsBearerToRlcMapping;
377 rrc->GetAttribute (
"EpsBearerToRlcMapping", epsBearerToRlcMapping);
379 if (epsBearerToRlcMapping.Get () == LteEnbRrc::RLC_SM_ALWAYS)
381 rrc->SetAttribute (
"EpsBearerToRlcMapping", EnumValue (LteEnbRrc::RLC_UM_ALWAYS));
385 rrc->SetLteEnbCmacSapProvider (mac->GetLteEnbCmacSapProvider ());
386 mac->SetLteEnbCmacSapUser (rrc->GetLteEnbCmacSapUser ());
387 rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
389 mac->SetFfMacSchedSapProvider (sched->GetFfMacSchedSapProvider ());
390 mac->SetFfMacCschedSapProvider (sched->GetFfMacCschedSapProvider ());
392 sched->SetFfMacSchedSapUser (mac->GetFfMacSchedSapUser ());
393 sched->SetFfMacCschedSapUser (mac->GetFfMacCschedSapUser ());
395 phy->SetLteEnbPhySapUser (mac->GetLteEnbPhySapUser ());
396 mac->SetLteEnbPhySapProvider (phy->GetLteEnbPhySapProvider ());
399 phy->SetLteEnbCphySapUser (rrc->GetLteEnbCphySapUser ());
400 rrc->SetLteEnbCphySapProvider (phy->GetLteEnbCphySapProvider ());
402 Ptr<LteEnbNetDevice> dev = m_enbNetDeviceFactory.
Create<LteEnbNetDevice> ();
405 dev->SetAttribute (
"LteEnbPhy", PointerValue (phy));
406 dev->SetAttribute (
"LteEnbMac", PointerValue (mac));
407 dev->SetAttribute (
"FfMacScheduler", PointerValue (sched));
408 dev->SetAttribute (
"LteEnbRrc", PointerValue (rrc));
410 phy->SetDevice (dev);
411 dlPhy->SetDevice (dev);
412 ulPhy->SetDevice (dev);
423 bool dlFreqOk = m_downlinkPathlossModel->
SetAttributeFailSafe (
"Frequency", DoubleValue (dlFreq));
426 NS_LOG_WARN (
"DL propagation model does not have a Frequency attribute");
430 bool ulFreqOk = m_uplinkPathlossModel->
SetAttributeFailSafe (
"Frequency", DoubleValue (ulFreq));
433 NS_LOG_WARN (
"UL propagation model does not have a Frequency attribute");
439 m_uplinkChannel->AddRx (ulPhy);
441 if (m_epcHelper != 0)
444 m_epcHelper->AddEnb (n, dev, dev->GetCellId ());
445 Ptr<EpcEnbApplication> enbApp = n->
GetApplication (0)->GetObject<EpcEnbApplication> ();
446 NS_ASSERT_MSG (enbApp != 0,
"cannot retrieve EpcEnbApplication");
449 rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
450 enbApp->SetS1SapUser (rrc->GetS1SapUser ());
454 x2->SetEpcX2SapUser (rrc->GetEpcX2SapUser ());
455 rrc->SetEpcX2SapProvider (x2->GetEpcX2SapProvider ());
462 LteHelper::InstallSingleUeDevice (Ptr<Node> n)
465 Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
466 Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
468 Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
470 Ptr<LteHarqPhy> harq = Create<LteHarqPhy> ();
471 dlPhy->SetHarqPhyModule (harq);
472 ulPhy->SetHarqPhyModule (harq);
473 phy->SetHarqPhyModule (harq);
475 Ptr<LteRsReceivedPowerChunkProcessor> pRs = Create<LteRsReceivedPowerChunkProcessor> (phy->GetObject<LtePhy> ());
476 dlPhy->AddRsPowerChunkProcessor (pRs);
478 Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> (), dlPhy);
479 dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
481 Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (dlPhy);
482 dlPhy->AddDataSinrChunkProcessor (pData);
484 dlPhy->SetChannel (m_downlinkChannel);
485 ulPhy->SetChannel (m_uplinkChannel);
487 Ptr<MobilityModel> mm = n->
GetObject<MobilityModel> ();
488 NS_ASSERT_MSG (mm,
"MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
489 dlPhy->SetMobility (mm);
490 ulPhy->SetMobility (mm);
492 Ptr<AntennaModel> antenna = (m_ueAntennaModelFactory.
Create ())->GetObject<AntennaModel> ();
493 NS_ASSERT_MSG (antenna,
"error in creating the AntennaModel object");
494 dlPhy->SetAntenna (antenna);
495 ulPhy->SetAntenna (antenna);
497 Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
498 Ptr<LteUeRrc> rrc = CreateObject<LteUeRrc> ();
502 Ptr<LteUeRrcProtocolIdeal> rrcProtocol = CreateObject<LteUeRrcProtocolIdeal> ();
503 rrcProtocol->SetUeRrc (rrc);
504 rrc->AggregateObject (rrcProtocol);
505 rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
506 rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
510 Ptr<LteUeRrcProtocolReal> rrcProtocol = CreateObject<LteUeRrcProtocolReal> ();
511 rrcProtocol->SetUeRrc (rrc);
512 rrc->AggregateObject (rrcProtocol);
513 rrcProtocol->SetLteUeRrcSapProvider (rrc->GetLteUeRrcSapProvider ());
514 rrc->SetLteUeRrcSapUser (rrcProtocol->GetLteUeRrcSapUser ());
517 if (m_epcHelper != 0)
519 rrc->SetUseRlcSm (
false);
521 Ptr<EpcUeNas> nas = CreateObject<EpcUeNas> ();
523 nas->SetAsSapProvider (rrc->GetAsSapProvider ());
524 rrc->SetAsSapUser (nas->GetAsSapUser ());
526 rrc->SetLteUeCmacSapProvider (mac->GetLteUeCmacSapProvider ());
527 mac->SetLteUeCmacSapUser (rrc->GetLteUeCmacSapUser ());
528 rrc->SetLteMacSapProvider (mac->GetLteMacSapProvider ());
530 phy->SetLteUePhySapUser (mac->GetLteUePhySapUser ());
531 mac->SetLteUePhySapProvider (phy->GetLteUePhySapProvider ());
533 phy->SetLteUeCphySapUser (rrc->GetLteUeCphySapUser ());
534 rrc->SetLteUeCphySapProvider (phy->GetLteUeCphySapProvider ());
537 uint64_t imsi = ++m_imsiCounter;
538 Ptr<LteUeNetDevice> dev = CreateObject<LteUeNetDevice> (n, phy, mac, rrc, nas, imsi);
539 phy->SetDevice (dev);
540 dlPhy->SetDevice (dev);
541 ulPhy->SetDevice (dev);
542 nas->SetDevice (dev);
546 dlPhy->SetLtePhyRxCtrlEndOkCallback (
MakeCallback (&LteUePhy::ReceiveLteControlMessageList, phy));
550 if (m_epcHelper != 0)
552 m_epcHelper->AddUe (dev, dev->GetImsi ());
565 for (NetDeviceContainer::Iterator i = ueDevices.
Begin (); i != ueDevices.
End (); ++i)
581 ueNas->Connect (enbLteDevice->GetCellId (), enbLteDevice->GetDlEarfcn ());
583 if (m_epcHelper != 0)
586 m_epcHelper->ActivateEpsBearer (ueDevice, ueLteDevice->GetImsi (),
EpcTft::Default (),
EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT));
590 if (m_epcHelper == 0)
600 for (NetDeviceContainer::Iterator i = ueDevices.
Begin (); i != ueDevices.
End (); ++i)
612 double minDistance = std::numeric_limits<double>::infinity ();
614 for (NetDeviceContainer::Iterator i = enbDevices.
Begin (); i != enbDevices.
End (); ++i)
618 if (distance < minDistance)
620 minDistance = distance;
621 closestEnbDevice = *i;
625 Attach (ueDevice, closestEnbDevice);
632 for (NetDeviceContainer::Iterator i = ueDevices.
Begin (); i != ueDevices.
End (); ++i)
644 NS_ASSERT_MSG (m_epcHelper != 0,
"dedicated EPS bearers cannot be set up when EPC is not used");
646 uint64_t imsi = ueDevice->GetObject<
LteUeNetDevice> ()->GetImsi ();
647 m_epcHelper->ActivateEpsBearer (ueDevice, imsi, tft, bearer);
654 static void ActivateCallback (
Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti);
655 void ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti);
665 m_ueDevice (ueDevice),
672 DrbActivator::ActivateCallback (Ptr<DrbActivator> a, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
675 a->ActivateDrb (imsi, cellId, rnti);
679 DrbActivator::ActivateDrb (uint64_t imsi, uint16_t cellId, uint16_t rnti)
682 if ((!m_active) && (imsi == m_imsi))
684 Ptr<LteUeRrc> ueRrc = m_ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
685 NS_ASSERT (ueRrc->GetState () == LteUeRrc::CONNECTED_NORMALLY);
686 uint16_t rnti = ueRrc->GetRnti();
687 Ptr<LteEnbNetDevice> enbLteDevice = m_ueDevice->GetObject<LteUeNetDevice> ()->GetTargetEnb ();
688 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetObject<LteEnbNetDevice> ()->GetRrc ();
689 NS_ASSERT (ueRrc->GetCellId () == enbLteDevice->GetCellId ());
690 Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
691 NS_ASSERT (ueManager->GetState () == UeManager::CONNECTED_NORMALLY ||
692 ueManager->GetState () == UeManager::CONNECTION_RECONFIGURATION);
693 EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params;
695 params.bearer = m_bearer;
698 enbRrc->GetS1SapUser ()->DataRadioBearerSetupRequest (params);
708 NS_ASSERT_MSG (m_epcHelper == 0,
"this method must not be used when EPC is being used");
718 std::ostringstream path;
719 path <<
"/NodeList/" << enbLteDevice->GetNode ()->GetId ()
720 <<
"/DeviceList/" << enbLteDevice->GetIfIndex ()
721 <<
"/LteEnbRrc/ConnectionEstablished";
723 Config::Connect (path.str (), MakeBoundCallback (&DrbActivator::ActivateCallback, arg));
731 for (NodeContainer::Iterator i = enbNodes.
Begin (); i != enbNodes.
End (); ++i)
733 for (NodeContainer::Iterator j = i + 1; j != enbNodes.
End (); ++j)
746 m_epcHelper->AddX2Interface (enbNode1, enbNode2);
753 NS_ASSERT_MSG (m_epcHelper,
"Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
754 Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest,
this, ueDev, sourceEnbDev, targetEnbDev);
762 uint16_t targetCellId = targetEnbDev->GetObject<
LteEnbNetDevice> ()->GetCellId ();
764 uint16_t rnti = ueDev->GetObject<
LteUeNetDevice> ()->GetRrc ()->GetRnti ();
765 sourceRrc->SendHandoverRequest (rnti, targetCellId);
776 for (NetDeviceContainer::Iterator i = ueDevices.
Begin (); i != ueDevices.
End (); ++i)
804 std::string propModelStr = m_dlPathlossModelFactory.
GetTypeId ().
GetName ().erase (0,5).c_str ();
831 NS_ASSERT_MSG (m_rlcStats == 0,
"please make sure that LteHelper::EnableRlcTraces is called at most once");
832 m_rlcStats = CreateObject<RadioBearerStatsCalculator> (
"RLC");
833 m_radioBearerStatsConnector.EnableRlcStats (m_rlcStats);
839 int64_t currentStream = stream;
841 for (NetDeviceContainer::Iterator i = c.
Begin (); i != c.
End (); ++i)
849 currentStream += dlPhy->AssignStreams (currentStream);
850 currentStream += ulPhy->AssignStreams (currentStream);
858 currentStream += dlPhy->AssignStreams (currentStream);
859 currentStream += ulPhy->AssignStreams (currentStream);
860 currentStream += ueMac->AssignStreams (currentStream);
863 return (currentStream - stream);
867 FindImsiFromEnbRlcPath (std::string path)
874 std::string ueMapPath = path.substr (0, path.find (
"/DataRadioBearerMap"));
877 if (match.
GetN () != 0)
890 FindImsiFromUePhy (std::string path)
897 std::string ueRlcPath = path.substr (0, path.find (
"/LteUePhy"));
898 ueRlcPath +=
"/LteUeRrc";
901 if (match.GetN () != 0)
903 Ptr<Object> ueRrc = match.Get (0);
904 return ueRrc->GetObject<LteUeRrc> ()->GetImsi ();
915 FindImsiFromLteNetDevice (std::string path)
924 if (match.GetN () != 0)
926 Ptr<Object> ueNetDevice = match.Get (0);
927 NS_LOG_LOGIC (
"FindImsiFromLteNetDevice: " << path <<
", " << ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ());
928 return ueNetDevice->GetObject<LteUeNetDevice> ()->GetImsi ();
937 FindCellIdFromEnbRlcPath (std::string path)
944 std::string enbNetDevicePath = path.substr (0, path.find (
"/LteEnbRrc"));
946 if (match.GetN () != 0)
948 Ptr<Object> enbNetDevice = match.Get (0);
949 NS_LOG_LOGIC (
"FindCellIdFromEnbRlcPath: " << path <<
", " << enbNetDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
950 return enbNetDevice->GetObject<LteEnbNetDevice> ()->GetCellId ();
954 NS_FATAL_ERROR (
"Lookup " << enbNetDevicePath <<
" got no matches");
959 FindImsiFromEnbMac (std::string path, uint16_t rnti)
964 std::ostringstream oss;
965 std::string p = path.substr (0, path.find (
"/LteEnbMac"));
967 p +=
"/LteEnbRrc/UeMap/" + oss.str ();
968 uint64_t imsi = FindImsiFromEnbRlcPath (p);
969 NS_LOG_LOGIC (
"FindImsiFromEnbMac: " << path <<
", " << rnti <<
", " << imsi);
974 FindCellIdFromEnbMac (std::string path, uint16_t rnti)
978 std::ostringstream oss;
979 std::string p = path.substr (0, path.find (
"/LteEnbMac"));
981 p +=
"/LteEnbRrc/UeMap/" + oss.str ();
982 uint16_t cellId = FindCellIdFromEnbRlcPath (p);
983 NS_LOG_LOGIC (
"FindCellIdFromEnbMac: " << path <<
", "<< rnti <<
", " << cellId);
989 FindImsiForEnb (std::string path, uint16_t rnti)
993 if (path.find (
"/DlPhyTransmission"))
996 std::ostringstream oss;
997 std::string p = path.substr (0, path.find (
"/LteEnbPhy"));
999 p +=
"/LteEnbRrc/UeMap/" + oss.str ();
1000 imsi = FindImsiFromEnbRlcPath (p);
1001 NS_LOG_LOGIC (
"FindImsiForEnb[Tx]: " << path <<
", " << rnti <<
", " << imsi);
1003 else if (path.find (
"/UlPhyReception"))
1005 std::string p = path.substr (0, path.find (
"/LteUePhy"));
1006 imsi = FindImsiFromLteNetDevice (p);
1007 NS_LOG_LOGIC (
"FindImsiForEnb[Rx]: " << path <<
", " << rnti <<
", " << imsi);
1014 FindImsiForUe (std::string path, uint16_t rnti)
1018 if (path.find (
"/UlPhyTransmission"))
1020 std::string p = path.substr (0, path.find (
"/LteUePhy"));
1021 imsi = FindImsiFromLteNetDevice (p);
1022 NS_LOG_LOGIC (
"FindImsiForUe[Tx]: " << path <<
", " << rnti <<
", " << imsi);
1024 else if (path.find (
"/DlPhyReception"))
1027 std::ostringstream oss;
1028 std::string p = path.substr (0, path.find (
"/LteEnbPhy"));
1030 p +=
"/LteEnbRrc/UeMap/" + oss.str ();
1031 imsi = FindImsiFromEnbRlcPath (p);
1032 NS_LOG_LOGIC (
"FindImsiForUe[Rx]: " << path <<
", " << rnti <<
", " << imsi);
1038 DlPhyTransmissionCallback (Ptr<PhyTxStatsCalculator> phyTxStats,
1039 std::string path, PhyTransmissionStatParameters params)
1043 std::ostringstream pathAndRnti;
1044 pathAndRnti << path <<
"/" << params.m_rnti;
1045 if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
1047 imsi = phyTxStats->GetImsiPath (pathAndRnti.str ());
1051 imsi = FindImsiForEnb (path, params.m_rnti);
1052 phyTxStats->SetImsiPath (pathAndRnti.str (), imsi);
1055 params.m_imsi = imsi;
1056 phyTxStats->DlPhyTransmission (params);
1060 UlPhyTransmissionCallback (Ptr<PhyTxStatsCalculator> phyTxStats,
1061 std::string path, PhyTransmissionStatParameters params)
1065 std::ostringstream pathAndRnti;
1066 pathAndRnti << path <<
"/" << params.m_rnti;
1067 if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
1069 imsi = phyTxStats->GetImsiPath (pathAndRnti.str ());
1073 imsi = FindImsiForUe (path, params.m_rnti);
1074 phyTxStats->SetImsiPath (pathAndRnti.str (), imsi);
1077 params.m_imsi = imsi;
1078 phyTxStats->UlPhyTransmission (params);
1083 DlPhyReceptionCallback (Ptr<PhyRxStatsCalculator> phyRxStats,
1084 std::string path, PhyReceptionStatParameters params)
1088 std::ostringstream pathAndRnti;
1089 pathAndRnti << path <<
"/" << params.m_rnti;
1090 if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
1092 imsi = phyRxStats->GetImsiPath (pathAndRnti.str ());
1096 imsi = FindImsiForUe (path, params.m_rnti);
1097 phyRxStats->SetImsiPath (pathAndRnti.str (), imsi);
1100 params.m_imsi = imsi;
1101 phyRxStats->DlPhyReception (params);
1105 UlPhyReceptionCallback (Ptr<PhyRxStatsCalculator> phyRxStats,
1106 std::string path, PhyReceptionStatParameters params)
1110 std::ostringstream pathAndRnti;
1111 pathAndRnti << path <<
"/" << params.m_rnti;
1112 if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) ==
true)
1114 imsi = phyRxStats->GetImsiPath (pathAndRnti.str ());
1118 imsi = FindImsiForEnb (path, params.m_rnti);
1119 phyRxStats->SetImsiPath (pathAndRnti.str (), imsi);
1122 params.m_imsi = imsi;
1123 phyRxStats->UlPhyReception (params);
1140 Config::Connect (
"/NodeList/*/DeviceList/*/LteEnbPhy/DlPhyTransmission",
1141 MakeBoundCallback (&DlPhyTransmissionCallback, m_phyTxStats));
1147 Config::Connect (
"/NodeList/*/DeviceList/*/LteUePhy/UlPhyTransmission",
1148 MakeBoundCallback (&UlPhyTransmissionCallback, m_phyTxStats));
1154 Config::Connect (
"/NodeList/*/DeviceList/*/LteUePhy/DlSpectrumPhy/DlPhyReception",
1155 MakeBoundCallback (&DlPhyReceptionCallback, m_phyRxStats));
1161 Config::Connect (
"/NodeList/*/DeviceList/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception",
1162 MakeBoundCallback (&UlPhyReceptionCallback, m_phyRxStats));
1169 std::string path, uint32_t frameNo, uint32_t subframeNo,
1170 uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1,
1171 uint8_t mcsTb2, uint16_t sizeTb2)
1175 std::ostringstream pathAndRnti;
1176 pathAndRnti << path <<
"/" << rnti;
1179 imsi = macStats->
GetImsiPath (pathAndRnti.str ());
1183 imsi = FindImsiFromEnbMac (path, rnti);
1187 uint16_t cellId = 0;
1194 cellId = FindCellIdFromEnbMac (path, rnti);
1198 macStats->
DlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
1216 MakeBoundCallback (&DlSchedulingCallback, m_macStats));
1221 uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
1222 uint8_t mcs, uint16_t size)
1227 std::ostringstream pathAndRnti;
1228 pathAndRnti << path <<
"/" << rnti;
1231 imsi = macStats->
GetImsiPath (pathAndRnti.str ());
1235 imsi = FindImsiFromEnbMac (path, rnti);
1238 uint16_t cellId = 0;
1245 cellId = FindCellIdFromEnbMac (path, rnti);
1249 macStats->
UlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcs, size);
1257 MakeBoundCallback (&UlSchedulingCallback, m_macStats));
1262 std::string path, uint16_t cellId, uint16_t rnti,
1263 double rsrp,
double sinr)
1267 std::string pathUePhy = path.substr (0, path.find (
"/ReportCurrentCellRsrpSinr"));
1274 imsi = FindImsiFromUePhy (pathUePhy);
1285 Config::Connect (
"/NodeList/*/DeviceList/*/LteUePhy/ReportCurrentCellRsrpSinr",
1286 MakeBoundCallback (&ReportCurrentCellRsrpSinrCallback, m_phyStats));
1291 uint16_t cellId, uint16_t rnti,
double sinrLinear)
1296 std::ostringstream pathAndRnti;
1297 pathAndRnti << path <<
"/" << rnti;
1298 std::string pathEnbMac = path.substr (0, path.find (
"LteEnbPhy/ReportUeSinr"));
1299 pathEnbMac +=
"LteEnbMac/DlScheduling";
1302 imsi = phyStats->
GetImsiPath (pathAndRnti.str ());
1306 imsi = FindImsiFromEnbMac (pathEnbMac, rnti);
1310 phyStats->
ReportUeSinr (cellId, imsi, rnti, sinrLinear);
1314 ReportInterference (Ptr<PhyStatsCalculator> phyStats, std::string path,
1315 uint16_t cellId, Ptr<SpectrumValue> interference)
1318 phyStats->ReportInterference (cellId, interference);
1326 MakeBoundCallback (&ReportUeSinr, m_phyStats));
1327 Config::Connect (
"/NodeList/*/DeviceList/*/LteEnbPhy/ReportInterference",
1328 MakeBoundCallback (&ReportInterference, m_phyStats));
1341 NS_ASSERT_MSG (m_pdcpStats == 0,
"please make sure that LteHelper::EnablePdcpTraces is called at most once");
1342 m_pdcpStats = CreateObject<RadioBearerStatsCalculator> (
"PDCP");
1343 m_radioBearerStatsConnector.EnablePdcpStats (m_pdcpStats);
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
TypeId GetTypeId(void) const
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)=0
void EnableDlRxPhyTraces(void)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
NetDeviceContainer InstallEnbDevice(NodeContainer c)
void EnableLogComponents(void)
void HandoverRequest(Time hoTime, Ptr< NetDevice > ueDev, Ptr< NetDevice > sourceEnbDev, Ptr< NetDevice > targetEnbDev)
Hold a value for an Attribute.
void EnableDlPhyTraces(void)
void SetCellIdPath(std::string path, uint16_t cellId)
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > >)
PhySpectrum received a new list of LteControlMessage.
void SetUeAntennaModelAttribute(std::string n, const AttributeValue &v)
void SetFadingModel(std::string model)
static Ptr< EpcTft > Default()
void ReportUeSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double sinrLinear)
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
void EnableRlcTraces(void)
void SetTypeId(TypeId tid)
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
virtual void DoDispose(void)
void SetUeAntennaModelType(std::string type)
#define NS_LOG_FUNCTION_NOARGS()
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
void Connect(std::string path, const CallbackBase &cb)
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
void EnableUlRxPhyTraces(void)
#define NS_FATAL_ERROR(msg)
fatal error handling
void SetSchedulerType(std::string type)
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
void EnablePdcpTraces(void)
void AttachToClosestEnb(NetDeviceContainer ueDevices, NetDeviceContainer enbDevices)
Keep track of the current position and velocity of an object.
static double GetCarrierFrequency(uint16_t earfcn)
Config::MatchContainer LookupMatches(std::string path)
Ptr< Application > GetApplication(uint32_t index) const
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Ptr< Object > Create(void) const
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
virtual void ReceiveLteUlHarqFeedback(UlInfoListElement_s mes)
PhySpectrum generated a new UL HARQ feedback.
void SetSchedulerAttribute(std::string n, const AttributeValue &v)
void Attach(NetDeviceContainer ueDevices, Ptr< NetDevice > enbDevice)
holds a vector of ns3::NetDevice pointers
virtual void AddSpectrumPropagationLossModel(Ptr< SpectrumPropagationLossModel > loss)=0
void EnablePhyTraces(void)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
#define NS_LOG_LOGIC(msg)
void SetEnbAntennaModelType(std::string type)
uint32_t GetN(void) const
void SetSpectrumChannelType(std::string type)
void SetFadingModelAttribute(std::string n, const AttributeValue &v)
void EnableDlMacTraces(void)
virtual void ReceiveLteDlHarqFeedback(DlInfoListElement_s mes)
PhySpectrum generated a new DL HARQ feedback.
void ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
keep track of a set of node pointers.
void EnableUlTxPhyTraces(void)
void DlScheduling(uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
bool ExistsCellIdPath(std::string path)
void AddX2Interface(NodeContainer enbNodes)
Ptr< Object > Get(uint32_t i) const
std::string GetName(void) const
void Set(std::string name, const AttributeValue &value)
void EnableUlPhyTraces(void)
hold a set of objects which match a specific search string.
void EnableDlTxPhyTraces(void)
void Receive(Ptr< Packet > p)
void EnableUlMacTraces(void)
uint16_t GetCellIdPath(std::string path)
uint64_t GetImsiPath(std::string path)
#define NS_ASSERT_MSG(condition, message)
Ptr< RadioBearerStatsCalculator > GetRlcStats(void)
NetDeviceContainer InstallUeDevice(NodeContainer c)
Ptr< RadioBearerStatsCalculator > GetPdcpStats(void)
virtual void DoDispose(void)
instantiate subclasses of ns3::Object.
Modelize the propagation loss through a transmission medium.
void SetEpcHelper(Ptr< EpcHelper > h)
uint32_t AddDevice(Ptr< NetDevice > device)
void SetPathlossModelType(std::string type)
void SetEnbAntennaModelAttribute(std::string n, const AttributeValue &v)
void SetSpectrumChannelAttribute(std::string n, const AttributeValue &v)
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
virtual void DoInitialize(void)
spectrum-aware propagation loss model
void SetImsiPath(std::string path, uint64_t imsi)
void EnableMacTraces(void)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if cond is true.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
A template-based reference counting class.
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
bool ExistsImsiPath(std::string path)
virtual void DoInitialize(void)
void UlScheduling(uint16_t cellId, uint64_t imsi, uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, uint8_t mcs, uint16_t sizeTb)
void LogComponentEnable(char const *name, enum LogLevel level)
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
void ReportCurrentCellRsrpSinr(uint16_t cellId, uint64_t imsi, uint16_t rnti, double rsrp, double sinr)