src/lte/test/lte-test-fdtbfq-ff-mac-scheduler.cc
author Nicola Baldo <nbaldo@cttc.es>
Tue, 22 Oct 2013 18:06:07 +0200
changeset 10223 c2718ab29f13
parent 10218 97da49da2d6c
child 10224 cf10f30eaf41
permissions -rw-r--r--
removed unused variables in some LTE tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     2
/*
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     4
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     8
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    13
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    17
 *
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    18
 * Author: Marco Miozzo <marco.miozzo@cttc.es>,
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    19
 *         Nicola Baldo <nbaldo@cttc.es>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    20
 *         Dizhi Zhou <dizhi.zhou@gmail.com>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    21
 */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    22
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    23
#include <iostream>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    24
#include <sstream>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    25
#include <string>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    26
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    27
#include <ns3/object.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    28
#include <ns3/spectrum-interference.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    29
#include <ns3/spectrum-error-model.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    30
#include <ns3/log.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    31
#include <ns3/test.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    32
#include <ns3/simulator.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    33
#include <ns3/packet.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    34
#include <ns3/ptr.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    35
#include "ns3/radio-bearer-stats-calculator.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    36
#include <ns3/constant-position-mobility-model.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    37
#include <ns3/eps-bearer.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    38
#include <ns3/node-container.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    39
#include <ns3/mobility-helper.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    40
#include <ns3/net-device-container.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    41
#include <ns3/lte-ue-net-device.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    42
#include <ns3/lte-enb-net-device.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    43
#include <ns3/lte-ue-rrc.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    44
#include <ns3/lte-helper.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    45
#include "ns3/string.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    46
#include "ns3/double.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    47
#include <ns3/lte-enb-phy.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    48
#include <ns3/lte-ue-phy.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    49
#include <ns3/boolean.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    50
#include <ns3/enum.h>
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    51
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    52
#include "ns3/epc-helper.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    53
#include "ns3/network-module.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    54
#include "ns3/ipv4-global-routing-helper.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    55
#include "ns3/internet-module.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    56
#include "ns3/applications-module.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    57
#include "ns3/point-to-point-helper.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    58
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    59
#include "lte-test-fdtbfq-ff-mac-scheduler.h"
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    60
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
    61
NS_LOG_COMPONENT_DEFINE ("LenaTestFdTbfqFfMacScheduler");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    62
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    63
namespace ns3 {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    64
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    65
LenaTestFdTbfqFfMacSchedulerSuite::LenaTestFdTbfqFfMacSchedulerSuite ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    66
  : TestSuite ("lte-fdtbfq-ff-mac-scheduler", SYSTEM)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    67
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    68
  NS_LOG_INFO ("creating LenaTestFdTbfqFfMacSchedulerSuite");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    69
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
    70
  bool errorModel = false;
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
    71
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    72
  // General config
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    73
  // Traffic: UDP traffic with fixed rate
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    74
  // Token generation rate = traffic rate
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    75
  // RLC header length = 2 bytes, PDCP header = 2 bytes
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    76
  // Simulation time = 1.0 sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    77
  // Throughput in this file is calculated in RLC layer
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    78
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    79
  //Test Case 1: homogeneous flow test in FDTBFQ (same distance)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    80
  // DOWNLINK -> DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.2    13)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    81
  // Traffic info
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    82
  //   UDP traffic: payload size = 200 bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    83
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 232000 byte/rate 
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    84
  // Totol bandwidth: 24 PRB at Itbs 26 -> 2196 -> 2196000 byte/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    85
  // 1 user -> 232000 * 1 = 232000 < 2196000 -> throughput = 232000 byte/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    86
  // 3 user -> 232000 * 3 = 696000 < 2196000 -> througphut = 232000 byte/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    87
  // 6 user -> 232000 * 6 = 139200 < 2196000 -> throughput = 232000 byte/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    88
  // 12 user -> 232000 * 12 = 2784000 > 2196000 -> throughput = 2196000 / 12 = 183000 byte/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    89
  // UPLINK -> DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.2    13)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    90
  // 1 user -> 25 PRB at Itbs 26 -> 2292 -> 2292000 > 232000 -> throughput = 232000 bytes/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    91
  // 3 users -> 8 PRB at Itbs 26 -> 749 -> 749000 > 232000 -> throughput = 232000 bytes/sec 
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    92
  // 6 users -> 4 PRB at Itbs 26 -> 373 -> 373000 > 232000 -> throughput = 232000 bytes/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    93
  // 12 users -> 2 PRB at Itbs 26 -> 185 -> 185000 < 232000 -> throughput = 185000 bytes/sec
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
    94
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (1,0,0,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
    95
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (3,0,0,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
    96
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (6,0,0,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
    97
  //AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (12,0,0,183000,185000,200,1,errorModel));// simulation time = 1.5, otherwise, ul test will fail
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
    98
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
    99
  // DOWNLINK - DISTANCE 4800 -> MCS 22 -> Itbs 20 (from table 7.1.7.2.1-1 of 36.213)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   100
  // Traffic info
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   101
  //   UDP traffic: payload size = 200 bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   102
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 232000 byte/rate 
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   103
  // Totol bandwidth: 24 PRB at Itbs 20 -> 1383 -> 1383000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   104
  // 1 user -> 903000 * 1 = 232000 < 1383000 -> throughput = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   105
  // 3 user -> 232000 * 3 = 696000 < 1383000 -> througphut = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   106
  // 6 user -> 232000 * 6 = 139200 > 1383000 -> throughput = 1383000 / 6 = 230500 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   107
  // 12 user -> 232000 * 12 = 2784000 > 1383000 -> throughput =  1383000 / 12 = 115250 byte/sec
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   108
  // UPLINK - DISTANCE 4800 -> MCS 14 -> Itbs 13 (from table 7.1.7.2.1-1 of 36.213)
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   109
  // 1 user -> 25 PRB at Itbs 13 -> 807 -> 807000 > 232000 -> throughput = 232000 bytes/sec
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   110
  // 3 users -> 8 PRB at Itbs 13 -> 253 -> 253000 > 232000 -> throughput = 232000 bytes/sec
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   111
  // 6 users -> 4 PRB at Itbs 13 -> 125 -> 125000 < 232000 -> throughput = 125000 bytes/sec
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   112
  // after the patch enforcing min 3 PRBs per UE:
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   113
  // 12 users -> 3 PRB at Itbs 13 -> 93  bytes * 8/12 UE/TTI  -> 62000 < 232000 -> throughput = 62000  bytes/sec
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   114
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (1,0,4800,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   115
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (3,0,4800,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   116
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (6,0,4800,230500,125000,200,1,errorModel), TestCase::EXTENSIVE);
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   117
  //AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (12,0,4800,75250,62000,200,1,errorModel)); // simulation time = 1.5, otherwise, ul test will fail
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   118
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   119
  // DOWNLINK - DISTANCE 6000 -> MCS 20 -> Itbs 18 (from table 7.1.7.2.1-1 of 36.213)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   120
  // Traffic info
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   121
  //   UDP traffic: payload size = 200 bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   122
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 232000 byte/rate 
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   123
  // Totol bandwidth: 24 PRB at Itbs 18 -> 1191 -> 1191000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   124
  // 1 user -> 903000 * 1 = 232000 < 1191000 -> throughput = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   125
  // 3 user -> 232000 * 3 = 696000 < 1191000 -> througphut = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   126
  // 6 user -> 232000 * 6 = 1392000 > 1191000 -> throughput = 1191000 / 6 = 198500 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   127
  // 12 user -> 232000 * 12 = 2784000 > 1191000 -> throughput =  1191000 / 12 = 99250 byte/sec
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   128
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   129
  // UPLINK - DISTANCE 6000 -> MCS 12 -> Itbs 11 (from table 7.1.7.2.1-1 of 36.213)
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   130
  // 1 user -> 25 PRB at Itbs 11 -> 621 -> 621000 > 232000 -> throughput = 232000 bytes/sec
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   131
  // 3 users -> 8 PRB at Itbs 11 -> 201 -> 201000 < 232000 -> throughput = 201000  bytes/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   132
  // 6 users -> 4 PRB at Itbs 11 -> 97 -> 97000 < 232000 -> throughput = 97000 bytes/sec
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   133
  // after the patch enforcing min 3 PRBs per UE:
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   134
  // 12 users -> 3 PRB at Itbs 11 -> 73 bytes * 8/12 UE/TTI -> 48667 < 232000 -> throughput = 48667 bytes/sec
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   135
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (1,0,6000,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   136
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (3,0,6000,232000,201000,200,1,errorModel), TestCase::EXTENSIVE);
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   137
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (6,0,6000,198500,97000,200,1,errorModel), TestCase::EXTENSIVE);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   138
  //AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (12,0,6000,99250,48667,200,1, errorModel)); // simulation time = 1.5, otherwise, ul test will fail
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   139
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   140
  // DOWNLINK - DISTANCE 10000 -> MCS 14 -> Itbs 13 (from table 7.1.7.2.1-1 of 36.213)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   141
  // Traffic info
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   142
  //   UDP traffic: payload size = 200 bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   143
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 232000 byte/rate 
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   144
  // Totol bandwidth: 24 PRB at Itbs 13 -> 775 -> 775000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   145
  // 1 user -> 903000 * 1 = 232000 < 775000 -> throughput = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   146
  // 3 user -> 232000 * 3 = 696000 < 775000 -> througphut = 232000 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   147
  // 6 user -> 232000 * 6 = 139200 > 775000 -> throughput = 775000 / 6 = 129166 byte/sec
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   148
  // 12 user -> 232000 * 12 = 2784000 > 775000 -> throughput =  775000 / 12 = 64583 byte/sec
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   149
  // UPLINK - DISTANCE 10000 -> MCS 8 -> Itbs 8 (from table 7.1.7.2.1-1 of 36.213)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   150
  // 1 user -> 24 PRB at Itbs 8 -> 437 -> 437000 > 232000 -> throughput = 232000 bytes/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   151
  // 3 users -> 8 PRB at Itbs 8 -> 137 -> 137000 < 232000 -> throughput = 137000 bytes/sec
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   152
  // 6 users -> 4 PRB at Itbs 8 -> 67 -> 67000 < 232000 -> throughput = 67000 bytes/sec
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   153
  // after the patch enforcing min 3 PRBs per UE:
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   154
  // 12 users -> 3 PRB at Itbs 8 -> 49 bytes * 8/12 UE/TTI -> 32667 < 232000 -> throughput = 32667  bytes/sec
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   155
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (1,0,10000,232000,232000,200,1,errorModel), TestCase::EXTENSIVE);
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   156
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (3,0,10000,232000,137000,200,1,errorModel), TestCase::EXTENSIVE);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   157
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (6,0,10000,129166,67000,200,1,errorModel), TestCase::EXTENSIVE);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   158
  //AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase1 (12,0,10000,64583,32667,200,1,errorModel));// simulation time = 1.5, otherwise, ul test will fail
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   159
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   160
  // Test Case 2: homogeneous flow test in FDTBFQ (different distance)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   161
  // Traffic1 info
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   162
  //   UDP traffic: payload size = 100 bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   163
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 132000 byte/rate 
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   164
  // Maximum throughput = 4 / ( 1/2196000 + 1/1191000 + 1/1383000 + 1/775000 ) = 1209046 byte/s
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   165
  // 132000 * 4 = 528000 < 1209046 -> estimated throughput in downlink = 132000 byte/sec
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   166
  std::vector<uint16_t> dist1;
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   167
  dist1.push_back (0);       // User 0 distance --> MCS 28
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   168
  dist1.push_back (4800);    // User 1 distance --> MCS 22
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   169
  dist1.push_back (6000);    // User 2 distance --> MCS 20
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   170
  dist1.push_back (10000);   // User 3 distance --> MCS 14
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   171
  std::vector<uint16_t> packetSize1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   172
  packetSize1.push_back (100);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   173
  packetSize1.push_back (100);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   174
  packetSize1.push_back (100);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   175
  packetSize1.push_back (100);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   176
  std::vector<uint32_t> estThrFdTbfqDl1;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   177
  estThrFdTbfqDl1.push_back (132000); // User 0 estimated TTI throughput from FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   178
  estThrFdTbfqDl1.push_back (132000); // User 1 estimated TTI throughput from FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   179
  estThrFdTbfqDl1.push_back (132000); // User 2 estimated TTI throughput from FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   180
  estThrFdTbfqDl1.push_back (132000); // User 3 estimated TTI throughput from FDTBFQ
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   181
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase2 (dist1,estThrFdTbfqDl1,packetSize1,1,errorModel), TestCase::EXTENSIVE);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   182
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   183
  // Traffic2 info
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   184
  //   UDP traffic: payload size = 300 bytes, interval = 1 ms
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   185
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> 332000 byte/rate
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   186
  // Maximum throughput = 4 / ( 1/2196000 + 1/1191000 + 1/1383000 + 1/775000 ) = 1209046 byte/s
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   187
  // 232000 * 4 = 1328000 > 1209046 -> estimated throughput in downlink = 1209046 / 4 = 302266 byte/sec
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   188
  std::vector<uint16_t> dist2;
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   189
  dist2.push_back (0);       // User 0 distance --> MCS 28
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   190
  dist2.push_back (4800);    // User 1 distance --> MCS 22
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   191
  dist2.push_back (6000);    // User 2 distance --> MCS 20
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   192
  dist2.push_back (10000);   // User 3 distance --> MCS 14
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   193
  std::vector<uint16_t> packetSize2;
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   194
  packetSize2.push_back (300);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   195
  packetSize2.push_back (300);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   196
  packetSize2.push_back (300);
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   197
  packetSize2.push_back (300);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   198
  std::vector<uint32_t> estThrFdTbfqDl2;
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   199
  estThrFdTbfqDl2.push_back (302266); // User 0 estimated TTI throughput from FDTBFQ
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   200
  estThrFdTbfqDl2.push_back (302266); // User 1 estimated TTI throughput from FDTBFQ
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   201
  estThrFdTbfqDl2.push_back (302266); // User 2 estimated TTI throughput from FDTBFQ
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   202
  estThrFdTbfqDl2.push_back (302266); // User 3 estimated TTI throughput from FDTBFQ
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   203
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase2 (dist2,estThrFdTbfqDl2,packetSize2,1,errorModel), TestCase::EXTENSIVE);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   204
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   205
  // Test Case 3: heterogeneous flow test in FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   206
  //   UDP traffic: payload size = [100,200,300] bytes, interval = 1 ms
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   207
  //   UDP rate in scheduler: (payload + RLC header + PDCP header + IP header + UDP header) * 1000 byte/sec -> [132000, 232000, 332000] byte/rate 
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   208
  // Maximum throughput = 3 / ( 1/2196000 + 1/1191000 + 1/1383000) = 1486569 byte/s
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   209
  // 132000 + 232000 + 332000 = 696000 < 1486569 -> estimated throughput in downlink = [132000, 232000, 332000] byte/sec
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   210
  std::vector<uint16_t> dist3;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   211
  dist3.push_back (0);    // User 0 distance --> MCS 28
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   212
  dist3.push_back (4800);    // User 1 distance --> MCS 22
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   213
  dist3.push_back (6000);    // User 2 distance --> MCS 20
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   214
  std::vector<uint16_t> packetSize3;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   215
  packetSize3.push_back (100);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   216
  packetSize3.push_back (200);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   217
  packetSize3.push_back (300);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   218
  std::vector<uint32_t> estThrFdTbfqDl3;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   219
  estThrFdTbfqDl3.push_back (132000); // User 0 estimated TTI throughput from FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   220
  estThrFdTbfqDl3.push_back (232000); // User 1 estimated TTI throughput from FDTBFQ
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   221
  estThrFdTbfqDl3.push_back (332000); // User 2 estimated TTI throughput from FDTBFQ
9680
31fbdb962ad0 re-applied variable test scope for PSS, TDTBFQ and FDTBFQ LTE scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9677
diff changeset
   222
  AddTestCase (new LenaFdTbfqFfMacSchedulerTestCase2 (dist3,estThrFdTbfqDl3,packetSize3,1,errorModel), TestCase::QUICK);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   223
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   224
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   225
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   226
static LenaTestFdTbfqFfMacSchedulerSuite lenaTestFdTbfqFfMacSchedulerSuite;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   227
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   228
// --------------- T E S T - C A S E   # 1 ------------------------------
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   229
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   230
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   231
std::string 
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   232
LenaFdTbfqFfMacSchedulerTestCase1::BuildNameString (uint16_t nUser, uint16_t dist)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   233
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   234
  std::ostringstream oss;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   235
  oss << nUser << " UEs, distance " << dist << " m";
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   236
  return oss.str ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   237
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   238
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   239
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   240
LenaFdTbfqFfMacSchedulerTestCase1::LenaFdTbfqFfMacSchedulerTestCase1 (uint16_t nUser, uint16_t nLc, uint16_t dist, double thrRefDl, double thrRefUl, uint16_t packetSize, uint16_t interval,bool errorModelEnabled)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   241
  : TestCase (BuildNameString (nUser, dist)),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   242
    m_nUser (nUser),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   243
    m_dist (dist),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   244
    m_packetSize (packetSize),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   245
    m_interval (interval),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   246
    m_thrRefDl (thrRefDl),
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   247
    m_thrRefUl (thrRefUl),
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   248
    m_errorModelEnabled (errorModelEnabled)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   249
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   250
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   251
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   252
LenaFdTbfqFfMacSchedulerTestCase1::~LenaFdTbfqFfMacSchedulerTestCase1 ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   253
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   254
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   255
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   256
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   257
LenaFdTbfqFfMacSchedulerTestCase1::DoRun (void)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   258
{
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   259
  NS_LOG_FUNCTION (this << GetName ());
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   260
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   261
  if (!m_errorModelEnabled)
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   262
    {
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   263
      Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   264
      Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   265
    }
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   266
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   267
  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   268
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   269
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   270
  Ptr<EpcHelper>  epcHelper = CreateObject<EpcHelper> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   271
  lteHelper->SetEpcHelper (epcHelper);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   272
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   273
  //LogComponentEnable ("FdTbfqFfMacScheduler", LOG_DEBUG);
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   274
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   275
  Ptr<Node> pgw = epcHelper->GetPgwNode ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   276
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   277
  // Create a single RemoteHost
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   278
  NodeContainer remoteHostContainer;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   279
  remoteHostContainer.Create (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   280
  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   281
  InternetStackHelper internet;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   282
  internet.Install (remoteHostContainer);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   283
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   284
  // Create the Internet
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   285
  PointToPointHelper p2ph;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   286
  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   287
  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   288
  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.001)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   289
  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   290
  Ipv4AddressHelper ipv4h;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   291
  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   292
  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   293
  // interface 0 is localhost, 1 is the p2p device
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   294
  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   295
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   296
  Ipv4StaticRoutingHelper ipv4RoutingHelper;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   297
  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   298
  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   299
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   300
  //Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   301
  //Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   302
  //Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   303
  //Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   304
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   305
  //Config::SetDefault ("ns3::LteEnbRrc::EpsBearerToRlcMapping", EnumValue (LteHelper::RLC_UM_ALWAYS));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   306
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   307
//   LogComponentDisableAll (LOG_LEVEL_ALL);
9156
b08c2b497837 disabled useless tracing and loggin in lte-*-ff-mac-scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9149
diff changeset
   308
  //LogComponentEnable ("LenaTestFdTbfqFfMacCheduler", LOG_LEVEL_ALL);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   309
   
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   310
  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   311
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   312
  // Create Nodes: eNodeB and UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   313
  NodeContainer enbNodes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   314
  NodeContainer ueNodes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   315
  enbNodes.Create (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   316
  ueNodes.Create (m_nUser);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   317
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   318
  // Install Mobility Model
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   319
  MobilityHelper mobility;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   320
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   321
  mobility.Install (enbNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   322
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   323
  mobility.Install (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   324
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   325
  // Create Devices and install them in the Nodes (eNB and UE)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   326
  NetDeviceContainer enbDevs;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   327
  NetDeviceContainer ueDevs;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   328
  lteHelper->SetSchedulerType ("ns3::FdTbfqFfMacScheduler");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   329
  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   330
  ueDevs = lteHelper->InstallUeDevice (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   331
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   332
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   333
  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   334
  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   335
  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   336
  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   337
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   338
  // Set UEs' position and power
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   339
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   340
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   341
      Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   342
      mm->SetPosition (Vector (m_dist, 0.0, 0.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   343
      Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   344
      Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   345
      uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   346
      uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   347
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   348
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   349
  // Install the IP stack on the UEs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   350
  internet.Install (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   351
  Ipv4InterfaceContainer ueIpIface;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   352
  ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   353
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   354
  // Assign IP address to UEs
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   355
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   356
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   357
      Ptr<Node> ueNode = ueNodes.Get (u);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   358
      // Set the default gateway for the UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   359
      Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   360
      ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   361
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   362
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   363
  // Attach a UE to a eNB
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   364
  lteHelper->Attach (ueDevs, enbDevs.Get (0));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   365
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   366
  // Activate an EPS bearer on all UEs
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   367
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   368
    {
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   369
      Ptr<NetDevice> ueDevice = ueDevs.Get (u);
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   370
      GbrQosInformation qos;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   371
      qos.gbrDl = (m_packetSize + 32) * (1000 / m_interval) * 8;  // bit/s, considering IP, UDP, RLC, PDCP header size
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   372
      qos.gbrUl = 0;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   373
      qos.mbrDl = qos.gbrDl;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   374
      qos.mbrUl = 0;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   375
      
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   376
      enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   377
      EpsBearer bearer (q, qos);
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   378
      lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());  
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   379
    }
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   380
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   381
  // Install downlind and uplink applications
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   382
  uint16_t dlPort = 1234;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   383
  uint16_t ulPort = 2000;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   384
  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   385
  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   386
  ApplicationContainer clientApps;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   387
  ApplicationContainer serverApps;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   388
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   389
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   390
      ++ulPort;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   391
      serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive packets from remotehost
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   392
      serverApps.Add (ulPacketSinkHelper.Install (remoteHost));  // receive packets from UEs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   393
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   394
      UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink packets generator
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   395
      dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   396
      dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   397
      dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   398
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   399
      UdpClientHelper ulClient (remoteHostAddr, ulPort);           // downlink packets generator
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   400
      ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   401
      ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   402
      ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   403
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   404
      clientApps.Add (dlClient.Install (remoteHost));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   405
      clientApps.Add (ulClient.Install (ueNodes.Get (u)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   406
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   407
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   408
  serverApps.Start (Seconds (0.001));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   409
  clientApps.Start (Seconds (0.001));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   410
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   411
  double statsStartTime = 0.001; // need to allow for RRC connection establishment + SRS
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   412
  double statsDuration = 1;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   413
  double tolerance = 0.1;
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   414
  Simulator::Stop (Seconds (statsStartTime + statsDuration - 0.0001));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   415
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   416
  lteHelper->EnableRlcTraces ();
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   417
  lteHelper->EnableMacTraces ();
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   418
  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   419
  rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   420
  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   421
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   422
  Simulator::Run ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   423
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   424
  /**
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   425
   * Check that the downlink assignation is done in a "token bank fair queue" manner
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   426
   */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   427
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   428
  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s) at distance " << m_dist);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   429
  std::vector <uint64_t> dlDataRxed;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   430
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   431
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   432
      // get the imsi
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   433
      uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   434
      // get the lcId
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   435
      uint8_t lcId = 4;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   436
      uint64_t data = rlcStats->GetDlRxData (imsi, lcId);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   437
      dlDataRxed.push_back (data);
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   438
      NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << "  thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_thrRefDl);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   439
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   440
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   441
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   442
    {
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   443
      NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / statsDuration, m_thrRefDl, m_thrRefDl * tolerance, " Unfair Throughput!");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   444
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   445
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   446
  /**
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   447
  * Check that the uplink assignation is done in a "round robin" manner
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   448
  */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   449
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   450
  NS_LOG_INFO ("UL - Test with " << m_nUser << " user(s) at distance " << m_dist);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   451
  std::vector <uint64_t> ulDataRxed;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   452
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   453
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   454
      // get the imsi
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   455
      uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   456
      // get the lcId
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   457
      uint8_t lcId = 4;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   458
      ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   459
      NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)ulDataRxed.at (i) << "  thr " << (double)ulDataRxed.at (i) / statsDuration << " ref " << m_thrRefUl);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   460
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   461
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   462
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   463
    {
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   464
      NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / statsDuration, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   465
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   466
  Simulator::Destroy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   467
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   468
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   469
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   470
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   471
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   472
// --------------- T E S T - C A S E   # 2 ------------------------------
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   473
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   474
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   475
std::string 
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   476
LenaFdTbfqFfMacSchedulerTestCase2::BuildNameString (uint16_t nUser, std::vector<uint16_t> dist)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   477
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   478
  std::ostringstream oss;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   479
  oss << "distances (m) = [ " ;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   480
  for (std::vector<uint16_t>::iterator it = dist.begin (); it != dist.end (); ++it)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   481
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   482
      oss << *it << " ";
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   483
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   484
  oss << "]";
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   485
  return oss.str ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   486
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   487
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   488
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   489
LenaFdTbfqFfMacSchedulerTestCase2::LenaFdTbfqFfMacSchedulerTestCase2 (std::vector<uint16_t> dist, std::vector<uint32_t> estThrFdTbfqDl, std::vector<uint16_t> packetSize, uint16_t interval,bool errorModelEnabled)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   490
  : TestCase (BuildNameString (dist.size (), dist)),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   491
    m_nUser (dist.size ()),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   492
    m_dist (dist),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   493
    m_packetSize (packetSize),
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   494
    m_interval (interval),
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   495
    m_estThrFdTbfqDl (estThrFdTbfqDl),
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   496
    m_errorModelEnabled (errorModelEnabled)
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   497
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   498
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   499
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   500
LenaFdTbfqFfMacSchedulerTestCase2::~LenaFdTbfqFfMacSchedulerTestCase2 ()
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   501
{
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   502
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   503
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   504
void
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   505
LenaFdTbfqFfMacSchedulerTestCase2::DoRun (void)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   506
{
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   507
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   508
  if (!m_errorModelEnabled)
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   509
    {
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   510
      Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   511
      Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   512
    }
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   513
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   514
  Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true));
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   515
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   516
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   517
  Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   518
  Ptr<EpcHelper>  epcHelper = CreateObject<EpcHelper> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   519
  lteHelper->SetEpcHelper (epcHelper);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   520
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   521
  Ptr<Node> pgw = epcHelper->GetPgwNode ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   522
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   523
  // Create a single RemoteHost
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   524
  NodeContainer remoteHostContainer;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   525
  remoteHostContainer.Create (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   526
  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   527
  InternetStackHelper internet;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   528
  internet.Install (remoteHostContainer);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   529
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   530
  // Create the Internet
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   531
  PointToPointHelper p2ph;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   532
  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   533
  p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   534
  p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.001)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   535
  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   536
  Ipv4AddressHelper ipv4h;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   537
  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   538
  Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   539
  // interface 0 is localhost, 1 is the p2p device
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   540
  Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   541
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   542
  Ipv4StaticRoutingHelper ipv4RoutingHelper;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   543
  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   544
  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   545
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   546
10107
88e2b4465de4 Adjust test vectors of scheduler extensive tests with new MCS BLER curves
Marco Miozzo <marco.miozzo@cttc.es>
parents: 9680
diff changeset
   547
//   LogComponentDisableAll (LOG_LEVEL_ALL);
9156
b08c2b497837 disabled useless tracing and loggin in lte-*-ff-mac-scheduler tests
Nicola Baldo <nicola@baldo.biz>
parents: 9149
diff changeset
   548
  //LogComponentEnable ("LenaTestFdTbfqFfMacCheduler", LOG_LEVEL_ALL);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   549
   
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   550
  lteHelper->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   551
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   552
  // Create Nodes: eNodeB and UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   553
  NodeContainer enbNodes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   554
  NodeContainer ueNodes;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   555
  enbNodes.Create (1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   556
  ueNodes.Create (m_nUser);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   557
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   558
  // Install Mobility Model
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   559
  MobilityHelper mobility;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   560
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   561
  mobility.Install (enbNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   562
  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   563
  mobility.Install (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   564
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   565
  // Create Devices and install them in the Nodes (eNB and UE)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   566
  NetDeviceContainer enbDevs;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   567
  NetDeviceContainer ueDevs;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   568
  lteHelper->SetSchedulerType ("ns3::FdTbfqFfMacScheduler");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   569
  enbDevs = lteHelper->InstallEnbDevice (enbNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   570
  ueDevs = lteHelper->InstallUeDevice (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   571
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   572
  Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   573
  Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   574
  enbPhy->SetAttribute ("TxPower", DoubleValue (30.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   575
  enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   576
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   577
  // Set UEs' position and power
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   578
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   579
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   580
      Ptr<ConstantPositionMobilityModel> mm = ueNodes.Get (i)->GetObject<ConstantPositionMobilityModel> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   581
      mm->SetPosition (Vector (m_dist.at (i), 0.0, 0.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   582
      Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   583
      Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   584
      uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   585
      uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   586
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   587
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   588
  // Install the IP stack on the UEs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   589
  internet.Install (ueNodes);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   590
  Ipv4InterfaceContainer ueIpIface;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   591
  ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   592
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   593
  // Assign IP address to UEs
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   594
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   595
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   596
      Ptr<Node> ueNode = ueNodes.Get (u);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   597
      // Set the default gateway for the UE
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   598
      Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv4> ());
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   599
      ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   600
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   601
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   602
  // Attach a UE to a eNB
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   603
  lteHelper->Attach (ueDevs, enbDevs.Get (0));
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   604
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   605
  // Activate an EPS bearer on all UEs
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   606
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   607
  uint16_t mbrDl = 0;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   608
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   609
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   610
      mbrDl = mbrDl + m_packetSize.at (u);
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   611
    }
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   612
  mbrDl = mbrDl / ueNodes.GetN (); 
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   613
9655
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   614
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   615
    {
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   616
      Ptr<NetDevice> ueDevice = ueDevs.Get (u);
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   617
      GbrQosInformation qos;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   618
      qos.gbrDl = (mbrDl + 32) * (1000 / m_interval) * 8;  // bit/s, considering IP, UDP, RLC, PDCP header size
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   619
      qos.gbrUl = 0;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   620
      qos.mbrDl = qos.gbrDl;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   621
      qos.mbrUl = 0;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   622
  
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   623
      enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   624
      EpsBearer bearer (q, qos);
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   625
      lteHelper->ActivateDedicatedEpsBearer (ueDevice, bearer, EpcTft::Default ());  
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   626
    }
72ed5eddc62b updated PSS, TDTBFQ and FDTBFQ scheduler tests
Nicola Baldo <nbaldo@cttc.es>
parents: 9653
diff changeset
   627
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   628
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   629
  // Install downlind and uplink applications
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   630
  uint16_t dlPort = 1234;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   631
  uint16_t ulPort = 2000;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   632
  PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   633
  PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   634
  ApplicationContainer clientApps;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   635
  ApplicationContainer serverApps;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   636
  for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   637
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   638
      ++ulPort;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   639
      serverApps.Add (dlPacketSinkHelper.Install (ueNodes.Get (u))); // receive packets from remotehost
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   640
      serverApps.Add (ulPacketSinkHelper.Install (remoteHost));  // receive packets from UEs
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   641
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   642
      UdpClientHelper dlClient (ueIpIface.GetAddress (u), dlPort); // uplink packets generator
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   643
      dlClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   644
      dlClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   645
      dlClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   646
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   647
      UdpClientHelper ulClient (remoteHostAddr, ulPort);           // downlink packets generator
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   648
      ulClient.SetAttribute ("Interval", TimeValue (MilliSeconds (m_interval)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   649
      ulClient.SetAttribute ("MaxPackets", UintegerValue (1000000));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   650
      ulClient.SetAttribute ("PacketSize", UintegerValue (m_packetSize.at (u)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   651
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   652
      clientApps.Add (dlClient.Install (remoteHost));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   653
      clientApps.Add (ulClient.Install (ueNodes.Get (u)));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   654
   }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   655
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   656
  serverApps.Start (Seconds (0.001));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   657
  clientApps.Start (Seconds (0.001));
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   658
9677
31a4e3806084 Update PSS, FDTBFQ, TDTBFQ's code and testcases
Dizhi Zhou <dizhi.zhou@gmail.com>
parents: 9675
diff changeset
   659
  double statsStartTime = 0.001; // need to allow for RRC connection establishment + SRS
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   660
  double statsDuration = 1.0;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   661
  double tolerance = 0.1;
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   662
  Simulator::Stop (Seconds (statsStartTime + statsDuration - 0.0001));
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   663
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   664
  lteHelper->EnableRlcTraces ();
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   665
  Ptr<RadioBearerStatsCalculator> rlcStats = lteHelper->GetRlcStats ();
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   666
  rlcStats->SetAttribute ("StartTime", TimeValue (Seconds (statsStartTime)));
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   667
  rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (statsDuration)));
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   668
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   669
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   670
  Simulator::Run ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   671
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   672
  /**
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   673
   * Check that the downlink assignation is done in a "token bank fair queue" manner
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   674
   */
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   675
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   676
  NS_LOG_INFO ("DL - Test with " << m_nUser << " user(s)");
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   677
  std::vector <uint64_t> dlDataRxed;
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   678
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   679
    {
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   680
      // get the imsi
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   681
      uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   682
      // get the lcId
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   683
      uint8_t lcId = 4;
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   684
      dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   685
      NS_LOG_INFO ("\tUser " << i << " dist " << m_dist.at (i) << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << "  thr " << (double)dlDataRxed.at (i) / statsDuration << " ref " << m_nUser);
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   686
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   687
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   688
  for (int i = 0; i < m_nUser; i++)
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   689
    {
9653
382d27da8905 merged lena-dev with ns-3-dev
Nicola Baldo <nbaldo@cttc.es>
parents: 9181
diff changeset
   690
      NS_TEST_ASSERT_MSG_EQ_TOL ((double)dlDataRxed.at (i) / statsDuration, m_estThrFdTbfqDl.at (i), m_estThrFdTbfqDl.at (i) * tolerance, " Unfair Throughput!");
9149
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   691
    }
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   692
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   693
  Simulator::Destroy ();
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   694
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   695
}
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   696
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   697
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   698
} // namespace ns3
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   699
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   700
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   701
2580b67c83b3 GSoC 2012 NS-3 LTE MAC schedulers
Dizhi Zhou <dizhi.zhou@gmail.com>
parents:
diff changeset
   702