src/lte/test/lte-test-downlink-power-control.h
author Tom Henderson <tomh@tomh.org>
Mon, 28 Sep 2015 20:27:25 -0700
changeset 11676 05ea1489e509
parent 10892 3e86fac77082
permissions -rw-r--r--
bug 2184: Integer overflow in MacLow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10892
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     2
/*
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2014 Piotr Gawlowicz
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     4
 *
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     8
 *
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    13
 *
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    17
 *
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    18
 * Author: Piotr Gawlowicz <gawlowicz.p@gmail.com>
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    19
 *
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    20
 */
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    21
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    22
#ifndef LTE_TEST_DOWNLINK_POWER_CONTROL_H
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    23
#define LTE_TEST_DOWNLINK_POWER_CONTROL_H
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    24
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    25
#include "ns3/spectrum-value.h"
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    26
#include <ns3/lte-rrc-sap.h>
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    27
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    28
#include "ns3/spectrum-test.h"
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    29
#include "ns3/lte-spectrum-value-helper.h"
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    30
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    31
#include "ns3/test.h"
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    32
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    33
using namespace ns3;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    34
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    35
/**
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    36
 * Test 1.1 SINR calculation in downlink
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    37
 */
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    38
class LteDownlinkPowerControlTestSuite : public TestSuite
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    39
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    40
public:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    41
  LteDownlinkPowerControlTestSuite ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    42
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    43
  double CalculateRbTxPower (double txPower, uint8_t pa);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    44
};
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    45
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    46
class LteDownlinkPowerControlSpectrumValueTestCase : public TestCase
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    47
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    48
public:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    49
  LteDownlinkPowerControlSpectrumValueTestCase (std::string name,
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    50
                                                uint16_t earfcn, uint8_t bw, double powerTx,
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    51
                                                std::map<int, double> powerTxMap, std::vector <int> activeRbs,
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    52
                                                SpectrumValue& expected);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    53
  virtual ~LteDownlinkPowerControlSpectrumValueTestCase ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    54
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    55
private:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    56
  virtual void DoRun (void);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    57
  Ptr<SpectrumValue> m_actual;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    58
  Ptr<SpectrumValue> m_expected;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    59
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    60
};
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    61
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    62
class LteDownlinkPowerControlTestCase : public TestCase
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    63
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    64
public:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    65
  LteDownlinkPowerControlTestCase (bool changePower, uint8_t pa, std::string name);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    66
  virtual ~LteDownlinkPowerControlTestCase ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    67
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    68
private:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    69
  virtual void DoRun (void);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    70
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    71
  bool m_changePdschConfigDedicated;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    72
  LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    73
  double m_expectedPowerDiff;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    74
};
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    75
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    76
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    77
class LteDownlinkPowerControlRrcConnectionReconfigurationTestCase : public TestCase
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    78
{
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    79
public:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    80
  LteDownlinkPowerControlRrcConnectionReconfigurationTestCase (bool useIdealRrc, std::string name);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    81
  virtual ~LteDownlinkPowerControlRrcConnectionReconfigurationTestCase ();
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    82
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    83
  void ConnectionReconfigurationEnb (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    84
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    85
  void ConnectionReconfigurationUe (std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    86
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    87
  void ChangePdschConfigDedicated (uint16_t rnti, uint8_t pa);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    88
private:
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    89
  virtual void DoRun (void);
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    90
  bool m_useIdealRrc;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    91
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    92
  bool m_changePdschConfigDedicatedTriggered;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    93
  bool m_connectionReconfigurationUeReceived;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    94
  bool m_connectionReconfigurationEnbCompleted;
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    95
};
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    96
3e86fac77082 GSoC 2014 FFR algorithms
Piotr Gawlowicz <gawlowicz.p@gmail.com>
parents:
diff changeset
    97
#endif /* LTE_TEST_DOWNLINK_POWER_CONTROL_H */