src/lte/model/lte-spectrum-phy.cc
author Nicola Baldo <nbaldo@cttc.es>
Tue, 30 Oct 2012 16:02:07 +0100
changeset 9406 7f0f9d8f8e20
parent 9053 974762654b12
child 9414 7b0db3dbf19b
permissions -rw-r--r--
new LTE RRC model
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>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    26
#include <math.h>
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"
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    34
#include "lte-sinr-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>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    40
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    41
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    42
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    43
namespace ns3 {
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    44
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
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    55
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
    56
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    57
  
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
    58
TbId_t::TbId_t ()
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    59
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    60
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    61
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
    62
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
    63
: m_rnti (a),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    64
  m_layer (b)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    65
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    66
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    67
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    68
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
    69
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
    70
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    71
  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
    72
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    73
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    74
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
    75
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
    76
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    77
  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
    78
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    79
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    80
NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    81
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    82
LteSpectrumPhy::LteSpectrumPhy ()
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
    83
  : m_state (IDLE),
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    84
  m_random (0.0, 1.0),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    85
  m_transmissionMode (0)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    86
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
    87
  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
    88
  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
    89
  m_interferenceCtrl = CreateObject<LteInterference> ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    90
  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
    91
    {
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
    92
      m_txModeGain.push_back (1.0);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
    93
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    94
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    95
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    96
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    97
LteSpectrumPhy::~LteSpectrumPhy ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    98
{
7924
3a44452d0dad made LteInterference an Object and fixed more disposals
Nicola Baldo <nbaldo@cttc.es>
parents: 7913
diff changeset
    99
  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
   100
  m_expectedTbs.clear ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   101
  m_txModeGain.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   102
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   103
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   104
void LteSpectrumPhy::DoDispose ()
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   105
{
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
   106
  NS_LOG_FUNCTION (this);
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   107
  m_channel = 0;
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   108
  m_mobility = 0;
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   109
  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
   110
  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
   111
  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
   112
  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
   113
  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
   114
  m_ltePhyTxEndCallback      = MakeNullCallback< void, Ptr<const 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
   115
  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
   116
  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
   117
  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
   118
  m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7911
diff changeset
   119
  SpectrumPhy::DoDispose ();
7911
0d2783c3500e removed useless getters
Nicola Baldo <nbaldo@cttc.es>
parents: 7894
diff changeset
   120
} 
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   121
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   122
std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   123
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   124
  switch (s)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   125
    {
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   126
    case LteSpectrumPhy::IDLE:
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   127
      os << "IDLE";
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   128
      break;
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   129
    case LteSpectrumPhy::RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   130
      os << "RX_DATA";
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   131
      break;
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   132
    case LteSpectrumPhy::RX_CTRL:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   133
      os << "RX_CTRL";
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   134
      break;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   135
    case LteSpectrumPhy::TX:
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   136
      os << "TX";
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   137
      break;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   138
    default:
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   139
      os << "UNKNOWN";
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   140
      break;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   141
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   142
  return os;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   143
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   144
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   145
TypeId
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   146
LteSpectrumPhy::GetTypeId (void)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   147
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   148
  static TypeId tid = TypeId ("ns3::LteSpectrumPhy")
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   149
    .SetParent<SpectrumPhy> ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   150
    .AddTraceSource ("TxStart",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   151
                     "Trace fired when a new transmission is started",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   152
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyTxStartTrace))
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   153
    .AddTraceSource ("TxEnd",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   154
                     "Trace fired when a previosuly started transmission is finished",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   155
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyTxEndTrace))
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   156
    .AddTraceSource ("RxStart",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   157
                     "Trace fired when the start of a signal is detected",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   158
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxStartTrace))
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   159
    .AddTraceSource ("RxEndOk",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   160
                     "Trace fired when a previosuly started RX terminates successfully",
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   161
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndOkTrace))
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   162
    .AddTraceSource ("RxEndError",
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   163
                     "Trace fired when a previosuly started RX terminates with an error",
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   164
                     MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndErrorTrace))
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   165
    .AddAttribute ("DataErrorModelEnabled",
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   166
                    "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
   167
                    BooleanValue (true),
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   168
                   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
   169
                    MakeBooleanChecker ())
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   170
    .AddAttribute ("CtrlErrorModelEnabled",
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   171
                    "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
   172
                    BooleanValue (true),
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   173
                    MakeBooleanAccessor (&LteSpectrumPhy::m_ctrlErrorModelEnabled),
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   174
                    MakeBooleanChecker ())
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   175
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   176
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   177
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   178
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   179
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   180
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   181
Ptr<NetDevice>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   182
LteSpectrumPhy::GetDevice ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   183
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   184
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   185
  return m_device;
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   188
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   189
Ptr<MobilityModel>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   190
LteSpectrumPhy::GetMobility ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   191
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   192
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   193
  return m_mobility;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   194
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   195
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   196
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   197
void
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   198
LteSpectrumPhy::SetDevice (Ptr<NetDevice> d)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   199
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   200
  NS_LOG_FUNCTION (this << d);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   201
  m_device = d;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   202
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   203
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   204
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   205
void
7553
2b93d333dea6 Bug 1271 - stronger type checking in SpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7385
diff changeset
   206
LteSpectrumPhy::SetMobility (Ptr<MobilityModel> m)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   207
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   208
  NS_LOG_FUNCTION (this << m);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   209
  m_mobility = m;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   210
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   211
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   212
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   213
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   214
LteSpectrumPhy::SetChannel (Ptr<SpectrumChannel> c)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   215
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   216
  NS_LOG_FUNCTION (this << c);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   217
  m_channel = c;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   218
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   219
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   220
Ptr<SpectrumChannel> 
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   221
LteSpectrumPhy::GetChannel ()
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   222
{
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   223
  return m_channel;
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   224
}
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   225
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   226
Ptr<const SpectrumModel>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   227
LteSpectrumPhy::GetRxSpectrumModel () const
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   228
{
8693
478733ab87b7 MultiModelSpectrumChannel working with LTE
Nicola Baldo <nbaldo@cttc.es>
parents: 8538
diff changeset
   229
  return m_rxSpectrumModel;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   230
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   231
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   232
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   233
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   234
LteSpectrumPhy::SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   235
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   236
  NS_LOG_FUNCTION (this << txPsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   237
  NS_ASSERT (txPsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   238
  m_txPsd = txPsd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   239
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   240
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   241
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   242
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   243
LteSpectrumPhy::SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   244
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   245
  NS_LOG_FUNCTION (this << noisePsd);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   246
  NS_ASSERT (noisePsd);
8693
478733ab87b7 MultiModelSpectrumChannel working with LTE
Nicola Baldo <nbaldo@cttc.es>
parents: 8538
diff changeset
   247
  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
   248
  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
   249
  m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
6705
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   252
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   253
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   254
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
   255
LteSpectrumPhy::SetLtePhyTxEndCallback (LtePhyTxEndCallback c)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   256
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   257
  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
   258
  m_ltePhyTxEndCallback = 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
   259
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   260
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   261
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   262
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
   263
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
   264
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   265
  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
   266
  m_ltePhyRxDataEndErrorCallback = c;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   267
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   268
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   269
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   270
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
   271
LteSpectrumPhy::SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   272
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   273
  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
   274
  m_ltePhyRxDataEndOkCallback = c;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   275
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   276
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
   277
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
   278
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
   279
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   280
  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
   281
  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
   282
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   283
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   284
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
   285
LteSpectrumPhy::SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   286
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   287
  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
   288
  m_ltePhyRxCtrlEndErrorCallback = c;
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
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
   291
7836
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   292
Ptr<AntennaModel>
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   293
LteSpectrumPhy::GetRxAntenna ()
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   294
{
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   295
  return m_antenna;
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   296
}
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   297
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   298
void
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   299
LteSpectrumPhy::SetAntenna (Ptr<AntennaModel> a)
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   300
{
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   301
  NS_LOG_FUNCTION (this << a);
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   302
  m_antenna = a;
9cf68ee51869 integrated AntennaModel with spectrum
Nicola Baldo <nbaldo@cttc.es>
parents: 7581
diff changeset
   303
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   304
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   305
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   306
LteSpectrumPhy::SetState (State newState)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   307
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   308
  ChangeState (newState);
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   311
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   312
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   313
LteSpectrumPhy::ChangeState (State newState)
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   314
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   315
  NS_LOG_LOGIC (this << " state: " << m_state << " -> " << newState);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   316
  m_state = newState;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   317
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   318
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   319
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   320
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
   321
bool
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   322
LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, Time 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
   323
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   324
  NS_LOG_FUNCTION (this << 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
   325
  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
   326
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   327
  m_phyTxStartTrace (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
   328
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   329
  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
   330
  {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   331
    case RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   332
    case RX_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
   333
      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
   334
      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
   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
    case TX:
e40974228d94 Update Phy Layer 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
      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
   338
      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
   339
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   340
    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
   341
    {
e40974228d94 Update Phy Layer 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
      /*
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   343
      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
   344
      (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
   345
      (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
   346
      */
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   347
      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
   348
      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
   349
      
e40974228d94 Update Phy Layer 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
      // 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
   351
      // 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
   352
      // 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
   353
      // 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
   354
      ChangeState (TX);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   355
      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
   356
      Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   357
      txParams->duration = 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
   358
      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
   359
      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
   360
      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
   361
      txParams->packetBurst = 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
   362
      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
   363
      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
   364
      m_channel->StartTx (txParams);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   365
      Simulator::Schedule (duration, &LteSpectrumPhy::EndTx, 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
   366
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   367
    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
   368
    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
   369
    
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   370
    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
   371
      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
   372
      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
   373
      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
   374
  }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   375
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   376
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   377
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
   378
LteSpectrumPhy::StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > 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
   379
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   380
  NS_LOG_FUNCTION (this << time);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   381
  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
   382
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   383
//   m_phyTxStartTrace (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
   384
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   385
  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
   386
  {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   387
    case RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   388
    case RX_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
   389
      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
   390
      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
   391
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   392
    case TX:
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   393
      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
   394
      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
   395
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   396
    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
   397
    {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   398
      /*
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   399
      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
   400
      (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
   401
      (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
   402
      */
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   403
      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
   404
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   405
      // 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
   406
      // 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
   407
      // 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
   408
      // 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
   409
      ChangeState (TX);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   410
      NS_ASSERT (m_channel);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   411
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
   412
      Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   413
      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
   414
      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
   415
      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
   416
      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
   417
      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
   418
      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
   419
      m_channel->StartTx (txParams);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   420
      Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTx, 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
   421
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   422
    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
   423
    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
   424
    
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   425
    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
   426
      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
   427
      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
   428
      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
   429
  }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   430
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   431
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   432
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   433
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
   434
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
   435
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   436
  NS_LOG_FUNCTION (this << time);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   437
  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
   438
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   439
  //   m_phyTxStartTrace (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
   440
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   441
  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
   442
  {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   443
    case RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   444
    case RX_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
   445
      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
   446
      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
   447
      
e40974228d94 Update Phy Layer 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
    case TX:
e40974228d94 Update Phy Layer 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
      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
   450
      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
   451
      
e40974228d94 Update Phy Layer 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
    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
   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
      /*
e40974228d94 Update Phy Layer 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
      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
   456
      (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
   457
      (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
   458
      */
e40974228d94 Update Phy Layer 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_txPsd);
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9053
diff changeset
   460
      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
   461
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   462
      // 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
   463
      // 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
   464
      // 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
   465
      // 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
   466
      ChangeState (TX);
e40974228d94 Update Phy Layer 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
      NS_ASSERT (m_channel);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   468
      Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   469
      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
   470
      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
   471
      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
   472
      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
   473
      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
   474
      m_channel->StartTx (txParams);
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   475
      Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTx, 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
   476
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   477
    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
   478
    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
   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
    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
   481
      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
   482
      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
   483
      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
   484
  }
e40974228d94 Update Phy Layer 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
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   486
e40974228d94 Update Phy Layer 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
e40974228d94 Update Phy Layer 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
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   489
void
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   490
LteSpectrumPhy::EndTx ()
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   491
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   492
  NS_LOG_FUNCTION (this);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   493
  NS_LOG_LOGIC (this << " state: " << m_state);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   494
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   495
  NS_ASSERT (m_state == TX);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   496
7961
535d5448b8f1 meaningful trace sources for LteSpectrumPhy
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   497
  m_phyTxEndTrace (m_txPacketBurst);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   498
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
   499
  if (!m_ltePhyTxEndCallback.IsNull ())
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   500
    {
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   501
      for (std::list<Ptr<Packet> >::const_iterator iter = m_txPacketBurst->Begin (); iter
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   502
           != m_txPacketBurst->End (); ++iter)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   503
        {
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   504
          Ptr<Packet> packet = (*iter)->Copy ();
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
   505
          m_ltePhyTxEndCallback (packet);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   506
        }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   507
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   508
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   509
  m_txPacketBurst = 0;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   510
  ChangeState (IDLE);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   511
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   512
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   513
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   514
void
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   515
LteSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumRxParams)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   516
{
7581
6ac3fa410583 spectrum API change
Nicola Baldo <nicola@baldo.biz>
parents: 7553
diff changeset
   517
  NS_LOG_FUNCTION (this << spectrumRxParams);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   518
  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
   519
  
8339
bfa05e51eecf merge ns-3-lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 8253 7581
diff changeset
   520
  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
   521
  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
   522
  
7891
382a429bdc69 added PHY synchronization model
Nicola Baldo <nicola@baldo.biz>
parents: 7886
diff changeset
   523
  // 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
   524
  // 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
   525
  Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   526
  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
   527
    {
e40974228d94 Update Phy Layer 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
      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
   529
      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
   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
  else
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   532
    {
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
   533
      Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
e40974228d94 Update Phy Layer 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
      Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
e40974228d94 Update Phy Layer 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
      if ((lteDlCtrlRxParams!=0)||(lteUlSrsRxParams!=0))
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   536
        {
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
   537
          m_interferenceCtrl->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
   538
          StartRxCtrl (spectrumRxParams);
e40974228d94 Update Phy Layer 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
        }
e40974228d94 Update Phy Layer 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
      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
   541
        {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   542
          // other type of signal (could be 3G, GSM, whatever) -> interference
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
          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
   544
          m_interferenceCtrl->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
   545
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   546
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   547
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   548
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   549
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
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
   551
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
   552
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   553
  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
   554
  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
   555
    {
e40974228d94 Update Phy Layer 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
      case TX:
e40974228d94 Update Phy Layer 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
        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
   558
        break;
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   559
      case RX_CTRL:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   560
        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
   561
        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
   562
      case IDLE:
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   563
      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
   564
        // 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
   565
        // 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
   566
        // 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
   567
        {
e40974228d94 Update Phy Layer 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
          // 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
   569
          // 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
   570
          //  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
   571
          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
   572
            {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   573
              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
   574
              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
   575
                {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   576
                  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
   577
                  // 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
   578
                  // 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
   579
                  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
   580
                  m_firstRxDuration = params->duration;
9053
974762654b12 subframe indication now triggered independently by LteUePhy
Nicola Baldo <nicola@baldo.biz>
parents: 9043
diff changeset
   581
                  NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
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
   582
                  Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, 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
   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
              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
   585
                {
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   586
                  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
   587
                  // 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
   588
                  // 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
   589
                  // 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
   590
                  // 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
   591
                  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
   592
                  && (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
   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
              
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   595
              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
   596
              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
   597
                {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   598
                  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
   599
                  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
   600
                  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   601
                  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
   602
                }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   603
                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
   604
              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
   605
              
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   606
              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
   607
            }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   608
          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
   609
            {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   610
              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
   611
              << 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
   612
            }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   613
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   614
        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
   615
        
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   616
        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
   617
          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
   618
          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
   619
      }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   620
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   621
   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
   622
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   623
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   624
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   625
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   626
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
   627
LteSpectrumPhy::StartRxCtrl (Ptr<SpectrumSignalParameters> 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
   628
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   629
  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
   630
  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
   631
  {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   632
    case TX:
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   633
      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
   634
      break;
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   635
    case RX_DATA:
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   636
      NS_FATAL_ERROR ("cannot RX data while receing control");
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   637
      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
   638
    case IDLE:
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   639
    case RX_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
   640
      // 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
   641
      // 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
   642
      // 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
   643
      {
e40974228d94 Update Phy Layer 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
        // 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
   645
        // 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
   646
        // 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
   647
        uint16_t 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
   648
        bool dl;
e40974228d94 Update Phy Layer 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
        Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (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
   650
        if (lteDlCtrlRxParams!=0)
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   651
          {
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
   652
            cellId = lteDlCtrlRxParams->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
   653
            dl = 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
   654
          }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   655
        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
   656
          {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   657
            Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (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
   658
            cellId = lteUlSrsRxParams->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
   659
            dl = 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
   660
          }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   661
        if (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
   662
        {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   663
          NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << 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
   664
          if (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
   665
          {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   666
            // 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
   667
            // 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
   668
            NS_ASSERT (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
   669
            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
   670
            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
   671
            NS_LOG_LOGIC (this << " scheduling EndRx with delay " << 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
   672
            if (dl==true)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8139
diff changeset
   673
              {
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
   674
                // store the DCIs
e40974228d94 Update Phy Layer 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
                m_rxControlMessageList = lteDlCtrlRxParams->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
   676
                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8139
diff changeset
   677
              }
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   678
            else
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   679
              {
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
   680
                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxUlSrs, this);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   681
              }
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   682
          }
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   683
          else if (m_state == RX_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
   684
          {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   685
            // 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
   686
            // 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
   687
            // 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
   688
            // 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
   689
            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
   690
            && (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
   691
          }
e40974228d94 Update Phy Layer 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
          
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   693
          ChangeState (RX_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
   694
          m_interferenceCtrl->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
   695
          
e40974228d94 Update Phy Layer 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
//           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
   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
        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
   699
        {
e40974228d94 Update Phy Layer 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
          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
   701
          << 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
   702
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   703
      }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   704
      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
   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
      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
   707
        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
   708
        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
   709
  }
e40974228d94 Update Phy Layer 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
  
e40974228d94 Update Phy Layer 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
  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
   712
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   713
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   714
8514
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   715
void
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   716
LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr)
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   717
{
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   718
  NS_LOG_FUNCTION (this << sinr);
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   719
  m_sinrPerceived = sinr;
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   720
}
6480a3cc31f2 Add LtePemSinrChunkProcessor and connect it to LteSpectrumPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8512
diff changeset
   721
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   722
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   723
void
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   724
LteSpectrumPhy::AddExpectedTb (uint16_t  rnti, uint16_t size, uint8_t mcs, std::vector<int> map, uint8_t layer)
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   725
{
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   726
  NS_LOG_LOGIC (this << " rnti: " << rnti << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint8_t)layer);
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
   727
  TbId_t tbId;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   728
  tbId.m_rnti = rnti;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   729
  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
   730
  expectedTbs_t::iterator it;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   731
  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
   732
  if (it != m_expectedTbs.end ())
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   733
  {
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   734
    // migth be a TB of an unreceived packet (due to high progpalosses)
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   735
    m_expectedTbs.erase (it);
8512
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   736
  }
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   737
  // insert new entry
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   738
  tbInfo_t tbInfo = {size, mcs, map, false};
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
   739
  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
   740
}
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   741
3b33e0855d77 commit debug stuff for merge with ns-3-lena-dev
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8511
diff changeset
   742
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   743
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
   744
LteSpectrumPhy::EndRxData ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   745
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   746
  NS_LOG_FUNCTION (this);
7893
8dba98ae26ee PHY synchronization
Nicola Baldo <nbaldo@cttc.es>
parents: 7891
diff changeset
   747
  NS_LOG_LOGIC (this << " state: " << m_state);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   748
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   749
  NS_ASSERT (m_state == RX_DATA);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   750
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   751
  // 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
   752
  // 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
   753
  m_interferenceData->EndRx ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   754
  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
   755
  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
   756
  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
   757
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   758
  // 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
   759
  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
   760
  NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   761
  m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   762
  
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
   763
  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
   764
    {
9043
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   765
      if (m_dataErrorModelEnabled)
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   766
        {
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   767
          double errorRate = LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs);
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   768
          (*itTb).second.corrupt = m_random.GetValue () > errorRate ? false : true;
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8693 8724
diff changeset
   769
          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 << " ErrorRate " << errorRate << " corrupted " << (*itTb).second.corrupt);
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   770
       }
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   771
      
8534
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   772
//       for (uint16_t i = 0; i < (*itTb).second.rbBitmap.size (); i++)
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   773
//         {
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   774
//           NS_LOG_DEBUG (this << " RB " << (*itTb).second.rbBitmap.at (i) << " SINR " << m_sinrPerceived[(*itTb).second.rbBitmap.at (i)]);
8187224a4598 Add LteSpectrumPhy::PemEnabled atribute for enable/disable the phy error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8521
diff changeset
   775
//         }
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
   776
      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
   777
    }
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   778
    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
   779
    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
   780
      {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   781
        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
   782
          {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   783
            // retrieve TB info of this packet 
8538
fbd322b7d863 merge with PEM and solve merge errors
mmiozzo
parents: 8506 8534
diff changeset
   784
            LteRadioBearerTag tag;
fbd322b7d863 merge with PEM and solve merge errors
mmiozzo
parents: 8506 8534
diff changeset
   785
            (*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
   786
            TbId_t tbId;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   787
            tbId.m_rnti = tag.GetRnti ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   788
            tbId.m_layer = tag.GetLayer ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   789
            itTb = m_expectedTbs.find (tbId);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   790
            NS_LOG_INFO (this << " Packet of " << tbId.m_rnti << " layer " <<  (uint8_t) tbId.m_layer);
8521
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   791
            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
   792
              {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   793
                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
   794
                  {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   795
                    m_phyRxEndOkTrace (*j);
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   796
                
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
   797
                    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
   798
                      {
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
   799
                        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
   800
                      }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   801
                  }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   802
                else
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   803
                  {
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   804
                    // 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
   805
                    m_phyRxEndErrorTrace (*j);
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   806
                  }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   807
              }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   808
          }
05b373fc3061 Add LteMiErrorModel and update LteSpectrumPhy for managing the error model
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8514
diff changeset
   809
      }
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
   810
      
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   811
  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
   812
    {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   813
      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
   814
        {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   815
          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
   816
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   817
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   818
  ChangeState (IDLE);
7927
c8d380a263ec fixed uplink RX and interference calculation
Nicola Baldo <nbaldo@cttc.es>
parents: 7926
diff changeset
   819
  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
   820
  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
   821
  m_expectedTbs.clear ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   822
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   823
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
   824
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   825
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
   826
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
   827
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   828
  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
   829
  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
   830
  
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   831
  NS_ASSERT (m_state == RX_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
   832
  
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   833
  // 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
   834
  // 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
   835
  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
   836
  // 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
   837
  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
   838
  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
   839
  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
   840
    {
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   841
      // 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
   842
      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
   843
    }
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   844
//   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
   845
  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
   846
  if (m_ctrlErrorModelEnabled)
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   847
    {
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   848
      double  errorRate = LteMiErrorModel::GetPcfichPdcchError (m_sinrPerceived);
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   849
      errorRate = LteMiErrorModel::GetPcfichPdcchError (m_sinrPerceived);
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   850
      error = m_random.GetValue () > errorRate ? false : true;
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   851
      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
   852
    }
9130e2dbe601 Add PCFICH-PDCCD Error model based on 3GPP R4-081920
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9040
diff changeset
   853
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
  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
   855
    {
e40974228d94 Update Phy Layer 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
      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
   857
        {
e40974228d94 Update Phy Layer 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
          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
   859
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   860
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   861
  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
   862
    {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   863
      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
   864
        {
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   865
          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
   866
        }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   867
    }
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   868
  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
   869
  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
   870
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   871
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   872
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
   873
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
   874
{
9038
e1d67c8aa95b Polish code according to codereview
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9036
diff changeset
   875
  NS_ASSERT (m_state == RX_CTRL);
9036
5e09b29d4af5 Add SRS signaling
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9035
diff changeset
   876
  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
   877
  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
   878
  // 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
   879
}
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   880
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   881
void 
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   882
LteSpectrumPhy::SetCellId (uint16_t cellId)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   883
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   884
  m_cellId = cellId;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   885
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   886
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
   887
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   888
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
   889
LteSpectrumPhy::AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   890
{
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
   891
  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
   892
}
e40974228d94 Update Phy Layer 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
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   894
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
   895
LteSpectrumPhy::AddCtrlSinrChunkProcessor (Ptr<LteSinrChunkProcessor> 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
   896
{
e40974228d94 Update Phy Layer for managing different frames for different set of channels (data vs. ctrl and srs)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8726
diff changeset
   897
  m_interferenceCtrl->AddSinrChunkProcessor (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   898
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   899
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   900
void 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   901
LteSpectrumPhy::SetTransmissionMode (uint8_t txMode)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   902
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   903
  NS_LOG_FUNCTION (this << (uint16_t) txMode);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   904
  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
   905
  m_transmissionMode = txMode;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   906
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   907
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   908
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   909
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
   910
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
   911
{
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
   912
  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
   913
  // convert to linear
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   914
  gain = 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
   915
  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
   916
  {
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
   917
    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
   918
  }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   919
  std::vector <double> temp;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   920
  temp = m_txModeGain;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   921
  m_txModeGain.clear ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   922
  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
   923
  {
26110c369b1c Update tbId_t struct to TbId_t (coding style) and group SetTxModeGain methods
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8715
diff changeset
   924
    if (i==txMode-1)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   925
    {
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
   926
      m_txModeGain.push_back (gain);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   927
    }
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
   928
    else
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   929
    {
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
   930
      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
   931
    }
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
   932
  }
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   933
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   934
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8538
diff changeset
   935
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   936
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   937
} // namespace ns3