src/lte/model/lte-spectrum-phy.cc
author Tom Henderson <tomh@tomh.org>
Mon, 04 Jan 2016 14:11:51 -0800
changeset 11800 bd9c9abd5d6e
parent 11577 0210ca11dad1
permissions -rw-r--r--
merge to ns-3-dev@11799:f410a3b3825b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Mileti? <rivanvx@gmail.com>
parents: 7177
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
/*
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
     3
 * Copyright (c) 2009, 2011 CTTC
6705
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: Nicola Baldo <nbaldo@cttc.es>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    19
 *         Giuseppe Piro  <g.piro@poliba.it>
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
    20
 *         Marco Miozzo <marco.miozzo@cttc.es> (add physical error model)
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    24
#include <ns3/object-factory.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    25
#include <ns3/log.h>
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Mileti? <rivanvx@gmail.com>
parents: 9057
diff changeset
    26
#include <cmath>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    27
#include <ns3/simulator.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    28
#include <ns3/trace-source-accessor.h>
7836
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
    29
#include <ns3/antenna-model.h>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    30
#include "lte-spectrum-phy.h"
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
    31
#include "lte-spectrum-signal-parameters.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    32
#include "lte-net-device.h"
8462
cf6a48994db5 renamed LteMacTag --> LteRadioBearerTag
Nicola Baldo <nbaldo@cttc.es>
parents: 8339
diff changeset
    33
#include "lte-radio-bearer-tag.h"
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
    34
#include "lte-chunk-processor.h"
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
    35
#include "lte-phy-tag.h"
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
    36
#include <ns3/lte-mi-error-model.h>
8538
fbd322b7d863 merge with PEM and solve merge errors
mmiozzo
parents: 8506 8534
diff changeset
    37
#include <ns3/lte-radio-bearer-tag.h>
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
    38
#include <ns3/boolean.h>
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    39
#include <ns3/double.h>
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
    40
#include <ns3/config.h>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    41
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    42
namespace ns3 {
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    43
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10892
diff changeset
    44
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    45
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    46
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    47
// duration of SRS portion of UL subframe  
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    48
// = 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: 9043
diff changeset
    49
static const Time UL_SRS_DURATION = NanoSeconds (71429 -1);  
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    50
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    51
// duration of the control portion of a subframe
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    52
// = 0.001 / 14 * 3 (ctrl fixed to 3 symbols) -1ns as margin to avoid overlapping simulator events
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    53
static const Time DL_CTRL_DURATION = NanoSeconds (214286 -1);
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    54
10680
ace43d9baa17 make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents: 10652
diff changeset
    55
static const double EffectiveCodingRate[29] = {
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    56
  0.08,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    57
  0.1,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    58
  0.11,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    59
  0.15,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    60
  0.19,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    61
  0.24,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    62
  0.3,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    63
  0.37,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    64
  0.44,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    65
  0.51,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    66
  0.3,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    67
  0.33,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    68
  0.37,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    69
  0.42,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    70
  0.48,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    71
  0.54,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    72
  0.6,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    73
  0.43,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    74
  0.45,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    75
  0.5,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    76
  0.55,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    77
  0.6,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    78
  0.65,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    79
  0.7,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    80
  0.75,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    81
  0.8,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    82
  0.85,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    83
  0.89,
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    84
  0.92
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    85
};
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
    86
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    87
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    88
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    89
  
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
    90
TbId_t::TbId_t ()
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    91
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    92
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    93
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
    94
TbId_t::TbId_t (const uint16_t a, const uint8_t b)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    95
: m_rnti (a),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    96
  m_layer (b)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    97
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    98
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    99
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   100
bool
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
   101
operator == (const TbId_t &a, const TbId_t &b)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   102
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   103
  return ( (a.m_rnti == b.m_rnti) && (a.m_layer == b.m_layer) );
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   104
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   105
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   106
bool
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
   107
operator < (const TbId_t& a, const TbId_t& b)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   108
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   109
  return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_layer < b.m_layer) ) );
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   110
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   111
10652
dc18deba4502 [doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10410
diff changeset
   112
NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   113
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   114
LteSpectrumPhy::LteSpectrumPhy ()
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   115
  : m_state (IDLE),
10288
ea6c9b15169c Attempt to initial synchronization, cell search, MIB and SIB1
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10063
diff changeset
   116
    m_cellId (0),
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   117
  m_transmissionMode (0),
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   118
  m_layersNum (1)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   119
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
   120
  NS_LOG_FUNCTION (this);
8987
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
   121
  m_random = CreateObject<UniformRandomVariable> ();
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
   122
  m_random->SetAttribute ("Min", DoubleValue (0.0));
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
   123
  m_random->SetAttribute ("Max", DoubleValue (1.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: 8726
diff changeset
   124
  m_interferenceData = CreateObject<LteInterference> ();
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: 8726
diff changeset
   125
  m_interferenceCtrl = CreateObject<LteInterference> ();
9057
227b3882f459 merge ns-3-lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9053 8987
diff changeset
   126
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   127
  for (uint8_t i = 0; i < 7; i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   128
    {
8724
b92bff65c4fd Udate default values of txMode gain to 1.0 (linear of 0 dB)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8718
diff changeset
   129
      m_txModeGain.push_back (1.0);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   130
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   131
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   132
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   133
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   134
LteSpectrumPhy::~LteSpectrumPhy ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   135
{
7924
3a44452d0dad made LteInterference an Object and fixed more disposals
Nicola Baldo <nbaldo@cttc.es>
parents: 7913
diff changeset
   136
  NS_LOG_FUNCTION (this);
8511
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
   137
  m_expectedTbs.clear ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   138
  m_txModeGain.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   139
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   140
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   141
void LteSpectrumPhy::DoDispose ()
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   142
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
   143
  NS_LOG_FUNCTION (this);
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   144
  m_channel = 0;
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   145
  m_mobility = 0;
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   146
  m_device = 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: 8726
diff changeset
   147
  m_interferenceData->Dispose ();
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: 8726
diff changeset
   148
  m_interferenceData = 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: 8726
diff changeset
   149
  m_interferenceCtrl->Dispose ();
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: 8726
diff changeset
   150
  m_interferenceCtrl = 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: 8726
diff changeset
   151
  m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
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: 8726
diff changeset
   152
  m_ltePhyRxDataEndOkCallback    = MakeNullCallback< void, Ptr<Packet> >  ();
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: 8726
diff changeset
   153
  m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
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: 8726
diff changeset
   154
  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   155
  m_ltePhyDlHarqFeedbackCallback = MakeNullCallback< void, DlInfoListElement_s > ();
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   156
  m_ltePhyUlHarqFeedbackCallback = MakeNullCallback< void, UlInfoListElement_s > ();
9996
62697fe2165d Bug-fix LteUePhy UE Measurements PSS storage by introducing PssElement struct
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9983
diff changeset
   157
  m_ltePhyRxPssCallback = MakeNullCallback< void, uint16_t, Ptr<SpectrumValue> > ();
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
   158
  SpectrumPhy::DoDispose ();
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   159
} 
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   160
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   161
std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   162
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   163
  switch (s)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   164
    {
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   165
    case LteSpectrumPhy::IDLE:
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   166
      os << "IDLE";
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   167
      break;
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   168
    case LteSpectrumPhy::RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   169
      os << "RX_DATA";
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   170
      break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   171
    case LteSpectrumPhy::RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   172
      os << "RX_DL_CTRL";
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   173
      break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   174
    case LteSpectrumPhy::TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   175
      os << "TX_DATA";
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   176
      break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   177
    case LteSpectrumPhy::TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   178
      os << "TX_DL_CTRL";
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   179
      break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   180
    case LteSpectrumPhy::TX_UL_SRS:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   181
      os << "TX_UL_SRS";
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   182
      break;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   183
    default:
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   184
      os << "UNKNOWN";
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   185
      break;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   186
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   187
  return os;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   188
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   189
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   190
TypeId
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   191
LteSpectrumPhy::GetTypeId (void)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   192
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   193
  static TypeId tid = TypeId ("ns3::LteSpectrumPhy")
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   194
    .SetParent<SpectrumPhy> ()
11274
609de51c9b88 SetGroupName for lte module
Mohit Goyal <mohit.bits2011@gmail.com>
parents: 11272
diff changeset
   195
    .SetGroupName("Lte")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   196
    .AddTraceSource ("TxStart",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   197
                     "Trace fired when a new transmission is started",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   198
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyTxStartTrace),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   199
                     "ns3::PacketBurst::TracedCallback")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   200
    .AddTraceSource ("TxEnd",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   201
                     "Trace fired when a previosuly started transmission is finished",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   202
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyTxEndTrace),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   203
                     "ns3::PacketBurst::TracedCallback")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   204
    .AddTraceSource ("RxStart",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   205
                     "Trace fired when the start of a signal is detected",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   206
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxStartTrace),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   207
                     "ns3::PacketBurst::TracedCallback")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   208
    .AddTraceSource ("RxEndOk",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   209
                     "Trace fired when a previosuly started RX terminates successfully",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   210
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndOkTrace),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   211
                     "ns3::Packet::TracedCallback")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   212
    .AddTraceSource ("RxEndError",
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   213
                     "Trace fired when a previosuly started RX terminates with an error",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   214
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndErrorTrace),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   215
                     "ns3::Packet::TracedCallback")
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   216
    .AddAttribute ("DataErrorModelEnabled",
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   217
                    "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   218
                    BooleanValue (true),
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   219
                   MakeBooleanAccessor (&LteSpectrumPhy::m_dataErrorModelEnabled),
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   220
                    MakeBooleanChecker ())
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   221
    .AddAttribute ("CtrlErrorModelEnabled",
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   222
                    "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   223
                    BooleanValue (true),
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   224
                    MakeBooleanAccessor (&LteSpectrumPhy::m_ctrlErrorModelEnabled),
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   225
                    MakeBooleanChecker ())
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   226
    .AddTraceSource ("DlPhyReception",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   227
                     "DL reception PHY layer statistics.",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   228
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_dlPhyReception),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   229
                     "ns3::PhyReceptionStatParameters::TracedCallback")
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   230
    .AddTraceSource ("UlPhyReception",
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   231
                     "DL reception PHY layer statistics.",
11085
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   232
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_ulPhyReception),
6e4d08656d7c TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
   233
                     "ns3::PhyReceptionStatParameters::TracedCallback")
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   234
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   235
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   236
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   237
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   238
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   239
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   240
Ptr<NetDevice>
11577
0210ca11dad1 GetDevice() should be const.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11399
diff changeset
   241
LteSpectrumPhy::GetDevice () const
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   242
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   243
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   244
  return m_device;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   245
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   246
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   247
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   248
Ptr<MobilityModel>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   249
LteSpectrumPhy::GetMobility ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   250
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   251
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   252
  return m_mobility;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   253
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   254
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   255
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   256
void
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   257
LteSpectrumPhy::SetDevice (Ptr<NetDevice> d)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   258
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   259
  NS_LOG_FUNCTION (this << d);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   260
  m_device = d;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   261
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   262
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   263
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   264
void
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   265
LteSpectrumPhy::SetMobility (Ptr<MobilityModel> m)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   266
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   267
  NS_LOG_FUNCTION (this << m);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   268
  m_mobility = m;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   269
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   270
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   271
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   272
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   273
LteSpectrumPhy::SetChannel (Ptr<SpectrumChannel> c)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   274
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   275
  NS_LOG_FUNCTION (this << c);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   276
  m_channel = c;
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
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   279
Ptr<SpectrumChannel> 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   280
LteSpectrumPhy::GetChannel ()
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   281
{
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   282
  return m_channel;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   283
}
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   284
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   285
Ptr<const SpectrumModel>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   286
LteSpectrumPhy::GetRxSpectrumModel () const
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   287
{
8693
478733ab87b7 MultiModelSpectrumChannel working with LTE
Nicola Baldo <nbaldo@cttc.es>
parents: 8538
diff changeset
   288
  return m_rxSpectrumModel;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   289
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   290
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   291
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   292
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   293
LteSpectrumPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   294
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   295
  NS_LOG_FUNCTION (this << txPsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   296
  NS_ASSERT (txPsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   297
  m_txPsd = txPsd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   298
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   299
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   300
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   301
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   302
LteSpectrumPhy::SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   303
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   304
  NS_LOG_FUNCTION (this << noisePsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   305
  NS_ASSERT (noisePsd);
8693
478733ab87b7 MultiModelSpectrumChannel working with LTE
Nicola Baldo <nbaldo@cttc.es>
parents: 8538
diff changeset
   306
  m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
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: 8726
diff changeset
   307
  m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
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: 8726
diff changeset
   308
  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   309
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   310
9579
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   311
  
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   312
void 
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   313
LteSpectrumPhy::Reset ()
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   314
{
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   315
  NS_LOG_FUNCTION (this);
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   316
  m_cellId = 0;
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   317
  m_state = IDLE;
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   318
  m_transmissionMode = 0;
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   319
  m_layersNum = 1;
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   320
  m_endTxEvent.Cancel ();
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   321
  m_endRxDataEvent.Cancel ();
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   322
  m_endRxDlCtrlEvent.Cancel ();
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   323
  m_endRxUlSrsEvent.Cancel ();
9581
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   324
  m_rxControlMessageList.clear ();
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   325
  m_expectedTbs.clear ();
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   326
  m_txControlMessageList.clear ();
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   327
  m_rxPacketBurstList.clear ();
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   328
  m_txPacketBurst = 0;
d1ad2deb4a04 added missing reinitializations to LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9579
diff changeset
   329
  m_rxSpectrumModel = 0;
9579
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   330
}
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   331
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   332
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: 8726
diff changeset
   333
void
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: 8726
diff changeset
   334
LteSpectrumPhy::SetLtePhyRxDataEndErrorCallback (LtePhyRxDataEndErrorCallback c)
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: 8726
diff changeset
   335
{
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: 8726
diff changeset
   336
  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: 8726
diff changeset
   337
  m_ltePhyRxDataEndErrorCallback = c;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   338
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   339
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   340
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   341
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: 8726
diff changeset
   342
LteSpectrumPhy::SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c)
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);
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: 8726
diff changeset
   345
  m_ltePhyRxDataEndOkCallback = c;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   346
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   347
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: 8726
diff changeset
   348
void
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: 8726
diff changeset
   349
LteSpectrumPhy::SetLtePhyRxCtrlEndOkCallback (LtePhyRxCtrlEndOkCallback c)
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: 8726
diff changeset
   350
{
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: 8726
diff changeset
   351
  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: 8726
diff changeset
   352
  m_ltePhyRxCtrlEndOkCallback = c;
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: 8726
diff changeset
   353
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   354
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   355
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: 8726
diff changeset
   356
LteSpectrumPhy::SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   357
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   358
  NS_LOG_FUNCTION (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: 8726
diff changeset
   359
  m_ltePhyRxCtrlEndErrorCallback = c;
6705
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
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   362
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   363
void
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   364
LteSpectrumPhy::SetLtePhyRxPssCallback (LtePhyRxPssCallback c)
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   365
{
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   366
  NS_LOG_FUNCTION (this);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   367
  m_ltePhyRxPssCallback = c;
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   368
}
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   369
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   370
void
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   371
LteSpectrumPhy::SetLtePhyDlHarqFeedbackCallback (LtePhyDlHarqFeedbackCallback c)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   372
{
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   373
  NS_LOG_FUNCTION (this);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   374
  m_ltePhyDlHarqFeedbackCallback = c;
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   375
}
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   376
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   377
void
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   378
LteSpectrumPhy::SetLtePhyUlHarqFeedbackCallback (LtePhyUlHarqFeedbackCallback c)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   379
{
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   380
  NS_LOG_FUNCTION (this);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   381
  m_ltePhyUlHarqFeedbackCallback = c;
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   382
}
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   383
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: 8726
diff changeset
   384
7836
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   385
Ptr<AntennaModel>
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   386
LteSpectrumPhy::GetRxAntenna ()
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   387
{
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   388
  return m_antenna;
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   389
}
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   390
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   391
void
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   392
LteSpectrumPhy::SetAntenna (Ptr<AntennaModel> a)
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   393
{
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   394
  NS_LOG_FUNCTION (this << a);
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   395
  m_antenna = a;
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   396
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   397
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   398
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   399
LteSpectrumPhy::SetState (State newState)
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
  ChangeState (newState);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   402
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   403
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   404
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   405
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   406
LteSpectrumPhy::ChangeState (State newState)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   407
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   408
  NS_LOG_LOGIC (this << " state: " << m_state << " -> " << newState);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   409
  m_state = newState;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   410
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   411
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   412
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   413
void
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   414
LteSpectrumPhy::SetHarqPhyModule (Ptr<LteHarqPhy> harq)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   415
{
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   416
  m_harqPhyModule = harq;
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   417
}
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   418
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   419
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   420
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   421
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   422
bool
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   423
LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, Time duration)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   424
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   425
  NS_LOG_FUNCTION (this << pb);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   426
  NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
   427
  
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   428
  m_phyTxStartTrace (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: 8726
diff changeset
   429
  
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   430
  switch (m_state)
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   431
    {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   432
    case RX_DATA:
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   433
    case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   434
    case RX_UL_SRS:
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   435
      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   436
      break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   437
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   438
    case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   439
    case TX_DL_CTRL:      
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   440
    case TX_UL_SRS:
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   441
      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   442
      break;
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: 8726
diff changeset
   443
      
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   444
    case IDLE:
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: 8726
diff changeset
   445
    {
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: 8726
diff changeset
   446
      /*
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: 8726
diff changeset
   447
      m_txPsd must be setted by the device, according to
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: 8726
diff changeset
   448
      (i) the available subchannel for transmission
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: 8726
diff changeset
   449
      (ii) the power transmission
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: 8726
diff changeset
   450
      */
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: 8726
diff changeset
   451
      NS_ASSERT (m_txPsd);
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: 8726
diff changeset
   452
      m_txPacketBurst = pb;
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: 8726
diff changeset
   453
      
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: 8726
diff changeset
   454
      // we need to convey some PHY meta information to the receiver
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: 8726
diff changeset
   455
      // to be used for simulation purposes (e.g., the CellId). 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: 8726
diff changeset
   456
      // is done by setting the ctrlMsgList parameter of
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: 8726
diff changeset
   457
      // LteSpectrumSignalParametersDataFrame
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   458
      ChangeState (TX_DATA);
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: 8726
diff changeset
   459
      NS_ASSERT (m_channel);
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: 8726
diff changeset
   460
      Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   461
      txParams->duration = duration;
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   462
      txParams->txPhy = GetObject<SpectrumPhy> ();
8506
f9616c9094a5 integrated AntennaModel with LTE, including system test
Nicola Baldo <nbaldo@cttc.es>
parents: 8505
diff changeset
   463
      txParams->txAntenna = m_antenna;
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   464
      txParams->psd = m_txPsd;
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   465
      txParams->packetBurst = 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: 8726
diff changeset
   466
      txParams->ctrlMsgList = ctrlMsgList;
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: 8726
diff changeset
   467
      txParams->cellId = m_cellId;
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   468
      m_channel->StartTx (txParams);
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   469
      m_endTxEvent = Simulator::Schedule (duration, &LteSpectrumPhy::EndTxData, 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: 8726
diff changeset
   470
    }
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: 8726
diff changeset
   471
    return false;
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: 8726
diff changeset
   472
    break;
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: 8726
diff changeset
   473
    
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   474
    default:
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: 8726
diff changeset
   475
      NS_FATAL_ERROR ("unknown state");
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   476
      return true;
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   477
      break;
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: 8726
diff changeset
   478
  }
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: 8726
diff changeset
   479
}
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: 8726
diff changeset
   480
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: 8726
diff changeset
   481
bool
10292
d8c887780c32 Reverted changes from parent revision 9974
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10287
diff changeset
   482
LteSpectrumPhy::StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgList, bool pss)
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: 8726
diff changeset
   483
{
10292
d8c887780c32 Reverted changes from parent revision 9974
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10287
diff changeset
   484
  NS_LOG_FUNCTION (this << " PSS " << (uint16_t)pss);
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: 8726
diff changeset
   485
  NS_LOG_LOGIC (this << " state: " << m_state);
10292
d8c887780c32 Reverted changes from parent revision 9974
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10287
diff changeset
   486
  
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: 8726
diff changeset
   487
  switch (m_state)
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: 8726
diff changeset
   488
  {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   489
    case RX_DATA:
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   490
    case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   491
    case RX_UL_SRS:
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: 8726
diff changeset
   492
      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
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: 8726
diff changeset
   493
      break;
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: 8726
diff changeset
   494
      
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   495
    case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   496
    case TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   497
    case TX_UL_SRS:
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: 8726
diff changeset
   498
      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid 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: 8726
diff changeset
   499
      break;
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: 8726
diff changeset
   500
      
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: 8726
diff changeset
   501
    case IDLE:
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: 8726
diff changeset
   502
    {
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: 8726
diff changeset
   503
      /*
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: 8726
diff changeset
   504
      m_txPsd must be setted by the device, according to
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: 8726
diff changeset
   505
      (i) the available subchannel for transmission
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: 8726
diff changeset
   506
      (ii) the power transmission
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: 8726
diff changeset
   507
      */
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: 8726
diff changeset
   508
      NS_ASSERT (m_txPsd);
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: 8726
diff changeset
   509
      
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: 8726
diff changeset
   510
      // we need to convey some PHY meta information to the receiver
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: 8726
diff changeset
   511
      // to be used for simulation purposes (e.g., the CellId). 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: 8726
diff changeset
   512
      // is done by setting the cellId parameter of
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: 8726
diff changeset
   513
      // LteSpectrumSignalParametersDlCtrlFrame
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   514
      ChangeState (TX_DL_CTRL);
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: 8726
diff changeset
   515
      NS_ASSERT (m_channel);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   516
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: 8726
diff changeset
   517
      Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   518
      txParams->duration = DL_CTRL_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: 8726
diff changeset
   519
      txParams->txPhy = GetObject<SpectrumPhy> ();
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: 8726
diff changeset
   520
      txParams->txAntenna = m_antenna;
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: 8726
diff changeset
   521
      txParams->psd = m_txPsd;
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: 8726
diff changeset
   522
      txParams->cellId = m_cellId;
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
   523
      txParams->pss = pss;
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: 8726
diff changeset
   524
      txParams->ctrlMsgList = ctrlMsgList;
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: 8726
diff changeset
   525
      m_channel->StartTx (txParams);
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   526
      m_endTxEvent = Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTxDlCtrl, this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   527
    }
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: 8726
diff changeset
   528
    return false;
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: 8726
diff changeset
   529
    break;
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: 8726
diff changeset
   530
    
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   531
    default:
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: 8726
diff changeset
   532
      NS_FATAL_ERROR ("unknown state");
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: 8726
diff changeset
   533
      return true;
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: 8726
diff changeset
   534
      break;
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: 8726
diff changeset
   535
  }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   536
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   537
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   538
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: 8726
diff changeset
   539
bool
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: 8726
diff changeset
   540
LteSpectrumPhy::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: 8726
diff changeset
   541
{
9250
97d61b6d88e0 remove invalid argument
Tom Henderson <tomh@tomh.org>
parents: 9202
diff changeset
   542
  NS_LOG_FUNCTION (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: 8726
diff changeset
   543
  NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
   544
  
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: 8726
diff changeset
   545
  switch (m_state)
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   546
    {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   547
    case RX_DATA:
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   548
    case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   549
    case RX_UL_SRS:
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: 8726
diff changeset
   550
      NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
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: 8726
diff changeset
   551
      break;
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: 8726
diff changeset
   552
      
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   553
    case TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   554
    case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   555
    case TX_UL_SRS:
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: 8726
diff changeset
   556
      NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid 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: 8726
diff changeset
   557
      break;
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: 8726
diff changeset
   558
      
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: 8726
diff changeset
   559
    case IDLE:
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: 8726
diff changeset
   560
    {
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: 8726
diff changeset
   561
      /*
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   562
      m_txPsd must be setted by the device, according to
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: 8726
diff changeset
   563
      (i) the available subchannel for transmission
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: 8726
diff changeset
   564
      (ii) the power transmission
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: 8726
diff changeset
   565
      */
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: 8726
diff changeset
   566
      NS_ASSERT (m_txPsd);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   567
      NS_LOG_LOGIC (this << " m_txPsd: " << *m_txPsd);
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: 8726
diff changeset
   568
      
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: 8726
diff changeset
   569
      // we need to convey some PHY meta information to the receiver
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: 8726
diff changeset
   570
      // to be used for simulation purposes (e.g., the CellId). 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: 8726
diff changeset
   571
      // is done by setting the cellId parameter of 
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: 8726
diff changeset
   572
      // LteSpectrumSignalParametersDlCtrlFrame
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   573
      ChangeState (TX_UL_SRS);
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: 8726
diff changeset
   574
      NS_ASSERT (m_channel);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   575
      Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   576
      txParams->duration = UL_SRS_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: 8726
diff changeset
   577
      txParams->txPhy = GetObject<SpectrumPhy> ();
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: 8726
diff changeset
   578
      txParams->txAntenna = m_antenna;
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: 8726
diff changeset
   579
      txParams->psd = m_txPsd;
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: 8726
diff changeset
   580
      txParams->cellId = m_cellId;
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: 8726
diff changeset
   581
      m_channel->StartTx (txParams);
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   582
      m_endTxEvent = Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTxUlSrs, 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: 8726
diff changeset
   583
    }
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: 8726
diff changeset
   584
    return false;
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: 8726
diff changeset
   585
    break;
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: 8726
diff changeset
   586
    
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: 8726
diff changeset
   587
    default:
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: 8726
diff changeset
   588
      NS_FATAL_ERROR ("unknown state");
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: 8726
diff changeset
   589
      return true;
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: 8726
diff changeset
   590
      break;
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: 8726
diff changeset
   591
  }
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: 8726
diff changeset
   592
}
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: 8726
diff changeset
   593
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   594
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: 8726
diff changeset
   595
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   596
void
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   597
LteSpectrumPhy::EndTxData ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   598
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   599
  NS_LOG_FUNCTION (this);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   600
  NS_LOG_LOGIC (this << " state: " << m_state);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   601
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   602
  NS_ASSERT (m_state == TX_DATA);
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   603
  m_phyTxEndTrace (m_txPacketBurst);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   604
  m_txPacketBurst = 0;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   605
  ChangeState (IDLE);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   606
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   607
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   608
void
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   609
LteSpectrumPhy::EndTxDlCtrl ()
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   610
{
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   611
  NS_LOG_FUNCTION (this);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   612
  NS_LOG_LOGIC (this << " state: " << m_state);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   613
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   614
  NS_ASSERT (m_state == TX_DL_CTRL);
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   615
  NS_ASSERT (m_txPacketBurst == 0);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   616
  ChangeState (IDLE);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   617
}
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   618
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   619
void
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   620
LteSpectrumPhy::EndTxUlSrs ()
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   621
{
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   622
  NS_LOG_FUNCTION (this);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   623
  NS_LOG_LOGIC (this << " state: " << m_state);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   624
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   625
  NS_ASSERT (m_state == TX_UL_SRS);
11269
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   626
  NS_ASSERT (m_txPacketBurst == 0);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   627
  ChangeState (IDLE);
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   628
}
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   629
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   630
db337450b114 split LteSpectrumPhy::EndTx event into Data, DlCtrl, UlSrs
Nicola Baldo <nbaldo@cttc.es>
parents: 11085
diff changeset
   631
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   632
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   633
void
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   634
LteSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumRxParams)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   635
{
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   636
  NS_LOG_FUNCTION (this << spectrumRxParams);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   637
  NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
   638
  
8339
bfa05e51eecf merge ns-3-lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 8253 7581
diff changeset
   639
  Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
bfa05e51eecf merge ns-3-lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 8253 7581
diff changeset
   640
  Time duration = spectrumRxParams->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: 8726
diff changeset
   641
  
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   642
  // the device might start RX only if the signal is of a type
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   643
  // understood by this device - in this case, an LTE signal.
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: 8726
diff changeset
   644
  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   645
  Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   646
  Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
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: 8726
diff changeset
   647
  if (lteDataRxParams != 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: 8726
diff changeset
   648
    {
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: 8726
diff changeset
   649
      m_interferenceData->AddSignal (rxPsd, duration);
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: 8726
diff changeset
   650
      StartRxData (lteDataRxParams);
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: 8726
diff changeset
   651
    }
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   652
  else if (lteDlCtrlRxParams!=0)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   653
    {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   654
      m_interferenceCtrl->AddSignal (rxPsd, duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   655
      StartRxDlCtrl (lteDlCtrlRxParams);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   656
    }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   657
  else if (lteUlSrsRxParams!=0)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   658
    {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   659
      m_interferenceCtrl->AddSignal (rxPsd, duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   660
      StartRxUlSrs (lteUlSrsRxParams);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   661
    }
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: 8726
diff changeset
   662
  else
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   663
    {
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   664
      // other type of signal (could be 3G, GSM, whatever) -> interference
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   665
      m_interferenceData->AddSignal (rxPsd, duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   666
      m_interferenceCtrl->AddSignal (rxPsd, duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   667
    }    
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: 8726
diff changeset
   668
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   669
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: 8726
diff changeset
   670
void
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: 8726
diff changeset
   671
LteSpectrumPhy::StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params)
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: 8726
diff changeset
   672
{
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: 8726
diff changeset
   673
  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: 8726
diff changeset
   674
  switch (m_state)
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: 8726
diff changeset
   675
    {
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   676
      case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   677
      case TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   678
      case TX_UL_SRS:
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: 8726
diff changeset
   679
        NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
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: 8726
diff changeset
   680
        break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   681
      case RX_DL_CTRL:
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   682
        NS_FATAL_ERROR ("cannot RX Data while receiving control");
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   683
        break;
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: 8726
diff changeset
   684
      case IDLE:
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   685
      case RX_DATA:
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: 8726
diff changeset
   686
        // the behavior is similar when
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: 8726
diff changeset
   687
        // we're IDLE or RX because we can receive more signals
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: 8726
diff changeset
   688
        // simultaneously (e.g., at the eNB).
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: 8726
diff changeset
   689
        {
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: 8726
diff changeset
   690
          // To check if we're synchronized to this signal, we check
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: 8726
diff changeset
   691
          // for the CellId which is reported in the
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: 8726
diff changeset
   692
          //  LteSpectrumSignalParametersDataFrame
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: 8726
diff changeset
   693
          if (params->cellId  == m_cellId)
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: 8726
diff changeset
   694
            {
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: 8726
diff changeset
   695
              NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
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: 8726
diff changeset
   696
              if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
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: 8726
diff changeset
   697
                {
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: 8726
diff changeset
   698
                  NS_ASSERT (m_state == IDLE);
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: 8726
diff changeset
   699
                  // first transmission, i.e., we're IDLE and we
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: 8726
diff changeset
   700
                  // start RX
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: 8726
diff changeset
   701
                  m_firstRxStart = Simulator::Now ();
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: 8726
diff changeset
   702
                  m_firstRxDuration = params->duration;
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   703
                  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
9579
1f1a0bd0c009 added method LteSpectrumPhy::Reset ()
Nicola Baldo <nbaldo@cttc.es>
parents: 9562
diff changeset
   704
                  m_endRxDataEvent = Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, 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: 8726
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: 8726
diff changeset
   706
              else
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: 8726
diff changeset
   707
                {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   708
                  NS_ASSERT (m_state == RX_DATA);
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: 8726
diff changeset
   709
                  // sanity check: if there are multiple RX events, they
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: 8726
diff changeset
   710
                  // should occur at the same time and have the same
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: 8726
diff changeset
   711
                  // duration, otherwise the interference calculation
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: 8726
diff changeset
   712
                  // won't be correct
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: 8726
diff changeset
   713
                  NS_ASSERT ((m_firstRxStart == Simulator::Now ()) 
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: 8726
diff changeset
   714
                  && (m_firstRxDuration == params->duration));
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: 8726
diff changeset
   715
                }
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: 8726
diff changeset
   716
              
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   717
              ChangeState (RX_DATA);
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: 8726
diff changeset
   718
              if (params->packetBurst)
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: 8726
diff changeset
   719
                {
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: 8726
diff changeset
   720
                  m_rxPacketBurstList.push_back (params->packetBurst);
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: 8726
diff changeset
   721
                  m_interferenceData->StartRx (params->psd);
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: 8726
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: 8726
diff changeset
   723
                  m_phyRxStartTrace (params->packetBurst);
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: 8726
diff changeset
   724
                }
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: 8726
diff changeset
   725
                NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
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: 8726
diff changeset
   726
              m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
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: 8726
diff changeset
   727
              
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: 8726
diff changeset
   728
              NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
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: 8726
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: 8726
diff changeset
   730
          else
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: 8726
diff changeset
   731
            {
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: 8726
diff changeset
   732
              NS_LOG_LOGIC (this << " not in sync with this signal (cellId=" 
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: 8726
diff changeset
   733
              << params->cellId  << ", m_cellId=" << m_cellId << ")");
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: 8726
diff changeset
   734
            }
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: 8726
diff changeset
   735
        }
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: 8726
diff changeset
   736
        break;
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: 8726
diff changeset
   737
        
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: 8726
diff changeset
   738
        default:
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: 8726
diff changeset
   739
          NS_FATAL_ERROR ("unknown state");
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: 8726
diff changeset
   740
          break;
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: 8726
diff changeset
   741
      }
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: 8726
diff changeset
   742
      
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: 8726
diff changeset
   743
   NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
   744
}
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: 8726
diff changeset
   745
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: 8726
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: 8726
diff changeset
   747
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: 8726
diff changeset
   748
void
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   749
LteSpectrumPhy::StartRxDlCtrl (Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   750
{
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   751
  NS_LOG_FUNCTION (this);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   752
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   753
  // To check if we're synchronized to this signal, we check
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   754
  // for the CellId which is reported in the
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   755
  // LteSpectrumSignalParametersDlCtrlFrame
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   756
  uint16_t cellId;        
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   757
  NS_ASSERT (lteDlCtrlRxParams != 0);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   758
  cellId = lteDlCtrlRxParams->cellId;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   759
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   760
  switch (m_state)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   761
    {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   762
    case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   763
    case TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   764
    case TX_UL_SRS:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   765
    case RX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   766
    case RX_UL_SRS:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   767
      NS_FATAL_ERROR ("unexpected event in state " << m_state);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   768
      break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   769
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   770
    case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   771
    case IDLE:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   772
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   773
      // common code for the two states
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   774
      // check presence of PSS for UE measuerements
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   775
      if (lteDlCtrlRxParams->pss == true)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   776
        {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   777
          if (!m_ltePhyRxPssCallback.IsNull ())
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   778
              {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   779
                m_ltePhyRxPssCallback (cellId, lteDlCtrlRxParams->psd);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   780
              }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   781
        }   
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   782
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   783
      // differentiated code for the two states
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   784
      switch (m_state)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   785
        {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   786
        case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   787
          NS_ASSERT_MSG (m_cellId != cellId, "any other DlCtrl should be from a different cell");
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   788
          NS_LOG_LOGIC (this << " ignoring other DlCtrl (cellId=" 
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   789
                        << cellId  << ", m_cellId=" << m_cellId << ")");      
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   790
          break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   791
          
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   792
        case IDLE:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   793
          if (cellId  == m_cellId)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   794
            {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   795
              NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   796
              
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   797
              NS_ASSERT (m_rxControlMessageList.empty ());
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   798
              m_firstRxStart = Simulator::Now ();
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   799
              m_firstRxDuration = lteDlCtrlRxParams->duration;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   800
              NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteDlCtrlRxParams->duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   801
              
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   802
              // store the DCIs
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   803
              m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   804
              m_endRxDlCtrlEvent = Simulator::Schedule (lteDlCtrlRxParams->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   805
              ChangeState (RX_DL_CTRL);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   806
              m_interferenceCtrl->StartRx (lteDlCtrlRxParams->psd);            
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   807
            }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   808
          else
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   809
            {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   810
              NS_LOG_LOGIC (this << " not synchronizing with this signal (cellId=" 
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   811
                            << cellId  << ", m_cellId=" << m_cellId << ")");          
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   812
            }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   813
          break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   814
          
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   815
        default:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   816
          NS_FATAL_ERROR ("unexpected event in state " << m_state);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   817
          break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   818
        }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   819
      break; // case RX_DL_CTRL or IDLE
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   820
      
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   821
    default:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   822
      NS_FATAL_ERROR ("unknown state");
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   823
      break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   824
    }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   825
  
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   826
  NS_LOG_LOGIC (this << " state: " << m_state);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   827
}
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   828
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   829
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   830
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   831
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   832
void
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   833
LteSpectrumPhy::StartRxUlSrs (Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams)
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: 8726
diff changeset
   834
{
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: 8726
diff changeset
   835
  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: 8726
diff changeset
   836
  switch (m_state)
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   837
    {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   838
    case TX_DATA:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   839
    case TX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   840
    case TX_UL_SRS:
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: 8726
diff changeset
   841
      NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
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: 8726
diff changeset
   842
      break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   843
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   844
    case RX_DATA:
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   845
    case RX_DL_CTRL:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   846
      NS_FATAL_ERROR ("cannot RX SRS while receiving something else");
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   847
      break;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   848
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: 8726
diff changeset
   849
    case IDLE:
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   850
    case RX_UL_SRS:
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: 8726
diff changeset
   851
      // the behavior is similar when
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   852
      // we're IDLE or RX_UL_SRS because we can receive more signals
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   853
      // simultaneously at the eNB
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: 8726
diff changeset
   854
      {
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: 8726
diff changeset
   855
        // To check if we're synchronized to this signal, we check
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: 8726
diff changeset
   856
        // for the CellId which is reported in the
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: 8726
diff changeset
   857
        // LteSpectrumSignalParametersDlCtrlFrame
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: 8726
diff changeset
   858
        uint16_t cellId;
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   859
        cellId = lteUlSrsRxParams->cellId;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   860
        if (cellId  == m_cellId)
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   861
          {
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   862
            NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   863
            if (m_state == IDLE)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   864
              {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   865
                // first transmission, i.e., we're IDLE and we
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   866
                // start RX
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   867
                NS_ASSERT (m_rxControlMessageList.empty ());
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   868
                m_firstRxStart = Simulator::Now ();
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   869
                m_firstRxDuration = lteUlSrsRxParams->duration;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   870
                NS_LOG_LOGIC (this << " scheduling EndRx with delay " << lteUlSrsRxParams->duration);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   871
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   872
                m_endRxUlSrsEvent = Simulator::Schedule (lteUlSrsRxParams->duration, &LteSpectrumPhy::EndRxUlSrs, this);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   873
              }
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   874
            else if (m_state == RX_UL_SRS)
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   875
              {
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   876
                // sanity check: if there are multiple RX events, they
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   877
                // should occur at the same time and have the same
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   878
                // duration, otherwise the interference calculation
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   879
                // won't be correct
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   880
                NS_ASSERT ((m_firstRxStart == Simulator::Now ()) 
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   881
                           && (m_firstRxDuration == lteUlSrsRxParams->duration));
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   882
              }            
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   883
            ChangeState (RX_UL_SRS);
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   884
            m_interferenceCtrl->StartRx (lteUlSrsRxParams->psd);          
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: 8726
diff changeset
   885
          }
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: 8726
diff changeset
   886
        else
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: 8726
diff changeset
   887
          {
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   888
            NS_LOG_LOGIC (this << " not in sync with this signal (cellId=" 
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   889
                          << cellId  << ", m_cellId=" << m_cellId << ")");          
9035
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   890
          }
10292
d8c887780c32 Reverted changes from parent revision 9974
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10287
diff changeset
   891
      }
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: 8726
diff changeset
   892
      break;
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: 8726
diff changeset
   893
      
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   894
    default:
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   895
      NS_FATAL_ERROR ("unknown state");
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   896
      break;
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
   897
    }
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: 8726
diff changeset
   898
  
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: 8726
diff changeset
   899
  NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
   900
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   901
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   902
8514
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   903
void
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   904
LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr)
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   905
{
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   906
  NS_LOG_FUNCTION (this << sinr);
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   907
  m_sinrPerceived = sinr;
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   908
}
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   909
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   910
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   911
void
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   912
LteSpectrumPhy::AddExpectedTb (uint16_t  rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer, uint8_t harqId,uint8_t rv,  bool downlink)
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   913
{
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   914
  NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer << " rv " << (uint16_t)rv);
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
   915
  TbId_t tbId;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   916
  tbId.m_rnti = rnti;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   917
  tbId.m_layer = layer;
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   918
  expectedTbs_t::iterator it;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   919
  it = m_expectedTbs.find (tbId);
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   920
  if (it != m_expectedTbs.end ())
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   921
    {
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   922
      // migth be a TB of an unreceived packet (due to high progpalosses)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   923
      m_expectedTbs.erase (it);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   924
    }
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   925
  // insert new entry
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
   926
  tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, rv, 0.0, downlink, false, false};
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   927
  m_expectedTbs.insert (std::pair<TbId_t, tbInfo_t> (tbId,tbInfo));
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   928
}
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   929
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   930
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   931
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: 8726
diff changeset
   932
LteSpectrumPhy::EndRxData ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   933
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   934
  NS_LOG_FUNCTION (this);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   935
  NS_LOG_LOGIC (this << " state: " << m_state);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   936
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   937
  NS_ASSERT (m_state == RX_DATA);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   938
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   939
  // this will trigger CQI calculation and Error Model evaluation
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   940
  // as a side effect, the error model should update the error status of all TBs
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: 8726
diff changeset
   941
  m_interferenceData->EndRx ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   942
  NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
8511
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
   943
  NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
   944
  expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   945
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   946
  // apply transmission mode gain
8724
b92bff65c4fd Udate default values of txMode gain to 1.0 (linear of 0 dB)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8718
diff changeset
   947
  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   948
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   949
  m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   950
  
8511
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
   951
  while (itTb!=m_expectedTbs.end ())
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
   952
    {
9202
e3645afbe360 Bug-fix inhibit Error Model when receiving data frame with only control messages in LteSpectrumPhy::EndRxData
mmiozzo
parents: 9063
diff changeset
   953
      if ((m_dataErrorModelEnabled)&&(m_rxPacketBurstList.size ()>0)) // avoid to check for errors when there is no actual data transmitted
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   954
        {
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   955
          // retrieve HARQ info
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   956
          HarqProcessInfoList_t harqInfoList;
9353
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   957
          if ((*itTb).second.ndi == 0)
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   958
            {
9353
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   959
              // TB retxed: retrieve HARQ history
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   960
              uint16_t ulHarqId = 0;
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   961
              if ((*itTb).second.downlink)
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   962
                {
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   963
                  harqInfoList = m_harqPhyModule->GetHarqProcessInfoDl ((*itTb).second.harqProcessId, (*itTb).first.m_layer);
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   964
                }
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   965
              else
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   966
                {
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   967
                  harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl ((*itTb).first.m_rnti, ulHarqId);
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   968
                }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   969
            }
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   970
          TbStats_t tbStats = LteMiErrorModel::GetTbDecodificationStats (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs, harqInfoList);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
   971
          (*itTb).second.mi = tbStats.mi;
9353
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   972
          (*itTb).second.corrupt = m_random->GetValue () > tbStats.tbler ? false : true;
41d2e7b4ff68 Update LteMiErrorModel with BLER curves for HARQ retx ( MCS0 rv2 and rv3 still lacks)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9351
diff changeset
   973
          NS_LOG_DEBUG (this << "RNTI " << (*itTb).first.m_rnti << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " layer " << (uint16_t)(*itTb).first.m_layer << " TBLER " << tbStats.tbler << " corrupted " << (*itTb).second.corrupt);
9519
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   974
          // fire traces on DL/UL reception PHY stats
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   975
          PhyReceptionStatParameters params;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   976
          params.m_timestamp = Simulator::Now ().GetMilliSeconds ();
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   977
          params.m_cellId = m_cellId;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   978
          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: 9414
diff changeset
   979
          params.m_rnti = (*itTb).first.m_rnti;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   980
          params.m_txMode = m_transmissionMode;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   981
          params.m_layer =  (*itTb).first.m_layer;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   982
          params.m_mcs = (*itTb).second.mcs;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   983
          params.m_size = (*itTb).second.size;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   984
          params.m_rv = (*itTb).second.rv;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   985
          params.m_ndi = (*itTb).second.ndi;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   986
          params.m_correctness = (uint8_t)!(*itTb).second.corrupt;
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   987
          if ((*itTb).second.downlink)
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   988
            {
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   989
              // DL
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   990
              m_dlPhyReception (params);
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   991
            }
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   992
          else
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   993
            {
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   994
              // UL
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   995
              params.m_rv = harqInfoList.size ();
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   996
              m_ulPhyReception (params);
fc6e45584ef4 Add DL and UL PHY traces on transmission and reception statistics
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9414
diff changeset
   997
            }
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   998
       }
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   999
      
8511
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
  1000
      itTb++;
46046bbb2a5c Add info in LteSpectrumPhy on TB from DCI elaborated by LteEnbPhy and LteUePhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8339
diff changeset
  1001
    }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1002
    std::map <uint16_t, DlInfoListElement_s> harqDlInfoMap;
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1003
    for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin (); 
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1004
    i != m_rxPacketBurstList.end (); ++i)
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1005
      {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1006
        for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin (); j != (*i)->End (); ++j)
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1007
          {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1008
            // retrieve TB info of this packet 
8538
fbd322b7d863 merge with PEM and solve merge errors
mmiozzo
parents: 8506 8534
diff changeset
  1009
            LteRadioBearerTag tag;
fbd322b7d863 merge with PEM and solve merge errors
mmiozzo
parents: 8506 8534
diff changeset
  1010
            (*j)->PeekPacketTag (tag);
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1011
            TbId_t tbId;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1012
            tbId.m_rnti = tag.GetRnti ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1013
            tbId.m_layer = tag.GetLayer ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1014
            itTb = m_expectedTbs.find (tbId);
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1015
            NS_LOG_INFO (this << " Packet of " << tbId.m_rnti << " layer " <<  (uint16_t) tag.GetLayer ());
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1016
            if (itTb!=m_expectedTbs.end ())
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1017
              {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1018
                if (!(*itTb).second.corrupt)
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1019
                  {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1020
                    m_phyRxEndOkTrace (*j);
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1021
                
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: 8726
diff changeset
  1022
                    if (!m_ltePhyRxDataEndOkCallback.IsNull ())
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1023
                      {
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: 8726
diff changeset
  1024
                        m_ltePhyRxDataEndOkCallback (*j);
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1025
                      }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1026
                  }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1027
                else
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1028
                  {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1029
                    // TB received with errors
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1030
                    m_phyRxEndErrorTrace (*j);
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1031
                  }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1032
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1033
                // send HARQ feedback (if not already done for this TB)
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1034
                if (!(*itTb).second.harqFeedbackSent)
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1035
                  {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1036
                    (*itTb).second.harqFeedbackSent = true;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1037
                    if (!(*itTb).second.downlink)
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1038
                      {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1039
                        UlInfoListElement_s harqUlInfo;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1040
                        harqUlInfo.m_rnti = tbId.m_rnti;
9617
9e8cc31936f8 fix compilation warnings in optimized mode
Nicola Baldo <nbaldo@cttc.es>
parents: 9588
diff changeset
  1041
                        harqUlInfo.m_tpc = 0;
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1042
                        if ((*itTb).second.corrupt)
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1043
                          {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1044
                            harqUlInfo.m_receptionStatus = UlInfoListElement_s::NotOk;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1045
                            NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-NACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1046
                            m_harqPhyModule->UpdateUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1047
                          }
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1048
                        else
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1049
                          {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1050
                            harqUlInfo.m_receptionStatus = UlInfoListElement_s::Ok;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1051
                            NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " send UL-HARQ-ACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1052
                            m_harqPhyModule->ResetUlHarqProcessStatus (tbId.m_rnti, (*itTb).second.harqProcessId);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1053
                          }
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1054
                          if (!m_ltePhyUlHarqFeedbackCallback.IsNull ())
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1055
                            {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1056
                              m_ltePhyUlHarqFeedbackCallback (harqUlInfo);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1057
                            }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1058
                      }
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1059
                    else
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1060
                      {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1061
                        std::map <uint16_t, DlInfoListElement_s>::iterator itHarq = harqDlInfoMap.find (tbId.m_rnti);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1062
                        if (itHarq==harqDlInfoMap.end ())
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1063
                          {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1064
                            DlInfoListElement_s harqDlInfo;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1065
                            harqDlInfo.m_harqStatus.resize (m_layersNum, DlInfoListElement_s::NACK);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1066
                            harqDlInfo.m_rnti = tbId.m_rnti;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1067
                            harqDlInfo.m_harqProcessId = (*itTb).second.harqProcessId;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1068
                            if ((*itTb).second.corrupt)
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1069
                              {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1070
                                harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1071
                                NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " send DL-HARQ-NACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1072
                                m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1073
                              }
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1074
                            else
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1075
                              {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1076
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1077
                                harqDlInfo.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1078
                                NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itTb).second.size << " send DL-HARQ-ACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1079
                                m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1080
                              }
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1081
                            harqDlInfoMap.insert (std::pair <uint16_t, DlInfoListElement_s> (tbId.m_rnti, harqDlInfo));
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1082
                          }
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1083
                        else
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1084
                        {
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1085
                          if ((*itTb).second.corrupt)
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1086
                            {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1087
                              (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::NACK;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1088
                              NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " <<(uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-NACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1089
                              m_harqPhyModule->UpdateDlHarqProcessStatus ((*itTb).second.harqProcessId, tbId.m_layer, (*itTb).second.mi, (*itTb).second.size, (*itTb).second.size / EffectiveCodingRate [(*itTb).second.mcs]);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1090
                            }
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1091
                          else
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1092
                            {
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1093
                              NS_ASSERT_MSG (tbId.m_layer < (*itHarq).second.m_harqStatus.size (), " layer " << (uint16_t)tbId.m_layer);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1094
                              (*itHarq).second.m_harqStatus.at (tbId.m_layer) = DlInfoListElement_s::ACK;
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1095
                              NS_LOG_DEBUG (this << " RNTI " << tbId.m_rnti << " harqId " << (uint16_t)(*itTb).second.harqProcessId << " layer " << (uint16_t)tbId.m_layer << " size " << (*itHarq).second.m_harqStatus.size () << " send DL-HARQ-ACK");
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1096
                              m_harqPhyModule->ResetDlHarqProcessStatus ((*itTb).second.harqProcessId);
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1097
                            }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1098
                        }
9587
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1099
                      } // end if ((*itTb).second.downlink) HARQ
8f669a9d4719 Bug-fix LteSpectrumPhy send HARQ feedback per TB basis
mmiozzo
parents: 9562
diff changeset
  1100
                  } // end if (!(*itTb).second.harqFeedbackSent)
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1101
              }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1102
          }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1103
      }
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1104
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1105
  // send DL HARQ feedback to LtePhy
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1106
  std::map <uint16_t, DlInfoListElement_s>::iterator itHarq;
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1107
  for (itHarq = harqDlInfoMap.begin (); itHarq != harqDlInfoMap.end (); itHarq++)
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1108
    {
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1109
      if (!m_ltePhyDlHarqFeedbackCallback.IsNull ())
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1110
        {
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1111
          m_ltePhyDlHarqFeedbackCallback ((*itHarq).second);
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1112
        }
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1113
    }
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1114
  // forward control messages of this frame to LtePhy
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: 8726
diff changeset
  1115
  if (!m_rxControlMessageList.empty ())
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: 8726
diff changeset
  1116
    {
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: 8726
diff changeset
  1117
      if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
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: 8726
diff changeset
  1118
        {
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: 8726
diff changeset
  1119
          m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
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: 8726
diff changeset
  1120
        }
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: 8726
diff changeset
  1121
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1122
  ChangeState (IDLE);
7927
c8d380a263ec fixed uplink RX and interference calculation
Nicola Baldo <nbaldo@cttc.es>
parents: 7926
diff changeset
  1123
  m_rxPacketBurstList.clear ();
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: 8726
diff changeset
  1124
  m_rxControlMessageList.clear ();
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
  1125
  m_expectedTbs.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1126
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1127
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: 8726
diff changeset
  1128
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: 8726
diff changeset
  1129
void
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: 8726
diff changeset
  1130
LteSpectrumPhy::EndRxDlCtrl ()
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: 8726
diff changeset
  1131
{
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: 8726
diff changeset
  1132
  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: 8726
diff changeset
  1133
  NS_LOG_LOGIC (this << " state: " << m_state);
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: 8726
diff changeset
  1134
  
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
  1135
  NS_ASSERT (m_state == RX_DL_CTRL);
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: 8726
diff changeset
  1136
  
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: 8726
diff changeset
  1137
  // this will trigger CQI calculation and Error Model evaluation
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: 8726
diff changeset
  1138
  // as a side effect, the error model should update the error status of all TBs
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: 8726
diff changeset
  1139
  m_interferenceCtrl->EndRx ();
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: 8726
diff changeset
  1140
  // apply transmission mode gain
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: 8726
diff changeset
  1141
  NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
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: 8726
diff changeset
  1142
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1143
  if (m_transmissionMode>0)
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1144
    {
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1145
      // in case of MIMO, ctrl is always txed as TX diversity
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1146
      m_sinrPerceived *= m_txModeGain.at (1);
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1147
    }
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1148
//   m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
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: 8726
diff changeset
  1149
  bool error = false;
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1150
  if (m_ctrlErrorModelEnabled)
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1151
    {
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1152
      double  errorRate = LteMiErrorModel::GetPcfichPdcchError (m_sinrPerceived);
9057
227b3882f459 merge ns-3-lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9053 8987
diff changeset
  1153
      error = m_random->GetValue () > errorRate ? false : true;
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1154
      NS_LOG_DEBUG (this << " PCFICH-PDCCH Decodification, errorRate " << errorRate << " error " << error);
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1155
    }
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
  1156
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: 8726
diff changeset
  1157
  if (!error)
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: 8726
diff changeset
  1158
    {
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: 8726
diff changeset
  1159
      if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
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: 8726
diff changeset
  1160
        {
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1161
          NS_LOG_DEBUG (this << " PCFICH-PDCCH Rxed OK");
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: 8726
diff changeset
  1162
          m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
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: 8726
diff changeset
  1163
        }
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: 8726
diff changeset
  1164
    }
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: 8726
diff changeset
  1165
  else
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: 8726
diff changeset
  1166
    {
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: 8726
diff changeset
  1167
      if (!m_ltePhyRxCtrlEndErrorCallback.IsNull ())
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: 8726
diff changeset
  1168
        {
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1169
          NS_LOG_DEBUG (this << " PCFICH-PDCCH Error");
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: 8726
diff changeset
  1170
          m_ltePhyRxCtrlEndErrorCallback ();
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: 8726
diff changeset
  1171
        }
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: 8726
diff changeset
  1172
    }
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: 8726
diff changeset
  1173
  ChangeState (IDLE);
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: 8726
diff changeset
  1174
  m_rxControlMessageList.clear ();
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: 8726
diff changeset
  1175
}
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: 8726
diff changeset
  1176
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: 8726
diff changeset
  1177
void
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: 8726
diff changeset
  1178
LteSpectrumPhy::EndRxUlSrs ()
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: 8726
diff changeset
  1179
{
11272
1117aab0eb5c refactoring of the LteSpectrumPhy state machine
Nicola Baldo <nbaldo@cttc.es>
parents: 11271
diff changeset
  1180
  NS_ASSERT (m_state == RX_UL_SRS);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
  1181
  ChangeState (IDLE);
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: 8726
diff changeset
  1182
  m_interferenceCtrl->EndRx ();
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: 8726
diff changeset
  1183
  // nothing to do (used only for SRS at this stage)
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: 8726
diff changeset
  1184
}
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: 8726
diff changeset
  1185
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1186
void 
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1187
LteSpectrumPhy::SetCellId (uint16_t cellId)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1188
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1189
  m_cellId = cellId;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1190
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1191
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: 8726
diff changeset
  1192
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1193
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1194
LteSpectrumPhy::AddRsPowerChunkProcessor (Ptr<LteChunkProcessor> p)
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1195
{
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1196
  m_interferenceCtrl->AddRsPowerChunkProcessor (p);
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1197
}
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1198
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1199
void
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1200
LteSpectrumPhy::AddDataPowerChunkProcessor (Ptr<LteChunkProcessor> p)
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1201
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1202
  m_interferenceData->AddRsPowerChunkProcessor (p);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1203
}
9389
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1204
4bd2725add01 Update RSRP and RSRQ evaluation (RSRQ as average SINR)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9368
diff changeset
  1205
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1206
LteSpectrumPhy::AddDataSinrChunkProcessor (Ptr<LteChunkProcessor> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
  1207
{
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: 8726
diff changeset
  1208
  m_interferenceData->AddSinrChunkProcessor (p);
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: 8726
diff changeset
  1209
}
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: 8726
diff changeset
  1210
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: 8726
diff changeset
  1211
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1212
LteSpectrumPhy::AddInterferenceCtrlChunkProcessor (Ptr<LteChunkProcessor> p)
9983
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
  1213
{
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
  1214
  m_interferenceCtrl->AddInterferenceChunkProcessor (p);
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
  1215
}
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
  1216
0091ab7a897c Add RSRP-RSRQ UE measurement and correspondent c-phy primitive for reporting them to LteUeRrr
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9617
diff changeset
  1217
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1218
LteSpectrumPhy::AddInterferenceDataChunkProcessor (Ptr<LteChunkProcessor> p)
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: 9354
diff changeset
  1219
{
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9354
diff changeset
  1220
  m_interferenceData->AddInterferenceChunkProcessor (p);
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9354
diff changeset
  1221
}
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9354
diff changeset
  1222
d52b94f66fe7 Add trace sources for DL RSRP/RSRQ (dummy values, TBD), UL SRS and interference power traces
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9354
diff changeset
  1223
void
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10680
diff changeset
  1224
LteSpectrumPhy::AddCtrlSinrChunkProcessor (Ptr<LteChunkProcessor> 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: 8726
diff changeset
  1225
{
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: 8726
diff changeset
  1226
  m_interferenceCtrl->AddSinrChunkProcessor (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1227
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1228
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1229
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1230
LteSpectrumPhy::SetTransmissionMode (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1231
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1232
  NS_LOG_FUNCTION (this << (uint16_t) txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1233
  NS_ASSERT_MSG (txMode < m_txModeGain.size (), "TransmissionMode not available: 1.." << m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1234
  m_transmissionMode = txMode;
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9057
diff changeset
  1235
  m_layersNum = TransmissionModesLayers::TxMode2LayerNum (txMode);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1236
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1237
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1238
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1239
void 
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1240
LteSpectrumPhy::SetTxModeGain (uint8_t txMode, double gain)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1241
{
8724
b92bff65c4fd Udate default values of txMode gain to 1.0 (linear of 0 dB)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8718
diff changeset
  1242
  NS_LOG_FUNCTION (this << " txmode " << (uint16_t)txMode << " gain " << gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1243
  // convert to linear
9063
32755d0516f4 Bug 1237 - code cleanups related to includes
Vedran Mileti? <rivanvx@gmail.com>
parents: 9057
diff changeset
  1244
  gain = std::pow (10.0, (gain / 10.0));
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1245
  if (m_txModeGain.size () < txMode)
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1246
  {
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1247
    m_txModeGain.resize (txMode);
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1248
  }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1249
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1250
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1251
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1252
  for (uint8_t i = 0; i < temp.size (); i++)
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1253
  {
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1254
    if (i==txMode-1)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1255
    {
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1256
      m_txModeGain.push_back (gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1257
    }
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1258
    else
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1259
    {
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1260
      m_txModeGain.push_back (temp.at (i));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1261
    }
8718
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
  1262
  }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1263
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1264
8987
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1265
int64_t
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1266
LteSpectrumPhy::AssignStreams (int64_t stream)
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1267
{
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1268
  NS_LOG_FUNCTION (this << stream);
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1269
  m_random->SetStream (stream);
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1270
  return 1;
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1271
}
03b1accee8d1 Replace src/lte usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 8726
diff changeset
  1272
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
  1273
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1274
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
  1275
} // namespace ns3