src/lte/model/lte-ue-phy.cc
author Nicola Baldo <nbaldo@cttc.es>
Tue, 20 Nov 2012 18:18:01 +0100
changeset 9413 20f1c6678ee2
parent 9406 7f0f9d8f8e20
child 9414 7b0db3dbf19b
permissions -rw-r--r--
improved LTE Random Access model
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"
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
    38
#include <ns3/lte-common.h>
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    39
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    40
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    41
NS_LOG_COMPONENT_DEFINE ("LteUePhy");
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    42
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    43
namespace ns3 {
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    44
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    45
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    46
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    47
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    48
// duration of data portion of UL subframe
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    49
// = TTI - 1 symbol for SRS - 1ns as margin to avoid overlapping simulator events
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    50
// (symbol duration in nanoseconds = TTI / 14 (rounded))
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    51
// in other words, duration of data portion of UL subframe = TTI*(13/14) -1ns
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    52
static const Time UL_DATA_DURATION = NanoSeconds (1e6 - 71429 - 1); 
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    53
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    54
// delay from subframe start to transmission of SRS 
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    55
// = TTI - 1 symbol for SRS 
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    56
static const Time UL_SRS_DELAY_FROM_SUBFRAME_START = NanoSeconds (1e6 - 71429); 
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    57
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    58
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    59
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
    60
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
// member SAP forwarders
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    63
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    64
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    65
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    66
class UeMemberLteUePhySapProvider : public LteUePhySapProvider
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    67
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    68
public:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    69
  UeMemberLteUePhySapProvider (LteUePhy* phy);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    70
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    71
  // inherited from LtePhySapProvider
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    72
  virtual void SendMacPdu (Ptr<Packet> p);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
    73
  virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
    74
  virtual void SendRachPreamble (uint32_t prachId);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    75
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    76
private:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    77
  LteUePhy* m_phy;
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
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    80
UeMemberLteUePhySapProvider::UeMemberLteUePhySapProvider (LteUePhy* phy) : m_phy (phy)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    81
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    82
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    83
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    84
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    85
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    86
UeMemberLteUePhySapProvider::SendMacPdu (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    87
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    88
  m_phy->DoSendMacPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    89
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    90
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    91
void
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
    92
UeMemberLteUePhySapProvider::SendLteControlMessage (Ptr<LteControlMessage> msg)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    93
{
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
    94
  m_phy->DoSendLteControlMessage (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    95
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    96
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    97
void
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
    98
UeMemberLteUePhySapProvider::SendRachPreamble (uint32_t prachId)
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
    99
{
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   100
  m_phy->DoSendRachPreamble (prachId);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   101
}
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   102
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   103
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   104
////////////////////////////////////////
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   105
// LteUePhy methods
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   106
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   107
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   108
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   109
NS_OBJECT_ENSURE_REGISTERED (LteUePhy);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   110
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   111
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   112
LteUePhy::LteUePhy ()
7980
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   113
{
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   114
  NS_LOG_FUNCTION (this);
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   115
  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
   116
}
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   117
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7949
diff changeset
   118
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
   119
  : LtePhy (dlPhy, ulPhy),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   120
    m_p10CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   121
    // ideal behavior
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   122
    m_p10CqiLast (MilliSeconds (0)),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   123
    m_a30CqiPeriocity (MilliSeconds (1)),
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   124
    // ideal behavior
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   125
    m_a30CqiLast (MilliSeconds (0)),
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   126
    m_uePhySapUser (0),
9346
00e674a0d567 merge lena-dev and lena-epc
Nicola Baldo <nbaldo@cttc.es>
parents: 9337 9053
diff changeset
   127
    m_ueCphySapUser (0),
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   128
    m_rnti (0),
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   129
    m_transmissionMode (0),
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   130
    m_srsPeriodicity (0),
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   131
    m_srsConfigured (false),
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   132
    m_dlConfigured (false),
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   133
    m_ulConfigured (false),
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   134
    m_addedToDlChannel (false)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   135
{
8522
795ea37db2ff Change LteAmc* to Ptr<LteAmc> in LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8517
diff changeset
   136
  m_amc = CreateObject <LteAmc> ();
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   137
  m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   138
  m_ueCphySapProvider = new MemberLteUeCphySapProvider<LteUePhy> (this);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   139
  m_macChTtiDelay = UL_PUSCH_TTIS_DELAY;
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   140
  for (int i = 0; i < m_macChTtiDelay; i++)
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   141
    {
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   142
      Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   143
      m_packetBurstQueue.push_back (pb);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   144
      std::list<Ptr<LteControlMessage> > l;
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   145
      m_controlMessagesQueue.push_back (l);
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   146
    }
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   147
  std::vector <int> ulRb;
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   148
  m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   149
9054
16f693a95855 added assert for correct scheduling of LteUePhy::SubframeIndication
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   150
  NS_ASSERT_MSG (Simulator::Now ().GetNanoSeconds () == 0,
16f693a95855 added assert for correct scheduling of LteUePhy::SubframeIndication
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   151
                 "Cannot create UE devices after simulation started");
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   152
  Simulator::ScheduleNow (&LteUePhy::SubframeIndication, this, 1, 1);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   153
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   154
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   155
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   156
LteUePhy::~LteUePhy ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   157
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   158
  m_txModeGain.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   159
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   160
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   161
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   162
LteUePhy::DoDispose ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   163
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   164
  NS_LOG_FUNCTION (this);
7930
ccb40542ae88 fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   165
  delete m_uePhySapProvider;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   166
  delete m_ueCphySapProvider;
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   167
  LtePhy::DoDispose ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   168
}
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   169
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   170
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   171
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   172
TypeId
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   173
LteUePhy::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   174
{
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   175
  static TypeId tid = TypeId ("ns3::LteUePhy")
6707
2ac68a0381ca improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   176
    .SetParent<LtePhy> ()
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   177
    .AddConstructor<LteUePhy> ()
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   178
    .AddAttribute ("TxPower",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   179
                   "Transmission power in dBm",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   180
                   DoubleValue (10.0),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   181
                   MakeDoubleAccessor (&LteUePhy::SetTxPower, 
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   182
                                       &LteUePhy::GetTxPower),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   183
                   MakeDoubleChecker<double> ())
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   184
    .AddAttribute ("NoiseFigure",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   185
                   "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
   186
                   " 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
   187
                   "\"the difference in decibels (dB) between"
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   188
                   " 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
   189
                   " 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
   190
                   " are connected to sources at the standard noise temperature T0.\" "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   191
                   "In this model, we consider T0 = 290K.",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   192
                   DoubleValue (9.0),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   193
                   MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, 
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   194
                                       &LteUePhy::GetNoiseFigure),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   195
                   MakeDoubleChecker<double> ())
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   196
    .AddAttribute ("TxMode1Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   197
                  "Transmission mode 1 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   198
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   199
                   MakeDoubleAccessor (&LteUePhy::SetTxMode1Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   200
                  MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   201
    .AddAttribute ("TxMode2Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   202
                    "Transmission mode 2 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   203
                    DoubleValue (4.2),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   204
                   MakeDoubleAccessor (&LteUePhy::SetTxMode2Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   205
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   206
    .AddAttribute ("TxMode3Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   207
                    "Transmission mode 3 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   208
                    DoubleValue (-2.8),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   209
                   MakeDoubleAccessor (&LteUePhy::SetTxMode3Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   210
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   211
    .AddAttribute ("TxMode4Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   212
                    "Transmission mode 4 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   213
                    DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   214
                   MakeDoubleAccessor (&LteUePhy::SetTxMode4Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   215
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   216
    .AddAttribute ("TxMode5Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   217
                  "Transmission mode 5 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   218
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   219
                   MakeDoubleAccessor (&LteUePhy::SetTxMode5Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   220
                  MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   221
    .AddAttribute ("TxMode6Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   222
                    "Transmission mode 6 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   223
                    DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   224
                   MakeDoubleAccessor (&LteUePhy::SetTxMode6Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   225
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   226
    .AddAttribute ("TxMode7Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   227
                  "Transmission mode 7 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   228
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   229
                   MakeDoubleAccessor (&LteUePhy::SetTxMode7Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   230
                  MakeDoubleChecker<double> ())
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   231
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   232
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   233
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   234
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   235
void
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   236
LteUePhy::DoStart ()
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   237
{
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   238
  NS_LOG_FUNCTION (this);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   239
  LtePhy::DoStart ();
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   240
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   241
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   242
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   243
LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   244
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   245
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   246
  m_uePhySapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   247
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   248
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   249
LteUePhySapProvider*
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   250
LteUePhy::GetLteUePhySapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   251
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   252
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   253
  return (m_uePhySapProvider);
6705
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
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   256
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   257
void
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   258
LteUePhy::SetLteUeCphySapUser (LteUeCphySapUser* s)
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   259
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   260
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   261
  m_ueCphySapUser = s;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   262
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   263
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   264
LteUeCphySapProvider*
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   265
LteUePhy::GetLteUeCphySapProvider ()
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   266
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   267
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   268
  return (m_ueCphySapProvider);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   269
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   270
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   271
void
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   272
LteUePhy::SetNoiseFigure (double nf)
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   273
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   274
  NS_LOG_FUNCTION (this << nf);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   275
  m_noiseFigure = nf;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   276
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   277
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   278
double
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   279
LteUePhy::GetNoiseFigure () const
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   280
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   281
  NS_LOG_FUNCTION (this);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   282
  return m_noiseFigure;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   283
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   284
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   285
void
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   286
LteUePhy::SetTxPower (double pow)
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   287
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   288
  NS_LOG_FUNCTION (this << pow);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   289
  m_txPower = pow;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   290
}
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   291
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   292
double
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   293
LteUePhy::GetTxPower () const
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   294
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   295
  NS_LOG_FUNCTION (this);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   296
  return m_txPower;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   297
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   298
8670
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   299
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   300
uint8_t
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   301
LteUePhy::GetMacChDelay (void) const
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   302
{
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   303
  return (m_macChTtiDelay);
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   304
}
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   305
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   306
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   307
LteUePhy::DoSendMacPdu (Ptr<Packet> p)
6705
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
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   310
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   311
  SetMacPdu (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   312
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   313
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
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   316
LteUePhy::PhyPduReceived (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   317
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   318
  m_uePhySapUser->ReceivePhyPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   319
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   320
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   321
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   322
LteUePhy::SetSubChannelsForTransmission (std::vector <int> mask)
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
  NS_LOG_FUNCTION (this);
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
  m_subChannelsForTransmission = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   327
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   328
  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
   329
  m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   330
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   331
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   332
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   333
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   334
LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   335
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   336
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   337
  m_subChannelsForReception = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   338
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   339
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   340
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   341
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   342
LteUePhy::GetSubChannelsForTransmission ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   343
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   344
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   345
  return m_subChannelsForTransmission;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   346
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   347
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   348
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   349
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   350
LteUePhy::GetSubChannelsForReception ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   351
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   352
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   353
  return m_subChannelsForReception;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   354
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   355
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   356
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   357
Ptr<SpectrumValue>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   358
LteUePhy::CreateTxPowerSpectralDensity ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   359
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   360
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   361
  LteSpectrumValueHelper psdHelper;
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   362
  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
   363
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   364
  return psd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   365
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   366
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   367
void
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   368
LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   369
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   370
  NS_LOG_FUNCTION (this);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   371
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   372
  if (!(m_dlConfigured && m_ulConfigured))
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   373
    {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   374
      return;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   375
    }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   376
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   377
  // check periodic wideband CQI
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   378
  if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   379
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   380
      Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   381
      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   382
      DoSendLteControlMessage (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   383
      m_p10CqiLast = Simulator::Now ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   384
    }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   385
  // 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
   386
  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
   387
    {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   388
      Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   389
      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   390
      DoSendLteControlMessage (msg);
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   391
      m_a30CqiLast = Simulator::Now ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   392
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   393
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   394
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   395
void
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   396
LteUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   397
{
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   398
  // Not used by UE, CQI are based only on RS
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   399
}
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   400
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   401
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   402
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   403
Ptr<DlCqiLteControlMessage>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   404
LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   405
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   406
  NS_LOG_FUNCTION (this);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   407
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   408
  // apply transmission mode gain
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   409
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   410
  SpectrumValue newSinr = sinr;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   411
  newSinr *= m_txModeGain.at (m_transmissionMode);
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   412
//   std::vector<int> cqi = m_amc->CreateCqiFeedbacks (newSinr);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   413
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   414
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   415
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   416
  // CREATE DlCqiLteControlMessage
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   417
  Ptr<DlCqiLteControlMessage> msg = Create<DlCqiLteControlMessage> ();
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   418
  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
   419
  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
   420
  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
   421
    {
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   422
      cqi = m_amc->CreateCqiFeedbacks (newSinr, m_dlBandwidth);
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   423
      
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   424
      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
   425
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   426
      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
   427
      int activeSubChannels = 0;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   428
      // 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
   429
      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
   430
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   431
          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
   432
            {
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   433
              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
   434
              activeSubChannels++;
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   435
            }
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
   436
          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
   437
        }
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::P10; // Peridic CQI using PUCCH wideband
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   441
      NS_ASSERT_MSG (nLayer > 0, " nLayer negative");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   442
      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
   443
      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
   444
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   445
          if (activeSubChannels > 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   446
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   447
              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
   448
            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   449
          else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   450
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   451
              // approximate with the worst case -> CQI = 1
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   452
              dlcqi.m_wbCqi.push_back (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   453
            }
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
   454
        }
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   455
      //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
   456
      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
   457
      // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   458
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   459
  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
   460
    {
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   461
      cqi = m_amc->CreateCqiFeedbacks (newSinr, GetRbgSize ());
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   462
      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
   463
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   464
      int rbgSize = GetRbgSize ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   465
      double cqiSum = 0.0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   466
      int cqiNum = 0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   467
      SbMeasResult_s rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   468
      //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
   469
      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
   470
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   471
          if (cqi.at (i) != -1)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   472
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   473
              cqiSum += cqi.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   474
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   475
          // 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
   476
          cqiNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   477
          if (cqiNum == rbgSize)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   478
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   479
              // average the CQIs of the different RBGs
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   480
              //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
   481
              HigherLayerSelected_s hlCqi;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   482
              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
   483
              for (int i = 0; i < nLayer; i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   484
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   485
                  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
   486
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   487
              rbgMeas.m_higherLayerSelected.push_back (hlCqi);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   488
              cqiSum = 0.0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   489
              cqiNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   490
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   491
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   492
      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
   493
      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
   494
      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
   495
      //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
   496
      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
   497
      dlcqi.m_sbMeasResult = rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   498
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   499
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   500
  msg->SetDlCqi (dlcqi);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   501
  return msg;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   502
}
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
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
void
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   507
LteUePhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   508
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   509
  NS_LOG_FUNCTION (this << msg);
9346
00e674a0d567 merge lena-dev and lena-epc
Nicola Baldo <nbaldo@cttc.es>
parents: 9337 9053
diff changeset
   510
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   511
  SetControlMessages (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   512
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   513
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   514
void 
9413
20f1c6678ee2 improved LTE Random Access model
Nicola Baldo <nbaldo@cttc.es>
parents: 9406
diff changeset
   515
LteUePhy::DoSendRachPreamble (uint32_t raPreambleId)
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   516
{
9413
20f1c6678ee2 improved LTE Random Access model
Nicola Baldo <nbaldo@cttc.es>
parents: 9406
diff changeset
   517
  NS_LOG_FUNCTION (this << raPreambleId);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   518
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   519
  // unlike other control messages, RACH preamble is sent ASAP
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   520
  Ptr<RachPreambleLteControlMessage> msg = Create<RachPreambleLteControlMessage> ();
9413
20f1c6678ee2 improved LTE Random Access model
Nicola Baldo <nbaldo@cttc.es>
parents: 9406
diff changeset
   521
  msg->SetRapId (raPreambleId);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   522
  m_controlMessagesQueue.at (0).push_back (msg);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   523
}
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   524
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   525
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   526
void
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   527
LteUePhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   528
{
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   529
  NS_LOG_FUNCTION (this);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   530
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   531
  std::list<Ptr<LteControlMessage> >::iterator it;
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   532
  for (it = msgList.begin (); it != msgList.end(); it++)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   533
  {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   534
    Ptr<LteControlMessage> msg = (*it);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   535
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   536
    if (msg->GetMessageType () == LteControlMessage::DL_DCI)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   537
    {
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   538
      Ptr<DlDciLteControlMessage> msg2 = DynamicCast<DlDciLteControlMessage> (msg);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   539
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   540
      DlDciListElement_s dci = msg2->GetDci ();
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   541
      if (dci.m_rnti != m_rnti)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   542
        {
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   543
          // DCI not for me
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   544
          continue;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   545
        }
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   546
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   547
      if (dci.m_resAlloc != 0)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   548
      {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   549
        NS_FATAL_ERROR ("Resource Allocation type not implemented");
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   550
      }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   551
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   552
      std::vector <int> dlRb;
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   553
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   554
      // translate the DCI to Spectrum framework
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   555
      uint32_t mask = 0x1;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   556
      for (int i = 0; i < 32; i++)
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   557
      {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   558
        if (((dci.m_rbBitmap & mask) >> i) == 1)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   559
        {
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   560
          for (int k = 0; k < GetRbgSize (); k++)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   561
          {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   562
            dlRb.push_back ((i * GetRbgSize ()) + k);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   563
            //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   564
          }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   565
        }
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   566
        mask = (mask << 1);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   567
      }
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
   568
      
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8253
diff changeset
   569
      // send TB info to LteSpectrumPhy
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   570
      NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap "  << dci.m_rbBitmap);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   571
      for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   572
      {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   573
        m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   574
      }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   575
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   576
      SetSubChannelsForReception (dlRb);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   577
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   578
      
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   579
    }
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   580
    else if (msg->GetMessageType () == LteControlMessage::UL_DCI) 
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
      // set the uplink bandwidht according to the UL-CQI
8729
74de12409ee5 Update m_macChTtiDelay fixed to 4 in UL (standard) and make schedulers unaware of channel delays (tests updated according to new delay)
mmiozzo
parents: 8728
diff changeset
   583
      NS_LOG_DEBUG (this << " UL DCI");
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   584
      Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   585
      UlDciListElement_s dci = msg2->GetDci ();
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   586
      if (dci.m_rnti != m_rnti)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   587
        {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   588
          // DCI not for me
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   589
          continue;
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   590
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   591
      std::vector <int> ulRb;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   592
      for (int i = 0; i < dci.m_rbLen; i++)
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   593
      {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   594
        ulRb.push_back (i + dci.m_rbStart);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   595
        //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   596
      }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   597
      
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   598
      QueueSubChannelsForTransmission (ulRb);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   599
      // pass the info to the MAC
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   600
      m_uePhySapUser->ReceiveLteControlMessage (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   601
    }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   602
    else if (msg->GetMessageType () == LteControlMessage::MIB) 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   603
      {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   604
        NS_LOG_INFO ("received MIB");
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   605
        Ptr<MibLteControlMessage> msg2 = DynamicCast<MibLteControlMessage> (msg);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   606
        m_ueCphySapUser->RecvMasterInformationBlock (msg2->GetMib ());
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   607
      }
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   608
    else
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   609
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   610
      // pass the message to UE-MAC
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   611
      m_uePhySapUser->ReceiveLteControlMessage (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   612
    }
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   613
    
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   614
  }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   615
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   616
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   617
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   618
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   619
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   620
void
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   621
LteUePhy::QueueSubChannelsForTransmission (std::vector <int> rbMap)
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   622
{
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   623
  m_subChannelsForTransmissionQueue.at (m_macChTtiDelay - 1) = rbMap;
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   624
}
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   625
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   626
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   627
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   628
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   629
{
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   630
  NS_LOG_FUNCTION (this << frameNo << subframeNo);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   631
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   632
  NS_ASSERT_MSG (frameNo > 0, "the SRS index check code assumes that frameNo starts at 1");
8728
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   633
  
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   634
  if (m_ulConfigured)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   635
    {
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   636
      // update uplink transmission mask according to previous UL-CQIs
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   637
      SetSubChannelsForTransmission (m_subChannelsForTransmissionQueue.at (0));
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   638
   
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   639
      // shift the queue
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   640
      for (uint8_t i = 1; i < m_macChTtiDelay; i++)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   641
        {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   642
          m_subChannelsForTransmissionQueue.at (i-1) = m_subChannelsForTransmissionQueue.at (i);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   643
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   644
      m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   645
  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   646
      if (m_srsConfigured)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   647
        {
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   648
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   649
          NS_ASSERT_MSG (subframeNo > 0 && subframeNo <= 10, "the SRS index check code assumes that subframeNo starts at 1");
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   650
          if ((((frameNo-1)*10 + (subframeNo-1)) % m_srsPeriodicity) == m_srsSubframeOffset)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   651
            {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   652
              NS_LOG_INFO ("frame " << frameNo << " subframe " << subframeNo << " sending SRS (offset=" << m_srsSubframeOffset << ", period=" << m_srsPeriodicity << ")");
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   653
              Simulator::Schedule (UL_SRS_DELAY_FROM_SUBFRAME_START, 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   654
                                   &LteUePhy::SendSrs,
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   655
                                   this);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   656
            }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   657
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   658
      
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   659
      std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   660
      // send packets in queue
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   661
      // send the current burts of packets
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   662
      Ptr<PacketBurst> pb = GetPacketBurst ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   663
      if (pb)
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   664
        {
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   665
          NS_LOG_LOGIC (this << " UE - start TX PUSCH + PUCCH");
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   666
          m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   667
        }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   668
      else
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   669
        {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   670
          // send only PUCCH (ideal: fake full bandwidth signal)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   671
          if (ctrlMsg.size ()>0)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   672
            {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   673
              std::vector <int> dlRb;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   674
              for (uint8_t i = 0; i < m_ulBandwidth; i++)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   675
                {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   676
                  dlRb.push_back (i);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   677
                }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   678
              SetSubChannelsForTransmission (dlRb);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   679
              m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   680
            }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   681
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   682
    }  // m_configured
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   683
  
8415
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   684
  // trigger the MAC
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   685
  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   686
  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   687
  
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   688
  ++subframeNo;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   689
  if (subframeNo > 10)
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   690
    {
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   691
      ++frameNo;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   692
      subframeNo = 1;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   693
    }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   694
  
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   695
  // schedule next subframe indication
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   696
  Simulator::Schedule (Seconds (GetTti ()), &LteUePhy::SubframeIndication, this, frameNo, subframeNo);  
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   697
}
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   698
  
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   699
void
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   700
  LteUePhy::SendSrs ()
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   701
{
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   702
  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << m_cellId);
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   703
  // set the current tx power spectral density (full bandwidth)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   704
  std::vector <int> dlRb;
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   705
  for (uint8_t i = 0; i < m_ulBandwidth; i++)
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   706
    {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   707
      dlRb.push_back (i);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   708
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   709
  SetSubChannelsForTransmission (dlRb);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   710
  m_uplinkSpectrumPhy->StartTxUlSrsFrame ();
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   711
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   712
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8737
diff changeset
   713
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   714
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   715
void
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   716
LteUePhy::DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   717
{
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   718
  NS_LOG_FUNCTION (this << cellId);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   719
  m_enbCellId = cellId;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   720
  m_dlEarfcn = dlEarfcn;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   721
  m_downlinkSpectrumPhy->SetCellId (cellId);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   722
  m_uplinkSpectrumPhy->SetCellId (cellId);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   723
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   724
  // configure DL for receing the BCH with the minimum bandwith
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   725
  const uint8_t minDlBandwidth = 6;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   726
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, minDlBandwidth, m_noiseFigure);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   727
  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   728
  m_downlinkSpectrumPhy->GetChannel ()->AddRx (m_downlinkSpectrumPhy);  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   729
  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   730
  m_dlConfigured = false;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   731
  m_ulConfigured = false;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   732
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   733
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   734
void
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   735
LteUePhy::DoSetDlBandwidth (uint8_t dlBandwidth)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   736
{
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   737
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   738
  m_dlBandwidth = dlBandwidth;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   739
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   740
  int Type0AllocationRbg[4] = {
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   741
    10,     // RGB size 1
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   742
    26,     // RGB size 2
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   743
    63,     // RGB size 3
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   744
    110     // RGB size 4
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   745
  };  // see table 7.1.6.1-1 of 36.213
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   746
  for (int i = 0; i < 4; i++)
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   747
    {
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   748
      if (dlBandwidth < Type0AllocationRbg[i])
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   749
        {
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   750
          m_rbgSize = i + 1;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   751
          break;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   752
        }
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   753
    }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   754
  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   755
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   756
  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   757
  m_downlinkSpectrumPhy->GetChannel ()->AddRx (m_downlinkSpectrumPhy);  
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   758
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   759
  m_dlConfigured = true;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   760
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   761
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   762
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   763
void 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   764
LteUePhy::DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth)
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   765
{
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   766
  m_ulEarfcn = ulEarfcn;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   767
  m_ulBandwidth = ulBandwidth;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   768
  m_ulConfigured = true;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   769
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   770
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   771
 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   772
void
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   773
LteUePhy::DoSetRnti (uint16_t rnti)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   774
{
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   775
  NS_LOG_FUNCTION (this << rnti);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   776
  m_rnti = rnti;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   777
}
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   778
 
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   779
void
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   780
LteUePhy::DoSetTransmissionMode (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   781
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   782
  NS_LOG_FUNCTION (this << (uint16_t)txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   783
  m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   784
  m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   785
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   786
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   787
void
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   788
LteUePhy::DoSetSrsConfigurationIndex (uint16_t srcCi)
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   789
{
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   790
  NS_LOG_FUNCTION (this << srcCi);
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   791
  m_srsPeriodicity = GetSrsPeriodicity (srcCi);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   792
  m_srsSubframeOffset = GetSrsSubframeOffset (srcCi);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   793
  m_srsConfigured = true;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   794
  NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << m_srsSubframeOffset << " cellId " << m_cellId << " CI " << srcCi);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   795
}
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   796
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   797
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   798
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   799
LteUePhy::SetTxMode1Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   800
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   801
  SetTxModeGain (1, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   802
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   803
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   804
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   805
LteUePhy::SetTxMode2Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   806
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   807
  SetTxModeGain (2, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   808
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   809
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   810
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   811
LteUePhy::SetTxMode3Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   812
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   813
  SetTxModeGain (3, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   814
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   815
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   816
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   817
LteUePhy::SetTxMode4Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   818
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   819
  SetTxModeGain (4, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   820
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   821
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   822
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   823
LteUePhy::SetTxMode5Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   824
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   825
  SetTxModeGain (5, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   826
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   827
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   828
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   829
LteUePhy::SetTxMode6Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   830
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   831
  SetTxModeGain (6, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   832
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   833
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   834
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   835
LteUePhy::SetTxMode7Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   836
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   837
  SetTxModeGain (7, gain);
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   838
}
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   839
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   840
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   841
void
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   842
LteUePhy::SetTxModeGain (uint8_t txMode, double gain)
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   843
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   844
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   845
  // 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
   846
  double gainLin = pow (10.0, (gain / 10.0));
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   847
  if (m_txModeGain.size () < txMode)
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   848
    {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   849
      m_txModeGain.resize (txMode);
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   850
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   851
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   852
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   853
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   854
  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
   855
    {
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   856
      if (i==txMode-1)
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   857
        {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   858
          m_txModeGain.push_back (gainLin);
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   859
        }
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   860
      else
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   861
        {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   862
          m_txModeGain.push_back (temp.at (i));
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   863
        }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   864
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   865
  // forward the info to DL LteSpectrumPhy
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
   866
  m_downlinkSpectrumPhy->SetTxModeGain (txMode, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   867
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   868
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   869
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   870
} // namespace ns3