7938
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
|
2 |
/*
|
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License version 2 as
|
|
7 |
* published by the Free Software Foundation;
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program; if not, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
*
|
|
18 |
* Author: Manuel Requena <manuel.requena@cttc.es>
|
7947
|
19 |
* Author: Marco Miozzo <marco.miozzo@cttc.es>
|
7938
|
20 |
*/
|
|
21 |
|
|
22 |
#include "lte-common.h"
|
7947
|
23 |
#include <ns3/log.h>
|
7938
|
24 |
|
7947
|
25 |
NS_LOG_COMPONENT_DEFINE ("LteFfConverter");
|
7938
|
26 |
|
|
27 |
namespace ns3 {
|
|
28 |
|
|
29 |
|
|
30 |
lteFlowId_t::lteFlowId_t ()
|
|
31 |
{
|
|
32 |
}
|
|
33 |
|
|
34 |
lteFlowId_t::lteFlowId_t (const uint16_t a, const uint8_t b)
|
|
35 |
: m_rnti(a),
|
|
36 |
m_lcId(b)
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
bool
|
|
41 |
operator == (const lteFlowId_t &a, const lteFlowId_t &b)
|
|
42 |
{
|
|
43 |
return ( (a.m_rnti == b.m_rnti) && (a.m_lcId == b.m_lcId) );
|
|
44 |
}
|
|
45 |
|
|
46 |
bool
|
|
47 |
operator < (const lteFlowId_t& a, const lteFlowId_t& b)
|
|
48 |
{
|
|
49 |
return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_lcId < b.m_lcId) ) );
|
|
50 |
}
|
|
51 |
|
|
52 |
|
7947
|
53 |
uint16_t
|
|
54 |
LteFfConverter::double2fpS11dot3(double val)
|
|
55 |
{
|
|
56 |
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
|
|
57 |
int16_t valFp = (int16_t)(val * pow (2, 3));
|
|
58 |
return (valFp);
|
|
59 |
}
|
|
60 |
|
|
61 |
double
|
|
62 |
LteFfConverter::fpS11dot3toDouble(uint16_t val)
|
|
63 |
{
|
|
64 |
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
|
|
65 |
double valD = ((int16_t)val) / pow (2, 3);
|
|
66 |
return (valD);
|
|
67 |
}
|
|
68 |
|
|
69 |
double
|
|
70 |
LteFfConverter::getMinFpS11dot3Value ()
|
|
71 |
{
|
|
72 |
return (-4096); // -4096 = 0x8000 = 1000 0000 0000 0000 b
|
|
73 |
}
|
|
74 |
|
|
75 |
//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000)
|
|
76 |
|
|
77 |
|
|
78 |
|
7938
|
79 |
}; // namespace ns3
|
|
80 |
|