A Discrete-Event Network Simulator
API
no-op-component-carrier-manager.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Danilo Abrignani
4  * Copyright (c) 2016 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Danilo Abrignani <danilo.abrignani@unibo.it>
20  * Biljana Bojovic <biljana.bojovic@cttc.es>
21  *
22  */
23 
25 #include <ns3/log.h>
26 #include <ns3/random-variable-stream.h>
27 
28 namespace ns3 {
29 
30 NS_LOG_COMPONENT_DEFINE ("NoOpComponentCarrierManager");
31 NS_OBJECT_ENSURE_REGISTERED (NoOpComponentCarrierManager);
32 
34 {
35  NS_LOG_FUNCTION (this);
39  m_ccmRrcSapUser = 0;
40 }
41 
43 {
44  NS_LOG_FUNCTION (this);
45 }
46 
47 void
49 {
50  NS_LOG_FUNCTION (this);
51  delete m_ccmRrcSapProvider;
52  delete m_ccmMacSapUser;
53  delete m_macSapProvider;
54 }
55 
56 
57 TypeId
59 {
60  static TypeId tid = TypeId ("ns3::NoOpComponentCarrierManager")
62  .SetGroupName("Lte")
63  .AddConstructor<NoOpComponentCarrierManager> ()
64  ;
65  return tid;
66 }
67 
68 
69 void
71 {
72  NS_LOG_FUNCTION (this);
74 }
75 
77 // MAC SAP
79 
80 
81 void
83 {
84  NS_LOG_FUNCTION (this);
85  std::map <uint8_t, LteMacSapProvider*>::iterator it = m_macSapProvidersMap.find (params.componentCarrierId);
86  NS_ASSERT_MSG (it != m_macSapProvidersMap.end (), "could not find Sap for ComponentCarrier " << params.componentCarrierId);
87  // with this algorithm all traffic is on Primary Carrier
88  it->second->TransmitPdu (params);
89 }
90 
91 void
93 {
94  NS_LOG_FUNCTION (this);
95  auto ueManager = m_ccmRrcSapUser->GetUeManager (params.rnti);
96  std::map <uint8_t, LteMacSapProvider*>::iterator it = m_macSapProvidersMap.find (ueManager->GetComponentCarrierId ());
97  NS_ASSERT_MSG (it != m_macSapProvidersMap.end (), "could not find Sap for ComponentCarrier ");
98  it->second->ReportBufferStatus (params);
99 }
100 
101 void
103 {
104  NS_LOG_FUNCTION (this);
105  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_ueAttached.find (txOpParams.rnti);
106  NS_ASSERT_MSG (rntiIt != m_ueAttached.end (), "could not find RNTI" << txOpParams.rnti);
107  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (txOpParams.lcid);
108  NS_ASSERT_MSG (lcidIt != rntiIt->second.end (), "could not find LCID " << (uint16_t) txOpParams.lcid);
109  NS_LOG_DEBUG (this << " rnti= " << txOpParams.rnti << " lcid= " << (uint32_t) txOpParams.lcid << " layer= " << (uint32_t)txOpParams.layer<<" ccId="<< (uint32_t)txOpParams.componentCarrierId);
110  (*lcidIt).second->NotifyTxOpportunity (txOpParams);
111 
112 }
113 
114 void
116 {
117  NS_LOG_FUNCTION (this);
118  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_ueAttached.find (rxPduParams.rnti);
119  NS_ASSERT_MSG (rntiIt != m_ueAttached.end (), "could not find RNTI" << rxPduParams.rnti);
120  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (rxPduParams.lcid);
121  if (lcidIt != rntiIt->second.end ())
122  {
123  (*lcidIt).second->ReceivePdu (rxPduParams);
124  }
125 }
126 
127 void
129 {
130  NS_LOG_FUNCTION (this);
131 }
132 
133 void
135  LteRrcSap::MeasResults measResults)
136 {
137  NS_LOG_FUNCTION (this << rnti << (uint16_t) measResults.measId);
138 }
139 
140 void
141 NoOpComponentCarrierManager::DoAddUe (uint16_t rnti, uint8_t state)
142 {
143  NS_LOG_FUNCTION (this << rnti << (uint16_t) state);
144  std::map<uint16_t, uint8_t>::iterator stateIt;
145  std::map<uint16_t, uint8_t>::iterator eccIt; // m_enabledComponentCarrier iterator
146  stateIt = m_ueState.find (rnti);
147  if (stateIt == m_ueState.end ())
148  {
149  // NS_ASSERT_MSG ((stateIt == m_ueState.end () && state == 3), " ERROR: Ue was not indexed and current state is CONNECTED_NORMALLY" << (uint16_t) state);
150  NS_LOG_DEBUG (this << " UE " << rnti << " was not found, now it is added in the map");
151  m_ueState.insert (std::pair<uint16_t, uint8_t> (rnti, state));
152  eccIt = m_enabledComponentCarrier.find (rnti);
153  //if ((state == 7 || state == 0) && eccIt == m_enabledComponentCarrier.end ())
154  if (eccIt == m_enabledComponentCarrier.end ())
155  {
156  // the Primary carrier (PC) is enabled by default
157  // on the PC the SRB0 and SRB1 are enabled when the Ue is connected
158  // these are hard-coded and the configuration not pass through the
159  // Component Carrier Manager which is responsible of configure
160  // only DataRadioBearer on the different Component Carrier
161  m_enabledComponentCarrier.insert (std::pair<uint16_t, uint8_t> (rnti, 1));
162  }
163  else
164  {
165  NS_FATAL_ERROR (this << " Ue " << rnti << " had Component Carrier enabled before join the network" << (uint16_t) state);
166  }
167  // preparing the rnti,lcid,LteMacSapUser map
168  std::map<uint8_t, LteMacSapUser*> empty;
169  std::pair <std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator, bool>
170  ret = m_ueAttached.insert (std::pair <uint16_t, std::map<uint8_t, LteMacSapUser*> >
171  (rnti, empty));
172  NS_LOG_DEBUG (this << "AddUe: UE Pointer LteMacSapUser Map " << rnti << " added " << (uint16_t) ret.second);
173  NS_ASSERT_MSG (ret.second, "element already present, RNTI already existed");
174 
175  //add new rnti in the map
176  std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> emptyA;
177  std::pair <std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator, bool>
178  retA = m_rlcLcInstantiated.insert (std::pair <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >
179  (rnti, emptyA));
180  NS_ASSERT_MSG (retA.second, "element already present, RNTI already existed");
181  NS_LOG_DEBUG (this << "AddUe: UE " << rnti << " added " << (uint16_t) retA.second);
182 
183  }
184  else
185  {
186  NS_LOG_DEBUG (this << " UE " << rnti << "found, updating the state from " << (uint16_t) stateIt->second << " to " << (uint16_t) state);
187  stateIt->second = state;
188  }
189 
190 
191 }
192 
193 void
195 {
196  NS_LOG_FUNCTION (this);
197  NS_ASSERT_MSG( m_rlcLcInstantiated.find(lcInfo.rnti) != m_rlcLcInstantiated.end(), "Adding lc for a user that was not yet added to component carrier manager list.");
198  m_rlcLcInstantiated.find(lcInfo.rnti)->second.insert(std::pair <uint8_t, LteEnbCmacSapProvider::LcInfo> (lcInfo.lcId, lcInfo));
199 }
200 
201 
202 void
204 {
205  NS_LOG_FUNCTION (this);
206  std::map<uint16_t, uint8_t>::iterator stateIt;
207  std::map<uint16_t, uint8_t>::iterator eccIt; // m_enabledComponentCarrier iterator
208  stateIt = m_ueState.find (rnti);
209  eccIt = m_enabledComponentCarrier.find (rnti);
210  NS_ASSERT_MSG (stateIt != m_ueState.end (), "request to remove UE info with unknown rnti ");
211  NS_ASSERT_MSG (eccIt != m_enabledComponentCarrier.end (), "request to remove UE info with unknown rnti ");
212 
213  //std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator lcsIt;
214  auto rlcLcIt = m_rlcLcInstantiated.find (rnti);
215  NS_ASSERT_MSG (rlcLcIt != m_rlcLcInstantiated.end (), "request to Release Data Radio Bearer on UE without Logical Channels enabled");
216 
217  auto rntiIt = m_ueAttached.find (rnti);
218 
219  NS_ASSERT_MSG (rntiIt != m_ueAttached.end (), "request to Release Data Radio Bearer on unattached UE");
220 
221  m_ueState.erase (rnti);
222  m_enabledComponentCarrier.erase (rnti);
223  m_rlcLcInstantiated.erase (rnti);
224  m_ueAttached.erase (rnti);
225 }
226 
227 std::vector<LteCcmRrcSapProvider::LcsConfig>
228 NoOpComponentCarrierManager::DoSetupDataRadioBearer (EpsBearer bearer, uint8_t bearerId, uint16_t rnti, uint8_t lcid, uint8_t lcGroup, LteMacSapUser *msu)
229 {
230  NS_LOG_FUNCTION (this << rnti);
231  std::map<uint16_t, uint8_t>::iterator eccIt; // m_enabledComponentCarrier iterator
232  eccIt = m_enabledComponentCarrier.find (rnti);
233  NS_ASSERT_MSG (eccIt != m_enabledComponentCarrier.end (), "SetupDataRadioBearer on unknown rnti ");
234 
235  // enable by default all carriers
236  eccIt->second = m_noOfComponentCarriers;
237 
238  std::vector<LteCcmRrcSapProvider::LcsConfig> res;
241  // NS_LOG_DEBUG (this << " componentCarrierEnabled " << (uint16_t) eccIt->second);
242  for (uint16_t ncc = 0; ncc < m_noOfComponentCarriers; ncc++)
243  {
244  // NS_LOG_DEBUG (this << " res size " << (uint16_t) res.size ());
246  lci.rnti = rnti;
247  lci.lcId = lcid;
248  lci.lcGroup = lcGroup;
249  lci.qci = bearer.qci;
250  if (ncc == 0)
251  {
252  lci.isGbr = bearer.IsGbr ();
253  lci.mbrUl = bearer.gbrQosInfo.mbrUl;
254  lci.mbrDl = bearer.gbrQosInfo.mbrDl;
255  lci.gbrUl = bearer.gbrQosInfo.gbrUl;
256  lci.gbrDl = bearer.gbrQosInfo.gbrDl;
257  }
258  else
259  {
260  lci.isGbr = 0;
261  lci.mbrUl = 0;
262  lci.mbrDl = 0;
263  lci.gbrUl = 0;
264  lci.gbrDl = 0;
265  } // data flows only on PC
266  NS_LOG_DEBUG (this << " RNTI " << lci.rnti << "Lcid " << (uint16_t) lci.lcId << " lcGroup " << (uint16_t) lci.lcGroup);
267  entry.componentCarrierId = ncc;
268  entry.lc = lci;
269  entry.msu = m_ccmMacSapUser;
270  res.push_back (entry);
271  } // end for
272 
273 
274  // preparing the rnti,lcid,LcInfo map
275  std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator rntiIter = m_rlcLcInstantiated.find (rnti);
276  rntiIter = m_rlcLcInstantiated.begin ();
277  // while (rntiIter != m_rlcLcInstantiated.end ())
278  // {
279  // ++rntiIter;
280  // }
281  // if (rntiIt == m_rlcLcInstantiated.end ())
282  // {
283  // //add new rnti in the map
284  // std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> empty;
285  // std::pair <std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator, bool>
286  // ret = m_rlcLcInstantiated.insert (std::pair <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >
287  // (rnti, empty));
288  // NS_LOG_DEBUG (this << " UE " << rnti << " added " << (uint16_t) ret.second);
289  // }
290 
291  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator sapIt = m_ueAttached.find (rnti);
292  NS_ASSERT_MSG (sapIt != m_ueAttached.end (), "RNTI not found");
293  rntiIter = m_rlcLcInstantiated.find (rnti);
294  std::map<uint8_t, LteEnbCmacSapProvider::LcInfo>::iterator lcidIt = rntiIter->second.find (lcid);
295  //std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = sapIt->second.find (lcinfo.lcId);
296  NS_ASSERT_MSG (rntiIter != m_rlcLcInstantiated.end (), "RNTI not found");
297  if (lcidIt == rntiIter->second.end ())
298  {
299  lcinfo.rnti = rnti;
300  lcinfo.lcId = lcid;
301  lcinfo.lcGroup = lcGroup;
302  lcinfo.qci = bearer.qci;
303  lcinfo.isGbr = bearer.IsGbr ();
304  lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
305  lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
306  lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
307  lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
308  rntiIter->second.insert (std::pair<uint8_t, LteEnbCmacSapProvider::LcInfo> (lcinfo.lcId, lcinfo));
309  sapIt->second.insert (std::pair<uint8_t, LteMacSapUser*> (lcinfo.lcId, msu));
310  }
311  else
312  {
313  NS_LOG_ERROR ("LC already exists");
314  }
315  return res;
316 
317 }
318 
319 std::vector<uint8_t>
321 {
322  NS_LOG_FUNCTION (this);
323  // here we receive directly the rnti and the lcid, instead of only drbid
324  // drbid are mapped as drbid = lcid + 2
325  std::map<uint16_t, uint8_t>::iterator eccIt; // m_enabledComponentCarrier iterator
326  eccIt= m_enabledComponentCarrier.find (rnti);
327  NS_ASSERT_MSG (eccIt != m_enabledComponentCarrier.end (), "request to Release Data Radio Bearer on Ue without Component Carrier Enabled");
328  std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator lcsIt;
329  lcsIt = m_rlcLcInstantiated.find (rnti);
330  NS_ASSERT_MSG (lcsIt != m_rlcLcInstantiated.end (), "request to Release Data Radio Bearer on Ue without Logical Channels enabled");
331  std::map<uint8_t, LteEnbCmacSapProvider::LcInfo>::iterator lcIt;
332  NS_LOG_DEBUG (this << " remove lcid " << (uint16_t) lcid << " for rnti " << rnti);
333  lcIt = lcsIt->second.find (lcid);
334  NS_ASSERT_MSG (lcIt != lcsIt->second.end (), " Logical Channel not found");
335  std::vector<uint8_t> res;
336  for (uint16_t i = 0; i < eccIt->second; i++)
337  {
338  res.insert (res.end (), i);
339  }
340  //Find user based on rnti and then erase lcid stored against the same
341  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_ueAttached.find (rnti);
342  rntiIt->second.erase (lcid);
343  std::map <uint16_t, std::map<uint8_t, LteEnbCmacSapProvider::LcInfo> >::iterator rlcInstancesIt = m_rlcLcInstantiated.find (rnti);
344  std::map<uint8_t, LteEnbCmacSapProvider::LcInfo>::iterator rclLcIt;
345  lcIt = rlcInstancesIt->second.find (lcid);
346  NS_ASSERT_MSG (lcIt != lcsIt->second.end (), " Erasing: Logical Channel not found");
347  lcsIt->second.erase (lcid);
348  return res;
349 }
350 
353 {
354  NS_LOG_FUNCTION (this);
355  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator itSapUserAtCcm;
356  itSapUserAtCcm = m_ueAttached.find (lcinfo.rnti);
357  NS_ASSERT_MSG (itSapUserAtCcm != m_ueAttached.end (), "request to Add a SignalBearer to unknown rnti");
358  std::map <uint16_t, std::map<uint8_t, LteMacSapUser*> >::iterator rntiIt = m_ueAttached.find (lcinfo.rnti);
359  NS_ASSERT_MSG (rntiIt != m_ueAttached.end (), "RNTI not found");
360  std::map<uint8_t, LteMacSapUser*>::iterator lcidIt = rntiIt->second.find (lcinfo.lcId);
361  if (lcidIt == rntiIt->second.end ())
362  {
363  rntiIt->second.insert (std::pair<uint8_t, LteMacSapUser*> (lcinfo.lcId, msu));
364  }
365  else
366  {
367  NS_LOG_ERROR ("LC already exists");
368  }
369 
370  return m_ccmMacSapUser;
371 }
372 
373 void
374 NoOpComponentCarrierManager::DoNotifyPrbOccupancy (double prbOccupancy, uint8_t componentCarrierId)
375 {
376  NS_LOG_FUNCTION (this);
377  NS_LOG_DEBUG ("Update PRB occupancy:"<<prbOccupancy<<" at carrier:"<< (uint32_t) componentCarrierId);
378  m_ccPrbOccupancy.insert(std::pair<uint8_t, double> (componentCarrierId, prbOccupancy));
379 }
380 
381 void
383 {
384  NS_LOG_FUNCTION (this);
385  NS_ASSERT_MSG (bsr.m_macCeType == MacCeListElement_s::BSR, "Received a Control Message not allowed " << bsr.m_macCeType);
386  if ( bsr.m_macCeType == MacCeListElement_s::BSR)
387  {
388  MacCeListElement_s newBsr;
389  newBsr.m_rnti = bsr.m_rnti;
390  newBsr.m_macCeType = bsr.m_macCeType;
391  newBsr.m_macCeValue.m_phr = bsr.m_macCeValue.m_phr;
393  newBsr.m_macCeValue.m_bufferStatus.resize (4);
394  for (uint16_t i = 0; i < 4; i++)
395  {
396  uint8_t bsrId = bsr.m_macCeValue.m_bufferStatus.at (i);
397  uint32_t buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
398  // here the buffer should be divide among the different sap
399  // since the buffer status report are compressed information
400  // it is needed to use BsrId2BufferSize to uncompress
401  // after the split over all component carriers is is needed to
402  // compress again the information to fit MacCeListEkement_s structure
403  // verify how many Component Carrier are enabled per UE
404  // in this simple code the BufferStatus will be notify only
405  // to the primary carrier component
407  }
408  auto sapIt = m_ccmMacSapProviderMap.find (componentCarrierId);
409  if (sapIt == m_ccmMacSapProviderMap.end ())
410  {
411  NS_FATAL_ERROR ("Sap not found in the CcmMacSapProviderMap");
412  }
413  else
414  {
415  // in the current implementation bsr in uplink is forwarded only to the primary carrier.
416  // above code demonstrates how to resize buffer status if more carriers are being used in future
417  sapIt->second->ReportMacCeToScheduler (newBsr);
418  }
419  }
420  else
421  {
422  NS_FATAL_ERROR ("Expected BSR type of message.");
423  }
424 }
425 
426 void
427 NoOpComponentCarrierManager::DoUlReceiveSr (uint16_t rnti, uint8_t componentCarrierId)
428 {
429  NS_LOG_FUNCTION (this);
430 
431  auto sapIt = m_ccmMacSapProviderMap.find (componentCarrierId);
432  NS_ABORT_MSG_IF (sapIt == m_ccmMacSapProviderMap.end (),
433  "Sap not found in the CcmMacSapProviderMap");
434 
435  sapIt->second->ReportSrToScheduler (rnti);
436 }
437 
438 
440 
442 
444 {
445  NS_LOG_FUNCTION (this);
446 
447 }
448 
450 {
451  NS_LOG_FUNCTION (this);
452 }
453 
454 TypeId
456 {
457  static TypeId tid = TypeId ("ns3::RrComponentCarrierManager")
459  .SetGroupName("Lte")
460  .AddConstructor<RrComponentCarrierManager> ()
461  ;
462  return tid;
463 }
464 
465 
466 void
468 {
469  NS_LOG_FUNCTION (this);
470 
471  NS_ASSERT_MSG( m_enabledComponentCarrier.find(params.rnti)!=m_enabledComponentCarrier.end(), " UE with provided RNTI not found. RNTI:"<<params.rnti);
472 
473  uint32_t numberOfCarriersForUe = m_enabledComponentCarrier.find (params.rnti)->second;
474  if (params.lcid == 0 || params.lcid == 1 || numberOfCarriersForUe == 1)
475  {
476  NS_LOG_INFO("Buffer status forwarded to the primary carrier.");
477  auto ueManager = m_ccmRrcSapUser->GetUeManager (params.rnti);
478  m_macSapProvidersMap.at (ueManager->GetComponentCarrierId ())->ReportBufferStatus (params);
479  }
480  else
481  {
482  params.retxQueueSize /= numberOfCarriersForUe;
483  params.txQueueSize /= numberOfCarriersForUe;
484  for ( uint16_t i = 0; i < numberOfCarriersForUe ; i++)
485  {
486  NS_ASSERT_MSG (m_macSapProvidersMap.find(i)!=m_macSapProvidersMap.end(), "Mac sap provider does not exist.");
487  m_macSapProvidersMap.find(i)->second->ReportBufferStatus(params);
488  }
489  }
490 }
491 
492 
493 void
495 {
496  NS_LOG_FUNCTION (this);
497  NS_ASSERT_MSG (componentCarrierId == 0, "Received BSR from a ComponentCarrier not allowed, ComponentCarrierId = " << componentCarrierId);
498  NS_ASSERT_MSG (bsr.m_macCeType == MacCeListElement_s::BSR, "Received a Control Message not allowed " << bsr.m_macCeType);
499 
500  // split traffic in uplink equally among carriers
501  uint32_t numberOfCarriersForUe = m_enabledComponentCarrier.find(bsr.m_rnti)->second;
502 
503  if ( bsr.m_macCeType == MacCeListElement_s::BSR)
504  {
505  MacCeListElement_s newBsr;
506  newBsr.m_rnti = bsr.m_rnti;
507  // mac control element type, values can be BSR, PHR, CRNTI
508  newBsr.m_macCeType = bsr.m_macCeType;
509  // the power headroom, 64 means no valid phr is available
510  newBsr.m_macCeValue.m_phr = bsr.m_macCeValue.m_phr;
511  // indicates that the CRNTI MAC CE was received. The value is not used.
513  // and value 64 means that the buffer status should not be updated
514  newBsr.m_macCeValue.m_bufferStatus.resize (4);
515  // always all 4 LCGs are present see 6.1.3.1 of 3GPP TS 36.321.
516  for (uint16_t i = 0; i < 4; i++)
517  {
518  uint8_t bsrStatusId = bsr.m_macCeValue.m_bufferStatus.at (i);
519  uint32_t bufferSize = BufferSizeLevelBsr::BsrId2BufferSize (bsrStatusId);
520  // here the buffer should be divide among the different sap
521  // since the buffer status report are compressed information
522  // it is needed to use BsrId2BufferSize to uncompress
523  // after the split over all component carriers is is needed to
524  // compress again the information to fit MacCeListElement_s structure
525  // verify how many Component Carrier are enabled per UE
526  newBsr.m_macCeValue.m_bufferStatus.at(i) = BufferSizeLevelBsr::BufferSize2BsrId (bufferSize/numberOfCarriersForUe);
527  }
528  // notify MAC of each component carrier that is enabled for this UE
529  for ( uint16_t i = 0; i < numberOfCarriersForUe ; i++)
530  {
531  NS_ASSERT_MSG (m_ccmMacSapProviderMap.find(i)!=m_ccmMacSapProviderMap.end(), "Mac sap provider does not exist.");
532  m_ccmMacSapProviderMap.find(i)->second->ReportMacCeToScheduler(newBsr);
533  }
534  }
535  else
536  {
537  auto ueManager = m_ccmRrcSapUser->GetUeManager (bsr.m_rnti);
538  m_ccmMacSapProviderMap.at (ueManager->GetComponentCarrierId ())->ReportMacCeToScheduler (bsr);
539  }
540 }
541 
542 void
543 RrComponentCarrierManager::DoUlReceiveSr(uint16_t rnti, uint8_t componentCarrierId)
544 {
545  NS_LOG_FUNCTION (this);
546  NS_UNUSED (componentCarrierId);
547  // split traffic in uplink equally among carriers
548  uint32_t numberOfCarriersForUe = m_enabledComponentCarrier.find (rnti)->second;
549 
550  m_ccmMacSapProviderMap.find (m_lastCcIdForSr)->second->ReportSrToScheduler (rnti);
551 
552  m_lastCcIdForSr++;
553  if (m_lastCcIdForSr > numberOfCarriersForUe - 1)
554  {
555  m_lastCcIdForSr = 0;
556  }
557 }
558 
559 } // end of namespace ns3
static uint8_t BufferSize2BsrId(uint32_t val)
Convert Buffer size to BSR ID.
Definition: lte-common.cc:191
static uint32_t BsrId2BufferSize(uint8_t val)
Convert BSR ID to buffer size.
Definition: lte-common.cc:184
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
enum ns3::EpsBearer::Qci qci
Qos class indicator.
bool IsGbr() const
Definition: eps-bearer.cc:119
GbrQosInformation gbrQosInfo
GBR QOS information.
Definition: eps-bearer.h:131
virtual Ptr< UeManager > GetUeManager(uint16_t rnti)=0
Get UE manager by RNTI.
The class implements Component Carrier Manager (CCM) that operates using the Component Carrier Manage...
std::map< uint16_t, uint8_t > m_enabledComponentCarrier
This map tells for each RNTI the number of enabled component carriers.
std::map< uint16_t, std::map< uint8_t, LteEnbCmacSapProvider::LcInfo > > m_rlcLcInstantiated
This map contains logical channel configuration per flow Id (rnti, lcid).
LteCcmRrcSapProvider * m_ccmRrcSapProvider
A pointer to the SAP interface of the CCM instance to receive API calls from the eNodeB RRC instance.
std::map< uint16_t, uint8_t > m_ueState
Map of RRC states per UE (rnti, state), e.g.
LteMacSapProvider * m_macSapProvider
A pointer to main SAP interface of the MAC instance, which is in this case handled by CCM.
std::map< uint8_t, LteMacSapProvider * > m_macSapProvidersMap
A map of pointers to real SAP interfaces of MAC instances.
std::map< uint8_t, LteCcmMacSapProvider * > m_ccmMacSapProviderMap
A map of pointers to the SAP interfaces of CCM instance that provides the CCM specific functionalitie...
std::map< uint16_t, std::map< uint8_t, LteMacSapUser * > > m_ueAttached
The map that contains the rnti, lcid, SAP of the RLC instance.
uint16_t m_noOfComponentCarriers
The number component of carriers that are supported by this eNb.
LteCcmMacSapUser * m_ccmMacSapUser
LteCcmMacSapUser is extended version of LteMacSapUser interface.
LteCcmRrcSapUser * m_ccmRrcSapUser
A pointer to SAP interface of RRC instance, i.e.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:96
The default component carrier manager that forwards all traffic, the uplink and the downlink,...
virtual LteMacSapUser * DoConfigureSignalBearer(LteEnbCmacSapProvider::LcInfo lcinfo, LteMacSapUser *msu)
Configure the signal bearer.
virtual void DoNotifyPrbOccupancy(double prbOccupancy, uint8_t componentCarrierId)
Function implements the function of the SAP interface of CCM instance which is used by MAC to notify ...
friend class MemberLteCcmRrcSapProvider< NoOpComponentCarrierManager >
allow MemberLteCcmRrcSapProvider<NoOpComponentCarrierManager> class friend access
virtual void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU.
virtual void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report buffer status.
virtual void DoAddLc(LteEnbCmacSapProvider::LcInfo lcInfo, LteMacSapUser *msu)
Add LC.
virtual void DoRemoveUe(uint16_t rnti)
Remove UE.
virtual void DoDispose()
Destructor implementation.
std::map< uint8_t, double > m_ccPrbOccupancy
The physical resource block occupancy per carrier.
virtual void DoAddUe(uint16_t rnti, uint8_t state)
Add UE.
virtual void DoNotifyTxOpportunity(LteMacSapUser::TxOpportunityParameters txOpParams)
Notify transmit opportunity.
virtual void DoUlReceiveSr(uint16_t rnti, uint8_t componentCarrierId)
Forward uplink SR to CCM, called by MAC through CCM SAP interface.
virtual void DoInitialize()
Initialize() implementation.
friend class MemberLteCcmMacSapUser< NoOpComponentCarrierManager >
allow MemberLteCcmMacSapUser<NoOpComponentCarrierManager> class friend access
virtual void DoUlReceiveMacCe(MacCeListElement_s bsr, uint8_t componentCarrierId)
Forwards uplink BSR to CCM, called by MAC through CCM SAP interface.
friend class EnbMacMemberLteMacSapProvider< NoOpComponentCarrierManager >
allow EnbMacMemberLteMacSapProvider<NoOpComponentCarrierManager> class friend access
virtual std::vector< uint8_t > DoReleaseDataRadioBearer(uint16_t rnti, uint8_t lcid)
Release data radio bearer.
virtual void DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams)
Receive PDU.
virtual std::vector< LteCcmRrcSapProvider::LcsConfig > DoSetupDataRadioBearer(EpsBearer bearer, uint8_t bearerId, uint16_t rnti, uint8_t lcid, uint8_t lcGroup, LteMacSapUser *msu)
Setup data radio bearer.
virtual void DoReportUeMeas(uint16_t rnti, LteRrcSap::MeasResults measResults)
Implementation of ReportUeMeas.
virtual void DoNotifyHarqDeliveryFailure()
Notify HARQ delivery failure.
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Component carrier manager implementation that splits traffic equally among carriers.
virtual void DoUlReceiveMacCe(MacCeListElement_s bsr, uint8_t componentCarrierId) override
Forwards uplink BSR to CCM, called by MAC through CCM SAP interface.
static TypeId GetTypeId()
Get the type ID.
virtual void DoUlReceiveSr(uint16_t rnti, uint8_t componentCarrierId) override
Forward uplink SR to CCM, called by MAC through CCM SAP interface.
uint8_t m_lastCcIdForSr
Last CCID to which a SR was routed.
virtual void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params) override
Report buffer status.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
make Callback use a separate empty type
Definition: empty.h:34
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:257
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint64_t gbrDl
Guaranteed Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:42
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
uint64_t mbrDl
Maximum Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:44
uint64_t mbrUl
Maximum Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:45
uint16_t componentCarrierId
component carrier ID
LteEnbCmacSapProvider::LcInfo lc
LC info.
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
uint64_t gbrUl
guaranteed bitrate in uplink
uint8_t qci
QoS Class Identifier.
uint64_t mbrDl
maximum bitrate in downlink
uint64_t mbrUl
maximum bitrate in uplink
uint8_t lcGroup
logical channel group
uint64_t gbrDl
guaranteed bitrate in downlink
uint8_t lcId
logical channel identifier
bool isGbr
true if the bearer is GBR, false if the bearer is NON-GBR
uint16_t rnti
C-RNTI identifying the UE.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:68
uint32_t txQueueSize
the current size of the RLC transmission queue
Definition: lte-mac-sap.h:71
uint32_t retxQueueSize
the current size of the RLC retransmission queue in bytes
Definition: lte-mac-sap.h:73
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-mac-sap.h:70
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:69
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:46
uint8_t componentCarrierId
the component carrier id corresponding to the sending Mac istance
Definition: lte-mac-sap.h:52
Parameters for LteMacSapUser::ReceivePdu.
Definition: lte-mac-sap.h:157
uint8_t lcid
the logical channel id
Definition: lte-mac-sap.h:177
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:176
Parameters for LteMacSapUser::NotifyTxOpportunity.
Definition: lte-mac-sap.h:104
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-mac-sap.h:133
uint8_t componentCarrierId
the component carrier id
Definition: lte-mac-sap.h:132
uint8_t layer
the layer of transmission (MIMO)
Definition: lte-mac-sap.h:130
uint8_t lcid
the logical channel id
Definition: lte-mac-sap.h:134
MeasResults structure.
Definition: lte-rrc-sap.h:679
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:680
See section 4.3.14 macCEListElement.
struct MacCeValue_u m_macCeValue
MAC CE value.
std::vector< uint8_t > m_bufferStatus
buffer status
uint8_t m_crnti
NRTI.