src/lte/model/rr-ff-mac-scheduler.cc
author Vedran Miletić <rivanvx@gmail.com>
Sat, 01 Sep 2012 20:57:21 +0200
changeset 9063 32755d0516f4
parent 9059 47aa9789ed30
child 9155 3a2efbb0e7d9
permissions -rw-r--r--
Bug 1237 - code cleanups related to includes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     2
/*
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     4
 *
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     7
 * published by the Free Software Foundation;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     8
 *
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    12
 * GNU General Public License for more details.
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    13
 *
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    17
 *
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    19
 */
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    20
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    21
#include <ns3/log.h>
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    22
#include <ns3/pointer.h>
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 9059
diff changeset
    23
#include <ns3/math.h>
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    24
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
    25
#include <ns3/lte-amc.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
    26
#include <ns3/rr-ff-mac-scheduler.h>
8497
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
    27
#include <ns3/simulator.h>
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
    28
#include <ns3/lte-common.h>
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
    29
#include <ns3/lte-vendor-specific-parameters.h>
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    30
7906
d58de34e41d3 MAC, RRC and Scheduler created by LenaHelper
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7897
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler");
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    32
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    33
namespace ns3 {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    34
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    35
int Type0AllocationRbg[4] = {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    36
  10,       // RGB size 1
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    37
  26,       // RGB size 2
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    38
  63,       // RGB size 3
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    39
  110       // RGB size 4
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    40
};  // see table 7.1.6.1-1 of 36.213
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    41
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    42
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
    43
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
    44
7906
d58de34e41d3 MAC, RRC and Scheduler created by LenaHelper
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7897
diff changeset
    45
NS_OBJECT_ENSURE_REGISTERED (RrFfMacScheduler);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    46
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    47
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    48
class RrSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    49
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    50
public:
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    51
  RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    52
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    53
  // inherited from FfMacCschedSapProvider
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    54
  virtual void CschedCellConfigReq (const struct CschedCellConfigReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    55
  virtual void CschedUeConfigReq (const struct CschedUeConfigReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    56
  virtual void CschedLcConfigReq (const struct CschedLcConfigReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    57
  virtual void CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    58
  virtual void CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    59
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    60
private:
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    61
  RrSchedulerMemberCschedSapProvider ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    62
  RrFfMacScheduler* m_scheduler;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    63
};
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    64
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    65
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    66
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    67
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    68
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    69
RrSchedulerMemberCschedSapProvider::RrSchedulerMemberCschedSapProvider (RrFfMacScheduler* scheduler) : m_scheduler (scheduler)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    70
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    71
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    72
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    73
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    74
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    75
RrSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    76
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    77
  m_scheduler->DoCschedCellConfigReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    78
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    79
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    80
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    81
RrSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    82
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    83
  m_scheduler->DoCschedUeConfigReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    84
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    85
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    86
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    87
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    88
RrSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    89
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    90
  m_scheduler->DoCschedLcConfigReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    91
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    92
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    93
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
    94
RrSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    95
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    96
  m_scheduler->DoCschedLcReleaseReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    97
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    98
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
    99
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   100
RrSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   101
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   102
  m_scheduler->DoCschedUeReleaseReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   103
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   104
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   105
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   106
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   107
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   108
class RrSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   109
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   110
public:
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   111
  RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   112
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   113
  // inherited from FfMacSchedSapProvider
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   114
  virtual void SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   115
  virtual void SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   116
  virtual void SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   117
  virtual void SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   118
  virtual void SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   119
  virtual void SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   120
  virtual void SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   121
  virtual void SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   122
  virtual void SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   123
  virtual void SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   124
  virtual void SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   125
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   126
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   127
private:
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   128
  RrSchedulerMemberSchedSapProvider ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   129
  RrFfMacScheduler* m_scheduler;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   130
};
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   131
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   132
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   133
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   134
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   135
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   136
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   137
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   138
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   139
RrSchedulerMemberSchedSapProvider::RrSchedulerMemberSchedSapProvider (RrFfMacScheduler* scheduler)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   140
  : m_scheduler (scheduler)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   141
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   142
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   143
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   144
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   145
RrSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   146
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   147
  m_scheduler->DoSchedDlRlcBufferReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   148
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   149
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   150
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   151
RrSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   152
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   153
  m_scheduler->DoSchedDlPagingBufferReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   154
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   155
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   156
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   157
RrSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   158
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   159
  m_scheduler->DoSchedDlMacBufferReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   160
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   161
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   162
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   163
RrSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   164
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   165
  m_scheduler->DoSchedDlTriggerReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   166
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   167
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   168
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   169
RrSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   170
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   171
  m_scheduler->DoSchedDlRachInfoReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   172
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   173
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   174
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   175
RrSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   176
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   177
  m_scheduler->DoSchedDlCqiInfoReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   178
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   179
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   180
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   181
RrSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   182
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   183
  m_scheduler->DoSchedUlTriggerReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   184
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   185
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   186
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   187
RrSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   188
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   189
  m_scheduler->DoSchedUlNoiseInterferenceReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   190
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   191
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   192
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   193
RrSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   194
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   195
  m_scheduler->DoSchedUlSrInfoReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   196
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   197
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   198
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   199
RrSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   200
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   201
  m_scheduler->DoSchedUlMacCtrlInfoReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   202
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   203
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   204
void
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   205
RrSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   206
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   207
  m_scheduler->DoSchedUlCqiInfoReq (params);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   208
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   209
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   210
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   211
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   212
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   213
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   214
RrFfMacScheduler::RrFfMacScheduler ()
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   215
  :   m_cschedSapUser (0),
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   216
    m_schedSapUser (0),
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   217
    m_nextRntiDl (0),
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   218
    m_nextRntiUl (0)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   219
{
8525
23d9706114f8 Change LteAmc* to Ptr<LteAmc> in RR scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8516
diff changeset
   220
  m_amc = CreateObject <LteAmc> ();
7888
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   221
  m_cschedSapProvider = new RrSchedulerMemberCschedSapProvider (this);
06a7383d3bf0 renamed member SAPs
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   222
  m_schedSapProvider = new RrSchedulerMemberSchedSapProvider (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   223
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   224
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   225
RrFfMacScheduler::~RrFfMacScheduler ()
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   226
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   227
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   228
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   229
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   230
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   231
RrFfMacScheduler::DoDispose ()
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   232
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   233
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   234
  delete m_cschedSapProvider;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   235
  delete m_schedSapProvider;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   236
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   237
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   238
TypeId
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   239
RrFfMacScheduler::GetTypeId (void)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   240
{
7983
b91d5a39aabc scheduler and propagation model configurable through ConfigStore
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   241
  static TypeId tid = TypeId ("ns3::RrFfMacScheduler")
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   242
    .SetParent<FfMacScheduler> ()
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   243
    .AddConstructor<RrFfMacScheduler> ()
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   244
    .AddAttribute ("CqiTimerThreshold",
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   245
                   "The number of TTIs a CQI is valid (default 1000 - 1 sec.)",
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   246
                   UintegerValue (1000),
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   247
                   MakeUintegerAccessor (&RrFfMacScheduler::m_cqiTimersThreshold),
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   248
                   MakeUintegerChecker<uint32_t> ())
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   249
    ;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   250
  return tid;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   251
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   252
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   253
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   254
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   255
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   256
RrFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   257
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   258
  m_cschedSapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   259
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   260
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   261
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   262
RrFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   263
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   264
  m_schedSapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   265
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   266
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   267
FfMacCschedSapProvider*
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   268
RrFfMacScheduler::GetFfMacCschedSapProvider ()
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   269
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   270
  return m_cschedSapProvider;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   271
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   272
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   273
FfMacSchedSapProvider*
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   274
RrFfMacScheduler::GetFfMacSchedSapProvider ()
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   275
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   276
  return m_schedSapProvider;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   277
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   278
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   279
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   280
RrFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::CschedCellConfigReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   281
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   282
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   283
  // Read the subset of parameters used
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   284
  m_cschedCellConfig = params;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   285
  FfMacCschedSapUser::CschedUeConfigCnfParameters cnf;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   286
  cnf.m_result = SUCCESS;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   287
  m_cschedSapUser->CschedUeConfigCnf (cnf);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   288
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   289
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   290
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   291
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   292
RrFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::CschedUeConfigReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   293
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   294
  NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   295
  std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   296
  if (it==m_uesTxMode.end ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   297
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   298
      m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   299
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   300
  else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   301
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   302
      (*it).second = params.m_transmissionMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   303
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   304
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   305
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   306
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   307
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   308
RrFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   309
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   310
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   311
  // Not used at this stage
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   312
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   313
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   314
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   315
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   316
RrFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   317
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   318
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   319
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   320
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   321
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   322
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   323
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   324
RrFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   325
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   326
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   327
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   328
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   329
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   330
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   331
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   332
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   333
RrFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   334
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   335
  NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   336
  // API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
8413
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   337
  std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
7972
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   338
  bool newLc = true;
8413
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   339
  while (it != m_rlcBufferReq.end ())
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   340
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   341
      // remove old entries of this UE-LC
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   342
      if (((*it).m_rnti == params.m_rnti)&&((*it).m_logicalChannelIdentity == params.m_logicalChannelIdentity))
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   343
        {
8412
018034c10dec fixed RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8342
diff changeset
   344
          it = m_rlcBufferReq.erase (it);
7972
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   345
          newLc = false;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   346
        }
8413
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   347
      else
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   348
        {
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   349
          ++it;
3387abb7a77c better fix for RR scheduler buffer status report bug
Nicola Baldo <nbaldo@cttc.es>
parents: 8412
diff changeset
   350
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   351
    }
7972
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   352
  // add the new parameters
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   353
  m_rlcBufferReq.insert (it, params);
7972
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   354
  // initialize statistics of the flow in case of new flows
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   355
  if (newLc == true)
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   356
    {
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   357
      m_p10CqiRxed.insert ( std::pair<uint16_t, uint8_t > (params.m_rnti, 1)); // only codeword 0 at this stage (SISO)
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   358
      // initialized to 1 (i.e., the lowest value for transmitting a signal)
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   359
      m_p10CqiTimers.insert ( std::pair<uint16_t, uint32_t > (params.m_rnti, m_cqiTimersThreshold));
7972
6d24eb482e41 LENA-80 RrFfMacScheduler::DoSchedDlTriggerReq solved issue on nFlows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7966
diff changeset
   360
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   361
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   362
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   363
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   364
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   365
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   366
RrFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   367
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   368
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   369
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   370
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   371
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   372
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   373
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   374
RrFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   375
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   376
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   377
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   378
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   379
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   380
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   381
int
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   382
RrFfMacScheduler::GetRbgSize (int dlbandwidth)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   383
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   384
  for (int i = 0; i < 4; i++)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   385
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   386
      if (dlbandwidth < Type0AllocationRbg[i])
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   387
        {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   388
          return (i + 1);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   389
        }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   390
    }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   391
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   392
  return (-1);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   393
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   394
8320
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   395
bool
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   396
RrFfMacScheduler::SortRlcBufferReq (FfMacSchedSapProvider::SchedDlRlcBufferReqParameters i,FfMacSchedSapProvider::SchedDlRlcBufferReqParameters j)
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   397
{
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   398
  return (i.m_rnti<j.m_rnti);
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   399
}
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   400
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   401
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   402
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   403
RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   404
{
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   405
  NS_LOG_FUNCTION (this << " DL Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   406
  // API generated by RLC for triggering the scheduling of a DL subframe
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   407
  
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   408
  RefreshDlCqiMaps ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   409
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   410
  // Get the actual active flows (queue!=0)
8320
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   411
  std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
756e0218720d Bug-fix in RrFfMacScheduler::DoSchedDlTriggerReq when scheduling multiple LCs per UE
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
   412
  m_rlcBufferReq.sort (SortRlcBufferReq);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   413
  int nflows = 0;
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   414
  int nTbs = 0;
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   415
  std::map <uint16_t,uint8_t> lcActivesPerRnti;
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   416
  std::map <uint16_t,uint8_t>::iterator itLcRnti;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   417
  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   418
    {
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   419
//       NS_LOG_INFO (this << " User " << (*it).m_rnti << " LC " << (uint16_t)(*it).m_logicalChannelIdentity);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   420
      // remove old entries of this UE-LC
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   421
      if ( ((*it).m_rlcTransmissionQueueSize > 0)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   422
           || ((*it).m_rlcRetransmissionQueueSize > 0)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   423
           || ((*it).m_rlcStatusPduSize > 0) )
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   424
        {
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   425
          std::map <uint16_t,uint8_t>::iterator itCqi = m_p10CqiRxed.find ((*it).m_rnti);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   426
          uint8_t cqi = 0;
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   427
          if (itCqi != m_p10CqiRxed.end ())
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   428
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   429
              cqi = (*itCqi).second;
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   430
            }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   431
          else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   432
            {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   433
              cqi = 1; // lowest value fro trying a transmission
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   434
            }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   435
          if (cqi != 0)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   436
            {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   437
              // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   438
              nflows++;
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   439
              itLcRnti = lcActivesPerRnti.find ((*it).m_rnti);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   440
              if (itLcRnti != lcActivesPerRnti.end ())
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   441
                {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   442
                  (*itLcRnti).second++;
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   443
                }
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   444
              else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   445
                {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   446
                  lcActivesPerRnti.insert (std::pair<uint16_t, uint8_t > ((*it).m_rnti, 1));
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   447
                  nTbs++;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   448
                }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   449
        
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   450
            }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   451
        }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   452
    }
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   453
    
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   454
  if (nflows == 0)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   455
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   456
      return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   457
    }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   458
  // Divide the resource equally among the active users according to
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   459
  // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   460
  int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   461
  int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   462
  int rbgPerTb = rbgNum / nTbs;
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   463
  if (rbgPerTb == 0)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   464
    {
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   465
      rbgPerTb = 1;                // at least 1 rbg per TB (till available resource)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   466
    }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   467
  int rbgAllocated = 0;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   468
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   469
  FfMacSchedSapUser::SchedDlConfigIndParameters ret;
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   470
  // round robin assignment to all UE-LC registered starting from the subsequent of the one
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   471
  // served last scheduling trigger
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   472
  //NS_LOG_DEBUG (this << " next to be served " << m_nextRntiDl << " nflows " << nflows);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   473
  if (m_nextRntiDl != 0)
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   474
    {
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   475
      for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   476
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   477
          if ((*it).m_rnti == m_nextRntiDl)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   478
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   479
              break;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   480
            }
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   481
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   482
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   483
      if (it == m_rlcBufferReq.end ())
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   484
        {
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   485
          NS_LOG_ERROR (this << " no user found");
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   486
        }
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   487
    }
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   488
  else
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   489
    {
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   490
      it = m_rlcBufferReq.begin ();
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   491
      m_nextRntiDl = (*it).m_rnti;
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   492
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   493
  std::map <uint16_t,uint8_t>::iterator itTxMode;
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   494
  do
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   495
    {
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   496
      itLcRnti = lcActivesPerRnti.find ((*it).m_rnti);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   497
      if (itLcRnti == lcActivesPerRnti.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   498
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   499
          // skip this entry
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   500
          it++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   501
          if (it == m_rlcBufferReq.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   502
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   503
              // restart from the first
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   504
              it = m_rlcBufferReq.begin ();
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   505
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   506
          continue;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   507
        }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   508
      itTxMode = m_uesTxMode.find ((*it).m_rnti);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   509
      if (itTxMode == m_uesTxMode.end())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   510
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   511
          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).m_rnti);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   512
        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   513
      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   514
      int lcNum = (*itLcRnti).second;
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   515
      // create new BuildDataListElement_s for this RNTI
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   516
      BuildDataListElement_s newEl;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   517
      newEl.m_rnti = (*it).m_rnti;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   518
      // create the DlDciListElement_s
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   519
      DlDciListElement_s newDci;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   520
      newDci.m_rnti = (*it).m_rnti;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   521
      newDci.m_resAlloc = 0;
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   522
      newDci.m_rbBitmap = 0;
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   523
      std::map <uint16_t,uint8_t>::iterator itCqi = m_p10CqiRxed.find (newEl.m_rnti);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   524
      for (uint8_t i = 0; i < nLayer; i++) 
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   525
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   526
          if (itCqi == m_p10CqiRxed.end ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   527
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   528
              newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   529
            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   530
          else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   531
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   532
              newDci.m_mcs.push_back ( m_amc->GetMcsFromCqi ((*itCqi).second) );
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   533
            }
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   534
        }
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   535
      // group the LCs of this RNTI
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   536
      std::vector <struct RlcPduListElement_s> newRlcPduLe;
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   537
//       int totRbg = lcNum * rbgPerFlow;
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   538
//       totRbg = rbgNum / nTbs;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   539
      int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * rbgSize) / 8);
9044
e8595c3ac95b Add testcase for DL control channels (PCFICH+PDCCH) to lte-phy-error-model test suite
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9042
diff changeset
   540
      NS_LOG_DEBUG (this << " DL - Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " <<  rbgAllocated * rbgSize << "..." << (rbgAllocated* rbgSize) + (rbgPerTb * rbgSize) - 1 << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " layers " << nLayer);
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   541
      uint16_t rlcPduSize = tbSize / lcNum;
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   542
      for (int i = 0; i < lcNum ; i++)
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   543
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   544
          for (uint8_t j = 0; j < nLayer; j++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   545
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   546
              RlcPduListElement_s newRlcEl;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   547
              newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity;
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   548
//               NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << rlcPduSize << " ID " << (*it).m_rnti << " layer " << (uint16_t)j);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   549
              newRlcEl.m_size = rlcPduSize;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   550
              UpdateDlRlcBufferInfo ((*it).m_rnti, newRlcEl.m_logicalChannelIdentity, rlcPduSize);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   551
              newRlcPduLe.push_back (newRlcEl);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   552
            }
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   553
          it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   554
          if (it == m_rlcBufferReq.end ())
8020
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   555
            {
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   556
              // restart from the first
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   557
              it = m_rlcBufferReq.begin ();
fc705bc87348 Round Robin circular scheduling upgrade
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   558
            }
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   559
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   560
      uint32_t rbgMask = 0;
8342
ae80a024c11e Bug-fix RrFfMacScheduler::DoSchedDlTriggerReq DCI TB size per multiple LCs
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   561
      for (int i = 0; i < rbgPerTb; i++)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   562
        {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   563
          rbgMask = rbgMask + (0x1 << rbgAllocated);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   564
          rbgAllocated++;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   565
        }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   566
      newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   567
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   568
      for (int i = 0; i < nLayer; i++)
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   569
        {
7977
9a44dfd0056d LENA-68 RrFfMacScheduler 1 TB per RNTI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7972
diff changeset
   570
          newDci.m_tbsSize.push_back (tbSize);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   571
          newDci.m_ndi.push_back (1); // TBD (new data indicator)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   572
          newDci.m_rv.push_back (0); // TBD (redundancy version)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   573
        }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   574
      newEl.m_dci = newDci;
7897
313a02778014 DL PF Scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7895
diff changeset
   575
      // ...more parameters -> ignored in this version
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   576
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   577
7953
1db2126cb7c9 PfFfMacScheduler updated for multiples rlcPdu
mmiozzo
parents: 7948
diff changeset
   578
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   579
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   580
      newEl.m_rlcPduList.push_back (newRlcPduLe);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   581
      ret.m_buildDataList.push_back (newEl);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   582
      if (rbgAllocated == rbgNum)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   583
        {
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8020
diff changeset
   584
          //NS_LOG_DEBUG (this << " FULL " << (*it).m_rnti);
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   585
          m_nextRntiDl = (*it).m_rnti; // store last RNTI served
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   586
          break;                       // no more RGB to be allocated
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   587
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   588
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   589
  while ((*it).m_rnti != m_nextRntiDl);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   590
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   591
  ret.m_nrOfPdcchOfdmSymbols = 1;   // TODO: check correct value according the DCIs txed
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   592
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   593
  m_schedSapUser->SchedDlConfigInd (ret);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   594
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   595
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   596
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   597
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   598
RrFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   599
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   600
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   601
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   602
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   603
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   604
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   605
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   606
RrFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   607
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   608
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   609
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   610
  std::map <uint16_t,uint8_t>::iterator it;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   611
  for (unsigned int i = 0; i < params.m_cqiList.size (); i++)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   612
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   613
      if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 )
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   614
        {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   615
          // wideband CQI reporting
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   616
          std::map <uint16_t,uint8_t>::iterator it;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   617
          uint16_t rnti = params.m_cqiList.at (i).m_rnti;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   618
          it = m_p10CqiRxed.find (rnti);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   619
          if (it == m_p10CqiRxed.end ())
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   620
            {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   621
              // create the new entry
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   622
              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)
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   623
              // generate correspondent timer
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   624
              m_p10CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   625
            }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   626
          else
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   627
            {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   628
              // update the CQI value
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   629
              (*it).second = params.m_cqiList.at (i).m_wbCqi.at (0);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   630
              // update correspondent timer
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   631
              std::map <uint16_t,uint32_t>::iterator itTimers;
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   632
              itTimers = m_p10CqiTimers.find (rnti);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   633
              (*itTimers).second = m_cqiTimersThreshold;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   634
            }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   635
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   636
      else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 )
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   637
        {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   638
          // subband CQI reporting high layer configured 
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   639
          // Not used by RR Scheduler
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   640
        }
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   641
      else
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   642
        {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   643
          NS_LOG_ERROR (this << " CQI type unknown");
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7888
diff changeset
   644
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   645
    }
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   646
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   647
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   648
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   649
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   650
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   651
RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   652
{
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   653
  NS_LOG_FUNCTION (this << " Ul - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   654
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   655
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   656
  RefreshUlCqiMaps ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   657
  
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
   658
  std::map <uint16_t,uint32_t>::iterator it; 
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   659
  int nflows = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   660
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   661
  for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   662
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   663
      // remove old entries of this UE-LC
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   664
      if ((*it).second > 0)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   665
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   666
          nflows++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   667
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   668
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   669
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   670
  if (nflows == 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   671
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   672
      return ; // no flows to be scheduled
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   673
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   674
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   675
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   676
  // Divide the resource equally among the active users starting from the subsequent one served last scheduling trigger
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   677
  int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   678
  if (rbPerFlow == 0)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   679
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   680
      rbPerFlow = 1;              // at least 1 rbg per flow (till available resource)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   681
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   682
  int rbAllocated = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   683
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   684
  FfMacSchedSapUser::SchedUlConfigIndParameters ret;
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   685
  std::vector <uint16_t> rbgAllocationMap;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   686
  if (m_nextRntiUl != 0)
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   687
    {
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   688
      for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   689
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   690
          if ((*it).first == m_nextRntiUl)
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   691
            {
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   692
              break;
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   693
            }
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   694
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   695
      if (it == m_ceBsrRxed.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   696
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   697
          NS_LOG_ERROR (this << " no user found");
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   698
        }
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   699
    }
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   700
  else
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   701
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   702
      it = m_ceBsrRxed.begin ();
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   703
      m_nextRntiUl = (*it).first;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   704
    }
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   705
  do
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   706
    {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   707
      if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   708
        {
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   709
          // limit to physical resources last resource assignment
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   710
          rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   711
        }
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   712
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   713
      UlDciListElement_s uldci;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   714
      uldci.m_rnti = (*it).first;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   715
      uldci.m_rbStart = rbAllocated;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   716
      uldci.m_rbLen = rbPerFlow;
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   717
      std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find ((*it).first);
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   718
      int cqi = 0;
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   719
      if (itCqi == m_ueCqi.end ())
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   720
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   721
          // no cqi info about this UE
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   722
          uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   723
          NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first );
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   724
        }
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   725
      else
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   726
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   727
          // take the lowest CQI value (worst RB)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   728
          double minSinr = (*itCqi).second.at (uldci.m_rbStart);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   729
          for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   730
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   731
              if ((*itCqi).second.at (i) < minSinr)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   732
                {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   733
                  minSinr = (*itCqi).second.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   734
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   735
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   736
          // translate SINR -> cqi: WILD ACK: same as DL
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   737
          double s = log2 ( 1 + (
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 9059
diff changeset
   738
                                 std::pow (10, minSinr / 10 )  /
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents: 9059
diff changeset
   739
                                 ( (-std::log (5.0 * 0.00005 )) / 1.5) ));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   740
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   741
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8513
diff changeset
   742
          cqi = m_amc->GetCqiFromSpectralEfficiency (s);
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   743
          if (cqi == 0)
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   744
            {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   745
              it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   746
              if (it == m_ceBsrRxed.end ())
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   747
                {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   748
                  // restart from the first
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   749
                  it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8077
diff changeset
   750
                }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   751
              continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7953
diff changeset
   752
            }
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8513
diff changeset
   753
          uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   754
//           NS_LOG_DEBUG (this << " UE " <<  (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   755
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   756
        }
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   757
      
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   758
      rbAllocated += rbPerFlow;
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   759
      // store info on allocation for managing ul-cqi interpretation
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   760
      for (int i = 0; i < rbPerFlow; i++)
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   761
        {
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   762
          rbgAllocationMap.push_back ((*it).first);
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   763
        }
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   764
        
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8513
diff changeset
   765
      uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   766
      NS_LOG_DEBUG (this << " UL - UE " << (*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);
8675
e65859f03e99 Bug-fix: update m_ceBsrRxed each UL scheduling trigger event
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   767
      UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   768
      uldci.m_ndi = 1;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   769
      uldci.m_cceIndex = 0;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   770
      uldci.m_aggrLevel = 1;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   771
      uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   772
      uldci.m_hopping = false;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   773
      uldci.m_n2Dmrs = 0;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   774
      uldci.m_tpc = 0; // no power control
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   775
      uldci.m_cqiRequest = false; // only period CQI at this stage
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   776
      uldci.m_ulIndex = 0; // TDD parameter
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   777
      uldci.m_dai = 1; // TDD parameter
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   778
      uldci.m_freqHopping = 0;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   779
      uldci.m_pdcchPowerOffset = 0; // not used
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   780
      ret.m_dciList.push_back (uldci);
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   781
      it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   782
      if (it == m_ceBsrRxed.end ())
8077
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   783
        {
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   784
          // restart from the first
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   785
          it = m_ceBsrRxed.begin ();
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   786
        }
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   787
      if (rbAllocated == m_cschedCellConfig.m_ulBandwidth)
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   788
        {
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   789
          // Stop allocation: no more PRBs
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   790
          m_nextRntiUl = (*it).first;
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   791
          break;
6416d09febbf RrFfMacScheduler updated to circular allocation in uplink
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8067
diff changeset
   792
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   793
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   794
  while ((*it).first != m_nextRntiUl);
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   795
  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   796
  m_schedSapUser->SchedUlConfigInd (ret);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   797
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   798
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   799
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   800
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   801
RrFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   802
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   803
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   804
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   805
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   806
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   807
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   808
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   809
RrFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   810
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   811
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   812
  // TODO: Implementation of the API
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   813
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   814
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   815
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   816
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   817
RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   818
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   819
  NS_LOG_FUNCTION (this);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   820
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
   821
  std::map <uint16_t,uint32_t>::iterator it;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   822
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   823
  for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   824
    {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   825
      if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   826
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   827
          // buffer status report
8887
90cbd09c8ff6 fixed bug with multiple LCs in UL BSR
Nicola Baldo <nbaldo@cttc.es>
parents: 8859
diff changeset
   828
          // note that we only consider LCG 0, the other three LCGs are neglected
90cbd09c8ff6 fixed bug with multiple LCs in UL BSR
Nicola Baldo <nbaldo@cttc.es>
parents: 8859
diff changeset
   829
          // this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   830
          uint16_t rnti = params.m_macCeList.at (i).m_rnti;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   831
          it = m_ceBsrRxed.find (rnti);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   832
          if (it == m_ceBsrRxed.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   833
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   834
              // create the new entry
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
   835
              uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
   836
              int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
8887
90cbd09c8ff6 fixed bug with multiple LCs in UL BSR
Nicola Baldo <nbaldo@cttc.es>
parents: 8859
diff changeset
   837
              m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   838
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   839
          else
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   840
            {
8887
90cbd09c8ff6 fixed bug with multiple LCs in UL BSR
Nicola Baldo <nbaldo@cttc.es>
parents: 8859
diff changeset
   841
              // update the buffer size value
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
   842
              (*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   843
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   844
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   845
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   846
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   847
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   848
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   849
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   850
void
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   851
RrFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   852
{
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   853
  NS_LOG_FUNCTION (this);
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   854
  NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
8321
c674feef9d5f Bug-fix UL Allocation Map storing for UL-CQI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8320
diff changeset
   855
//     NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf "  << sfnSf);
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   856
  switch (m_ulCqiFilter)
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   857
    {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   858
      case FfMacScheduler::SRS_UL_CQI:
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   859
        {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   860
          // filter all the CQIs that are not SRS based
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   861
          if (params.m_ulCqi.m_type!=UlCqi_s::SRS)
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   862
            {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   863
              return;
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   864
            }
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   865
        }
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   866
      break;
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   867
      case FfMacScheduler::PUSCH_UL_CQI:
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   868
        {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   869
          // filter all the CQIs that are not SRS based
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   870
            if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH)
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   871
            {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   872
              return;
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   873
            }
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   874
        }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   875
      case FfMacScheduler::ALL_UL_CQI:
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   876
        break;
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   877
        
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   878
      default:
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   879
        NS_FATAL_ERROR ("Unknown UL CQI type");
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8729
diff changeset
   880
    }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   881
    switch (params.m_ulCqi.m_type)
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7906
diff changeset
   882
    {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   883
      case UlCqi_s::PUSCH:
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   884
        {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   885
          std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   886
          std::map <uint16_t, std::vector <double> >::iterator itCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   887
          itMap = m_allocationMaps.find (params.m_sfnSf);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   888
          if (itMap == m_allocationMaps.end ())
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   889
            {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   890
              NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   891
              return;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   892
            }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   893
          for (uint32_t i = 0; i < (*itMap).second.size (); i++)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   894
            {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   895
              // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   896
              //       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   897
              double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   898
              //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   899
              itCqi = m_ueCqi.find ((*itMap).second.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   900
              if (itCqi == m_ueCqi.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   901
                {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   902
                  // create a new entry
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   903
                  std::vector <double> newCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   904
                  for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   905
                    {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   906
                      if (i == j)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   907
                        {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   908
                          newCqi.push_back (sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   909
                        }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   910
                      else
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   911
                        {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   912
                          // initialize with NO_SINR value.
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   913
                          newCqi.push_back (30.0);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   914
                        }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   915
                      
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   916
                    }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   917
                  m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   918
                  // generate correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   919
                  m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   920
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   921
              else
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   922
                {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   923
                  // update the value
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   924
                  (*itCqi).second.at (i) = sinr;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   925
                  // update correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   926
                  std::map <uint16_t, uint32_t>::iterator itTimers;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   927
                  itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   928
                  (*itTimers).second = m_cqiTimersThreshold;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   929
                  
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   930
                }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   931
              
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   932
            }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   933
          // remove obsolete info on allocation
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   934
          m_allocationMaps.erase (itMap);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   935
        }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   936
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   937
      case UlCqi_s::SRS:
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   938
        {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   939
          // get the RNTI from vendor specific parameters
9059
47aa9789ed30 fix maybe-uninitialized warnings
Tom Henderson <tomh@tomh.org>
parents: 9047
diff changeset
   940
          uint16_t rnti = 0;
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   941
          NS_ASSERT (params.m_vendorSpecificList.size () > 0);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   942
          for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   943
            {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   944
              if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   945
                {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   946
                  Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   947
                  rnti = vsp->GetRnti ();
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   948
                }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   949
            }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   950
          std::map <uint16_t, std::vector <double> >::iterator itCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   951
          itCqi = m_ueCqi.find (rnti);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   952
          if (itCqi == m_ueCqi.end ())
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   953
            {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   954
              // create a new entry
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   955
              std::vector <double> newCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   956
              for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   957
                {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   958
                  double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   959
                  newCqi.push_back (sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   960
                  NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB  " << j << " value " << sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   961
                  
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   962
                }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   963
              m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   964
              // generate correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   965
              m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   966
            }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   967
          else
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   968
            {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   969
              // update the values
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   970
              for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   971
                {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   972
                  double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   973
                  (*itCqi).second.at (j) = sinr;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   974
                  NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB  " << j << " value " << sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   975
                }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   976
              // update correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   977
              std::map <uint16_t, uint32_t>::iterator itTimers;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   978
              itTimers = m_ueCqiTimers.find (rnti);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   979
              (*itTimers).second = m_cqiTimersThreshold;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   980
              
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   981
            }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   982
          
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   983
          
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   984
        }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   985
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   986
      case UlCqi_s::PUCCH_1:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   987
      case UlCqi_s::PUCCH_2:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   988
      case UlCqi_s::PRACH:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   989
        {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   990
          NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   991
        }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   992
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   993
      default:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
   994
        NS_FATAL_ERROR ("Unknown type of UL-CQI");
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8086
diff changeset
   995
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   996
  return;
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   997
}
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
   998
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   999
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1000
void
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1001
RrFfMacScheduler::RefreshDlCqiMaps(void)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1002
{
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1003
  NS_LOG_FUNCTION (this << m_p10CqiTimers.size ());
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1004
  // refresh DL CQI P01 Map
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1005
  std::map <uint16_t,uint32_t>::iterator itP10 = m_p10CqiTimers.begin ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1006
  while (itP10!=m_p10CqiTimers.end ())
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1007
    {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1008
      NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1009
      if ((*itP10).second == 0)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1010
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1011
          // delete correspondent entries
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1012
          std::map <uint16_t,uint8_t>::iterator itMap = m_p10CqiRxed.find ((*itP10).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1013
          NS_ASSERT_MSG (itMap != m_p10CqiRxed.end (), " Does not find CQI report for user " << (*itP10).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1014
          NS_LOG_INFO (this << " P10-CQI exired for user " << (*itP10).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1015
          m_p10CqiRxed.erase (itMap);
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1016
          std::map <uint16_t,uint32_t>::iterator temp = itP10;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1017
          itP10++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1018
          m_p10CqiTimers.erase (temp);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1019
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1020
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1021
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1022
          (*itP10).second--;
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1023
          itP10++;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1024
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1025
    }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1026
  
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1027
  return;
7886
b65c16d4da83 LENA project first public release
CTTC
parents:
diff changeset
  1028
}
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1029
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1030
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1031
void
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1032
RrFfMacScheduler::RefreshUlCqiMaps(void)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1033
{
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1034
  // refresh UL CQI  Map
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1035
  std::map <uint16_t,uint32_t>::iterator itUl = m_ueCqiTimers.begin ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1036
  while (itUl!=m_ueCqiTimers.end ())
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1037
    {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1038
      NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1039
      if ((*itUl).second == 0)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1040
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1041
          // delete correspondent entries
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1042
          std::map <uint16_t, std::vector <double> >::iterator itMap = m_ueCqi.find ((*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1043
          NS_ASSERT_MSG (itMap != m_ueCqi.end (), " Does not find CQI report for user " << (*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1044
          NS_LOG_INFO (this << " UL-CQI exired for user " << (*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1045
          (*itMap).second.clear ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1046
          m_ueCqi.erase (itMap);
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1047
          std::map <uint16_t,uint32_t>::iterator temp = itUl;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1048
          itUl++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1049
          m_ueCqiTimers.erase (temp);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1050
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1051
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1052
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1053
          (*itUl).second--;
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1054
          itUl++;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1055
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1056
    }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1057
  
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1058
  return;
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1059
}
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1060
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1061
void
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1062
RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1063
{
8858
6336a6eabf99 Update Ul and Dl RlcBufferInfo methods of RR and PF scheduler for considering the minimum RLC overhead when decrementing queues
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1064
  size = size - 2; // remove the minimum RLC overhead
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1065
  std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1066
  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1067
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1068
      if (((*it).m_rnti == rnti) && ((*it).m_logicalChannelIdentity))
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1069
        {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1070
//           NS_LOG_DEBUG (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).m_rlcTransmissionQueueSize << " retxqueue " << (*it).m_rlcRetransmissionQueueSize << " status " << (*it).m_rlcStatusPduSize << " decrease " << size);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1071
          // Update queues: RLC tx order Status, ReTx, Tx
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1072
          // Update status queue
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1073
          if ((*it).m_rlcStatusPduSize <= size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1074
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1075
              size -= (*it).m_rlcStatusPduSize;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1076
              (*it).m_rlcStatusPduSize = 0;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1077
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1078
          else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1079
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1080
              (*it).m_rlcStatusPduSize -= size;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1081
              return;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1082
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1083
          // update retransmission queue  
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1084
          if ((*it).m_rlcRetransmissionQueueSize <= size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1085
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1086
              size -= (*it).m_rlcRetransmissionQueueSize;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1087
              (*it).m_rlcRetransmissionQueueSize = 0;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1088
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1089
          else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1090
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1091
              (*it).m_rlcRetransmissionQueueSize -= size;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1092
              return;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1093
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1094
          // update transmission queue
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1095
          if ((*it).m_rlcTransmissionQueueSize <= size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1096
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1097
              size -= (*it).m_rlcTransmissionQueueSize;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1098
              (*it).m_rlcTransmissionQueueSize = 0;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1099
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1100
          else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1101
            {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1102
              (*it).m_rlcTransmissionQueueSize -= size;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1103
              return;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1104
            }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1105
          return;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1106
        }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1107
    }
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1108
}
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1109
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1110
void
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1111
RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1112
{
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1113
8858
6336a6eabf99 Update Ul and Dl RlcBufferInfo methods of RR and PF scheduler for considering the minimum RLC overhead when decrementing queues
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1114
  size = size - 2; // remove the minimum RLC overhead
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1115
  std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1116
  if (it!=m_ceBsrRxed.end ())
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1117
    {
8497
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1118
//       NS_LOG_DEBUG (this << " Update RLC BSR UE " << rnti << " size " << size << " BSR " << (*it).second);      
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1119
      if ((*it).second >= size)
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1120
        {
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1121
          (*it).second -= size;
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1122
        }
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1123
      else
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1124
        {
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1125
          (*it).second = 0;
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  1126
        }
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1127
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1128
  else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1129
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1130
      NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1131
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1132
  
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1133
}
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1134
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1135
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1136
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1137
RrFfMacScheduler::TransmissionModeConfigurationUpdate (uint16_t rnti, uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1138
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1139
  NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1140
  FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1141
  params.m_rnti = rnti;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1142
  params.m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1143
  m_cschedSapUser->CschedUeConfigUpdateInd (params);
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8413
diff changeset
  1144
}
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1145
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1146
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1147
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1148
}