src/lte/model/pf-ff-mac-scheduler.cc
author John Abraham <john.abraham@gatech.edu>
Mon, 25 Jun 2012 11:52:17 -0700
changeset 8869 f43017db07ec
parent 8859 e3c54825650d
child 8887 90cbd09c8ff6
child 9319 dbe853670778
permissions -rw-r--r--
NetAnim: Remove obsolete netanim-config.h
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     2
/*
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     4
 *
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     8
 *
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    12
 * GNU General Public License for more details.
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    13
 *
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    17
 *
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    19
 */
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    20
8812
36d9cc69da14 fix build on FreeBSD
Tom Henderson <tomh@tomh.org>
parents: 8729
diff changeset
    21
#ifdef __FreeBSD__
36d9cc69da14 fix build on FreeBSD
Tom Henderson <tomh@tomh.org>
parents: 8729
diff changeset
    22
#define log2(x) (log(x) / M_LN2)
36d9cc69da14 fix build on FreeBSD
Tom Henderson <tomh@tomh.org>
parents: 8729
diff changeset
    23
#endif /* __FreeBSD__ */
36d9cc69da14 fix build on FreeBSD
Tom Henderson <tomh@tomh.org>
parents: 8729
diff changeset
    24
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    25
#include <ns3/log.h>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    26
#include <ns3/pointer.h>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    27
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    28
#include <ns3/simulator.h>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    29
#include <ns3/lte-amc.h>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    30
#include <ns3/pf-ff-mac-scheduler.h>
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    31
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    32
NS_LOG_COMPONENT_DEFINE ("PfFfMacScheduler");
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    33
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    34
namespace ns3 {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    35
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    36
int PfType0AllocationRbg[4] = {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    37
  10,       // RGB size 1
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    38
  26,       // RGB size 2
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    39
  63,       // RGB size 3
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    40
  110       // RGB size 4
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    41
};  // see table 7.1.6.1-1 of 36.213
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    42
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    43
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    44
NS_OBJECT_ENSURE_REGISTERED (PfFfMacScheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    45
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    46
7936
2c531eab14f1 Move inline code in pf-ff-mac-schedluer to cc file
mmiozzo
parents: 7912
diff changeset
    47
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    48
class PfSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    49
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    50
public:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    51
  PfSchedulerMemberCschedSapProvider (PfFfMacScheduler* scheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    52
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    53
  // inherited from FfMacCschedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    54
  virtual void CschedCellConfigReq (const struct CschedCellConfigReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    55
  virtual void CschedUeConfigReq (const struct CschedUeConfigReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    56
  virtual void CschedLcConfigReq (const struct CschedLcConfigReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    57
  virtual void CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    58
  virtual void CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    59
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    60
private:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    61
  PfSchedulerMemberCschedSapProvider ();
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    62
  PfFfMacScheduler* m_scheduler;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    63
};
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    64
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    65
PfSchedulerMemberCschedSapProvider::PfSchedulerMemberCschedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    66
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    67
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    68
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    69
PfSchedulerMemberCschedSapProvider::PfSchedulerMemberCschedSapProvider (PfFfMacScheduler* scheduler) : m_scheduler (scheduler)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    70
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    71
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    72
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    73
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    74
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    75
PfSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    76
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    77
  m_scheduler->DoCschedCellConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    78
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    79
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    80
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    81
PfSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    82
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    83
  m_scheduler->DoCschedUeConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    84
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    85
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    86
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    87
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    88
PfSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    89
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    90
  m_scheduler->DoCschedLcConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    91
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    92
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    93
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    94
PfSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    95
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    96
  m_scheduler->DoCschedLcReleaseReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    97
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    98
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    99
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   100
PfSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   101
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   102
  m_scheduler->DoCschedUeReleaseReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   103
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   104
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   105
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   106
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   107
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   108
class PfSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   109
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   110
public:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   111
  PfSchedulerMemberSchedSapProvider (PfFfMacScheduler* scheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   112
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   113
  // inherited from FfMacSchedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   114
  virtual void SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   115
  virtual void SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   116
  virtual void SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   117
  virtual void SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   118
  virtual void SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   119
  virtual void SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   120
  virtual void SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   121
  virtual void SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   122
  virtual void SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   123
  virtual void SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   124
  virtual void SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   125
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   126
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   127
private:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   128
  PfSchedulerMemberSchedSapProvider ();
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   129
  PfFfMacScheduler* m_scheduler;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   130
};
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   131
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   132
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   133
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   134
PfSchedulerMemberSchedSapProvider::PfSchedulerMemberSchedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   135
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   136
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   137
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   138
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   139
PfSchedulerMemberSchedSapProvider::PfSchedulerMemberSchedSapProvider (PfFfMacScheduler* scheduler)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   140
  : m_scheduler (scheduler)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   141
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   142
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   143
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   144
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   145
PfSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   146
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   147
  m_scheduler->DoSchedDlRlcBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   148
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   149
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   150
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   151
PfSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   152
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   153
  m_scheduler->DoSchedDlPagingBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   154
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   155
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   156
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   157
PfSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   158
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   159
  m_scheduler->DoSchedDlMacBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   160
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   161
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   162
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   163
PfSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   164
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   165
  m_scheduler->DoSchedDlTriggerReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   166
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   167
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   168
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   169
PfSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   170
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   171
  m_scheduler->DoSchedDlRachInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   172
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   173
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   174
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   175
PfSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   176
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   177
  m_scheduler->DoSchedDlCqiInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   178
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   179
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   180
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   181
PfSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   182
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   183
  m_scheduler->DoSchedUlTriggerReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   184
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   185
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   186
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   187
PfSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   188
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   189
  m_scheduler->DoSchedUlNoiseInterferenceReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   190
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   191
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   192
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   193
PfSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   194
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   195
  m_scheduler->DoSchedUlSrInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   196
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   197
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   198
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   199
PfSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   200
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   201
  m_scheduler->DoSchedUlMacCtrlInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   202
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   203
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   204
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   205
PfSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   206
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   207
  m_scheduler->DoSchedUlCqiInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   208
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   209
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   210
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   211
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   212
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   213
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   214
PfFfMacScheduler::PfFfMacScheduler ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   215
  :   m_cschedSapUser (0),
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   216
    m_schedSapUser (0),
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   217
    m_timeWindow (99.0),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   218
    m_nextRntiUl (0)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   219
{
8523
0c515ddca47b Change LteAmc* to Ptr<LteAmc> in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8516
diff changeset
   220
  m_amc = CreateObject <LteAmc> ();
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   221
  m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   222
  m_schedSapProvider = new PfSchedulerMemberSchedSapProvider (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   223
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   224
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   225
PfFfMacScheduler::~PfFfMacScheduler ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   226
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   227
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   228
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   229
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   230
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   231
PfFfMacScheduler::DoDispose ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   232
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   233
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   234
  delete m_cschedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   235
  delete m_schedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   236
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   237
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   238
TypeId
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   239
PfFfMacScheduler::GetTypeId (void)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   240
{
7983
b91d5a39aabc scheduler and propagation model configurable through ConfigStore
Nicola Baldo <nbaldo@cttc.es>
parents: 7979
diff changeset
   241
  static TypeId tid = TypeId ("ns3::PfFfMacScheduler")
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
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<PfFfMacScheduler> ()
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 (&PfFfMacScheduler::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
    ;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   250
  return tid;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   251
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   252
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   253
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   254
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   255
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   256
PfFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   257
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   258
  m_cschedSapUser = s;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   259
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   260
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   261
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   262
PfFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   263
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   264
  m_schedSapUser = s;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   265
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   266
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   267
FfMacCschedSapProvider*
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   268
PfFfMacScheduler::GetFfMacCschedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   269
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   270
  return m_cschedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   271
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   272
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   273
FfMacSchedSapProvider*
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   274
PfFfMacScheduler::GetFfMacSchedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   275
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   276
  return m_schedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   277
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   278
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   279
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   280
PfFfMacScheduler::DoCschedCellConfigReq (const struct FfMacCschedSapProvider::CschedCellConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   281
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   282
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   283
  // Read the subset of parameters used
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   284
  m_cschedCellConfig = params;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   285
  FfMacCschedSapUser::CschedUeConfigCnfParameters cnf;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   286
  cnf.m_result = SUCCESS;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   287
  m_cschedSapUser->CschedUeConfigCnf (cnf);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   288
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   289
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   290
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   291
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   292
PfFfMacScheduler::DoCschedUeConfigReq (const struct FfMacCschedSapProvider::CschedUeConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
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
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   304
  return;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   305
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   306
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   307
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   308
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   309
PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::CschedLcConfigReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   310
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   311
  NS_LOG_FUNCTION (this << " New LC, rnti: "  << params.m_rnti);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   312
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   313
  std::map <uint16_t, pfsFlowPerf_t>::iterator it;
7909
82b1281ea0a3 Updates for MACOS compilation (virtual destructors and variable types)
mmiozzo
parents: 7899
diff changeset
   314
  for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   315
    {
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   316
      it = m_flowStatsDl.find (params.m_rnti);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   317
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   318
      if (it == m_flowStatsDl.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   319
        {
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   320
          pfsFlowPerf_t flowStatsDl;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   321
          flowStatsDl.flowStart = Simulator::Now ();
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   322
          flowStatsDl.totalBytesTransmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   323
          flowStatsDl.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   324
          flowStatsDl.lastAveragedThroughput = 1;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   325
          m_flowStatsDl.insert (std::pair<uint16_t, pfsFlowPerf_t> (params.m_rnti, flowStatsDl));
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   326
          pfsFlowPerf_t flowStatsUl;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   327
          flowStatsUl.flowStart = Simulator::Now ();
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   328
          flowStatsUl.totalBytesTransmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   329
          flowStatsUl.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   330
          flowStatsUl.lastAveragedThroughput = 1;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   331
          m_flowStatsUl.insert (std::pair<uint16_t, pfsFlowPerf_t> (params.m_rnti, flowStatsUl));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   332
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   333
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   334
        {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   335
          NS_LOG_ERROR ("RNTI already exists");
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   336
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   337
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   338
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   339
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   340
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   341
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   342
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   343
PfFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::CschedLcReleaseReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   344
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   345
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   346
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   347
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   348
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   349
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   350
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   351
PfFfMacScheduler::DoCschedUeReleaseReq (const struct FfMacCschedSapProvider::CschedUeReleaseReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   352
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   353
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   354
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   355
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   356
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   357
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   358
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   359
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   360
PfFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::SchedDlRlcBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   361
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   362
  NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   363
  // API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   364
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   365
  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   366
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7968
diff changeset
   367
  LteFlowId_t flow (params.m_rnti, params.m_logicalChannelIdentity);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   368
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   369
  it =  m_rlcBufferReq.find (flow);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   370
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   371
  if (it == m_rlcBufferReq.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   372
    {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   373
      m_rlcBufferReq.insert (std::pair <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters> (flow, params));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   374
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   375
  else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   376
    {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   377
      (*it).second = params;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   378
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   379
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   380
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   381
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   382
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   383
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   384
PfFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::SchedDlPagingBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   385
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   386
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   387
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   388
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   389
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   390
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   391
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   392
PfFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::SchedDlMacBufferReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   393
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   394
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   395
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   396
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   397
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   398
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   399
int
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   400
PfFfMacScheduler::GetRbgSize (int dlbandwidth)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   401
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   402
  for (int i = 0; i < 4; i++)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   403
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   404
      if (dlbandwidth < PfType0AllocationRbg[i])
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   405
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   406
          return (i + 1);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   407
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   408
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   409
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   410
  return (-1);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   411
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   412
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   413
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   414
int 
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   415
PfFfMacScheduler::LcActivePerFlow (uint16_t rnti)
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   416
{
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   417
  std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   418
  int lcActive = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   419
  for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   420
    {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   421
      if (((*it).first.m_rnti == rnti) && (((*it).second.m_rlcTransmissionQueueSize > 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   422
                                           || ((*it).second.m_rlcRetransmissionQueueSize > 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   423
                                           || ((*it).second.m_rlcStatusPduSize > 0) ))
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   424
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   425
          lcActive++;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   426
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   427
      if ((*it).first.m_rnti > rnti)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   428
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   429
          break;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   430
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   431
    }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   432
  return (lcActive);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   433
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   434
}
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   435
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   436
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   437
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   438
PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::SchedDlTriggerReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   439
{
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   440
  NS_LOG_FUNCTION (this << " Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   441
  // API generated by RLC for triggering the scheduling of a DL subframe
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   442
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   443
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   444
  // evaluate the relative channel quality indicator for each UE per each RBG 
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   445
  // (since we are using allocation type 0 the small unit of allocation is RBG)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   446
  // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   447
  
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   448
  RefreshDlCqiMaps ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   449
  
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   450
  int rbgSize = GetRbgSize (m_cschedCellConfig.m_dlBandwidth);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   451
  int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   452
  std::map <uint16_t, std::vector <uint16_t> > allocationMap;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   453
  for (int i = 0; i < rbgNum; i++)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   454
    {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   455
//       NS_LOG_DEBUG (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   456
      std::map <uint16_t, pfsFlowPerf_t>::iterator it;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   457
      std::map <uint16_t, pfsFlowPerf_t>::iterator itMax = m_flowStatsDl.end ();
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   458
      double rcqiMax = 0.0;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   459
      for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.end (); it++)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   460
        {
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   461
          std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   462
          itCqi = m_a30CqiRxed.find ((*it).first);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   463
          std::map <uint16_t,uint8_t>::iterator itTxMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   464
          itTxMode = m_uesTxMode.find ((*it).first);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   465
          if (itTxMode == m_uesTxMode.end())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   466
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   467
              NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   468
            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   469
          int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   470
          std::vector <uint8_t> sbCqi;
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   471
          if (itCqi == m_a30CqiRxed.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   472
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   473
//               NS_LOG_DEBUG (this << " No DL-CQI for this UE " << (*it).first);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   474
              for (uint8_t k = 0; k < nLayer; k++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   475
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   476
                  sbCqi.push_back (1);  // start with lowest value
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   477
                }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   478
            }
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   479
          else
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   480
            {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   481
              sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   482
//               NS_LOG_INFO (this << " CQI " << (uint32_t)cqi);
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   483
            }
8716
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   484
          uint8_t cqi1 = sbCqi.at(0);
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   485
          uint8_t cqi2 = 1;
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   486
          if (sbCqi.size () > 1)
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   487
            {
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   488
              cqi2 = sbCqi.at(1);
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   489
            }
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   490
          
ecf992a9c825 Buf-fix CQI map access in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   491
          if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   492
            {
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   493
//               NS_LOG_DEBUG (this << " LC active " << LcActivePerFlow ((*it).first));
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   494
              if (LcActivePerFlow ((*it).first) > 0)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   495
                {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   496
                  // this UE has data to transmit
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   497
                  double achievableRate = 0.0;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   498
                  for (uint8_t k = 0; k < nLayer; k++) 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   499
                    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   500
                      uint8_t mcs = 0; 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   501
                      if (sbCqi.size () > k)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   502
                        {                       
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   503
                          mcs = m_amc->GetMcsFromCqi (sbCqi.at (k));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   504
                        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   505
                      else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   506
                        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   507
                          // no info on this subband -> worst MCS
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   508
                          mcs = 0;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   509
                        }
8852
84a2915c73b1 Bug-fix PF scheduler DoSchedDlTriggerReq achievableRate evaluated per RB instead oof RBG
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8812
diff changeset
   510
                        achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   511
                    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   512
                  
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   513
                  double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   514
//                   NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   515
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   516
                  if (rcqi > rcqiMax)
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   517
                    {
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   518
                      rcqiMax = rcqi;
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   519
                      itMax = it;
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   520
                    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   521
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   522
            }   // end if cqi
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   523
        } // end for m_rlcBufferReq
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   524
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   525
      if (itMax == m_flowStatsDl.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   526
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   527
          // no UE available for this RB
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   528
          NS_LOG_DEBUG (this << " no UE found");
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   529
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   530
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   531
        {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   532
          std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   533
          itMap = allocationMap.find ((*itMax).first);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   534
          if (itMap == allocationMap.end ())
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   535
            {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   536
              // insert new element
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   537
              std::vector <uint16_t> tempMap;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   538
              tempMap.push_back (i);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   539
              allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax).first, tempMap));
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   540
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   541
          else
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   542
            {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   543
              (*itMap).second.push_back (i);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   544
            }
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   545
//           NS_LOG_DEBUG (this << " UE assigned " << (*itMax).first);
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   546
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   547
    } // end for RBGs
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   548
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   549
  // reset TTI stats of users
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   550
  std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   551
  for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   552
    {
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   553
      (*itStats).second.lastTtiBytesTrasmitted = 0;
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   554
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   555
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   556
  // generate the transmission opportunities by grouping the RBGs of the same RNTI and
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   557
  // creating the correspondent DCIs
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   558
  FfMacSchedSapUser::SchedDlConfigIndParameters ret;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   559
  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap = allocationMap.begin ();
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   560
  while (itMap != allocationMap.end ())
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   561
    {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   562
      // create new BuildDataListElement_s for this LC
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   563
      BuildDataListElement_s newEl;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   564
      newEl.m_rnti = (*itMap).first;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   565
      // create the DlDciListElement_s
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   566
      DlDciListElement_s newDci;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   567
      std::vector <struct RlcPduListElement_s> newRlcPduLe;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   568
      newDci.m_rnti = (*itMap).first;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   569
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   570
      uint16_t lcActives = LcActivePerFlow ((*itMap).first);
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   571
//       NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << lcActives);
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   572
      uint16_t RgbPerRnti = (*itMap).second.size ();
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   573
      std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   574
      itCqi = m_a30CqiRxed.find ((*itMap).first);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   575
      std::map <uint16_t,uint8_t>::iterator itTxMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   576
      itTxMode = m_uesTxMode.find ((*itMap).first);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   577
      if (itTxMode == m_uesTxMode.end())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   578
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   579
          NS_FATAL_ERROR ("No Transmission Mode info on user " << (*itMap).first);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   580
        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   581
      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   582
      std::vector <uint8_t> worstCqi (2, 15);
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   583
      if (itCqi != m_a30CqiRxed.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   584
        {
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   585
          for (uint16_t k = 0; k < (*itMap).second.size (); k++)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   586
            {
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   587
              if ((*itCqi).second.m_higherLayerSelected.size () > (*itMap).second.at (k))
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   588
                {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   589
//                 NS_LOG_DEBUG (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   590
                  for (uint8_t j = 0; j < nLayer; j++) 
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   591
                    {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   592
                      if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size ()> j)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   593
                        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   594
                          if (((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j)) < worstCqi.at (j))
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   595
                            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   596
                              worstCqi.at (j) = ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (j));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   597
                            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   598
                        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   599
                      else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   600
                        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   601
                          // no CQI for this layer of this suband -> worst one
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   602
                          worstCqi.at (j) = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   603
                        }
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   604
                    }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   605
                }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   606
              else
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   607
                {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   608
                  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
   609
                    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   610
                      worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   611
                    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   612
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   613
            }
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   614
        }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   615
      else
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
   616
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   617
          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
   618
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   619
              worstCqi.at (j) = 1; // try with lowest MCS in RBG with no info on channel
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   620
            }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   621
        }
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   622
//       NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   623
      uint32_t bytesTxed = 0;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   624
      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
   625
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   626
          newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi.at (j)));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   627
          int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (j), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   628
          newDci.m_tbsSize.push_back (tbSize);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   629
          NS_LOG_DEBUG (this << " MCS " << m_amc->GetMcsFromCqi (worstCqi.at (j)));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   630
          bytesTxed += tbSize;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   631
        }
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   632
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   633
      newDci.m_resAlloc = 0;  // only allocation type 0 at this stage
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   634
      newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   635
      uint32_t rbgMask = 0;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   636
      for (uint16_t k = 0; k < (*itMap).second.size (); k++)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   637
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   638
          rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   639
//           NS_LOG_DEBUG (this << " Allocated PRB " << (*itMap).second.at (k));
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   640
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   641
      newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   642
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   643
      // create the rlc PDUs -> equally divide resources among actives LCs
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   644
      std::map <LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator itBufReq;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   645
      for (itBufReq = m_rlcBufferReq.begin (); itBufReq != m_rlcBufferReq.end (); itBufReq++)
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   646
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   647
          if (((*itBufReq).first.m_rnti == (*itMap).first) &&
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   648
            (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   649
              || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   650
              || ((*itBufReq).second.m_rlcStatusPduSize > 0) ))
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   651
            {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   652
              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
   653
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   654
                  RlcPduListElement_s newRlcEl;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   655
                  newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   656
                  newRlcEl.m_size = newDci.m_tbsSize.at (j) / lcActives;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   657
                  NS_LOG_DEBUG (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   658
                  newRlcPduLe.push_back (newRlcEl);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   659
                  UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   660
                }
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   661
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   662
          if ((*itBufReq).first.m_rnti > (*itMap).first)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   663
            {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   664
              break;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   665
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   666
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   667
      newDci.m_ndi.push_back (1); // TBD (new data indicator)
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   668
      newDci.m_rv.push_back (0); // TBD (redundancy version)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   669
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   670
      newEl.m_dci = newDci;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   671
      // ...more parameters -> ingored in this version
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   672
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   673
      newEl.m_rlcPduList.push_back (newRlcPduLe);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   674
      ret.m_buildDataList.push_back (newEl);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   675
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   676
      // update UE stats
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   677
      std::map <uint16_t, pfsFlowPerf_t>::iterator it;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   678
      it = m_flowStatsDl.find ((*itMap).first);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   679
      if (it != m_flowStatsDl.end ())
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   680
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   681
          (*it).second.lastTtiBytesTrasmitted = bytesTxed;
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   682
//           NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   683
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   684
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   685
        }
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   686
      else
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   687
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   688
          NS_LOG_DEBUG (this << " No Stats for this allocated UE");
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
   689
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   690
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   691
      itMap++;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   692
    } // end while allocation
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   693
  ret.m_nrOfPdcchOfdmSymbols = 1;   // TODO: check correct value according the DCIs txed
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   694
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   695
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   696
  // update UEs stats
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   697
  for (itStats = m_flowStatsDl.begin (); itStats != m_flowStatsDl.end (); itStats++)
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   698
    {
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   699
      (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted;
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   700
      // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   701
      (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001));
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   702
//       NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted);
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   703
//       NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   704
      (*itStats).second.lastTtiBytesTrasmitted = 0;
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
   705
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   706
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   707
  m_schedSapUser->SchedDlConfigInd (ret);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   708
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   709
 
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   710
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   711
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   712
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   713
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   714
PfFfMacScheduler::DoSchedDlRachInfoReq (const struct FfMacSchedSapProvider::SchedDlRachInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   715
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   716
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   717
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   718
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   719
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   720
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   721
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   722
PfFfMacScheduler::DoSchedDlCqiInfoReq (const struct FfMacSchedSapProvider::SchedDlCqiInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   723
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   724
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   725
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   726
  for (unsigned int i = 0; i < params.m_cqiList.size (); i++)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   727
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   728
      if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::P10 )
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   729
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   730
          // wideband CQI reporting
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   731
          std::map <uint16_t,uint8_t>::iterator it;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   732
          uint16_t rnti = params.m_cqiList.at (i).m_rnti;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   733
          it = m_p10CqiRxed.find (rnti);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   734
          if (it == m_p10CqiRxed.end ())
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   735
            {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   736
              // create the new entry
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   737
              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
   738
              // 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
   739
              m_p10CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   740
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   741
          else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   742
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   743
              // update the CQI value and refresh correspondent timer
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   744
              (*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
   745
              // 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
   746
              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
   747
              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
   748
              (*itTimers).second = m_cqiTimersThreshold;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   749
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   750
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   751
      else if ( params.m_cqiList.at (i).m_cqiType == CqiListElement_s::A30 )
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   752
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   753
          // subband CQI reporting high layer configured
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   754
          std::map <uint16_t,SbMeasResult_s>::iterator it;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   755
          uint16_t rnti = params.m_cqiList.at (i).m_rnti;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   756
          it = m_a30CqiRxed.find (rnti);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   757
          if (it == m_a30CqiRxed.end ())
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   758
            {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   759
              // create the new entry
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   760
              m_a30CqiRxed.insert ( std::pair<uint16_t, SbMeasResult_s > (rnti, params.m_cqiList.at (i).m_sbMeasResult) );
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   761
              m_a30CqiTimers.insert ( std::pair<uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   762
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   763
          else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   764
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   765
              // update the CQI value and refresh correspondent timer
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   766
              (*it).second = params.m_cqiList.at (i).m_sbMeasResult;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   767
              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
   768
              itTimers = m_a30CqiTimers.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
   769
              (*itTimers).second = m_cqiTimersThreshold;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   770
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   771
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   772
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   773
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   774
          NS_LOG_ERROR (this << " CQI type unknown");
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   775
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   776
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   777
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   778
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   779
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   780
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   781
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   782
double
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   783
PfFfMacScheduler::EstimateUlSinr (uint16_t rnti, uint16_t rb)
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   784
{
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   785
  std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find (rnti);
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   786
  if (itCqi == m_ueCqi.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   787
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   788
      // no cqi info about this UE
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   789
      return (NO_SINR);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   790
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   791
    }
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   792
  else
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   793
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   794
      // take the average SINR value among the available
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   795
      double sinrSum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   796
      int sinrNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   797
      for (uint32_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   798
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   799
          double sinr = (*itCqi).second.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   800
          if (sinr != NO_SINR)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   801
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   802
              sinrSum += sinr;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   803
              sinrNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   804
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   805
        }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   806
      double estimatedSinr = sinrSum / (double)sinrNum;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   807
      // store the value
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   808
      (*itCqi).second.at (rb) = estimatedSinr;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   809
      return (estimatedSinr);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   810
    }
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   811
}
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   812
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   813
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   814
PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::SchedUlTriggerReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   815
{
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
   816
  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: 8047
diff changeset
   817
 
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   818
  RefreshUlCqiMaps ();
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   819
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
   820
  std::map <uint16_t,uint32_t>::iterator it; 
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   821
  int nflows = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   822
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   823
  for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   824
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   825
      // remove old entries of this UE-LC
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   826
      if ((*it).second > 0)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   827
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   828
          nflows++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   829
        }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   830
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   831
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   832
  if (nflows == 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   833
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   834
      return ; // no flows to be scheduled
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   835
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   836
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   837
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   838
  // Divide the resource equally among the active users
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   839
  int rbPerFlow = m_cschedCellConfig.m_ulBandwidth / nflows;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   840
  if (rbPerFlow == 0)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   841
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   842
      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: 8141
diff changeset
   843
    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   844
  int rbAllocated = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   845
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   846
  FfMacSchedSapUser::SchedUlConfigIndParameters ret;
7943
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
   847
  std::vector <uint16_t> rbgAllocationMap;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   848
  std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   849
  if (m_nextRntiUl != 0)
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   850
    {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   851
      for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++)
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   852
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   853
          if ((*it).first == m_nextRntiUl)
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   854
            {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   855
              break;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   856
            }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   857
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   858
      if (it == m_ceBsrRxed.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   859
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   860
          NS_LOG_ERROR (this << " no user found");
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   861
        }
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   862
    }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   863
  else
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   864
    {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   865
      it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   866
      m_nextRntiUl = (*it).first;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   867
    }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   868
  do
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   869
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   870
      if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   871
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   872
          // limit to physical resources last resource assignment
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   873
          rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   874
        }
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   875
     
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   876
      UlDciListElement_s uldci;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   877
      uldci.m_rnti = (*it).first;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   878
      uldci.m_rbStart = rbAllocated;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   879
      uldci.m_rbLen = rbPerFlow;
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   880
      std::map <uint16_t, std::vector <double> >::iterator itCqi = m_ueCqi.find ((*it).first);
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   881
      int cqi = 0;
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   882
      if (itCqi == m_ueCqi.end ())
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   883
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   884
          // no cqi info about this UE
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   885
          uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   886
//           NS_LOG_DEBUG (this << " UE does not have ULCQI " << (*it).first );
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   887
        }
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   888
      else
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   889
        {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   890
          // take the lowest CQI value (worst RB)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   891
          double minSinr = (*itCqi).second.at (uldci.m_rbStart);
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   892
          if (minSinr == NO_SINR)
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   893
            {
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   894
              minSinr = EstimateUlSinr ((*it).first, uldci.m_rbStart);
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   895
            }
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   896
          for (uint16_t i = uldci.m_rbStart; i < uldci.m_rbStart + uldci.m_rbLen; i++)
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   897
            {
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   898
//               NS_LOG_DEBUG (this << " UE " << (*it).first << " has SINR " << (*itCqi).second.at(i));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   899
              double sinr = (*itCqi).second.at (i);
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   900
              if (sinr == NO_SINR)
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   901
                {
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   902
                  sinr = EstimateUlSinr ((*it).first, i);
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
   903
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   904
              if ((*itCqi).second.at (i) < minSinr)
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   905
                {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   906
                  minSinr = (*itCqi).second.at (i);
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   907
                }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   908
            }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   909
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   910
          // translate SINR -> cqi: WILD ACK: same as DL
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   911
          double s = log2 ( 1 + (
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   912
                              pow (10, minSinr / 10 )  /
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   913
                              ( (-log (5.0 * 0.00005 )) / 1.5) ));
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   914
          cqi = m_amc->GetCqiFromSpectralEfficiency (s);
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   915
          if (cqi == 0)
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   916
            {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   917
              it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   918
              if (it == m_ceBsrRxed.end ())
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   919
                {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   920
                  // restart from the first
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   921
                  it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   922
                }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   923
              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: 7959
diff changeset
   924
            }
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   925
          uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   926
//           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: 8141
diff changeset
   927
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
   928
        }
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   929
      
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   930
      rbAllocated += rbPerFlow;
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   931
      // 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: 8182
diff changeset
   932
      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: 8182
diff changeset
   933
        {
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   934
          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: 8182
diff changeset
   935
        }
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
   936
      uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   937
//       NS_LOG_DEBUG (this << " 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 << " RbAlloc " << rbAllocated);
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
   938
      UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   939
      uldci.m_ndi = 1;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   940
      uldci.m_cceIndex = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   941
      uldci.m_aggrLevel = 1;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   942
      uldci.m_ueTxAntennaSelection = 3; // antenna selection OFF
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   943
      uldci.m_hopping = false;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   944
      uldci.m_n2Dmrs = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   945
      uldci.m_tpc = 0; // no power control
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   946
      uldci.m_cqiRequest = false; // only period CQI at this stage
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   947
      uldci.m_ulIndex = 0; // TDD parameter
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   948
      uldci.m_dai = 1; // TDD parameter
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   949
      uldci.m_freqHopping = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   950
      uldci.m_pdcchPowerOffset = 0; // not used
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   951
      ret.m_dciList.push_back (uldci);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   952
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   953
      // update TTI  UE stats
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   954
      itStats = m_flowStatsUl.find ((*it).first);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   955
      if (itStats != m_flowStatsUl.end ())
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   956
        {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   957
          (*itStats).second.lastTtiBytesTrasmitted =  uldci.m_tbSize;
8264
e3a90cfb6ac2 Bug-fix LENA 172 bug on schedulers in uplink when UE has CQI = 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8182
diff changeset
   958
//                     NS_LOG_DEBUG (this << " UE bytes txed " << (*it).second.lastTtiBytesTrasmitted);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   959
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   960
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   961
        }
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   962
      else
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   963
        {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   964
          NS_LOG_DEBUG (this << " No Stats for this allocated UE");
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   965
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   966
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   967
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   968
      it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   969
      if (it == m_ceBsrRxed.end ())
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   970
        {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   971
          // restart from the first
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   972
          it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   973
        }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   974
      if (rbAllocated == m_cschedCellConfig.m_ulBandwidth)
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   975
        {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   976
          // Stop allocation: no more PRBs
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   977
          m_nextRntiUl = (*it).first;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   978
          break;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
   979
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   980
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   981
  while ((*it).first != m_nextRntiUl);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   982
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   983
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   984
  // Update global UE stats
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   985
  // update UEs stats
8133
ea0cd92de3bb PfFfMacScheduler::DoSchedUlTriggerReq fix bug m_flowStatsDl instead of m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8131
diff changeset
   986
  for (itStats = m_flowStatsUl.begin (); itStats != m_flowStatsUl.end (); itStats++)
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   987
    {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   988
      (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   989
      // update average throughput (see eq. 12.3 of Sec 12.3.1.2 of LTE – The UMTS Long Term Evolution, Ed Wiley)
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   990
      (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001));
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   991
      //       NS_LOG_DEBUG (this << " UE tot bytes " << (*itStats).second.totalBytesTransmitted);
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   992
      //       NS_LOG_DEBUG (this << " UE avg thr " << (*itStats).second.lastAveragedThroughput);
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   993
      (*itStats).second.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   994
    }
7943
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
   995
  m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   996
  m_schedSapUser->SchedUlConfigInd (ret);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   997
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   998
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   999
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1000
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1001
PfFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvider::SchedUlNoiseInterferenceReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1002
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1003
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1004
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1005
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1006
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1007
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1008
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1009
PfFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedUlSrInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1010
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1011
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1012
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1013
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1014
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1015
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1016
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1017
PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::SchedUlMacCtrlInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1018
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1019
  NS_LOG_FUNCTION (this);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1020
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1021
  std::map <uint16_t,uint32_t>::iterator it;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1022
  
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1023
  for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1024
  {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1025
    if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1026
    {
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1027
      // buffer status report
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1028
      uint16_t rnti = params.m_macCeList.at (i).m_rnti;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1029
      it = m_ceBsrRxed.find (rnti);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1030
      if (it == m_ceBsrRxed.end ())
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1031
      {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1032
        // create the new entry
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1033
        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: 8321
diff changeset
  1034
        int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1035
        m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1036
      }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1037
      else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1038
      {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1039
        // update the CQI value
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1040
        (*it).second = BufferSizeLevelBsr::BsrId2BufferSize (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: 8321
diff changeset
  1041
      }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1042
    }
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1043
  }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1044
  
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1045
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1046
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1047
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1048
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1049
PfFfMacScheduler::DoSchedUlCqiInfoReq (const struct FfMacSchedSapProvider::SchedUlCqiInfoReqParameters& params)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1050
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1051
  NS_LOG_FUNCTION (this);
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
  1052
//   NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
7943
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
  1053
  // retrieve the allocation for this subframe
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
  1054
  std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1055
  std::map <uint16_t, std::vector <double> >::iterator itCqi;
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
  1056
  itMap = m_allocationMaps.find (params.m_sfnSf);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1057
  if (itMap == m_allocationMaps.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1058
    {
8321
c674feef9d5f Bug-fix UL Allocation Map storing for UL-CQI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
  1059
      NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1060
      return;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1061
    }
7943
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
  1062
  for (uint32_t i = 0; i < (*itMap).second.size (); i++)
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
  1063
    {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1064
      // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1065
//       NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1066
      double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1067
      //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1068
      itCqi = m_ueCqi.find ((*itMap).second.at (i));
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1069
      if (itCqi == m_ueCqi.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1070
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1071
          // create a new entry
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1072
          std::vector <double> newCqi;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1073
          for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1074
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1075
              if (i == j)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1076
                {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1077
                  newCqi.push_back (sinr);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1078
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1079
              else
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1080
                {
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1081
                  // initialize with NO_SINR value.
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1082
                  newCqi.push_back (NO_SINR);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1083
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1084
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1085
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1086
          m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1087
          // 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
  1088
          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: 8141
diff changeset
  1089
        }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1090
      else
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1091
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1092
          // update the value
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1093
          (*itCqi).second.at (i) = sinr;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1094
          // 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
  1095
          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
  1096
          itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1097
          (*itTimers).second = 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
  1098
          
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1099
        }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1100
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1101
    }
7948
7a7b4ad007b0 UL-CQI and AMC in RrFfMacScheduler
mmiozzo
parents: 7947
diff changeset
  1102
  // remove obsolete info on allocation
8321
c674feef9d5f Bug-fix UL Allocation Map storing for UL-CQI
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8319
diff changeset
  1103
  m_allocationMaps.erase (itMap);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1104
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1105
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1106
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
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
void
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1109
PfFfMacScheduler::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
  1110
{
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1111
  // 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
  1112
  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
  1113
  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
  1114
    {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1115
//       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
  1116
      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
  1117
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1118
          // 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
  1119
          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
  1120
          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
  1121
          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
  1122
          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
  1123
          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
  1124
          itP10++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1125
          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
  1126
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1127
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1128
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1129
          (*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
  1130
          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
  1131
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1132
    }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1133
  
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1134
  // refresh DL CQI A30 Map
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1135
  std::map <uint16_t,uint32_t>::iterator itA30 = m_a30CqiTimers.begin ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1136
  while (itA30!=m_a30CqiTimers.end ())