src/lte/model/lte-enb-phy.cc
author mmiozzo
Mon, 28 Nov 2011 12:32:08 +0100
changeset 8415 e9a27a8c6331
parent 8253 6faee3d1d1d0
child 8506 f9616c9094a5
permissions -rw-r--r--
Uplink scheduler with multiple bearers (LCs) allocates in a Round Robin fashion the active ones
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 6852
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     2
/*
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     3
 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     4
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     8
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    12
 * GNU General Public License for more details.
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    13
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    17
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    18
 * Author: Giuseppe Piro  <g.piro@poliba.it>
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    19
 *         Marco Miozzo <mmiozzo@cttc.es>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    20
 */
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
#include <ns3/object-factory.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    23
#include <ns3/log.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    24
#include <math.h>
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    25
#include <ns3/simulator.h>
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
    26
#include <ns3/attribute-accessor-helper.h>
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
    27
#include <ns3/double.h>
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
    28
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
    29
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    30
#include "lte-enb-phy.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    31
#include "lte-net-device.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    32
#include "lte-spectrum-value-helper.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    33
#include "ideal-control-messages.h"
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    34
#include "lte-enb-net-device.h"
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    35
#include "lte-enb-mac.h"
7947
4ed7cfac199d PUSCH UL-CQ Integrated in PFS
mmiozzo
parents: 7944
diff changeset
    36
#include <ns3/lte-common.h>
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    37
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    38
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    39
NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
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
namespace ns3 {
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
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    44
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    45
// member SAP forwarders
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    46
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    47
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    48
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    49
class EnbMemberLteEnbPhySapProvider : public LteEnbPhySapProvider
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    50
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    51
public:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    52
  EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    53
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    54
  // inherited from LteEnbPhySapProvider
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    55
  virtual void SendMacPdu (Ptr<Packet> p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    56
  virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    57
  virtual void SetCellId (uint16_t cellId);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    58
  virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    59
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    60
private:
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    61
  LteEnbPhy* m_phy;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    62
};
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    63
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    64
EnbMemberLteEnbPhySapProvider::EnbMemberLteEnbPhySapProvider (LteEnbPhy* phy) : m_phy (phy)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    65
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    66
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    67
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    68
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    69
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    70
void
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    71
EnbMemberLteEnbPhySapProvider::SendMacPdu (Ptr<Packet> p)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    72
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    73
  m_phy->DoSendMacPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    74
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    75
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    76
void
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    77
EnbMemberLteEnbPhySapProvider::SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    78
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    79
  m_phy->DoSetBandwidth (ulBandwidth, dlBandwidth);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    80
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    81
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    82
void
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    83
EnbMemberLteEnbPhySapProvider::SetCellId (uint16_t cellId)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    84
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    85
  m_phy->DoSetCellId (cellId);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    86
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    87
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    88
void
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    89
EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    90
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    91
  m_phy->DoSendIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    92
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    93
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    94
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    95
////////////////////////////////////////
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    96
// generic LteEnbPhy methods
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    97
////////////////////////////////////////
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    98
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    99
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   100
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   101
NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy);
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
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   104
LteEnbPhy::LteEnbPhy ()
7980
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   105
{
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   106
  NS_LOG_FUNCTION (this);
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   107
  NS_FATAL_ERROR ("This constructor should not be called");
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   108
}
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   109
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   110
LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   111
  : LtePhy (dlPhy, ulPhy),
f07d99163a56 LteSpectrumPhy instances now plugged onto LtePhy via its constructor
Nicola Baldo <nbaldo@cttc.es>
parents: 7977
diff changeset
   112
    m_nrFrames (0),
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   113
    m_nrSubFrames (0)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   114
{
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   115
  m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
7944
f7e5e0540487 connection of SAPs moved from EnbNetDevice to LenaHelper
Nicola Baldo <nicola@baldo.biz>
parents: 7943
diff changeset
   116
  Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   117
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   118
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   119
TypeId
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   120
LteEnbPhy::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   121
{
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   122
  static TypeId tid = TypeId ("ns3::LteEnbPhy")
6707
2ac68a0381ca improved module after Tom's review
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   123
    .SetParent<LtePhy> ()
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   124
    .AddConstructor<LteEnbPhy> ()
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   125
    .AddAttribute ("TxPower",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   126
                   "Transmission power in dBm",
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   127
                   DoubleValue (30.0),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   128
                   MakeDoubleAccessor (&LteEnbPhy::SetTxPower, 
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   129
                                       &LteEnbPhy::GetTxPower),
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   130
                   MakeDoubleChecker<double> ())
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   131
    .AddAttribute ("NoiseFigure",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   132
                   "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   133
                   " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   134
                   "\"the difference in decibels (dB) between"
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   135
                   " the noise output of the actual receiver to the noise output of an "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   136
                   " ideal receiver with the same overall gain and bandwidth when the receivers "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   137
                   " are connected to sources at the standard noise temperature T0.\" "
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   138
                   "In this model, we consider T0 = 290K.",
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   139
                   DoubleValue (5.0),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   140
                   MakeDoubleAccessor (&LteEnbPhy::SetNoiseFigure, 
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   141
                                       &LteEnbPhy::GetNoiseFigure),
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   142
                   MakeDoubleChecker<double> ())
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   143
  ;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   144
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   145
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   146
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   147
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   148
LteEnbPhy::~LteEnbPhy ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   149
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   150
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   151
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   152
void
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   153
LteEnbPhy::DoDispose ()
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   154
{
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   155
  NS_LOG_FUNCTION (this);
7921
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7914
diff changeset
   156
  m_ueAttached.clear ();
7930
ccb40542ae88 fixed memory leak in PHY SAP usage
Nicola Baldo <nbaldo@cttc.es>
parents: 7928
diff changeset
   157
  delete m_enbPhySapProvider;
7913
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   158
  LtePhy::DoDispose ();
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   159
}
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   160
ed3a9f8a76d7 added DoDispose to lte-phy and lte-spectrum-phy
Nicola Baldo <nbaldo@cttc.es>
parents: 7887
diff changeset
   161
void
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   162
LteEnbPhy::DoStart ()
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   163
{
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   164
  NS_LOG_FUNCTION (this);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   165
  Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_noiseFigure);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   166
  m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   167
  LtePhy::DoStart ();
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   168
}
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   169
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   170
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   171
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   172
LteEnbPhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   173
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   174
  m_enbPhySapUser = s;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   175
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   176
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   177
LteEnbPhySapProvider*
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   178
LteEnbPhy::GetLteEnbPhySapProvider ()
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   179
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   180
  return (m_enbPhySapProvider);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   181
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   182
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   183
void
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   184
LteEnbPhy::SetTxPower (double pow)
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   185
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   186
  NS_LOG_FUNCTION (this << pow);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   187
  m_txPower = pow;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   188
}
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   189
7949
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   190
double
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   191
LteEnbPhy::GetTxPower () const
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   192
{
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   193
  NS_LOG_FUNCTION (this);
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   194
  return m_txPower;
3bf9450ac03f added TX power attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7944
diff changeset
   195
}
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   196
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   197
void
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   198
LteEnbPhy::SetNoiseFigure (double nf)
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   199
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   200
  NS_LOG_FUNCTION (this << nf);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   201
  m_noiseFigure = nf;
7981
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   202
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   203
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   204
double
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   205
LteEnbPhy::GetNoiseFigure () const
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   206
{
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   207
  NS_LOG_FUNCTION (this);
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   208
  return m_noiseFigure;
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   209
}
aacecd825d99 noise figure attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 7980
diff changeset
   210
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   211
bool
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   212
LteEnbPhy::AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   213
{
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   214
  std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   215
  it = m_ueAttached.find (rnti);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   216
  if (it == m_ueAttached.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   217
    {
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   218
      m_ueAttached.insert (std::pair<uint16_t, Ptr<LteUePhy> > (rnti, phy));
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   219
      return (true);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   220
    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   221
  else
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   222
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   223
      NS_LOG_ERROR ("UE already attached");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   224
      return (false);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   225
    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   226
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   227
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   228
bool
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   229
LteEnbPhy::DeleteUePhy (uint16_t rnti)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   230
{
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   231
  std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   232
  it = m_ueAttached.find (rnti);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   233
  if (it == m_ueAttached.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   234
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   235
      NS_LOG_ERROR ("UE not attached");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   236
      return (false);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   237
    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   238
  else
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   239
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   240
      m_ueAttached.erase (it);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   241
      return (true);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   242
    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   243
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   244
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   245
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   246
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   247
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   248
LteEnbPhy::DoSendMacPdu (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   249
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   250
//   NS_LOG_FUNCTION (this << pb->GetNPackets () << pb->GetSize ());
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   251
//   return GetDownlinkSpectrumPhy ()->StartTx (pb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   252
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   253
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   254
  SetMacPdu (p);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   255
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   256
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   257
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   258
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   259
LteEnbPhy::PhyPduReceived (Ptr<Packet> p)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   260
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   261
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   262
  m_enbPhySapUser->ReceivePhyPdu (p);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   263
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   264
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   265
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   266
LteEnbPhy::DoSetDownlinkSubChannels ()
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
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   269
  Ptr<SpectrumValue> txPsd = CreateTxPowerSpectralDensity ();
7928
b736f63e9bdf removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents: 7921
diff changeset
   270
  m_downlinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   271
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   272
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   273
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   274
Ptr<SpectrumValue>
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   275
LteEnbPhy::CreateTxPowerSpectralDensity ()
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   276
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   277
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   278
8015
e8fd3bf1692f flexible spectrum model
Nicola Baldo <nbaldo@cttc.es>
parents: 7981
diff changeset
   279
  Ptr<SpectrumValue> psd = LteSpectrumValueHelper::CreateTxPowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_txPower, GetDownlinkSubChannels ());
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   280
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   281
  return psd;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   282
}
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
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   285
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   286
LteEnbPhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   287
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   288
  NS_LOG_FUNCTION (this);
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
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   291
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   292
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   293
LteEnbPhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   294
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   295
  NS_LOG_FUNCTION (this << msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   296
  // queues the message (wait for MAC-PHY delay)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   297
  SetControlMessages (msg);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   298
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   299
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   300
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   301
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   302
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   303
LteEnbPhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
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
  NS_LOG_FUNCTION (this << msg);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   306
  m_enbPhySapUser->ReceiveIdealControlMessage (msg);
6705
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
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
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   312
LteEnbPhy::StartFrame (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   313
{
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   314
  NS_LOG_FUNCTION (this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   315
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   316
  ++m_nrFrames;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   317
  NS_LOG_INFO ("-----frame " << m_nrFrames << "-----");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   318
  m_nrSubFrames = 0;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   319
  StartSubFrame ();
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   320
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   321
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   322
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   323
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   324
LteEnbPhy::StartSubFrame (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   325
{
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   326
  NS_LOG_FUNCTION (this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   327
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   328
  ++m_nrSubFrames;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   329
  NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   330
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   331
  // send the current burst of control messages
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   332
  std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   333
  std::vector <int> dlRb;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   334
  if (ctrlMsg.size () > 0)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   335
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   336
      std::list<Ptr<IdealControlMessage> >::iterator it;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   337
      it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   338
      while (it != ctrlMsg.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   339
        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   340
          Ptr<IdealControlMessage> msg = (*it);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   341
          if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   342
            {
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   343
              std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   344
              Ptr<DlDciIdealControlMessage> dci = DynamicCast<DlDciIdealControlMessage> (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   345
              it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   346
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   347
              if (it2 == m_ueAttached.end ())
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   348
                {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   349
                  NS_LOG_ERROR ("UE not attached");
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   350
                }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   351
              else
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   352
                {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   353
                  // get the tx power spectral density according to DL-DCI(s)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   354
                  // translate the DCI to Spectrum framework
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   355
                  uint32_t mask = 0x1;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   356
                  for (int i = 0; i < 32; i++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   357
                    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   358
                      if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   359
                        {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   360
                          for (int k = 0; k < GetRbgSize (); k++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   361
                            {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   362
                              dlRb.push_back ((i * GetRbgSize ()) + k);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   363
                              //NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   364
                            }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   365
                        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   366
                      mask = (mask << 1);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   367
                    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   368
                  (*it2).second->ReceiveIdealControlMessage (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   369
                }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   370
            }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   371
          else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   372
            {
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   373
              std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   374
              Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   375
              it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   376
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   377
              if (it2 == m_ueAttached.end ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   378
                {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   379
                  NS_LOG_ERROR ("UE not attached");
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   380
                }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   381
              else
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   382
                {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   383
                  (*it2).second->ReceiveIdealControlMessage (msg);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   384
                }
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   385
            }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   386
          ctrlMsg.pop_front ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   387
          it = ctrlMsg.begin ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   388
        }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   389
    }
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   390
  // set the current tx power spectral density
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   391
  SetDownlinkSubChannels (dlRb);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   392
  // send the current burts of packets
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   393
  Ptr<PacketBurst> pb = GetPacketBurst ();
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   394
  if (pb)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   395
    {
7928
b736f63e9bdf removed LtePhy::Get{Up,Down}linkSpectrumPhy methods which are evil
Nicola Baldo <nbaldo@cttc.es>
parents: 7921
diff changeset
   396
      m_downlinkSpectrumPhy->StartTx (pb);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   397
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   398
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   399
  // trigger the MAC
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   400
  m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   401
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   402
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   403
  // trigger the UE(s)
8180
5429db8b8c37 Fix Bug JIRA:LENA-145, RNTI as uint16_t in LteEnbPhy
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8148
diff changeset
   404
  std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   405
  for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++)
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   406
    {
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   407
      (*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   408
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   409
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   410
  Simulator::Schedule (Seconds (GetTti ()),
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   411
                       &LteEnbPhy::EndSubFrame,
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   412
                       this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   413
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   414
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   415
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   416
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   417
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   418
LteEnbPhy::EndSubFrame (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   419
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   420
  NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   421
  if (m_nrSubFrames == 10)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   422
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   423
      Simulator::ScheduleNow (&LteEnbPhy::EndFrame, this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   424
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   425
  else
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   426
    {
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   427
      Simulator::ScheduleNow (&LteEnbPhy::StartSubFrame, this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   428
    }
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   429
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   430
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   431
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   432
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   433
LteEnbPhy::EndFrame (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   434
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   435
  NS_LOG_FUNCTION (this << Simulator::Now ().GetSeconds ());
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   436
  Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   437
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   438
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   439
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   440
void 
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   441
LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr)
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   442
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   443
  NS_LOG_FUNCTION (this << sinr);
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   444
  Ptr<LteEnbNetDevice> thisDevice = GetDevice ()->GetObject<LteEnbNetDevice> ();
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   445
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   446
  m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   447
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   448
7910
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   449
}
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   450
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   451
7934
0f09fc707a8c Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents: 7930
diff changeset
   452
UlCqi_s
0f09fc707a8c Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents: 7930
diff changeset
   453
LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr)
7910
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   454
{
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   455
  NS_LOG_FUNCTION (this << sinr);
7910
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   456
  Values::const_iterator it;
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   457
  UlCqi_s ulcqi;
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   458
  ulcqi.m_type = UlCqi_s::PUSCH;
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   459
  int i = 0;
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   460
  for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   461
    {
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   462
      double sinrdb = 10 * log10 ((*it));
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   463
      // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   464
      int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   465
      ulcqi.m_sinr.push_back (sinrFp);
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   466
      i++;
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   467
    }
7934
0f09fc707a8c Convert UL-CQI from IdealControlMessage to PhySap Primitive
mmiozzo
parents: 7930
diff changeset
   468
  return (ulcqi);
7910
d7083e401e59 PUSCH based UL-CQI generation at eNB PHY side
mmiozzo
parents: 7887
diff changeset
   469
	
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   470
}
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   471
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   472
};