src/lte/test/lte-test-mimo.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 10892 3e86fac77082
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     2
/*
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     4
 *
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     8
 *
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    12
 * GNU General Public License for more details.
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    13
 *
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    17
 *
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    19
 */
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    20
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    21
#include <iostream>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    22
#include <sstream>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    23
#include <string>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    24
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    25
#include <ns3/object.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    26
#include <ns3/spectrum-interference.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    27
#include <ns3/spectrum-error-model.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    28
#include <ns3/log.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    29
#include <ns3/test.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    30
#include <ns3/simulator.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    31
#include <ns3/packet.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    32
#include <ns3/ptr.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    33
#include <iostream>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    34
#include "ns3/radio-bearer-stats-calculator.h"
10081
f0879d02aafd Renaming of file buildings-mobility-model in mobility-building-info
Marco Miozzo <marco.miozzo@cttc.es>
parents: 10080
diff changeset
    35
#include <ns3/mobility-building-info.h>
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    36
#include <ns3/buildings-propagation-loss-model.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    37
#include <ns3/eps-bearer.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    38
#include <ns3/node-container.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    39
#include <ns3/mobility-helper.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    40
#include <ns3/net-device-container.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    41
#include <ns3/lte-ue-net-device.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    42
#include <ns3/lte-enb-net-device.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    43
#include <ns3/lte-ue-rrc.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    44
#include <ns3/lte-helper.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    45
#include "ns3/string.h"
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    46
#include "ns3/double.h"
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    47
#include <ns3/lte-enb-phy.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    48
#include <ns3/lte-ue-phy.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    49
#include <ns3/boolean.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    50
#include <ns3/rr-ff-mac-scheduler.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    51
#include <ns3/pf-ff-mac-scheduler.h>
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    52
#include <ns3/pointer.h>
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8714
diff changeset
    53
#include <ns3/enum.h>
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
    54
#include <ns3/buildings-helper.h>
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    55
8822
49d3a0979d43 fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents: 8726
diff changeset
    56
#include "lte-test-mimo.h"
49d3a0979d43 fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents: 8726
diff changeset
    57
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    58
10553
8c347165bb56 Move tests outside ns3 namespace
Vedran Miletić <rivanvx@gmail.com>
parents: 10081
diff changeset
    59
using namespace ns3;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    60
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10892
diff changeset
    61
NS_LOG_COMPONENT_DEFINE ("LteTestMimo");
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    62
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    63
LenaTestMimoSuite::LenaTestMimoSuite ()
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    64
  : TestSuite ("lte-mimo", SYSTEM)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    65
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    66
  NS_LOG_INFO ("creating LenaMimoTestCase");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    67
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    68
  // RR DOWNLINK- DISTANCE 300
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    69
  // interval 1 : [0.1, 0.2) sec TxMode 0: MCS 20 -> TB size 1191 bytes
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    70
  // interval 2 : [0.3, 0.4) sec TxMode 1: MCS 26 -> TB size 1836 bytes
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    71
  // interval 3 : [0.5, 0.6) sec TxMode 2: MCS 18 -> TB size  967 bytes (x2 layers)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    72
  // --> 
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    73
  std::vector<uint32_t> estThrDl;
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    74
  estThrDl.push_back (119100); // interval 1 : estimated throughput for TxMode 1
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    75
  estThrDl.push_back (183600); // interval 2 : estimated throughput for TxMode 2
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
    76
  estThrDl.push_back (193400); // interval 3 : estimated throughput for TxMode 3
9673
Nicola Baldo <nbaldo@cttc.es>
parents: 9614 9267
diff changeset
    77
  AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::RrFfMacScheduler", true), TestCase::QUICK);
Nicola Baldo <nbaldo@cttc.es>
parents: 9614 9267
diff changeset
    78
  AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::PfFfMacScheduler", true), TestCase::QUICK);
Nicola Baldo <nbaldo@cttc.es>
parents: 9614 9267
diff changeset
    79
  AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::RrFfMacScheduler", false), TestCase::QUICK);
Nicola Baldo <nbaldo@cttc.es>
parents: 9614 9267
diff changeset
    80
  AddTestCase (new LenaMimoTestCase(300, estThrDl, "ns3::PfFfMacScheduler", false), TestCase::QUICK);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    81
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    82
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    83
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    84
static LenaTestMimoSuite lenaTestMimoSuite;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    85
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    86
std::string 
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    87
LenaMimoTestCase::BuildNameString (uint16_t dist, std::string schedulerType, bool useIdealRrc)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    88
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    89
  std::ostringstream oss;
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
    90
  oss << " UE distance " << dist << " m" << " Scheduler " << schedulerType;
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    91
  if (useIdealRrc)
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    92
    {
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    93
      oss << ", ideal RRC";
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    94
    }
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    95
  else
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    96
    {
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    97
      oss << ", real RRC";
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
    98
    }  
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    99
  return oss.str ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   100
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   101
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   102
LenaMimoTestCase::LenaMimoTestCase (uint16_t dist, std::vector<uint32_t> estThrDl, std::string schedulerType, bool useIdealRrc)
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   103
  : TestCase (BuildNameString (dist, schedulerType, useIdealRrc)),              
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   104
    m_dist (dist),
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   105
    m_estThrDl (estThrDl),
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   106
    m_schedulerType (schedulerType),
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   107
    m_useIdealRrc (useIdealRrc)
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   108
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   109
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   110
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   111
LenaMimoTestCase::~LenaMimoTestCase ()
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   112
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   113
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   114
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   115
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   116
LenaMimoTestCase::DoRun (void)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   117
{
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   118
  NS_LOG_FUNCTION (this << GetName ());
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
   119
  Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8714
diff changeset
   120
  Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
9538
9d8d81c9655a updated tests for RRC real/ideal: interference antenna mimo harq
Nicola Baldo <nbaldo@cttc.es>
parents: 9535
diff changeset
   121
  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (m_useIdealRrc));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   122
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10553
diff changeset
   123
  //Disable Uplink Power Control
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10553
diff changeset
   124
  Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false));
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents: 10553
diff changeset
   125
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   126
  /**
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   127
   * Initialize Simulation Scenario: 1 eNB and m_nUser UEs
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   128
   */
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   129
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   130
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   131
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
9351
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
   132
  Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false));
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
   133
  Config::SetDefault ("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue (false));
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
   134
  
6e074e67a1ad HARQ first draft version: RR works, PF todo, LteMiErrorModel on-going
mmiozzo
parents: 9346
diff changeset
   135
//   lteHelper->SetSchedulerAttribute ("HarqEnabled", BooleanValue (false));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   136
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   137
  
8726
f6f0e2531457 merge with ns-3-lena-pem changeset 8419:e8df5f68c35e (MIMO model)
mmiozzo
parents: 8714
diff changeset
   138
  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::HybridBuildingsPropagationLossModel"));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   139
  lteHelper->SetPathlossModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   140
  lteHelper->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   141
  lteHelper->SetPathlossModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   142
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   143
//   lteHelper->EnableLogComponents ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   144
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   145
  // Create Nodes: eNodeB and UE
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   146
  NodeContainer enbNodes;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   147
  NodeContainer ueNodes;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   148
  enbNodes.Create (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   149
  ueNodes.Create (1);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   150
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   151
  // Install Mobility Model
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   152
  MobilityHelper mobility;
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   153
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   154
  mobility.Install (enbNodes);
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   155
  BuildingsHelper::Install (enbNodes);
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   156
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   157
  mobility.Install (ueNodes);
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   158
  BuildingsHelper::Install (ueNodes);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   159
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   160
  // Create Devices and install them in the Nodes (eNB and UE)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   161
  NetDeviceContainer enbDevs;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   162
  NetDeviceContainer ueDevs;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   163
  lteHelper->SetSchedulerType (m_schedulerType);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   164
  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   165
  ueDevs = lteHelper->InstallUeDevice (ueNodes);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   166
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   167
  // Attach a UE to a eNB
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   168
  lteHelper->Attach (ueDevs, enbDevs.Get (0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   169
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   170
  // Activate an EPS bearer
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   171
  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   172
  EpsBearer bearer (q);
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8822
diff changeset
   173
  lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   174
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   175
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   176
  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   177
  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   178
  enbPhy->SetAttribute ("TxPower", DoubleValue (46.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   179
  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   180
  Ptr<MobilityModel> mmenb = enbNodes.Get (0)->GetObject<MobilityModel> ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   181
  mmenb->SetPosition (Vector (0.0, 0.0, 30.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   182
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   183
  // Set UE's position and power
10080
1b36e2276e15 Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9673
diff changeset
   184
  Ptr<MobilityModel> mmue = ueNodes.Get (0)->GetObject<MobilityModel> ();
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   185
  mmue->SetPosition (Vector (m_dist, 0.0, 1.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   186
  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (0)->GetObject<LteUeNetDevice> ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   187
  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   188
  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   189
  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   190
  
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9346
diff changeset
   191
  // need to allow for RRC connection establishment + SRS before enabling traces
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   192
  lteHelper->EnableRlcTraces ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   193
  lteHelper->EnableMacTraces ();
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   194
  double simulationTime = 0.6; 
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   195
  double tolerance = 0.1;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   196
  
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9346
diff changeset
   197
  uint8_t rnti = 1;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   198
  Ptr<LteEnbNetDevice> enbNetDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   199
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   200
  PointerValue ptrval;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   201
  enbNetDev->GetAttribute ("FfMacScheduler", ptrval);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   202
  Ptr<PfFfMacScheduler> pfsched;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   203
  Ptr<RrFfMacScheduler> rrsched;
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   204
  if (m_schedulerType.compare ("ns3::RrFfMacScheduler") == 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   205
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   206
      rrsched = ptrval.Get<RrFfMacScheduler> ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   207
      if (rrsched == 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   208
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   209
          NS_FATAL_ERROR ("No RR Scheduler available");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   210
        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   211
      Simulator::Schedule (Seconds (0.2), &RrFfMacScheduler::TransmissionModeConfigurationUpdate, rrsched, rnti, 1);
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   212
      Simulator::Schedule (Seconds (0.4), &RrFfMacScheduler::TransmissionModeConfigurationUpdate, rrsched, rnti, 2);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   213
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   214
  else if (m_schedulerType.compare ("ns3::PfFfMacScheduler") == 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   215
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   216
      pfsched = ptrval.Get<PfFfMacScheduler> ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   217
      if (pfsched == 0)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   218
        {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   219
          NS_FATAL_ERROR ("No Pf Scheduler available");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   220
        }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   221
      
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   222
      Simulator::Schedule (Seconds (0.2), &PfFfMacScheduler::TransmissionModeConfigurationUpdate, pfsched, rnti, 1);
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   223
      Simulator::Schedule (Seconds (0.4), &PfFfMacScheduler::TransmissionModeConfigurationUpdate, pfsched, rnti, 2);
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   224
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   225
  else
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   226
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   227
      NS_FATAL_ERROR ("Scheduler not supported by this test");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   228
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   229
    
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   230
  
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   231
  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   232
  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (0.1)));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   233
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   234
  NS_LOG_INFO (m_schedulerType << " MIMO test:");
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   235
  double sampleTime = 0.199999; // at 0.2 RlcStats are reset
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   236
  for (uint8_t j = 0; j < m_estThrDl.size (); j ++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   237
    {
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   238
      NS_LOG_INFO ("\t test with user at distance " << m_dist << " time " << sampleTime);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   239
      // get the imsi
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   240
      uint64_t imsi = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetImsi ();
9406
7f0f9d8f8e20 new LTE RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 9346
diff changeset
   241
      uint8_t lcId = 3;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   242
      Time t = Seconds (sampleTime);
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   243
      Simulator::Schedule(t, &LenaMimoTestCase::GetRlcBufferSample, this, rlcStats, imsi, lcId);
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   244
      sampleTime += 0.2;
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   245
    }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   246
  Simulator::Stop (Seconds (simulationTime));
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   247
  Simulator::Run ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   248
  Simulator::Destroy ();
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   249
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   250
  NS_LOG_INFO ("Check consistency");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   251
    for (uint8_t i = 0; i < m_estThrDl.size (); i++)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   252
      {
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   253
        NS_LOG_INFO ("interval " << i + 1 << ": bytes rxed " << (double)m_dlDataRxed.at (i) << " ref " << m_estThrDl.at (i));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   254
        NS_TEST_ASSERT_MSG_EQ_TOL ((double)m_dlDataRxed.at (i) , m_estThrDl.at (i), m_estThrDl.at (i) * tolerance, " Unfair Throughput!");
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   255
      }
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   256
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   257
}
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   258
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   259
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   260
void
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   261
LenaMimoTestCase::GetRlcBufferSample (Ptr<RadioBearerStatsCalculator> rlcStats, uint64_t imsi, uint8_t lcId)
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   262
{
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   263
  m_dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
9614
c1df336c06f8 RadioBearerStatsCalculator: handle end epoch via scheduled event
Nicola Baldo <nbaldo@cttc.es>
parents: 9538
diff changeset
   264
  NS_LOG_INFO (Simulator::Now () << "\t get bytes " << m_dlDataRxed.at (m_dlDataRxed.size () - 1));
8714
398bbcbb3f42 Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   265
}