1.1 --- a/src/lte/helper/cc-helper.cc Wed Jul 19 15:19:46 2017 +0300
1.2 +++ b/src/lte/helper/cc-helper.cc Thu Jul 20 13:06:57 2017 +0300
1.3 @@ -27,6 +27,7 @@
1.4 #include <ns3/pointer.h>
1.5 #include <iostream>
1.6 #include <ns3/uinteger.h>
1.7 +#include <ns3/lte-spectrum-value-helper.h>
1.8
1.9 #define MIN_CC 1
1.10 #define MAX_CC 2
1.11 @@ -61,12 +62,12 @@
1.12 UintegerValue (1),
1.13 MakeUintegerAccessor (&CcHelper::m_numberOfComponentCarriers),
1.14 MakeUintegerChecker<uint16_t> (MIN_CC, MAX_CC))
1.15 - .AddAttribute ("UlFreq",
1.16 + .AddAttribute ("UlEarfcn",
1.17 "Set Ul Channel [EARFCN] for the first carrier component",
1.18 UintegerValue (0),
1.19 MakeUintegerAccessor (&CcHelper::m_ulEarfcn),
1.20 MakeUintegerChecker<uint32_t> ())
1.21 - .AddAttribute ("DlFreq",
1.22 + .AddAttribute ("DlEarfcn",
1.23 "Set Dl Channel [EARFCN] for the first carrier component",
1.24 UintegerValue (0),
1.25 MakeUintegerAccessor (&CcHelper::m_dlEarfcn),
1.26 @@ -172,19 +173,46 @@
1.27 {
1.28 std::map< uint8_t, ComponentCarrier > ccmap;
1.29
1.30 + uint32_t ulEarfcn = m_ulEarfcn;
1.31 + uint32_t dlEarfcn = m_dlEarfcn;
1.32 + uint32_t maxBandwidthRb = std::max<uint32_t> (m_ulBandwidth, m_dlBandwidth);
1.33 +
1.34 + // Convert bandwidth from RBs to kHz
1.35 + uint32_t maxBandwidthKhz = LteSpectrumValueHelper::GetChannelBandwidth(maxBandwidthRb) / 1e3;
1.36 +
1.37 for (uint8_t i = 0; i < m_numberOfComponentCarriers; i++)
1.38 {
1.39 + // Make sure we stay within the same band.
1.40 + if (LteSpectrumValueHelper::GetUplinkCarrierBand (ulEarfcn) !=
1.41 + LteSpectrumValueHelper::GetUplinkCarrierBand (m_ulEarfcn)
1.42 + || LteSpectrumValueHelper::GetDownlinkCarrierBand (dlEarfcn) !=
1.43 + LteSpectrumValueHelper::GetDownlinkCarrierBand (m_dlEarfcn))
1.44 + {
1.45 + NS_FATAL_ERROR ("Band is not wide enough to allocate " << +m_numberOfComponentCarriers << " CCs");
1.46 + }
1.47 +
1.48 bool pc =false;
1.49 - uint32_t ul = m_ulEarfcn + i * m_ulBandwidth;
1.50 - uint32_t dl = m_dlEarfcn + i * m_dlBandwidth;
1.51 +
1.52 if (i == 0)
1.53 {
1.54 pc = true;
1.55 }
1.56 - ComponentCarrier cc = CreateSingleCc (m_ulBandwidth, m_dlBandwidth, ul, dl, pc);
1.57 + ComponentCarrier cc = CreateSingleCc (m_ulBandwidth, m_dlBandwidth, ulEarfcn, dlEarfcn, pc);
1.58 ccmap.insert (std::pair<uint8_t, ComponentCarrier >(i, cc));
1.59
1.60 - NS_LOG_INFO(" ulBandwidth:"<<m_ulBandwidth<<" , dlBandwidth: "<<m_dlBandwidth<<" , ul:"<<ul<<" , dl:"<<dl);
1.61 + NS_LOG_INFO("ulBandwidth: " << m_ulBandwidth <<
1.62 + ", dlBandwidth: " << m_dlBandwidth <<
1.63 + ", ulEarfcn: " << ulEarfcn <<
1.64 + ", dlEarfcn: " << dlEarfcn);
1.65 +
1.66 + // The spacing between the centre frequencies of two contiguous CCs should be multiple of 300 kHz.
1.67 + // Round spacing up to 300 kHz.
1.68 + uint32_t frequencyShift = 300 * (1 + (maxBandwidthKhz - 1) / 300);
1.69 +
1.70 + // Unit of EARFCN corresponds to 100kHz.
1.71 + uint32_t earfcnShift = frequencyShift / 100;
1.72 + ulEarfcn += earfcnShift;
1.73 + dlEarfcn += earfcnShift;
1.74 }
1.75
1.76 return ccmap;
2.1 --- a/src/lte/helper/lte-helper.cc Wed Jul 19 15:19:46 2017 +0300
2.2 +++ b/src/lte/helper/lte-helper.cc Thu Jul 20 13:06:57 2017 +0300
2.3 @@ -78,7 +78,7 @@
2.4 LteHelper::LteHelper (void)
2.5 : m_fadingStreamsAssigned (false),
2.6 m_imsiCounter (0),
2.7 - m_cellIdCounter (0)
2.8 + m_cellIdCounter {1}
2.9 {
2.10 NS_LOG_FUNCTION (this);
2.11 m_enbNetDeviceFactory.SetTypeId (LteEnbNetDevice::GetTypeId ());
2.12 @@ -141,9 +141,9 @@
2.13 "The type of pathloss model to be used. "
2.14 "The allowed values for this attributes are the type names "
2.15 "of any class inheriting from ns3::PropagationLossModel.",
2.16 - StringValue ("ns3::FriisPropagationLossModel"),
2.17 - MakeStringAccessor (&LteHelper::SetPathlossModelType),
2.18 - MakeStringChecker ())
2.19 + TypeIdValue (FriisPropagationLossModel::GetTypeId ()),
2.20 + MakeTypeIdAccessor (&LteHelper::SetPathlossModelType),
2.21 + MakeTypeIdChecker ())
2.22 .AddAttribute ("FadingModel",
2.23 "The type of fading model to be used."
2.24 "The allowed values for this attributes are the type names "
2.25 @@ -196,7 +196,7 @@
2.26 "If it is more than one and m_useCa is false, it will raise an error ",
2.27 UintegerValue (1),
2.28 MakeUintegerAccessor (&LteHelper::m_noOfCcs),
2.29 - MakeUintegerChecker<uint16_t> (1, 3))
2.30 + MakeUintegerChecker<uint16_t> (MIN_NO_CC, MAX_NO_CC))
2.31 ;
2.32 return tid;
2.33 }
2.34 @@ -205,8 +205,8 @@
2.35 LteHelper::DoDispose ()
2.36 {
2.37 NS_LOG_FUNCTION (this);
2.38 - m_downlinkChannel.clear ();
2.39 - m_uplinkChannel.clear ();
2.40 + m_downlinkChannel = 0;
2.41 + m_uplinkChannel = 0;
2.42 m_componentCarrierPhyParams.clear();
2.43 Object::DoDispose ();
2.44 }
2.45 @@ -214,19 +214,13 @@
2.46 Ptr<SpectrumChannel>
2.47 LteHelper::GetUplinkSpectrumChannel (void) const
2.48 {
2.49 - return m_uplinkChannel.at(0);
2.50 + return m_uplinkChannel;
2.51 }
2.52
2.53 Ptr<SpectrumChannel>
2.54 LteHelper::GetDownlinkSpectrumChannel (void) const
2.55 {
2.56 - return m_downlinkChannel.at(0);
2.57 -}
2.58 -
2.59 -Ptr<SpectrumChannel>
2.60 -LteHelper::GetDownlinkSpectrumChannel (uint8_t carrierId) const
2.61 -{
2.62 - return m_downlinkChannel.at(carrierId);
2.63 + return m_downlinkChannel;
2.64 }
2.65
2.66 void
2.67 @@ -236,51 +230,44 @@
2.68 // PathLossModel Objects are vectors --> in InstallSingleEnb we will set the frequency
2.69 NS_LOG_FUNCTION (this << m_noOfCcs);
2.70
2.71 - for (uint16_t i = 0; i < m_noOfCcs; i++)
2.72 + m_downlinkChannel = m_channelFactory.Create<SpectrumChannel> ();
2.73 + m_uplinkChannel = m_channelFactory.Create<SpectrumChannel> ();
2.74 +
2.75 + m_downlinkPathlossModel = m_pathlossModelFactory.Create ();
2.76 + Ptr<SpectrumPropagationLossModel> dlSplm = m_downlinkPathlossModel->GetObject<SpectrumPropagationLossModel> ();
2.77 + if (dlSplm != 0)
2.78 {
2.79 - Ptr<SpectrumChannel> downlinkChannelElem = m_channelFactory.Create<SpectrumChannel> ();
2.80 - Ptr<SpectrumChannel> uplinkChannelElem = m_channelFactory.Create<SpectrumChannel> ();
2.81 + NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in DL");
2.82 + m_downlinkChannel->AddSpectrumPropagationLossModel (dlSplm);
2.83 + }
2.84 + else
2.85 + {
2.86 + NS_LOG_LOGIC (this << " using a PropagationLossModel in DL");
2.87 + Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModel->GetObject<PropagationLossModel> ();
2.88 + NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
2.89 + m_downlinkChannel->AddPropagationLossModel (dlPlm);
2.90 + }
2.91
2.92 - Ptr<Object> m_downlinkPathlossModelElem = m_dlPathlossModelFactory.Create ();
2.93 - Ptr<SpectrumPropagationLossModel> dlSplm = m_downlinkPathlossModelElem->GetObject<SpectrumPropagationLossModel> ();
2.94 - if (dlSplm != 0)
2.95 - {
2.96 - NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in DL");
2.97 - downlinkChannelElem->AddSpectrumPropagationLossModel (dlSplm);
2.98 - }
2.99 - else
2.100 - {
2.101 - NS_LOG_LOGIC (this << " using a PropagationLossModel in DL");
2.102 - Ptr<PropagationLossModel> dlPlm = m_downlinkPathlossModelElem->GetObject<PropagationLossModel> ();
2.103 - NS_ASSERT_MSG (dlPlm != 0, " " << m_downlinkPathlossModelElem << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
2.104 - downlinkChannelElem->AddPropagationLossModel (dlPlm);
2.105 - }
2.106 -
2.107 - Ptr<Object> m_uplinkPathlossModelElem = m_ulPathlossModelFactory.Create ();
2.108 - Ptr<SpectrumPropagationLossModel> ulSplm = m_uplinkPathlossModelElem->GetObject<SpectrumPropagationLossModel> ();
2.109 - if (ulSplm != 0)
2.110 - {
2.111 - NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in UL");
2.112 - uplinkChannelElem->AddSpectrumPropagationLossModel (ulSplm);
2.113 - }
2.114 - else
2.115 - {
2.116 - NS_LOG_LOGIC (this << " using a PropagationLossModel in UL");
2.117 - Ptr<PropagationLossModel> ulPlm = m_uplinkPathlossModelElem->GetObject<PropagationLossModel> ();
2.118 - NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModelElem << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
2.119 - uplinkChannelElem->AddPropagationLossModel (ulPlm);
2.120 - }
2.121 - if (!m_fadingModelType.empty ())
2.122 - {
2.123 - m_fadingModule = m_fadingModelFactory.Create<SpectrumPropagationLossModel> ();
2.124 - m_fadingModule->Initialize ();
2.125 - downlinkChannelElem->AddSpectrumPropagationLossModel (m_fadingModule);
2.126 - uplinkChannelElem->AddSpectrumPropagationLossModel (m_fadingModule);
2.127 - }
2.128 - m_downlinkChannel.push_back (downlinkChannelElem);
2.129 - m_uplinkChannel.push_back (uplinkChannelElem);
2.130 - m_uplinkPathlossModel.push_back (m_uplinkPathlossModelElem);
2.131 - m_downlinkPathlossModel.push_back (m_downlinkPathlossModelElem);
2.132 + m_uplinkPathlossModel = m_pathlossModelFactory.Create ();
2.133 + Ptr<SpectrumPropagationLossModel> ulSplm = m_uplinkPathlossModel->GetObject<SpectrumPropagationLossModel> ();
2.134 + if (ulSplm != 0)
2.135 + {
2.136 + NS_LOG_LOGIC (this << " using a SpectrumPropagationLossModel in UL");
2.137 + m_uplinkChannel->AddSpectrumPropagationLossModel (ulSplm);
2.138 + }
2.139 + else
2.140 + {
2.141 + NS_LOG_LOGIC (this << " using a PropagationLossModel in UL");
2.142 + Ptr<PropagationLossModel> ulPlm = m_uplinkPathlossModel->GetObject<PropagationLossModel> ();
2.143 + NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
2.144 + m_uplinkChannel->AddPropagationLossModel (ulPlm);
2.145 + }
2.146 + if (!m_fadingModelType.empty ())
2.147 + {
2.148 + m_fadingModule = m_fadingModelFactory.Create<SpectrumPropagationLossModel> ();
2.149 + m_fadingModule->Initialize ();
2.150 + m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
2.151 + m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
2.152 }
2.153 }
2.154
2.155 @@ -398,21 +385,18 @@
2.156 }
2.157
2.158 void
2.159 -LteHelper::SetPathlossModelType (std::string type)
2.160 +LteHelper::SetPathlossModelType (TypeId type)
2.161 {
2.162 NS_LOG_FUNCTION (this << type);
2.163 - m_dlPathlossModelFactory = ObjectFactory ();
2.164 - m_dlPathlossModelFactory.SetTypeId (type);
2.165 - m_ulPathlossModelFactory = ObjectFactory ();
2.166 - m_ulPathlossModelFactory.SetTypeId (type);
2.167 + m_pathlossModelFactory = ObjectFactory ();
2.168 + m_pathlossModelFactory.SetTypeId (type);
2.169 }
2.170
2.171 void
2.172 LteHelper::SetPathlossModelAttribute (std::string n, const AttributeValue &v)
2.173 {
2.174 NS_LOG_FUNCTION (this << n);
2.175 - m_dlPathlossModelFactory.Set (n, v);
2.176 - m_ulPathlossModelFactory.Set (n, v);
2.177 + m_pathlossModelFactory.Set (n, v);
2.178 }
2.179
2.180 void
2.181 @@ -529,9 +513,7 @@
2.182 Ptr<NetDevice>
2.183 LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
2.184 {
2.185 -
2.186 - NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num eNBs exceeded");
2.187 - uint16_t cellId = ++m_cellIdCounter;
2.188 + uint16_t cellId = m_cellIdCounter; // \todo Remove, eNB has no cell ID
2.189
2.190 Ptr<LteEnbNetDevice> dev = m_enbNetDeviceFactory.Create<LteEnbNetDevice> ();
2.191 Ptr<LteHandoverAlgorithm> handoverAlgorithm = m_handoverAlgorithmFactory.Create<LteHandoverAlgorithm> ();
2.192 @@ -552,9 +534,12 @@
2.193 cc->SetDlEarfcn(it->second.GetDlEarfcn());
2.194 cc->SetUlEarfcn(it->second.GetUlEarfcn());
2.195 cc->SetAsPrimary(it->second.IsPrimary());
2.196 + NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num cells exceeded");
2.197 + cc->SetCellId (m_cellIdCounter++);
2.198 ccMap [it->first] = cc;
2.199 }
2.200 NS_ABORT_MSG_IF (m_useCa && ccMap.size()<2, "You have to either specify carriers or disable carrier aggregation");
2.201 + NS_ASSERT (ccMap.size () == m_noOfCcs);
2.202
2.203 for (std::map<uint8_t,Ptr<ComponentCarrierEnb> >::iterator it = ccMap.begin (); it != ccMap.end (); ++it)
2.204 {
2.205 @@ -581,8 +566,8 @@
2.206 pInterf->AddCallback (MakeCallback (&LteEnbPhy::ReportInterference, phy));
2.207 ulPhy->AddInterferenceDataChunkProcessor (pInterf); // for interference power tracing
2.208
2.209 - dlPhy->SetChannel (m_downlinkChannel.at (it->first));
2.210 - ulPhy->SetChannel (m_uplinkChannel.at (it->first));
2.211 + dlPhy->SetChannel (m_downlinkChannel);
2.212 + ulPhy->SetChannel (m_uplinkChannel);
2.213
2.214 Ptr<MobilityModel> mm = n->GetObject<MobilityModel> ();
2.215 NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallEnbDevice ()");
2.216 @@ -607,7 +592,7 @@
2.217
2.218 Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
2.219 Ptr<LteEnbComponentCarrierManager> ccmEnbManager = m_enbComponentCarrierManagerFactory.Create<LteEnbComponentCarrierManager> ();
2.220 - rrc->ConfigureCarriers(m_componentCarrierPhyParams, m_noOfCcs);
2.221 + rrc->ConfigureCarriers (ccMap);
2.222
2.223 //ComponentCarrierManager SAP
2.224 rrc->SetLteCcmRrcSapProvider (ccmEnbManager->GetLteCcmRrcSapProvider ());
2.225 @@ -730,7 +715,7 @@
2.226 NS_LOG_LOGIC ("set the propagation model frequencies");
2.227 double dlFreq = LteSpectrumValueHelper::GetCarrierFrequency (it->second->m_dlEarfcn);
2.228 NS_LOG_LOGIC ("DL freq: " << dlFreq);
2.229 - bool dlFreqOk = m_downlinkPathlossModel.at (it->first)->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq));
2.230 + bool dlFreqOk = m_downlinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (dlFreq));
2.231 if (!dlFreqOk)
2.232 {
2.233 NS_LOG_WARN ("DL propagation model does not have a Frequency attribute");
2.234 @@ -739,7 +724,7 @@
2.235 double ulFreq = LteSpectrumValueHelper::GetCarrierFrequency (it->second->m_ulEarfcn);
2.236
2.237 NS_LOG_LOGIC ("UL freq: " << ulFreq);
2.238 - bool ulFreqOk = m_uplinkPathlossModel.at(it->first)->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq));
2.239 + bool ulFreqOk = m_uplinkPathlossModel->SetAttributeFailSafe ("Frequency", DoubleValue (ulFreq));
2.240 if (!ulFreqOk)
2.241 {
2.242 NS_LOG_WARN ("UL propagation model does not have a Frequency attribute");
2.243 @@ -751,7 +736,7 @@
2.244
2.245 for (it = ccMap.begin (); it != ccMap.end (); ++it)
2.246 {
2.247 - m_uplinkChannel.at (it->first)->AddRx (it->second->GetPhy ()->GetUlSpectrumPhy ());
2.248 + m_uplinkChannel->AddRx (it->second->GetPhy ()->GetUlSpectrumPhy ());
2.249 }
2.250
2.251 if (m_epcHelper != 0)
2.252 @@ -840,8 +825,8 @@
2.253 pCtrl->AddCallback (MakeCallback (&LteUePhy::GenerateCtrlCqiReport, phy));
2.254 }
2.255
2.256 - dlPhy->SetChannel (m_downlinkChannel.at (it->first));
2.257 - ulPhy->SetChannel (m_uplinkChannel.at (it->first));
2.258 + dlPhy->SetChannel (m_downlinkChannel);
2.259 + ulPhy->SetChannel (m_uplinkChannel);
2.260
2.261 Ptr<MobilityModel> mm = n->GetObject<MobilityModel> ();
2.262 NS_ASSERT_MSG (mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
2.263 @@ -1244,15 +1229,23 @@
2.264 {
2.265 NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
2.266 NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
2.267 - Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetEnbDev);
2.268 + uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice> ()->GetCellId ();
2.269 + Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetCellId);
2.270 }
2.271
2.272 void
2.273 -LteHelper::DoHandoverRequest (Ptr<NetDevice> ueDev, Ptr<NetDevice> sourceEnbDev, Ptr<NetDevice> targetEnbDev)
2.274 +LteHelper::HandoverRequest (Time hoTime, Ptr<NetDevice> ueDev, Ptr<NetDevice> sourceEnbDev, uint16_t targetCellId)
2.275 {
2.276 - NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetEnbDev);
2.277 + NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetCellId);
2.278 + NS_ASSERT_MSG (m_epcHelper, "Handover requires the use of the EPC - did you forget to call LteHelper::SetEpcHelper () ?");
2.279 + Simulator::Schedule (hoTime, &LteHelper::DoHandoverRequest, this, ueDev, sourceEnbDev, targetCellId);
2.280 +}
2.281
2.282 - uint16_t targetCellId = targetEnbDev->GetObject<LteEnbNetDevice> ()->GetCellId ();
2.283 +void
2.284 +LteHelper::DoHandoverRequest (Ptr<NetDevice> ueDev, Ptr<NetDevice> sourceEnbDev, uint16_t targetCellId)
2.285 +{
2.286 + NS_LOG_FUNCTION (this << ueDev << sourceEnbDev << targetCellId);
2.287 +
2.288 Ptr<LteEnbRrc> sourceRrc = sourceEnbDev->GetObject<LteEnbNetDevice> ()->GetRrc ();
2.289 uint16_t rnti = ueDev->GetObject<LteUeNetDevice> ()->GetRrc ()->GetRnti ();
2.290 sourceRrc->SendHandoverRequest (rnti, targetCellId);
2.291 @@ -1329,7 +1322,7 @@
2.292 LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
2.293 LogComponentEnable ("LteChunkProcessor", LOG_LEVEL_ALL);
2.294
2.295 - std::string propModelStr = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
2.296 + std::string propModelStr = m_pathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
2.297 LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
2.298 LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
2.299 LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
3.1 --- a/src/lte/helper/lte-helper.h Wed Jul 19 15:19:46 2017 +0300
3.2 +++ b/src/lte/helper/lte-helper.h Thu Jul 20 13:06:57 2017 +0300
3.3 @@ -134,7 +134,7 @@
3.4 * inheriting from ns3::PropagationLossModel, for example:
3.5 * "ns3::FriisPropagationLossModel"
3.6 */
3.7 - void SetPathlossModelType (std::string type);
3.8 + void SetPathlossModelType (TypeId type);
3.9
3.10 /**
3.11 * Set an attribute for the path loss models to be created.
3.12 @@ -516,6 +516,21 @@
3.13 Ptr<NetDevice> sourceEnbDev, Ptr<NetDevice> targetEnbDev);
3.14
3.15
3.16 + /**
3.17 + * Manually trigger an X2-based handover.
3.18 + *
3.19 + * \param hoTime when the handover shall be initiated
3.20 + * \param ueDev the UE that hands off, must be of the type LteUeNetDevice
3.21 + * \param sourceEnbDev source eNB, must be of the type LteEnbNetDevice
3.22 + * (originally the UE is attached to this eNB)
3.23 + * \param targetCellId target CellId (the UE primary component carrier will
3.24 + * be connected to this cell after the handover)
3.25 + *
3.26 + * \warning Requires the use of EPC mode. See SetEpcHelper() method
3.27 + */
3.28 + void HandoverRequest (Time hoTime, Ptr<NetDevice> ueDev,
3.29 + Ptr<NetDevice> sourceEnbDev, uint16_t targetCellId);
3.30 +
3.31 /**
3.32 * Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
3.33 *
3.34 @@ -662,14 +677,6 @@
3.35 */
3.36 Ptr<SpectrumChannel> GetDownlinkSpectrumChannel (void) const;
3.37
3.38 - /**
3.39 - * Get downlink spectrum channel of a given carrier.
3.40 - *
3.41 - * \param carrierId the carrier ID
3.42 - * \return a pointer to the SpectrumChannel instance used for the downlink on a given carrier
3.43 - */
3.44 - Ptr<SpectrumChannel> GetDownlinkSpectrumChannel (uint8_t carrierId) const;
3.45 -
3.46
3.47 protected:
3.48 // inherited from Object
3.49 @@ -705,16 +712,15 @@
3.50 * \param ueDev the UE that hands off, must be of the type LteUeNetDevice
3.51 * \param sourceEnbDev source eNB, must be of the type LteEnbNetDevice
3.52 * (originally the UE is attached to this eNB)
3.53 - * \param targetEnbDev target eNB, must be of the type LteEnbNetDevice
3.54 - * (the UE would be connected to this eNB after the
3.55 - * handover)
3.56 + * \param targetCellId target CellId (the UE primary component carrier will
3.57 + * be connected to this cell after the handover)
3.58 *
3.59 * This method is normally scheduled by HandoverRequest() to run at a specific
3.60 * time where a manual handover is desired by the simulation user.
3.61 */
3.62 void DoHandoverRequest (Ptr<NetDevice> ueDev,
3.63 Ptr<NetDevice> sourceEnbDev,
3.64 - Ptr<NetDevice> targetEnbDev);
3.65 + uint16_t targetCellId);
3.66
3.67
3.68 /**
3.69 @@ -736,13 +742,13 @@
3.70 */
3.71
3.72 /// The downlink LTE channel used in the simulation.
3.73 - std::vector <Ptr<SpectrumChannel> > m_downlinkChannel;
3.74 + Ptr<SpectrumChannel> m_downlinkChannel;
3.75 /// The uplink LTE channel used in the simulation.
3.76 - std::vector< Ptr<SpectrumChannel> > m_uplinkChannel;
3.77 + Ptr<SpectrumChannel> m_uplinkChannel;
3.78 /// The path loss model used in the downlink channel.
3.79 - std::vector< Ptr<Object> > m_downlinkPathlossModel;
3.80 + Ptr<Object> m_downlinkPathlossModel;
3.81 /// The path loss model used in the uplink channel.
3.82 - std::vector< Ptr<Object> > m_uplinkPathlossModel;
3.83 + Ptr<Object> m_uplinkPathlossModel;
3.84
3.85 /// Factory of MAC scheduler object.
3.86 ObjectFactory m_schedulerFactory;
3.87 @@ -762,10 +768,8 @@
3.88 ObjectFactory m_ueNetDeviceFactory;
3.89 /// Factory of antenna object for UE.
3.90 ObjectFactory m_ueAntennaModelFactory;
3.91 - /// Factory of path loss model object for the downlink channel.
3.92 - ObjectFactory m_dlPathlossModelFactory;
3.93 - /// Factory of path loss model object for the uplink channel.
3.94 - ObjectFactory m_ulPathlossModelFactory;
3.95 + /// Factory of path loss model object.
3.96 + ObjectFactory m_pathlossModelFactory;
3.97 /// Factory of both the downlink and uplink LTE channels.
3.98 ObjectFactory m_channelFactory;
3.99
4.1 --- a/src/lte/model/component-carrier-enb.cc Wed Jul 19 15:19:46 2017 +0300
4.2 +++ b/src/lte/model/component-carrier-enb.cc Thu Jul 20 13:06:57 2017 +0300
4.3 @@ -116,6 +116,12 @@
4.4
4.5 }
4.6
4.7 +uint16_t
4.8 +ComponentCarrierEnb::GetCellId ()
4.9 +{
4.10 + return m_cellId;
4.11 +}
4.12 +
4.13 Ptr<LteEnbPhy>
4.14 ComponentCarrierEnb::GetPhy ()
4.15 {
4.16 @@ -123,6 +129,13 @@
4.17 return m_phy;
4.18 }
4.19
4.20 +void
4.21 +ComponentCarrierEnb::SetCellId (uint16_t cellId)
4.22 +{
4.23 + NS_LOG_FUNCTION (this << cellId);
4.24 + m_cellId = cellId;
4.25 +}
4.26 +
4.27 void
4.28 ComponentCarrierEnb::SetPhy (Ptr<LteEnbPhy> s)
4.29 {
5.1 --- a/src/lte/model/component-carrier-enb.h Wed Jul 19 15:19:46 2017 +0300
5.2 +++ b/src/lte/model/component-carrier-enb.h Thu Jul 20 13:06:57 2017 +0300
5.3 @@ -58,7 +58,13 @@
5.4
5.5 virtual ~ComponentCarrierEnb (void);
5.6 virtual void DoDispose (void);
5.7 -
5.8 +
5.9 + /**
5.10 + * Get cell identifier
5.11 + * \return cell identifer
5.12 + */
5.13 + uint16_t GetCellId ();
5.14 +
5.15 /**
5.16 * \return a pointer to the physical layer.
5.17 */
5.18 @@ -78,6 +84,13 @@
5.19 * \return a pointer to the Mac Scheduler.
5.20 */
5.21 Ptr<FfMacScheduler> GetFfMacScheduler ();
5.22 +
5.23 + /**
5.24 + * Set physical cell identifier
5.25 + * \param cellId cell identifier
5.26 + */
5.27 + void SetCellId (uint16_t cellId);
5.28 +
5.29 /**
5.30 * Set the LteEnbPhy
5.31 * \param s a pointer to the LteEnbPhy
5.32 @@ -107,6 +120,7 @@
5.33
5.34 private:
5.35
5.36 + uint16_t m_cellId; ///< Cell identifer
5.37 Ptr<LteEnbPhy> m_phy; ///< the Phy instance of this eNodeB component carrier
5.38 Ptr<LteEnbMac> m_mac; ///< the MAC instance of this eNodeB component carrier
5.39 Ptr<FfMacScheduler> m_scheduler; ///< the scheduler instance of this eNodeB component carrier
6.1 --- a/src/lte/model/lte-ccm-rrc-sap.h Wed Jul 19 15:19:46 2017 +0300
6.2 +++ b/src/lte/model/lte-ccm-rrc-sap.h Thu Jul 20 13:06:57 2017 +0300
6.3 @@ -203,6 +203,14 @@
6.4 */
6.5 virtual void ReleaseLcs (uint16_t rnti, uint8_t lcid) = 0;
6.6
6.7 + /**
6.8 + * Get UE manager by RNTI
6.9 + *
6.10 + * \param rnti RNTI
6.11 + * \return UE manager
6.12 + */
6.13 + virtual Ptr<UeManager> GetUeManager (uint16_t rnti) = 0;
6.14 +
6.15 }; // end of class LteCcmRrcSapUser
6.16
6.17 /// MemberLteCcmRrcSapProvider class
6.18 @@ -296,6 +304,7 @@
6.19 virtual void ReleaseLcs (uint16_t rnti, uint8_t lcid);
6.20 virtual uint8_t AddUeMeasReportConfigForComponentCarrier (LteRrcSap::ReportConfigEutra reportConfig);
6.21 virtual void TriggerComponentCarrier (uint16_t rnti, uint16_t targetCellId);
6.22 + virtual Ptr<UeManager> GetUeManager (uint16_t rnti);
6.23
6.24 private:
6.25 C* m_owner; ///< the owner class
6.26 @@ -337,6 +346,13 @@
6.27 NS_FATAL_ERROR ("Function should not be called because it is not implemented.");
6.28 }
6.29
6.30 +template <class C>
6.31 +Ptr<UeManager>
6.32 +MemberLteCcmRrcSapUser<C>::GetUeManager (uint16_t rnti)
6.33 +{
6.34 + return m_owner->GetUeManager (rnti);
6.35 +}
6.36 +
6.37 } // end of namespace ns3
6.38
6.39
7.1 --- a/src/lte/model/lte-enb-net-device.cc Wed Jul 19 15:19:46 2017 +0300
7.2 +++ b/src/lte/model/lte-enb-net-device.cc Thu Jul 20 13:06:57 2017 +0300
7.3 @@ -225,6 +225,19 @@
7.4 return m_cellId;
7.5 }
7.6
7.7 +bool
7.8 +LteEnbNetDevice::HasCellId (uint16_t cellId) const
7.9 +{
7.10 + for (auto &it: m_ccMap)
7.11 + {
7.12 + if (it.second->GetCellId () == cellId)
7.13 + {
7.14 + return true;
7.15 + }
7.16 + }
7.17 + return false;
7.18 +}
7.19 +
7.20 uint8_t
7.21 LteEnbNetDevice::GetUlBandwidth () const
7.22 {
7.23 @@ -342,6 +355,7 @@
7.24 void
7.25 LteEnbNetDevice::SetCcMap (std::map< uint8_t, Ptr<ComponentCarrierEnb> > ccm)
7.26 {
7.27 + NS_ASSERT_MSG (!m_isConfigured, "attempt to set CC map after configuration");
7.28 m_ccMap = ccm;
7.29 }
7.30
7.31 @@ -389,7 +403,8 @@
7.32 {
7.33 NS_LOG_LOGIC (this << " Configure cell " << m_cellId);
7.34 // we have to make sure that this function is called only once
7.35 - m_rrc->ConfigureCell (m_cellId);
7.36 + NS_ASSERT (!m_ccMap.empty ());
7.37 + m_rrc->ConfigureCell (m_ccMap);
7.38 m_isConfigured = true;
7.39 }
7.40
8.1 --- a/src/lte/model/lte-enb-net-device.h Wed Jul 19 15:19:46 2017 +0300
8.2 +++ b/src/lte/model/lte-enb-net-device.h Thu Jul 20 13:06:57 2017 +0300
8.3 @@ -107,6 +107,12 @@
8.4 */
8.5 uint16_t GetCellId () const;
8.6
8.7 + /**
8.8 + * \param cellId cell ID
8.9 + * \return true if cellId is served by this eNB
8.10 + */
8.11 + bool HasCellId (uint16_t cellId) const;
8.12 +
8.13 /**
8.14 * \return the uplink bandwidth in RBs
8.15 */
9.1 --- a/src/lte/model/lte-enb-rrc.cc Wed Jul 19 15:19:46 2017 +0300
9.2 +++ b/src/lte/model/lte-enb-rrc.cc Thu Jul 20 13:06:57 2017 +0300
9.3 @@ -65,7 +65,7 @@
9.4 *
9.5 * \param rrc ENB RRC
9.6 */
9.7 - EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc);
9.8 + EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc, uint8_t componentCarrierId);
9.9
9.10 virtual uint16_t AllocateTemporaryCellRnti ();
9.11 virtual void NotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success);
9.12 @@ -73,17 +73,19 @@
9.13
9.14 private:
9.15 LteEnbRrc* m_rrc; ///< the RRC
9.16 + uint8_t m_componentCarrierId; ///< Component carrier ID
9.17 };
9.18
9.19 -EnbRrcMemberLteEnbCmacSapUser::EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc)
9.20 +EnbRrcMemberLteEnbCmacSapUser::EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc, uint8_t componentCarrierId)
9.21 : m_rrc (rrc)
9.22 + , m_componentCarrierId {componentCarrierId}
9.23 {
9.24 }
9.25
9.26 uint16_t
9.27 EnbRrcMemberLteEnbCmacSapUser::AllocateTemporaryCellRnti ()
9.28 {
9.29 - return m_rrc->DoAllocateTemporaryCellRnti ();
9.30 + return m_rrc->DoAllocateTemporaryCellRnti (m_componentCarrierId);
9.31 }
9.32
9.33 void
9.34 @@ -139,10 +141,11 @@
9.35 }
9.36
9.37
9.38 -UeManager::UeManager (Ptr<LteEnbRrc> rrc, uint16_t rnti, State s)
9.39 +UeManager::UeManager (Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
9.40 : m_lastAllocatedDrbid (0),
9.41 m_rnti (rnti),
9.42 m_imsi (0),
9.43 + m_componentCarrierId (componentCarrierId),
9.44 m_lastRrcTransactionIdentifier (0),
9.45 m_rrc (rrc),
9.46 m_state (s),
9.47 @@ -208,7 +211,7 @@
9.48 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
9.49 LteMacSapUser* lteMacSapUser = m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser ());
9.50 // Signal Channel are only on Primary Carrier
9.51 - m_rrc->m_cmacSapProvider.at (0)->AddLc (lcinfo, lteMacSapUser);
9.52 + m_rrc->m_cmacSapProvider.at (m_componentCarrierId)->AddLc (lcinfo, lteMacSapUser);
9.53 m_rrc->m_ccmRrcSapProvider->AddLc (lcinfo, lteMacSapUser);
9.54 }
9.55
9.56 @@ -250,7 +253,7 @@
9.57 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
9.58 LteMacSapUser* MacSapUserForRlc = m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser ());
9.59 // Signal Channel are only on Primary Carrier
9.60 - m_rrc->m_cmacSapProvider.at (0)->AddLc (lcinfo, MacSapUserForRlc);
9.61 + m_rrc->m_cmacSapProvider.at (m_componentCarrierId)->AddLc (lcinfo, MacSapUserForRlc);
9.62 m_rrc->m_ccmRrcSapProvider->AddLc (lcinfo, MacSapUserForRlc);
9.63 }
9.64
9.65 @@ -586,7 +589,7 @@
9.66 EpcX2SapProvider::HandoverRequestParams params;
9.67 params.oldEnbUeX2apId = m_rnti;
9.68 params.cause = EpcX2SapProvider::HandoverDesirableForRadioReason;
9.69 - params.sourceCellId = m_rrc->m_cellId;
9.70 + params.sourceCellId = m_rrc->ComponentCarrierToCellId (m_componentCarrierId);
9.71 params.targetCellId = cellId;
9.72 params.mmeUeS1apId = m_imsi;
9.73 params.ueAggregateMaxBitRateDownlink = 200 * 1000;
9.74 @@ -600,11 +603,11 @@
9.75 hpi.asConfig.sourceRadioResourceConfig = GetRadioResourceConfigForHandoverPreparationInfo ();
9.76 hpi.asConfig.sourceMasterInformationBlock.dlBandwidth = m_rrc->m_dlBandwidth;
9.77 hpi.asConfig.sourceMasterInformationBlock.systemFrameNumber = 0;
9.78 - hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity = m_rrc->m_sib1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
9.79 - hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.cellIdentity = m_rrc->m_cellId;
9.80 - hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIndication = m_rrc->m_sib1.cellAccessRelatedInfo.csgIndication;
9.81 - hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity = m_rrc->m_sib1.cellAccessRelatedInfo.csgIdentity;
9.82 - LteEnbCmacSapProvider::RachConfig rc = m_rrc->m_cmacSapProvider.at (0)->GetRachConfig ();
9.83 + hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity = m_rrc->m_sib1.at (m_componentCarrierId).cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
9.84 + hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.cellIdentity = m_rrc->ComponentCarrierToCellId (m_componentCarrierId);
9.85 + hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIndication = m_rrc->m_sib1.at (m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
9.86 + hpi.asConfig.sourceSystemInformationBlockType1.cellAccessRelatedInfo.csgIdentity = m_rrc->m_sib1.at (m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
9.87 + LteEnbCmacSapProvider::RachConfig rc = m_rrc->m_cmacSapProvider.at (m_componentCarrierId)->GetRachConfig ();
9.88 hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
9.89 hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
9.90 hpi.asConfig.sourceSystemInformationBlockType2.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
9.91 @@ -652,7 +655,7 @@
9.92 &LteEnbRrc::HandoverLeavingTimeout,
9.93 m_rrc, m_rnti);
9.94 NS_ASSERT (handoverCommand.haveMobilityControlInfo);
9.95 - m_rrc->m_handoverStartTrace (m_imsi, m_rrc->m_cellId, m_rnti, handoverCommand.mobilityControlInfo.targetPhysCellId);
9.96 + m_rrc->m_handoverStartTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti, handoverCommand.mobilityControlInfo.targetPhysCellId);
9.97
9.98 EpcX2SapProvider::SnStatusTransferParams sst;
9.99 sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
9.100 @@ -735,7 +738,7 @@
9.101 NS_LOG_LOGIC ("forwarding data to target eNB over X2-U");
9.102 uint8_t drbid = Bid2Drbid (bid);
9.103 EpcX2Sap::UeDataParams params;
9.104 - params.sourceCellId = m_rrc->m_cellId;
9.105 + params.sourceCellId = m_rrc->ComponentCarrierToCellId (m_componentCarrierId);
9.106 params.targetCellId = m_targetCellId;
9.107 params.gtpTeid = GetDataRadioBearerInfo (drbid)->m_gtpTeid;
9.108 params.ueData = p;
9.109 @@ -784,7 +787,7 @@
9.110 ueCtxReleaseParams.targetCellId = m_targetCellId;
9.111 m_rrc->m_x2SapProvider->SendUeContextRelease (ueCtxReleaseParams);
9.112 SwitchToState (CONNECTED_NORMALLY);
9.113 - m_rrc->m_handoverEndOkTrace (m_imsi, m_rrc->m_cellId, m_rnti);
9.114 + m_rrc->m_handoverEndOkTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti);
9.115 break;
9.116
9.117 default:
9.118 @@ -921,7 +924,7 @@
9.119 StartDataRadioBearers ();
9.120 }
9.121 SwitchToState (CONNECTED_NORMALLY);
9.122 - m_rrc->m_connectionEstablishedTrace (m_imsi, m_rrc->m_cellId, m_rnti);
9.123 + m_rrc->m_connectionEstablishedTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti);
9.124 break;
9.125
9.126 default:
9.127 @@ -957,7 +960,7 @@
9.128 m_needPhyMacConfiguration = false;
9.129 }
9.130 SwitchToState (CONNECTED_NORMALLY);
9.131 - m_rrc->m_connectionReconfigurationTrace (m_imsi, m_rrc->m_cellId, m_rnti);
9.132 + m_rrc->m_connectionReconfigurationTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti);
9.133 break;
9.134
9.135 // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED state UE
9.136 @@ -975,7 +978,7 @@
9.137 NS_LOG_INFO ("Send PATH SWITCH REQUEST to the MME");
9.138 EpcEnbS1SapProvider::PathSwitchRequestParameters params;
9.139 params.rnti = m_rnti;
9.140 - params.cellId = m_rrc->m_cellId;
9.141 + params.cellId = m_rrc->ComponentCarrierToCellId (m_componentCarrierId);
9.142 params.mmeUeS1Id = m_imsi;
9.143 SwitchToState (HANDOVER_PATH_SWITCH);
9.144 for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
9.145 @@ -1039,7 +1042,7 @@
9.146 << " measResultListEutra " << msg.measResults.measResultListEutra.size ()
9.147 << " haveScellsMeas " << msg.measResults.haveScellsMeas
9.148 << " measScellResultList " << msg.measResults.measScellResultList.measResultScell.size ());
9.149 - NS_LOG_LOGIC ("serving cellId " << m_rrc->m_cellId
9.150 + NS_LOG_LOGIC ("serving cellId " << m_rrc->ComponentCarrierToCellId (m_componentCarrierId)
9.151 << " RSRP " << (uint16_t) msg.measResults.rsrpResult
9.152 << " RSRQ " << (uint16_t) msg.measResults.rsrqResult);
9.153
9.154 @@ -1096,7 +1099,7 @@
9.155 ///Report any measurements to ComponentCarrierManager, so it can react to any change or activate the SCC
9.156 m_rrc->m_ccmRrcSapProvider->ReportUeMeas (m_rnti, msg.measResults);
9.157 // fire a trace source
9.158 - m_rrc->m_recvMeasurementReportTrace (m_imsi, m_rrc->m_cellId, m_rnti, msg);
9.159 + m_rrc->m_recvMeasurementReportTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti, msg);
9.160
9.161 } // end of UeManager::RecvMeasurementReport
9.162
9.163 @@ -1148,6 +1151,12 @@
9.164 return m_imsi;
9.165 }
9.166
9.167 +uint8_t
9.168 +UeManager::GetComponentCarrierId () const
9.169 +{
9.170 + return m_componentCarrierId;
9.171 +}
9.172 +
9.173 uint16_t
9.174 UeManager::GetSrsConfigurationIndex (void) const
9.175 {
9.176 @@ -1349,7 +1358,7 @@
9.177 m_state = newState;
9.178 NS_LOG_INFO (this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager "
9.179 << ToString (oldState) << " --> " << ToString (newState));
9.180 - m_stateTransitionTrace (m_imsi, m_rrc->m_cellId, m_rnti, oldState, newState);
9.181 + m_stateTransitionTrace (m_imsi, m_rrc->ComponentCarrierToCellId (m_componentCarrierId), m_rnti, oldState, newState);
9.182
9.183 switch (newState)
9.184 {
9.185 @@ -1398,26 +1407,35 @@
9.186 std::list<LteRrcSap::SCellToAddMod> SccCon;
9.187
9.188 // sCellToReleaseList is always empty since no Scc is released
9.189 - std::map<uint8_t, ComponentCarrier >::iterator it = m_rrc->m_componentCarrierPhyConf.begin();
9.190 -
9.191 - it++;
9.192 - for (;it!=m_rrc->m_componentCarrierPhyConf.end(); it++)
9.193 +
9.194 + for (auto &it: m_rrc->m_componentCarrierPhyConf)
9.195 {
9.196 -
9.197 - uint8_t ccId = it->first;
9.198 - ComponentCarrier eNbCcm = it->second;
9.199 + uint8_t ccId = it.first;
9.200 +
9.201 + if (ccId == m_componentCarrierId)
9.202 + {
9.203 + // Skip primary CC.
9.204 + continue;
9.205 + }
9.206 + else if (ccId < m_componentCarrierId)
9.207 + {
9.208 + // Shift all IDs below PCC forward so PCC can use CC ID 1.
9.209 + ccId++;
9.210 + }
9.211 +
9.212 + Ptr<ComponentCarrierEnb> eNbCcm = it.second;
9.213 LteRrcSap::SCellToAddMod component;
9.214 component.sCellIndex = ccId;
9.215 - component.cellIdentification.physCellId = m_rrc->m_cellId;
9.216 - component.cellIdentification.dlCarrierFreq = eNbCcm.m_dlEarfcn;
9.217 + component.cellIdentification.physCellId = eNbCcm->GetCellId ();
9.218 + component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn ();
9.219 component.radioResourceConfigCommonSCell.haveNonUlConfiguration = true;
9.220 - component.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth = eNbCcm.m_dlBandwidth;
9.221 + component.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth = eNbCcm->GetDlBandwidth ();
9.222 component.radioResourceConfigCommonSCell.nonUlConfiguration.antennaInfoCommon.antennaPortsCount = 0;
9.223 component.radioResourceConfigCommonSCell.nonUlConfiguration.pdschConfigCommon.referenceSignalPower = m_rrc->m_cphySapProvider.at (0)->GetReferenceSignalPower ();
9.224 component.radioResourceConfigCommonSCell.nonUlConfiguration.pdschConfigCommon.pb = 0;
9.225 component.radioResourceConfigCommonSCell.haveUlConfiguration = true;
9.226 - component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq = eNbCcm.m_ulEarfcn;
9.227 - component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth = eNbCcm.m_ulBandwidth;
9.228 + component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq = eNbCcm->GetUlEarfcn ();
9.229 + component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth = eNbCcm->GetUlBandwidth ();
9.230 component.radioResourceConfigCommonSCell.ulConfiguration.ulPowerControlCommonSCell.alpha = 0;
9.231 //component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type = LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
9.232 component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.srsBandwidthConfig = 0;
9.233 @@ -1481,7 +1499,7 @@
9.234 m_carriersConfigured (false)
9.235 {
9.236 NS_LOG_FUNCTION (this);
9.237 - m_cmacSapUser.push_back (new EnbRrcMemberLteEnbCmacSapUser (this));
9.238 + m_cmacSapUser.push_back (new EnbRrcMemberLteEnbCmacSapUser (this, 0));
9.239 m_handoverManagementSapUser = new MemberLteHandoverManagementSapUser<LteEnbRrc> (this);
9.240 m_anrSapUser = new MemberLteAnrSapUser<LteEnbRrc> (this);
9.241 m_ffrRrcSapUser.push_back (new MemberLteFfrRrcSapUser<LteEnbRrc> (this));
9.242 @@ -1495,33 +1513,24 @@
9.243 m_ffrRrcSapProvider.push_back (0);
9.244 }
9.245
9.246 -void LteEnbRrc::ConfigureCarriers(std::map<uint8_t, ComponentCarrier > ccPhyConf, uint16_t numberOfComponentCarriers)
9.247 +void
9.248 +LteEnbRrc::ConfigureCarriers (std::map<uint8_t, Ptr<ComponentCarrierEnb>> ccPhyConf)
9.249 {
9.250 NS_ASSERT_MSG (!m_carriersConfigured, "Secondary carriers can be configured only once.");
9.251 m_componentCarrierPhyConf = ccPhyConf;
9.252 - m_numberOfComponentCarriers = numberOfComponentCarriers;
9.253 -
9.254 - if (m_numberOfComponentCarriers < MIN_NO_CC || m_numberOfComponentCarriers > MAX_NO_CC)
9.255 + m_numberOfComponentCarriers = ccPhyConf.size ();
9.256 +
9.257 + NS_ASSERT (m_numberOfComponentCarriers >= MIN_NO_CC && m_numberOfComponentCarriers <= MAX_NO_CC);
9.258 +
9.259 + for (uint8_t i = 1; i < m_numberOfComponentCarriers; i++)
9.260 {
9.261 - // this check is neede in order to maintain backward compatibility with scripts and tests
9.262 - // if case lte-helper is not used (like in several tests) the m_numberOfComponentCarriers
9.263 - // is not set and then an error is rised
9.264 - // In this case m_numberOfComponentCarriers is set to 1
9.265 - m_numberOfComponentCarriers = MIN_NO_CC;
9.266 + m_cphySapUser.push_back (new MemberLteEnbCphySapUser<LteEnbRrc> (this));
9.267 + m_cmacSapUser.push_back (new EnbRrcMemberLteEnbCmacSapUser (this, i));
9.268 + m_ffrRrcSapUser.push_back (new MemberLteFfrRrcSapUser<LteEnbRrc> (this));
9.269 + m_cphySapProvider.push_back (0);
9.270 + m_cmacSapProvider.push_back (0);
9.271 + m_ffrRrcSapProvider.push_back (0);
9.272 }
9.273 -
9.274 - if (m_numberOfComponentCarriers > MIN_NO_CC)
9.275 - {
9.276 - for ( uint8_t i = 1; i < m_numberOfComponentCarriers ; i++)
9.277 - {
9.278 - m_cphySapUser.push_back (new MemberLteEnbCphySapUser<LteEnbRrc> (this));
9.279 - m_cmacSapUser.push_back (new EnbRrcMemberLteEnbCmacSapUser (this));
9.280 - m_ffrRrcSapUser.push_back (new MemberLteFfrRrcSapUser<LteEnbRrc> (this));
9.281 - m_cphySapProvider.push_back (0);
9.282 - m_cmacSapProvider.push_back (0);
9.283 - m_ffrRrcSapProvider.push_back (0);
9.284 - }
9.285 - }
9.286 m_carriersConfigured = true;
9.287 Object::DoInitialize ();
9.288 }
9.289 @@ -1659,7 +1668,7 @@
9.290 "Number of Component Carriers ",
9.291 UintegerValue (1),
9.292 MakeIntegerAccessor (&LteEnbRrc::m_numberOfComponentCarriers),
9.293 - MakeIntegerChecker<int16_t> (MIN_NO_CC, 2)) // to change, currently the CC number is liited to 2
9.294 + MakeIntegerChecker<int16_t> (MIN_NO_CC, MAX_NO_CC))
9.295
9.296 // Handover related attributes
9.297 .AddAttribute ("AdmitHandoverRequest",
9.298 @@ -1909,7 +1918,7 @@
9.299 NS_LOG_FUNCTION (this << (uint32_t) rnti);
9.300 NS_ASSERT (0 != rnti);
9.301 std::map<uint16_t, Ptr<UeManager> >::iterator it = m_ueMap.find (rnti);
9.302 - NS_ASSERT_MSG (it != m_ueMap.end (), "RNTI " << rnti << " not found in eNB with cellId " << m_cellId);
9.303 + NS_ASSERT_MSG (it != m_ueMap.end (), "UE manager for RNTI " << rnti << " not found");
9.304 return it->second;
9.305 }
9.306
9.307 @@ -2002,32 +2011,32 @@
9.308 }
9.309
9.310 void
9.311 -LteEnbRrc::ConfigureCell (uint16_t cellId)
9.312 +LteEnbRrc::ConfigureCell (std::map<uint8_t, Ptr<ComponentCarrierEnb>> ccPhyConf)
9.313 {
9.314 - std::map<uint8_t, ComponentCarrier >::iterator it = m_componentCarrierPhyConf.begin ();
9.315 - uint8_t ulBandwidth = it->second.m_ulBandwidth;
9.316 - uint8_t dlBandwidth = it->second.m_dlBandwidth;
9.317 - uint32_t ulEarfcn = it->second.m_ulEarfcn;
9.318 - uint32_t dlEarfcn = it->second.m_dlEarfcn;
9.319 + auto it = ccPhyConf.begin ();
9.320 + NS_ASSERT (it != ccPhyConf.end ());
9.321 + uint8_t ulBandwidth = it->second->GetUlBandwidth ();
9.322 + uint8_t dlBandwidth = it->second->GetDlBandwidth ();
9.323 + uint32_t ulEarfcn = it->second->GetUlEarfcn ();
9.324 + uint32_t dlEarfcn = it->second->GetDlEarfcn ();
9.325 NS_LOG_FUNCTION (this << (uint16_t) ulBandwidth << (uint16_t) dlBandwidth
9.326 - << ulEarfcn << dlEarfcn << cellId);
9.327 + << ulEarfcn << dlEarfcn);
9.328 NS_ASSERT (!m_configured);
9.329
9.330 - for (it = m_componentCarrierPhyConf.begin (); it != m_componentCarrierPhyConf.end (); ++it)
9.331 + for (const auto &it: ccPhyConf)
9.332 {
9.333 - m_cphySapProvider[it->first]->SetBandwidth (it->second.m_ulBandwidth, it->second.m_dlBandwidth);
9.334 - m_cphySapProvider[it->first]->SetEarfcn (it->second.m_ulEarfcn, it->second.m_dlEarfcn);
9.335 - m_cphySapProvider[it->first]->SetCellId (cellId);
9.336 - m_cmacSapProvider[it->first]->ConfigureMac (it->second.m_ulBandwidth, it->second.m_dlBandwidth);
9.337 - m_ffrRrcSapProvider[it->first]->SetCellId (cellId);
9.338 - m_ffrRrcSapProvider[it->first]->SetBandwidth (it->second.m_ulBandwidth, it->second.m_dlBandwidth);
9.339 + m_cphySapProvider.at (it.first)->SetBandwidth (it.second->GetUlBandwidth (), it.second->GetDlBandwidth ());
9.340 + m_cphySapProvider.at (it.first)->SetEarfcn (it.second->GetUlEarfcn (), it.second->GetDlEarfcn ());
9.341 + m_cphySapProvider.at (it.first)->SetCellId (it.second->GetCellId ());
9.342 + m_cmacSapProvider.at (it.first)->ConfigureMac (it.second->GetUlBandwidth (), it.second->GetDlBandwidth ());
9.343 + m_ffrRrcSapProvider.at (it.first)->SetCellId (it.second->GetCellId ());
9.344 + m_ffrRrcSapProvider.at (it.first)->SetBandwidth (it.second->GetUlBandwidth (), it.second->GetDlBandwidth ());
9.345 }
9.346
9.347 m_dlEarfcn = dlEarfcn;
9.348 m_ulEarfcn = ulEarfcn;
9.349 m_dlBandwidth = dlBandwidth;
9.350 m_ulBandwidth = ulBandwidth;
9.351 - m_cellId = cellId;
9.352
9.353 /*
9.354 * Initializing the list of UE measurement configuration (m_ueMeasConfig).
9.355 @@ -2052,22 +2061,26 @@
9.356 m_ueMeasConfig.haveSmeasure = false;
9.357 m_ueMeasConfig.haveSpeedStatePars = false;
9.358
9.359 - // Enabling MIB transmission
9.360 - LteRrcSap::MasterInformationBlock mib;
9.361 - mib.dlBandwidth = m_dlBandwidth;
9.362 - mib.systemFrameNumber = 0;
9.363 - // Enabling SIB1 transmission with default values
9.364 - m_sib1.cellAccessRelatedInfo.cellIdentity = cellId;
9.365 - m_sib1.cellAccessRelatedInfo.csgIndication = false;
9.366 - m_sib1.cellAccessRelatedInfo.csgIdentity = 0;
9.367 - m_sib1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity = 0; // not used
9.368 - m_sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
9.369 - m_sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
9.370 -
9.371 - for (it = m_componentCarrierPhyConf.begin (); it != m_componentCarrierPhyConf.end (); ++it)
9.372 + m_sib1.clear ();
9.373 + m_sib1.reserve (ccPhyConf.size ());
9.374 + for (const auto &it: ccPhyConf)
9.375 {
9.376 - m_cphySapProvider.at (it->first)->SetMasterInformationBlock (mib);
9.377 - m_cphySapProvider.at (it->first)->SetSystemInformationBlockType1 (m_sib1);
9.378 + // Enabling MIB transmission
9.379 + LteRrcSap::MasterInformationBlock mib;
9.380 + mib.dlBandwidth = it.second->GetDlBandwidth ();
9.381 + mib.systemFrameNumber = 0;
9.382 + m_cphySapProvider.at (it.first)->SetMasterInformationBlock (mib);
9.383 +
9.384 + // Enabling SIB1 transmission with default values
9.385 + LteRrcSap::SystemInformationBlockType1 sib1;
9.386 + sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId ();
9.387 + sib1.cellAccessRelatedInfo.csgIndication = false;
9.388 + sib1.cellAccessRelatedInfo.csgIdentity = 0;
9.389 + sib1.cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity = 0; // not used
9.390 + sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
9.391 + sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
9.392 + m_sib1.push_back (sib1);
9.393 + m_cphySapProvider.at (it.first)->SetSystemInformationBlockType1 (sib1);
9.394 }
9.395 /*
9.396 * Enabling transmission of other SIB. The first time System Information is
9.397 @@ -2085,20 +2098,38 @@
9.398 void
9.399 LteEnbRrc::SetCellId (uint16_t cellId)
9.400 {
9.401 - m_cellId = cellId;
9.402 -
9.403 - // update SIB1 too
9.404 - m_sib1.cellAccessRelatedInfo.cellIdentity = cellId;
9.405 - m_cphySapProvider.at (0)->SetSystemInformationBlockType1 (m_sib1);
9.406 + // update SIB1
9.407 + m_sib1.at (0).cellAccessRelatedInfo.cellIdentity = cellId;
9.408 + m_cphySapProvider.at (0)->SetSystemInformationBlockType1 (m_sib1.at (0));
9.409 }
9.410
9.411 void
9.412 LteEnbRrc::SetCellId (uint16_t cellId, uint8_t ccIndex)
9.413 {
9.414 - m_cellId = cellId;
9.415 - // update SIB1 too
9.416 - m_sib1.cellAccessRelatedInfo.cellIdentity = cellId;
9.417 - m_cphySapProvider[ccIndex]->SetSystemInformationBlockType1 (m_sib1);
9.418 + // update SIB1
9.419 + m_sib1.at (ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
9.420 + m_cphySapProvider.at (ccIndex)->SetSystemInformationBlockType1 (m_sib1.at (ccIndex));
9.421 +}
9.422 +
9.423 +uint8_t
9.424 +LteEnbRrc::CellToComponentCarrierId (uint16_t cellId)
9.425 +{
9.426 + NS_LOG_FUNCTION (this << cellId);
9.427 + for (auto &it: m_componentCarrierPhyConf)
9.428 + {
9.429 + if (it.second->GetCellId () == cellId)
9.430 + {
9.431 + return it.first;
9.432 + }
9.433 + }
9.434 + NS_FATAL_ERROR ("Cell " << cellId << " not found in CC map");
9.435 +}
9.436 +
9.437 +uint16_t
9.438 +LteEnbRrc::ComponentCarrierToCellId (uint8_t componentCarrierId)
9.439 +{
9.440 + NS_LOG_FUNCTION (this << +componentCarrierId);
9.441 + return m_componentCarrierPhyConf.at (componentCarrierId)->GetCellId ();
9.442 }
9.443
9.444 bool
9.445 @@ -2253,8 +2284,6 @@
9.446 NS_LOG_LOGIC ("targetCellId = " << req.targetCellId);
9.447 NS_LOG_LOGIC ("mmeUeS1apId = " << req.mmeUeS1apId);
9.448
9.449 - NS_ASSERT (req.targetCellId == m_cellId);
9.450 -
9.451 if (m_admitHandoverRequest == false)
9.452 {
9.453 NS_LOG_INFO ("rejecting handover request from cellId " << req.sourceCellId);
9.454 @@ -2268,7 +2297,7 @@
9.455 return;
9.456 }
9.457
9.458 - uint16_t rnti = AddUe (UeManager::HANDOVER_JOINING);
9.459 + uint16_t rnti = AddUe (UeManager::HANDOVER_JOINING, CellToComponentCarrierId (req.targetCellId));
9.460 LteEnbCmacSapProvider::AllocateNcRaPreambleReturnValue anrcrv = m_cmacSapProvider.at (0)->AllocateNcRaPreamble (rnti);
9.461 if (anrcrv.valid == false)
9.462 {
9.463 @@ -2300,7 +2329,7 @@
9.464
9.465 LteRrcSap::RrcConnectionReconfiguration handoverCommand = ueManager->GetRrcConnectionReconfigurationForHandover ();
9.466 handoverCommand.haveMobilityControlInfo = true;
9.467 - handoverCommand.mobilityControlInfo.targetPhysCellId = m_cellId;
9.468 + handoverCommand.mobilityControlInfo.targetPhysCellId = req.targetCellId;
9.469 handoverCommand.mobilityControlInfo.haveCarrierFreq = true;
9.470 handoverCommand.mobilityControlInfo.carrierFreq.dlCarrierFreq = m_dlEarfcn;
9.471 handoverCommand.mobilityControlInfo.carrierFreq.ulCarrierFreq = m_ulEarfcn;
9.472 @@ -2448,10 +2477,10 @@
9.473
9.474
9.475 uint16_t
9.476 -LteEnbRrc::DoAllocateTemporaryCellRnti ()
9.477 +LteEnbRrc::DoAllocateTemporaryCellRnti (uint8_t componentCarrierId)
9.478 {
9.479 - NS_LOG_FUNCTION (this);
9.480 - return AddUe (UeManager::INITIAL_RANDOM_ACCESS);
9.481 + NS_LOG_FUNCTION (this << +componentCarrierId);
9.482 + return AddUe (UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
9.483 }
9.484
9.485 void
9.486 @@ -2494,12 +2523,15 @@
9.487
9.488 bool isHandoverAllowed = true;
9.489
9.490 + Ptr<UeManager> ueManager = GetUeManager (rnti);
9.491 + NS_ASSERT_MSG (ueManager != 0, "Cannot find UE context with RNTI " << rnti);
9.492 +
9.493 if (m_anrSapProvider != 0)
9.494 {
9.495 // ensure that proper neighbour relationship exists between source and target cells
9.496 bool noHo = m_anrSapProvider->GetNoHo (targetCellId);
9.497 bool noX2 = m_anrSapProvider->GetNoX2 (targetCellId);
9.498 - NS_LOG_DEBUG (this << " cellId=" << m_cellId
9.499 + NS_LOG_DEBUG (this << " cellId=" << ComponentCarrierToCellId (ueManager->GetComponentCarrierId ())
9.500 << " targetCellId=" << targetCellId
9.501 << " NRT.NoHo=" << noHo << " NRT.NoX2=" << noX2);
9.502
9.503 @@ -2511,9 +2543,6 @@
9.504 }
9.505 }
9.506
9.507 - Ptr<UeManager> ueManager = GetUeManager (rnti);
9.508 - NS_ASSERT_MSG (ueManager != 0, "Cannot find UE context with RNTI " << rnti);
9.509 -
9.510 if (ueManager->GetState () != UeManager::CONNECTED_NORMALLY)
9.511 {
9.512 isHandoverAllowed = false;
9.513 @@ -2564,7 +2593,7 @@
9.514 }
9.515
9.516 uint16_t
9.517 -LteEnbRrc::AddUe (UeManager::State state)
9.518 +LteEnbRrc::AddUe (UeManager::State state, uint8_t componentCarrierId)
9.519 {
9.520 NS_LOG_FUNCTION (this);
9.521 bool found = false;
9.522 @@ -2582,12 +2611,13 @@
9.523
9.524 NS_ASSERT_MSG (found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
9.525 m_lastAllocatedRnti = rnti;
9.526 - Ptr<UeManager> ueManager = CreateObject<UeManager> (this, rnti, state);
9.527 + Ptr<UeManager> ueManager = CreateObject<UeManager> (this, rnti, state, componentCarrierId);
9.528 m_ccmRrcSapProvider-> AddUe (rnti, (uint8_t)state);
9.529 m_ueMap.insert (std::pair<uint16_t, Ptr<UeManager> > (rnti, ueManager));
9.530 ueManager->Initialize ();
9.531 - NS_LOG_DEBUG (this << " New UE RNTI " << rnti << " cellId " << m_cellId << " srs CI " << ueManager->GetSrsConfigurationIndex ());
9.532 - m_newUeContextTrace (m_cellId, rnti);
9.533 + const uint16_t cellId = ComponentCarrierToCellId (componentCarrierId);
9.534 + NS_LOG_DEBUG (this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI " << ueManager->GetSrsConfigurationIndex ());
9.535 + m_newUeContextTrace (cellId, rnti);
9.536 return rnti;
9.537 }
9.538
9.539 @@ -2663,9 +2693,12 @@
9.540 LteEnbRrc::SetCsgId (uint32_t csgId, bool csgIndication)
9.541 {
9.542 NS_LOG_FUNCTION (this << csgId << csgIndication);
9.543 - m_sib1.cellAccessRelatedInfo.csgIdentity = csgId;
9.544 - m_sib1.cellAccessRelatedInfo.csgIndication = csgIndication;
9.545 - m_cphySapProvider.at (0)->SetSystemInformationBlockType1 (m_sib1);
9.546 + for (uint8_t componentCarrierId = 0; componentCarrierId < m_sib1.size (); componentCarrierId++)
9.547 + {
9.548 + m_sib1.at (componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
9.549 + m_sib1.at (componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
9.550 + m_cphySapProvider.at (componentCarrierId)->SetSystemInformationBlockType1 (m_sib1.at (componentCarrierId));
9.551 + }
9.552 }
9.553
9.554 void
9.555 @@ -2812,25 +2845,31 @@
9.556 {
9.557 // NS_LOG_FUNCTION (this);
9.558
9.559 + for (auto &it: m_componentCarrierPhyConf)
9.560 + {
9.561 + uint8_t ccId = it.first;
9.562 +
9.563 + LteRrcSap::SystemInformation si;
9.564 + si.haveSib2 = true;
9.565 + si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn ();
9.566 + si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth ();
9.567 + si.sib2.radioResourceConfigCommon.pdschConfigCommon.referenceSignalPower = m_cphySapProvider.at (ccId)->GetReferenceSignalPower ();
9.568 + si.sib2.radioResourceConfigCommon.pdschConfigCommon.pb = 0;
9.569 +
9.570 + LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at (ccId)->GetRachConfig ();
9.571 + LteRrcSap::RachConfigCommon rachConfigCommon;
9.572 + rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
9.573 + rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
9.574 + rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
9.575 + si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
9.576 +
9.577 + m_rrcSapUser->SendSystemInformation (it.second->GetCellId (), si);
9.578 + }
9.579 +
9.580 /*
9.581 * For simplicity, we use the same periodicity for all SIBs. Note that in real
9.582 * systems the periodicy of each SIBs could be different.
9.583 */
9.584 - LteRrcSap::SystemInformation si;
9.585 - si.haveSib2 = true;
9.586 - si.sib2.freqInfo.ulCarrierFreq = m_ulEarfcn;
9.587 - si.sib2.freqInfo.ulBandwidth = m_ulBandwidth;
9.588 - si.sib2.radioResourceConfigCommon.pdschConfigCommon.referenceSignalPower = m_cphySapProvider.at (0)->GetReferenceSignalPower ();
9.589 - si.sib2.radioResourceConfigCommon.pdschConfigCommon.pb = 0;
9.590 -
9.591 - LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at (0)->GetRachConfig ();
9.592 - LteRrcSap::RachConfigCommon rachConfigCommon;
9.593 - rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
9.594 - rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
9.595 - rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
9.596 - si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
9.597 -
9.598 - m_rrcSapUser->SendSystemInformation (si);
9.599 Simulator::Schedule (m_systemInformationPeriodicity, &LteEnbRrc::SendSystemInformation, this);
9.600 }
9.601
10.1 --- a/src/lte/model/lte-enb-rrc.h Wed Jul 19 15:19:46 2017 +0300
10.2 +++ b/src/lte/model/lte-enb-rrc.h Thu Jul 20 13:06:57 2017 +0300
10.3 @@ -104,10 +104,11 @@
10.4 * \param rrc pointer to the LteEnbRrc holding this UeManager
10.5 * \param rnti RNTI of the UE
10.6 * \param s initial state of the UeManager
10.7 + * \param componentCarrierId primary component carrier ID
10.8 *
10.9 * \return
10.10 */
10.11 - UeManager (Ptr<LteEnbRrc> rrc, uint16_t rnti, State s);
10.12 + UeManager (Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId);
10.13
10.14 virtual ~UeManager (void);
10.15
10.16 @@ -321,6 +322,12 @@
10.17 */
10.18 uint64_t GetImsi (void) const;
10.19
10.20 + /**
10.21 + *
10.22 + * \return the primary component carrier ID
10.23 + */
10.24 + uint8_t GetComponentCarrierId () const;
10.25 +
10.26 /**
10.27 *
10.28 * \return the SRS Configuration Index
10.29 @@ -488,6 +495,10 @@
10.30 * unique UE identifier.
10.31 */
10.32 uint64_t m_imsi;
10.33 + /**
10.34 + * ID of the primary CC for this UE
10.35 + */
10.36 + uint8_t m_componentCarrierId;
10.37
10.38 uint8_t m_lastRrcTransactionIdentifier; ///< last RRC transaction identifier
10.39
10.40 @@ -843,15 +854,16 @@
10.41 * `LteHelper::InstallEnbDevice` (i.e. before the simulation starts).
10.42 *
10.43 * \warning Raises an error when executed more than once.
10.44 + *
10.45 + * \param ccPhyConf the component carrier configuration
10.46 */
10.47 - void ConfigureCell (uint16_t cellId);
10.48 + void ConfigureCell (std::map<uint8_t, Ptr<ComponentCarrierEnb>> ccPhyConf);
10.49
10.50 /**
10.51 * \brief Configure carriers.
10.52 * \param ccPhyConf the component carrier configuration
10.53 - * \param numberOfCarriers the number of carriers
10.54 */
10.55 - void ConfigureCarriers (std::map<uint8_t, ComponentCarrier > ccPhyConf, uint16_t numberOfCarriers);
10.56 + void ConfigureCarriers (std::map<uint8_t, Ptr<ComponentCarrierEnb>> ccPhyConf);
10.57
10.58 /**
10.59 * set the cell id of this eNB
10.60 @@ -868,6 +880,24 @@
10.61 */
10.62 void SetCellId (uint16_t m_cellId, uint8_t ccIndex);
10.63
10.64 + /**
10.65 + * convert the cell id to component carrier id
10.66 + *
10.67 + * \param cellId Cell ID
10.68 + *
10.69 + * \return corresponding component carrier id
10.70 + */
10.71 + uint8_t CellToComponentCarrierId (uint16_t cellId);
10.72 +
10.73 + /**
10.74 + * convert the component carrier id to cell id
10.75 + *
10.76 + * \param componentCarrierId component carrier ID
10.77 + *
10.78 + * \return corresponding cell ID
10.79 + */
10.80 + uint16_t ComponentCarrierToCellId (uint8_t componentCarrierId);
10.81 +
10.82 /**
10.83 * Enqueue an IP data packet on the proper bearer for downlink
10.84 * transmission. Normally expected to be called by the NetDevice
10.85 @@ -1126,9 +1156,10 @@
10.86 /**
10.87 * Allocate temporary cell RNTI function
10.88 *
10.89 + * \param componentCarrierId ID of the primary component carrier
10.90 * \return temporary RNTI
10.91 */
10.92 - uint16_t DoAllocateTemporaryCellRnti ();
10.93 + uint16_t DoAllocateTemporaryCellRnti (uint8_t componentCarrierId);
10.94 /**
10.95 * Notify LC config result function
10.96 *
10.97 @@ -1209,10 +1240,11 @@
10.98 * * target cell RNTI allocation upon handover
10.99 *
10.100 * \param state the initial state of the UeManager
10.101 + * \param componentCarrierId primary component carrier ID of the UeManager
10.102 *
10.103 * \return the newly allocated RNTI
10.104 */
10.105 - uint16_t AddUe (UeManager::State state);
10.106 + uint16_t AddUe (UeManager::State state, uint8_t componentCarrierId);
10.107
10.108 /**
10.109 * remove a UE from the cell
10.110 @@ -1382,8 +1414,6 @@
10.111
10.112 /// True if ConfigureCell() has been completed.
10.113 bool m_configured;
10.114 - /// Cell identifier. Must be unique across the simulation.
10.115 - uint16_t m_cellId;
10.116 /// Downlink E-UTRA Absolute Radio Frequency Channel Number.
10.117 uint32_t m_dlEarfcn;
10.118 /// Uplink E-UTRA Absolute Radio Frequency Channel Number.
10.119 @@ -1396,7 +1426,7 @@
10.120 uint16_t m_lastAllocatedRnti;
10.121
10.122 /// The System Information Block Type 1 that is currently broadcasted over BCH.
10.123 - LteRrcSap::SystemInformationBlockType1 m_sib1;
10.124 + std::vector<LteRrcSap::SystemInformationBlockType1> m_sib1;
10.125
10.126 /**
10.127 * The `UeMap` attribute. List of UeManager by C-RNTI.
10.128 @@ -1549,7 +1579,7 @@
10.129
10.130 bool m_carriersConfigured; ///< are carriers configured
10.131
10.132 - std::map<uint8_t, ComponentCarrier> m_componentCarrierPhyConf; ///< component carrier phy configuration
10.133 + std::map<uint8_t, Ptr<ComponentCarrierEnb>> m_componentCarrierPhyConf; ///< component carrier phy configuration
10.134
10.135 }; // end of `class LteEnbRrc`
10.136
11.1 --- a/src/lte/model/lte-rrc-header.cc Wed Jul 19 15:19:46 2017 +0300
11.2 +++ b/src/lte/model/lte-rrc-header.cc Thu Jul 20 13:06:57 2017 +0300
11.3 @@ -1717,7 +1717,7 @@
11.4 {
11.5 // 3 optional fields. Extension marker not present.
11.6 std::bitset<3> noncriticalExtension_v1020;
11.7 - noncriticalExtension_v1020.set (1,0); // No sCellToRealeaseList-r10
11.8 + noncriticalExtension_v1020.set (2,0); // No sCellToRealeaseList-r10
11.9 noncriticalExtension_v1020.set (1,1); // sCellToAddModList-r10
11.10 noncriticalExtension_v1020.set (0,0); // No nonCriticalExtension RRCConnectionReconfiguration-v1130-IEs
11.11 SerializeSequence (noncriticalExtension_v1020,false);
11.12 @@ -1740,7 +1740,7 @@
11.13 cellIdentification_r10.set(0,1); // dl-CarrierFreq-r10
11.14 SerializeSequence (cellIdentification_r10, false);
11.15
11.16 - SerializeInteger (it->cellIdentification.physCellId,1,MAX_EARFCN);
11.17 + SerializeInteger (it->cellIdentification.physCellId,1,65536);
11.18 SerializeInteger (it->cellIdentification.dlCarrierFreq,1,MAX_EARFCN);
11.19
11.20 //Serialize RadioResourceConfigCommonSCell
11.21 @@ -1769,7 +1769,7 @@
11.22 radioResourceConfigCommonSCell_r10.set (0,rrccsc.haveUlConfiguration); // UlConfiguration
11.23 SerializeSequence (radioResourceConfigCommonSCell_r10,false);
11.24
11.25 - if (radioResourceConfigCommonSCell_r10[1])
11.26 + if (rrccsc.haveNonUlConfiguration)
11.27 {
11.28 // 5 optional fields. Extension marker not present.
11.29 std::bitset<5> nonUlConfiguration_r10;
11.30 @@ -1796,7 +1796,7 @@
11.31 SerializeInteger (rrccsc.nonUlConfiguration.pdschConfigCommon.pb,0,3);
11.32
11.33 }
11.34 - if (radioResourceConfigCommonSCell_r10[0])
11.35 + if (rrccsc.haveUlConfiguration)
11.36 {
11.37 //Serialize Ul Configuration
11.38 // 7 optional fields. Extension marker present.
11.39 @@ -1860,12 +1860,12 @@
11.40 pcdscOpt.set (0,pcdsc.haveUlConfiguration);
11.41 SerializeSequence (pcdscOpt, true);
11.42
11.43 - if (pcdscOpt[1])
11.44 + if (pcdsc.haveNonUlConfiguration)
11.45 {
11.46 //Serialize NonUl configuration
11.47 std::bitset<4> nulOpt;
11.48 nulOpt.set (3,pcdsc.haveAntennaInfoDedicated);
11.49 - nulOpt.set (2,0); // crossCarrierSchedulingConfig-r10 NOT IMplemented
11.50 + nulOpt.set (2,0); // crossCarrierSchedulingConfig-r10 Not Implemented
11.51 nulOpt.set (1,0); // csi-RS-Config-r10 Not Implemented
11.52 nulOpt.set (0, pcdsc.havePdschConfigDedicated); // pdsch-ConfigDedicated-r10
11.53 SerializeSequence (nulOpt,false);
11.54 @@ -1906,7 +1906,7 @@
11.55
11.56
11.57 }
11.58 - if (pcdscOpt[0])
11.59 + if (pcdsc.haveUlConfiguration)
11.60 {
11.61 //Serialize Ul Configuration
11.62 std::bitset<7> ulOpt;
11.63 @@ -2591,6 +2591,10 @@
11.64 // Continue to deserialize futere Release optional fields
11.65 std::bitset<3> nonCriticalExtension_v1020;
11.66 bIterator = DeserializeSequence (&nonCriticalExtension_v1020, false, bIterator);
11.67 + NS_ASSERT (!nonCriticalExtension_v1020[2]); // No sCellToRealeaseList-r10
11.68 + NS_ASSERT (nonCriticalExtension_v1020[1]); // sCellToAddModList-r10
11.69 + NS_ASSERT (!nonCriticalExtension_v1020[0]); // No nonCriticalExtension RRCConnectionReconfiguration-v1130-IEs
11.70 +
11.71 int numElems;
11.72 bIterator = DeserializeSequenceOf (&numElems,MAX_OBJECT_ID,1,bIterator);
11.73 nonCriticalExtension->sCellsToAddModList.clear ();
11.74 @@ -2602,13 +2606,16 @@
11.75
11.76 LteRrcSap::SCellToAddMod sctam;
11.77 // Deserialize sCellIndex
11.78 + NS_ASSERT (sCellToAddMod_r10[3]); // sCellIndex
11.79 int n;
11.80 bIterator = DeserializeInteger (&n,1,MAX_OBJECT_ID,bIterator);
11.81 sctam.sCellIndex = n;
11.82 // Deserialize CellIdentification
11.83 + NS_ASSERT (sCellToAddMod_r10[2]); // CellIdentification
11.84 bIterator = DeserializeCellIdentification (&sctam.cellIdentification, bIterator);
11.85
11.86 // Deserialize RadioResourceConfigCommonSCell
11.87 + NS_ASSERT (sCellToAddMod_r10[1]);
11.88 bIterator = DeserializeRadioResourceConfigCommonSCell (&sctam.radioResourceConfigCommonSCell, bIterator);
11.89 if (sCellToAddMod_r10[0])
11.90 {
11.91 @@ -2630,11 +2637,13 @@
11.92 NS_LOG_FUNCTION (this);
11.93 std::bitset<2> cellIdentification_r10;
11.94 bIterator = DeserializeSequence (&cellIdentification_r10,false,bIterator);
11.95 + NS_ASSERT(cellIdentification_r10[1]); // phyCellId-r10
11.96 int n1;
11.97 bIterator = DeserializeInteger (&n1,1,65536,bIterator);
11.98 ci->physCellId = n1;
11.99 int n2;
11.100 - bIterator = DeserializeInteger (&n2,1,65536,bIterator);
11.101 + NS_ASSERT (cellIdentification_r10[0]); // dl-CarrierFreq-r10
11.102 + bIterator = DeserializeInteger (&n2,1,MAX_EARFCN,bIterator);
11.103 ci->dlCarrierFreq = n2;
11.104
11.105 return bIterator;
11.106 @@ -2683,7 +2692,7 @@
11.107
11.108 std::bitset<2> UlPowerControlCommonSCell_r10;
11.109 bIterator = DeserializeSequence (&UlPowerControlCommonSCell_r10,false,bIterator);
11.110 - bIterator = DeserializeInteger (&n,0,MAX_EARFCN,bIterator);
11.111 + bIterator = DeserializeInteger (&n,0,65536,bIterator);
11.112 rrccsc->ulConfiguration.ulPowerControlCommonSCell.alpha = n;
11.113
11.114 std::bitset<1> prachConfigSCell_r10;
11.115 @@ -2701,7 +2710,7 @@
11.116 NS_LOG_FUNCTION (this);
11.117 std::bitset<1> RadioResourceConfigDedicatedSCell_r10;
11.118 bIterator = DeserializeSequence (&RadioResourceConfigDedicatedSCell_r10,false,bIterator);
11.119 - DeserializePhysicalConfigDedicatedSCell (&rrcdsc->physicalConfigDedicatedSCell, bIterator);
11.120 + bIterator = DeserializePhysicalConfigDedicatedSCell (&rrcdsc->physicalConfigDedicatedSCell, bIterator);
11.121
11.122 return bIterator;
11.123 }
11.124 @@ -2719,6 +2728,8 @@
11.125 std::bitset<4> nulOpt;
11.126 bIterator = DeserializeSequence (&nulOpt,false,bIterator);
11.127 pcdsc->haveAntennaInfoDedicated = nulOpt[3];
11.128 + NS_ASSERT(!nulOpt[2]); // crossCarrierSchedulingConfig-r10 Not Implemented
11.129 + NS_ASSERT(!nulOpt[1]); // csi-RS-Config-r10 Not Implemented
11.130 pcdsc->havePdschConfigDedicated = nulOpt[0];
11.131
11.132 if (pcdsc->haveAntennaInfoDedicated)
11.133 @@ -2742,6 +2753,7 @@
11.134 if (codebookSubsetRestrictionPresent[0])
11.135 {
11.136 // Deserialize codebookSubsetRestriction
11.137 + NS_FATAL_ERROR ("Not implemented yet");
11.138 // ...
11.139 }
11.140
11.141 @@ -2755,6 +2767,7 @@
11.142 else if (txantennaselchosen == 1)
11.143 {
11.144 // Deserialize ue-TransmitAntennaSelection setup
11.145 + NS_FATAL_ERROR ("Not implemented yet");
11.146 // ...
11.147 }
11.148 }
11.149 @@ -2780,7 +2793,12 @@
11.150 std::bitset<7> ulOpt;
11.151 bIterator = DeserializeSequence (&ulOpt,false,bIterator);
11.152 pcdsc->haveAntennaInfoUlDedicated = ulOpt[6];
11.153 + NS_ASSERT(!ulOpt[5]); // pusch-ConfigDedicatedSCell-r10 not present
11.154 + NS_ASSERT(!ulOpt[4]); // uplinkPowerControlDedicatedSCell-r10 not present
11.155 + NS_ASSERT(!ulOpt[3]); // cqi-ReportConfigSCell-r10 not present
11.156 pcdsc->haveSoundingRsUlConfigDedicated = ulOpt[2];
11.157 + NS_ASSERT(!ulOpt[1]); // soundingRS-UL-ConfigDedicated-v1020 not present
11.158 + NS_ASSERT(!ulOpt[0]); // soundingRS-UL-ConfigDedicatedAperiodic-r10 not present
11.159
11.160 if (pcdsc->haveAntennaInfoUlDedicated)
11.161 {
11.162 @@ -2803,6 +2821,7 @@
11.163 if (codebookSubsetRestrictionPresent[0])
11.164 {
11.165 // Deserialize codebookSubsetRestriction
11.166 + NS_FATAL_ERROR ("Not implemented yet");
11.167 // ...
11.168 }
11.169
11.170 @@ -2816,6 +2835,7 @@
11.171 else if (txantennaselchosen == 1)
11.172 {
11.173 // Deserialize ue-TransmitAntennaSelection setup
11.174 + NS_FATAL_ERROR ("Not implemented yet");
11.175 // ...
11.176 }
11.177 }
12.1 --- a/src/lte/model/lte-rrc-protocol-ideal.cc Wed Jul 19 15:19:46 2017 +0300
12.2 +++ b/src/lte/model/lte-rrc-protocol-ideal.cc Thu Jul 20 13:06:57 2017 +0300
12.3 @@ -196,7 +196,7 @@
12.4 }
12.5 else
12.6 {
12.7 - if (enbDev->GetCellId () == cellId)
12.8 + if (enbDev->HasCellId (cellId))
12.9 {
12.10 found = true;
12.11 break;
12.12 @@ -329,9 +329,9 @@
12.13 }
12.14
12.15 void
12.16 -LteEnbRrcProtocolIdeal::DoSendSystemInformation (LteRrcSap::SystemInformation msg)
12.17 +LteEnbRrcProtocolIdeal::DoSendSystemInformation (uint16_t cellId, LteRrcSap::SystemInformation msg)
12.18 {
12.19 - NS_LOG_FUNCTION (this << m_cellId);
12.20 + NS_LOG_FUNCTION (this << cellId);
12.21 // walk list of all nodes to get UEs with this cellId
12.22 Ptr<LteUeRrc> ueRrc;
12.23 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
12.24 @@ -345,7 +345,7 @@
12.25 {
12.26 Ptr<LteUeRrc> ueRrc = ueDev->GetRrc ();
12.27 NS_LOG_LOGIC ("considering UE IMSI " << ueDev->GetImsi () << " that has cellId " << ueRrc->GetCellId ());
12.28 - if (ueRrc->GetCellId () == m_cellId)
12.29 + if (ueRrc->GetCellId () == cellId)
12.30 {
12.31 NS_LOG_LOGIC ("sending SI to IMSI " << ueDev->GetImsi ());
12.32 ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
13.1 --- a/src/lte/model/lte-rrc-protocol-ideal.h Wed Jul 19 15:19:46 2017 +0300
13.2 +++ b/src/lte/model/lte-rrc-protocol-ideal.h Thu Jul 20 13:06:57 2017 +0300
13.3 @@ -220,9 +220,10 @@
13.4 /**
13.5 * Send system information function
13.6 *
13.7 + * \param cellId cell ID
13.8 * \param msg LteRrcSap::SystemInformation
13.9 */
13.10 - void DoSendSystemInformation (LteRrcSap::SystemInformation msg);
13.11 + void DoSendSystemInformation (uint16_t cellId, LteRrcSap::SystemInformation msg);
13.12 /**
13.13 * Send system information function
13.14 *
14.1 --- a/src/lte/model/lte-rrc-protocol-real.cc Wed Jul 19 15:19:46 2017 +0300
14.2 +++ b/src/lte/model/lte-rrc-protocol-real.cc Thu Jul 20 13:06:57 2017 +0300
14.3 @@ -256,7 +256,7 @@
14.4 }
14.5 else
14.6 {
14.7 - if (enbDev->GetCellId () == cellId)
14.8 + if (enbDev->HasCellId (cellId))
14.9 {
14.10 found = true;
14.11 break;
14.12 @@ -504,9 +504,9 @@
14.13 }
14.14
14.15 void
14.16 -LteEnbRrcProtocolReal::DoSendSystemInformation (LteRrcSap::SystemInformation msg)
14.17 +LteEnbRrcProtocolReal::DoSendSystemInformation (uint16_t cellId, LteRrcSap::SystemInformation msg)
14.18 {
14.19 - NS_LOG_FUNCTION (this << m_cellId);
14.20 + NS_LOG_FUNCTION (this << cellId);
14.21 // walk list of all nodes to get UEs with this cellId
14.22 Ptr<LteUeRrc> ueRrc;
14.23 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
14.24 @@ -520,7 +520,7 @@
14.25 {
14.26 Ptr<LteUeRrc> ueRrc = ueDev->GetRrc ();
14.27 NS_LOG_LOGIC ("considering UE IMSI " << ueDev->GetImsi () << " that has cellId " << ueRrc->GetCellId ());
14.28 - if (ueRrc->GetCellId () == m_cellId)
14.29 + if (ueRrc->GetCellId () == cellId)
14.30 {
14.31 NS_LOG_LOGIC ("sending SI to IMSI " << ueDev->GetImsi ());
14.32 ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
14.33 @@ -549,14 +549,7 @@
14.34 transmitPdcpPduParameters.rnti = rnti;
14.35 transmitPdcpPduParameters.lcid = 0;
14.36
14.37 - if (m_setupUeParametersMap.find (rnti) == m_setupUeParametersMap.end () )
14.38 - {
14.39 - std::cout << "RNTI not found in Enb setup parameters Map!" << std::endl;
14.40 - }
14.41 - else
14.42 - {
14.43 - m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
14.44 - }
14.45 + m_setupUeParametersMap.at (rnti).srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
14.46 }
14.47
14.48 void
15.1 --- a/src/lte/model/lte-rrc-protocol-real.h Wed Jul 19 15:19:46 2017 +0300
15.2 +++ b/src/lte/model/lte-rrc-protocol-real.h Thu Jul 20 13:06:57 2017 +0300
15.3 @@ -247,15 +247,17 @@
15.4 /**
15.5 * Send system information function
15.6 *
15.7 + * \param cellId cell ID
15.8 * \param msg LteRrcSap::SystemInformation
15.9 */
15.10 - void DoSendSystemInformation (LteRrcSap::SystemInformation msg);
15.11 + void DoSendSystemInformation (uint16_t cellId, LteRrcSap::SystemInformation msg);
15.12 /**
15.13 * Send system information function
15.14 *
15.15 + * \param cellId cell ID
15.16 * \param msg LteRrcSap::SystemInformation
15.17 */
15.18 - void SendSystemInformation (LteRrcSap::SystemInformation msg);
15.19 + void SendSystemInformation (uint16_t cellId, LteRrcSap::SystemInformation msg);
15.20 /**
15.21 * Send RRC connection setup function
15.22 *
16.1 --- a/src/lte/model/lte-rrc-sap.h Wed Jul 19 15:19:46 2017 +0300
16.2 +++ b/src/lte/model/lte-rrc-sap.h Thu Jul 20 13:06:57 2017 +0300
16.3 @@ -1086,9 +1086,10 @@
16.4 * \brief Send a _SystemInformation_ message to all attached UEs
16.5 * during a system information acquisition procedure
16.6 * (Section 5.2.2 of TS 36.331).
16.7 + * \param cellId cell ID
16.8 * \param msg the message
16.9 */
16.10 - virtual void SendSystemInformation (SystemInformation msg) = 0;
16.11 + virtual void SendSystemInformation (uint16_t cellId, SystemInformation msg) = 0;
16.12
16.13 /**
16.14 * \brief Send an _RRCConnectionSetup_ message to a UE
16.15 @@ -1475,7 +1476,7 @@
16.16
16.17 virtual void SetupUe (uint16_t rnti, SetupUeParameters params);
16.18 virtual void RemoveUe (uint16_t rnti);
16.19 - virtual void SendSystemInformation (SystemInformation msg);
16.20 + virtual void SendSystemInformation (uint16_t cellId, SystemInformation msg);
16.21 virtual void SendRrcConnectionSetup (uint16_t rnti, RrcConnectionSetup msg);
16.22 virtual void SendRrcConnectionReconfiguration (uint16_t rnti, RrcConnectionReconfiguration msg);
16.23 virtual void SendRrcConnectionReestablishment (uint16_t rnti, RrcConnectionReestablishment msg);
16.24 @@ -1519,9 +1520,9 @@
16.25
16.26 template <class C>
16.27 void
16.28 -MemberLteEnbRrcSapUser<C>::SendSystemInformation (SystemInformation msg)
16.29 +MemberLteEnbRrcSapUser<C>::SendSystemInformation (uint16_t cellId, SystemInformation msg)
16.30 {
16.31 - m_owner->DoSendSystemInformation (msg);
16.32 + m_owner->DoSendSystemInformation (cellId, msg);
16.33 }
16.34
16.35 template <class C>
17.1 --- a/src/lte/model/lte-spectrum-value-helper.cc Wed Jul 19 15:19:46 2017 +0300
17.2 +++ b/src/lte/model/lte-spectrum-value-helper.cc Thu Jul 20 13:06:57 2017 +0300
17.3 @@ -114,38 +114,62 @@
17.4 }
17.5 }
17.6
17.7 -double
17.8 -LteSpectrumValueHelper::GetDownlinkCarrierFrequency (uint32_t nDl)
17.9 +uint16_t
17.10 +LteSpectrumValueHelper::GetDownlinkCarrierBand (uint32_t nDl)
17.11 {
17.12 NS_LOG_FUNCTION (nDl);
17.13 for (uint16_t i = 0; i < NUM_EUTRA_BANDS; ++i)
17.14 {
17.15 - if ((g_eutraChannelNumbers[i].rangeNdl1 <= nDl)
17.16 - && (g_eutraChannelNumbers[i].rangeNdl2 >= nDl))
17.17 + if (g_eutraChannelNumbers[i].rangeNdl1 <= nDl &&
17.18 + g_eutraChannelNumbers[i].rangeNdl2 >= nDl)
17.19 {
17.20 NS_LOG_LOGIC ("entry " << i << " fDlLow=" << g_eutraChannelNumbers[i].fDlLow);
17.21 - return 1.0e6 * (g_eutraChannelNumbers[i].fDlLow + 0.1 * (nDl - g_eutraChannelNumbers[i].nOffsDl));
17.22 + return i;
17.23 }
17.24 }
17.25 NS_LOG_ERROR ("invalid EARFCN " << nDl);
17.26 - return 0.0;
17.27 + return NUM_EUTRA_BANDS;
17.28 }
17.29
17.30 -double
17.31 -LteSpectrumValueHelper::GetUplinkCarrierFrequency (uint32_t nUl)
17.32 +uint16_t
17.33 +LteSpectrumValueHelper::GetUplinkCarrierBand (uint32_t nUl)
17.34 {
17.35 NS_LOG_FUNCTION (nUl);
17.36 for (uint16_t i = 0; i < NUM_EUTRA_BANDS; ++i)
17.37 {
17.38 - if ((g_eutraChannelNumbers[i].rangeNul1 <= nUl)
17.39 - && (g_eutraChannelNumbers[i].rangeNul2 >= nUl))
17.40 + if (g_eutraChannelNumbers[i].rangeNul1 <= nUl &&
17.41 + g_eutraChannelNumbers[i].rangeNul2 >= nUl)
17.42 {
17.43 NS_LOG_LOGIC ("entry " << i << " fUlLow=" << g_eutraChannelNumbers[i].fUlLow);
17.44 - return 1.0e6 * (g_eutraChannelNumbers[i].fUlLow + 0.1 * (nUl - g_eutraChannelNumbers[i].nOffsUl));
17.45 + return i;
17.46 }
17.47 }
17.48 NS_LOG_ERROR ("invalid EARFCN " << nUl);
17.49 - return 0.0;
17.50 + return NUM_EUTRA_BANDS;
17.51 +}
17.52 +
17.53 +double
17.54 +LteSpectrumValueHelper::GetDownlinkCarrierFrequency (uint32_t nDl)
17.55 +{
17.56 + NS_LOG_FUNCTION (nDl);
17.57 + uint16_t i = GetDownlinkCarrierBand (nDl);
17.58 + if (i == NUM_EUTRA_BANDS)
17.59 + {
17.60 + return 0.0;
17.61 + }
17.62 + return 1.0e6 * (g_eutraChannelNumbers[i].fDlLow + 0.1 * (nDl - g_eutraChannelNumbers[i].nOffsDl));
17.63 +}
17.64 +
17.65 +double
17.66 +LteSpectrumValueHelper::GetUplinkCarrierFrequency (uint32_t nUl)
17.67 +{
17.68 + NS_LOG_FUNCTION (nUl);
17.69 + uint16_t i = GetUplinkCarrierBand (nUl);
17.70 + if (i == NUM_EUTRA_BANDS)
17.71 + {
17.72 + return 0.0;
17.73 + }
17.74 + return 1.0e6 * (g_eutraChannelNumbers[i].fUlLow + 0.1 * (nUl - g_eutraChannelNumbers[i].nOffsUl));
17.75 }
17.76
17.77 double
18.1 --- a/src/lte/model/lte-spectrum-value-helper.h Wed Jul 19 15:19:46 2017 +0300
18.2 +++ b/src/lte/model/lte-spectrum-value-helper.h Thu Jul 20 13:06:57 2017 +0300
18.3 @@ -48,13 +48,31 @@
18.4 static double GetCarrierFrequency (uint32_t earfcn);
18.5
18.6 /**
18.7 - * Calculates the dowlink carrier frequency from the E-UTRA Absolute
18.8 + * Converts downlink EARFCN to corresponding LTE frequency band number.
18.9 + *
18.10 + * \param earfcn the EARFCN
18.11 + *
18.12 + * \return the downlink carrier band
18.13 + */
18.14 + static uint16_t GetDownlinkCarrierBand (uint32_t nDl);
18.15 +
18.16 + /**
18.17 + * Converts uplink EARFCN to corresponding LTE frequency band number.
18.18 + *
18.19 + * \param earfcn the EARFCN
18.20 + *
18.21 + * \return the uplink carrier band
18.22 + */
18.23 + static uint16_t GetUplinkCarrierBand (uint32_t nDl);
18.24 +
18.25 + /**
18.26 + * Calculates the downlink carrier frequency from the E-UTRA Absolute
18.27 * Radio Frequency Channel Number (EARFCN) using the formula in 3GPP TS
18.28 * 36.101 section 5.7.3 "Carrier frequency and EARFCN".
18.29 *
18.30 * \param earfcn the EARFCN
18.31 *
18.32 - * \return the dowlink carrier frequency in Hz
18.33 + * \return the downlink carrier frequency in Hz
18.34 */
18.35 static double GetDownlinkCarrierFrequency (uint32_t earfcn);
18.36
19.1 --- a/src/lte/model/lte-ue-rrc.cc Wed Jul 19 15:19:46 2017 +0300
19.2 +++ b/src/lte/model/lte-ue-rrc.cc Thu Jul 20 13:06:57 2017 +0300
19.3 @@ -1237,6 +1237,7 @@
19.4 uint8_t ccId = scell.sCellIndex;
19.5
19.6
19.7 + uint16_t physCellId = scell.cellIdentification.physCellId;
19.8 uint8_t ulBand = scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth;
19.9 uint32_t ulEarfcn = scell.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq;
19.10 uint8_t dlBand = scell.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth;
19.11 @@ -1244,7 +1245,7 @@
19.12 uint8_t txMode = scell.radioResourceConfigDedicateSCell.physicalConfigDedicatedSCell.antennaInfo.transmissionMode;
19.13 uint8_t srsIndex = scell.radioResourceConfigDedicateSCell.physicalConfigDedicatedSCell.soundingRsUlConfigDedicated.srsConfigIndex;
19.14
19.15 - m_cphySapProvider.at (ccId)->SynchronizeWithEnb (m_cellId, dlEarfcn);
19.16 + m_cphySapProvider.at (ccId)->SynchronizeWithEnb (physCellId, dlEarfcn);
19.17 m_cphySapProvider.at (ccId)->SetDlBandwidth (dlBand);
19.18 m_cphySapProvider.at (ccId)->ConfigureUplink (ulEarfcn, ulBand);
19.19 m_cphySapProvider.at (ccId)->ConfigureReferenceSignalPower (scell.radioResourceConfigCommonSCell.nonUlConfiguration.pdschConfigCommon.referenceSignalPower);
20.1 --- a/src/lte/model/no-op-component-carrier-manager.cc Wed Jul 19 15:19:46 2017 +0300
20.2 +++ b/src/lte/model/no-op-component-carrier-manager.cc Thu Jul 20 13:06:57 2017 +0300
20.3 @@ -92,7 +92,8 @@
20.4 NoOpComponentCarrierManager::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters params)
20.5 {
20.6 NS_LOG_FUNCTION (this);
20.7 - std::map <uint8_t, LteMacSapProvider*>::iterator it = m_macSapProvidersMap.find (0);
20.8 + auto ueManager = m_ccmRrcSapUser->GetUeManager (params.rnti);
20.9 + std::map <uint8_t, LteMacSapProvider*>::iterator it = m_macSapProvidersMap.find (ueManager->GetComponentCarrierId ());
20.10 NS_ASSERT_MSG (it != m_macSapProvidersMap.end (), "could not find Sap for ComponentCarrier ");
20.11 it->second->ReportBufferStatus (params);
20.12 }
20.13 @@ -369,7 +370,6 @@
20.14 NoOpComponentCarrierManager::DoUlReceiveMacCe (MacCeListElement_s bsr, uint8_t componentCarrierId)
20.15 {
20.16 NS_LOG_FUNCTION (this);
20.17 - NS_ASSERT_MSG (componentCarrierId == 0, "Received BSR from a ComponentCarrier not allowed, ComponentCarrierId = " << componentCarrierId);
20.18 NS_ASSERT_MSG (bsr.m_macCeType == MacCeListElement_s::BSR, "Received a Control Message not allowed " << bsr.m_macCeType);
20.19 if ( bsr.m_macCeType == MacCeListElement_s::BSR)
20.20 {
20.21 @@ -393,7 +393,7 @@
20.22 // to the primary carrier component
20.23 newBsr.m_macCeValue.m_bufferStatus.at (i) = BufferSizeLevelBsr::BufferSize2BsrId (buffer);
20.24 }
20.25 - std::map< uint8_t,LteCcmMacSapProvider*>::iterator sapIt = m_ccmMacSapProviderMap.find (0);
20.26 + auto sapIt = m_ccmMacSapProviderMap.find (componentCarrierId);
20.27 if (sapIt == m_ccmMacSapProviderMap.end ())
20.28 {
20.29 NS_FATAL_ERROR ("Sap not found in the CcmMacSapProviderMap");
20.30 @@ -446,15 +446,15 @@
20.31
20.32 NS_ASSERT_MSG( m_enabledComponentCarrier.find(params.rnti)!=m_enabledComponentCarrier.end(), " UE with provided RNTI not found. RNTI:"<<params.rnti);
20.33
20.34 - if (params.lcid == 0 || params.lcid==1)
20.35 + uint32_t numberOfCarriersForUe = m_enabledComponentCarrier.find (params.rnti)->second;
20.36 + if (params.lcid == 0 || params.lcid == 1 || numberOfCarriersForUe == 1)
20.37 {
20.38 - NS_LOG_INFO("Buffer status for lcId=0 and lcId=1 forwarded to the primary carrier.");
20.39 - m_macSapProvidersMap.find(0)->second->ReportBufferStatus(params);
20.40 -
20.41 + NS_LOG_INFO("Buffer status forwarded to the primary carrier.");
20.42 + auto ueManager = m_ccmRrcSapUser->GetUeManager (params.rnti);
20.43 + m_macSapProvidersMap.at (ueManager->GetComponentCarrierId ())->ReportBufferStatus (params);
20.44 }
20.45 else
20.46 {
20.47 - uint32_t numberOfCarriersForUe = m_enabledComponentCarrier.find(params.rnti)->second;
20.48 params.retxQueueSize /= numberOfCarriersForUe;
20.49 params.txQueueSize /= numberOfCarriersForUe;
20.50 for ( uint16_t i = 0; i < numberOfCarriersForUe ; i++)
20.51 @@ -510,8 +510,8 @@
20.52 }
20.53 else
20.54 {
20.55 - NS_ASSERT_MSG (m_ccmMacSapProviderMap[0], "Mac sap provider does not exist.");
20.56 - m_ccmMacSapProviderMap[0]->ReportMacCeToScheduler(bsr);
20.57 + auto ueManager = m_ccmRrcSapUser->GetUeManager (bsr.m_rnti);
20.58 + m_ccmMacSapProviderMap.at (ueManager->GetComponentCarrierId ())->ReportMacCeToScheduler (bsr);
20.59 }
20.60 }
20.61
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/src/lte/test/lte-test-aggregation-throughput-scale.cc Thu Jul 20 13:06:57 2017 +0300
21.3 @@ -0,0 +1,168 @@
21.4 +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
21.5 +/*
21.6 + * Copyright (c) 2017 Alexander Krotov
21.7 + *
21.8 + * This program is free software; you can redistribute it and/or modify
21.9 + * it under the terms of the GNU General Public License version 2 as
21.10 + * published by the Free Software Foundation;
21.11 + *
21.12 + * This program is distributed in the hope that it will be useful,
21.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21.15 + * GNU General Public License for more details.
21.16 + *
21.17 + * You should have received a copy of the GNU General Public License
21.18 + * along with this program; if not, write to the Free Software
21.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21.20 + *
21.21 + * Author: Alexander Krotov <krotov@iitp.ru>
21.22 + *
21.23 + */
21.24 +
21.25 +#include "lte-test-aggregation-throughput-scale.h"
21.26 +
21.27 +#include <algorithm>
21.28 +
21.29 +#include <ns3/application-container.h>
21.30 +#include <ns3/friis-spectrum-propagation-loss.h>
21.31 +#include <ns3/internet-stack-helper.h>
21.32 +#include <ns3/ipv4-address-helper.h>
21.33 +#include <ns3/ipv4-interface-container.h>
21.34 +#include <ns3/ipv4-static-routing-helper.h>
21.35 +#include <ns3/log.h>
21.36 +#include <ns3/lte-enb-net-device.h>
21.37 +#include <ns3/lte-helper.h>
21.38 +#include <ns3/lte-ue-net-device.h>
21.39 +#include <ns3/lte-ue-rrc.h>
21.40 +#include <ns3/mobility-helper.h>
21.41 +#include <ns3/net-device-container.h>
21.42 +#include <ns3/node-container.h>
21.43 +#include <ns3/packet-sink.h>
21.44 +#include <ns3/point-to-point-epc-helper.h>
21.45 +#include <ns3/point-to-point-helper.h>
21.46 +#include <ns3/simulator.h>
21.47 +#include <ns3/udp-client.h>
21.48 +
21.49 +using namespace ns3;
21.50 +
21.51 +NS_LOG_COMPONENT_DEFINE ("LteAggregationThroughputScaleTest");
21.52 +
21.53 +LteAggregationThroughputScaleTestSuite::LteAggregationThroughputScaleTestSuite ()
21.54 + : TestSuite ("lte-aggregation-throughput-scale", SYSTEM)
21.55 +{
21.56 + AddTestCase (new LteAggregationThroughputScaleTestCase ("Carrier aggregation throughput scale"), TestCase::QUICK);
21.57 +}
21.58 +
21.59 +static LteAggregationThroughputScaleTestSuite g_lteAggregationThroughputScaleTestSuite;
21.60 +
21.61 +LteAggregationThroughputScaleTestCase::LteAggregationThroughputScaleTestCase (std::string name)
21.62 + : TestCase (name)
21.63 +{
21.64 + NS_LOG_FUNCTION (this << GetName ());
21.65 +}
21.66 +
21.67 +
21.68 +LteAggregationThroughputScaleTestCase::~LteAggregationThroughputScaleTestCase ()
21.69 +{
21.70 + NS_LOG_FUNCTION (this << GetName ());
21.71 +}
21.72 +
21.73 +double
21.74 +LteAggregationThroughputScaleTestCase::GetThroughput (uint8_t numberOfComponentCarriers)
21.75 +{
21.76 + NS_LOG_FUNCTION (this << GetName ());
21.77 +
21.78 + auto lteHelper = CreateObject<LteHelper> ();
21.79 + lteHelper->SetAttribute ("PathlossModel", TypeIdValue (ns3::FriisSpectrumPropagationLossModel::GetTypeId ()));
21.80 + lteHelper->SetAttribute ("NumberOfComponentCarriers", UintegerValue (numberOfComponentCarriers));
21.81 + lteHelper->SetAttribute ("EnbComponentCarrierManager", StringValue ("ns3::RrComponentCarrierManager"));
21.82 +
21.83 + auto epcHelper = CreateObject<PointToPointEpcHelper> ();
21.84 + lteHelper->SetEpcHelper (epcHelper);
21.85 +
21.86 + auto cch = CreateObject<CcHelper> ();
21.87 + cch->SetUlEarfcn (100 + 18000);
21.88 + cch->SetDlEarfcn (100);
21.89 + cch->SetUlBandwidth (25);
21.90 + cch->SetDlBandwidth (25);
21.91 + cch->SetNumberOfComponentCarriers (numberOfComponentCarriers);
21.92 +
21.93 + const auto ccm = cch->EquallySpacedCcs ();
21.94 + lteHelper->SetCcPhyParams (ccm);
21.95 +
21.96 + auto enbNode = CreateObject<Node> ();
21.97 + auto ueNode = CreateObject<Node> ();
21.98 + auto pgwNode = epcHelper->GetPgwNode ();
21.99 +
21.100 + MobilityHelper mobility;
21.101 + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
21.102 + mobility.Install (enbNode);
21.103 + mobility.Install (ueNode);
21.104 +
21.105 + InternetStackHelper internet;
21.106 + internet.Install (ueNode);
21.107 +
21.108 + Ipv4AddressHelper ipv4h;
21.109 + ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
21.110 +
21.111 + Ipv4StaticRoutingHelper ipv4RoutingHelper;
21.112 + auto ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
21.113 + ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
21.114 +
21.115 + auto enbDev = DynamicCast<LteEnbNetDevice> (lteHelper->InstallEnbDevice (enbNode).Get (0));
21.116 + auto ueDevs = lteHelper->InstallUeDevice (ueNode);
21.117 + auto ueDev = DynamicCast<LteUeNetDevice> (ueDevs.Get (0));
21.118 +
21.119 + Ipv4InterfaceContainer ueIpIface = epcHelper->AssignUeIpv4Address (ueDevs);
21.120 +
21.121 + // Attach to last CC as primary
21.122 + ueDev->SetDlEarfcn (ccm.at (numberOfComponentCarriers - 1).GetDlEarfcn ());
21.123 + lteHelper->Attach (ueDevs);
21.124 + m_expectedCellId = enbDev->GetCcMap ().at (numberOfComponentCarriers - 1)->GetCellId ();
21.125 +
21.126 + // Applications
21.127 + const uint16_t port = 21;
21.128 +
21.129 + ApplicationContainer apps;
21.130 +
21.131 + auto sink = CreateObject<PacketSink> ();
21.132 + sink->SetAttribute ("Protocol", StringValue ("ns3::UdpSocketFactory"));
21.133 + sink->SetAttribute ("Local", AddressValue (InetSocketAddress (ueIpIface.GetAddress (0), port)));
21.134 + ueNode->AddApplication (sink);
21.135 + apps.Add (sink);
21.136 +
21.137 + auto client = CreateObject<UdpClient> ();
21.138 + client->SetAttribute ("RemotePort", UintegerValue (port));
21.139 + client->SetAttribute ("MaxPackets", UintegerValue (1000000));
21.140 + client->SetAttribute ("Interval", TimeValue (Seconds (0.0001)));
21.141 + client->SetAttribute ("PacketSize", UintegerValue (1000));
21.142 + client->SetAttribute ("RemoteAddress", AddressValue (ueIpIface.GetAddress (0)));
21.143 + pgwNode->AddApplication (client);
21.144 +
21.145 + apps.Add (client);
21.146 + apps.Start (Seconds (1.0));
21.147 +
21.148 + Simulator::Stop (Seconds (2.0));
21.149 + Simulator::Run ();
21.150 +
21.151 + m_actualCellId = ueDev->GetRrc ()->GetCellId ();
21.152 +
21.153 + Simulator::Destroy ();
21.154 + return 8e-6 * sink->GetTotalRx ();
21.155 +}
21.156 +
21.157 +void
21.158 +LteAggregationThroughputScaleTestCase::DoRun ()
21.159 +{
21.160 + std::vector<double> throughputs;
21.161 + for (uint8_t i = 1; i <= 4; i++)
21.162 + {
21.163 + throughputs.push_back (GetThroughput (i) / i);
21.164 + NS_TEST_ASSERT_MSG_EQ (m_expectedCellId, m_actualCellId, "UE has attached to an unexpected cell");
21.165 + }
21.166 + double average = std::accumulate(begin (throughputs), end (throughputs), 0.0) / throughputs.size ();
21.167 + for (double throughput: throughputs)
21.168 + {
21.169 + NS_TEST_ASSERT_MSG_EQ_TOL (throughput, average, average * 0.01, "Throughput does not scale with number of component carriers");
21.170 + }
21.171 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/src/lte/test/lte-test-aggregation-throughput-scale.h Thu Jul 20 13:06:57 2017 +0300
22.3 @@ -0,0 +1,70 @@
22.4 +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
22.5 +/*
22.6 + * Copyright (c) 2017 Alexander Krotov
22.7 + *
22.8 + * This program is free software; you can redistribute it and/or modify
22.9 + * it under the terms of the GNU General Public License version 2 as
22.10 + * published by the Free Software Foundation;
22.11 + *
22.12 + * This program is distributed in the hope that it will be useful,
22.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
22.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22.15 + * GNU General Public License for more details.
22.16 + *
22.17 + * You should have received a copy of the GNU General Public License
22.18 + * along with this program; if not, write to the Free Software
22.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22.20 + *
22.21 + * Author: Alexander Krotov <krotov@iitp.ru>
22.22 + *
22.23 + */
22.24 +
22.25 +#ifndef LTE_AGGREGATION_THROUGHPUT_SCALE_H
22.26 +#define LTE_AGGREGATION_THROUGHPUT_SCALE_H
22.27 +
22.28 +#include <ns3/test.h>
22.29 +
22.30 +using namespace ns3;
22.31 +
22.32 +/**
22.33 + * \brief Test suite for executing carrier aggregation throughput scaling test case.
22.34 + *
22.35 + * \sa ns3::LteAggregationThroughputScaleTestCase
22.36 + */
22.37 +class LteAggregationThroughputScaleTestSuite : public TestSuite
22.38 +{
22.39 +public:
22.40 + LteAggregationThroughputScaleTestSuite ();
22.41 +};
22.42 +
22.43 +/**
22.44 + * \ingroup lte
22.45 + *
22.46 + * \brief Testing that UE throughput scales linearly with number of component carriers.
22.47 + * Also attaches UE to last component carrier to make sure no code assumes
22.48 + * that primary carrier is first.
22.49 + */
22.50 +class LteAggregationThroughputScaleTestCase : public TestCase
22.51 +{
22.52 +public:
22.53 + /**
22.54 + * \brief Creates an instance of the carrier aggregation throughput scaling test case.
22.55 + * \param name name of this test
22.56 + */
22.57 + LteAggregationThroughputScaleTestCase (std::string name);
22.58 +
22.59 + virtual ~LteAggregationThroughputScaleTestCase ();
22.60 +
22.61 +private:
22.62 + /**
22.63 + * \brief Setup the simulation, run it, and verify the result.
22.64 + */
22.65 + virtual void DoRun ();
22.66 +
22.67 + double GetThroughput (uint8_t numberOfComponentCarriers);
22.68 +
22.69 + uint16_t m_expectedCellId; //< Cell ID UE is expected to attach to
22.70 + uint16_t m_actualCellId; //< Cell ID UE has attached to
22.71 +};
22.72 +
22.73 +#endif /* LTE_AGGREGATION_THROUGHPUT_SCALE_H */
23.1 --- a/src/lte/test/lte-test-carrier-aggregation.cc Wed Jul 19 15:19:46 2017 +0300
23.2 +++ b/src/lte/test/lte-test-carrier-aggregation.cc Thu Jul 20 13:06:57 2017 +0300
23.3 @@ -289,6 +289,14 @@
23.4
23.5 lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
23.6
23.7 + auto cch = CreateObject<CcHelper> ();
23.8 + cch->SetDlEarfcn (100); // Same as default value for LteEnbNetDevice
23.9 + cch->SetUlEarfcn (100 + 18000); // Same as default value for LteEnbNetDevice
23.10 + cch->SetDlBandwidth (m_dlBandwidth);
23.11 + cch->SetUlBandwidth (m_ulBandwidth);
23.12 + cch->SetNumberOfComponentCarriers (m_numberOfComponentCarriers);
23.13 + lteHelper->SetCcPhyParams (cch->EquallySpacedCcs ());
23.14 +
23.15 // Create Nodes: eNodeB and UE
23.16 NodeContainer enbNodes;
23.17 NodeContainer ueNodes;
24.1 --- a/src/lte/test/lte-test-pathloss-model.cc Wed Jul 19 15:19:46 2017 +0300
24.2 +++ b/src/lte/test/lte-test-pathloss-model.cc Thu Jul 20 13:06:57 2017 +0300
24.3 @@ -214,6 +214,7 @@
24.4
24.5 // set frequency. This is important because it changes the behavior of the path loss model
24.6 lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (200));
24.7 + lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18200));
24.8 lteHelper->SetUeDeviceAttribute ("DlEarfcn", UintegerValue (200));
24.9
24.10 // remove shadowing component
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/src/lte/test/lte-test-secondary-cell-selection.cc Thu Jul 20 13:06:57 2017 +0300
25.3 @@ -0,0 +1,199 @@
25.4 +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
25.5 +/*
25.6 + * Copyright (c) 2017 Alexander Krotov
25.7 + *
25.8 + * This program is free software; you can redistribute it and/or modify
25.9 + * it under the terms of the GNU General Public License version 2 as
25.10 + * published by the Free Software Foundation;
25.11 + *
25.12 + * This program is distributed in the hope that it will be useful,
25.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
25.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25.15 + * GNU General Public License for more details.
25.16 + *
25.17 + * You should have received a copy of the GNU General Public License
25.18 + * along with this program; if not, write to the Free Software
25.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25.20 + *
25.21 + * Author: Alexander Krotov <krotov@iitp.ru>
25.22 + *
25.23 + */
25.24 +
25.25 +#include "lte-test-secondary-cell-selection.h"
25.26 +
25.27 +#include <ns3/boolean.h>
25.28 +#include <ns3/double.h>
25.29 +#include <ns3/integer.h>
25.30 +#include <ns3/log.h>
25.31 +#include <ns3/simulator.h>
25.32 +
25.33 +#include <ns3/internet-stack-helper.h>
25.34 +#include <ns3/ipv4-address-helper.h>
25.35 +#include <ns3/ipv4-interface-container.h>
25.36 +#include <ns3/friis-spectrum-propagation-loss.h>
25.37 +#include <ns3/ipv4-static-routing-helper.h>
25.38 +#include <ns3/lte-enb-net-device.h>
25.39 +#include <ns3/lte-helper.h>
25.40 +#include <ns3/lte-ue-net-device.h>
25.41 +#include <ns3/lte-ue-rrc.h>
25.42 +#include <ns3/mobility-helper.h>
25.43 +#include <ns3/net-device-container.h>
25.44 +#include <ns3/node-container.h>
25.45 +#include <ns3/point-to-point-epc-helper.h>
25.46 +#include <ns3/point-to-point-helper.h>
25.47 +
25.48 +using namespace ns3;
25.49 +
25.50 +NS_LOG_COMPONENT_DEFINE ("LteSecondaryCellSelectionTest");
25.51 +
25.52 +/*
25.53 + * Test Suite
25.54 + */
25.55 +
25.56 +LteSecondaryCellSelectionTestSuite::LteSecondaryCellSelectionTestSuite ()
25.57 + : TestSuite ("lte-secondary-cell-selection", SYSTEM)
25.58 +{
25.59 + // REAL RRC PROTOCOL
25.60 +
25.61 + AddTestCase (new LteSecondaryCellSelectionTestCase ("EPC, real RRC, RngRun=1", false, 1, 2), TestCase::QUICK);
25.62 + AddTestCase (new LteSecondaryCellSelectionTestCase ("EPC, real RRC, RngRun=1", false, 1, 4), TestCase::QUICK);
25.63 +
25.64 + // IDEAL RRC PROTOCOL
25.65 +
25.66 + AddTestCase (new LteSecondaryCellSelectionTestCase ("EPC, ideal RRC, RngRun=1", true, 1, 2), TestCase::QUICK);
25.67 + AddTestCase (new LteSecondaryCellSelectionTestCase ("EPC, ideal RRC, RngRun=1", true, 1, 4), TestCase::QUICK);
25.68 +
25.69 +} // end of LteSecondaryCellSelectionTestSuite::LteSecondaryCellSelectionTestSuite ()
25.70 +
25.71 +static LteSecondaryCellSelectionTestSuite g_lteSecondaryCellSelectionTestSuite;
25.72 +
25.73 +/*
25.74 + * Test Case
25.75 + */
25.76 +
25.77 +LteSecondaryCellSelectionTestCase::LteSecondaryCellSelectionTestCase (
25.78 + std::string name, bool isIdealRrc, int64_t rngRun, uint8_t numberOfComponentCarriers)
25.79 + : TestCase (name),
25.80 + m_isIdealRrc (isIdealRrc),
25.81 + m_rngRun (rngRun),
25.82 + m_numberOfComponentCarriers (numberOfComponentCarriers)
25.83 +{
25.84 + NS_LOG_FUNCTION (this << GetName ());
25.85 +}
25.86 +
25.87 +
25.88 +LteSecondaryCellSelectionTestCase::~LteSecondaryCellSelectionTestCase ()
25.89 +{
25.90 + NS_LOG_FUNCTION (this << GetName ());
25.91 +}
25.92 +
25.93 +void
25.94 +LteSecondaryCellSelectionTestCase::DoRun ()
25.95 +{
25.96 + NS_LOG_FUNCTION (this << GetName ());
25.97 +
25.98 + Config::SetGlobal ("RngRun", IntegerValue (m_rngRun));
25.99 +
25.100 + // Create helpers.
25.101 + auto lteHelper = CreateObject<LteHelper> ();
25.102 + lteHelper->SetAttribute ("PathlossModel", TypeIdValue (ns3::FriisSpectrumPropagationLossModel::GetTypeId ()));
25.103 + lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (m_isIdealRrc));
25.104 + lteHelper->SetAttribute ("NumberOfComponentCarriers", UintegerValue (m_numberOfComponentCarriers));
25.105 +
25.106 + auto epcHelper = CreateObject<PointToPointEpcHelper> ();
25.107 + lteHelper->SetEpcHelper (epcHelper);
25.108 +
25.109 + auto cch = CreateObject<CcHelper> ();
25.110 + cch->SetUlEarfcn (100 + 18000);
25.111 + cch->SetDlEarfcn (100);
25.112 + cch->SetUlBandwidth (25);
25.113 + cch->SetDlBandwidth (25);
25.114 + cch->SetNumberOfComponentCarriers (m_numberOfComponentCarriers);
25.115 +
25.116 + const auto ccm = cch->EquallySpacedCcs ();
25.117 + lteHelper->SetCcPhyParams (ccm);
25.118 +
25.119 + // Create nodes.
25.120 + auto enbNode = CreateObject<Node> ();
25.121 + NodeContainer ueNodes;
25.122 + ueNodes.Create (m_numberOfComponentCarriers);
25.123 +
25.124 + MobilityHelper mobility;
25.125 + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
25.126 + mobility.Install (enbNode);
25.127 + mobility.Install (ueNodes);
25.128 +
25.129 + // Physical layer.
25.130 + auto enbDev = DynamicCast<LteEnbNetDevice> (lteHelper->InstallEnbDevice (enbNode).Get (0));
25.131 + auto ueDevs = lteHelper->InstallUeDevice (ueNodes);
25.132 +
25.133 + // Network layer.
25.134 + InternetStackHelper internet;
25.135 + internet.Install (ueNodes);
25.136 + epcHelper->AssignUeIpv4Address (ueDevs);
25.137 +
25.138 + for (auto &it: ccm)
25.139 + {
25.140 + std::cerr << "Assign " << it.second.GetDlEarfcn () << std::endl;
25.141 + DynamicCast<LteUeNetDevice> (ueDevs.Get (it.first))->SetDlEarfcn (it.second.GetDlEarfcn ());
25.142 + }
25.143 +
25.144 + // Enable Idle mode cell selection.
25.145 + lteHelper->Attach (ueDevs);
25.146 +
25.147 + // Connect to trace sources in UEs
25.148 + Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
25.149 + MakeCallback (&LteSecondaryCellSelectionTestCase::StateTransitionCallback,
25.150 + this));
25.151 + Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/InitialSecondaryCellSelectionEndOk",
25.152 + MakeCallback (&LteSecondaryCellSelectionTestCase::InitialSecondaryCellSelectionEndOkCallback,
25.153 + this));
25.154 + Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
25.155 + MakeCallback (&LteSecondaryCellSelectionTestCase::ConnectionEstablishedCallback,
25.156 + this));
25.157 +
25.158 + // Run simulation.
25.159 + Simulator::Stop (Seconds (2.0));
25.160 + Simulator::Run ();
25.161 +
25.162 + for (auto &it: enbDev->GetCcMap ())
25.163 + {
25.164 + auto ueDev = DynamicCast<LteUeNetDevice> (ueDevs.Get (it.first));
25.165 + uint16_t expectedCellId = it.second->GetCellId ();
25.166 + uint16_t actualCellId = ueDev->GetRrc ()->GetCellId ();
25.167 + NS_TEST_ASSERT_MSG_EQ (expectedCellId, actualCellId, "IMSI " << ueDev->GetImsi () << " has attached to an unexpected cell");
25.168 +
25.169 + NS_TEST_ASSERT_MSG_EQ (m_lastState.at (ueDev->GetImsi ()),
25.170 + LteUeRrc::CONNECTED_NORMALLY,
25.171 + "UE " << ueDev->GetImsi ()
25.172 + << " is not at CONNECTED_NORMALLY state");
25.173 + }
25.174 +
25.175 + // Destroy simulator.
25.176 + Simulator::Destroy ();
25.177 +} // end of void LteSecondaryCellSelectionTestCase::DoRun ()
25.178 +
25.179 +
25.180 +void
25.181 +LteSecondaryCellSelectionTestCase::StateTransitionCallback (
25.182 + std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti,
25.183 + LteUeRrc::State oldState, LteUeRrc::State newState)
25.184 +{
25.185 + NS_LOG_FUNCTION (this << imsi << cellId << rnti << oldState << newState);
25.186 + m_lastState[imsi] = newState;
25.187 +}
25.188 +
25.189 +
25.190 +void
25.191 +LteSecondaryCellSelectionTestCase::InitialSecondaryCellSelectionEndOkCallback (
25.192 + std::string context, uint64_t imsi, uint16_t cellId)
25.193 +{
25.194 + NS_LOG_FUNCTION (this << imsi << cellId);
25.195 +}
25.196 +
25.197 +void
25.198 +LteSecondaryCellSelectionTestCase::ConnectionEstablishedCallback (
25.199 + std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
25.200 +{
25.201 + NS_LOG_FUNCTION (this << imsi << cellId << rnti);
25.202 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/src/lte/test/lte-test-secondary-cell-selection.h Thu Jul 20 13:06:57 2017 +0300
26.3 @@ -0,0 +1,115 @@
26.4 +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
26.5 +/*
26.6 + * Copyright (c) 2017 Alexander Krotov
26.7 + *
26.8 + * This program is free software; you can redistribute it and/or modify
26.9 + * it under the terms of the GNU General Public License version 2 as
26.10 + * published by the Free Software Foundation;
26.11 + *
26.12 + * This program is distributed in the hope that it will be useful,
26.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26.15 + * GNU General Public License for more details.
26.16 + *
26.17 + * You should have received a copy of the GNU General Public License
26.18 + * along with this program; if not, write to the Free Software
26.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26.20 + *
26.21 + * Author: Alexander Krotov <krotov@iitp.ru>
26.22 + *
26.23 + */
26.24 +
26.25 +#ifndef LTE_TEST_SECONDARY_CELL_SELECTION_H
26.26 +#define LTE_TEST_SECONDARY_CELL_SELECTION_H
26.27 +
26.28 +#include <ns3/test.h>
26.29 +#include <ns3/nstime.h>
26.30 +#include <ns3/node-container.h>
26.31 +#include <ns3/vector.h>
26.32 +#include <ns3/lte-ue-rrc.h>
26.33 +#include <vector>
26.34 +
26.35 +using namespace ns3;
26.36 +
26.37 +/**
26.38 + * \brief Test suite for executing the secondary cell selection test cases.
26.39 + *
26.40 + * \sa ns3::LteSecondaryCellSelectionTestCase
26.41 + */
26.42 +class LteSecondaryCellSelectionTestSuite : public TestSuite
26.43 +{
26.44 +public:
26.45 + LteSecondaryCellSelectionTestSuite ();
26.46 +};
26.47 +
26.48 +
26.49 +
26.50 +
26.51 +/**
26.52 + * \ingroup lte
26.53 + *
26.54 + * \brief Testing the initial cell selection procedure by UE at IDLE state in
26.55 + * the beginning of simulation with multiple component carriers.
26.56 + */
26.57 +class LteSecondaryCellSelectionTestCase : public TestCase
26.58 +{
26.59 +public:
26.60 + /**
26.61 + * \brief Creates an instance of the initial cell selection test case.
26.62 + * \param name name of this test
26.63 + * \param isIdealRrc if true, simulation uses Ideal RRC protocol, otherwise
26.64 + * simulation uses Real RRC protocol
26.65 + * \param rngRun the number of run to be used by the random number generator
26.66 + * \param numberOfComponentCarriers number of component carriers
26.67 + */
26.68 + LteSecondaryCellSelectionTestCase (std::string name, bool isIdealRrc, int64_t rngRun, uint8_t numberOfComponentCarriers);
26.69 +
26.70 + virtual ~LteSecondaryCellSelectionTestCase ();
26.71 +
26.72 +private:
26.73 + /**
26.74 + * \brief Setup the simulation according to the configuration set by the
26.75 + * class constructor, run it, and verify the result.
26.76 + */
26.77 + virtual void DoRun ();
26.78 +
26.79 + /**
26.80 + * \brief State transition callback function
26.81 + * \param context the context string
26.82 + * \param imsi the IMSI
26.83 + * \param cellId the cell ID
26.84 + * \param rnti the RNTI
26.85 + * \param oldState the old state
26.86 + * \param newState the new state
26.87 + */
26.88 + void StateTransitionCallback (std::string context, uint64_t imsi,
26.89 + uint16_t cellId, uint16_t rnti,
26.90 + LteUeRrc::State oldState, LteUeRrc::State newState);
26.91 + /**
26.92 + * \brief Initial cell selection end ok callback function
26.93 + * \param context the context string
26.94 + * \param imsi the IMSI
26.95 + * \param cellId the cell ID
26.96 + */
26.97 + void InitialSecondaryCellSelectionEndOkCallback (std::string context, uint64_t imsi,
26.98 + uint16_t cellId);
26.99 + /**
26.100 + * \brief Connection established callback function
26.101 + * \param context the context string
26.102 + * \param imsi the IMSI
26.103 + * \param cellId the cell ID
26.104 + * \param rnti the RNTI
26.105 + */
26.106 + void ConnectionEstablishedCallback (std::string context, uint64_t imsi,
26.107 + uint16_t cellId, uint16_t rnti);
26.108 +
26.109 + bool m_isIdealRrc; ///< whether the LTE is configured to use ideal RRC
26.110 + int64_t m_rngRun; ///< rng run
26.111 + uint8_t m_numberOfComponentCarriers; ///< number of component carriers
26.112 +
26.113 + /// The current UE RRC state.
26.114 + std::map<uint64_t, LteUeRrc::State> m_lastState;
26.115 +
26.116 +}; // end of class LteSecondaryCellSelectionTestCase
26.117 +
26.118 +#endif /* LTE_TEST_SECONDARY_CELL_SELECTION_H */
27.1 --- a/src/lte/test/test-lte-handover-delay.cc Wed Jul 19 15:19:46 2017 +0300
27.2 +++ b/src/lte/test/test-lte-handover-delay.cc Thu Jul 20 13:06:57 2017 +0300
27.3 @@ -16,6 +16,7 @@
27.4 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27.5 *
27.6 * Author: Budiarto Herman <budiarto.herman@magister.fi>
27.7 + * Alexander Krotov <krotov@iitp.ru>
27.8 */
27.9
27.10 #include <ns3/test.h>
27.11 @@ -67,9 +68,10 @@
27.12 * \param delayThreshold the delay threshold
27.13 * \param simulationDuration duration of the simulation
27.14 */
27.15 - LteHandoverDelayTestCase (bool useIdealRrc, Time handoverTime,
27.16 + LteHandoverDelayTestCase (uint8_t numberOfComponentCarriers, bool useIdealRrc, Time handoverTime,
27.17 Time delayThreshold, Time simulationDuration)
27.18 : TestCase ("Verifying that the time needed for handover is under a specified threshold"),
27.19 + m_numberOfComponentCarriers (numberOfComponentCarriers),
27.20 m_useIdealRrc (useIdealRrc),
27.21 m_handoverTime (handoverTime),
27.22 m_delayThreshold (delayThreshold),
27.23 @@ -120,6 +122,7 @@
27.24 void EnbHandoverEndOkCallback (std::string context, uint64_t imsi,
27.25 uint16_t cellid, uint16_t rnti);
27.26
27.27 + uint8_t m_numberOfComponentCarriers;
27.28 bool m_useIdealRrc; ///< use ideal RRC?
27.29 Time m_handoverTime; ///< handover time
27.30 Time m_delayThreshold; ///< the delay threshold
27.31 @@ -136,59 +139,38 @@
27.32 NS_LOG_INFO ("-----test case: ideal RRC = " << m_useIdealRrc
27.33 << " handover time = " << m_handoverTime.GetSeconds () << "-----");
27.34
27.35 - Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
27.36 - Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
27.37 + /*
27.38 + * Helpers.
27.39 + */
27.40 + auto epcHelper = CreateObject<PointToPointEpcHelper> ();
27.41 +
27.42 + auto lteHelper = CreateObject<LteHelper> ();
27.43 lteHelper->SetEpcHelper (epcHelper);
27.44 - lteHelper->SetAttribute ("UseIdealRrc", BooleanValue(m_useIdealRrc));
27.45 + lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (m_useIdealRrc));
27.46 + lteHelper->SetAttribute ("NumberOfComponentCarriers", UintegerValue (m_numberOfComponentCarriers));
27.47
27.48 - // SETUP A REMOTE HOST
27.49 + auto ccHelper = CreateObject<CcHelper> ();
27.50 + ccHelper->SetUlEarfcn (100 + 18000);
27.51 + ccHelper->SetDlEarfcn (100);
27.52 + ccHelper->SetUlBandwidth (25);
27.53 + ccHelper->SetDlBandwidth (25);
27.54 + ccHelper->SetNumberOfComponentCarriers (m_numberOfComponentCarriers);
27.55
27.56 - NodeContainer remoteHosts;
27.57 - remoteHosts.Create (1);
27.58 - InternetStackHelper inetStackHelper;
27.59 - inetStackHelper.Install (remoteHosts);
27.60 -
27.61 - // SETUP POINT-TO-POINT CONNECTION BETWEEN REMOTE HOST AND EPC
27.62 -
27.63 - PointToPointHelper p2pHelper;
27.64 - p2pHelper.SetDeviceAttribute ("DataRate",
27.65 - DataRateValue (DataRate ("100Gb/s")));
27.66 - p2pHelper.SetDeviceAttribute ("Mtu", UintegerValue (1500));
27.67 - p2pHelper.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
27.68 -
27.69 - NetDeviceContainer inetDevs = p2pHelper.Install (epcHelper->GetPgwNode (),
27.70 - remoteHosts.Get (0));
27.71 -
27.72 - Ipv4AddressHelper addrHelper;
27.73 - addrHelper.SetBase ("10.1.1.0", "255.255.255.0");
27.74 - Ipv4InterfaceContainer inetIfs;
27.75 - inetIfs = addrHelper.Assign (inetDevs);
27.76 -
27.77 - // SETUP ROUTING
27.78 -
27.79 - Ipv4StaticRoutingHelper ipRoutingHelper;
27.80 - Ptr<Ipv4StaticRouting> remoteHostRouting =
27.81 - ipRoutingHelper.GetStaticRouting (remoteHosts.Get (0)->GetObject<Ipv4> ());
27.82 - remoteHostRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"),
27.83 - Ipv4Mask ("255.0.0.0"), 1);
27.84 -
27.85 - // CREATE NODES
27.86 -
27.87 - NodeContainer enbNodes;
27.88 - NodeContainer ueNodes;
27.89 - enbNodes.Create (2);
27.90 - ueNodes.Create (1);
27.91 -
27.92 - /**
27.93 + /*
27.94 + * Physical layer.
27.95 + *
27.96 * eNodeB 0 UE eNodeB 1
27.97 *
27.98 * x ----------------------- x ----------------------- x
27.99 * 500 m 500 m
27.100 */
27.101 + // Create nodes.
27.102 + NodeContainer enbNodes;
27.103 + enbNodes.Create (2);
27.104 + auto ueNode = CreateObject<Node> ();
27.105
27.106 - // SETUP MOBILITY
27.107 -
27.108 - Ptr<ListPositionAllocator> posAlloc = CreateObject<ListPositionAllocator> ();
27.109 + // Setup mobility
27.110 + auto posAlloc = CreateObject<ListPositionAllocator> ();
27.111 posAlloc->Add (Vector (0, 0, 0));
27.112 posAlloc->Add (Vector (1000, 0, 0));
27.113 posAlloc->Add (Vector (500, 0, 0));
27.114 @@ -197,30 +179,23 @@
27.115 mobilityHelper.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
27.116 mobilityHelper.SetPositionAllocator (posAlloc);
27.117 mobilityHelper.Install (enbNodes);
27.118 - mobilityHelper.Install (ueNodes);
27.119 + mobilityHelper.Install (ueNode);
27.120
27.121 - // SETUP LTE DEVICES
27.122 + /*
27.123 + * Link layer.
27.124 + */
27.125 + auto enbDevs = lteHelper->InstallEnbDevice (enbNodes);
27.126 + auto ueDev = lteHelper->InstallUeDevice (ueNode).Get (0);
27.127
27.128 - NetDeviceContainer enbDevs;
27.129 - NetDeviceContainer ueDevs;
27.130 - enbDevs = lteHelper->InstallEnbDevice (enbNodes);
27.131 - ueDevs = lteHelper->InstallUeDevice (ueNodes);
27.132 + /*
27.133 + * Network layer.
27.134 + */
27.135 + InternetStackHelper inetStackHelper;
27.136 + inetStackHelper.Install (ueNode);
27.137 + Ipv4InterfaceContainer ueIfs;
27.138 + ueIfs = epcHelper->AssignUeIpv4Address (ueDev);
27.139
27.140 - // SETUP INTERNET IN UE
27.141 -
27.142 - inetStackHelper.Install(ueNodes);
27.143 - Ipv4InterfaceContainer ueIfs;
27.144 - ueIfs = epcHelper->AssignUeIpv4Address (ueDevs);
27.145 -
27.146 - // SETUP DEFAULT GATEWAY FOR UE
27.147 -
27.148 - Ptr<Ipv4StaticRouting> ueStaticRouting =
27.149 - ipRoutingHelper.GetStaticRouting (ueNodes.Get (0)->GetObject<Ipv4> ());
27.150 - ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (),
27.151 - 1);
27.152 -
27.153 - // INSTALLING TRACES
27.154 -
27.155 + // Setup traces.
27.156 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverStart",
27.157 MakeCallback (&LteHandoverDelayTestCase::UeHandoverStartCallback, this));
27.158 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverEndOk",
27.159 @@ -231,15 +206,12 @@
27.160 Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/HandoverEndOk",
27.161 MakeCallback (&LteHandoverDelayTestCase::EnbHandoverEndOkCallback, this));
27.162
27.163 - // SIMULATION
27.164 + // Prepare handover.
27.165 + lteHelper->AddX2Interface (enbNodes);
27.166 + lteHelper->Attach (ueDev, enbDevs.Get(0));
27.167 + lteHelper->HandoverRequest (m_handoverTime, ueDev, enbDevs.Get (0), enbDevs.Get (1));
27.168
27.169 - lteHelper->AddX2Interface (enbNodes);
27.170 - lteHelper->Attach (ueDevs.Get(0), enbDevs.Get(0));
27.171 - lteHelper->HandoverRequest (m_handoverTime, ueDevs.Get (0), enbDevs.Get (0),
27.172 - enbDevs.Get (1));
27.173 - // disable error model in dl ctrl channel
27.174 - //Config::Set ("/NodeList/*/DeviceList/*/LteUePhy/DlSpectrumPhy/CtrlErrorModelEnabled",
27.175 - // BooleanValue (false));
27.176 + // Run simulation.
27.177 Simulator::Stop (m_simulationDuration);
27.178 Simulator::Run ();
27.179 Simulator::Destroy ();
27.180 @@ -318,7 +290,7 @@
27.181 {
27.182 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDuration
27.183 AddTestCase (
27.184 - new LteHandoverDelayTestCase (true, handoverTime, Seconds (0.005),
27.185 + new LteHandoverDelayTestCase (1, true, handoverTime, Seconds (0.005),
27.186 Seconds (0.200)), TestCase::QUICK);
27.187 }
27.188
27.189 @@ -329,7 +301,7 @@
27.190 {
27.191 // arguments: useIdealRrc, handoverTime, delayThreshold, simulationDuration
27.192 AddTestCase (
27.193 - new LteHandoverDelayTestCase (false, handoverTime, Seconds (0.020),
27.194 + new LteHandoverDelayTestCase (1, false, handoverTime, Seconds (0.020),
27.195 Seconds (0.200)), TestCase::QUICK);
27.196 }
27.197 }
28.1 --- a/src/lte/wscript Wed Jul 19 15:19:46 2017 +0300
28.2 +++ b/src/lte/wscript Thu Jul 20 13:06:57 2017 +0300
28.3 @@ -178,6 +178,7 @@
28.4 'test/test-asn1-encoding.cc',
28.5 'test/lte-test-ue-measurements.cc',
28.6 'test/lte-test-cell-selection.cc',
28.7 + 'test/lte-test-secondary-cell-selection.cc',
28.8 'test/test-lte-handover-delay.cc',
28.9 'test/test-lte-handover-target.cc',
28.10 'test/lte-test-deactivate-bearer.cc',
28.11 @@ -189,6 +190,7 @@
28.12 'test/lte-test-cqi-generation.cc',
28.13 'test/lte-simple-spectrum-phy.cc',
28.14 'test/lte-test-carrier-aggregation.cc',
28.15 + 'test/lte-test-aggregation-throughput-scale.cc',
28.16 ]
28.17
28.18 headers = bld(features='ns3header')