src/lte/model/pss-ff-mac-scheduler.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 10960 a9f5dbb766f0
child 11110 b6f6e368aa51
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     2
/*
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     4
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     8
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    13
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    17
 *
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    19
 * Modification: Dizhi Zhou <dizhi.zhou@gmail.com>    // modify codes related to downlink scheduler
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    20
 */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    21
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    22
#include <ns3/log.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    23
#include <ns3/pointer.h>
9658
2b77600c9031 use #include <ns3/math.h> in updated GSoC 2012 LTE schedulers
Nicola Baldo <nbaldo@cttc.es>
parents: 9657
diff changeset
    24
#include <ns3/math.h>
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    25
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    26
#include <ns3/simulator.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    27
#include <ns3/lte-amc.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    28
#include <ns3/pss-ff-mac-scheduler.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    29
#include <ns3/lte-vendor-specific-parameters.h>
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    30
#include <ns3/boolean.h>
9788
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
    31
#include <cfloat>
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    32
#include <set>
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    33
#include <ns3/string.h>
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    34
#include <algorithm>
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    35
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    36
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10960
diff changeset
    37
namespace ns3 {
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    38
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10960
diff changeset
    39
NS_LOG_COMPONENT_DEFINE ("PssFfMacScheduler");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    40
10680
ace43d9baa17 make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents: 10672
diff changeset
    41
static const int PssType0AllocationRbg[4] = {
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    42
  10,       // RGB size 1
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    43
  26,       // RGB size 2
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    44
  63,       // RGB size 3
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    45
  110       // RGB size 4
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    46
};  // see table 7.1.6.1-1 of 36.213
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    47
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    48
10652
dc18deba4502 [doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10498
diff changeset
    49
NS_OBJECT_ENSURE_REGISTERED (PssFfMacScheduler);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    50
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    51
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
    52
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    53
class PssSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    54
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    55
public:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    56
  PssSchedulerMemberCschedSapProvider (PssFfMacScheduler* scheduler);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    57
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    58
  // inherited from FfMacCschedSapProvider
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    59
  virtual void CschedCellConfigReq (const struct CschedCellConfigReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    60
  virtual void CschedUeConfigReq (const struct CschedUeConfigReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    61
  virtual void CschedLcConfigReq (const struct CschedLcConfigReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    62
  virtual void CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    63
  virtual void CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    64
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    65
private:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    66
  PssSchedulerMemberCschedSapProvider ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    67
  PssFfMacScheduler* m_scheduler;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    68
};
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    69
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    70
PssSchedulerMemberCschedSapProvider::PssSchedulerMemberCschedSapProvider ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    71
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    72
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    73
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    74
PssSchedulerMemberCschedSapProvider::PssSchedulerMemberCschedSapProvider (PssFfMacScheduler* scheduler) : m_scheduler (scheduler)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    75
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    76
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    77
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    78
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    79
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    80
PssSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    81
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    82
  m_scheduler->DoCschedCellConfigReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    83
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    84
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    85
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    86
PssSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    87
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    88
  m_scheduler->DoCschedUeConfigReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    89
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    90
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    91
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    92
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    93
PssSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    94
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    95
  m_scheduler->DoCschedLcConfigReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    96
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    97
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    98
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    99
PssSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   100
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   101
  m_scheduler->DoCschedLcReleaseReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   102
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   103
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   104
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   105
PssSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   106
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   107
  m_scheduler->DoCschedUeReleaseReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   108
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   109
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   110
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   111
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   112
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   113
class PssSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   114
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   115
public:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   116
  PssSchedulerMemberSchedSapProvider (PssFfMacScheduler* scheduler);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   117
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   118
  // inherited from FfMacSchedSapProvider
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   119
  virtual void SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   120
  virtual void SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   121
  virtual void SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   122
  virtual void SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   123
  virtual void SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   124
  virtual void SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   125
  virtual void SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   126
  virtual void SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   127
  virtual void SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   128
  virtual void SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   129
  virtual void SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   130
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   131
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   132
private:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   133
  PssSchedulerMemberSchedSapProvider ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   134
  PssFfMacScheduler* m_scheduler;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   135
};
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   136
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   137
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   138
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   139
PssSchedulerMemberSchedSapProvider::PssSchedulerMemberSchedSapProvider ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   140
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   141
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   142
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   143
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   144
PssSchedulerMemberSchedSapProvider::PssSchedulerMemberSchedSapProvider (PssFfMacScheduler* scheduler)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   145
  : m_scheduler (scheduler)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   146
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   147
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   148
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   149
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   150
PssSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   151
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   152
  m_scheduler->DoSchedDlRlcBufferReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   153
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   154
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   155
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   156
PssSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   157
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   158
  m_scheduler->DoSchedDlPagingBufferReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   159
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   160
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   161
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   162
PssSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   163
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   164
  m_scheduler->DoSchedDlMacBufferReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   165
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   166
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   167
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   168
PssSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   169
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   170
  m_scheduler->DoSchedDlTriggerReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   171
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   172
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   173
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   174
PssSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   175
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   176
  m_scheduler->DoSchedDlRachInfoReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   177
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   178
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   179
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   180
PssSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   181
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   182
  m_scheduler->DoSchedDlCqiInfoReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   183
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   184
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   185
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   186
PssSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   187
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   188
  m_scheduler->DoSchedUlTriggerReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   189
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   190
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   191
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   192
PssSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   193
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   194
  m_scheduler->DoSchedUlNoiseInterferenceReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   195
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   196
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   197
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   198
PssSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   199
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   200
  m_scheduler->DoSchedUlSrInfoReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   201
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   202
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   203
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   204
PssSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   205
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   206
  m_scheduler->DoSchedUlMacCtrlInfoReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   207
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   208
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   209
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   210
PssSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   211
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   212
  m_scheduler->DoSchedUlCqiInfoReq (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   213
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   214
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   215
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   216
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   217
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   218
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   219
PssFfMacScheduler::PssFfMacScheduler ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   220
  :   m_cschedSapUser (0),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   221
    m_schedSapUser (0),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   222
    m_timeWindow (99.0),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   223
    m_nextRntiUl (0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   224
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   225
  m_amc = CreateObject <LteAmc> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   226
  m_cschedSapProvider = new PssSchedulerMemberCschedSapProvider (this);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   227
  m_schedSapProvider = new PssSchedulerMemberSchedSapProvider (this);
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   228
  m_ffrSapProvider = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   229
  m_ffrSapUser = new MemberLteFfrSapUser<PssFfMacScheduler> (this);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   230
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   231
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   232
PssFfMacScheduler::~PssFfMacScheduler ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   233
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   234
  NS_LOG_FUNCTION (this);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   235
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   236
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   237
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   238
PssFfMacScheduler::DoDispose ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   239
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   240
  NS_LOG_FUNCTION (this);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   241
  m_dlHarqProcessesDciBuffer.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   242
  m_dlHarqProcessesTimer.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   243
  m_dlHarqProcessesRlcPduListBuffer.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   244
  m_dlInfoListBuffered.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   245
  m_ulHarqCurrentProcessId.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   246
  m_ulHarqProcessesStatus.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   247
  m_ulHarqProcessesDciBuffer.clear ();
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   248
  delete m_cschedSapProvider;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   249
  delete m_schedSapProvider;
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   250
  delete m_ffrSapUser;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   251
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   252
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   253
TypeId
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   254
PssFfMacScheduler::GetTypeId (void)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   255
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   256
  static TypeId tid = TypeId ("ns3::PssFfMacScheduler")
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   257
    .SetParent<FfMacScheduler> ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   258
    .AddConstructor<PssFfMacScheduler> ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   259
    .AddAttribute ("CqiTimerThreshold",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   260
                   "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   261
                   UintegerValue (1000),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   262
                   MakeUintegerAccessor (&PssFfMacScheduler::m_cqiTimersThreshold),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   263
                   MakeUintegerChecker<uint32_t> ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   264
    .AddAttribute ("PssFdSchedulerType",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   265
                   "FD scheduler in PSS (default value is PFsch)",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   266
                   StringValue ("PFsch"),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   267
                   MakeStringAccessor (&PssFfMacScheduler::m_fdSchedulerType),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   268
                   MakeStringChecker ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   269
    .AddAttribute ("nMux",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   270
                   "The number of UE selected by TD scheduler (default value is 0)",
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   271
                   UintegerValue (0),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   272
                   MakeUintegerAccessor (&PssFfMacScheduler::m_nMux),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   273
                   MakeUintegerChecker<uint32_t> ())
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   274
    .AddAttribute ("HarqEnabled",
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   275
                   "Activate/Deactivate the HARQ [by default is active].",
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   276
                   BooleanValue (true),
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   277
                   MakeBooleanAccessor (&PssFfMacScheduler::m_harqOn),
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   278
                   MakeBooleanChecker ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   279
    .AddAttribute ("UlGrantMcs",
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   280
                   "The MCS of the UL grant, must be [0..15] (default 0)",
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   281
                   UintegerValue (0),
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   282
                   MakeUintegerAccessor (&PssFfMacScheduler::m_ulGrantMcs),
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   283
                   MakeUintegerChecker<uint8_t> ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   284
  ;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   285
  return tid;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   286
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   287
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   288
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   289
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   290
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   291
PssFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   292
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   293
  m_cschedSapUser = s;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   294
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   295
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   296
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   297
PssFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   298
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   299
  m_schedSapUser = s;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   300
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   301
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   302
FfMacCschedSapProvider*
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   303
PssFfMacScheduler::GetFfMacCschedSapProvider ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   304
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   305
  return m_cschedSapProvider;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   306
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   307
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   308
FfMacSchedSapProvider*
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   309
PssFfMacScheduler::GetFfMacSchedSapProvider ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   310
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   311
  return m_schedSapProvider;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   312
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   313
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   314
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   315
PssFfMacScheduler::SetLteFfrSapProvider (LteFfrSapProvider* s)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   316
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   317
  m_ffrSapProvider = s;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   318
}
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   319
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   320
LteFfrSapUser*
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   321
PssFfMacScheduler::GetLteFfrSapUser ()
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   322
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   323
  return m_ffrSapUser;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   324
}
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   325
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   326
void
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   327
PssFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::CschedCellConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   328
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   329
  NS_LOG_FUNCTION (this);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   330
  // Read the subset of parameters used
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   331
  m_cschedCellConfig = params;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   332
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   333
  FfMacCschedSapUser::CschedUeConfigCnfParameters cnf;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   334
  cnf.m_result = SUCCESS;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   335
  m_cschedSapUser->CschedUeConfigCnf (cnf);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   336
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   337
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   338
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   339
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   340
PssFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::CschedUeConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   341
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   342
  NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   343
  std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   344
  if (it == m_uesTxMode.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   345
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   346
      m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   347
      // generate HARQ buffers
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   348
      m_dlHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   349
      DlHarqProcessesStatus_t dlHarqPrcStatus;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   350
      dlHarqPrcStatus.resize (8,0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   351
      m_dlHarqProcessesStatus.insert (std::pair <uint16_t, DlHarqProcessesStatus_t> (params.m_rnti, dlHarqPrcStatus));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   352
      DlHarqProcessesTimer_t dlHarqProcessesTimer;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   353
      dlHarqProcessesTimer.resize (8,0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   354
      m_dlHarqProcessesTimer.insert (std::pair <uint16_t, DlHarqProcessesTimer_t> (params.m_rnti, dlHarqProcessesTimer));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   355
      DlHarqProcessesDciBuffer_t dlHarqdci;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   356
      dlHarqdci.resize (8);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   357
      m_dlHarqProcessesDciBuffer.insert (std::pair <uint16_t, DlHarqProcessesDciBuffer_t> (params.m_rnti, dlHarqdci));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   358
      DlHarqRlcPduListBuffer_t dlHarqRlcPdu;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   359
      dlHarqRlcPdu.resize (2);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   360
      dlHarqRlcPdu.at (0).resize (8);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   361
      dlHarqRlcPdu.at (1).resize (8);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   362
      m_dlHarqProcessesRlcPduListBuffer.insert (std::pair <uint16_t, DlHarqRlcPduListBuffer_t> (params.m_rnti, dlHarqRlcPdu));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   363
      m_ulHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   364
      UlHarqProcessesStatus_t ulHarqPrcStatus;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   365
      ulHarqPrcStatus.resize (8,0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   366
      m_ulHarqProcessesStatus.insert (std::pair <uint16_t, UlHarqProcessesStatus_t> (params.m_rnti, ulHarqPrcStatus));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   367
      UlHarqProcessesDciBuffer_t ulHarqdci;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   368
      ulHarqdci.resize (8);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   369
      m_ulHarqProcessesDciBuffer.insert (std::pair <uint16_t, UlHarqProcessesDciBuffer_t> (params.m_rnti, ulHarqdci));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   370
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   371
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   372
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   373
      (*it).second = params.m_transmissionMode;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   374
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   375
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   376
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   377
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   378
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   379
PssFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   380
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   381
  NS_LOG_FUNCTION (this << " New LC, rnti: "  << params.m_rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   382
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   383
  std::map <uint16_t, pssFlowPerf_t>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   384
  for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   385
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   386
      it = m_flowStatsDl.find (params.m_rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   387
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   388
      if (it == m_flowStatsDl.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   389
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   390
          double tbrDlInBytes = params.m_logicalChannelConfigList.at (i).m_eRabGuaranteedBitrateDl / 8;   // byte/s
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   391
          double tbrUlInBytes = params.m_logicalChannelConfigList.at (i).m_eRabGuaranteedBitrateUl / 8;   // byte/s
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   392
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   393
          pssFlowPerf_t flowStatsDl;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   394
          flowStatsDl.flowStart = Simulator::Now ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   395
          flowStatsDl.totalBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   396
          flowStatsDl.lastTtiBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   397
          flowStatsDl.lastAveragedThroughput = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   398
          flowStatsDl.secondLastAveragedThroughput = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   399
          flowStatsDl.targetThroughput = tbrDlInBytes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   400
          m_flowStatsDl.insert (std::pair<uint16_t, pssFlowPerf_t> (params.m_rnti, flowStatsDl));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   401
          pssFlowPerf_t flowStatsUl;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   402
          flowStatsUl.flowStart = Simulator::Now ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   403
          flowStatsUl.totalBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   404
          flowStatsUl.lastTtiBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   405
          flowStatsUl.lastAveragedThroughput = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   406
          flowStatsUl.secondLastAveragedThroughput = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   407
          flowStatsUl.targetThroughput = tbrUlInBytes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   408
          m_flowStatsUl.insert (std::pair<uint16_t, pssFlowPerf_t> (params.m_rnti, flowStatsUl));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   409
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   410
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   411
        {
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9658
diff changeset
   412
          // update GBR from UeManager::SetupDataRadioBearer ()
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9658
diff changeset
   413
          double tbrDlInBytes = params.m_logicalChannelConfigList.at (i).m_eRabGuaranteedBitrateDl / 8;   // byte/s
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9658
diff changeset
   414
          double tbrUlInBytes = params.m_logicalChannelConfigList.at (i).m_eRabGuaranteedBitrateUl / 8;   // byte/s
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9658
diff changeset
   415
          m_flowStatsDl[(*it).first].targetThroughput = tbrDlInBytes;
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9658
diff changeset
   416
          m_flowStatsUl[(*it).first].targetThroughput = tbrUlInBytes;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   417
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   418
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   419
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   420
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   421
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   422
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   423
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   424
PssFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   425
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   426
  NS_LOG_FUNCTION (this);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   427
  for (uint16_t i = 0; i < params.m_logicalChannelIdentity.size (); i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   428
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   429
      std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   430
      std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   431
      while (it!=m_rlcBufferReq.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   432
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   433
          if (((*it).first.m_rnti == params.m_rnti) && ((*it).first.m_lcId == params.m_logicalChannelIdentity.at (i)))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   434
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   435
              temp = it;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   436
              it++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   437
              m_rlcBufferReq.erase (temp);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   438
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   439
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   440
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   441
              it++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   442
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   443
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   444
    }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   445
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   446
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   447
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   448
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   449
PssFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   450
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   451
  NS_LOG_FUNCTION (this);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   452
  
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   453
  m_uesTxMode.erase (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   454
  m_dlHarqCurrentProcessId.erase (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   455
  m_dlHarqProcessesStatus.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   456
  m_dlHarqProcessesTimer.erase (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   457
  m_dlHarqProcessesDciBuffer.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   458
  m_dlHarqProcessesRlcPduListBuffer.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   459
  m_ulHarqCurrentProcessId.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   460
  m_ulHarqProcessesStatus.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   461
  m_ulHarqProcessesDciBuffer.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   462
  m_flowStatsDl.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   463
  m_flowStatsUl.erase  (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   464
  m_ceBsrRxed.erase (params.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   465
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   466
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   467
  while (it!=m_rlcBufferReq.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   468
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   469
      if ((*it).first.m_rnti == params.m_rnti)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   470
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   471
          temp = it;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   472
          it++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   473
          m_rlcBufferReq.erase (temp);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   474
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   475
      else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   476
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   477
          it++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   478
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   479
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   480
  if (m_nextRntiUl == params.m_rnti)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   481
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   482
      m_nextRntiUl = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   483
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   484
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   485
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   486
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   487
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   488
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   489
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   490
PssFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   491
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   492
  NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   493
  // API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   494
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   495
  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   496
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   497
  LteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   498
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   499
  it =  m_rlcBufferReq.find (flow);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   500
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   501
  if (it == m_rlcBufferReq.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   502
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   503
      m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   504
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   505
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   506
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   507
      (*it).second = params;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   508
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   509
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   510
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   511
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   512
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   513
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   514
PssFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   515
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   516
  NS_LOG_FUNCTION (this);
9657
4ba3220bce18 re-applied fix for bug 1532 - unimplemented LTE Scheduler methods
Nicola Baldo <nbaldo@cttc.es>
parents: 9654
diff changeset
   517
  NS_FATAL_ERROR ("method not implemented");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   518
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   519
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   520
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   521
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   522
PssFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   523
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   524
  NS_LOG_FUNCTION (this);
9657
4ba3220bce18 re-applied fix for bug 1532 - unimplemented LTE Scheduler methods
Nicola Baldo <nbaldo@cttc.es>
parents: 9654
diff changeset
   525
  NS_FATAL_ERROR ("method not implemented");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   526
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   527
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   528
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   529
int
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   530
PssFfMacScheduler::GetRbgSize (int dlbandwidth)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   531
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   532
  for (int i = 0; i < 4; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   533
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   534
      if (dlbandwidth < PssType0AllocationRbg[i])
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   535
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   536
          return (i + 1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   537
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   538
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   539
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   540
  return (-1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   541
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   542
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   543
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   544
int
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   545
PssFfMacScheduler::LcActivePerFlow (uint16_t rnti)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   546
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   547
  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   548
  int lcActive = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   549
  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   550
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   551
      if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   552
                                           || ((*it).second.m_rlcRetransmissionQueueSize > 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   553
                                           || ((*it).second.m_rlcStatusPduSize > 0) ))
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   554
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   555
          lcActive++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   556
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   557
      if ((*it).first.m_rnti > rnti)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   558
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   559
          break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   560
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   561
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   562
  return (lcActive);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   563
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   564
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   565
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   566
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   567
uint8_t
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   568
PssFfMacScheduler::HarqProcessAvailability (uint16_t rnti)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   569
{
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   570
  NS_LOG_FUNCTION (this << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   571
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   572
  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   573
  if (it == m_dlHarqCurrentProcessId.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   574
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   575
      NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   576
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   577
  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   578
  if (itStat == m_dlHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   579
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   580
      NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   581
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   582
  uint8_t i = (*it).second;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   583
  do
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   584
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   585
      i = (i + 1) % HARQ_PROC_NUM;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   586
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   587
  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   588
  if ((*itStat).second.at (i) == 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   589
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   590
      return (true);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   591
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   592
  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   593
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   594
      return (false); // return a not valid harq proc id
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   595
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   596
}
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   597
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   598
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   599
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   600
uint8_t
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   601
PssFfMacScheduler::UpdateHarqProcessId (uint16_t rnti)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   602
{
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   603
  NS_LOG_FUNCTION (this << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   604
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   605
  if (m_harqOn == false)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   606
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   607
      return (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   608
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   609
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   610
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   611
  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   612
  if (it == m_dlHarqCurrentProcessId.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   613
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   614
      NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   615
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   616
  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   617
  if (itStat == m_dlHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   618
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   619
      NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   620
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   621
  uint8_t i = (*it).second;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   622
  do
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   623
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   624
      i = (i + 1) % HARQ_PROC_NUM;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   625
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   626
  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   627
  if ((*itStat).second.at (i) == 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   628
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   629
      (*it).second = i;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   630
      (*itStat).second.at (i) = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   631
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   632
  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   633
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   634
      NS_FATAL_ERROR ("No HARQ process available for RNTI " << rnti << " check before update with HarqProcessAvailability");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   635
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   636
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   637
  return ((*it).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   638
}
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   639
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   640
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   641
void
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   642
PssFfMacScheduler::RefreshHarqProcesses ()
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   643
{
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   644
  NS_LOG_FUNCTION (this);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   645
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   646
  std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itTimers;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   647
  for (itTimers = m_dlHarqProcessesTimer.begin (); itTimers != m_dlHarqProcessesTimer.end (); itTimers ++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   648
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   649
      for (uint16_t i = 0; i < HARQ_PROC_NUM; i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   650
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   651
          if ((*itTimers).second.at (i) == HARQ_DL_TIMEOUT)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   652
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   653
              // reset HARQ process
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   654
              
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   655
              NS_LOG_DEBUG (this << " Reset HARQ proc " << i << " for RNTI " << (*itTimers).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   656
              std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find ((*itTimers).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   657
              if (itStat == m_dlHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   658
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   659
                  NS_FATAL_ERROR ("No Process Id Status found for this RNTI " << (*itTimers).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   660
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   661
              (*itStat).second.at (i) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   662
              (*itTimers).second.at (i) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   663
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   664
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   665
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   666
              (*itTimers).second.at (i)++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   667
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   668
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   669
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   670
  
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   671
}
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   672
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   673
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   674
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   675
PssFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   676
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   677
  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   678
  // API generated by RLC for triggering the scheduling of a DL subframe
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   679
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   680
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   681
  // evaluate the relative channel quality indicator for each UE per each RBG
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   682
  // (since we are using allocation type 0 the small unit of allocation is RBG)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   683
  // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   684
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   685
  RefreshDlCqiMaps ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   686
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   687
  int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   688
  int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   689
  std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNTI
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   690
  std::vector <bool> rbgMap;  // global RBGs map
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   691
  uint16_t rbgAllocatedNum = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   692
  std::set <uint16_t> rntiAllocated;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   693
  rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false);
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   694
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   695
  rbgMap = m_ffrSapProvider->GetAvailableDlRbg ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   696
  for (std::vector<bool>::iterator it = rbgMap.begin (); it != rbgMap.end (); it++)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   697
    {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   698
      if ((*it) == true )
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   699
        {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   700
          rbgAllocatedNum++;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   701
        }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   702
    }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   703
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   704
  FfMacSchedSapUser::SchedDlConfigIndParameters ret;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   705
10449
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   706
  //   update UL HARQ proc id
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   707
  std::map <uint16_t, uint8_t>::iterator itProcId;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   708
  for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++)
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   709
    {
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   710
      (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   711
    }
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   712
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   713
  // RACH Allocation
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   714
  uint16_t rbAllocatedNum = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   715
  std::vector <bool> ulRbMap;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   716
  ulRbMap.resize (m_cschedCellConfig.m_ulBandwidth, false);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   717
  ulRbMap = m_ffrSapProvider->GetAvailableUlRbg ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   718
  uint8_t maxContinuousUlBandwidth = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   719
  uint8_t tmpMinBandwidth = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   720
  uint16_t ffrRbStartOffset = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   721
  uint16_t tmpFfrRbStartOffset = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   722
  uint16_t index = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   723
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   724
  for (std::vector<bool>::iterator it = ulRbMap.begin (); it != ulRbMap.end (); it++)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   725
    {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   726
      if ((*it) == true )
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   727
        {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   728
          rbAllocatedNum++;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   729
          if (tmpMinBandwidth > maxContinuousUlBandwidth)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   730
            {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   731
              maxContinuousUlBandwidth = tmpMinBandwidth;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   732
              ffrRbStartOffset = tmpFfrRbStartOffset;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   733
            }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   734
          tmpMinBandwidth = 0;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   735
        }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   736
      else
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   737
        {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   738
          if (tmpMinBandwidth == 0)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   739
            {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   740
              tmpFfrRbStartOffset = index;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   741
            }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   742
          tmpMinBandwidth++;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   743
        }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   744
      index++;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   745
    }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   746
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   747
  if (tmpMinBandwidth > maxContinuousUlBandwidth)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   748
    {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   749
      maxContinuousUlBandwidth = tmpMinBandwidth;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   750
      ffrRbStartOffset = tmpFfrRbStartOffset;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   751
    }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   752
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   753
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   754
  uint16_t rbStart = 0;
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   755
  rbStart = ffrRbStartOffset;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   756
  std::vector <struct RachListElement_s>::iterator itRach;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   757
  for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   758
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   759
      NS_ASSERT_MSG (m_amc->GetTbSizeFromMcs (m_ulGrantMcs, m_cschedCellConfig.m_ulBandwidth) > (*itRach).m_estimatedSize, " Default UL Grant MCS does not allow to send RACH messages");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   760
      BuildRarListElement_s newRar;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   761
      newRar.m_rnti = (*itRach).m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   762
      // DL-RACH Allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   763
      // Ideal: no needs of configuring m_dci
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   764
      // UL-RACH Allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   765
      newRar.m_grant.m_rnti = newRar.m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   766
      newRar.m_grant.m_mcs = m_ulGrantMcs;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   767
      uint16_t rbLen = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   768
      uint16_t tbSizeBits = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   769
      // find lowest TB size that fits UL grant estimated size
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   770
      while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < (ffrRbStartOffset + maxContinuousUlBandwidth)))
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   771
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   772
          rbLen++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   773
          tbSizeBits = m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   774
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   775
      if (tbSizeBits < (*itRach).m_estimatedSize)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   776
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   777
          // no more allocation space: finish allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   778
          break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   779
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   780
      newRar.m_grant.m_rbStart = rbStart;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   781
      newRar.m_grant.m_rbLen = rbLen;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   782
      newRar.m_grant.m_tbSize = tbSizeBits / 8;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   783
      newRar.m_grant.m_hopping = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   784
      newRar.m_grant.m_tpc = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   785
      newRar.m_grant.m_cqiRequest = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   786
      newRar.m_grant.m_ulDelay = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   787
      NS_LOG_INFO (this << " UL grant allocated to RNTI " << (*itRach).m_rnti << " rbStart " << rbStart << " rbLen " << rbLen << " MCS " << m_ulGrantMcs << " tbSize " << newRar.m_grant.m_tbSize);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   788
      for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   789
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   790
          m_rachAllocationMap.at (i) = (*itRach).m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   791
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   792
10449
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   793
      if (m_harqOn == true)
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   794
        {
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   795
          // generate UL-DCI for HARQ retransmissions
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   796
          UlDciListElement_s uldci;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   797
          uldci.m_rnti = newRar.m_rnti;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   798
          uldci.m_rbLen = rbLen;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   799
          uldci.m_rbStart = rbStart;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   800
          uldci.m_mcs = m_ulGrantMcs;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   801
          uldci.m_tbSize = tbSizeBits / 8;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   802
          uldci.m_ndi = 1;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   803
          uldci.m_cceIndex = 0;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   804
          uldci.m_aggrLevel = 1;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   805
          uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   806
          uldci.m_hopping = false;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   807
          uldci.m_n2Dmrs = 0;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   808
          uldci.m_tpc = 0; // no power control
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   809
          uldci.m_cqiRequest = false; // only period CQI at this stage
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   810
          uldci.m_ulIndex = 0; // TDD parameter
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   811
          uldci.m_dai = 1; // TDD parameter
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   812
          uldci.m_freqHopping = 0;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   813
          uldci.m_pdcchPowerOffset = 0; // not used
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   814
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   815
          uint8_t harqId = 0;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   816
          std::map <uint16_t, uint8_t>::iterator itProcId;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   817
          itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti);
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   818
          if (itProcId == m_ulHarqCurrentProcessId.end ())
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   819
            {
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   820
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti);
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   821
            }
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   822
          harqId = (*itProcId).second;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   823
          std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti);
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   824
          if (itDci == m_ulHarqProcessesDciBuffer.end ())
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   825
            {
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   826
              NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti);
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   827
            }
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   828
          (*itDci).second.at (harqId) = uldci;
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   829
        }
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
   830
10879
a9443dfe8b21 fixed Bug 1893 - issue in DoSchedUlTriggerReq with harq
Nicola Baldo <nbaldo@cttc.es>
parents: 10821
diff changeset
   831
      rbStart = rbStart + rbLen;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   832
      ret.m_buildRarList.push_back (newRar);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   833
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   834
  m_rachList.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   835
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   836
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   837
  // Process DL HARQ feedback
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   838
  RefreshHarqProcesses ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   839
  // retrieve past HARQ retx buffered
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   840
  if (m_dlInfoListBuffered.size () > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   841
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   842
      if (params.m_dlInfoList.size () > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   843
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   844
          NS_LOG_INFO (this << " Received DL-HARQ feedback");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   845
          m_dlInfoListBuffered.insert (m_dlInfoListBuffered.end (), params.m_dlInfoList.begin (), params.m_dlInfoList.end ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   846
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   847
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   848
  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   849
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   850
      if (params.m_dlInfoList.size () > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   851
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   852
          m_dlInfoListBuffered = params.m_dlInfoList;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   853
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   854
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   855
  if (m_harqOn == false)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   856
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   857
      // Ignore HARQ feedback
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   858
      m_dlInfoListBuffered.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   859
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   860
  std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   861
  for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   862
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   863
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   864
      if (itRnti != rntiAllocated.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   865
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   866
          // RNTI already allocated for retx
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   867
          continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   868
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   869
      uint8_t nLayers = m_dlInfoListBuffered.at (i).m_harqStatus.size ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   870
      std::vector <bool> retx;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   871
      NS_LOG_INFO (this << " Processing DLHARQ feedback");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   872
      if (nLayers == 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   873
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   874
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   875
          retx.push_back (false);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   876
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   877
      else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   878
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   879
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   880
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (1) == DlInfoListElement_s::NACK);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   881
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   882
      if (retx.at (0) || retx.at (1))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   883
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   884
          // retrieve HARQ process information
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   885
          uint16_t rnti = m_dlInfoListBuffered.at (i).m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   886
          uint8_t harqId = m_dlInfoListBuffered.at (i).m_harqProcessId;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   887
          NS_LOG_INFO (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   888
          std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itHarq = m_dlHarqProcessesDciBuffer.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   889
          if (itHarq == m_dlHarqProcessesDciBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   890
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   891
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   892
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   893
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   894
          DlDciListElement_s dci = (*itHarq).second.at (harqId);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   895
          int rv = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   896
          if (dci.m_rv.size () == 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   897
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   898
              rv = dci.m_rv.at (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   899
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   900
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   901
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   902
              rv = (dci.m_rv.at (0) > dci.m_rv.at (1) ? dci.m_rv.at (0) : dci.m_rv.at (1));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   903
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   904
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   905
          if (rv == 3)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   906
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   907
              // maximum number of retx reached -> drop process
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   908
              NS_LOG_INFO ("Maximum number of retransmissions reached -> drop process");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   909
              std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   910
              if (it == m_dlHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   911
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   912
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   913
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   914
              (*it).second.at (harqId) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   915
              std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   916
              if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   917
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   918
                  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   919
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   920
              for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   921
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   922
                  (*itRlcPdu).second.at (k).at (harqId).clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   923
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   924
              continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   925
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   926
          // check the feasibility of retransmitting on the same RBGs
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   927
          // translate the DCI to Spectrum framework
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   928
          std::vector <int> dciRbg;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   929
          uint32_t mask = 0x1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   930
          NS_LOG_INFO ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   931
          for (int j = 0; j < 32; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   932
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   933
              if (((dci.m_rbBitmap & mask) >> j) == 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   934
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   935
                  dciRbg.push_back (j);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   936
                  NS_LOG_INFO ("\t" << j);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   937
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   938
              mask = (mask << 1);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   939
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   940
          bool free = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   941
          for (uint8_t j = 0; j < dciRbg.size (); j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   942
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   943
              if (rbgMap.at (dciRbg.at (j)) == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   944
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   945
                  free = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   946
                  break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   947
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   948
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   949
          if (free)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   950
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   951
              // use the same RBGs for the retx
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   952
              // reserve RBGs
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   953
              for (uint8_t j = 0; j < dciRbg.size (); j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   954
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   955
                  rbgMap.at (dciRbg.at (j)) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   956
                  NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   957
                  rbgAllocatedNum++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   958
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   959
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   960
              NS_LOG_INFO (this << " Send retx in the same RBGs");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   961
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   962
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   963
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   964
              // find RBGs for sending HARQ retx
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   965
              uint8_t j = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   966
              uint8_t rbgId = (dciRbg.at (dciRbg.size () - 1) + 1) % rbgNum;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   967
              uint8_t startRbg = dciRbg.at (dciRbg.size () - 1);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   968
              std::vector <bool> rbgMapCopy = rbgMap;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   969
              while ((j < dciRbg.size ())&&(startRbg != rbgId))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   970
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   971
                  if (rbgMapCopy.at (rbgId) == false)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   972
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   973
                      rbgMapCopy.at (rbgId) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   974
                      dciRbg.at (j) = rbgId;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   975
                      j++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   976
                    }
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   977
                  rbgId = (rbgId + 1) % rbgNum;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   978
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   979
              if (j == dciRbg.size ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   980
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   981
                  // find new RBGs -> update DCI map
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   982
                  uint32_t rbgMask = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   983
                  for (uint16_t k = 0; k < dciRbg.size (); k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   984
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   985
                      rbgMask = rbgMask + (0x1 << dciRbg.at (k));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   986
                      rbgAllocatedNum++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   987
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   988
                  dci.m_rbBitmap = rbgMask;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   989
                  rbgMap = rbgMapCopy;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   990
                  NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   991
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   992
              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   993
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   994
                  // HARQ retx cannot be performed on this TTI -> store it
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
   995
                  dlInfoListUntxed.push_back (m_dlInfoListBuffered.at (i));
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   996
                  NS_LOG_INFO (this << " No resource for this retx -> buffer it");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   997
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   998
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
   999
          // retrieve RLC PDU list for retx TBsize and update DCI
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1000
          BuildDataListElement_s newEl;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1001
          std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1002
          if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1003
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1004
              NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1005
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1006
          for (uint8_t j = 0; j < nLayers; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1007
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1008
              if (retx.at (j))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1009
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1010
                  if (j >= dci.m_ndi.size ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1011
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1012
                      // for avoiding errors in MIMO transient phases
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1013
                      dci.m_ndi.push_back (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1014
                      dci.m_rv.push_back (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1015
                      dci.m_mcs.push_back (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1016
                      dci.m_tbsSize.push_back (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1017
                      NS_LOG_INFO (this << " layer " << (uint16_t)j << " no txed (MIMO transition)");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1018
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1019
                  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1020
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1021
                      dci.m_ndi.at (j) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1022
                      dci.m_rv.at (j)++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1023
                      (*itHarq).second.at (harqId).m_rv.at (j)++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1024
                      NS_LOG_INFO (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1025
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1026
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1027
              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1028
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1029
                  // empty TB of layer j
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1030
                  dci.m_ndi.at (j) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1031
                  dci.m_rv.at (j) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1032
                  dci.m_mcs.at (j) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1033
                  dci.m_tbsSize.at (j) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1034
                  NS_LOG_INFO (this << " layer " << (uint16_t)j << " no retx");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1035
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1036
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1037
          for (uint16_t k = 0; k < (*itRlcPdu).second.at (0).at (dci.m_harqProcess).size (); k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1038
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1039
              std::vector <struct RlcPduListElement_s> rlcPduListPerLc;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1040
              for (uint8_t j = 0; j < nLayers; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1041
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1042
                  if (retx.at (j))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1043
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1044
                      if (j < dci.m_ndi.size ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1045
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1046
                          rlcPduListPerLc.push_back ((*itRlcPdu).second.at (j).at (dci.m_harqProcess).at (k));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1047
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1048
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1049
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1050
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1051
              if (rlcPduListPerLc.size () > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1052
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1053
                  newEl.m_rlcPduList.push_back (rlcPduListPerLc);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1054
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1055
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1056
          newEl.m_rnti = rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1057
          newEl.m_dci = dci;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1058
          (*itHarq).second.at (harqId).m_rv = dci.m_rv;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1059
          // refresh timer
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1060
          std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer = m_dlHarqProcessesTimer.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1061
          if (itHarqTimer== m_dlHarqProcessesTimer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1062
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1063
              NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1064
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1065
          (*itHarqTimer).second.at (harqId) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1066
          ret.m_buildDataList.push_back (newEl);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1067
          rntiAllocated.insert (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1068
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1069
      else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1070
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1071
          // update HARQ process status
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1072
          NS_LOG_INFO (this << " HARQ received ACK for UE " << m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1073
          std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1074
          if (it == m_dlHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1075
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1076
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1077
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1078
          (*it).second.at (m_dlInfoListBuffered.at (i).m_harqProcessId) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1079
          std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1080
          if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1081
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1082
              NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1083
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1084
          for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1085
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1086
              (*itRlcPdu).second.at (k).at (m_dlInfoListBuffered.at (i).m_harqProcessId).clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1087
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1088
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1089
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1090
  m_dlInfoListBuffered.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1091
  m_dlInfoListBuffered = dlInfoListUntxed;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1092
10498
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1093
  if (rbgAllocatedNum == rbgNum)
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1094
    {
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1095
      // all the RBGs are already allocated -> exit
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1096
      if ((ret.m_buildDataList.size () > 0) || (ret.m_buildRarList.size () > 0))
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1097
        {
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1098
          m_schedSapUser->SchedDlConfigInd (ret);
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1099
        }
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1100
      return;
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1101
    }
65062eed16a2 Big-fix out_of_range in LTE schedulers when HARQ uses all the RBGs for retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10449
diff changeset
  1102
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1103
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1104
  std::map <uint16_t, pssFlowPerf_t>::iterator it;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1105
  std::map <uint16_t, pssFlowPerf_t> tdUeSet; // the result of TD scheduler
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1106
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1107
  // schedulability check
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1108
  std::map <uint16_t, pssFlowPerf_t> ueSet;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1109
  for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1110
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1111
      if( LcActivePerFlow ((*it).first) > 0 )
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1112
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1113
          ueSet.insert(std::pair <uint16_t, pssFlowPerf_t> ((*it).first, (*it).second));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1114
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1115
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1116
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1117
  if (ueSet.size() != 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1118
    { // has data in RLC buffer
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1119
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1120
      // Time Domain scheduler
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1121
      std::vector <std::pair<double, uint16_t> > ueSet1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1122
      std::vector <std::pair<double,uint16_t> > ueSet2;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1123
      for (it = ueSet.begin (); it != ueSet.end (); it++)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1124
        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1125
          std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1126
          if ((itRnti != rntiAllocated.end ())||(!HarqProcessAvailability ((*it).first)))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1127
            {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1128
              // UE already allocated for HARQ or without HARQ process available -> drop it
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1129
              if (itRnti != rntiAllocated.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1130
              {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1131
                NS_LOG_DEBUG (this << " RNTI discared for HARQ tx" << (uint16_t)(*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1132
              }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1133
              if (!HarqProcessAvailability ((*it).first))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1134
              {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1135
                NS_LOG_DEBUG (this << " RNTI discared for HARQ id" << (uint16_t)(*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1136
              }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1137
              continue;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1138
            }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1139
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1140
          double metric = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1141
          if ((*it).second.lastAveragedThroughput < (*it).second.targetThroughput )
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1142
            {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1143
        	    // calculate TD BET metric
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1144
              metric = 1 / (*it).second.lastAveragedThroughput;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1145
              ueSet1.push_back(std::pair<double, uint16_t> (metric, (*it).first));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1146
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1147
          else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1148
            {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1149
              // calculate TD PF metric
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1150
              std::map <uint16_t,uint8_t>::iterator itCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1151
              itCqi = m_p10CqiRxed.find ((*it).first);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1152
              std::map <uint16_t,uint8_t>::iterator itTxMode;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1153
              itTxMode = m_uesTxMode.find ((*it).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1154
              if (itTxMode == m_uesTxMode.end())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1155
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1156
                  NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1157
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1158
              int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1159
              uint8_t wbCqi = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1160
              if (itCqi == m_p10CqiRxed.end())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1161
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1162
                  wbCqi = 1; // start with lowest value
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1163
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1164
              else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1165
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1166
                  wbCqi = (*itCqi).second;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1167
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1168
    
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1169
              if (wbCqi > 0)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1170
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1171
                  if (LcActivePerFlow ((*it).first) > 0)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1172
                    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1173
                      // this UE has data to transmit
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1174
                      double achievableRate = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1175
                      for (uint8_t k = 0; k < nLayer; k++) 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1176
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1177
                          uint8_t mcs = 0; 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1178
                          mcs = m_amc->GetMcsFromCqi (wbCqi);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1179
                          achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1180
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1181
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1182
                      metric = achievableRate / (*it).second.lastAveragedThroughput;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1183
                   }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1184
                } // end of wbCqi
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1185
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1186
              ueSet2.push_back(std::pair<double, uint16_t> (metric, (*it).first));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1187
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1188
        }// end of ueSet
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1189
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1190
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1191
      if (ueSet1.size () != 0 || ueSet2.size () != 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1192
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1193
          // sorting UE in ueSet1 and ueSet1 in descending order based on their metric value
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1194
          std::sort (ueSet1.rbegin (), ueSet1.rend ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1195
          std::sort (ueSet2.rbegin (), ueSet2.rend ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1196
 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1197
          // select UE set for frequency domain scheduler
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1198
          uint32_t nMux;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1199
          if ( m_nMux > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1200
            nMux = m_nMux;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1201
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1202
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1203
              // select half number of UE
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1204
              if (ueSet1.size() + ueSet2.size() <=2 )
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1205
                nMux = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1206
              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1207
                nMux = (int)((ueSet1.size() + ueSet2.size()) / 2) ; // TD scheduler only transfers half selected UE per RTT to TD scheduler
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1208
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1209
          for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it--)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1210
           {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1211
             std::vector <std::pair<double, uint16_t> >::iterator itSet;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1212
             for (itSet = ueSet1.begin (); itSet != ueSet1.end () && nMux != 0; itSet++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1213
               {  
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1214
                 std::map <uint16_t, pssFlowPerf_t>::iterator itUe;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1215
                 itUe = m_flowStatsDl.find((*itSet).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1216
                 tdUeSet.insert(std::pair<uint16_t, pssFlowPerf_t> ( (*itUe).first, (*itUe).second ) );
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1217
                 nMux--;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1218
               }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1219
           
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1220
             if (nMux == 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1221
               break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1222
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1223
             for (itSet = ueSet2.begin (); itSet != ueSet2.end () && nMux != 0; itSet++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1224
               {  
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1225
                 std::map <uint16_t, pssFlowPerf_t>::iterator itUe;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1226
                 itUe = m_flowStatsDl.find((*itSet).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1227
                 tdUeSet.insert(std::pair<uint16_t, pssFlowPerf_t> ( (*itUe).first, (*itUe).second ) );
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1228
                 nMux--;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1229
               }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1230
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1231
             if (nMux == 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1232
               break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1233
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1234
           } // end of m_flowStatsDl
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1235
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1236
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1237
          if ( m_fdSchedulerType.compare("CoItA") == 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1238
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1239
              // FD scheduler: Carrier over Interference to Average (CoItA)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1240
              std::map < uint16_t, uint8_t > sbCqiSum;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1241
              for (it = tdUeSet.begin (); it != tdUeSet.end (); it++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1242
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1243
                  uint8_t sum = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1244
                  for (int i = 0; i < rbgNum; i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1245
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1246
                      std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1247
                      itCqi = m_a30CqiRxed.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1248
                      std::map <uint16_t,uint8_t>::iterator itTxMode;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1249
                      itTxMode = m_uesTxMode.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1250
                      if (itTxMode == m_uesTxMode.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1251
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1252
                          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1253
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1254
                      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1255
                      std::vector <uint8_t> sbCqis;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1256
                      if (itCqi == m_a30CqiRxed.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1257
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1258
                          for (uint8_t k = 0; k < nLayer; k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1259
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1260
                              sbCqis.push_back (1);  // start with lowest value
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1261
                            }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1262
                        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1263
                      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1264
                        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1265
                          sbCqis = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1266
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1267
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1268
                      uint8_t cqi1 = sbCqis.at (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1269
                      uint8_t cqi2 = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1270
                      if (sbCqis.size () > 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1271
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1272
                          cqi2 = sbCqis.at (1);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1273
                        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1274
            
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1275
                      uint8_t sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1276
                      if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1277
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1278
                          for (uint8_t k = 0; k < nLayer; k++) 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1279
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1280
                              if (sbCqis.size () > k)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1281
                                {                       
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1282
           	                  sbCqi = sbCqis.at(k);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1283
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1284
                              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1285
                                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1286
                                  // no info on this subband 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1287
                                  sbCqi = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1288
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1289
                              sum += sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1290
                            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1291
                        }   // end if cqi
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1292
                    }// end of rbgNum
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1293
              
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1294
                  sbCqiSum.insert (std::pair<uint16_t, uint8_t> ((*it).first, sum));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1295
                }// end tdUeSet
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1296
        
9153
f04612961e79 correct code style errors in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9152
diff changeset
  1297
              for (int i = 0; i < rbgNum; i++)
f04612961e79 correct code style errors in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9152
diff changeset
  1298
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1299
                  if (rbgMap.at (i) == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1300
                    continue;
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1301
                  if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*it).first)) == false)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1302
                    continue;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1303
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1304
                  std::map <uint16_t, pssFlowPerf_t>::iterator itMax = tdUeSet.end ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1305
                  double metricMax = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1306
                  for (it = tdUeSet.begin (); it != tdUeSet.end (); it++)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1307
                    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1308
                      // calculate PF weigth 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1309
                      double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1310
                      if (weight < 1.0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1311
                        weight = 1.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1312
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1313
                      std::map < uint16_t, uint8_t>::iterator itSbCqiSum;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1314
                      itSbCqiSum = sbCqiSum.find((*it).first);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1315
        
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1316
                      std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1317
                      itCqi = m_a30CqiRxed.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1318
                      std::map <uint16_t,uint8_t>::iterator itTxMode;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1319
                      itTxMode = m_uesTxMode.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1320
                      if (itTxMode == m_uesTxMode.end())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1321
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1322
                          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1323
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1324
                      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1325
                      std::vector <uint8_t> sbCqis;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1326
                      if (itCqi == m_a30CqiRxed.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1327
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1328
                          for (uint8_t k = 0; k < nLayer; k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1329
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1330
                              sbCqis.push_back (1);  // start with lowest value
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1331
                            }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1332
                        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1333
                      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1334
                        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1335
                          sbCqis = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1336
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1337
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1338
                      uint8_t cqi1 = sbCqis.at( 0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1339
                      uint8_t cqi2 = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1340
                      if (sbCqis.size () > 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1341
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1342
                          cqi2 = sbCqis.at(1);
9153
f04612961e79 correct code style errors in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9152
diff changeset
  1343
                        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1344
            
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1345
                      uint8_t sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1346
                      double colMetric = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1347
                      if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1348
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1349
                          for (uint8_t k = 0; k < nLayer; k++) 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1350
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1351
                              if (sbCqis.size () > k)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1352
                                {                       
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1353
                                  sbCqi = sbCqis.at(k);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1354
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1355
                              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1356
                                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1357
                                  // no info on this subband 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1358
                                  sbCqi = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1359
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1360
                              colMetric += (double)sbCqi / (double)(*itSbCqiSum).second;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1361
           	                } 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1362
                        }   // end if cqi
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1363
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1364
                      double metric = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1365
                      if (colMetric != 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1366
                        metric= weight * colMetric;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1367
                      else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1368
                        metric = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1369
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1370
                      if (metric > metricMax )
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1371
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1372
                          metricMax = metric;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1373
                          itMax = it;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1374
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1375
                    } // end of tdUeSet
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1376
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1377
                  if (itMax == m_flowStatsDl.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1378
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1379
                      // no UE available for downlink 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1380
                      return;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1381
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1382
                  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1383
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1384
                      allocationMap[(*itMax).first].push_back (i);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1385
                      rbgMap.at (i) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1386
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1387
                }// end of rbgNum
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1388
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1389
            }// end of CoIta
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1390
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1391
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1392
          if ( m_fdSchedulerType.compare("PFsch") == 0)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1393
            {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1394
              // FD scheduler: Proportional Fair scheduled (PFsch)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1395
              for (int i = 0; i < rbgNum; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1396
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1397
                  if (rbgMap.at (i) == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1398
                    continue;
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1399
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1400
                  if ((m_ffrSapProvider->IsDlRbgAvailableForUe (i, (*it).first)) == false)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1401
                    continue;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1402
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1403
                  std::map <uint16_t, pssFlowPerf_t>::iterator itMax = tdUeSet.end ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1404
                  double metricMax = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1405
                  for (it = tdUeSet.begin (); it != tdUeSet.end (); it++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1406
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1407
                      // calculate PF weigth 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1408
                      double weight = (*it).second.targetThroughput / (*it).second.lastAveragedThroughput;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1409
                      if (weight < 1.0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1410
                        weight = 1.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1411
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1412
                      std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1413
                      itCqi = m_a30CqiRxed.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1414
                      std::map <uint16_t,uint8_t>::iterator itTxMode;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1415
                      itTxMode = m_uesTxMode.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1416
                      if (itTxMode == m_uesTxMode.end())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1417
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1418
                          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1419
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1420
                      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1421
                      std::vector <uint8_t> sbCqis;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1422
                      if (itCqi == m_a30CqiRxed.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1423
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1424
                          for (uint8_t k = 0; k < nLayer; k++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1425
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1426
                              sbCqis.push_back (1);  // start with lowest value
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1427
                            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1428
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1429
                      else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1430
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1431
                          sbCqis = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1432
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1433
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1434
                      uint8_t cqi1 = sbCqis.at(0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1435
                      uint8_t cqi2 = 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1436
                      if (sbCqis.size () > 1)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1437
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1438
                          cqi2 = sbCqis.at(1);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1439
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1440
                
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1441
                      double schMetric = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1442
                      if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1443
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1444
                          double achievableRate = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1445
                          for (uint8_t k = 0; k < nLayer; k++) 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1446
                            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1447
                              uint8_t mcs = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1448
                              if (sbCqis.size () > k)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1449
                                {                       
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1450
                                  mcs = m_amc->GetMcsFromCqi (sbCqis.at (k));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1451
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1452
                              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1453
                                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1454
                                  // no info on this subband  -> worst MCS
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1455
                                  mcs = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1456
                                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1457
                              achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1458
            	  	    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1459
                          schMetric = achievableRate / (*it).second.secondLastAveragedThroughput;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1460
                        }   // end if cqi
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1461
         
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1462
                      double metric = 0.0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1463
                      metric= weight * schMetric;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1464
         
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1465
                      if (metric > metricMax )
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1466
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1467
                          metricMax = metric;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1468
                          itMax = it;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1469
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1470
                    } // end of tdUeSet
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1471
         
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1472
                  if (itMax == m_flowStatsDl.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1473
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1474
                      // no UE available for downlink 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1475
                      return;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1476
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1477
                  else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1478
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1479
                      allocationMap[(*itMax).first].push_back (i);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1480
                      rbgMap.at (i) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1481
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1482
         
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1483
                }// end of rbgNum
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1484
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1485
            } // end of PFsch
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1486
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1487
        } // end if ueSet1 || ueSet2
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1488
    
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1489
    } // end if ueSet
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1490
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1491
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1492
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1493
  // reset TTI stats of users
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1494
  std::map <uint16_t, pssFlowPerf_t>::iterator itStats;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1495
  for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1496
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1497
      (*itStats).second.lastTtiBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1498
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1499
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1500
  // generate the transmission opportunities by grouping the RBGs of the same RNTI and
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1501
  // creating the correspondent DCIs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1502
  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.begin ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1503
  while (itMap != allocationMap.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1504
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1505
      // create new BuildDataListElement_s for this LC
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1506
      BuildDataListElement_s newEl;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1507
      newEl.m_rnti = (*itMap).first;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1508
      // create the DlDciListElement_s
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1509
      DlDciListElement_s newDci;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1510
      newDci.m_rnti = (*itMap).first;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1511
      newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1512
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1513
      uint16_t lcActives = LcActivePerFlow ((*itMap).first);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1514
      NS_LOG_INFO (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
9788
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
  1515
      if (lcActives == 0)
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
  1516
        {
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
  1517
          // Set to max value, to avoid divide by 0 below
9809
290a3bb2f7c9 Use the *right* explicit value, cast to the right size, instead of C++11 constant.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9808
diff changeset
  1518
          lcActives = (uint16_t)65535; // UINT16_MAX;
9788
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
  1519
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1520
      uint16_t RgbPerRnti = (*itMap).second.size ();
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1521
      std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1522
      itCqi = m_a30CqiRxed.find ((*itMap).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1523
      std::map <uint16_t,uint8_t>::iterator itTxMode;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1524
      itTxMode = m_uesTxMode.find ((*itMap).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1525
      if (itTxMode == m_uesTxMode.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1526
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1527
          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1528
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1529
      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1530
      std::vector <uint8_t> worstCqi (2, 15);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1531
      if (itCqi != m_a30CqiRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1532
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1533
          for (uint16_t k = 0; k < (*itMap).second.size (); k++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1534
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1535
              if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1536
                {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1537
                  NS_LOG_INFO (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1538
                  for (uint8_t j = 0; j < nLayer; j++)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1539
                    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1540
                      if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size () > j)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1541
                        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1542
                          if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j)) < worstCqi.at (j))
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1543
                            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1544
                              worstCqi.at (j) = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1545
                            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1546
                        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1547
                      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1548
                        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1549
                          // no CQI for this layer of this suband -> worst one
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1550
                          worstCqi.at (j) = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1551
                        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1552
                    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1553
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1554
              else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1555
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1556
                  for (uint8_t j = 0; j < nLayer; j++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1557
                    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1558
                      worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1559
                    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1560
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1561
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1562
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1563
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1564
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1565
          for (uint8_t j = 0; j < nLayer; j++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1566
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1567
              worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1568
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1569
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1570
      for (uint8_t j = 0; j < nLayer; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1571
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1572
          NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (uint16_t)worstCqi.at (j));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1573
        }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1574
      uint32_t bytesTxed = 0;
9153
f04612961e79 correct code style errors in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9152
diff changeset
  1575
      for (uint8_t j = 0; j < nLayer; j++)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1576
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1577
          newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j)));
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1578
          int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1579
          newDci.m_tbsSize.push_back (tbSize);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1580
          NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_amc->GetMcsFromCqi (worstCqi.at (j)));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1581
          bytesTxed += tbSize;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1582
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1583
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1584
      newDci.m_resAlloc = 0;  // only allocation type 0 at this stage
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1585
      newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1586
      uint32_t rbgMask = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1587
      for (uint16_t k = 0; k < (*itMap).second.size (); k++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1588
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1589
          rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1590
          NS_LOG_INFO (this << " Allocated RBG " << (*itMap).second.at (k));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1591
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1592
      newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1593
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1594
      // create the rlc PDUs -> equally divide resources among actives LCs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1595
      std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1596
      for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1597
        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1598
          if (((*itBufReq).first.m_rnti == (*itMap).first)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1599
              && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1600
                  || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1601
                  || ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1602
            {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1603
              std::vector <struct RlcPduListElement_s> newRlcPduLe;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1604
              for (uint8_t j = 0; j < nLayer; j++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1605
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1606
                  RlcPduListElement_s newRlcEl;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1607
                  newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1608
                  newRlcEl.m_size = newDci.m_tbsSize.at (j) / lcActives;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1609
                  NS_LOG_INFO (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1610
                  newRlcPduLe.push_back (newRlcEl);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1611
                  UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1612
                  if (m_harqOn == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1613
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1614
                      // store RLC PDU list for HARQ
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1615
                      std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find ((*itMap).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1616
                      if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1617
                        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1618
                          NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << (*itMap).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1619
                        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1620
                      (*itRlcPdu).second.at (j).at (newDci.m_harqProcess).push_back (newRlcEl);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1621
                    }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1622
                }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1623
              newEl.m_rlcPduList.push_back (newRlcPduLe);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1624
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1625
          if ((*itBufReq).first.m_rnti > (*itMap).first)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1626
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1627
              break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1628
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1629
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1630
      for (uint8_t j = 0; j < nLayer; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1631
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1632
          newDci.m_ndi.push_back (1);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1633
          newDci.m_rv.push_back (0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1634
        }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1635
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1636
      newDci.m_tpc = m_ffrSapProvider->GetTpc ((*itMap).first);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1637
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1638
      newEl.m_dci = newDci;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1639
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1640
      if (m_harqOn == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1641
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1642
          // store DCI for HARQ
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1643
          std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci = m_dlHarqProcessesDciBuffer.find (newEl.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1644
          if (itDci == m_dlHarqProcessesDciBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1645
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1646
              NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for RNTI " << newEl.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1647
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1648
          (*itDci).second.at (newDci.m_harqProcess) = newDci;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1649
          // refresh timer
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1650
          std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer =  m_dlHarqProcessesTimer.find (newEl.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1651
          if (itHarqTimer== m_dlHarqProcessesTimer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1652
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1653
              NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)newEl.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1654
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1655
          (*itHarqTimer).second.at (newDci.m_harqProcess) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1656
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1657
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1658
      // ...more parameters -> ingored in this version
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1659
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1660
      ret.m_buildDataList.push_back (newEl);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1661
      // update UE stats
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1662
      std::map <uint16_t, pssFlowPerf_t>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1663
      it = m_flowStatsDl.find ((*itMap).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1664
      if (it != m_flowStatsDl.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1665
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1666
          (*it).second.lastTtiBytesTransmitted = bytesTxed;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1667
          NS_LOG_INFO (this << " UE total bytes txed " << (*it).second.lastTtiBytesTransmitted);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1668
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1669
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1670
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1671
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1672
        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1673
          NS_FATAL_ERROR (this << " No Stats for this allocated UE");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1674
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1675
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1676
      itMap++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1677
    } // end while allocation
9870
6543f3876ff5 [Doxygen] use \todo
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9809
diff changeset
  1678
  ret.m_nrOfPdcchOfdmSymbols = 1;   /// \todo check correct value according the DCIs txed
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1679
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1680
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1681
  // update UEs stats
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1682
  NS_LOG_INFO (this << " Update UEs statistics");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1683
  for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1684
    { 
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1685
      std::map <uint16_t, pssFlowPerf_t>::iterator itUeScheduleted = tdUeSet.end();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1686
      itUeScheduleted = tdUeSet.find((*itStats).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1687
      if (itUeScheduleted != tdUeSet.end())
9159
e4545deccc31 Initialize some metric parameters in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9153
diff changeset
  1688
        {
e4545deccc31 Initialize some metric parameters in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9153
diff changeset
  1689
          (*itStats).second.secondLastAveragedThroughput = ((1.0 - (1 / m_timeWindow)) * (*itStats).second.secondLastAveragedThroughput) + ((1 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
e4545deccc31 Initialize some metric parameters in GSoC 2012 LTE NS-3 MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9153
diff changeset
  1690
        }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1691
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1692
      (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTransmitted;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1693
      // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1694
      (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTransmitted / 0.001));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1695
      (*itStats).second.lastTtiBytesTransmitted = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1696
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1697
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1698
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1699
  m_schedSapUser->SchedDlConfigInd (ret);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1700
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1701
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1702
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1703
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1704
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1705
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1706
PssFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1707
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1708
  NS_LOG_FUNCTION (this);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1709
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1710
  m_rachList = params.m_rachList;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1711
  
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1712
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1713
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1714
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1715
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1716
PssFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1717
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1718
  NS_LOG_FUNCTION (this);
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1719
  m_ffrSapProvider->ReportDlCqiInfo (params);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1720
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1721
  for (unsigned int i = 0; i < params.m_cqiList.size (); i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1722
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1723
      if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 )
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1724
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1725
          // wideband CQI reporting
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1726
          std::map <uint16_t,uint8_t>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1727
          uint16_t rnti = params.m_cqiList.at (i).m_rnti;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1728
          it = m_p10CqiRxed.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1729
          if (it == m_p10CqiRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1730
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1731
              // create the new entry
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1732
              m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (rnti, params.m_cqiList.at (i).m_wbCqi.at (0)) ); // only codeword 0 at this stage (SISO)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1733
              // generate correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1734
              m_p10CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1735
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1736
          else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1737
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1738
              // update the CQI value and refresh correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1739
              (*it).second = params.m_cqiList.at (i).m_wbCqi.at (0);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1740
              // update correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1741
              std::map <uint16_t,uint32_t>::iterator itTimers;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1742
              itTimers = m_p10CqiTimers.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1743
              (*itTimers).second = m_cqiTimersThreshold;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1744
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1745
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1746
      else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 )
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1747
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1748
          // subband CQI reporting high layer configured
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1749
          std::map <uint16_t,SbMeasResult_s>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1750
          uint16_t rnti = params.m_cqiList.at (i).m_rnti;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1751
          it = m_a30CqiRxed.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1752
          if (it == m_a30CqiRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1753
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1754
              // create the new entry
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1755
              m_a30CqiRxed.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.m_cqiList.at (i).m_sbMeasResult) );
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1756
              m_a30CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1757
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1758
          else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1759
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1760
              // update the CQI value and refresh correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1761
              (*it).second = params.m_cqiList.at (i).m_sbMeasResult;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1762
              std::map <uint16_t,uint32_t>::iterator itTimers;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1763
              itTimers = m_a30CqiTimers.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1764
              (*itTimers).second = m_cqiTimersThreshold;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1765
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1766
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1767
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1768
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1769
          NS_LOG_ERROR (this << " CQI type unknown");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1770
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1771
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1772
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1773
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1774
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1775
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1776
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1777
double
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1778
PssFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1779
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1780
  std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1781
  if (itCqi == m_ueCqi.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1782
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1783
      // no cqi info about this UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1784
      return (NO_SINR);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1785
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1786
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1787
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1788
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1789
      // take the average SINR value among the available
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1790
      double sinrSum = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1791
      int sinrNum = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1792
      for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1793
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1794
          double sinr = (*itCqi).second.at (i);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1795
          if (sinr != NO_SINR)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1796
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1797
              sinrSum += sinr;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1798
              sinrNum++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1799
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1800
        }
9788
a1c1c87153b5 [Coverity] Division or modulo by zero (DIVIDE_BY_ZERO)
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9677
diff changeset
  1801
      double estimatedSinr = (sinrNum > 0) ? (sinrSum / sinrNum) : DBL_MAX;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1802
      // store the value
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1803
      (*itCqi).second.at (rb) = estimatedSinr;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1804
      return (estimatedSinr);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1805
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1806
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1807
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1808
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1809
PssFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1810
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1811
  NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1812
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1813
  RefreshUlCqiMaps ();
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1814
  m_ffrSapProvider->ReportUlCqiInfo (m_ueCqi);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1815
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1816
  // Generate RBs map
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1817
  FfMacSchedSapUser::SchedUlConfigIndParameters ret;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1818
  std::vector <bool> rbMap;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1819
  uint16_t rbAllocatedNum = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1820
  std::set <uint16_t> rntiAllocated;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1821
  std::vector <uint16_t> rbgAllocationMap;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1822
  // update with RACH allocation map
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1823
  rbgAllocationMap = m_rachAllocationMap;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1824
  //rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1825
  m_rachAllocationMap.clear ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1826
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1827
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1828
  rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false);
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1829
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1830
  rbMap = m_ffrSapProvider->GetAvailableUlRbg ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1831
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1832
  for (std::vector<bool>::iterator it = rbMap.begin (); it != rbMap.end (); it++)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1833
    {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1834
      if ((*it) == true )
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1835
        {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1836
          rbAllocatedNum++;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1837
        }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1838
    }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1839
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1840
  uint8_t minContinuousUlBandwidth = m_ffrSapProvider->GetMinContinuousUlBandwidth ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1841
  uint8_t ffrUlBandwidth = m_cschedCellConfig.m_ulBandwidth - rbAllocatedNum;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1842
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1843
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1844
  // remove RACH allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1845
  for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1846
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1847
      if (rbgAllocationMap.at (i) != 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1848
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1849
          rbMap.at (i) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1850
          NS_LOG_DEBUG (this << " Allocated for RACH " << i);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1851
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1852
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1853
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1854
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1855
  if (m_harqOn == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1856
    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1857
      //   Process UL HARQ feedback
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1858
      for (uint16_t i = 0; i < params.m_ulInfoList.size (); i++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1859
        {        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1860
          if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1861
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1862
              // retx correspondent block: retrieve the UL-DCI
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1863
              uint16_t rnti = params.m_ulInfoList.at (i).m_rnti;
10449
234f4746e6a7 fixed Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10410
diff changeset
  1864
              std::map <uint16_t, uint8_t>::iterator itProcId = m_ulHarqCurrentProcessId.find (rnti);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1865
              if (itProcId == m_ulHarqCurrentProcessId.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1866
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1867
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1868
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1869
              uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1870
              NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId << " i " << i << " size "  << params.m_ulInfoList.size ());
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1871
              std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1872
              if (itHarq == m_ulHarqProcessesDciBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1873
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1874
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1875
                  continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1876
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1877
              UlDciListElement_s dci = (*itHarq).second.at (harqId);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1878
              std::map <uint16_t, UlHarqProcessesStatus_t>::iterator itStat = m_ulHarqProcessesStatus.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1879
              if (itStat == m_ulHarqProcessesStatus.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1880
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1881
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1882
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1883
              if ((*itStat).second.at (harqId) >= 3)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1884
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1885
                  NS_LOG_INFO ("Max number of retransmissions reached (UL)-> drop process");
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1886
                  continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1887
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1888
              bool free = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1889
              for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1890
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1891
                  if (rbMap.at (j) == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1892
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1893
                      free = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1894
                      NS_LOG_INFO (this << " BUSY " << j);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1895
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1896
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1897
              if (free)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1898
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1899
                  // retx on the same RBs
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1900
                  for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1901
                    {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1902
                      rbMap.at (j) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1903
                      rbgAllocationMap.at (j) = dci.m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1904
                      NS_LOG_INFO ("\tRB " << j);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1905
                      rbAllocatedNum++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1906
                    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1907
                  NS_LOG_INFO (this << " Send retx in the same RBs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen << " RV " << (*itStat).second.at (harqId) + 1);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1908
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1909
              else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1910
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1911
                  NS_LOG_INFO ("Cannot allocate retx due to RACH allocations for UE " << rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1912
                  continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1913
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1914
              dci.m_ndi = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1915
              // Update HARQ buffers with new HarqId
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1916
              (*itStat).second.at ((*itProcId).second) = (*itStat).second.at (harqId) + 1;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1917
              (*itStat).second.at (harqId) = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1918
              (*itHarq).second.at ((*itProcId).second) = dci;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1919
              ret.m_dciList.push_back (dci);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1920
              rntiAllocated.insert (dci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1921
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1922
            else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1923
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1924
              NS_LOG_INFO (this << " HARQ-ACK feedback from RNTI " << params.m_ulInfoList.at (i).m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1925
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1926
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1927
    }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1928
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1929
  std::map <uint16_t,uint32_t>::iterator it;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1930
  int nflows = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1931
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1932
  for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1933
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1934
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1935
      // select UEs with queues not empty and not yet allocated for HARQ
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1936
      if (((*it).second > 0)&&(itRnti == rntiAllocated.end ()))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1937
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1938
          nflows++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1939
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1940
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1941
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1942
  if (nflows == 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1943
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1944
      if (ret.m_dciList.size () > 0)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1945
        {
10672
53870483ef76 Bug-fix LTE UL Schedulers (all): add lacking allocationMap storage with only HARQ retransmissions
mmiozzo
parents: 10652
diff changeset
  1946
          m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1947
          m_schedSapUser->SchedUlConfigInd (ret);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1948
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1949
        
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1950
      return;  // no flows to be scheduled
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1951
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1952
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1953
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1954
  // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1955
  uint16_t tempRbPerFlow = (ffrUlBandwidth) / (nflows + rntiAllocated.size ());
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1956
  uint16_t rbPerFlow = (minContinuousUlBandwidth < tempRbPerFlow) ? minContinuousUlBandwidth : tempRbPerFlow;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  1957
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1958
  if (rbPerFlow < 3)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1959
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1960
      rbPerFlow = 3;  // at least 3 rbg per flow (till available resource) to ensure TxOpportunity >= 7 bytes
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1961
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1962
  int rbAllocated = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1963
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1964
  std::map <uint16_t, pssFlowPerf_t>::iterator itStats;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1965
  if (m_nextRntiUl != 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1966
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1967
      for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1968
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1969
          if ((*it).first == m_nextRntiUl)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1970
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1971
              break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1972
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1973
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1974
      if (it == m_ceBsrRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1975
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1976
          NS_LOG_ERROR (this << " no user found");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1977
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1978
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1979
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1980
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1981
      it = m_ceBsrRxed.begin ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1982
      m_nextRntiUl = (*it).first;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1983
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1984
  do
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  1985
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1986
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1987
      if ((itRnti != rntiAllocated.end ())||((*it).second == 0))
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1988
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1989
          // UE already allocated for UL-HARQ -> skip it
10070
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  1990
          NS_LOG_DEBUG (this << " UE already allocated in HARQ -> discared, RNTI " << (*it).first);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1991
          it++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1992
          if (it == m_ceBsrRxed.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1993
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1994
              // restart from the first
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1995
              it = m_ceBsrRxed.begin ();
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1996
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1997
          continue;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1998
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  1999
      if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2000
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2001
          // limit to physical resources last resource assignment
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2002
          rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2003
          // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2004
          if (rbPerFlow < 3)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2005
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2006
              // terminate allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2007
              rbPerFlow = 0;      
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2008
            }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2009
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2010
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2011
      rbAllocated = 0;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2012
      UlDciListElement_s uldci;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2013
      uldci.m_rnti = (*it).first;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2014
      uldci.m_rbLen = rbPerFlow;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2015
      bool allocated = false;
10070
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2016
      NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
10769
2a65963e27ac [Bug 1868] Optimized builds are sensitive to -fstrict-overflow
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10680
diff changeset
  2017
      while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2018
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2019
          // check availability
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2020
          bool free = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2021
          for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2022
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2023
              if (rbMap.at (j) == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2024
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2025
                  free = false;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2026
                  break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2027
                }
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2028
              if ((m_ffrSapProvider->IsUlRbgAvailableForUe (j, (*it).first)) == false)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2029
                {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2030
                  free = false;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2031
                  break;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2032
                }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2033
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2034
          if (free)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2035
            {
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2036
        	  NS_LOG_INFO (this << "RNTI: "<< (*it).first<< " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2037
              uldci.m_rbStart = rbAllocated;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2038
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2039
              for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2040
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2041
                  rbMap.at (j) = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2042
                  // store info on allocation for managing ul-cqi interpretation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2043
                  rbgAllocationMap.at (j) = (*it).first;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2044
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2045
              rbAllocated += rbPerFlow;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2046
              allocated = true;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2047
              break;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2048
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2049
          rbAllocated++;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2050
          if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2051
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2052
              // limit to physical resources last resource assignment
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2053
              rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2054
              // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2055
              if (rbPerFlow < 3)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2056
                {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2057
                  // terminate allocation
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2058
                  rbPerFlow = 0;                 
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2059
                }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2060
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2061
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2062
      if (!allocated)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2063
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2064
          // unable to allocate new resource: finish scheduling
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2065
//          m_nextRntiUl = (*it).first;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2066
//          if (ret.m_dciList.size () > 0)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2067
//            {
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2068
//              m_schedSapUser->SchedUlConfigInd (ret);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2069
//            }
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2070
//          m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2071
//          return;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10879
diff changeset
  2072
    	  break;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2073
        }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2074
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2075
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2076
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2077
      std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find ((*it).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2078
      int cqi = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2079
      if (itCqi == m_ueCqi.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2080
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2081
          // no cqi info about this UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2082
          uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2083
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2084
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2085
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2086
          // take the lowest CQI value (worst RB)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2087
          double minSinr = (*itCqi).second.at (uldci.m_rbStart);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2088
          if (minSinr == NO_SINR)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2089
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2090
              minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2091
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2092
          for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2093
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2094
              double sinr = (*itCqi).second.at (i);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2095
              if (sinr == NO_SINR)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2096
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2097
                  sinr = EstimateUlSinr ((*it).first, i);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2098
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2099
              if ((*itCqi).second.at (i) < minSinr)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2100
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2101
                  minSinr = (*itCqi).second.at (i);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2102
                }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2103
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2104
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2105
          // translate SINR -> cqi: WILD ACK: same as DL
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2106
          double s = log2 ( 1 + (
10063
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2107
                                 std::pow (10, minSinr / 10 )  /
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2108
                                 ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2109
          cqi = m_amc->GetCqiFromSpectralEfficiency (s);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2110
          if (cqi == 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2111
            {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2112
              it++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2113
              if (it == m_ceBsrRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2114
                {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2115
                  // restart from the first
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2116
                  it = m_ceBsrRxed.begin ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2117
                }
10070
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2118
              NS_LOG_DEBUG (this << " UE discared for CQI=0, RNTI " << uldci.m_rnti);
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2119
              // remove UE from allocation map
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2120
              for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2121
                {
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2122
                  rbgAllocationMap.at (i) = 0;
85d6cfdea125 Bug-fix DoSchedUlTriggerReq of all schedulers: remove UEs discared for CQI=0 from the allocation map used to retrieve info when processing PUSCH CQIs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10063
diff changeset
  2123
                }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2124
              continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2125
            }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2126
          uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2127
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2128
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2129
      uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2130
      UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2131
      uldci.m_ndi = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2132
      uldci.m_cceIndex = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2133
      uldci.m_aggrLevel = 1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2134
      uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2135
      uldci.m_hopping = false;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2136
      uldci.m_n2Dmrs = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2137
      uldci.m_tpc = 0; // no power control
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2138
      uldci.m_cqiRequest = false; // only period CQI at this stage
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2139
      uldci.m_ulIndex = 0; // TDD parameter
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2140
      uldci.m_dai = 1; // TDD parameter
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2141
      uldci.m_freqHopping = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2142
      uldci.m_pdcchPowerOffset = 0; // not used
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2143
      ret.m_dciList.push_back (uldci);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2144
      // store DCI for HARQ_PERIOD
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2145
      uint8_t harqId = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2146
      if (m_harqOn == true)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2147
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2148
          std::map <uint16_t, uint8_t>::iterator itProcId;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2149
          itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2150
          if (itProcId == m_ulHarqCurrentProcessId.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2151
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2152
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2153
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2154
          harqId = (*itProcId).second;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2155
          std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2156
          if (itDci == m_ulHarqProcessesDciBuffer.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2157
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2158
              NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2159
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2160
          (*itDci).second.at (harqId) = uldci;
10821
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2161
          // Update HARQ process status (RV 0)
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2162
          std::map <uint16_t, UlHarqProcessesStatus_t>::iterator itStat = m_ulHarqProcessesStatus.find (uldci.m_rnti);
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2163
          if (itStat == m_ulHarqProcessesStatus.end ())
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2164
            {
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2165
              NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << uldci.m_rnti);
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2166
            }
9d3ffeb97587 Bug-fix: Bug 1935 - Bug in all Uplink Schedulers regarding HARQ retx handling
mmiozzo
parents: 10769
diff changeset
  2167
          (*itStat).second.at (harqId) = 0;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2168
        }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2169
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2170
      NS_LOG_INFO (this << " UE Allocation RNTI " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated << " harqId " << (uint16_t)harqId);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2171
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2172
      it++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2173
      if (it == m_ceBsrRxed.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2174
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2175
          // restart from the first
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2176
          it = m_ceBsrRxed.begin ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2177
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2178
      if ((rbAllocated == m_cschedCellConfig.m_ulBandwidth) || (rbPerFlow == 0))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2179
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2180
          // Stop allocation: no more PRBs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2181
          m_nextRntiUl = (*it).first;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2182
          break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2183
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2184
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2185
  while (((*it).first != m_nextRntiUl)&&(rbPerFlow!=0));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2186
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2187
  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2188
  m_schedSapUser->SchedUlConfigInd (ret);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2189
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2190
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2191
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2192
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2193
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2194
PssFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2195
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2196
  NS_LOG_FUNCTION (this);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2197
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2198
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2199
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2200
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2201
PssFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2202
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2203
  NS_LOG_FUNCTION (this);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2204
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2205
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2206
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2207
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2208
PssFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2209
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2210
  NS_LOG_FUNCTION (this);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2211
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2212
  std::map <uint16_t,uint32_t>::iterator it;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2213
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2214
  for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2215
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2216
      if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2217
        {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2218
          // buffer status report
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2219
          // note that this scheduler does not differentiate the
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2220
          // allocation according to which LCGs have more/less bytes
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2221
          // to send.
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2222
          // Hence the BSR of different LCGs are just summed up to get
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2223
          // a total queue size that is used for allocation purposes.
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2224
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2225
          uint32_t buffer = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2226
          for (uint8_t lcg = 0; lcg < 4; ++lcg)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2227
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2228
              uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (lcg);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2229
              buffer += BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2230
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2231
          
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2232
          uint16_t rnti = params.m_macCeList.at (i).m_rnti;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2233
          NS_LOG_LOGIC (this << "RNTI=" << rnti << " buffer=" << buffer);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2234
          it = m_ceBsrRxed.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2235
          if (it == m_ceBsrRxed.end ())
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2236
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2237
              // create the new entry
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2238
              m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2239
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2240
          else
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2241
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2242
              // update the buffer size value
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2243
              (*it).second = buffer;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2244
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2245
        }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2246
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2247
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2248
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2249
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2250
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2251
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2252
PssFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2253
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2254
  NS_LOG_FUNCTION (this);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2255
// retrieve the allocation for this subframe
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2256
  switch (m_ulCqiFilter)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2257
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2258
    case FfMacScheduler::SRS_UL_CQI:
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2259
      {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2260
        // filter all the CQIs that are not SRS based
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2261
        if (params.m_ulCqi.m_type != UlCqi_s::SRS)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2262
          {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2263
            return;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2264
          }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2265
      }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2266
      break;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2267
    case FfMacScheduler::PUSCH_UL_CQI:
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2268
      {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2269
        // filter all the CQIs that are not SRS based
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2270
        if (params.m_ulCqi.m_type != UlCqi_s::PUSCH)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2271
          {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2272
            return;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2273
          }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2274
      }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2275
    case FfMacScheduler::ALL_UL_CQI:
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2276
      break;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2277
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2278
    default:
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2279
      NS_FATAL_ERROR ("Unknown UL CQI type");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2280
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2281
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2282
  switch (params.m_ulCqi.m_type)
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2283
    {
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2284
    case UlCqi_s::PUSCH:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2285
      {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2286
        std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2287
        std::map <uint16_t, std::vector <double> >::iterator itCqi;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2288
        NS_LOG_DEBUG (this << " Collect PUSCH CQIs of Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2289
        itMap = m_allocationMaps.find (params.m_sfnSf);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2290
        if (itMap == m_allocationMaps.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2291
          {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2292
            return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2293
          }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2294
        for (uint32_t i = 0; i < (*itMap).second.size (); i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2295
          {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2296
            // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2297
            double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2298
            itCqi = m_ueCqi.find ((*itMap).second.at (i));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2299
            if (itCqi == m_ueCqi.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2300
              {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2301
                // create a new entry
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2302
                std::vector <double> newCqi;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2303
                for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2304
                  {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2305
                    if (i == j)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2306
                      {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2307
                        newCqi.push_back (sinr);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2308
                      }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2309
                    else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2310
                      {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2311
                        // initialize with NO_SINR value.
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2312
                        newCqi.push_back (NO_SINR);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2313
                      }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2314
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2315
                  }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2316
                m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2317
                // generate correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2318
                m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2319
              }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2320
            else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2321
              {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2322
                // update the value
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2323
                (*itCqi).second.at (i) = sinr;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2324
                NS_LOG_DEBUG (this << " RNTI " << (*itMap).second.at (i) << " RB " << i << " SINR " << sinr);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2325
                // update correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2326
                std::map <uint16_t, uint32_t>::iterator itTimers;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2327
                itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2328
                (*itTimers).second = m_cqiTimersThreshold;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2329
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2330
              }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2331
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2332
          }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2333
        // remove obsolete info on allocation
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2334
        m_allocationMaps.erase (itMap);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2335
      }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2336
      break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2337
    case UlCqi_s::SRS:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2338
      {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2339
        // get the RNTI from vendor specific parameters
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2340
        uint16_t rnti = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2341
        NS_ASSERT (params.m_vendorSpecificList.size () > 0);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2342
        for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2343
          {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2344
            if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2345
              {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2346
                Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2347
                rnti = vsp->GetRnti ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2348
              }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2349
          }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2350
        std::map <uint16_t, std::vector <double> >::iterator itCqi;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2351
        itCqi = m_ueCqi.find (rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2352
        if (itCqi == m_ueCqi.end ())
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2353
          {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2354
            // create a new entry
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2355
            std::vector <double> newCqi;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2356
            for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2357
              {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2358
                double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2359
                newCqi.push_back (sinr);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2360
                NS_LOG_INFO (this << " RNTI " << rnti << " new SRS-CQI for RB  " << j << " value " << sinr);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2361
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2362
              }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2363
            m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2364
            // generate correspondent timer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2365
            m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2366
          }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2367
        else
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2368
          {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2369
            // update the values
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2370
            for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2371
              {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2372
                double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2373
                (*itCqi).second.at (j) = sinr;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2374
                NS_LOG_INFO (this << " RNTI " << rnti << " update SRS-CQI for RB  " << j << " value " << sinr);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2375
              }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2376
            // update correspondent timer
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2377
            std::map <uint16_t, uint32_t>::iterator itTimers;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2378
            itTimers = m_ueCqiTimers.find (rnti);
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2379
            (*itTimers).second = m_cqiTimersThreshold;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2380
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2381
          }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2382
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2383
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2384
      }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2385
      break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2386
    case UlCqi_s::PUCCH_1:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2387
    case UlCqi_s::PUCCH_2:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2388
    case UlCqi_s::PRACH:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2389
      {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2390
        NS_FATAL_ERROR ("PssFfMacScheduler supports only PUSCH and SRS UL-CQIs");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2391
      }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2392
      break;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2393
    default:
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2394
      NS_FATAL_ERROR ("Unknown type of UL-CQI");
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2395
    }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2396
  return;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2397
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2398
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2399
void
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2400
PssFfMacScheduler::RefreshDlCqiMaps (void)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2401
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2402
  // refresh DL CQI P01 Map
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2403
  std::map <uint16_t,uint32_t>::iterator itP10 = m_p10CqiTimers.begin ();
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2404
  while (itP10 != m_p10CqiTimers.end ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2405
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2406
      NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2407
      if ((*itP10).second == 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2408
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2409
          // delete correspondent entries
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2410
          std::map <uint16_t,uint8_t>::iterator itMap = m_p10CqiRxed.find ((*itP10).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2411
          NS_ASSERT_MSG (itMap != m_p10CqiRxed.end (), " Does not find CQI report for user " << (*itP10).first);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2412
          NS_LOG_INFO (this << " P10-CQI expired for user " << (*itP10).first);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2413
          m_p10CqiRxed.erase (itMap);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2414
          std::map <uint16_t,uint32_t>::iterator temp = itP10;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2415
          itP10++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2416
          m_p10CqiTimers.erase (temp);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2417
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2418
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2419
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2420
          (*itP10).second--;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2421
          itP10++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2422
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2423
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2424
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2425
  // refresh DL CQI A30 Map
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2426
  std::map <uint16_t,uint32_t>::iterator itA30 = m_a30CqiTimers.begin ();
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2427
  while (itA30 != m_a30CqiTimers.end ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2428
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2429
      NS_LOG_INFO (this << " A30-CQI for user " << (*itA30).first << " is " << (uint32_t)(*itA30).second << " thr " << (uint32_t)m_cqiTimersThreshold);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2430
      if ((*itA30).second == 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2431
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2432
          // delete correspondent entries
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2433
          std::map <uint16_t,SbMeasResult_s>::iterator itMap = m_a30CqiRxed.find ((*itA30).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2434
          NS_ASSERT_MSG (itMap != m_a30CqiRxed.end (), " Does not find CQI report for user " << (*itA30).first);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2435
          NS_LOG_INFO (this << " A30-CQI expired for user " << (*itA30).first);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2436
          m_a30CqiRxed.erase (itMap);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2437
          std::map <uint16_t,uint32_t>::iterator temp = itA30;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2438
          itA30++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2439
          m_a30CqiTimers.erase (temp);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2440
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2441
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2442
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2443
          (*itA30).second--;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2444
          itA30++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2445
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2446
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2447
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2448
  return;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2449
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2450
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2451
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2452
void
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2453
PssFfMacScheduler::RefreshUlCqiMaps (void)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2454
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2455
  // refresh UL CQI  Map
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2456
  std::map <uint16_t,uint32_t>::iterator itUl = m_ueCqiTimers.begin ();
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2457
  while (itUl != m_ueCqiTimers.end ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2458
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2459
      NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2460
      if ((*itUl).second == 0)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2461
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2462
          // delete correspondent entries
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2463
          std::map <uint16_t, std::vector <double> >::iterator itMap = m_ueCqi.find ((*itUl).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2464
          NS_ASSERT_MSG (itMap != m_ueCqi.end (), " Does not find CQI report for user " << (*itUl).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2465
          NS_LOG_INFO (this << " UL-CQI exired for user " << (*itUl).first);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2466
          (*itMap).second.clear ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2467
          m_ueCqi.erase (itMap);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2468
          std::map <uint16_t,uint32_t>::iterator temp = itUl;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2469
          itUl++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2470
          m_ueCqiTimers.erase (temp);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2471
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2472
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2473
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2474
          (*itUl).second--;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2475
          itUl++;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2476
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2477
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2478
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2479
  return;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2480
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2481
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2482
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2483
PssFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2484
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2485
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2486
  LteFlowId_t flow (rnti, lcid);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2487
  it = m_rlcBufferReq.find (flow);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2488
  if (it != m_rlcBufferReq.end ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2489
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2490
      NS_LOG_INFO (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2491
      // Update queues: RLC tx order Status, ReTx, Tx
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2492
      // Update status queue
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2493
      if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2494
        {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2495
           (*it).second.m_rlcStatusPduSize = 0;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2496
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2497
      else if (((*it).second.m_rlcRetransmissionQueueSize > 0) && (size >= (*it).second.m_rlcRetransmissionQueueSize))
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2498
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2499
          (*it).second.m_rlcRetransmissionQueueSize = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2500
        }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2501
      else if ((*it).second.m_rlcTransmissionQueueSize > 0)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2502
        {
10063
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2503
          uint32_t rlcOverhead;
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2504
          if (lcid == 1)
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2505
            {
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2506
              // for SRB1 (using RLC AM) it's better to
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2507
              // overestimate RLC overhead rather than
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2508
              // underestimate it and risk unneeded
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2509
              // segmentation which increases delay 
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2510
              rlcOverhead = 4;                                  
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2511
            }
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2512
          else
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2513
            {
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2514
              // minimum RLC overhead due to header
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2515
              rlcOverhead = 2;
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2516
            }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2517
          // update transmission queue
10063
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2518
          if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead)
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2519
            {
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2520
              (*it).second.m_rlcTransmissionQueueSize = 0;
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2521
            }
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2522
          else
10063
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2523
            {                    
6b30859ebd37 merge lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9677
diff changeset
  2524
              (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead;
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2525
            }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2526
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2527
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2528
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2529
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2530
      NS_LOG_ERROR (this << " Does not find DL RLC Buffer Report of UE " << rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2531
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2532
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2533
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2534
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2535
PssFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2536
{
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2537
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2538
  size = size - 2; // remove the minimum RLC overhead
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2539
  std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2540
  if (it != m_ceBsrRxed.end ())
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2541
    {
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2542
      NS_LOG_INFO (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2543
      if ((*it).second >= size)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2544
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2545
          (*it).second -= size;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2546
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2547
      else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2548
        {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2549
          (*it).second = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2550
        }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2551
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2552
  else
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2553
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2554
      NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2555
    }
9654
cd7eb841e50e updated GSoC 2012 schedulers to LENA M5 version
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9159
diff changeset
  2556
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2557
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2558
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2559
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2560
PssFfMacScheduler::TransmissionModeConfigurationUpdate (uint16_t rnti, uint8_t txMode)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2561
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2562
  NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2563
  FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2564
  params.m_rnti = rnti;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2565
  params.m_transmissionMode = txMode;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2566
  m_cschedSapUser->CschedUeConfigUpdateInd (params);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2567
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2568
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2569
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
  2570
}