src/lte/model/pf-ff-mac-scheduler.cc
author Manuel Requena <manuel.requena@cttc.es>
Tue, 26 Mar 2013 10:41:49 +0100
changeset 10019 6efd95740e39
parent 9625 f058482ae3ee
child 9653 382d27da8905
child 10024 07b1d791701f
permissions -rw-r--r--
Add automatic triger of the HO based on the RSRQ measures
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__
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
    22
#define log2(x) (log (x) / M_LN2)
8812
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>
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
    31
#include <ns3/lte-vendor-specific-parameters.h>
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
    32
#include <ns3/boolean.h>
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
    33
#include <set>
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    34
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    35
NS_LOG_COMPONENT_DEFINE ("PfFfMacScheduler");
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    36
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    37
namespace ns3 {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    38
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    39
int PfType0AllocationRbg[4] = {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    40
  10,       // RGB size 1
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    41
  26,       // RGB size 2
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    42
  63,       // RGB size 3
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    43
  110       // RGB size 4
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    44
};  // 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
    45
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    46
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    47
NS_OBJECT_ENSURE_REGISTERED (PfFfMacScheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    48
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    49
7936
2c531eab14f1 Move inline code in pf-ff-mac-schedluer to cc file
mmiozzo
parents: 7912
diff changeset
    50
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    51
class PfSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider
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
public:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    54
  PfSchedulerMemberCschedSapProvider (PfFfMacScheduler* scheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    55
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    56
  // inherited from FfMacCschedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    57
  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
    58
  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
    59
  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
    60
  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
    61
  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
    62
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    63
private:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    64
  PfSchedulerMemberCschedSapProvider ();
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    65
  PfFfMacScheduler* m_scheduler;
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
PfSchedulerMemberCschedSapProvider::PfSchedulerMemberCschedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    69
{
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
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
    73
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    74
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    75
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    78
PfSchedulerMemberCschedSapProvider::CschedCellConfigReq (const struct CschedCellConfigReqParameters& params)
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
  m_scheduler->DoCschedCellConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    81
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    84
PfSchedulerMemberCschedSapProvider::CschedUeConfigReq (const struct CschedUeConfigReqParameters& params)
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
  m_scheduler->DoCschedUeConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    87
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    88
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    91
PfSchedulerMemberCschedSapProvider::CschedLcConfigReq (const struct CschedLcConfigReqParameters& params)
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
  m_scheduler->DoCschedLcConfigReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    94
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    97
PfSchedulerMemberCschedSapProvider::CschedLcReleaseReq (const struct CschedLcReleaseReqParameters& params)
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
  m_scheduler->DoCschedLcReleaseReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   100
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   103
PfSchedulerMemberCschedSapProvider::CschedUeReleaseReq (const struct CschedUeReleaseReqParameters& params)
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
  m_scheduler->DoCschedUeReleaseReq (params);
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
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   111
class PfSchedulerMemberSchedSapProvider : public FfMacSchedSapProvider
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
public:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   114
  PfSchedulerMemberSchedSapProvider (PfFfMacScheduler* scheduler);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   115
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   116
  // inherited from FfMacSchedSapProvider
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   117
  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
   118
  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
   119
  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
   120
  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
   121
  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
   122
  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
   123
  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
   124
  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
   125
  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
   126
  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
   127
  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
   128
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   129
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   130
private:
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   131
  PfSchedulerMemberSchedSapProvider ();
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   132
  PfFfMacScheduler* m_scheduler;
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
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
PfSchedulerMemberSchedSapProvider::PfSchedulerMemberSchedSapProvider ()
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
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   140
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
PfSchedulerMemberSchedSapProvider::PfSchedulerMemberSchedSapProvider (PfFfMacScheduler* scheduler)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   143
  : m_scheduler (scheduler)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   144
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   145
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   148
PfSchedulerMemberSchedSapProvider::SchedDlRlcBufferReq (const struct SchedDlRlcBufferReqParameters& params)
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
  m_scheduler->DoSchedDlRlcBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   151
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   154
PfSchedulerMemberSchedSapProvider::SchedDlPagingBufferReq (const struct SchedDlPagingBufferReqParameters& params)
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
  m_scheduler->DoSchedDlPagingBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   157
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   160
PfSchedulerMemberSchedSapProvider::SchedDlMacBufferReq (const struct SchedDlMacBufferReqParameters& params)
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
  m_scheduler->DoSchedDlMacBufferReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   163
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   166
PfSchedulerMemberSchedSapProvider::SchedDlTriggerReq (const struct SchedDlTriggerReqParameters& params)
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
  m_scheduler->DoSchedDlTriggerReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   169
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   172
PfSchedulerMemberSchedSapProvider::SchedDlRachInfoReq (const struct SchedDlRachInfoReqParameters& params)
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
  m_scheduler->DoSchedDlRachInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   175
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   178
PfSchedulerMemberSchedSapProvider::SchedDlCqiInfoReq (const struct SchedDlCqiInfoReqParameters& params)
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
  m_scheduler->DoSchedDlCqiInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   181
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   184
PfSchedulerMemberSchedSapProvider::SchedUlTriggerReq (const struct SchedUlTriggerReqParameters& params)
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
  m_scheduler->DoSchedUlTriggerReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   187
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   190
PfSchedulerMemberSchedSapProvider::SchedUlNoiseInterferenceReq (const struct SchedUlNoiseInterferenceReqParameters& params)
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
  m_scheduler->DoSchedUlNoiseInterferenceReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   193
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   196
PfSchedulerMemberSchedSapProvider::SchedUlSrInfoReq (const struct SchedUlSrInfoReqParameters& params)
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
  m_scheduler->DoSchedUlSrInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   199
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   202
PfSchedulerMemberSchedSapProvider::SchedUlMacCtrlInfoReq (const struct SchedUlMacCtrlInfoReqParameters& params)
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
  m_scheduler->DoSchedUlMacCtrlInfoReq (params);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   205
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   208
PfSchedulerMemberSchedSapProvider::SchedUlCqiInfoReq (const struct SchedUlCqiInfoReqParameters& params)
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
  m_scheduler->DoSchedUlCqiInfoReq (params);
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   215
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   216
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   217
PfFfMacScheduler::PfFfMacScheduler ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   218
  :   m_cschedSapUser (0),
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   219
    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
   220
    m_timeWindow (99.0),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   221
    m_nextRntiUl (0)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   222
{
8523
0c515ddca47b Change LteAmc* to Ptr<LteAmc> in PF scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8516
diff changeset
   223
  m_amc = CreateObject <LteAmc> ();
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   224
  m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   225
  m_schedSapProvider = new PfSchedulerMemberSchedSapProvider (this);
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   228
PfFfMacScheduler::~PfFfMacScheduler ()
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
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   231
}
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   234
PfFfMacScheduler::DoDispose ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   235
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   236
  NS_LOG_FUNCTION (this);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   237
  m_dlHarqProcessesDciBuffer.clear ();
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   238
  m_dlHarqProcessesTimer.clear ();
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   239
  m_dlHarqProcessesRlcPduListBuffer.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   240
  m_dlInfoListBuffered.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   241
  m_ulHarqCurrentProcessId.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   242
  m_ulHarqProcessesStatus.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   243
  m_ulHarqProcessesDciBuffer.clear ();
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   244
  delete m_cschedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   245
  delete m_schedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   246
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   247
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   248
TypeId
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   249
PfFfMacScheduler::GetTypeId (void)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   250
{
7983
b91d5a39aabc scheduler and propagation model configurable through ConfigStore
Nicola Baldo <nbaldo@cttc.es>
parents: 7979
diff changeset
   251
  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
   252
    .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
   253
    .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
   254
    .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
   255
                   "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
   256
                   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
   257
                   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
   258
                   MakeUintegerChecker<uint32_t> ())
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
   259
    .AddAttribute ("HarqEnabled",
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   260
                   "Activate/Deactivate the HARQ [by default is active].",
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   261
                   BooleanValue (true),
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   262
                   MakeBooleanAccessor (&PfFfMacScheduler::m_harqOn),
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   263
                   MakeBooleanChecker ())
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   264
    .AddAttribute ("UlGrantMcs",
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   265
                   "The MCS of the UL grant, must be [0..15] (default 0)",
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   266
                   UintegerValue (0),
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   267
                   MakeUintegerAccessor (&PfFfMacScheduler::m_ulGrantMcs),
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   268
                   MakeUintegerChecker<uint8_t> ())
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   269
  ;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   270
  return tid;
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   274
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   275
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   276
PfFfMacScheduler::SetFfMacCschedSapUser (FfMacCschedSapUser* s)
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
  m_cschedSapUser = s;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   279
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   280
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   281
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   282
PfFfMacScheduler::SetFfMacSchedSapUser (FfMacSchedSapUser* s)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   283
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   284
  m_schedSapUser = s;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   285
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   286
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   287
FfMacCschedSapProvider*
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   288
PfFfMacScheduler::GetFfMacCschedSapProvider ()
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
  return m_cschedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   291
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   292
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   293
FfMacSchedSapProvider*
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   294
PfFfMacScheduler::GetFfMacSchedSapProvider ()
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   295
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   296
  return m_schedSapProvider;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   297
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   298
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   299
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   300
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
   301
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   302
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   303
  // Read the subset of parameters used
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   304
  m_cschedCellConfig = params;
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   305
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   306
  FfMacCschedSapUser::CschedUeConfigCnfParameters cnf;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   307
  cnf.m_result = SUCCESS;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   308
  m_cschedSapUser->CschedUeConfigCnf (cnf);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   309
  return;
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   312
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   313
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
   314
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   315
  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
   316
  std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   317
  if (it == m_uesTxMode.end ())
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   318
    {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   319
      m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   320
      // generate HARQ buffers
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   321
      m_dlHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   322
      DlHarqProcessesStatus_t dlHarqPrcStatus;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   323
      dlHarqPrcStatus.resize (8,0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   324
      m_dlHarqProcessesStatus.insert (std::pair <uint16_t, DlHarqProcessesStatus_t> (params.m_rnti, dlHarqPrcStatus));
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   325
      DlHarqProcessesTimer_t dlHarqProcessesTimer;
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   326
      dlHarqProcessesTimer.resize (8,0);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   327
      m_dlHarqProcessesTimer.insert (std::pair <uint16_t, DlHarqProcessesTimer_t> (params.m_rnti, dlHarqProcessesTimer));
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   328
      DlHarqProcessesDciBuffer_t dlHarqdci;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   329
      dlHarqdci.resize (8);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   330
      m_dlHarqProcessesDciBuffer.insert (std::pair <uint16_t, DlHarqProcessesDciBuffer_t> (params.m_rnti, dlHarqdci));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   331
      DlHarqRlcPduListBuffer_t dlHarqRlcPdu;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   332
      dlHarqRlcPdu.resize (2);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   333
      dlHarqRlcPdu.at (0).resize (8);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   334
      dlHarqRlcPdu.at (1).resize (8);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   335
      m_dlHarqProcessesRlcPduListBuffer.insert (std::pair <uint16_t, DlHarqRlcPduListBuffer_t> (params.m_rnti, dlHarqRlcPdu));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   336
      m_ulHarqCurrentProcessId.insert (std::pair <uint16_t,uint8_t > (params.m_rnti, 0));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   337
      UlHarqProcessesStatus_t ulHarqPrcStatus;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   338
      ulHarqPrcStatus.resize (8,0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   339
      m_ulHarqProcessesStatus.insert (std::pair <uint16_t, UlHarqProcessesStatus_t> (params.m_rnti, ulHarqPrcStatus));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   340
      UlHarqProcessesDciBuffer_t ulHarqdci;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   341
      ulHarqdci.resize (8);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   342
      m_ulHarqProcessesDciBuffer.insert (std::pair <uint16_t, UlHarqProcessesDciBuffer_t> (params.m_rnti, ulHarqdci));
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   343
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   344
  else
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   345
    {
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   346
      (*it).second = params.m_transmissionMode;
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   347
    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   348
  return;
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
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   351
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   352
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
   353
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   354
  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
   355
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   356
  std::map <uint16_t, pfsFlowPerf_t>::iterator it;
7909
82b1281ea0a3 Updates for MACOS compilation (virtual destructors and variable types)
mmiozzo
parents: 7899
diff changeset
   357
  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
   358
    {
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   359
      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
   360
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   361
      if (it == m_flowStatsDl.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   362
        {
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   363
          pfsFlowPerf_t flowStatsDl;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   364
          flowStatsDl.flowStart = Simulator::Now ();
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   365
          flowStatsDl.totalBytesTransmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   366
          flowStatsDl.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   367
          flowStatsDl.lastAveragedThroughput = 1;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   368
          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
   369
          pfsFlowPerf_t flowStatsUl;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   370
          flowStatsUl.flowStart = Simulator::Now ();
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   371
          flowStatsUl.totalBytesTransmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   372
          flowStatsUl.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   373
          flowStatsUl.lastAveragedThroughput = 1;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
   374
          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
   375
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   376
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   377
        {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   378
          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
   379
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   380
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   381
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   382
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   383
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   384
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   385
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   386
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
   387
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   388
  NS_LOG_FUNCTION (this);
9465
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   389
  for (uint16_t i = 0; i < params.m_logicalChannelIdentity.size (); i++)
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   390
    {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   391
      std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   392
      std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   393
      while (it!=m_rlcBufferReq.end ())
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   394
        {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   395
          if (((*it).first.m_rnti == params.m_rnti) && ((*it).first.m_lcId == params.m_logicalChannelIdentity.at (i)))
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   396
            {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   397
              temp = it;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   398
              it++;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   399
              m_rlcBufferReq.erase (temp);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   400
            }
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   401
          else
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   402
            {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   403
              it++;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   404
            }
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   405
        }
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   406
    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   407
  return;
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
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   411
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
   412
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   413
  NS_LOG_FUNCTION (this);
9465
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   414
  
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   415
  m_uesTxMode.erase (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   416
  m_dlHarqCurrentProcessId.erase (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   417
  m_dlHarqProcessesStatus.erase  (params.m_rnti);
9562
Nicola Baldo <nbaldo@cttc.es>
parents: 9521 9394
diff changeset
   418
  m_dlHarqProcessesTimer.erase (params.m_rnti);
9465
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   419
  m_dlHarqProcessesDciBuffer.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   420
  m_dlHarqProcessesRlcPduListBuffer.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   421
  m_ulHarqCurrentProcessId.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   422
  m_ulHarqProcessesStatus.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   423
  m_ulHarqProcessesDciBuffer.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   424
  m_flowStatsDl.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   425
  m_flowStatsUl.erase  (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   426
  m_ceBsrRxed.erase (params.m_rnti);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   427
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   428
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator temp;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   429
  while (it!=m_rlcBufferReq.end ())
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   430
    {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   431
      if ((*it).first.m_rnti == params.m_rnti)
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   432
        {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   433
          temp = it;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   434
          it++;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   435
          m_rlcBufferReq.erase (temp);
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   436
        }
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   437
      else
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   438
        {
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   439
          it++;
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   440
        }
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   441
    }
9468
4513b57ab94b Bug fix release info on RR allocation memory and remove NS_FATAL_ERROR on HARQ when HO
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9465
diff changeset
   442
  if (m_nextRntiUl == params.m_rnti)
4513b57ab94b Bug fix release info on RR allocation memory and remove NS_FATAL_ERROR on HARQ when HO
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9465
diff changeset
   443
    {
4513b57ab94b Bug fix release info on RR allocation memory and remove NS_FATAL_ERROR on HARQ when HO
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9465
diff changeset
   444
      m_nextRntiUl = 0;
4513b57ab94b Bug fix release info on RR allocation memory and remove NS_FATAL_ERROR on HARQ when HO
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9465
diff changeset
   445
    }
9465
731494b1b3f1 UeRelease support at LteEnbMac and schedulers (PF and RR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9460
diff changeset
   446
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   447
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   448
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   449
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   450
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   451
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   452
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
   453
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   454
  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
   455
  // 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
   456
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   457
  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
   458
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7968
diff changeset
   459
  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
   460
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   461
  it =  m_rlcBufferReq.find (flow);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   462
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   463
  if (it == m_rlcBufferReq.end ())
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   464
    {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   465
      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
   466
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   467
  else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   468
    {
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   469
      (*it).second = params;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   470
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   471
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   472
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   473
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   474
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   475
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   476
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
   477
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   478
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   479
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   480
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   481
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   482
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   483
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   484
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
   485
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   486
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   487
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   488
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   489
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   490
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   491
int
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   492
PfFfMacScheduler::GetRbgSize (int dlbandwidth)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   493
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   494
  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
   495
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   496
      if (dlbandwidth < PfType0AllocationRbg[i])
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   497
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   498
          return (i + 1);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   499
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   500
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   501
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   502
  return (-1);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   503
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   504
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   505
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   506
int
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   507
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
   508
{
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   509
  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
   510
  int lcActive = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   511
  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
   512
    {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   513
      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
   514
                                           || ((*it).second.m_rlcRetransmissionQueueSize > 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   515
                                           || ((*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
   516
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   517
          lcActive++;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   518
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   519
      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
   520
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   521
          break;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   522
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   523
    }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   524
  return (lcActive);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   525
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   526
}
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   527
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
   528
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   529
uint8_t
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   530
PfFfMacScheduler::HarqProcessAvailability (uint16_t rnti)
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   531
{
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   532
  NS_LOG_FUNCTION (this << rnti);
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   533
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   534
  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   535
  if (it == m_dlHarqCurrentProcessId.end ())
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   536
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   537
      NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   538
    }
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   539
  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   540
  if (itStat == m_dlHarqProcessesStatus.end ())
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   541
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   542
      NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   543
    }
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   544
  uint8_t i = (*it).second;
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   545
  do
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   546
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   547
      i = (i + 1) % HARQ_PROC_NUM;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   548
    }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   549
  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   550
  if ((*itStat).second.at (i) == 0)
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   551
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   552
      return (true);
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   553
    }
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   554
  else
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   555
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   556
      return (false); // return a not valid harq proc id
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   557
    }
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   558
}
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   559
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   560
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   561
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   562
uint8_t
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   563
PfFfMacScheduler::UpdateHarqProcessId (uint16_t rnti)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   564
{
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   565
  NS_LOG_FUNCTION (this << rnti);
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   566
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   567
  if (m_harqOn == false)
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   568
    {
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   569
      return (0);
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   570
    }
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   571
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   572
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   573
  std::map <uint16_t, uint8_t>::iterator it = m_dlHarqCurrentProcessId.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   574
  if (it == m_dlHarqCurrentProcessId.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   575
    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   576
      NS_FATAL_ERROR ("No Process Id found for this RNTI " << rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   577
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   578
  std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   579
  if (itStat == m_dlHarqProcessesStatus.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   580
    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   581
      NS_FATAL_ERROR ("No Process Id Statusfound for this RNTI " << rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   582
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   583
  uint8_t i = (*it).second;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   584
  do
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   585
    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   586
      i = (i + 1) % HARQ_PROC_NUM;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   587
    }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   588
  while ( ((*itStat).second.at (i) != 0)&&(i != (*it).second));
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   589
  if ((*itStat).second.at (i) == 0)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   590
    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   591
      (*it).second = i;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   592
      (*itStat).second.at (i) = 1;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   593
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   594
  else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   595
    {
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   596
      NS_FATAL_ERROR ("No HARQ process available for RNTI " << rnti << " check before update with HarqProcessAvailability");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   597
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   598
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   599
  return ((*it).second);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   600
}
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   601
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   602
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   603
void
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   604
PfFfMacScheduler::RefreshHarqProcesses ()
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   605
{
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   606
  NS_LOG_FUNCTION (this);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   607
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   608
  std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itTimers;
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   609
  for (itTimers = m_dlHarqProcessesTimer.begin (); itTimers != m_dlHarqProcessesTimer.end (); itTimers ++)
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   610
    {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   611
      for (uint16_t i = 0; i < HARQ_PROC_NUM; i++)
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   612
        {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   613
          if ((*itTimers).second.at (i) == HARQ_DL_TIMEOUT)
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   614
            {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   615
              // reset HARQ process
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   616
              
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   617
              NS_LOG_DEBUG (this << " Reset HARQ proc " << i << " for RNTI " << (*itTimers).first);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   618
              std::map <uint16_t, DlHarqProcessesStatus_t>::iterator itStat = m_dlHarqProcessesStatus.find ((*itTimers).first);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   619
              if (itStat == m_dlHarqProcessesStatus.end ())
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   620
                {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   621
                  NS_FATAL_ERROR ("No Process Id Status found for this RNTI " << (*itTimers).first);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   622
                }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   623
              (*itStat).second.at (i) = 0;
9625
f058482ae3ee Update HARQ Timer reinitialization when doing reset in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9600
diff changeset
   624
              (*itTimers).second.at (i) = 0;
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   625
            }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   626
          else
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   627
            {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   628
              (*itTimers).second.at (i)++;
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   629
            }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   630
        }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   631
    }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   632
  
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   633
}
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   634
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   635
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   636
void
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   637
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
   638
{
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   639
  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
   640
  // 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
   641
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
   642
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   643
  // evaluate the relative channel quality indicator for each UE per each RBG
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   644
  // (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
   645
  // Resource allocation type 0 (see sec 7.1.6.1 of 36.213)
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   646
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
   647
  RefreshDlCqiMaps ();
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   648
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   649
  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
   650
  int rbgNum = m_cschedCellConfig.m_dlBandwidth / rbgSize;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   651
  std::map <uint16_t, std::vector <uint16_t> > allocationMap; // RBs map per RNTI
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   652
  std::vector <bool> rbgMap;  // global RBGs map
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   653
  uint16_t rbgAllocatedNum = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   654
  std::set <uint16_t> rntiAllocated;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   655
  rbgMap.resize (m_cschedCellConfig.m_dlBandwidth / rbgSize, false);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   656
  FfMacSchedSapUser::SchedDlConfigIndParameters ret;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   657
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   658
  // RACH Allocation
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   659
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   660
  uint16_t rbStart = 0;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   661
  std::vector <struct RachListElement_s>::iterator itRach;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   662
  for (itRach = m_rachList.begin (); itRach != m_rachList.end (); itRach++)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   663
    {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   664
      NS_ASSERT_MSG (m_amc->GetTbSizeFromMcs (m_ulGrantMcs, m_cschedCellConfig.m_ulBandwidth) > (*itRach).m_estimatedSize, " Default UL Grant MCS does not allow to send RACH messages");
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   665
      BuildRarListElement_s newRar;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   666
      newRar.m_rnti = (*itRach).m_rnti;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   667
      // DL-RACH Allocation
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   668
      // Ideal: no needs of configuring m_dci
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   669
      // UL-RACH Allocation
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   670
      newRar.m_grant.m_rnti = newRar.m_rnti;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   671
      newRar.m_grant.m_mcs = m_ulGrantMcs;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   672
      uint16_t rbLen = 1;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   673
      uint16_t tbSizeBits = 0;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   674
      // find lowest TB size that fits UL grant estimated size
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   675
      while ((tbSizeBits < (*itRach).m_estimatedSize) && (rbStart + rbLen < m_cschedCellConfig.m_ulBandwidth))
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   676
        {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   677
          rbLen++;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   678
          tbSizeBits = m_amc->GetTbSizeFromMcs (m_ulGrantMcs, rbLen);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   679
        }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   680
      if (tbSizeBits < (*itRach).m_estimatedSize)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   681
        {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   682
          // no more allocation space: finish allocation
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   683
          break;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   684
        }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   685
      newRar.m_grant.m_rbStart = rbStart;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   686
      newRar.m_grant.m_rbLen = rbLen;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   687
      newRar.m_grant.m_tbSize = tbSizeBits / 8;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   688
      newRar.m_grant.m_hopping = false;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   689
      newRar.m_grant.m_tpc = 0;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   690
      newRar.m_grant.m_cqiRequest = false;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   691
      newRar.m_grant.m_ulDelay = false;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   692
      NS_LOG_INFO (this << " UL grant allocated to RNTI " << (*itRach).m_rnti << " rbStart " << rbStart << " rbLen " << rbLen << " MCS " << m_ulGrantMcs << " tbSize " << newRar.m_grant.m_tbSize);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   693
      for (uint16_t i = rbStart; i < rbStart + rbLen; i++)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   694
        {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   695
          m_rachAllocationMap.at (i) = (*itRach).m_rnti;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   696
        }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   697
      rbStart = rbStart + rbLen;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   698
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   699
      ret.m_buildRarList.push_back (newRar);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   700
    }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   701
  m_rachList.clear ();
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   702
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   703
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   704
  // Process DL HARQ feedback
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   705
  RefreshHarqProcesses ();
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   706
  // retrieve past HARQ retx buffered
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   707
  if (m_dlInfoListBuffered.size () > 0)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   708
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   709
      if (params.m_dlInfoList.size () > 0)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   710
        {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   711
          NS_LOG_INFO (this << " Received DL-HARQ feedback");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   712
          m_dlInfoListBuffered.insert (m_dlInfoListBuffered.end (), params.m_dlInfoList.begin (), params.m_dlInfoList.end ());
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   713
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   714
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   715
  else
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   716
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   717
      if (params.m_dlInfoList.size () > 0)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   718
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   719
          m_dlInfoListBuffered = params.m_dlInfoList;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   720
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   721
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   722
  if (m_harqOn == false)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   723
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   724
      // Ignore HARQ feedback
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   725
      m_dlInfoListBuffered.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   726
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   727
  std::vector <struct DlInfoListElement_s> dlInfoListUntxed;
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
   728
  for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   729
    {
9372
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   730
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuffered.at (i).m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   731
      if (itRnti != rntiAllocated.end ())
9372
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   732
        {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   733
          // RNTI already allocated for retx
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   734
          continue;
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   735
        }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   736
      uint8_t nLayers = m_dlInfoListBuffered.at (i).m_harqStatus.size ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   737
      std::vector <bool> retx;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   738
      NS_LOG_INFO (this << " Processing DLHARQ feedback");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   739
      if (nLayers == 1)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   740
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   741
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   742
          retx.push_back (false);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   743
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   744
      else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   745
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   746
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlInfoListElement_s::NACK);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   747
          retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (1) == DlInfoListElement_s::NACK);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   748
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   749
      if (retx.at (0) || retx.at (1))
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   750
        {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   751
          // retrieve HARQ process information
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   752
          uint16_t rnti = m_dlInfoListBuffered.at (i).m_rnti;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   753
          uint8_t harqId = m_dlInfoListBuffered.at (i).m_harqProcessId;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   754
          NS_LOG_INFO (this << " HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   755
          std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itHarq = m_dlHarqProcessesDciBuffer.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   756
          if (itHarq == m_dlHarqProcessesDciBuffer.end ())
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   757
            {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   758
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   759
            }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   760
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   761
          DlDciListElement_s dci = (*itHarq).second.at (harqId);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   762
          int rv = 0;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   763
          if (dci.m_rv.size () == 1)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   764
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   765
              rv = dci.m_rv.at (0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   766
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   767
          else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   768
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   769
              rv = (dci.m_rv.at (0) > dci.m_rv.at (1) ? dci.m_rv.at (0) : dci.m_rv.at (1));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   770
            }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   771
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   772
          if (rv == 3)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   773
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   774
              // maximum number of retx reached -> drop process
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   775
              NS_LOG_INFO ("Maximum number of retransmissions reached -> drop process");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   776
              std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   777
              if (it == m_dlHarqProcessesStatus.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   778
                {
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9468
diff changeset
   779
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << m_dlInfoListBuffered.at (i).m_rnti);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   780
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   781
              (*it).second.at (harqId) = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   782
              std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   783
              if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   784
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   785
                  NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   786
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   787
              for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   788
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   789
                  (*itRlcPdu).second.at (k).at (harqId).clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   790
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   791
              continue;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   792
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   793
          // check the feasibility of retransmitting on the same RBGs
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   794
          // translate the DCI to Spectrum framework
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   795
          std::vector <int> dciRbg;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   796
          uint32_t mask = 0x1;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   797
          NS_LOG_INFO ("Original RBGs " << dci.m_rbBitmap << " rnti " << dci.m_rnti);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   798
          for (int j = 0; j < 32; j++)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   799
            {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   800
              if (((dci.m_rbBitmap & mask) >> j) == 1)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   801
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   802
                  dciRbg.push_back (j);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   803
                  NS_LOG_INFO ("\t" << j);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   804
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   805
              mask = (mask << 1);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   806
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   807
          bool free = true;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   808
          for (uint8_t j = 0; j < dciRbg.size (); j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   809
            {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   810
              if (rbgMap.at (dciRbg.at (j)) == true)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   811
                {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   812
                  free = false;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   813
                  break;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   814
                }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   815
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   816
          if (free)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   817
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   818
              // use the same RBGs for the retx
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   819
              // reserve RBGs
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   820
              for (uint8_t j = 0; j < dciRbg.size (); j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   821
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   822
                  rbgMap.at (dciRbg.at (j)) = true;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   823
                  NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   824
                  rbgAllocatedNum++;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   825
                }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   826
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   827
              NS_LOG_INFO (this << " Send retx in the same RBGs");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   828
            }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   829
          else
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   830
            {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   831
              // find RBGs for sending HARQ retx
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   832
              uint8_t j = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   833
              uint8_t rbgId = (dciRbg.at (dciRbg.size () - 1) + 1) % rbgNum;
9358
7545f5294223 Bug-fix DoSchedDlTriggerReq:startRbg both in RR and PR erroneous initialization
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9352
diff changeset
   834
              uint8_t startRbg = dciRbg.at (dciRbg.size () - 1);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   835
              std::vector <bool> rbgMapCopy = rbgMap;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   836
              while ((j < dciRbg.size ())&&(startRbg != rbgId))
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   837
                {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   838
                  if (rbgMapCopy.at (rbgId) == false)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   839
                    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   840
                      rbgMapCopy.at (rbgId) = true;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   841
                      dciRbg.at (j) = rbgId;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   842
                      j++;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   843
                    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   844
                  rbgId++;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   845
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   846
              if (j == dciRbg.size ())
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   847
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   848
                  // find new RBGs -> update DCI map
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   849
                  uint32_t rbgMask = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   850
                  for (uint16_t k = 0; k < dciRbg.size (); k++)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   851
                    {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   852
                      rbgMask = rbgMask + (0x1 << dciRbg.at (k));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   853
                      rbgAllocatedNum++;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
   854
                    }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   855
                  dci.m_rbBitmap = rbgMask;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   856
                  rbgMap = rbgMapCopy;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   857
                  NS_LOG_INFO (this << " Move retx in RBGs " << dciRbg.size ());
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   858
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   859
              else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   860
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   861
                  // HARQ retx cannot be performed on this TTI -> store it
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   862
                  dlInfoListUntxed.push_back (params.m_dlInfoList.at (i));
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   863
                  NS_LOG_INFO (this << " No resource for this retx -> buffer it");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   864
                }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   865
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   866
          // retrieve RLC PDU list for retx TBsize and update DCI
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   867
          BuildDataListElement_s newEl;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   868
          std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   869
          if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   870
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   871
              NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   872
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   873
          for (uint8_t j = 0; j < nLayers; j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   874
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   875
              if (retx.at (j))
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   876
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   877
                  if (j >= dci.m_ndi.size ())
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   878
                    {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   879
                      // for avoiding errors in MIMO transient phases
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   880
                      dci.m_ndi.push_back (0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   881
                      dci.m_rv.push_back (0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   882
                      dci.m_mcs.push_back (0);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   883
                      dci.m_tbsSize.push_back (0);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   884
                      NS_LOG_INFO (this << " layer " << (uint16_t)j << " no txed (MIMO transition)");
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
   885
                    }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   886
                  else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   887
                    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   888
                      dci.m_ndi.at (j) = 0;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   889
                      dci.m_rv.at (j)++;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   890
                      (*itHarq).second.at (harqId).m_rv.at (j)++;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   891
                      NS_LOG_INFO (this << " layer " << (uint16_t)j << " RV " << (uint16_t)dci.m_rv.at (j));
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   892
                    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   893
                }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   894
              else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   895
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   896
                  // empty TB of layer j
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   897
                  dci.m_ndi.at (j) = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   898
                  dci.m_rv.at (j) = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   899
                  dci.m_mcs.at (j) = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   900
                  dci.m_tbsSize.at (j) = 0;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   901
                  NS_LOG_INFO (this << " layer " << (uint16_t)j << " no retx");
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   902
                }
9372
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   903
            }
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   904
          for (uint16_t k = 0; k < (*itRlcPdu).second.at (0).at (dci.m_harqProcess).size (); k++)
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   905
            {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   906
              std::vector <struct RlcPduListElement_s> rlcPduListPerLc;
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   907
              for (uint8_t j = 0; j < nLayers; j++)
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   908
                {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   909
                  if (retx.at (j))
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   910
                    {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   911
                      if (j < dci.m_ndi.size ())
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   912
                        {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   913
                          rlcPduListPerLc.push_back ((*itRlcPdu).second.at (j).at (dci.m_harqProcess).at (k));
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   914
                        }
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   915
                    }
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   916
                }
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   917
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   918
              if (rlcPduListPerLc.size () > 0)
9372
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   919
                {
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   920
                  newEl.m_rlcPduList.push_back (rlcPduListPerLc);
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   921
                }
d6ccea47ee2b Bugs-fix: avoid multiple retransmission attempts per UE and reorder the RLC PDUs list for retrasmission both in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9369
diff changeset
   922
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   923
          newEl.m_rnti = rnti;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   924
          newEl.m_dci = dci;
9360
197c71f20845 Bug-fix in RR and PF: update RV field in different harq retx
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9359
diff changeset
   925
          (*itHarq).second.at (harqId).m_rv = dci.m_rv;
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   926
          // refresh timer
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   927
          std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer = m_dlHarqProcessesTimer.find (rnti);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   928
          if (itHarqTimer== m_dlHarqProcessesTimer.end ())
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   929
            {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   930
              NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)rnti);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   931
            }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   932
          (*itHarqTimer).second.at (harqId) = 0;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   933
          ret.m_buildDataList.push_back (newEl);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   934
          rntiAllocated.insert (rnti);
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   935
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   936
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   937
        {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   938
          // update HARQ process status
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   939
          NS_LOG_INFO (this << " HARQ received ACK for UE " << m_dlInfoListBuffered.at (i).m_rnti);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   940
          std::map <uint16_t, DlHarqProcessesStatus_t>::iterator it = m_dlHarqProcessesStatus.find (m_dlInfoListBuffered.at (i).m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   941
          if (it == m_dlHarqProcessesStatus.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   942
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   943
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   944
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   945
          (*it).second.at (m_dlInfoListBuffered.at (i).m_harqProcessId) = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   946
          std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find (m_dlInfoListBuffered.at (i).m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   947
          if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   948
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   949
              NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << m_dlInfoListBuffered.at (i).m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   950
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   951
          for (uint16_t k = 0; k < (*itRlcPdu).second.size (); k++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   952
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   953
              (*itRlcPdu).second.at (k).at (m_dlInfoListBuffered.at (i).m_harqProcessId).clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   954
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   955
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   956
    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   957
  m_dlInfoListBuffered.clear ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   958
  m_dlInfoListBuffered = dlInfoListUntxed;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   959
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   960
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   961
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   962
  for (int i = 0; i < rbgNum; i++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   963
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   964
      NS_LOG_INFO (this << " ALLOCATION for RBG " << i << " of " << rbgNum);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   965
      if (rbgMap.at (i) == false)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   966
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   967
          std::map <uint16_t, pfsFlowPerf_t>::iterator it;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   968
          std::map <uint16_t, pfsFlowPerf_t>::iterator itMax = m_flowStatsDl.end ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   969
          double rcqiMax = 0.0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   970
          for (it = m_flowStatsDl.begin (); it != m_flowStatsDl.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
   971
            {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   972
              std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   973
              if ((itRnti != rntiAllocated.end ())||(!HarqProcessAvailability ((*it).first)))
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   974
                {
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
   975
                  // UE already allocated for HARQ or without HARQ process available -> drop it
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   976
                  if (itRnti != rntiAllocated.end ())
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   977
                  {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   978
                    NS_LOG_DEBUG (this << " RNTI discared for HARQ tx" << (uint16_t)(*it).first);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   979
                  }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   980
                  if (!HarqProcessAvailability ((*it).first))
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   981
                  {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   982
                    NS_LOG_DEBUG (this << " RNTI discared for HARQ id" << (uint16_t)(*it).first);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
   983
                  }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   984
                  continue;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   985
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   986
              std::map <uint16_t,SbMeasResult_s>::iterator itCqi;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   987
              itCqi = m_a30CqiRxed.find ((*it).first);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   988
              std::map <uint16_t,uint8_t>::iterator itTxMode;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   989
              itTxMode = m_uesTxMode.find ((*it).first);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
   990
              if (itTxMode == m_uesTxMode.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   991
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   992
                  NS_FATAL_ERROR ("No Transmission Mode info on user " << (*it).first);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   993
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   994
              int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   995
              std::vector <uint8_t> sbCqi;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   996
              if (itCqi == m_a30CqiRxed.end ())
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   997
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   998
                  for (uint8_t k = 0; k < nLayer; k++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
   999
                    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1000
                      sbCqi.push_back (1);  // start with lowest value
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1001
                    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1002
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1003
              else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1004
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1005
                  sbCqi = (*itCqi).second.m_higherLayerSelected.at (i).m_sbCqi;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1006
                }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1007
              uint8_t cqi1 = sbCqi.at (0);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1008
              uint8_t cqi2 = 1;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1009
              if (sbCqi.size () > 1)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1010
                {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1011
                  cqi2 = sbCqi.at (1);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1012
                }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1013
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1014
              if ((cqi1 > 0)||(cqi2 > 0)) // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1015
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1016
                  if (LcActivePerFlow ((*it).first) > 0)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1017
                    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1018
                      // this UE has data to transmit
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1019
                      double achievableRate = 0.0;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1020
                      uint8_t mcs = 0;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1021
                      for (uint8_t k = 0; k < nLayer; k++)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1022
                        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1023
                          if (sbCqi.size () > k)
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1024
                            {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1025
                              mcs = m_amc->GetMcsFromCqi (sbCqi.at (k));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1026
                            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1027
                          else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1028
                            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1029
                              // no info on this subband -> worst MCS
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1030
                              mcs = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1031
                            }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1032
                          achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001);   // = TB size / TTI
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1033
                        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1034
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1035
                      double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1036
                      NS_LOG_INFO (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1037
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1038
                      if (rcqi > rcqiMax)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1039
                        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1040
                          rcqiMax = rcqi;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1041
                          itMax = it;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1042
                        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1043
                    }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1044
                }   // end if cqi
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1045
            } // end for m_rlcBufferReq
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1046
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1047
          if (itMax == m_flowStatsDl.end ())
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1048
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1049
              // no UE available for this RB
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1050
              NS_LOG_INFO (this << " any UE found");
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1051
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1052
          else
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1053
            {
9364
7fbef4fbea20 Update PfFfMacScheduler::DoSchedDlTriggerReq for maintaining rbgMap internal variable up-to-date
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9360
diff changeset
  1054
              rbgMap.at (i) = true;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1055
              std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1056
              itMap = allocationMap.find ((*itMax).first);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1057
              if (itMap == allocationMap.end ())
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1058
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1059
                  // insert new element
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1060
                  std::vector <uint16_t> tempMap;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1061
                  tempMap.push_back (i);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1062
                  allocationMap.insert (std::pair <uint16_t, std::vector <uint16_t> > ((*itMax).first, tempMap));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1063
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1064
              else
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1065
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1066
                  (*itMap).second.push_back (i);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1067
                }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1068
              NS_LOG_INFO (this << " UE assigned " << (*itMax).first);
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1069
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1070
        } // end for RBG free
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1071
    } // end for RBGs
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1072
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
  1073
  // 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
  1074
  std::map <uint16_t, pfsFlowPerf_t>::iterator itStats;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1075
  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
  1076
    {
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
  1077
      (*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
  1078
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1079
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1080
  // 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
  1081
  // 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
  1082
  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
  1083
  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
  1084
    {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1085
      // 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
  1086
      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
  1087
      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
  1088
      // 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
  1089
      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
  1090
      newDci.m_rnti = (*itMap).first;
9359
55dee31410ac Update RR and PF schedulers for avoiding the allocation of UEs that do not have HARQ processes available for transmitting
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9358
diff changeset
  1091
      newDci.m_harqProcess = UpdateHarqProcessId ((*itMap).first);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1092
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1093
      uint16_t lcActives = LcActivePerFlow ((*itMap).first);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1094
      NS_LOG_INFO (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
  1095
      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
  1096
      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
  1097
      itCqi = m_a30CqiRxed.find ((*itMap).first);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1098
      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
  1099
      itTxMode = m_uesTxMode.find ((*itMap).first);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1100
      if (itTxMode == m_uesTxMode.end ())
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1101
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1102
          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
  1103
        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1104
      int nLayer = TransmissionModesLayers::TxMode2LayerNum ((*itTxMode).second);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1105
      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
  1106
      if (itCqi != m_a30CqiRxed.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1107
        {
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1108
          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
  1109
            {
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1110
              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
  1111
                {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1112
                  NS_LOG_INFO (this << " RBG " << (*itMap).second.at (k) << " CQI " << (uint16_t)((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.at (0)) );
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1113
                  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
  1114
                    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1115
                      if ((*itCqi).second.m_higherLayerSelected.at ((*itMap).second.at (k)).m_sbCqi.size () > j)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1116
                        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1117
                          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
  1118
                            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1119
                              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
  1120
                            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1121
                        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1122
                      else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1123
                        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1124
                          // 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
  1125
                          worstCqi.at (j) = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1126
                        }
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1127
                    }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1128
                }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1129
              else
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1130
                {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1131
                  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
  1132
                    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1133
                      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
  1134
                    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1135
                }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1136
            }
8182
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1137
        }
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1138
      else
81d05985d460 Bug-fix JIRA-152 m_a30CqiRxed lookup in PfFfMacScheduler::DoSchedDlTriggerReq
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8181
diff changeset
  1139
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1140
          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
  1141
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1142
              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
  1143
            }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1144
        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1145
      for (uint8_t j = 0; j < nLayer; j++)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1146
        {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1147
          NS_LOG_INFO (this << " Layer " << (uint16_t)j << " CQI selected " << (uint16_t)worstCqi.at (j));
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1148
        }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1149
      uint32_t bytesTxed = 0;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1150
      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
  1151
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1152
          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
  1153
          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
  1154
          newDci.m_tbsSize.push_back (tbSize);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1155
          NS_LOG_INFO (this << " Layer " << (uint16_t)j << " MCS selected" << m_amc->GetMcsFromCqi (worstCqi.at (j)));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1156
          bytesTxed += tbSize;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1157
        }
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1158
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1159
      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
  1160
      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
  1161
      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
  1162
      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
  1163
        {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1164
          rbgMask = rbgMask + (0x1 << (*itMap).second.at (k));
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1165
          NS_LOG_INFO (this << " Allocated RBG " << (*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
  1166
        }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1167
      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
  1168
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1169
      // 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
  1170
      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
  1171
      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
  1172
        {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1173
          if (((*itBufReq).first.m_rnti == (*itMap).first)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1174
              && (((*itBufReq).second.m_rlcTransmissionQueueSize > 0)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1175
                  || ((*itBufReq).second.m_rlcRetransmissionQueueSize > 0)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1176
                  || ((*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
  1177
            {
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
  1178
              std::vector <struct RlcPduListElement_s> newRlcPduLe;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1179
              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
  1180
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1181
                  RlcPduListElement_s newRlcEl;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1182
                  newRlcEl.m_logicalChannelIdentity = (*itBufReq).first.m_lcId;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1183
                  newRlcEl.m_size = newDci.m_tbsSize.at (j) / lcActives;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1184
                  NS_LOG_INFO (this << " LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity << " size " << newRlcEl.m_size << " layer " << (uint16_t)j);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1185
                  newRlcPduLe.push_back (newRlcEl);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1186
                  UpdateDlRlcBufferInfo (newDci.m_rnti, newRlcEl.m_logicalChannelIdentity, newRlcEl.m_size);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1187
                  if (m_harqOn == true)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1188
                    {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1189
                      // store RLC PDU list for HARQ
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1190
                      std::map <uint16_t, DlHarqRlcPduListBuffer_t>::iterator itRlcPdu =  m_dlHarqProcessesRlcPduListBuffer.find ((*itMap).first);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1191
                      if (itRlcPdu == m_dlHarqProcessesRlcPduListBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1192
                        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1193
                          NS_FATAL_ERROR ("Unable to find RlcPdcList in HARQ buffer for RNTI " << (*itMap).first);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1194
                        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1195
                      (*itRlcPdu).second.at (j).at (newDci.m_harqProcess).push_back (newRlcEl);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1196
                    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1197
                }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
  1198
              newEl.m_rlcPduList.push_back (newRlcPduLe);
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1199
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1200
          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
  1201
            {
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1202
              break;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1203
            }
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1204
        }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
  1205
      for (uint8_t j = 0; j < nLayer; j++)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
  1206
        {
9360
197c71f20845 Bug-fix in RR and PF: update RV field in different harq retx
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9359
diff changeset
  1207
          newDci.m_ndi.push_back (1);
197c71f20845 Bug-fix in RR and PF: update RV field in different harq retx
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9359
diff changeset
  1208
          newDci.m_rv.push_back (0);
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9350
diff changeset
  1209
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1210
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1211
      newEl.m_dci = newDci;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1212
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1213
      if (m_harqOn == true)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1214
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1215
          // store DCI for HARQ
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1216
          std::map <uint16_t, DlHarqProcessesDciBuffer_t>::iterator itDci = m_dlHarqProcessesDciBuffer.find (newEl.m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1217
          if (itDci == m_dlHarqProcessesDciBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1218
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1219
              NS_FATAL_ERROR ("Unable to find RNTI entry in DCI HARQ buffer for RNTI " << newEl.m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1220
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1221
          (*itDci).second.at (newDci.m_harqProcess) = newDci;
9394
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1222
          // refresh timer
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1223
          std::map <uint16_t, DlHarqProcessesTimer_t>::iterator itHarqTimer =  m_dlHarqProcessesTimer.find (newEl.m_rnti);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1224
          if (itHarqTimer== m_dlHarqProcessesTimer.end ())
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1225
            {
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1226
              NS_FATAL_ERROR ("Unable to find HARQ timer for RNTI " << (uint16_t)newEl.m_rnti);
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1227
            }
3cefef4eb74a Introduced HARQ processes timers in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9379
diff changeset
  1228
          (*itHarqTimer).second.at (newDci.m_harqProcess) = 0;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1229
        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1230
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1231
      // ...more parameters -> ingored in this version
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1232
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1233
      ret.m_buildDataList.push_back (newEl);
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1234
      // 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
  1235
      std::map <uint16_t, pfsFlowPerf_t>::iterator it;
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1236
      it = m_flowStatsDl.find ((*itMap).first);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1237
      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
  1238
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1239
          (*it).second.lastTtiBytesTrasmitted = bytesTxed;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1240
          NS_LOG_INFO (this << " UE total bytes txed " << (*it).second.lastTtiBytesTrasmitted);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1241
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1242
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1243
        }
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
  1244
      else
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
  1245
        {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1246
          NS_FATAL_ERROR (this << " No Stats for this allocated UE");
8035
d2e70680881a LenaTestPfFfMacSchedulerSuite works with distance 0
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7983
diff changeset
  1247
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1248
7979
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1249
      itMap++;
8e542d91bfc3 LENA-68 PfFfMacScheduler updated to single TB per RNTI (LC multiplexed)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7974
diff changeset
  1250
    } // 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
  1251
  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
  1252
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1253
8047
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
  1254
  // update UEs stats
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1255
  NS_LOG_INFO (this << " Update UEs statistics");
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1256
  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
  1257
    {
3741b99462cd Update PfFfMacScheduler::m_timWindow for having giving more memory to the scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8035
diff changeset
  1258
      (*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
  1259
      // 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
  1260
      (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001));
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1261
      NS_LOG_INFO (this << " UE total bytes " << (*itStats).second.totalBytesTransmitted);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1262
      NS_LOG_INFO (this << " UE average throughput " << (*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
  1263
      (*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
  1264
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1265
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1266
  m_schedSapUser->SchedDlConfigInd (ret);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1267
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1268
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1269
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1270
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1271
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1272
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1273
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
  1274
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1275
  NS_LOG_FUNCTION (this);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1276
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1277
  m_rachList = params.m_rachList;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1278
  
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1279
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1280
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1281
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1282
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1283
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
  1284
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1285
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1286
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1287
  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
  1288
    {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1289
      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
  1290
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1291
          // wideband CQI reporting
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1292
          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
  1293
          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
  1294
          it = m_p10CqiRxed.find (rnti);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1295
          if (it == m_p10CqiRxed.end ())
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1296
            {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1297
              // create the new entry
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1298
              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
  1299
              // 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
  1300
              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
  1301
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1302
          else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1303
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1304
              // 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
  1305
              (*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
  1306
              // 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
  1307
              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
  1308
              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
  1309
              (*itTimers).second = m_cqiTimersThreshold;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1310
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1311
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1312
      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
  1313
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1314
          // subband CQI reporting high layer configured
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1315
          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
  1316
          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
  1317
          it = m_a30CqiRxed.find (rnti);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1318
          if (it == m_a30CqiRxed.end ())
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1319
            {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1320
              // create the new entry
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1321
              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
  1322
              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
  1323
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1324
          else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1325
            {
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1326
              // 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
  1327
              (*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
  1328
              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
  1329
              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
  1330
              (*itTimers).second = m_cqiTimersThreshold;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1331
            }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1332
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1333
      else
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1334
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1335
          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
  1336
        }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1337
    }
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1338
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1339
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1340
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1341
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1342
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1343
double
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1344
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
  1345
{
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1346
  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
  1347
  if (itCqi == m_ueCqi.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1348
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1349
      // no cqi info about this UE
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1350
      return (NO_SINR);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1351
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1352
    }
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1353
  else
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1354
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1355
      // 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
  1356
      double sinrSum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1357
      int sinrNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1358
      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
  1359
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1360
          double sinr = (*itCqi).second.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1361
          if (sinr != NO_SINR)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1362
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1363
              sinrSum += sinr;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1364
              sinrNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1365
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1366
        }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1367
      double estimatedSinr = sinrSum / (double)sinrNum;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1368
      // store the value
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1369
      (*itCqi).second.at (rb) = estimatedSinr;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1370
      return (estimatedSinr);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1371
    }
8141
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1372
}
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1373
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1374
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1375
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
  1376
{
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1377
  NS_LOG_FUNCTION (this << " UL - Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf) << " size " << params.m_ulInfoList.size ());
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1378
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1379
  RefreshUlCqiMaps ();
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1380
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1381
  // Generate RBs map
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1382
  FfMacSchedSapUser::SchedUlConfigIndParameters ret;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1383
  std::vector <bool> rbMap;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1384
  uint16_t rbAllocatedNum = 0;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1385
  std::set <uint16_t> rntiAllocated;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1386
  std::vector <uint16_t> rbgAllocationMap;
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1387
  // update with RACH allocation map
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1388
  rbgAllocationMap = m_rachAllocationMap;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1389
  //rbgAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1390
  m_rachAllocationMap.clear ();
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1391
  m_rachAllocationMap.resize (m_cschedCellConfig.m_ulBandwidth, 0);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1392
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1393
  rbMap.resize (m_cschedCellConfig.m_ulBandwidth, false);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1394
  // remove RACH allocation
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1395
  for (uint16_t i = 0; i < m_cschedCellConfig.m_ulBandwidth; i++)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1396
    {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1397
      if (rbgAllocationMap.at (i) != 0)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1398
        {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1399
          rbMap.at (i) = true;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1400
          NS_LOG_DEBUG (this << " Allocated for RACH " << i);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1401
        }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1402
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1403
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1404
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1405
  if (m_harqOn == true)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1406
    {
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1407
      //   Process UL HARQ feedback
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1408
      //   update UL HARQ proc id
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1409
      std::map <uint16_t, uint8_t>::iterator itProcId;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1410
      for (itProcId = m_ulHarqCurrentProcessId.begin (); itProcId != m_ulHarqCurrentProcessId.end (); itProcId++)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1411
        {
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1412
          (*itProcId).second = ((*itProcId).second + 1) % HARQ_PROC_NUM;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1413
        }
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1414
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1415
      for (uint16_t i = 0; i < params.m_ulInfoList.size (); i++)
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1416
        {        
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1417
          if (params.m_ulInfoList.at (i).m_receptionStatus == UlInfoListElement_s::NotOk)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1418
            {
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1419
              // retx correspondent block: retrieve the UL-DCI
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1420
              uint16_t rnti = params.m_ulInfoList.at (i).m_rnti;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1421
              itProcId = m_ulHarqCurrentProcessId.find (rnti);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1422
              if (itProcId == m_ulHarqCurrentProcessId.end ())
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1423
                {
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9468
diff changeset
  1424
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1425
                }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1426
              uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM;
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1427
              NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId << " i " << i << " size "  << params.m_ulInfoList.size ());
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1428
              std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1429
              if (itHarq == m_ulHarqProcessesDciBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1430
                {
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9468
diff changeset
  1431
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
9592
35619c251e91 handle case of No info find in HARQ buffer for UE
Nicola Baldo <nbaldo@cttc.es>
parents: 9587
diff changeset
  1432
                  continue;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1433
                }
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1434
              UlDciListElement_s dci = (*itHarq).second.at (harqId);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1435
              std::map <uint16_t, UlHarqProcessesStatus_t>::iterator itStat = m_ulHarqProcessesStatus.find (rnti);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1436
              if (itStat == m_ulHarqProcessesStatus.end ())
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1437
                {
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9468
diff changeset
  1438
                  NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti);
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1439
                }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1440
              if ((*itStat).second.at (harqId) >= 3)
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1441
                {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1442
                  NS_LOG_INFO ("Max number of retransmissions reached (UL)-> drop process");
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1443
                  continue;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1444
                }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1445
              bool free = true;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1446
              for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1447
                {
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1448
                  if (rbMap.at (j) == true)
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1449
                    {
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1450
                      free = false;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1451
                      NS_LOG_INFO (this << " BUSY " << j);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1452
                    }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1453
                }
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1454
              if (free)
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1455
                {
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1456
                  // retx on the same RBs
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1457
                  for (int j = dci.m_rbStart; j < dci.m_rbStart + dci.m_rbLen; j++)
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1458
                    {
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1459
                      rbMap.at (j) = true;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1460
                      rbgAllocationMap.at (j) = dci.m_rnti;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1461
                      NS_LOG_INFO ("\tRB " << j);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1462
                      rbAllocatedNum++;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1463
                    }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1464
                  NS_LOG_INFO (this << " Send retx in the same RBs " << (uint16_t)dci.m_rbStart << " to " << dci.m_rbStart + dci.m_rbLen << " RV " << (*itStat).second.at (harqId) + 1);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1465
                }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1466
              else
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1467
                {
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1468
                  NS_LOG_INFO ("Cannot allocate retx due to RACH allocations for UE " << rnti);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1469
                  continue;
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1470
                }
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1471
              dci.m_ndi = 0;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1472
              // Update HARQ buffers with new HarqId
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1473
              (*itStat).second.at ((*itProcId).second) = (*itStat).second.at (harqId) + 1;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1474
              (*itStat).second.at (harqId) = 0;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1475
              (*itHarq).second.at ((*itProcId).second) = dci;
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1476
              ret.m_dciList.push_back (dci);
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1477
              rntiAllocated.insert (dci.m_rnti);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1478
            }
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1479
            else
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1480
            {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1481
              NS_LOG_INFO (this << " HARQ-ACK feedback from RNTI " << params.m_ulInfoList.at (i).m_rnti);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1482
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1483
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1484
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1485
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1486
  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
  1487
  int nflows = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1488
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1489
  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
  1490
    {
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1491
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1492
      // select UEs with queues not empty and not yet allocated for HARQ
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1493
      if (((*it).second > 0)&&(itRnti == rntiAllocated.end ()))
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1494
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1495
          nflows++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1496
        }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1497
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1498
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1499
  if (nflows == 0)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1500
    {
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1501
      if (ret.m_dciList.size () > 0)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1502
        {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1503
          m_schedSapUser->SchedUlConfigInd (ret);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1504
        }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1505
        
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1506
      return;  // no flows to be scheduled
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1507
    }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1508
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1509
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1510
  // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1511
  uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ());
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1512
  if (rbPerFlow < 3)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1513
    {
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1514
      rbPerFlow = 3;  // at least 3 rbg per flow (till available resource) to ensure TxOpportunity >= 7 bytes
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1515
    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1516
  int rbAllocated = 0;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1517
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1518
  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
  1519
  if (m_nextRntiUl != 0)
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1520
    {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1521
      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
  1522
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1523
          if ((*it).first == m_nextRntiUl)
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1524
            {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1525
              break;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1526
            }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1527
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1528
      if (it == m_ceBsrRxed.end ())
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1529
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1530
          NS_LOG_ERROR (this << " no user found");
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1531
        }
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1532
    }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1533
  else
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1534
    {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1535
      it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1536
      m_nextRntiUl = (*it).first;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1537
    }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1538
  do
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1539
    {
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1540
      std::set <uint16_t>::iterator itRnti = rntiAllocated.find ((*it).first);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1541
      if ((itRnti != rntiAllocated.end ())||((*it).second == 0))
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1542
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1543
          // UE already allocated for UL-HARQ -> skip it
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1544
          it++;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1545
          if (it == m_ceBsrRxed.end ())
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1546
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1547
              // restart from the first
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1548
              it = m_ceBsrRxed.begin ();
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1549
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1550
          continue;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1551
        }
9379
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1552
      if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1553
        {
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1554
          // 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
  1555
          rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1556
          // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1557
          if (rbPerFlow < 3)
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1558
            {
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1559
              // terminate allocation
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1560
              rbPerFlow = 0;      
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1561
            }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1562
        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1563
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1564
      UlDciListElement_s uldci;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1565
      uldci.m_rnti = (*it).first;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1566
      uldci.m_rbLen = rbPerFlow;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1567
      bool allocated = false;
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1568
      NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1569
      while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1570
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1571
          // check availability
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1572
          bool free = true;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1573
          for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1574
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1575
              if (rbMap.at (j) == true)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1576
                {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1577
                  free = false;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1578
                  break;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1579
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1580
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1581
          if (free)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1582
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1583
              uldci.m_rbStart = rbAllocated;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1584
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1585
              for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1586
                {
9367
b4fcfc26791f Add lte-harq test suite and polishing of code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9366
diff changeset
  1587
                  rbMap.at (j) = true;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1588
                  // store info on allocation for managing ul-cqi interpretation
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1589
                  rbgAllocationMap.at (j) = (*it).first;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1590
                }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1591
              rbAllocated += rbPerFlow;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1592
              allocated = true;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1593
              break;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1594
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1595
          rbAllocated++;
9379
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1596
          if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1597
            {
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1598
              // limit to physical resources last resource assignment
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1599
              rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1600
              // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1601
              if (rbPerFlow < 3)
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1602
                {
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1603
                  // terminate allocation
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1604
                  rbPerFlow = 0;                 
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1605
                }
9379
12f60196ac3a Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9376
diff changeset
  1606
            }
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1607
        }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1608
      if (!allocated)
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1609
        {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1610
          // unable to allocate new resource: finish scheduling
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1611
          m_nextRntiUl = (*it).first;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1612
          if (ret.m_dciList.size () > 0)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1613
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1614
              m_schedSapUser->SchedUlConfigInd (ret);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1615
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1616
          m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1617
          return;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1618
        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1619
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1620
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1621
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1622
      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
  1623
      int cqi = 0;
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1624
      if (itCqi == m_ueCqi.end ())
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1625
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1626
          // no cqi info about this UE
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1627
          uldci.m_mcs = 0; // MCS 0 -> UL-AMC TBD
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1628
        }
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1629
      else
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7943
diff changeset
  1630
        {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1631
          // 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
  1632
          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
  1633
          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
  1634
            {
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1635
              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
  1636
            }
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1637
          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
  1638
            {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1639
              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
  1640
              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
  1641
                {
b3a8a85ee6f0 LENA-109 Uplink CQI support: introduced estimation of unkwnown CQI (average)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8133
diff changeset
  1642
                  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
  1643
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1644
              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
  1645
                {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1646
                  minSinr = (*itCqi).second.at (i);
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1647
                }
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1648
            }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1649
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1650
          // 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
  1651
          double s = log2 ( 1 + (
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1652
                              pow (10, minSinr / 10 )  /
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1653
                              ( (-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
  1654
          cqi = m_amc->GetCqiFromSpectralEfficiency (s);
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
  1655
          if (cqi == 0)
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
  1656
            {
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1657
              it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1658
              if (it == m_ceBsrRxed.end ())
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1659
                {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1660
                  // restart from the first
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1661
                  it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1662
                }
7966
c2cfb1a64d66 LENA-72 CQI=0 behaviour
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7959
diff changeset
  1663
              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
  1664
            }
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
  1665
          uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1666
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1667
8516
db748e56aea2 Update RR and PF scheduler for working wiht new LteAmc object
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8321
diff changeset
  1668
      uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
8675
e65859f03e99 Bug-fix: update m_ceBsrRxed each UL scheduling trigger event
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  1669
      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
  1670
      uldci.m_ndi = 1;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1671
      uldci.m_cceIndex = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1672
      uldci.m_aggrLevel = 1;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1673
      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
  1674
      uldci.m_hopping = false;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1675
      uldci.m_n2Dmrs = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1676
      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
  1677
      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
  1678
      uldci.m_ulIndex = 0; // TDD parameter
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1679
      uldci.m_dai = 1; // TDD parameter
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1680
      uldci.m_freqHopping = 0;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1681
      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
  1682
      ret.m_dciList.push_back (uldci);
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1683
      // store DCI for HARQ_PERIOD
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1684
      uint8_t harqId = 0;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1685
      if (m_harqOn == true)
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1686
        {
9376
4fa6b971e01f Bug-fix solvin desynchronization of UL HARQ processes during retransmissions
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9374
diff changeset
  1687
          std::map <uint16_t, uint8_t>::iterator itProcId;
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1688
          itProcId = m_ulHarqCurrentProcessId.find (uldci.m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1689
          if (itProcId == m_ulHarqCurrentProcessId.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1690
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1691
              NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << uldci.m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1692
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1693
          harqId = (*itProcId).second;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1694
          std::map <uint16_t, UlHarqProcessesDciBuffer_t>::iterator itDci = m_ulHarqProcessesDciBuffer.find (uldci.m_rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1695
          if (itDci == m_ulHarqProcessesDciBuffer.end ())
9352
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1696
            {
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1697
              NS_FATAL_ERROR ("Unable to find RNTI entry in UL DCI HARQ buffer for RNTI " << uldci.m_rnti);
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1698
            }
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1699
          (*itDci).second.at (harqId) = uldci;
0b43d0a862dc HARQ included in PF Scheduler
mmiozzo
parents: 9351
diff changeset
  1700
        }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1701
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1702
      NS_LOG_INFO (this << " UE Allocation RNTI " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated << " harqId " << (uint16_t)harqId);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1703
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1704
      // update TTI  UE stats
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1705
      itStats = m_flowStatsUl.find ((*it).first);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1706
      if (itStats != m_flowStatsUl.end ())
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1707
        {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1708
          (*itStats).second.lastTtiBytesTrasmitted =  uldci.m_tbSize;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1709
        }
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1710
      else
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1711
        {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1712
          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
  1713
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1714
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1715
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1716
      it++;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1717
      if (it == m_ceBsrRxed.end ())
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1718
        {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1719
          // restart from the first
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1720
          it = m_ceBsrRxed.begin ();
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1721
        }
9600
6997e80b2ba9 enforce at least 3RBs per UE in UL of PF scheduler
Nicola Baldo <nbaldo@cttc.es>
parents: 9592
diff changeset
  1722
      if ((rbAllocated == m_cschedCellConfig.m_ulBandwidth) || (rbPerFlow == 0))
8080
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1723
        {
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1724
          // Stop allocation: no more PRBs
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1725
          m_nextRntiUl = (*it).first;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1726
          break;
62d2fccef672 Refinements to RR and PF uplink scheduling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8047
diff changeset
  1727
        }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1728
    }
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1729
  while (((*it).first != m_nextRntiUl)&&(rbPerFlow!=0));
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1730
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1731
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1732
  // Update global UE stats
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1733
  // 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
  1734
  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
  1735
    {
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1736
      (*itStats).second.totalBytesTransmitted += (*itStats).second.lastTtiBytesTrasmitted;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1737
      // 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
  1738
      (*itStats).second.lastAveragedThroughput = ((1.0 - (1.0 / m_timeWindow)) * (*itStats).second.lastAveragedThroughput) + ((1.0 / m_timeWindow) * (double)((*itStats).second.lastTtiBytesTrasmitted / 0.001));
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1739
      NS_LOG_INFO (this << " UE total bytes " << (*itStats).second.totalBytesTransmitted);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1740
      NS_LOG_INFO (this << " UE average throughput " << (*itStats).second.lastAveragedThroughput);
8131
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1741
      (*itStats).second.lastTtiBytesTrasmitted = 0;
3a0422147f8a PfFfMacScheduler add m_flowStatsUl
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8080
diff changeset
  1742
    }
7943
db21a8048ab9 PfFfMacScheduler update reception of UL-CQI coherently with previous allocation
mmiozzo
parents: 7940
diff changeset
  1743
  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
  1744
  m_schedSapUser->SchedUlConfigInd (ret);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1745
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1746
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1747
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1748
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1749
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1750
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
  1751
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1752
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1753
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1754
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1755
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1756
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1757
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1758
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
  1759
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1760
  NS_LOG_FUNCTION (this);
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1761
  // TODO: Implementation of the API
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1762
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1763
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1764
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1765
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1766
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
  1767
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1768
  NS_LOG_FUNCTION (this);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8141
diff changeset
  1769
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  1770
  std::map <uint16_t,uint32_t>::iterator it;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1771
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1772
  for (unsigned int i = 0; i < params.m_macCeList.size (); i++)
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1773
    {
9369
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1774
      if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1775
        {
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1776
          // buffer status report
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1777
          // note that this scheduler does not differentiate the
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1778
          // allocation according to which LCGs have more/less bytes
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1779
          // to send.
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1780
          // Hence the BSR of different LCGs are just summed up to get
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1781
          // a total queue size that is used for allocation purposes.
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1782
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1783
          uint32_t buffer = 0;
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1784
          for (uint8_t lcg = 0; lcg < 4; ++lcg)
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1785
            {
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1786
              uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (lcg);
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1787
              buffer += BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1788
            }
9471
082640d26eea Implement real DoSendRrcConnectionSetupCompleted
Lluis Parcerisa <parcerisa@gmail.com>
parents: 9468
diff changeset
  1789
          
9369
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1790
          uint16_t rnti = params.m_macCeList.at (i).m_rnti;
9471
082640d26eea Implement real DoSendRrcConnectionSetupCompleted
Lluis Parcerisa <parcerisa@gmail.com>
parents: 9468
diff changeset
  1791
          NS_LOG_LOGIC (this << "RNTI=" << rnti << " buffer=" << buffer);
9369
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1792
          it = m_ceBsrRxed.find (rnti);
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1793
          if (it == m_ceBsrRxed.end ())
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1794
            {
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1795
              // create the new entry
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1796
              m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1797
            }
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1798
          else
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1799
            {
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1800
              // update the buffer size value
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1801
              (*it).second = buffer;
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1802
            }
eac9f11f4ced Updates on LCs and BSRs management on RR and PF schedulers
mmiozzo
parents: 9368
diff changeset
  1803
        }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1804
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1805
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1806
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1807
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1808
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1809
void
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1810
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
  1811
{
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1812
  NS_LOG_FUNCTION (this);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1813
// retrieve the allocation for this subframe
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1814
  switch (m_ulCqiFilter)
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1815
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1816
    case FfMacScheduler::SRS_UL_CQI:
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1817
      {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1818
        // filter all the CQIs that are not SRS based
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1819
        if (params.m_ulCqi.m_type != UlCqi_s::SRS)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1820
          {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1821
            return;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1822
          }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1823
      }
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1824
      break;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1825
    case FfMacScheduler::PUSCH_UL_CQI:
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1826
      {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1827
        // filter all the CQIs that are not SRS based
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1828
        if (params.m_ulCqi.m_type != UlCqi_s::PUSCH)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1829
          {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1830
            return;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1831
          }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1832
      }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1833
    case FfMacScheduler::ALL_UL_CQI:
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1834
      break;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1835
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1836
    default:
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1837
      NS_FATAL_ERROR ("Unknown UL CQI type");
9039
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1838
    }
5bdf0c1be85f Add SRS based UL-CQI and update RR and PF schedulers for managing them
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1839
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1840
  switch (params.m_ulCqi.m_type)
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1841
    {
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1842
    case UlCqi_s::PUSCH:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1843
      {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1844
        std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1845
        std::map <uint16_t, std::vector <double> >::iterator itCqi;
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1846
        NS_LOG_DEBUG (this << " Collect PUSCH CQIs of Frame no. " << (params.m_sfnSf >> 4) << " subframe no. " << (0xF & params.m_sfnSf));
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1847
        itMap = m_allocationMaps.find (params.m_sfnSf);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1848
        if (itMap == m_allocationMaps.end ())
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1849
          {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1850
            return;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1851
          }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1852
        for (uint32_t i = 0; i < (*itMap).second.size (); i++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1853
          {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1854
            // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1855
            double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1856
            itCqi = m_ueCqi.find ((*itMap).second.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1857
            if (itCqi == m_ueCqi.end ())
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1858
              {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1859
                // create a new entry
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1860
                std::vector <double> newCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1861
                for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1862
                  {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1863
                    if (i == j)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1864
                      {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1865
                        newCqi.push_back (sinr);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1866
                      }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1867
                    else
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1868
                      {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1869
                        // initialize with NO_SINR value.
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1870
                        newCqi.push_back (NO_SINR);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1871
                      }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1872
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1873
                  }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1874
                m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1875
                // generate correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1876
                m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1877
              }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1878
            else
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1879
              {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1880
                // update the value
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1881
                (*itCqi).second.at (i) = sinr;
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1882
                NS_LOG_DEBUG (this << " RNTI " << (*itMap).second.at (i) << " RB " << i << " SINR " << sinr);
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1883
                // update correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1884
                std::map <uint16_t, uint32_t>::iterator itTimers;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1885
                itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1886
                (*itTimers).second = m_cqiTimersThreshold;
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1887
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1888
              }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1889
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1890
          }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1891
        // remove obsolete info on allocation
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1892
        m_allocationMaps.erase (itMap);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1893
      }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1894
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1895
    case UlCqi_s::SRS:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1896
      {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1897
        // get the RNTI from vendor specific parameters
9059
47aa9789ed30 fix maybe-uninitialized warnings
Tom Henderson <tomh@tomh.org>
parents: 9047
diff changeset
  1898
        uint16_t rnti = 0;
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1899
        NS_ASSERT (params.m_vendorSpecificList.size () > 0);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1900
        for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1901
          {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1902
            if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1903
              {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1904
                Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1905
                rnti = vsp->GetRnti ();
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1906
              }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1907
          }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1908
        std::map <uint16_t, std::vector <double> >::iterator itCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1909
        itCqi = m_ueCqi.find (rnti);
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1910
        if (itCqi == m_ueCqi.end ())
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1911
          {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1912
            // create a new entry
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1913
            std::vector <double> newCqi;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1914
            for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1915
              {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1916
                double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1917
                newCqi.push_back (sinr);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1918
                NS_LOG_INFO (this << " RNTI " << rnti << " new SRS-CQI for RB  " << j << " value " << sinr);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1919
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1920
              }
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1921
            m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1922
            // generate correspondent timer
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1923
            m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1924
          }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1925
        else
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1926
          {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1927
            // update the values
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1928
            for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1929
              {
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1930
                double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1931
                (*itCqi).second.at (j) = sinr;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1932
                NS_LOG_INFO (this << " RNTI " << rnti << " update SRS-CQI for RB  " << j << " value " << sinr);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1933
              }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1934
            // update correspondent timer
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1935
            std::map <uint16_t, uint32_t>::iterator itTimers;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1936
            itTimers = m_ueCqiTimers.find (rnti);
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1937
            (*itTimers).second = m_cqiTimersThreshold;
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1938
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1939
          }
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1940
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1941
9042
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1942
      }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1943
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1944
    case UlCqi_s::PUCCH_1:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1945
    case UlCqi_s::PUCCH_2:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1946
    case UlCqi_s::PRACH:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1947
      {
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1948
        NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1949
      }
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1950
      break;
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1951
    default:
ae924de31cbd Update SRS-CQI management in RR and PF Schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9039
diff changeset
  1952
      NS_FATAL_ERROR ("Unknown type of UL-CQI");
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1953
    }
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1954
  return;
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1955
}
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  1956
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1957
void
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1958
PfFfMacScheduler::RefreshDlCqiMaps (void)
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1959
{
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1960
  // 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
  1961
  std::map <uint16_t,uint32_t>::iterator itP10 = m_p10CqiTimers.begin ();
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1962
  while (itP10 != m_p10CqiTimers.end ())
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1963
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1964
      NS_LOG_INFO (this << " P10-CQI for user " << (*itP10).first << " is " << (uint32_t)(*itP10).second << " thr " << (uint32_t)m_cqiTimersThreshold);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1965
      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
  1966
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1967
          // 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
  1968
          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
  1969
          NS_ASSERT_MSG (itMap != m_p10CqiRxed.end (), " Does not find CQI report for user " << (*itP10).first);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1970
          NS_LOG_INFO (this << " P10-CQI expired for user " << (*itP10).first);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1971
          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
  1972
          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
  1973
          itP10++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1974
          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
  1975
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1976
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1977
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1978
          (*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
  1979
          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
  1980
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1981
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1982
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1983
  // 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
  1984
  std::map <uint16_t,uint32_t>::iterator itA30 = m_a30CqiTimers.begin ();
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1985
  while (itA30 != m_a30CqiTimers.end ())
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1986
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  1987
      NS_LOG_INFO (this << " A30-CQI for user " << (*itA30).first << " is " << (uint32_t)(*itA30).second << " thr " << (uint32_t)m_cqiTimersThreshold);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1988
      if ((*itA30).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
  1989
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1990
          // 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
  1991
          std::map <uint16_t,SbMeasResult_s>::iterator itMap = m_a30CqiRxed.find ((*itA30).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1992
          NS_ASSERT_MSG (itMap != m_a30CqiRxed.end (), " Does not find CQI report for user " << (*itA30).first);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
  1993
          NS_LOG_INFO (this << " A30-CQI expired for user " << (*itA30).first);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1994
          m_a30CqiRxed.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
  1995
          std::map <uint16_t,uint32_t>::iterator temp = itA30;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1996
          itA30++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1997
          m_a30CqiTimers.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
  1998
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  1999
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2000
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2001
          (*itA30).second--;
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  2002
          itA30++;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2003
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2004
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2005
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2006
  return;
7899
6cde5b6879e1 add missed file of pf-ff-mac-scheduler
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
  2007
}
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2008
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2009
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2010
void
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2011
PfFfMacScheduler::RefreshUlCqiMaps (void)
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2012
{
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2013
  // refresh UL CQI  Map
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2014
  std::map <uint16_t,uint32_t>::iterator itUl = m_ueCqiTimers.begin ();
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2015
  while (itUl != m_ueCqiTimers.end ())
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2016
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2017
      NS_LOG_INFO (this << " UL-CQI for user " << (*itUl).first << " is " << (uint32_t)(*itUl).second << " thr " << (uint32_t)m_cqiTimersThreshold);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2018
      if ((*itUl).second == 0)
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2019
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2020
          // 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
  2021
          std::map <uint16_t, std::vector <double> >::iterator itMap = m_ueCqi.find ((*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2022
          NS_ASSERT_MSG (itMap != m_ueCqi.end (), " Does not find CQI report for user " << (*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2023
          NS_LOG_INFO (this << " UL-CQI exired for user " << (*itUl).first);
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2024
          (*itMap).second.clear ();
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2025
          m_ueCqi.erase (itMap);
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  2026
          std::map <uint16_t,uint32_t>::iterator temp = itUl;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  2027
          itUl++;
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  2028
          m_ueCqiTimers.erase (temp);
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2029
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2030
      else
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2031
        {
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2032
          (*itUl).second--;
8584
188a9d439fd8 Soved valgrind error on CQI updates in RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  2033
          itUl++;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2034
        }
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2035
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2036
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2037
  return;
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2038
}
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2039
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2040
void
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2041
PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2042
{
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2043
  std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2044
  LteFlowId_t flow (rnti, lcid);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2045
  it = m_rlcBufferReq.find (flow);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2046
  if (it != m_rlcBufferReq.end ())
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2047
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2048
      NS_LOG_INFO (this << " UE " << rnti << " LC " << (uint16_t)lcid << " txqueue " << (*it).second.m_rlcTransmissionQueueSize << " retxqueue " << (*it).second.m_rlcRetransmissionQueueSize << " status " << (*it).second.m_rlcStatusPduSize << " decrease " << size);
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2049
      // Update queues: RLC tx order Status, ReTx, Tx
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2050
      // Update status queue
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2051
      if (((*it).second.m_rlcStatusPduSize > 0) && (size >= (*it).second.m_rlcStatusPduSize))
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2052
        {
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2053
           (*it).second.m_rlcStatusPduSize = 0;
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2054
        }
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2055
      else if (((*it).second.m_rlcRetransmissionQueueSize > 0) && (size >= (*it).second.m_rlcRetransmissionQueueSize))
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2056
        {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2057
          (*it).second.m_rlcRetransmissionQueueSize = 0;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2058
        }
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2059
      else if ((*it).second.m_rlcTransmissionQueueSize > 0)
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2060
        {
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2061
          // update transmission queue
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2062
          if ((*it).second.m_rlcTransmissionQueueSize <= size)
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2063
            {
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2064
              (*it).second.m_rlcTransmissionQueueSize = 0;
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2065
            }
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2066
          else
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2067
            {
9506
9b140380dda0 Bug-fix in UpdateDlRlcBufferInfo of RR and PF schedulers: the 2 bytes of RLC overhead affects only new tx queue and not status and retx ones
mmiozzo
parents: 9504
diff changeset
  2068
              size -= 2; // remove minimun RLC overhead due to header
9504
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2069
              (*it).second.m_rlcTransmissionQueueSize -= size;
5671c81e6aad Bug-fix UpdateDlRlcBufferInfo of PF and RR schedulers mutual exclusivity of the status and retx queues
mmiozzo
parents: 9471
diff changeset
  2070
            }
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2071
        }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2072
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2073
  else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2074
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2075
      NS_LOG_ERROR (this << " Does not find DL RLC Buffer Report of UE " << rnti);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2076
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2077
}
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2078
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2079
void
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2080
PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2081
{
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2082
8858
6336a6eabf99 Update Ul and Dl RlcBufferInfo methods of RR and PF scheduler for considering the minimum RLC overhead when decrementing queues
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2083
  size = size - 2; // remove the minimum RLC overhead
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2084
  std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2085
  if (it != m_ceBsrRxed.end ())
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2086
    {
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2087
      NS_LOG_INFO (this << " UE " << rnti << " size " << size << " BSR " << (*it).second);
8497
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2088
      if ((*it).second >= size)
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2089
        {
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2090
          (*it).second -= size;
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2091
        }
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2092
      else
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2093
        {
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2094
          (*it).second = 0;
b06cd67bc6ba Update RR and PF scheduler for updating BSR queues avoiding overflows
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8435
diff changeset
  2095
        }
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2096
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2097
  else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2098
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2099
      NS_LOG_ERROR (this << " Does not find BSR report info of UE " << rnti);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2100
    }
9374
77f6eab81eac Run check-style and polish logs on RR and PF schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9372
diff changeset
  2101
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2102
}
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8321
diff changeset
  2103
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2104
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2105
PfFfMacScheduler::TransmissionModeConfigurationUpdate (uint16_t rnti, uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2106
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2107
  NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2108
  FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2109
  params.m_rnti = rnti;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2110
  params.m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2111
  m_cschedSapUser->CschedUeConfigUpdateInd (params);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2112
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8584
diff changeset
  2113
8311
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2114
ec257b681d85 Address LENA-173: CQI refresh procedure introduced in Pf and Rr schedulers
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8264
diff changeset
  2115
}