src/lte/model/lte-ue-phy.cc
author Marco Miozzo <marco.miozzo@cttc.es>
Thu, 21 Feb 2013 17:22:42 +0100
changeset 9986 d1c0357a227f
parent 9983 0091ab7a897c
child 9996 62697fe2165d
permissions -rw-r--r--
Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
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>
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
    39
#include <ns3/pointer.h>
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);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
    74
  virtual void SendRachPreamble (uint32_t prachId, uint32_t raRnti);
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
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
    98
UeMemberLteUePhySapProvider::SendRachPreamble (uint32_t prachId, uint32_t raRnti)
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
    99
{
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   100
  m_phy->DoSendRachPreamble (prachId, raRnti);
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),
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   120
    m_p10CqiPeriocity (MilliSeconds (1)),  // ideal behavior  
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   121
    m_a30CqiPeriocity (MilliSeconds (1)),  // ideal behavior
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   122
    m_uePhySapUser (0),
9346
00e674a0d567 merge lena-dev and lena-epc
Nicola Baldo <nbaldo@cttc.es>
parents: 9337 9053
diff changeset
   123
    m_ueCphySapUser (0),
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   124
    m_subframeNo (0),
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   125
    m_rsReceivedPowerUpdated (false),
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   126
    m_rsInterferencePowerUpdated (false),
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   127
    m_pssReceived (false),
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   128
    m_ueMeasurementsFilterPeriod (MilliSeconds (200)),
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   129
    m_ueMeasurementsFilterLast (MilliSeconds (0)),
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   130
    m_rsrpSinrSampleCounter (0)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   131
{
8522
795ea37db2ff Change LteAmc* to Ptr<LteAmc> in LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8517
diff changeset
   132
  m_amc = CreateObject <LteAmc> ();
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   133
  m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   134
  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
   135
  m_macChTtiDelay = UL_PUSCH_TTIS_DELAY;
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   136
  
9054
16f693a95855 added assert for correct scheduling of LteUePhy::SubframeIndication
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   137
  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
   138
                 "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
   139
  Simulator::ScheduleNow (&LteUePhy::SubframeIndication, this, 1, 1);
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   140
  Simulator::Schedule (m_ueMeasurementsFilterPeriod, &LteUePhy::ReportUeMeasurements, this);
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   141
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   142
  DoReset ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   143
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   144
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   145
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   146
LteUePhy::~LteUePhy ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   147
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   148
  m_txModeGain.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   149
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   150
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   151
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   152
LteUePhy::DoDispose ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   153
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   154
  NS_LOG_FUNCTION (this);
7930
ccb40542ae88 fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   155
  delete m_uePhySapProvider;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   156
  delete m_ueCphySapProvider;
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   157
  LtePhy::DoDispose ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   158
}
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   159
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   160
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   161
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   162
TypeId
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   163
LteUePhy::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   164
{
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   165
  static TypeId tid = TypeId ("ns3::LteUePhy")
6707
2ac68a0381ca improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   166
    .SetParent<LtePhy> ()
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   167
    .AddConstructor<LteUePhy> ()
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   168
    .AddAttribute ("TxPower",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   169
                   "Transmission power in dBm",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   170
                   DoubleValue (10.0),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   171
                   MakeDoubleAccessor (&LteUePhy::SetTxPower, 
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   172
                                       &LteUePhy::GetTxPower),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   173
                   MakeDoubleChecker<double> ())
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   174
    .AddAttribute ("NoiseFigure",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   175
                   "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
   176
                   " 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
   177
                   "\"the difference in decibels (dB) between"
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   178
                   " 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
   179
                   " 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
   180
                   " are connected to sources at the standard noise temperature T0.\" "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   181
                   "In this model, we consider T0 = 290K.",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   182
                   DoubleValue (9.0),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   183
                   MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, 
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   184
                                       &LteUePhy::GetNoiseFigure),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   185
                   MakeDoubleChecker<double> ())
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   186
    .AddAttribute ("TxMode1Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   187
                  "Transmission mode 1 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   188
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   189
                   MakeDoubleAccessor (&LteUePhy::SetTxMode1Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   190
                  MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   191
    .AddAttribute ("TxMode2Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   192
                    "Transmission mode 2 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   193
                    DoubleValue (4.2),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   194
                   MakeDoubleAccessor (&LteUePhy::SetTxMode2Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   195
                    MakeDoubleChecker<double> ())
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   196
    .AddAttribute ("TxMode3Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   197
                    "Transmission mode 3 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   198
                    DoubleValue (-2.8),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   199
                   MakeDoubleAccessor (&LteUePhy::SetTxMode3Gain                       ),
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 ("TxMode4Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   202
                    "Transmission mode 4 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   203
                    DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   204
                   MakeDoubleAccessor (&LteUePhy::SetTxMode4Gain                       ),
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 ("TxMode5Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   207
                  "Transmission mode 5 gain in dB",
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   208
                  DoubleValue (0.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   209
                   MakeDoubleAccessor (&LteUePhy::SetTxMode5Gain                       ),
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 ("TxMode6Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   212
                    "Transmission mode 6 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::SetTxMode6Gain                       ),
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 ("TxMode7Gain",
8737
5ad20527f3f6 JIRA 235 Address typo in lte-ue-phy.cc (dBm instead of dB)
mmiozzo
parents: 8729
diff changeset
   217
                  "Transmission mode 7 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::SetTxMode7Gain                       ),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   220
                  MakeDoubleChecker<double> ())
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   221
    .AddTraceSource ("ReportCurrentCellRsrpSinr",
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   222
                     "RSRP and SINR statistics.",
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   223
                     MakeTraceSourceAccessor (&LteUePhy::m_reportCurrentCellRsrpSinrTrace))
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   224
    .AddAttribute ("RsrpSinrSamplePeriod",
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   225
                   "The sampling period for reporting RSRP-SINR stats (default value 1)",
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   226
                   UintegerValue (1),
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   227
                   MakeUintegerAccessor (&LteUePhy::m_rsrpSinrSamplePeriod),
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   228
                   MakeUintegerChecker<uint16_t> ())
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   229
    .AddTraceSource ("UlPhyTransmission",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   230
                     "DL transmission PHY layer statistics.",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   231
                     MakeTraceSourceAccessor (&LteUePhy::m_ulPhyTransmission))
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   232
    .AddAttribute ("DlSpectrumPhy",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   233
                   "The downlink LteSpectrumPhy associated to this LtePhy",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   234
                   TypeId::ATTR_GET,
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   235
                   PointerValue (),
9636
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   236
                   MakePointerAccessor (&LteUePhy::GetDlSpectrumPhy),
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   237
                   MakePointerChecker <LteSpectrumPhy> ())
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   238
    .AddAttribute ("UlSpectrumPhy",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   239
                   "The uplink LteSpectrumPhy associated to this LtePhy",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   240
                   TypeId::ATTR_GET,
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   241
                   PointerValue (),
9636
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   242
                   MakePointerAccessor (&LteUePhy::GetUlSpectrumPhy),
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   243
                   MakePointerChecker <LteSpectrumPhy> ())
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   244
    .AddAttribute ("RsrqUeMeasThreshold",
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   245
                  "Receive threshold for PSS on RSRQ [dB]",
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   246
                  DoubleValue (-1000.0),
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   247
                   MakeDoubleAccessor (&LteUePhy::m_pssReceptionThreshold                    ),
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   248
                  MakeDoubleChecker<double> ())
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   249
    .AddAttribute ("UeMeasurementsFilterPeriod",
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   250
                  "Time period for reporting UE measurements (default 200 ms.) ",
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   251
                  TimeValue (MilliSeconds (200)),
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   252
                  MakeTimeAccessor (&LteUePhy::m_ueMeasurementsFilterPeriod),
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   253
                  MakeTimeChecker ())
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
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   256
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   257
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   258
void
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   259
LteUePhy::DoStart ()
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   260
{
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   261
  NS_LOG_FUNCTION (this);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   262
  LtePhy::DoStart ();
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   263
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   264
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   265
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   266
LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   267
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   268
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   269
  m_uePhySapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   270
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   271
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   272
LteUePhySapProvider*
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   273
LteUePhy::GetLteUePhySapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   274
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7895
diff changeset
   275
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   276
  return (m_uePhySapProvider);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   277
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   278
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   279
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   280
void
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   281
LteUePhy::SetLteUeCphySapUser (LteUeCphySapUser* s)
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   282
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   283
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   284
  m_ueCphySapUser = s;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   285
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   286
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   287
LteUeCphySapProvider*
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   288
LteUePhy::GetLteUeCphySapProvider ()
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   289
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   290
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   291
  return (m_ueCphySapProvider);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   292
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   293
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   294
void
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   295
LteUePhy::SetNoiseFigure (double nf)
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   296
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   297
  NS_LOG_FUNCTION (this << nf);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   298
  m_noiseFigure = nf;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   299
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   300
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   301
double
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   302
LteUePhy::GetNoiseFigure () const
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   303
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   304
  NS_LOG_FUNCTION (this);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   305
  return m_noiseFigure;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   306
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   307
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   308
void
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   309
LteUePhy::SetTxPower (double pow)
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   310
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   311
  NS_LOG_FUNCTION (this << pow);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   312
  m_txPower = pow;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   313
}
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   314
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   315
double
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   316
LteUePhy::GetTxPower () const
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   317
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   318
  NS_LOG_FUNCTION (this);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   319
  return m_txPower;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7930
diff changeset
   320
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   321
8670
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   322
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   323
uint8_t
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   324
LteUePhy::GetMacChDelay (void) const
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   325
{
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   326
  return (m_macChTtiDelay);
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   327
}
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   328
9636
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   329
Ptr<LteSpectrumPhy>
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   330
LteUePhy::GetDlSpectrumPhy () const
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   331
{
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   332
  return m_downlinkSpectrumPhy;
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   333
}
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   334
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   335
Ptr<LteSpectrumPhy>
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   336
LteUePhy::GetUlSpectrumPhy () const
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   337
{
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   338
  return m_uplinkSpectrumPhy;
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   339
}
91e31f0e569c make Dl/UlSpectrumPhy attributes in LteUe/EnbPhy use getter instead of member variable to fix compilation issue with gcc 4.4.3
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   340
8670
8f63d16fb2e8 fixed compilation error with g++-4.4
Nicola Baldo <nbaldo@cttc.es>
parents: 8664
diff changeset
   341
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   342
LteUePhy::DoSendMacPdu (Ptr<Packet> p)
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);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   345
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   346
  SetMacPdu (p);
6705
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   350
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   351
LteUePhy::PhyPduReceived (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   352
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   353
  m_uePhySapUser->ReceivePhyPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   354
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   355
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   356
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   357
LteUePhy::SetSubChannelsForTransmission (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   358
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   359
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   360
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   361
  m_subChannelsForTransmission = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   362
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   363
  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
   364
  m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
6705
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   368
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   369
LteUePhy::SetSubChannelsForReception (std::vector <int> mask)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   370
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   371
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   372
  m_subChannelsForReception = mask;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   373
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   374
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   375
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   376
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   377
LteUePhy::GetSubChannelsForTransmission ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   378
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   379
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   380
  return m_subChannelsForTransmission;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   381
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   382
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   383
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   384
std::vector <int>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   385
LteUePhy::GetSubChannelsForReception ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   386
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   387
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   388
  return m_subChannelsForReception;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   389
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   390
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   391
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   392
Ptr<SpectrumValue>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   393
LteUePhy::CreateTxPowerSpectralDensity ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   394
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   395
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   396
  LteSpectrumValueHelper psdHelper;
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   397
  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
   398
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   399
  return psd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   400
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   401
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   402
void
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   403
LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   404
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   405
  NS_LOG_FUNCTION (this);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   407
  if (!(m_dlConfigured && m_ulConfigured))
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   408
    {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   409
      return;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   410
    }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   411
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   412
  // check periodic wideband CQI
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   413
  if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   414
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   415
      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
   416
      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
9642
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   417
      if (msg)
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   418
        {
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   419
          DoSendLteControlMessage (msg);
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   420
        }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   421
      m_p10CqiLast = Simulator::Now ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   422
    }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   423
  // 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
   424
  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
   425
    {
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   426
      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
   427
      Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
9642
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   428
      if (msg)
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   429
        {
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   430
          DoSendLteControlMessage (msg);
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   431
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   432
      m_a30CqiLast = Simulator::Now ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   433
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   434
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   435
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   436
void
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   437
LteUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   438
{
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   439
  // Not used by UE, CQI are based only on RS
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   440
}
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   441
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   442
void
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   443
LteUePhy::ReportInterference (const SpectrumValue& interf)
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   444
{
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   445
  NS_LOG_FUNCTION (this << interf);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   446
  m_rsInterferencePowerUpdated = true;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   447
  m_rsIntereferencePower = interf; 
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   448
}
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   449
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   450
void
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   451
LteUePhy::ReportRsReceivedPower (const SpectrumValue& power)
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   452
{
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   453
  NS_LOG_FUNCTION (this << power);
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   454
  m_rsReceivedPowerUpdated = true;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   455
  m_rsReceivedPower = power;  
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   456
}
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   457
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   458
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   459
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
   460
Ptr<DlCqiLteControlMessage>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   461
LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   462
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   463
  NS_LOG_FUNCTION (this);
9642
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   464
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   465
  if (m_rnti == 0)
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   466
    {
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   467
      // abort method, the UE is still not registered
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   468
      return (0);
18322d968b54 Avoid generation of DL-CQI with RNTI = 0 when UEs are not connected
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9636
diff changeset
   469
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   470
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   471
  // apply transmission mode gain
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   472
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   473
  SpectrumValue newSinr = sinr;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   474
  newSinr *= m_txModeGain.at (m_transmissionMode);
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   475
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   476
  m_rsrpSinrSampleCounter++;
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   477
  if (m_rsrpSinrSampleCounter==m_rsrpSinrSamplePeriod)
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   478
    {
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   479
      NS_ASSERT_MSG (m_rsReceivedPowerUpdated, " RS received power info obsolete");
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   480
      // RSRP evaluated as averaged received power among RBs
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   481
      double sum = 0.0;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   482
      uint8_t rbNum = 0;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   483
      Values::const_iterator it;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   484
      for (it = m_rsReceivedPower.ConstValuesBegin (); it != m_rsReceivedPower.ConstValuesEnd (); it++)
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   485
        {
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   486
          sum += (*it);
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   487
          rbNum++;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   488
        }
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   489
      double rsrp = sum / (double)rbNum;
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   490
      // averaged SINR among RBs
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   491
      for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   492
        {
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   493
          sum += (*it);
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   494
          rbNum++;
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   495
        }
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   496
      double avSinr = sum / (double)rbNum;
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   497
      NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " SINR " << avSinr);
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   498
 
9390
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   499
      m_reportCurrentCellRsrpSinrTrace (m_cellId, m_rnti, rsrp, avSinr);
d51829659a57 Change RSRQ stats for average SINR ones
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9389
diff changeset
   500
      m_rsrpSinrSampleCounter = 0;
9357
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9353
diff changeset
   501
    }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   502
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   503
  // UE Measurements
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   504
  if (m_pssReceived)
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   505
    {
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   506
      NS_ASSERT_MSG (m_rsInterferencePowerUpdated, " RS interference power info obsolete");
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   507
      // PSSs received
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   508
      std::map <uint16_t, SpectrumValue>::iterator itPss = m_pssMap.begin ();
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   509
      while (itPss != m_pssMap.end ())
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   510
        {
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   511
          NS_LOG_DEBUG (this << " PSS received from eNB " << (*itPss).first);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   512
          uint8_t rbNum = 0;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   513
          SpectrumValue pi = (*itPss).second;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   514
          Values::const_iterator itPi;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   515
          double rsrpSum = 0.0;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   516
          double rsrqSum = 0.0;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   517
          Values::const_iterator itInt = m_rsIntereferencePower.ConstValuesBegin ();
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   518
          Values::const_iterator itPj = m_rsIntereferencePower.ConstValuesBegin ();
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   519
          Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_noiseFigure);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   520
          Values::const_iterator itN = noisePsd->ConstValuesBegin ();
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   521
          for (itPi = pi.ConstValuesBegin (); itPi != pi.ConstValuesEnd (); itPi++, itInt++, itPj++, itN++)
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   522
            {
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   523
              rbNum++;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   524
              rsrpSum += (*itPi);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   525
              rsrqSum += (*itInt) + (*itPj) + (*itN);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   526
              
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   527
            }
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   528
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   529
          double rsrp_dBm = 10 * log (1000 * rsrpSum / (double)rbNum);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   530
          double rsrq_dB = 10 * log (rsrpSum / rsrqSum);
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   531
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   532
          if (rsrq_dB > m_pssReceptionThreshold)
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   533
            {
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   534
              // report UE Measurements to upper layers
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   535
              NS_LOG_DEBUG (this << " CellId " << (*itPss).first << " has RSRP " << rsrp_dBm << " and RSRQ " << rsrq_dB);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   536
              // store measurements
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   537
              std::map <uint16_t, UeMeasurementsElement>::iterator itMeasMap =  m_UeMeasurementsMap.find ((*itPss).first);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   538
              if (itMeasMap == m_UeMeasurementsMap.end ())
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   539
                {
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   540
                  // insert new entry
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   541
                  UeMeasurementsElement newEl;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   542
                  newEl.rsrpSum = rsrp_dBm;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   543
                  newEl.rsrpNum = 1;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   544
                  newEl.rsrqSum = rsrq_dB;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   545
                  newEl.rsrqNum = 1;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   546
                  m_UeMeasurementsMap.insert (std::pair <uint16_t, UeMeasurementsElement> ((*itPss).first, newEl));
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   547
                }
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   548
              else
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   549
                {
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   550
                  (*itMeasMap).second.rsrpSum += rsrp_dBm;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   551
                  (*itMeasMap).second.rsrpNum++;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   552
                  (*itMeasMap).second.rsrqSum += rsrq_dB;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   553
                  (*itMeasMap).second.rsrqNum++;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   554
                }
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   555
              
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   556
            }
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   557
          itPss++;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   558
        }
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   559
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   560
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   561
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
   562
  // 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
   563
  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
   564
  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
   565
  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
   566
  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
   567
    {
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   568
      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
   569
      
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   570
      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
   571
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   572
      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
   573
      int activeSubChannels = 0;
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   574
      // 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
   575
      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
   576
        {
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   577
          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
   578
            {
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   579
              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
   580
              activeSubChannels++;
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   581
            }
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
   582
          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
   583
        }
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   584
      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
   585
      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
   586
      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
   587
      NS_ASSERT_MSG (nLayer > 0, " nLayer negative");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   588
      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
   589
      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
   590
        {
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   591
          if (activeSubChannels > 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   592
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   593
              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
   594
            }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   595
          else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   596
            {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   597
              // approximate with the worst case -> CQI = 1
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   598
              dlcqi.m_wbCqi.push_back (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   599
            }
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
   600
        }
8019
3f88f08f0e55 LENA-93 DL CQI averaged over active RBs only in UE PHY
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7981
diff changeset
   601
      //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
   602
      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
   603
      // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   604
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   605
  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
   606
    {
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8670 8725
diff changeset
   607
      cqi = m_amc->CreateCqiFeedbacks (newSinr, GetRbgSize ());
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   608
      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
   609
      int nbSubChannels = cqi.size ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   610
      int rbgSize = GetRbgSize ();
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   611
      double cqiSum = 0.0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   612
      int cqiNum = 0;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   613
      SbMeasResult_s rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   614
      //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
   615
      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
   616
        {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   617
          if (cqi.at (i) != -1)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   618
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   619
              cqiSum += cqi.at (i);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   620
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   621
          // 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
   622
          cqiNum++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   623
          if (cqiNum == rbgSize)
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   624
            {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   625
              // average the CQIs of the different RBGs
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   626
              //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
   627
              HigherLayerSelected_s hlCqi;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   628
              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
   629
              for (int i = 0; i < nLayer; i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   630
                {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   631
                  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
   632
                }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   633
              rbgMeas.m_higherLayerSelected.push_back (hlCqi);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   634
              cqiSum = 0.0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   635
              cqiNum = 0;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   636
            }
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   637
        }
7895
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   638
      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
   639
      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
   640
      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
   641
      //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
   642
      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
   643
      dlcqi.m_sbMeasResult = rbgMeas;
f20bb71f9b71 Aperiodic high layer configured subband CQI (A30 type) implemented
Marco Miozzo <marco.miozzo@cttc.es>
parents: 7893
diff changeset
   644
    }
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8042
diff changeset
   645
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   646
  msg->SetDlCqi (dlcqi);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   647
  return msg;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   648
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   649
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   650
9986
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   651
void
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   652
LteUePhy::ReportUeMeasurements ()
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   653
{
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   654
  NS_LOG_FUNCTION (this << Simulator::Now ());
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   655
  NS_LOG_DEBUG (this << " Report UE Measurements ");
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   656
  LteUeCphySapUser::UeMeasurementsParameters ret;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   657
  std::map <uint16_t, UeMeasurementsElement>::iterator it;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   658
  for (it = m_UeMeasurementsMap.begin (); it != m_UeMeasurementsMap.end (); it++)
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   659
    {
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   660
      double avg_rsrp = (*it).second.rsrpSum / (double)(*it).second.rsrpNum;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   661
      double avg_rsrq = (*it).second.rsrqSum / (double)(*it).second.rsrqNum;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   662
      NS_LOG_DEBUG (this << " CellId " << (*it).first << " RSRP " << avg_rsrp << " (nSamples " << (*it).second.rsrpNum << ") RSRQ " << avg_rsrq << " (nSamples " << (*it).second.rsrpNum << ")");
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   663
      LteUeCphySapUser::UeMeasurementsElement newEl;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   664
      newEl.m_cellId = (*it).first;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   665
      newEl.m_rsrp = avg_rsrp;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   666
      newEl.m_rsrq = avg_rsrq;
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   667
      ret.m_ueMeasurementsList.push_back (newEl);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   668
    }
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   669
  m_ueCphySapUser-> ReportUeMeasurements(ret);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   670
  m_UeMeasurementsMap.clear ();
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   671
  Simulator::Schedule (m_ueMeasurementsFilterPeriod, &LteUePhy::ReportUeMeasurements, this);
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   672
}
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   673
d1c0357a227f Update Phy support for Ue Measurements with time filtering and c-phy-sap measurements grouping
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   674
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   675
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   676
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
   677
LteUePhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   678
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   679
  NS_LOG_FUNCTION (this << msg);
9346
00e674a0d567 merge lena-dev and lena-epc
Nicola Baldo <nbaldo@cttc.es>
parents: 9337 9053
diff changeset
   680
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   681
  SetControlMessages (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   682
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   683
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   684
void 
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   685
LteUePhy::DoSendRachPreamble (uint32_t raPreambleId, uint32_t raRnti)
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   686
{
9413
20f1c6678ee2 improved LTE Random Access model
Nicola Baldo <nbaldo@cttc.es>
parents: 9406
diff changeset
   687
  NS_LOG_FUNCTION (this << raPreambleId);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   688
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   689
  // unlike other control messages, RACH preamble is sent ASAP
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   690
  Ptr<RachPreambleLteControlMessage> msg = Create<RachPreambleLteControlMessage> ();
9413
20f1c6678ee2 improved LTE Random Access model
Nicola Baldo <nbaldo@cttc.es>
parents: 9406
diff changeset
   691
  msg->SetRapId (raPreambleId);
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   692
  m_raPreambleId = raPreambleId;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   693
  m_raRnti = raRnti;
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   694
  m_controlMessagesQueue.at (0).push_back (msg);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   695
}
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   696
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   697
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   698
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
   699
LteUePhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   700
{
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
  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
   702
  
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
  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
   704
  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
   705
  {
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
    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
   707
  
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
    if (msg->GetMessageType () == LteControlMessage::DL_DCI)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   709
    {
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
   710
      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
   711
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   712
      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
   713
      if (dci.m_rnti != m_rnti)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   714
        {
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
   715
          // 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
   716
          continue;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   717
        }
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
   718
      
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
   719
      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
   720
      {
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
   721
        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
   722
      }
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
   723
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   724
      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
   725
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   726
      // translate the DCI to Spectrum framework
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   727
      uint32_t mask = 0x1;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   728
      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
   729
      {
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
   730
        if (((dci.m_rbBitmap & mask) >> i) == 1)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   731
        {
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
   732
          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
   733
          {
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
   734
            dlRb.push_back ((i * GetRbgSize ()) + k);
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
   735
//             NS_LOG_DEBUG(this << " RNTI " << m_rnti << " RBG " << i << " DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
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
   736
          }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   737
        }
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
   738
        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
   739
      }
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
   740
      
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8253
diff changeset
   741
      // 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
   742
      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
   743
      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
   744
      {
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   745
        m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_ndi.at (i), dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i, dci.m_harqProcess, dci.m_rv.at (i), true /* DL */);
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
   746
      }
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
   747
      
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   748
      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
   749
      
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
   750
      
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   751
    }
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
   752
    else if (msg->GetMessageType () == LteControlMessage::UL_DCI) 
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   753
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   754
      // set the uplink bandwidht according to the UL-CQI
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
   755
      Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   756
      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
   757
      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
   758
        {
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
   759
          // 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
   760
          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
   761
        }
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   762
      NS_LOG_INFO (this << " UL DCI");
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   763
      std::vector <int> ulRb;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   764
      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
   765
      {
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
   766
        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
   767
        //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
   768
      }
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
   769
      QueueSubChannelsForTransmission (ulRb);
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   770
      // fire trace of UL Tx PHY stats
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   771
      HarqProcessInfoList_t harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl (m_rnti, 0);
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   772
      PhyTransmissionStatParameters params;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   773
      params.m_cellId = m_cellId;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   774
      params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   775
      params.m_timestamp = Simulator::Now ().GetMilliSeconds () + UL_PUSCH_TTIS_DELAY;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   776
      params.m_rnti = m_rnti;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   777
      params.m_txMode = 0; // always SISO for UE
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   778
      params.m_layer = 0;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   779
      params.m_mcs = dci.m_mcs;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   780
      params.m_size = dci.m_tbSize;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   781
      params.m_rv = harqInfoList.size ();
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   782
      params.m_ndi = dci.m_ndi;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9461
diff changeset
   783
      m_ulPhyTransmission (params);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   784
      // 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
   785
      m_uePhySapUser->ReceiveLteControlMessage (msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   786
    }
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   787
    else if (msg->GetMessageType () == LteControlMessage::RAR)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   788
      {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   789
        Ptr<RarLteControlMessage> rarMsg = DynamicCast<RarLteControlMessage> (msg);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   790
        if (rarMsg->GetRaRnti () == m_raRnti)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   791
          {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   792
            for (std::list<RarLteControlMessage::Rar>::const_iterator it = rarMsg->RarListBegin (); it != rarMsg->RarListEnd (); ++it)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   793
              {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   794
                if (it->rapId != m_raPreambleId)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   795
                  {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   796
                    // UL grant not for me
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   797
                    continue;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   798
                  }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   799
                else
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   800
                  {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   801
                    NS_LOG_INFO ("received RAR RNTI " << m_raRnti);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   802
                    // set the uplink bandwidht according to the UL grant
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   803
                    std::vector <int> ulRb;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   804
                    for (int i = 0; i < it->rarPayload.m_grant.m_rbLen; i++)
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   805
                    {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   806
                      ulRb.push_back (i + it->rarPayload.m_grant.m_rbStart);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   807
                    }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   808
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   809
                    QueueSubChannelsForTransmission (ulRb);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   810
                    // pass the info to the MAC
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   811
                    m_uePhySapUser->ReceiveLteControlMessage (msg);
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   812
                    // reset RACH variables with out of range values
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   813
                    m_raPreambleId = 255;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   814
                    m_raRnti = 11;
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   815
                  }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   816
              }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   817
          }
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   818
      }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   819
    else if (msg->GetMessageType () == LteControlMessage::MIB) 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   820
      {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   821
        NS_LOG_INFO ("received MIB");
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   822
        Ptr<MibLteControlMessage> msg2 = DynamicCast<MibLteControlMessage> (msg);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   823
        m_ueCphySapUser->RecvMasterInformationBlock (msg2->GetMib ());
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   824
      }
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
   825
    else
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   826
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   827
      // 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
   828
      m_uePhySapUser->ReceiveLteControlMessage (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   829
    }
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
   830
    
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
   831
  }
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
   832
  
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
   833
  
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
   834
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   835
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   836
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
   837
void
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   838
LteUePhy::ReceivePss (uint16_t cellId, SpectrumValue p)
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   839
{
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   840
  NS_LOG_FUNCTION (this << cellId);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   841
  m_pssReceived = true;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   842
  m_pssMap.insert (std::pair <uint16_t, SpectrumValue> (cellId, p));
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   843
}
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   844
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   845
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   846
void
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
   847
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
   848
{
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   849
  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
   850
}
5a99218bfd1b Bug-fix on m_macChTtiDelay management on UE-eNB PHY and consequently update RR-PF schedulers and tests
mmiozzo
parents: 8726
diff changeset
   851
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   852
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   853
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   854
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   855
{
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
   856
  NS_LOG_FUNCTION (this << frameNo << subframeNo);
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   857
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   858
  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
   859
  
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   860
  // refresh internal variables
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9388
diff changeset
   861
  m_rsReceivedPowerUpdated = false;
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   862
  m_rsInterferencePowerUpdated = false;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   863
  m_pssReceived = false;
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
   864
  
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   865
  if (m_ulConfigured)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   866
    {
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   867
      // update uplink transmission mask according to previous UL-CQIs
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   868
      SetSubChannelsForTransmission (m_subChannelsForTransmissionQueue.at (0));
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   869
   
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   870
      // shift the queue
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   871
      for (uint8_t i = 1; i < m_macChTtiDelay; i++)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   872
        {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   873
          m_subChannelsForTransmissionQueue.at (i-1) = m_subChannelsForTransmissionQueue.at (i);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   874
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   875
      m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   876
  
9469
28a7b04a0b11 removed spurious LteUePhy::m_enbCellId; fixed bug in LteEnbRrc::GetNewSrsConfigurationIndex ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9461
diff changeset
   877
      if (m_srsConfigured && (m_srsStartTime <= Simulator::Now ()))
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   878
        {
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
   879
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   880
          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
   881
          if ((((frameNo-1)*10 + (subframeNo-1)) % m_srsPeriodicity) == m_srsSubframeOffset)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   882
            {
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   883
              NS_LOG_INFO ("frame " << frameNo << " subframe " << subframeNo << " sending SRS (offset=" << m_srsSubframeOffset << ", period=" << m_srsPeriodicity << ")");
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   884
              m_sendSrsEvent = Simulator::Schedule (UL_SRS_DELAY_FROM_SUBFRAME_START, 
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   885
                                                    &LteUePhy::SendSrs,
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   886
                                                    this);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   887
            }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   888
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   889
      
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   890
      std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   891
      // send packets in queue
9579
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9569
diff changeset
   892
      NS_LOG_LOGIC (this << " UE - start slot for PUSCH + PUCCH - RNTI " << m_rnti << " CELLID " << m_cellId);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   893
      // send the current burts of packets
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   894
      Ptr<PacketBurst> pb = GetPacketBurst ();
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   895
      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
   896
        {
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   897
          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
   898
        }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   899
      else
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   900
        {
9414
7b0db3dbf19b merged lena-dev and lena-epc
Nicola Baldo <nbaldo@cttc.es>
parents: 9413 9368
diff changeset
   901
      // send only PUCCH (ideal: fake null bandwidth signal)
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   902
          if (ctrlMsg.size ()>0)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   903
            {
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   904
              NS_LOG_LOGIC (this << " UE - start TX PUCCH (NO PUSCH)");
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   905
              std::vector <int> dlRb;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   906
              SetSubChannelsForTransmission (dlRb);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   907
              m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   908
            }
9460
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   909
          else
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   910
            {
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   911
              NS_LOG_LOGIC (this << " UE - UL NOTHING TO SEND");
0674e66ee483 Introduces RACH procedures in the schedulers and UL grant at PHY layer
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9420
diff changeset
   912
            }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   913
        }
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   914
    }  // 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
   915
  
8415
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   916
  // trigger the MAC
e9a27a8c6331 Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
mmiozzo
parents: 8253
diff changeset
   917
  m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   918
  
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9642
diff changeset
   919
  m_subframeNo = subframeNo;
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   920
  ++subframeNo;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   921
  if (subframeNo > 10)
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   922
    {
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   923
      ++frameNo;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   924
      subframeNo = 1;
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   925
    }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   926
  
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   927
  // schedule next subframe indication
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9048
diff changeset
   928
  Simulator::Schedule (Seconds (GetTti ()), &LteUePhy::SubframeIndication, this, frameNo, subframeNo);  
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   929
}
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   930
  
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
   931
void
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   932
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
   933
{
9469
28a7b04a0b11 removed spurious LteUePhy::m_enbCellId; fixed bug in LteEnbRrc::GetNewSrsConfigurationIndex ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9461
diff changeset
   934
  NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << (uint32_t) m_cellId);
28a7b04a0b11 removed spurious LteUePhy::m_enbCellId; fixed bug in LteEnbRrc::GetNewSrsConfigurationIndex ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9461
diff changeset
   935
  NS_ASSERT (m_cellId > 0);
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
   936
  // 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
   937
  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
   938
  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
   939
    {
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
   940
      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
   941
    }
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
   942
  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
   943
  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
   944
}
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
   945
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
   946
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   947
void
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   948
LteUePhy::DoReset ()
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   949
{
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   950
  NS_LOG_FUNCTION (this);
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   951
  
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   952
  m_rnti = 0;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   953
  m_transmissionMode = 0;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   954
  m_srsPeriodicity = 0;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   955
  m_srsConfigured = false;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   956
  m_dlConfigured = false;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   957
  m_ulConfigured = false;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   958
  m_raPreambleId = 255; // value out of range
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   959
  m_raRnti = 11; // value out of range
9562
Nicola Baldo <nbaldo@cttc.es>
parents: 9525 9390
diff changeset
   960
  m_rsrpSinrSampleCounter = 0;
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   961
  m_p10CqiLast = Simulator::Now ();
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   962
  m_a30CqiLast = Simulator::Now ();
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   963
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   964
  m_packetBurstQueue.clear ();
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   965
  m_controlMessagesQueue.clear ();
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   966
  m_subChannelsForTransmissionQueue.clear ();
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   967
  for (int i = 0; i < m_macChTtiDelay; i++)
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   968
    {
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   969
      Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   970
      m_packetBurstQueue.push_back (pb);
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   971
      std::list<Ptr<LteControlMessage> > l;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   972
      m_controlMessagesQueue.push_back (l);
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   973
    }
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   974
  std::vector <int> ulRb;
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   975
  m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   976
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   977
  m_sendSrsEvent.Cancel ();
9579
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9569
diff changeset
   978
  m_downlinkSpectrumPhy->Reset ();
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9569
diff changeset
   979
  m_uplinkSpectrumPhy->Reset ();
9485
938edff6f281 reset LteUePhy upon handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9469
diff changeset
   980
}
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   981
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   982
void
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   983
LteUePhy::DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   984
{
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   985
  NS_LOG_FUNCTION (this << cellId);
9469
28a7b04a0b11 removed spurious LteUePhy::m_enbCellId; fixed bug in LteEnbRrc::GetNewSrsConfigurationIndex ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9461
diff changeset
   986
  m_cellId = cellId;
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   987
  m_dlEarfcn = dlEarfcn;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   988
  m_downlinkSpectrumPhy->SetCellId (cellId);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   989
  m_uplinkSpectrumPhy->SetCellId (cellId);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   990
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   991
  // configure DL for receing the BCH with the minimum bandwith
9439
5107601b7a75 added S1 path switch + S11 modify bearer for X2 handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9420
diff changeset
   992
  m_dlBandwidth = 6;
5107601b7a75 added S1 path switch + S11 modify bearer for X2 handover
Nicola Baldo <nbaldo@cttc.es>
parents: 9420
diff changeset
   993
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   994
  m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   995
  m_downlinkSpectrumPhy->GetChannel ()->AddRx (m_downlinkSpectrumPhy);  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   996
  
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   997
  m_dlConfigured = false;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
   998
  m_ulConfigured = false;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   999
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1000
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1001
void
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1002
LteUePhy::DoSetDlBandwidth (uint8_t dlBandwidth)
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1003
{
9420
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1004
  NS_LOG_FUNCTION (this << (uint32_t) dlBandwidth);
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1005
  if (m_dlBandwidth != dlBandwidth)
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1006
    {
9420
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1007
      m_dlBandwidth = dlBandwidth;
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1008
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1009
      int Type0AllocationRbg[4] = {
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1010
        10,     // RGB size 1
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1011
        26,     // RGB size 2
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1012
        63,     // RGB size 3
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1013
        110     // RGB size 4
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1014
      };  // see table 7.1.6.1-1 of 36.213
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1015
      for (int i = 0; i < 4; i++)
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1016
        {
9420
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1017
          if (dlBandwidth < Type0AllocationRbg[i])
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1018
            {
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1019
              m_rbgSize = i + 1;
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1020
              break;
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1021
            }
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1022
        }
9420
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1023
  
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1024
      Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1025
      m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
cd49c7790894 X2 handover working on the control plane
Nicola Baldo <nbaldo@cttc.es>
parents: 9414
diff changeset
  1026
      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
  1027
    }
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1028
  m_dlConfigured = true;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1029
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1030
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1031
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1032
void 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1033
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
  1034
{
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1035
  m_ulEarfcn = ulEarfcn;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1036
  m_ulBandwidth = ulBandwidth;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1037
  m_ulConfigured = true;
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1038
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1039
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1040
 
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1041
void
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1042
LteUePhy::DoSetRnti (uint16_t rnti)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1043
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1044
  NS_LOG_FUNCTION (this << rnti);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1045
  m_rnti = rnti;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1046
}
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1047
 
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8737
diff changeset
  1048
void
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1049
LteUePhy::DoSetTransmissionMode (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1050
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1051
  NS_LOG_FUNCTION (this << (uint16_t)txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1052
  m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1053
  m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1054
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1055
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1056
void
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
  1057
LteUePhy::DoSetSrsConfigurationIndex (uint16_t srcCi)
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1058
{
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
  1059
  NS_LOG_FUNCTION (this << srcCi);
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
  1060
  m_srsPeriodicity = GetSrsPeriodicity (srcCi);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1061
  m_srsSubframeOffset = GetSrsSubframeOffset (srcCi);
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1062
  m_srsConfigured = true;
9469
28a7b04a0b11 removed spurious LteUePhy::m_enbCellId; fixed bug in LteEnbRrc::GetNewSrsConfigurationIndex ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9461
diff changeset
  1063
9569
6593186d50dd zero SRS guard time since we use static SRS periodicity now
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
  1064
  // a guard time is needed for the case where the SRS periodicity is changed dynamically at run time
6593186d50dd zero SRS guard time since we use static SRS periodicity now
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
  1065
  // if we use a static one, we can have a 0ms guard time
6593186d50dd zero SRS guard time since we use static SRS periodicity now
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
  1066
  m_srsStartTime = Simulator::Now () + MilliSeconds (0);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9347
diff changeset
  1067
  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
  1068
}
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1069
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1070
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1071
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1072
LteUePhy::SetTxMode1Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1073
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1074
  SetTxModeGain (1, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1075
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1076
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1077
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1078
LteUePhy::SetTxMode2Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1079
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1080
  SetTxModeGain (2, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1081
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1082
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1083
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1084
LteUePhy::SetTxMode3Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1085
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1086
  SetTxModeGain (3, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1087
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1088
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1089
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1090
LteUePhy::SetTxMode4Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1091
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1092
  SetTxModeGain (4, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1093
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1094
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1095
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1096
LteUePhy::SetTxMode5Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1097
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1098
  SetTxModeGain (5, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1099
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1100
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1101
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1102
LteUePhy::SetTxMode6Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1103
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1104
  SetTxModeGain (6, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1105
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1106
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1107
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1108
LteUePhy::SetTxMode7Gain (double gain)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1109
{
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1110
  SetTxModeGain (7, gain);
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1111
}
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1112
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1113
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1114
void
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1115
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
  1116
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1117
  NS_LOG_FUNCTION (this << gain);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1118
  // 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
  1119
  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
  1120
  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
  1121
    {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1122
      m_txModeGain.resize (txMode);
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1123
    }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1124
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1125
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1126
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1127
  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
  1128
    {
8725
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1129
      if (i==txMode-1)
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1130
        {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1131
          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
  1132
        }
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1133
      else
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1134
        {
e8df5f68c35e Update SetTxModeXGain for reducing the copy-and-paste code
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8720
diff changeset
  1135
          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
  1136
        }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1137
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1138
  // 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
  1139
  m_downlinkSpectrumPhy->SetTxModeGain (txMode, gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1140
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1141
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1142
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1143
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1144
void
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1145
LteUePhy::ReceiveLteDlHarqFeedback (DlInfoListElement_s m)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1146
{
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1147
  NS_LOG_FUNCTION (this);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1148
  // generate feedback to eNB and send it through ideal PUCCH
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1149
  Ptr<DlHarqFeedbackLteControlMessage> msg = Create<DlHarqFeedbackLteControlMessage> ();
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1150
  msg->SetDlHarqFeedback (m);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1151
  SetControlMessages (msg);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1152
}
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1153
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1154
void
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1155
LteUePhy::SetHarqPhyModule (Ptr<LteHarqPhy> harq)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1156
{
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1157
  m_harqPhyModule = harq;
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1158
}
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1159
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9347
diff changeset
  1160
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1161
} // namespace ns3