src/lte/model/lte-ue-phy.cc
author Nicola Baldo <nbaldo@cttc.es>
Mon, 05 Mar 2012 15:52:14 +0100
changeset 8664 ab4c821fc251
parent 8647 f6fad6b36154
child 8670 8f63d16fb2e8
permissions -rw-r--r--
revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
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);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    58
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    59
private:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    60
  LteUePhy* m_phy;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    61
};
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    62
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    63
UeMemberLteUePhySapProvider::UeMemberLteUePhySapProvider (LteUePhy* phy) : m_phy (phy)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    64
{
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
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    70
UeMemberLteUePhySapProvider::SendMacPdu (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    71
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    72
  m_phy->DoSendMacPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    73
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    74
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    75
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    76
UeMemberLteUePhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    77
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    78
  m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    79
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    80
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    81
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    82
UeMemberLteUePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    83
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    84
  m_phy->DoSendIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    85
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    86
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    87
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    88
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    89
////////////////////////////////////////
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    90
// generic LteUePhy methods
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    91
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    92
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    93
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    94
NS_OBJECT_ENSURE_REGISTERED (LteUePhy);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    95
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    96
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    97
LteUePhy::LteUePhy ()
7980
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
    98
{
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
    99
  NS_LOG_FUNCTION (this);
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   100
  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
   101
}
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   102
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   103
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
   104
  : LtePhy (dlPhy, ulPhy),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   105
    m_p10CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   106
    // ideal behavior
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   107
    m_p10CqiLast (MilliSeconds (0)),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   108
    m_a30CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   109
    // ideal behavior
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   110
    m_a30CqiLast (MilliSeconds (0))
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   111
{
8522
795ea37db2ff Change LteAmc* to Ptr<LteAmc> in LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8517
diff changeset
   112
  m_amc = CreateObject <LteAmc> ();
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   113
  m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   114
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   115
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   116
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   117
LteUePhy::~LteUePhy ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   118
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   119
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   120
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   121
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   122
LteUePhy::DoDispose ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   123
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   124
  NS_LOG_FUNCTION (this);
7930
ccb40542ae88 fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   125
  delete m_uePhySapProvider;
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   126
  LtePhy::DoDispose ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   127
}
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   128
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   129
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   130
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   131
TypeId
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   132
LteUePhy::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   133
{
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   134
  static TypeId tid = TypeId ("ns3::LteUePhy")
6707
2ac68a0381ca improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   135
    .SetParent<LtePhy> ()
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   136
    .AddConstructor<LteUePhy> ()
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   137
    .AddAttribute ("TxPower",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   138
                   "Transmission power in dBm",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   139
                   DoubleValue (10.0),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   140
                   MakeDoubleAccessor (&LteUePhy::SetTxPower, 
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   141
                                       &LteUePhy::GetTxPower),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   142
                   MakeDoubleChecker<double> ())
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   143
    .AddAttribute ("NoiseFigure",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   144
                   "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
   145
                   " 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
   146
                   "\"the difference in decibels (dB) between"
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   147
                   " 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
   148
                   " 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
   149
                   " are connected to sources at the standard noise temperature T0.\" "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   150
                   "In this model, we consider T0 = 290K.",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   151
                   DoubleValue (9.0),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   152
                   MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, 
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   153
                                       &LteUePhy::GetNoiseFigure),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   154
                   MakeDoubleChecker<double> ())
8664
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   155
    .AddAttribute ("MacToChannelDelay",
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   156
                   "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.",
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   157
                   UintegerValue (1),
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   158
                   MakeUintegerAccessor (&LteUePhy::m_macChTtiDelay),
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   159
                   MakeUintegerChecker<uint8_t> (1,255))
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   160
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   161
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   162
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   163
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   164
void
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   165
LteUePhy::DoStart ()
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   166
{
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   167
  NS_LOG_FUNCTION (this);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   168
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   169
  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   170
  LtePhy::DoStart ();
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   171
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   172
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   173
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   174
LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   175
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   176
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   177
  m_uePhySapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   178
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   179
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   180
LteUePhySapProvider*
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   181
LteUePhy::GetLteUePhySapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   182
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   183
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   184
  return (m_uePhySapProvider);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   185
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   186
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   187
void
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   188
LteUePhy::SetNoiseFigure (double nf)
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   189
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   190
  NS_LOG_FUNCTION (this << nf);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   191
  m_noiseFigure = nf;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   192
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   193
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   194
double
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   195
LteUePhy::GetNoiseFigure () const
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   196
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   197
  NS_LOG_FUNCTION (this);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   198
  return m_noiseFigure;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   199
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   200
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   201
void
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   202
LteUePhy::SetTxPower (double pow)
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   203
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   204
  NS_LOG_FUNCTION (this << pow);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   205
  m_txPower = pow;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   206
}
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   207
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   208
double
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   209
LteUePhy::GetTxPower () const
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   210
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   211
  NS_LOG_FUNCTION (this);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   212
  return m_txPower;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   213
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   214
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   215
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   216
LteUePhy::DoSendMacPdu (Ptr<Packet> p)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   217
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   218
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   219
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   220
  SetMacPdu (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   221
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   222
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
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   225
LteUePhy::PhyPduReceived (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   226
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   227
  m_uePhySapUser->ReceivePhyPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   228
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   229
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   230
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   231
LteUePhy::DoSetUplinkSubChannels ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   232
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   233
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   234
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   235
  /*
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   236
   *  XXX: the uplink scheduler is not implemented yet!
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   237
   *  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
   238
   */
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   239
  SetSubChannelsForTransmission (GetUplinkSubChannels ());
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   240
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   241
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   242
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   243
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   244
LteUePhy::SetSubChannelsForTransmission (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   245
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   246
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   247
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   248
  m_subChannelsForTransmission = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   249
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   250
  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
   251
  m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   252
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   253
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   254
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   255
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   256
LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   257
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   258
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   259
  m_subChannelsForReception = mask;
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   263
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   264
LteUePhy::GetSubChannelsForTransmission ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   265
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   266
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   267
  return m_subChannelsForTransmission;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   268
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   269
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
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   272
LteUePhy::GetSubChannelsForReception ()
6705
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
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   275
  return m_subChannelsForReception;
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
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
Ptr<SpectrumValue>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   280
LteUePhy::CreateTxPowerSpectralDensity ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   281
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   282
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   283
  LteSpectrumValueHelper psdHelper;
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   284
  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
   285
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   286
  return psd;
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   289
void
8664
ab4c821fc251 revision after Giuseppe's comments http://codereview.appspot.com/4626069/#msg1
Nicola Baldo <nbaldo@cttc.es>
parents: 8647
diff changeset
   290
LteUePhy::GenerateCqiReport (const SpectrumValue& sinr)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   291
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   292
  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
   293
  // check periodic wideband CQI
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   294
  if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   295
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   296
      Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   297
      Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   298
      DoSendIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   299
      m_p10CqiLast = Simulator::Now ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   300
    }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   301
  // 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
   302
  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
   303
    {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   304
      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
   305
      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
   306
      DoSendIdealControlMessage (msg);
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   307
      m_a30CqiLast = Simulator::Now ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   308
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   309
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   310
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   311
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   312
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   313
Ptr<DlCqiIdealControlMessage>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   314
LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
6705
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
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   317
8170
5be3dcd75840 removed unused CqiIdealControlMessage and UlCqiIdealControlMessage
Nicola Baldo <nbaldo@cttc.es>
parents: 8148
diff changeset
   318
  // CREATE DlCqiIdealControlMessage
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   319
  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
   320
  CqiListElement_s dlcqi;
8647
f6fad6b36154 Update LteUePhy for generating wideband and subband CQIs with LteAmc::MiErrorModel
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8646
diff changeset
   321
  std::vector<int> cqi;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   322
  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
   323
    {
8647
f6fad6b36154 Update LteUePhy for generating wideband and subband CQIs with LteAmc::MiErrorModel
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8646
diff changeset
   324
      cqi = m_amc->CreateCqiFeedbacks (sinr, m_dlBandwidth);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   325
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   326
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   327
      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
   328
      int activeSubChannels = 0;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   329
      // 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
   330
      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
   331
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   332
          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
   333
            {
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   334
              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
   335
              activeSubChannels++;
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   336
            }
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
   337
          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
   338
        }
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   339
      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
   340
      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
   341
      dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   342
      if (activeSubChannels > 0)
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
   343
        {
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   344
          dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   345
        }
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   346
      else
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   347
        {
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   348
          // approximate with the worst case -> CQI = 1
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   349
          dlcqi.m_wbCqi.push_back (1);
874d9e7e652b LteUePhy::CreateDlCqiFeedbackMessage fix bug on computation of CQI (no control on activeSubChannels!=0)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8022
diff changeset
   350
        }
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   351
      //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
   352
      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
   353
      // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   354
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   355
  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
   356
    {
8647
f6fad6b36154 Update LteUePhy for generating wideband and subband CQIs with LteAmc::MiErrorModel
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8646
diff changeset
   357
      cqi = m_amc->CreateCqiFeedbacks (sinr, GetRbgSize ());
f6fad6b36154 Update LteUePhy for generating wideband and subband CQIs with LteAmc::MiErrorModel
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8646
diff changeset
   358
      int nbSubChannels = m_dlBandwidth;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   359
      int rbgSize = GetRbgSize ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   360
      double cqiSum = 0.0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   361
      int cqiNum = 0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   362
      SbMeasResult_s rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   363
      //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
   364
      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
   365
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   366
          if (cqi.at (i) != -1)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   367
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   368
              cqiSum += cqi.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   369
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   370
          // 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
   371
          cqiNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   372
          if (cqiNum == rbgSize)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   373
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   374
              // average the CQIs of the different RBGs
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   375
              //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
   376
              HigherLayerSelected_s hlCqi;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   377
              hlCqi.m_sbPmi = 0; // not yet used
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   378
              hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize); // only CW0 (SISO mode)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   379
              rbgMeas.m_higherLayerSelected.push_back (hlCqi);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   380
              cqiSum = 0.0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   381
              cqiNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   382
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   383
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   384
      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
   385
      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
   386
      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
   387
      //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
   388
      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
   389
      dlcqi.m_sbMeasResult = rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   390
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   391
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   392
  msg->SetDlCqi (dlcqi);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   393
  return msg;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   394
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   395
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   396
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   397
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   398
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   399
LteUePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   400
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   401
  NS_LOG_FUNCTION (this << msg);
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   402
  Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   403
  Ptr<LteEnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   404
  msg->SetSourceDevice (thisDevice);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   405
  msg->SetDestinationDevice (remoteDevice);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   406
  SetControlMessages (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   407
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   408
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   409
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   410
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   411
LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   412
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   413
  NS_LOG_FUNCTION (this << msg);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   414
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   415
  if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   416
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   417
      Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   418
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   419
      DlDciListElement_s dci = msg2->GetDci ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   420
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   421
      if (dci.m_resAlloc != 0)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   422
        {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   423
          NS_FATAL_ERROR ("Resource Allocation type not implemented");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   424
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   425
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   426
      std::vector <int> dlRb;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   427
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   428
      // translate the DCI to Spectrum framework
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   429
      uint32_t mask = 0x1;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   430
      for (int i = 0; i < 32; i++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   431
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   432
          if (((dci.m_rbBitmap & mask) >> i) == 1)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   433
            {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   434
              for (int k = 0; k < GetRbgSize (); k++)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   435
                {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   436
                  dlRb.push_back ((i * GetRbgSize ()) + k);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   437
                  //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
   438
                }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   439
            }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   440
          mask = (mask << 1);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   441
        }
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
   442
      
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8253
diff changeset
   443
      // send TB info to LteSpectrumPhy
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   444
      NS_LOG_DEBUG (this << " UE " << m_rnti << " DCI " << dci.m_rnti << " bimap "  << dci.m_rbBitmap);
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
   445
      m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (0), dci.m_mcs.at (0), dlRb);  // SISO mode
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   446
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   447
      SetSubChannelsForReception (dlRb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   448
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   449
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   450
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   451
  else if (msg->GetMessageType () == IdealControlMessage::UL_DCI) 
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   452
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   453
      // set the uplink bandwidht according to the UL-CQI
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   454
      Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   455
      UlDciListElement_s dci = msg2->GetDci ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   456
      std::vector <int> ulRb;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   457
      for (int i = 0; i < dci.m_rbLen; i++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   458
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   459
          ulRb.push_back (i + dci.m_rbStart);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   460
          //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   461
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   462
      SetSubChannelsForTransmission (ulRb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   463
      // pass the info to the MAC
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   464
      m_uePhySapUser->ReceiveIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   465
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   466
  else
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   467
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   468
      // pass the message to UE-MAC
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   469
      m_uePhySapUser->ReceiveIdealControlMessage (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   470
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   471
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   472
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   473
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   474
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   475
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   476
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   477
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   478
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   479
  // trigger from eNB
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   480
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   481
  // send control messages
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   482
  std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   483
  if (ctrlMsg.size () > 0)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   484
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   485
      Ptr<LtePhy> phy = GetDevice ()->GetObject<LteUeNetDevice> ()->GetTargetEnb ()->GetPhy ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   486
      std::list<Ptr<IdealControlMessage> >::iterator it;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   487
      it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   488
      while (it != ctrlMsg.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   489
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   490
          Ptr<IdealControlMessage> msg = (*it);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   491
          phy->ReceiveIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   492
          ctrlMsg.pop_front ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   493
          it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   494
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   495
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   496
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   497
  // send packets in queue
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   498
  // send the current burts of packets
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   499
  Ptr<PacketBurst> pb = GetPacketBurst ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   500
  if (pb)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   501
    {
8506
f9616c9094a5 integrated AntennaModel with LTE, including system test
Nicola Baldo <nbaldo@cttc.es>
parents: 8415
diff changeset
   502
      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
   503
      m_uplinkSpectrumPhy->StartTx (pb);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   504
    }
8415
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   505
    
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   506
  // trigger the MAC
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   507
  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   508
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   509
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   510
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   511
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   512
void
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   513
LteUePhy::SetEnbCellId (uint16_t cellId)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   514
{
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   515
  m_enbCellId = cellId;
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   516
  m_downlinkSpectrumPhy->SetCellId (cellId);
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   517
  m_uplinkSpectrumPhy->SetCellId (cellId);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   518
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   519
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   520
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   521
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   522
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   523
LteUePhy::SetRnti (uint16_t rnti)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   524
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   525
  NS_LOG_FUNCTION (this << rnti);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   526
  m_rnti = rnti;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   527
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   528
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   529
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   530
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   531
} // namespace ns3