src/lte/test/lte-test-pathloss-model.cc
author Marco Miozzo <marco.miozzo@cttc.es>
Mon, 25 Jul 2011 10:56:56 +0200
changeset 8211 1f846c65ed78
parent 8210 cb2fc96c5534
child 8213 7746b2e4bffc
permissions -rw-r--r--
Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     2
/*
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     4
 *
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     8
 *
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    12
 * GNU General Public License for more details.
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    13
 *
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    17
 *
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    19
 */
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    20
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    21
#include "ns3/simulator.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    22
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    23
#include "ns3/log.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    24
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    25
#include "ns3/spectrum-test.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    26
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    27
#include "ns3/lte-phy-tag.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    28
#include "ns3/lte-test-ue-phy.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    29
#include "ns3/lte-sinr-chunk-processor.h"
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    30
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    31
#include "ns3/lte-test-pathloss-model.h"
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    32
#include <ns3/buildings-propagation-loss-model.h>
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    33
#include <ns3/node-container.h>
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    34
#include <ns3/mobility-helper.h>
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    35
#include <ns3/lena-helper.h>
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    36
#include <ns3/single-model-spectrum-channel.h>
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    37
#include "ns3/string.h"
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
    38
#include "ns3/double.h"
8193
4aa1c097a00e LtePathlossModelTestSuite on-going work
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8192
diff changeset
    39
#include <ns3/building.h>
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
    40
#include <ns3/enum.h>
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    41
#include <ns3/net-device-container.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    42
#include <ns3/lte-ue-net-device.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    43
#include <ns3/lte-enb-net-device.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    44
#include <ns3/lte-ue-rrc.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    45
#include <ns3/lena-helper.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    46
#include <ns3/lte-enb-phy.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    47
#include <ns3/lte-ue-phy.h>
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    48
#include "lte-test-sinr-chunk-processor.h"
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    49
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    50
NS_LOG_COMPONENT_DEFINE ("LtePathlossModelTest");
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    51
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    52
using namespace ns3;
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    53
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    54
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    55
/**
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
    56
 * Test 1.1 Pathloss compound test
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    57
 */
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    58
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    59
/**
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
    60
 * This TestSuite tests the BuildingPathlossModel by reproducing
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
    61
 * several communication scenarios 
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    62
 */
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    63
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    64
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    65
void
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    66
LteTestPathlossDlSchedCallback (LtePathlossModelSystemTestCase *testcase, std::string path,
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    67
                             uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    68
                             uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2)
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    69
{
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    70
  testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    71
}
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    72
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    73
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    74
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    75
LtePathlossModelTestSuite::LtePathlossModelTestSuite ()
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    76
  : TestSuite ("lte-pathloss-model", SYSTEM)
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
    77
{
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    78
 
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    79
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    80
      LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    81
  // 
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    82
  //   LogComponentEnable ("LenaHelper", logLevel);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    83
     LogComponentEnable ("LtePathlossModelTest", logLevel);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    84
  //   LogComponentEnable ("BuildingsPropagationLossModel", logLevel);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    85
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    86
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    87
  struct SnrEfficiencyMcs
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    88
  {
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    89
    double  snrDb;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    90
    double  efficiency;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    91
    int  mcsIndex;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    92
  };
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    93
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    94
  /**
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    95
  * Test vectors: SNRDB, Spectral Efficiency, MCS index
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    96
  * From XXX
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    97
  */
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    98
  SnrEfficiencyMcs snrEfficiencyMcs[] = {
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
    99
    { -5.00000,  0.08024,        -1},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   100
    { -4.00000,  0.10030,        -1},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   101
    { -3.00000,  0.12518,        -1},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   102
    { -2.00000,  0.15589,        0},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   103
    { -1.00000,  0.19365,        0},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   104
    { 0.00000,   0.23983,        2},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   105
    { 1.00000,   0.29593,        2},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   106
    { 2.00000,   0.36360,        2},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   107
    { 3.00000,   0.44451,        4},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   108
    { 4.00000,   0.54031,        4},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   109
    { 5.00000,   0.65251,        6},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   110
    { 6.00000,   0.78240,        6},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   111
    { 7.00000,   0.93086,        8},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   112
    { 8.00000,   1.09835,        8},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   113
    { 9.00000,   1.28485,        10},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   114
    { 10.00000,  1.48981,        12},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   115
    { 11.00000,  1.71229,        12},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   116
    { 12.00000,  1.95096,        14},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   117
    { 13.00000,  2.20429,        14},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   118
    { 14.00000,  2.47062,        16},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   119
    { 15.00000,  2.74826,        18},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   120
    { 16.00000,  3.03560,        18},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   121
    { 17.00000,  3.33115,        20},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   122
    { 18.00000,  3.63355,        20},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   123
    { 19.00000,  3.94163,        22},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   124
    { 20.00000,  4.25439,        22},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   125
    { 21.00000,  4.57095,        24},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   126
    { 22.00000,  4.89060,        24},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   127
    { 23.00000,  5.21276,        26},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   128
    { 24.00000,  5.53693,        26},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   129
    { 25.00000,  5.86271,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   130
    { 26.00000,  6.18980,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   131
    { 27.00000,  6.51792,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   132
    { 28.00000,  6.84687,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   133
    { 29.00000,  7.17649,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   134
    { 30.00000,  7.50663,        28},
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   135
  };
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   136
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   137
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   138
  double txPowerDbm = 30; // default eNB TX power over whole bandwdith
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   139
  double ktDbm = -174;    // reference LTE noise PSD
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   140
  double noisePowerDbm = ktDbm + 10 * log10 (25 * 180000); // corresponds to kT*bandwidth in linear units
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   141
  double receiverNoiseFigureDb = 9.0; // default UE noise figure
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   142
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   143
  double loss[] = {80.605, 243.62};
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   144
  double dist[] = {100.0, 1000.0};
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   145
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   146
  int numOfTests = sizeof (loss) / sizeof (double);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   147
  for ( int i = 0 ; i < numOfTests; i++ )
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   148
  {
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   149
//     double lossDb = txPowerDbm - snrEfficiencyMcs[i].snrDb - noisePowerDbm - receiverNoiseFigureDb;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   150
    
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   151
    double sinrDb = txPowerDbm- noisePowerDbm - receiverNoiseFigureDb - loss[i];
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   152
    NS_LOG_INFO (" Ptx " << txPowerDbm << " Pn " << noisePowerDbm << " Fn " << receiverNoiseFigureDb << " Pl " << loss[i] << " dist " << dist);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   153
    std::ostringstream name;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   154
    name << " snr= " << sinrDb << " dB, "
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   155
    << " mcs= " << snrEfficiencyMcs[i].mcsIndex;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   156
//     AddTestCase (new LtePathlossModelSystemTestCase (name.str (),  sinrDb, dist[i], snrEfficiencyMcs[i].mcsIndex));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   157
  }
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   158
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   159
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   160
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   161
    
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   162
    
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   163
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   164
 
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   165
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   166
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   167
// -------------- COMPOUND TESTS ----------------------------------
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   168
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   169
  LogComponentEnable ("LtePathlossModelTest", LOG_LEVEL_ALL);
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   170
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   171
  // NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite");
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   172
  
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   173
  Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   174
  
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   175
  lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   176
  
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
   177
  // Create Nodes: eNodeB, home eNB, UE and home UE (UE attached to HeNB)
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   178
  NodeContainer enbNodes;
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   179
  NodeContainer henbNodes;
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   180
  NodeContainer ueNodes;
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   181
  NodeContainer hueNodes;
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   182
  enbNodes.Create (1);
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   183
  henbNodes.Create (2);
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   184
  ueNodes.Create (5);
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   185
  hueNodes.Create (3);
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   186
  
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   187
  // Install Mobility Model
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   188
  MobilityHelper mobility;
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   189
  mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   190
  mobility.Install (enbNodes);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   191
  mobility.Install (henbNodes);
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   192
  mobility.Install (ueNodes);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   193
  mobility.Install (hueNodes);
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   194
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   195
  NetDeviceContainer enbDevs;
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   196
  NetDeviceContainer henbDevs;
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   197
  NetDeviceContainer ueDevs;
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   198
  NetDeviceContainer hueDevs;
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   199
  enbDevs = lena->InstallEnbDevice (enbNodes);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   200
  ueDevs = lena->InstallUeDevice (ueNodes);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   201
  henbDevs = lena->InstallEnbDevice (henbNodes);
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   202
  hueDevs = lena->InstallUeDevice (hueNodes);
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   203
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   204
  
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   205
  
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   206
  lena->Attach (ueDevs, enbDevs.Get (0));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   207
  lena->Attach (hueDevs, henbDevs.Get (0));
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   208
  
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
   209
// Test #1 Okumura Hata Model (150 < freq < 1500 MHz) (Macro<->UE)
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
   210
  
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   211
  double distance = 2000;
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   212
  double hm = 1;
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   213
  double hb = 30;
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   214
  double freq = 869e6; // E_UTRA BAND #5 see table 5.5-1 of 36.101
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   215
  Ptr<BuildingsMobilityModel> mm1 = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   216
  mm1->SetPosition (Vector (0.0, 0.0, hb));
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   217
  
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   218
  Ptr<BuildingsMobilityModel> mm2 = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   219
  mm2->SetPosition (Vector (distance, 0.0, hm));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   220
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   221
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 137.93, "OH Urban Large city = ??"));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   222
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   223
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 137.88, "OH Urban small city = ??"));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   224
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   225
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::SubUrban, BuildingsPropagationLossModel::Large, 128.03, "loss OH SubUrban"));
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   226
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   227
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::OpenAreas, BuildingsPropagationLossModel::Large, 110.21, "loss OH OpenAreas"));
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   228
  
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   229
  // Test #2 COST231 Model (1500 < freq < 2000~2170 MHz) (Macro<->UE)
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   230
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   231
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   232
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   233
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 148.55, "COST231 Urban Large city"));
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   234
  
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   235
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 150.64, "COST231 Urban small city and suburban"));
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   236
  
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   237
  // Test #3 2.6 GHz model (Macro<->UE)
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   238
  
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   239
  freq = 2.620e9; // E_UTRA BAND #7 see table 5.5-1 of 36.101
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   240
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   241
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm2, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Small, 121.83, "2.6GHz model"));
8206
964bd6f3afe3 Debug and verification of pathloss models COST231, ITU1411 LOS, ITU1411 NLOS over rooftop
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8200
diff changeset
   242
  
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   243
  // Test #4 ITU1411 LOS model (Macro<->UE)
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   244
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   245
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   246
  distance = 100;
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   247
  Ptr<BuildingsMobilityModel> mm3 = ueNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   248
  mm3->SetPosition (Vector (distance, 0.0, hm));
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   249
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm3, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 81.00, "ITU1411 LOS"));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   250
  
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   251
  // Test #5 ITU1411 NLOS model (Macro<->UE)
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   252
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   253
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   254
  distance = 900;
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   255
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   256
  Ptr<BuildingsMobilityModel> mm4 = ueNodes.Get (2)->GetObject<BuildingsMobilityModel> ();
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   257
  mm4->SetPosition (Vector (distance, 0.0, hm));
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   258
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm4, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 143.69, "ITU1411 NLOS"));
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   259
  
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   260
  // Test #6 ITUP1238 (HeNB <-> UE)
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   261
  
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   262
  distance = 30;
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   263
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   264
  double henbHeight = 10.0;
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   265
  Ptr<BuildingsMobilityModel> mm5 = henbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   266
  mm5->SetPosition (Vector (0.0, 0.0, henbHeight));
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   267
  Ptr<Building> building1 = Create<Building> (0.0, 10.0, 0.0, 10.0, 0.0, 20.0/*, 1, 1, 1*/);
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   268
  building1->SetBuildingType (Building::Residential);
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
   269
  building1->SetExtWallsType (Building::ConcreteWithWindows);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   270
  mm5->SetIndoor (building1);
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   271
  Ptr<BuildingsMobilityModel> mm6 = hueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   272
  mm6->SetPosition (Vector (distance, 0.0, hm));
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   273
  mm6->SetIndoor (building1);
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   274
  mm6->SetFloorNumber (2);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   275
  AddTestCase (new LtePathlossModelTestCase (freq, mm5, mm6, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.3855, "ITUP1238"));
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   276
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   277
  // Test #7 Outdoor -> Indoor OkumuraHata (Macro<->UE)
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   278
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   279
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   280
  distance = 2000;
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   281
  // The loss is as in test #2 (large city) plus the building penetration loss
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   282
  // which for ConcreteWithWindows is equal to 7 dB -> 148.55 + 7 = 155.55
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   283
  Ptr<BuildingsMobilityModel> mm7 = ueNodes.Get (3)->GetObject<BuildingsMobilityModel> ();
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   284
  mm7->SetPosition (Vector (distance, 0.0, hm));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   285
  mm7->SetIndoor (building1);
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   286
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm7, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 155.55, "Okumura Hata Outdoor -> Indoor"));
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   287
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   288
  // Test #8 Outdoor -> Indoor ITU1411 (Macro<->UE)
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   289
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   290
  distance = 100;
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   291
  Ptr<BuildingsMobilityModel> mm8 = ueNodes.Get (4)->GetObject<BuildingsMobilityModel> ();
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   292
  mm8->SetPosition (Vector (distance, 0.0, hm));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   293
  mm8->SetIndoor (building1);
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   294
  // The loss is as in test #4 plus the building penetration loss
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   295
  // which for ConcreteWithWindows is equal to 7 dB -> 81.000 + 7 = 88.000
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   296
  AddTestCase (new LtePathlossModelTestCase (freq, mm1, mm8, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 88.000, "ITU1411 LOS Outdoor -> Indoor"));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   297
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   298
  // Test #9 Indoor -> Outdoor LOS (HeNB <-> UE)
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   299
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   300
  distance = 100;
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   301
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   302
  Ptr<BuildingsMobilityModel> mm9 = henbNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   303
  mm9->SetPosition (Vector (0.0, 0.0, henbHeight));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   304
  mm9->SetIndoor (building1);
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   305
  mm9->SetFloorNumber (2);
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   306
  Ptr<BuildingsMobilityModel> mm10 = hueNodes.Get (1)->GetObject<BuildingsMobilityModel> ();
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   307
  mm10->SetPosition (Vector (distance, 0.0, hm));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   308
  // The loss is similar of test #4 plus the building penetration loss
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   309
  // which for ConcreteWithWindows is equal to 7 dB and the height gain
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   310
  // (2 floors x 2 dB/floor = 4) -> 81.838 + 7 - 4 = 84.838
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   311
  AddTestCase (new LtePathlossModelTestCase (freq, mm9, mm10, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 84.838, "ITU1411 LOS Indoor -> Outdoor"));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   312
  
8210
cb2fc96c5534 Lte BuildingPathlossModel compound test polishing
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8209
diff changeset
   313
  // Test #10 Indoor -> Outdoor NLOS (HeNB <-> UE)
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   314
  
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   315
  distance = 500;
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   316
  freq = 2.1140e9; // E_UTRA BAND #1 see table 5.5-1 of 36.101
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   317
  Ptr<BuildingsMobilityModel> mm11 = hueNodes.Get (2)->GetObject<BuildingsMobilityModel> ();
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   318
  mm11->SetPosition (Vector (distance, 0.0, hm));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   319
  // The loss is as in test #4 plus the building penetration loss
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   320
  // which for ConcreteWithWindows is equal to 7 dB and the height gain
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   321
  // (2 floors x 2 dB/floor = 4) -> 180.90 + 7 - 4 = 183.90
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   322
  AddTestCase (new LtePathlossModelTestCase (freq, mm9, mm11, BuildingsPropagationLossModel::Urban, BuildingsPropagationLossModel::Large, 183.90, "ITU1411 NLOS Indoor -> Outdoor"));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   323
  
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   324
}
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   325
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   326
static LtePathlossModelTestSuite ltePathlossModelTestSuite;
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   327
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   328
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   329
/**
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   330
 * TestCase
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   331
 */
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   332
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   333
LtePathlossModelTestCase::LtePathlossModelTestCase (double freq, Ptr<BuildingsMobilityModel> m1, Ptr<BuildingsMobilityModel> m2, BuildingsPropagationLossModel::Environment env, BuildingsPropagationLossModel::CitySize city, double refValue, std::string name)
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   334
  : TestCase ("LOSS calculation: " + name),
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   335
    m_freq (freq),
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   336
    m_node1 (m1),
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   337
    m_node2 (m2),
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   338
    m_env (env),
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   339
    m_city (city),
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   340
    m_lossRef (refValue)
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   341
{
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   342
}
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   343
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   344
LtePathlossModelTestCase::~LtePathlossModelTestCase ()
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   345
{
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   346
}
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   347
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   348
void
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   349
LtePathlossModelTestCase::DoRun (void)
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   350
{
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   351
//   LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   352
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   353
//   LogComponentEnable ("LteEnbRrc", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   354
//   LogComponentEnable ("LteUeRrc", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   355
//   LogComponentEnable ("LteEnbMac", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   356
//   LogComponentEnable ("LteUeMac", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   357
//   LogComponentEnable ("LteRlc", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   358
//   LogComponentEnable ("RrPacketScheduler", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   359
// 
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   360
//   LogComponentEnable ("LtePhy", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   361
//   LogComponentEnable ("LteEnbPhy", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   362
//   LogComponentEnable ("LteUePhy", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   363
// 
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   364
//   LogComponentEnable ("LteSpectrumPhy", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   365
//   LogComponentEnable ("LteInterference", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   366
//   LogComponentEnable ("LteSinrChunkProcessor", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   367
// 
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   368
//   LogComponentEnable ("LtePropagationLossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   369
//   LogComponentEnable ("LossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   370
//   LogComponentEnable ("ShadowingLossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   371
//   LogComponentEnable ("PenetrationLossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   372
//   LogComponentEnable ("MultipathLossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   373
//   LogComponentEnable ("PathLossModel", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   374
// 
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   375
//   LogComponentEnable ("LteNetDevice", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   376
//   LogComponentEnable ("LteUeNetDevice", logLevel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   377
//   LogComponentEnable ("LteEnbNetDevice", logLevel);
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   378
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   379
  LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   380
  NS_LOG_INFO ("Testing " << GetName());
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   381
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   382
  Ptr<SpectrumChannel> m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   383
  Ptr<SpectrumChannel> m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   384
  Ptr<BuildingsPropagationLossModel> m_downlinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   385
  m_downlinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   386
  m_downlinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   387
  m_downlinkPropagationLossModel->SetAttribute ("Environment", EnumValue (m_env));
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   388
  m_downlinkPropagationLossModel->SetAttribute ("CitySize", EnumValue (m_city));
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   389
  Ptr<BuildingsPropagationLossModel>  m_uplinkPropagationLossModel = CreateObject<BuildingsPropagationLossModel> ();
8209
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   390
  m_uplinkPropagationLossModel->SetAttribute ("Frequency", DoubleValue (m_freq));
7a795d377e61 Finalized pathloss model compound test: passed
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8208
diff changeset
   391
  m_uplinkPropagationLossModel->SetAttribute ("Lambda", DoubleValue (300000000.0 /m_freq));
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   392
  m_downlinkChannel->AddPropagationLossModel (m_downlinkPropagationLossModel);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   393
  m_uplinkChannel->AddPropagationLossModel (m_uplinkPropagationLossModel);
8191
02ce2fb4883b Remove dependences from SpectrumPropagationLossModel
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8189
diff changeset
   394
  
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   395
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   396
  
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   397
  Simulator::Stop (Seconds (0.1));
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   398
  Simulator::Run ();
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   399
  Simulator::Destroy ();
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   400
  double loss = m_downlinkPropagationLossModel->GetLoss (m_node1, m_node2);
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   401
8192
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   402
  NS_LOG_INFO ("Calculated loss: " << loss);
0d4ca39493cb LtePathlossModelTestSuite first draft (compile and run)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8191
diff changeset
   403
  NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   404
 
8208
20a270bed353 Basic compound test implemented (single pathloss models, no combination)
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8206
diff changeset
   405
  NS_TEST_ASSERT_MSG_EQ_TOL(loss, m_lossRef, 0.1, "Wrong loss !");
8189
dde497458c54 Add pathloss test
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff changeset
   406
}
8211
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   407
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   408
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   409
//-------------------- SYSTEM TEST ---------------------------------
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   410
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   411
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   412
LtePathlossModelSystemTestCase::LtePathlossModelSystemTestCase (std::string name, double snrDb, double dist, uint16_t mcsIndex)
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   413
: TestCase (name),
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   414
m_snrDb (snrDb),
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   415
m_distance (dist),
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   416
m_mcsIndex (mcsIndex)
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   417
{
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   418
  std::ostringstream sstream1, sstream2;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   419
  sstream1 << " snr=" << snrDb 
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   420
  << " mcs=" << mcsIndex << " distance=" << dist;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   421
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   422
  NS_LOG_INFO ("Creating LtePathlossModelSystemTestCase: " + sstream1.str ());
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   423
}
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   424
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   425
LtePathlossModelSystemTestCase::~LtePathlossModelSystemTestCase ()
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   426
{
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   427
}
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   428
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   429
void
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   430
LtePathlossModelSystemTestCase::DoRun (void)
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   431
{
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   432
  /**
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   433
  * Simulation Topology
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   434
  */
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   435
  LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   436
//   LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   437
//   LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   438
//   LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   439
//   LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   440
//   LogComponentEnable ("SingleModelSpectrumChannel", LOG_LEVEL_ALL);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   441
  LogComponentEnable ("BuildingsPropagationLossModel", logLevel);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   442
//   
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   443
  Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   444
  //   lena->EnableLogComponents ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   445
  lena->EnableMacTraces ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   446
  lena->EnableRlcTraces ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   447
  lena->SetAttribute ("PropagationModel", StringValue ("ns3::BuildingsPropagationLossModel"));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   448
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   449
  // Create Nodes: eNodeB and UE
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   450
  NodeContainer enbNodes;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   451
  NodeContainer ueNodes;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   452
  enbNodes.Create (1);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   453
  ueNodes.Create (1);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   454
  NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes );
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   455
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   456
  // Install Mobility Model
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   457
  MobilityHelper mobility;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   458
  mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   459
  mobility.Install (allNodes);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   460
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   461
  // Create Devices and install them in the Nodes (eNB and UE)
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   462
  NetDeviceContainer enbDevs;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   463
  NetDeviceContainer ueDevs;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   464
  lena->SetSchedulerType ("ns3::RrFfMacScheduler");
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   465
  enbDevs = lena->InstallEnbDevice (enbNodes);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   466
  ueDevs = lena->InstallUeDevice (ueNodes);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   467
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   468
  Ptr<BuildingsMobilityModel> mm_enb = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   469
  mm_enb->SetPosition (Vector (0.0, 0.0, 30.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   470
  Ptr<BuildingsMobilityModel> mm_ue = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   471
  mm_ue->SetPosition (Vector (m_distance, 0.0, 1.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   472
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   473
  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   474
  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   475
  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   476
  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   477
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   478
  Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (0)->GetObject<LteUeNetDevice> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   479
  Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   480
  uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   481
  uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   482
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   483
  // Attach a UE to a eNB
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   484
  lena->Attach (ueDevs, enbDevs.Get (0));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   485
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   486
  // Activate an EPS bearer
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   487
  enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   488
  EpsBearer bearer (q);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   489
  lena->ActivateEpsBearer (ueDevs, bearer);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   490
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   491
  // Use testing chunk processor in the PHY layer
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   492
  // It will be used to test that the SNR is as intended
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   493
  //Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   494
  Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   495
  uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   496
   
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   497
  Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   498
                   MakeBoundCallback (&LteTestPathlossDlSchedCallback, this));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   499
                   
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   500
  Simulator::Stop (Seconds (0.005));
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   501
  Simulator::Run ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   502
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   503
  double calculatedSinrDb = 10.0 * log10 (testSinr->GetSinr ()[0]);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   504
  NS_LOG_INFO ("Distance " << m_distance << " Calculated SINR " << calculatedSinrDb << " ref " << m_snrDb);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   505
  Simulator::Destroy ();
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   506
  NS_TEST_ASSERT_MSG_EQ_TOL (calculatedSinrDb, m_snrDb, 0.0000001, "Wrong SINR !");
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   507
}
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   508
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   509
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   510
void
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   511
LtePathlossModelSystemTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   512
                                         uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) 
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   513
{
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   514
  static bool firstTime = true;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   515
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   516
  if ( firstTime )
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   517
  {
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   518
    firstTime = false;
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   519
    NS_LOG_INFO ("SNR\tRef_MCS\tCalc_MCS");
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   520
  }
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   521
  
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   522
  /**
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   523
  * Note:
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   524
  *    For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   525
  *    because CQI feedback is still not available at the eNB.
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   526
  */
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   527
  if ( (frameNo > 1) || (subframeNo > 4) )
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   528
  {
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   529
    NS_LOG_INFO (m_snrDb << "\t" << m_mcsIndex << "\t" << (uint16_t)mcsTb1);
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   530
    
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   531
    NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcsTb1, m_mcsIndex, "Wrong MCS index");
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   532
  }
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   533
}
1f846c65ed78 Bug-fix BuildingPathlossModel update unit of distance in OH model and in its test
Marco Miozzo <marco.miozzo@cttc.es>
parents: 8210
diff changeset
   534