src/lte/model/lte-ue-phy.cc
author Marco Miozzo <marco.miozzo@cttc.es>
Fri, 23 Mar 2012 11:36:49 +0100
changeset 8715 736f0318fc8a
parent 8714 398bbcbb3f42
child 8720 d5a4b1c4d7c9
permissions -rw-r--r--
Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 6852
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     2
/*
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     3
 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     4
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     8
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    12
 * GNU General Public License for more details.
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    13
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    17
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    18
 * Author: Giuseppe Piro  <g.piro@poliba.it>
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    19
 *         Marco Miozzo <marco.miozzo@cttc.es>
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    20
 *         Nicola Baldo <nbaldo@cttc.es>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    21
 */
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    22
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    23
#include <ns3/object-factory.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    24
#include <ns3/log.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    25
#include <math.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    26
#include <ns3/simulator.h>
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
    27
#include <ns3/double.h>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    28
#include "lte-ue-phy.h"
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    29
#include "lte-enb-phy.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    30
#include "lte-net-device.h"
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    31
#include "lte-ue-net-device.h"
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    32
#include "lte-enb-net-device.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    33
#include "lte-spectrum-value-helper.h"
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    34
#include "lte-amc.h"
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    35
#include "lte-ue-mac.h"
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    36
#include "ff-mac-common.h"
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    37
#include "lte-sinr-chunk-processor.h"
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    38
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    39
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    40
NS_LOG_COMPONENT_DEFINE ("LteUePhy");
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    41
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    42
namespace ns3 {
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    43
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    44
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    45
// member SAP forwarders
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    46
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    47
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    48
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    49
class UeMemberLteUePhySapProvider : public LteUePhySapProvider
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    50
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    51
public:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    52
  UeMemberLteUePhySapProvider (LteUePhy* phy);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    53
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    54
  // inherited from LtePhySapProvider
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    55
  virtual void SendMacPdu (Ptr<Packet> p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    56
  virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    57
  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    58
  virtual void SetTransmissionMode (uint8_t txMode);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    59
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    60
private:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    61
  LteUePhy* m_phy;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    62
};
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    63
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    64
UeMemberLteUePhySapProvider::UeMemberLteUePhySapProvider (LteUePhy* phy) : m_phy (phy)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    65
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    66
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    67
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    68
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    69
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    70
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    71
UeMemberLteUePhySapProvider::SendMacPdu (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    72
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    73
  m_phy->DoSendMacPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    74
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    75
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    76
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    77
UeMemberLteUePhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    78
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    79
  m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    80
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    81
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    82
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    83
UeMemberLteUePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    84
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    85
  m_phy->DoSendIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    86
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    87
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    88
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    89
UeMemberLteUePhySapProvider::SetTransmissionMode (uint8_t   txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    90
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    91
  m_phy->DoSetTransmissionMode (txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    92
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    93
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    94
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    95
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    96
////////////////////////////////////////
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    97
// generic LteUePhy methods
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    98
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    99
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   100
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   101
NS_OBJECT_ENSURE_REGISTERED (LteUePhy);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   102
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   103
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   104
LteUePhy::LteUePhy ()
7980
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   105
{
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   106
  NS_LOG_FUNCTION (this);
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   107
  NS_FATAL_ERROR ("This constructor should not be called");
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   108
}
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   109
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   110
LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   111
  : LtePhy (dlPhy, ulPhy),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   112
    m_p10CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   113
    // ideal behavior
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   114
    m_p10CqiLast (MilliSeconds (0)),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   115
    m_a30CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   116
    // ideal behavior
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   117
    m_a30CqiLast (MilliSeconds (0))
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   118
{
8522
795ea37db2ff Change LteAmc* to Ptr<LteAmc> in LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8517
diff changeset
   119
  m_amc = CreateObject <LteAmc> ();
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   120
  m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   121
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   122
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   123
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   124
LteUePhy::~LteUePhy ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   125
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   126
  m_txModeGain.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   127
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   128
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   129
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   130
LteUePhy::DoDispose ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   131
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   132
  NS_LOG_FUNCTION (this);
7930
ccb40542ae88 fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   133
  delete m_uePhySapProvider;
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   134
  LtePhy::DoDispose ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   135
}
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   136
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   137
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   138
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   139
TypeId
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   140
LteUePhy::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   141
{
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   142
  static TypeId tid = TypeId ("ns3::LteUePhy")
6707
2ac68a0381ca improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   143
    .SetParent<LtePhy> ()
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   144
    .AddConstructor<LteUePhy> ()
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   145
    .AddAttribute ("TxPower",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   146
                   "Transmission power in dBm",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   147
                   DoubleValue (10.0),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   148
                   MakeDoubleAccessor (&LteUePhy::SetTxPower, 
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   149
                                       &LteUePhy::GetTxPower),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   150
                   MakeDoubleChecker<double> ())
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   151
    .AddAttribute ("NoiseFigure",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   152
                   "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   153
                   " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   154
                   "\"the difference in decibels (dB) between"
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   155
                   " the noise output of the actual receiver to the noise output of an "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   156
                   " ideal receiver with the same overall gain and bandwidth when the receivers "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   157
                   " are connected to sources at the standard noise temperature T0.\" "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   158
                   "In this model, we consider T0 = 290K.",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   159
                   DoubleValue (9.0),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   160
                   MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, 
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   161
                                       &LteUePhy::GetNoiseFigure),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   162
                   MakeDoubleChecker<double> ())
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   163
    .AddAttribute ("TxMode1Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   164
                  "Transmission mode 1 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   165
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   166
                   MakeDoubleAccessor (&LteUePhy::SetTxMode1Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   167
                  MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   168
    .AddAttribute ("TxMode2Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   169
                    "Transmission mode 2 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   170
                    DoubleValue (4.2),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   171
                   MakeDoubleAccessor (&LteUePhy::SetTxMode2Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   172
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   173
    .AddAttribute ("TxMode3Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   174
                    "Transmission mode 3 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   175
                    DoubleValue (-2.8),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   176
                   MakeDoubleAccessor (&LteUePhy::SetTxMode3Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   177
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   178
    .AddAttribute ("TxMode4Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   179
                    "Transmission mode 4 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   180
                    DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   181
                   MakeDoubleAccessor (&LteUePhy::SetTxMode4Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   182
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   183
    .AddAttribute ("TxMode5Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   184
                  "Transmission mode 5 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   185
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   186
                   MakeDoubleAccessor (&LteUePhy::SetTxMode5Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   187
                  MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   188
    .AddAttribute ("TxMode6Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   189
                    "Transmission mode 6 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   190
                    DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   191
                   MakeDoubleAccessor (&LteUePhy::SetTxMode6Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   192
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   193
    .AddAttribute ("TxMode7Gain",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   194
                  "Transmission mode 7 gain in dBm",
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   195
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   196
                   MakeDoubleAccessor (&LteUePhy::SetTxMode7Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   197
                  MakeDoubleChecker<double> ())
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   198
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   199
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   200
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   201
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   202
void
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   203
LteUePhy::DoStart ()
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   204
{
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   205
  NS_LOG_FUNCTION (this);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   206
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   207
  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   208
  LtePhy::DoStart ();
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   209
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   210
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   211
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   212
LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   213
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   214
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   215
  m_uePhySapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   216
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   217
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   218
LteUePhySapProvider*
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   219
LteUePhy::GetLteUePhySapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   220
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   221
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   222
  return (m_uePhySapProvider);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   223
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   224
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   225
void
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   226
LteUePhy::SetNoiseFigure (double nf)
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   227
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   228
  NS_LOG_FUNCTION (this << nf);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   229
  m_noiseFigure = nf;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   230
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   231
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   232
double
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   233
LteUePhy::GetNoiseFigure () const
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   234
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   235
  NS_LOG_FUNCTION (this);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   236
  return m_noiseFigure;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   237
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   238
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   239
void
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   240
LteUePhy::SetTxPower (double pow)
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   241
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   242
  NS_LOG_FUNCTION (this << pow);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   243
  m_txPower = pow;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   244
}
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   245
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   246
double
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   247
LteUePhy::GetTxPower () const
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   248
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   249
  NS_LOG_FUNCTION (this);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   250
  return m_txPower;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   251
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   252
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   253
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   254
LteUePhy::DoSendMacPdu (Ptr<Packet> p)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   255
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   256
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   257
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   258
  SetMacPdu (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   259
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   260
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   261
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   262
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   263
LteUePhy::PhyPduReceived (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   264
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   265
  m_uePhySapUser->ReceivePhyPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   266
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   267
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   268
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   269
LteUePhy::DoSetUplinkSubChannels ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   270
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   271
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   272
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   273
  /*
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   274
   *  XXX: the uplink scheduler is not implemented yet!
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   275
   *  Now, all uplink sub channels can be used for uplink transmission
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   276
   */
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   277
  SetSubChannelsForTransmission (GetUplinkSubChannels ());
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   278
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   279
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   280
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   281
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   282
LteUePhy::SetSubChannelsForTransmission (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   283
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   284
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   285
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   286
  m_subChannelsForTransmission = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   287
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   288
  Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
7928
b736f63e9bdf removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents: 7913
diff changeset
   289
  m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   290
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   291
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   292
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   293
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   294
LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   295
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   296
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   297
  m_subChannelsForReception = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   298
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   299
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   300
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   301
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   302
LteUePhy::GetSubChannelsForTransmission ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   303
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   304
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   305
  return m_subChannelsForTransmission;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   306
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   307
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   308
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   309
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   310
LteUePhy::GetSubChannelsForReception ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   311
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   312
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   313
  return m_subChannelsForReception;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   314
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   315
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   316
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   317
Ptr<SpectrumValue>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   318
LteUePhy::CreateTxPowerSpectralDensity ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   319
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   320
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   321
  LteSpectrumValueHelper psdHelper;
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   322
  Ptr<SpectrumValue> psd = psdHelper.CreateTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   323
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   324
  return psd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   325
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   326
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   327
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   328
LteUePhy::GenerateCqiFeedback (const SpectrumValue& sinr)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   329
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   330
  NS_LOG_FUNCTION (this);
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   331
  // check periodic wideband CQI
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   332
  if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   333
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   334
      Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   335
      Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   336
      DoSendIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   337
      m_p10CqiLast = Simulator::Now ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   338
    }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   339
  // check aperiodic high-layer configured subband CQI
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   340
  if  (Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   341
    {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   342
      Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   343
      Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   344
      DoSendIdealControlMessage (msg);
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   345
      m_a30CqiLast = Simulator::Now ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   346
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   347
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   348
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   349
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   350
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   351
Ptr<DlCqiIdealControlMessage>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   352
LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   353
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   354
  NS_LOG_FUNCTION (this);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   355
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   356
  // apply transmission mode gain
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   357
  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   358
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   359
  SpectrumValue newSinr = sinr;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   360
  newSinr *= m_txModeGain.at (m_transmissionMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   361
  std::vector<int> cqi = m_amc->CreateCqiFeedbacks (newSinr);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   362
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   363
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   364
8170
5be3dcd75840 removed unused CqiIdealControlMessage and UlCqiIdealControlMessage
Nicola Baldo <nbaldo@cttc.es>
parents: 8148
diff changeset
   365
  // CREATE DlCqiIdealControlMessage
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   366
  Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   367
  CqiListElement_s dlcqi;
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   368
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   369
  if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   370
    {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   371
      int nLayer = TransmissionModesLayers::TxMode2LayerNum (m_transmissionMode);
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   372
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   373
      double cqiSum = 0.0;
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   374
      int activeSubChannels = 0;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   375
      // average the CQIs of the different RBs
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   376
      for (int i = 0; i < nbSubChannels; i++)
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   377
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   378
          if (cqi.at (i) != -1)
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   379
            {
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   380
              cqiSum += cqi.at (i);
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   381
              activeSubChannels++;
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   382
            }
8042
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   383
          NS_LOG_DEBUG (this << " subch " << i << " cqi " <<  cqi.at (i));
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   384
        }
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   385
      dlcqi.m_rnti = m_rnti;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   386
      dlcqi.m_ri = 1; // not yet used
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   387
      dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   388
      NS_ASSERT_MSG (nLayer > 0, " nLayer negative");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   389
      NS_ASSERT_MSG (nLayer < 3, " nLayer limit is 2s");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   390
      for (int i = 0; i < nLayer; i++)
8042
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   391
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   392
          if (activeSubChannels > 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   393
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   394
              dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   395
            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   396
          else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   397
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   398
              // approximate with the worst case -> CQI = 1
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   399
              dlcqi.m_wbCqi.push_back (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   400
            }
8042
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   401
        }
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   402
      //NS_LOG_DEBUG (this << " Generate P10 CQI feedback " << (uint16_t) cqiSum / activeSubChannels);
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   403
      dlcqi.m_wbPmi = 0; // not yet used
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   404
      // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   405
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   406
  else if (Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   407
    {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   408
      int nLayer = TransmissionModesLayers::TxMode2LayerNum (m_transmissionMode);
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   409
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   410
      int rbgSize = GetRbgSize ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   411
      double cqiSum = 0.0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   412
      int cqiNum = 0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   413
      SbMeasResult_s rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   414
      //NS_LOG_DEBUG (this << " Create A30 CQI feedback, RBG " << rbgSize << " cqiNum " << nbSubChannels << " band "  << (uint16_t)m_dlBandwidth);
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   415
      for (int i = 0; i < nbSubChannels; i++)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   416
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   417
          if (cqi.at (i) != -1)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   418
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   419
              cqiSum += cqi.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   420
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   421
          // else "nothing" no CQI is treated as CQI = 0 (worst case scenario)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   422
          cqiNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   423
          if (cqiNum == rbgSize)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   424
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   425
              // average the CQIs of the different RBGs
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   426
              //NS_LOG_DEBUG (this << " RBG CQI "  << (uint16_t) cqiSum / rbgSize);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   427
              HigherLayerSelected_s hlCqi;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   428
              hlCqi.m_sbPmi = 0; // not yet used
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   429
              for (int i = 0; i < nLayer; i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   430
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   431
                  hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   432
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   433
              rbgMeas.m_higherLayerSelected.push_back (hlCqi);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   434
              cqiSum = 0.0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   435
              cqiNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   436
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   437
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   438
      dlcqi.m_rnti = m_rnti;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   439
      dlcqi.m_ri = 1; // not yet used
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   440
      dlcqi.m_cqiType = CqiListElement_s::A30; // Aperidic CQI using PUSCH
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   441
      //dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / nbSubChannels);
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   442
      dlcqi.m_wbPmi = 0; // not yet used
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   443
      dlcqi.m_sbMeasResult = rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   444
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   445
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   446
  msg->SetDlCqi (dlcqi);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   447
  return msg;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   448
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   449
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   450
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   451
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   452
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   453
LteUePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   454
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   455
  NS_LOG_FUNCTION (this << msg);
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   456
  Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   457
  Ptr<LteEnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   458
  msg->SetSourceDevice (thisDevice);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   459
  msg->SetDestinationDevice (remoteDevice);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   460
  SetControlMessages (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   461
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   462
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   463
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   464
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   465
LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   466
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   467
  NS_LOG_FUNCTION (this << msg);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   468
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   469
  if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   470
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   471
      Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   472
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   473
      DlDciListElement_s dci = msg2->GetDci ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   474
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   475
      if (dci.m_resAlloc != 0)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   476
        {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   477
          NS_FATAL_ERROR ("Resource Allocation type not implemented");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   478
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   479
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   480
      std::vector <int> dlRb;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   481
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   482
      // translate the DCI to Spectrum framework
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   483
      uint32_t mask = 0x1;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   484
      for (int i = 0; i < 32; i++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   485
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   486
          if (((dci.m_rbBitmap & mask) >> i) == 1)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   487
            {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   488
              for (int k = 0; k < GetRbgSize (); k++)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   489
                {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   490
                  dlRb.push_back ((i * GetRbgSize ()) + k);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   491
                  //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   492
                }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   493
            }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   494
          mask = (mask << 1);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   495
        }
8511
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8253
diff changeset
   496
      
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8253
diff changeset
   497
      // send TB info to LteSpectrumPhy
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   498
      NS_LOG_DEBUG (this << " UE " << m_rnti << " DCI " << dci.m_rnti << " bitmap "  << dci.m_rbBitmap);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   499
      for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   500
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   501
          m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   502
        }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   503
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   504
      SetSubChannelsForReception (dlRb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   505
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   506
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   507
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   508
  else if (msg->GetMessageType () == IdealControlMessage::UL_DCI) 
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   509
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   510
      // set the uplink bandwidht according to the UL-CQI
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   511
      Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   512
      UlDciListElement_s dci = msg2->GetDci ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   513
      std::vector <int> ulRb;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   514
      for (int i = 0; i < dci.m_rbLen; i++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   515
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   516
          ulRb.push_back (i + dci.m_rbStart);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   517
          //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   518
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   519
      SetSubChannelsForTransmission (ulRb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   520
      // pass the info to the MAC
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   521
      m_uePhySapUser->ReceiveIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   522
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   523
  else
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   524
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   525
      // pass the message to UE-MAC
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   526
      m_uePhySapUser->ReceiveIdealControlMessage (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   527
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   528
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   529
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   530
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   531
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   532
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   533
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   534
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   535
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   536
  // trigger from eNB
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   537
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   538
  // send control messages
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   539
  std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   540
  if (ctrlMsg.size () > 0)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   541
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   542
      Ptr<LtePhy> phy = GetDevice ()->GetObject<LteUeNetDevice> ()->GetTargetEnb ()->GetPhy ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   543
      std::list<Ptr<IdealControlMessage> >::iterator it;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   544
      it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   545
      while (it != ctrlMsg.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   546
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   547
          Ptr<IdealControlMessage> msg = (*it);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   548
          phy->ReceiveIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   549
          ctrlMsg.pop_front ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   550
          it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   551
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   552
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   553
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   554
  // send packets in queue
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   555
  // send the current burts of packets
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   556
  Ptr<PacketBurst> pb = GetPacketBurst ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   557
  if (pb)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   558
    {
8506
f9616c9094a5 integrated AntennaModel with LTE, including system test
Nicola Baldo <nbaldo@cttc.es>
parents: 8415
diff changeset
   559
      NS_LOG_LOGIC (this << " start TX");
7928
b736f63e9bdf removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents: 7913
diff changeset
   560
      m_uplinkSpectrumPhy->StartTx (pb);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   561
    }
8415
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   562
    
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   563
  // trigger the MAC
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   564
  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   565
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   566
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   567
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   568
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   569
void
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   570
LteUePhy::SetEnbCellId (uint16_t cellId)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   571
{
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   572
  m_enbCellId = cellId;
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   573
  m_downlinkSpectrumPhy->SetCellId (cellId);
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   574
  m_uplinkSpectrumPhy->SetCellId (cellId);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   575
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   576
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   577
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   578
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   579
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   580
LteUePhy::SetRnti (uint16_t rnti)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   581
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   582
  NS_LOG_FUNCTION (this << rnti);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   583
  m_rnti = rnti;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   584
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   585
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   586
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   587
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   588
LteUePhy::DoSetTransmissionMode (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   589
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   590
  NS_LOG_FUNCTION (this << (uint16_t)txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   591
  m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   592
  m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   593
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   594
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   595
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   596
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   597
LteUePhy::SetTxMode1Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   598
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   599
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   600
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   601
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   602
  if (m_txModeGain.size () < 1)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   603
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   604
    m_txModeGain.resize (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   605
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   606
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   607
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   608
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   609
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   610
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   611
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   612
    if (i==0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   613
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   614
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   615
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   616
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   617
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   618
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   619
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   620
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   621
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   622
  m_downlinkSpectrumPhy->SetTxMode1Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   623
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   624
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   625
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   626
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   627
LteUePhy::SetTxMode2Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   628
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   629
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   630
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   631
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   632
  if (m_txModeGain.size () < 2)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   633
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   634
    m_txModeGain.resize (2);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   635
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   636
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   637
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   638
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   639
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   640
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   641
    if (i==1)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   642
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   643
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   644
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   645
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   646
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   647
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   648
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   649
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   650
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   651
  m_downlinkSpectrumPhy->SetTxMode2Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   652
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   653
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   654
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   655
LteUePhy::SetTxMode3Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   656
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   657
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   658
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   659
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   660
  if (m_txModeGain.size () < 3)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   661
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   662
    m_txModeGain.resize (3);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   663
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   664
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   665
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   666
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   667
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   668
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   669
    if (i==2)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   670
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   671
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   672
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   673
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   674
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   675
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   676
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   677
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   678
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   679
  m_downlinkSpectrumPhy->SetTxMode3Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   680
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   681
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   682
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   683
LteUePhy::SetTxMode4Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   684
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   685
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   686
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   687
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   688
  if (m_txModeGain.size () < 4)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   689
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   690
    m_txModeGain.resize (4);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   691
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   692
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   693
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   694
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   695
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   696
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   697
    if (i==3)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   698
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   699
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   700
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   701
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   702
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   703
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   704
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   705
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   706
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   707
  m_downlinkSpectrumPhy->SetTxMode4Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   708
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   709
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   710
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   711
LteUePhy::SetTxMode5Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   712
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   713
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   714
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   715
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   716
  if (m_txModeGain.size () < 5)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   717
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   718
    m_txModeGain.resize (5);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   719
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   720
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   721
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   722
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   723
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   724
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   725
    if (i==4)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   726
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   727
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   728
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   729
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   730
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   731
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   732
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   733
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   734
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   735
  m_downlinkSpectrumPhy->SetTxMode5Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   736
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   737
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   738
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   739
LteUePhy::SetTxMode6Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   740
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   741
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   742
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   743
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   744
  if (m_txModeGain.size () < 6)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   745
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   746
    m_txModeGain.resize (6);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   747
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   748
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   749
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   750
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   751
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   752
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   753
    if (i==5)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   754
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   755
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   756
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   757
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   758
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   759
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   760
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   761
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   762
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   763
  m_downlinkSpectrumPhy->SetTxMode6Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   764
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   765
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   766
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   767
LteUePhy::SetTxMode7Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   768
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   769
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   770
  // convert to linear
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   771
  double gainLin = pow (10.0, (gain / 10.0));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   772
  if (m_txModeGain.size () < 7)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   773
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   774
    m_txModeGain.resize (7);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   775
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   776
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   777
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   778
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   779
  for (uint8_t i = 0; i < temp.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   780
  {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   781
    if (i==6)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   782
    {
8715
736f0318fc8a Bug-fix tx mode gain exchange from LteUePhy and LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8714
diff changeset
   783
      m_txModeGain.push_back (gainLin);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   784
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   785
    else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   786
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   787
      m_txModeGain.push_back (temp.at (i));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   788
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   789
  }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   790
  // forward the info to DL LteSpectrumPhy
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   791
  m_downlinkSpectrumPhy->SetTxMode7Gain (gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   792
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   793
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   794
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   795
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   796
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   797
} // namespace ns3