src/lte/model/lte-common.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 10680 ace43d9baa17
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     2
/*
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     4
 *
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     7
 * published by the Free Software Foundation;
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     8
 *
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    12
 * GNU General Public License for more details.
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    13
 *
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    17
 *
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    18
 * Author: Manuel Requena <manuel.requena@cttc.es>
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
    19
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    20
 */
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    21
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    22
#include "lte-common.h"
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
    23
#include <ns3/log.h>
8580
69e6897f7bc9 array boundary checking in lte-common.cc
Nicola Baldo <nbaldo@cttc.es>
parents: 8435
diff changeset
    24
#include <ns3/abort.h>
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    25
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    26
namespace ns3 {
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    27
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10680
diff changeset
    28
NS_LOG_COMPONENT_DEFINE ("LteCommon");
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    29
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7947
diff changeset
    30
LteFlowId_t::LteFlowId_t ()
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    31
{
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    32
}
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    33
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7947
diff changeset
    34
LteFlowId_t::LteFlowId_t (const uint16_t a, const uint8_t b)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
    35
  : m_rnti (a),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
    36
    m_lcId (b)
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    37
{
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    38
}
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    39
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    40
bool
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7947
diff changeset
    41
operator == (const LteFlowId_t &a, const LteFlowId_t &b)
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    42
{
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    43
  return ( (a.m_rnti == b.m_rnti) && (a.m_lcId == b.m_lcId) );
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    44
}
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    45
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    46
bool
7971
3cc205853837 lteFlowId_t --> LteFlowId_t
Nicola Baldo <nbaldo@cttc.es>
parents: 7947
diff changeset
    47
operator < (const LteFlowId_t& a, const LteFlowId_t& b)
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    48
{
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    49
  return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_lcId < b.m_lcId) ) );
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    50
}
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    51
8266
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    52
ImsiLcidPair_t::ImsiLcidPair_t ()
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    53
{
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    54
}
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    55
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    56
ImsiLcidPair_t::ImsiLcidPair_t (const uint64_t a, const uint8_t b)
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    57
  : m_imsi (a),
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    58
    m_lcId (b)
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    59
{
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    60
}
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    61
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    62
bool
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    63
operator == (const ImsiLcidPair_t &a, const ImsiLcidPair_t &b)
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    64
{
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    65
  return ((a.m_imsi == b.m_imsi) && (a.m_lcId == b.m_lcId));
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    66
}
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    67
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    68
bool
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    69
operator < (const ImsiLcidPair_t& a, const ImsiLcidPair_t& b)
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    70
{
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    71
  return ((a.m_imsi < b.m_imsi) || ((a.m_imsi == b.m_imsi) && (a.m_lcId
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    72
                                                               < b.m_lcId)));
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    73
}
3a30a2b5c94c Refactoring of the statistics classes to avoid continious calls to the attribute system.
jaumenin
parents: 8148
diff changeset
    74
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
    75
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    76
LteUeConfig_t::LteUeConfig_t ()
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    77
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    78
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    79
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    80
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    81
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    82
bool
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    83
operator == (const LteUeConfig_t &a, const LteUeConfig_t &b)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    84
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    85
  return (a.m_rnti == b.m_rnti);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    86
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    87
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    88
bool
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    89
operator < (const LteUeConfig_t& a, const LteUeConfig_t& b)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    90
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    91
  return (a.m_rnti < b.m_rnti);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    92
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    93
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    94
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
    95
uint16_t
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
    96
LteFfConverter::double2fpS11dot3 (double val)
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
    97
{
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
    98
  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
8674
2bd42ffd4fe8 Introduce sanity checks on LteFfConverter::double2fpS11dot3
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
    99
  // truncate val to notation limits
8680
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   100
  if (val > 4095.88)
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   101
    {
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   102
      val = 4095.88;
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   103
    }
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   104
  if (val < -4096)
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   105
    {
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   106
      val = -4096;
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   107
    }
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   108
  int16_t valFp = (int16_t)(val * 8);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
   109
  return (valFp);
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   110
}
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   111
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   112
double
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
   113
LteFfConverter::fpS11dot3toDouble (uint16_t val)
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   114
{
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
   115
  // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
8680
6f04863cf772 LENA-226 adjust coding style in LteFfConverter (lte-common.cc)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8674
diff changeset
   116
  double valD = ((int16_t)val) / 8.0;
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   117
  return (valD);
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   118
}
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   119
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   120
double 
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   121
LteFfConverter::getMinFpS11dot3Value ()
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   122
{
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 7971
diff changeset
   123
  return (-4096);        // -4096 = 0x8000 = 1000 0000 0000 0000 b
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   124
}
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   125
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   126
//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000)
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   127
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   128
10680
ace43d9baa17 make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents: 10413
diff changeset
   129
static const uint32_t BufferSizeLevelBsrTable[64] = {
10305
71ce191704c6 Renamed LTE measurement mapping function for consistency
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10300
diff changeset
   130
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   131
  0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   132
  107, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   133
  706, 826, 967, 1132, 1326, 1552, 1817, 2127, 2490, 2915, 3413,
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   134
  3995, 4677, 5476, 6411, 7505, 8787, 10287, 12043, 14099, 16507,
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   135
  19325, 22624, 26487, 31009, 36304, 42502, 49759, 58255,
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   136
  68201, 79846, 93749, 109439, 128125, 150000, 150000
10305
71ce191704c6 Renamed LTE measurement mapping function for consistency
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10300
diff changeset
   137
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   138
};
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   139
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   140
uint32_t
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   141
BufferSizeLevelBsr::BsrId2BufferSize (uint8_t val)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   142
{
8762
46d94f0ede45 remove tests that always evaluate to true
Tom Henderson <tomh@tomh.org>
parents: 8726
diff changeset
   143
  NS_ABORT_MSG_UNLESS (val < 64, "val = " << val << " is out of range");
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   144
  return BufferSizeLevelBsrTable[val];
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   145
}
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   146
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   147
uint8_t
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   148
BufferSizeLevelBsr::BufferSize2BsrId (uint32_t val)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   149
{
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   150
  int index = 0;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   151
  if (BufferSizeLevelBsrTable[63] < val)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   152
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   153
      index = 63;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   154
    }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   155
  else
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   156
    {
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   157
      while (BufferSizeLevelBsrTable[index] < val)
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   158
        {
8580
69e6897f7bc9 array boundary checking in lte-common.cc
Nicola Baldo <nbaldo@cttc.es>
parents: 8435
diff changeset
   159
          NS_ASSERT (index < 64);
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   160
          index++;
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   161
        }
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   162
    }
10305
71ce191704c6 Renamed LTE measurement mapping function for consistency
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10300
diff changeset
   163
8435
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   164
  return (index);
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   165
}
6b0542a91970 Transmission queue head-of-line delay and queue size at MAC Scheduler
mmiozzo
parents: 8266
diff changeset
   166
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7938
diff changeset
   167
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   168
uint8_t
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   169
TransmissionModesLayers::TxMode2LayerNum (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   170
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   171
  uint8_t nLayer = 0;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   172
  switch (txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   173
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   174
    case 0: // Tx MODE 1: SISO
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   175
      nLayer = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   176
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   177
    case 1: // Tx MODE 2: MIMO Tx Diversity
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   178
      nLayer = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   179
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   180
    case 2: // Tx MODE 3: MIMO Spatial Multiplexity Open Loop
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   181
      nLayer = 2;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   182
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   183
    case 3: // Tx MODE 4: MIMO Spatial Multiplexity Closed Loop
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   184
      nLayer = 2;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   185
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   186
    case 4: // Tx MODE 5: MIMO Multi-User
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   187
      nLayer = 2;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   188
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   189
    case 5: // Tx MODE 6: Closer loop single layer percoding
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   190
      nLayer = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   191
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   192
    case 6: // Tx MODE 7: Single antenna port 5
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   193
      nLayer = 1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   194
      break;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   195
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   196
  return (nLayer);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   197
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   198
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8580
diff changeset
   199
9995
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   200
double 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   201
EutranMeasurementMapping::RsrpRange2Dbm (uint8_t range)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   202
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   203
  // 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   204
  NS_ASSERT_MSG (range <= 97, "value " << range << " is out of range");
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   205
  return (double) range - 141.0;
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   206
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   207
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   208
uint8_t 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   209
EutranMeasurementMapping::Dbm2RsrpRange (double dbm)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   210
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   211
  // 3GPP TS 36.133 section 9.1.4 RSRP Measurement Report Mapping
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   212
  double range = std::min (std::max (std::floor (dbm + 141), 0.0), 97.0);
9995
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   213
  return (uint8_t) range;
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   214
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   215
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   216
double 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   217
EutranMeasurementMapping::RsrqRange2Db (uint8_t range)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   218
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   219
  // 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
10018
8851948132e5 Fix log display error
Manuel Requena <manuel.requena@cttc.es>
parents: 9995
diff changeset
   220
  NS_ASSERT_MSG (range <= 34, "value " << (uint16_t) range << " is out of range");
9995
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   221
  return ((double) range - 40.0)*0.5;
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   222
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   223
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   224
uint8_t 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   225
EutranMeasurementMapping::Db2RsrqRange (double db)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   226
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   227
  // 3GPP TS 36.133 section 9.1.7 RSRQ Measurement Report Mapping
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   228
  double range = std::min (std::max (std::floor (db*2 + 40), 0.0), 34.0);
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   229
  return (uint8_t) range;
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   230
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   231
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   232
double 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   233
EutranMeasurementMapping::QuantizeRsrp (double v)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   234
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   235
  return RsrpRange2Dbm (Dbm2RsrpRange (v));
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   236
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   237
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   238
double 
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   239
EutranMeasurementMapping::QuantizeRsrq (double v)
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   240
{
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   241
  return RsrqRange2Db (Db2RsrqRange (v));
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   242
}
32e393c01fdb added support for measurements in LteUeRrc
Nicola Baldo <nbaldo@cttc.es>
parents: 8762
diff changeset
   243
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   244
double
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   245
EutranMeasurementMapping::IeValue2ActualHysteresis (uint8_t hysteresisIeValue)
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   246
{
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   247
  if (hysteresisIeValue > 30)
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   248
    {
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   249
      NS_FATAL_ERROR ("The value " << (uint16_t) hysteresisIeValue
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   250
                                   << " is out of the allowed range (0..30)"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   251
                                   << " for Hysteresis IE value");
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   252
    }
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   253
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   254
  double actual = static_cast<double> (hysteresisIeValue) * 0.5;
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   255
  NS_ASSERT (actual >= 0.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   256
  NS_ASSERT (actual <= 15.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   257
  return actual;
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   258
}
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   259
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   260
uint8_t
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   261
EutranMeasurementMapping::ActualHysteresis2IeValue (double hysteresisDb)
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   262
{
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   263
  if ((hysteresisDb < 0.0) || (hysteresisDb > 15.0))
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   264
    {
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   265
      NS_FATAL_ERROR ("The value " << hysteresisDb
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   266
                                   << " is out of the allowed range (0..15) dB"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   267
                                   << " for hysteresis");
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   268
    }
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   269
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   270
  uint8_t ieValue = lround (hysteresisDb * 2.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   271
  NS_ASSERT (ieValue <= 30);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   272
  return ieValue;
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   273
}
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   274
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   275
double
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   276
EutranMeasurementMapping::IeValue2ActualA3Offset (int8_t a3OffsetIeValue)
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   277
{
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   278
  if ((a3OffsetIeValue < -30) || (a3OffsetIeValue > 30))
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   279
    {
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   280
      NS_FATAL_ERROR ("The value " << (int16_t) a3OffsetIeValue
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   281
                                   << " is out of the allowed range (-30..30)"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   282
                                   << " for a3-Offset IE value");
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   283
    }
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   284
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   285
  double actual = static_cast<double> (a3OffsetIeValue) * 0.5;
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   286
  NS_ASSERT (actual >= -15.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   287
  NS_ASSERT (actual <= 15.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   288
  return actual;
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   289
}
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   290
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   291
int8_t
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   292
EutranMeasurementMapping::ActualA3Offset2IeValue (double a3OffsetDb)
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   293
{
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   294
  if ((a3OffsetDb < -15.0) || (a3OffsetDb > 15.0))
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   295
    {
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   296
      NS_FATAL_ERROR ("The value " << a3OffsetDb
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   297
                                   << " is out of the allowed range (-15..15) dB"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   298
                                   << " for A3 Offset");
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   299
    }
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   300
10413
3ea02a8923ff fixed Bug 1793 - Various errors by MacOS compiler
Nicola Baldo <nbaldo@cttc.es>
parents: 10406
diff changeset
   301
  int8_t ieValue = lround (a3OffsetDb * 2.0);
3ea02a8923ff fixed Bug 1793 - Various errors by MacOS compiler
Nicola Baldo <nbaldo@cttc.es>
parents: 10406
diff changeset
   302
  NS_ASSERT (ieValue >= -30);
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   303
  NS_ASSERT (ieValue <= 30);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   304
  return ieValue;
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   305
}
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   306
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   307
double
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   308
EutranMeasurementMapping::IeValue2ActualQRxLevMin (int8_t qRxLevMinIeValue)
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   309
{
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   310
  if ((qRxLevMinIeValue < -70) || (qRxLevMinIeValue > -22))
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   311
    {
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   312
      NS_FATAL_ERROR ("The value " << (int16_t) qRxLevMinIeValue
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   313
                                   << " is out of the allowed range (-70..-22)"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   314
                                   << " for Q-RxLevMin IE value");
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   315
    }
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   316
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   317
  double actual = static_cast<double> (qRxLevMinIeValue) * 2;
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   318
  NS_ASSERT (actual >= -140.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   319
  NS_ASSERT (actual <= -44.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   320
  return actual;
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   321
}
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   322
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   323
double
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   324
EutranMeasurementMapping::IeValue2ActualQQualMin (int8_t qQualMinIeValue)
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   325
{
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   326
  if ((qQualMinIeValue < -34) || (qQualMinIeValue > -3))
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   327
    {
10326
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   328
      NS_FATAL_ERROR ("The value " << (int16_t) qQualMinIeValue
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   329
                                   << " is out of the allowed range (-34..-3)"
fdc5819a6bca Additional conversion functions for Hysteresis and A3 Offset
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10305
diff changeset
   330
                                   << " for Q-QualMin IE value");
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   331
    }
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   332
10378
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   333
  double actual = static_cast<double> (qQualMinIeValue);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   334
  NS_ASSERT (actual >= -34.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   335
  NS_ASSERT (actual <= -3.0);
d54dbdb31bdb Added back asserts to EutranMeasurementMapping
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10373
diff changeset
   336
  return actual;
10300
792cecb6cf2d Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10271
diff changeset
   337
}
10271
6f6ffd9379b0 Changes based on peer review: typos in documentation, conversion functions for Hysteresis and a3-Offset, separated constructor implementation of ReportConfigEutra, and removed dead code in LteUeRrc.
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10018
diff changeset
   338
7938
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
   339
}; // namespace ns3
7c5f7e3b4054 add new file for lte common stuff
mrequena
parents:
diff changeset
   340