merge with PEM and solve merge errors
@@ -658,7 +658,7 @@ BuildingsPropagationLossModel::GetLoss (Ptr<MobilityModel> a, Ptr<MobilityModel>
|
||||
{
|
||||
// out of bound
|
||||
loss = std::numeric_limits<double>::infinity ();
|
||||
NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> ITUR1411 : " << loss);
|
||||
NS_LOG_INFO (this << " 0-0 (>2000): down rooftop -> Infinity (out of bound) : " << loss);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -23,6 +23,9 @@ IMAGES_EPS = \
|
||||
$(FIGURES)/lte-arch-data-rrc-pdcp-rlc.eps \
|
||||
$(FIGURES)/lte-epc-e2e-data-protocol-stack.eps
|
||||
|
||||
$(FIGURES)/MCS_2_test.eps \
|
||||
$(FIGURES)/MCS_12_test.eps \
|
||||
$(FIGURES)/MCS_14_test.eps
|
||||
|
||||
# specify figures for build process (all eps figures)
|
||||
GRAPHS_EPS = \
|
||||
@@ -84,6 +87,20 @@ IMAGES_OTHER = $(FIGURES)/fading_pedestrian.png \
|
||||
$(FIGURES)/fading_pedestrian.pdf \
|
||||
$(FIGURES)/fading_vehicular.pdf \
|
||||
$(FIGURES)/fading_urban_3kmph.pdf \
|
||||
$(FIGURES)/MCS_1_4.pdf \
|
||||
$(FIGURES)/MCS_1_4.png \
|
||||
$(FIGURES)/MCS_5_8.pdf \
|
||||
$(FIGURES)/MCS_5_8.png \
|
||||
$(FIGURES)/MCS_9_12.pdf \
|
||||
$(FIGURES)/MCS_9_12.png \
|
||||
$(FIGURES)/MCS_13_16.pdf \
|
||||
$(FIGURES)/MCS_13_16.png \
|
||||
$(FIGURES)/MCS_17_20.pdf \
|
||||
$(FIGURES)/MCS_17_20.png \
|
||||
$(FIGURES)/MCS_21_24.pdf \
|
||||
$(FIGURES)/MCS_21_24.png \
|
||||
$(FIGURES)/MCS_25_27.pdf \
|
||||
$(FIGURES)/MCS_25_27.png
|
||||
$(FIGURES)/lte-phy-interference.png \
|
||||
$(FIGURES)/lte-phy-interference.pdf \
|
||||
$(FIGURES)/helpers.png \
|
||||
|
||||
@@ -181,7 +181,8 @@ latex_documents = [
|
||||
# ('lte-testing', 'lte-doc-testing.tex', u'LTE Simulator Testing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
# ('lte-design', 'lte-doc-design.tex', u'LTE Simulator Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
# ('lte-user', 'lte-doc-user.tex', u'LTE Simulator User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
('lte', 'lte-sim-doc.tex', u'LTE Simulator Documentation', u'Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
('lte-phy-error-model-design', 'lte-phy-error-model-design.tex', u'LTE Simulator Phy Error Model Desing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
#('lte', 'lte-sim-doc.tex', u'LTE Simulator Documentation', u'Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
|
||||
1511
src/lte/doc/source/figures/MCS_12_test.eps
Normal file
BIN
src/lte/doc/source/figures/MCS_12_test.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_13_16.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_13_16.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
1641
src/lte/doc/source/figures/MCS_14_test.eps
Normal file
BIN
src/lte/doc/source/figures/MCS_14_test.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_17_20.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_17_20.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
src/lte/doc/source/figures/MCS_1_4.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_1_4.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
src/lte/doc/source/figures/MCS_21_24.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_21_24.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
src/lte/doc/source/figures/MCS_25_27.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_25_27.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
1715
src/lte/doc/source/figures/MCS_2_test.eps
Normal file
BIN
src/lte/doc/source/figures/MCS_2_test.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_5_8.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_5_8.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
src/lte/doc/source/figures/MCS_9_12.pdf
Normal file
BIN
src/lte/doc/source/figures/MCS_9_12.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
66407
src/lte/doc/source/figures/miesm_scheme.eps
Normal file
BIN
src/lte/doc/source/figures/miesm_scheme.pdf
Normal file
200
src/lte/doc/source/lte-phy-error-model-design.rst
Normal file
@@ -0,0 +1,200 @@
|
||||
|
||||
|
||||
|
||||
++++++++++++++++++++++++++
|
||||
Design Documentation
|
||||
++++++++++++++++++++++++++
|
||||
|
||||
|
||||
PHY Error Model
|
||||
+++++++++++++++
|
||||
|
||||
The simulator includes an error model of the data plane (i.e., PDSCH) according to the standard link-to-system mapping (LSM) techniques. The choice is aligned with the standard system simulation methodology of OFDMA radio transmission technology. Thanks to LSM we are able to maintain a good level of accuracy and at the same time limiting the computational complexity increase. It is based on the mapping of single link layer performance obtained by means of link level simulators to system (in our case network) simulators. In particular link the layer simulator is used for generating the performance of a single link from a PHY layer perspective, usually in terms of code block error rate (BLER), under specific static conditions. LSM allows the usage of these parameters in more complex scenarios, typical of system/network simulators, where we have more links, interference and "colored" channel propagation phenomena (e.g., frequency selective fading).
|
||||
|
||||
To do this the Vienna LTE Simulator [Vienna]_ has been used for what concerns the extraction of link layer performance and the Mutual Information Based Effective SINR (MIESM) as LSM mapping function using part of the work recently published by the Signet Group of University of Padua [PaduaPEM]_.
|
||||
|
||||
|
||||
MIESM
|
||||
-----
|
||||
|
||||
The specific LSM method adopted is the one based on the usage of a mutual information metric, commonly referred to as the mutual information per per coded bit (MIB or MMIB when a mean of multiples MIBs is involved). Another option would be represented by the Exponential ESM (EESM); however, recent studies demonstrate that MIESM outperforms EESM in terms of accuracy [LozanoCost]_.
|
||||
Moreover, from an HARQ perspective, the MIESM has more flexibility in managing the combinations of the HARQ blocks. In fact, by working in the MI field, the formulas for evaluating both the chase combining (CC) and the incremental redundancy (IR) schemes work in the MI field as well, where there is no dependency respect to the MCS. On the contrary, the HARQ model of EESM works in the effective SINR field, which is MCS dependent, and does not allow the combination of HARQ blocks using different MCSs [wimaxEmd]_.
|
||||
|
||||
.. _fig-miesm-architecture:
|
||||
|
||||
.. figure:: figures/miesm_scheme.*
|
||||
:align: center
|
||||
|
||||
MIESM computational procedure diagram
|
||||
|
||||
The mutual information (MI) is dependent on the constellation mapping and can be calculated per transport block (TB) basis, by evaluating the MI over the symbols and the subcarrier. However, this would be too complex for a network simulator. Hence, in our implementation a flat channel response within the RB has been considered; therefore the overall MI of a TB is calculated averaging the MI evaluated per each RB used in the TB. In detail, the implemented scheme is depicted in Figure :ref:`fig-miesm-architecture`, where we see that the model starts by evaluating the MI value for each RB, represented in the figure by the SINR samples. Then the equivalent MI is evaluated per TB basis by averaging the MI values. Finally, a further step has to be done since the link level simulator returns the performance of the link in terms of block error rate (BLER) in a addive white guassian noise (AWGN) channel, where the blocks are the code blocks (CBs) independently encoded/decoded by the turbo encoder. On this matter the standard 3GPP segmentation scheme has been used for estimating the actual CB size (described in section 5.1.2 of [TS36.212]_). This scheme divides the the TB in :math:`N_{K_-}` blocks of size :math:`K_-` and :math:`N_{K+}` blocks of size :math:`K_+`. Therefore the overall TB BLER (TBLER) can be expressed as
|
||||
|
||||
.. math::
|
||||
|
||||
TBLER = 1- \prod\limits_{i=1}^{C}(1-CBLER_i)
|
||||
|
||||
where the :math:`CBLER_i` is the BLER of the CB :math:`i` obtained according to the link level simulator CB BLER curves.
|
||||
For estimating the :math:`CBLER_i`, the MI evaluation has been implemented according to its numerical approximation defined in [wimaxEmd]_. Moreover, for reducing the complexity of the computation, the approximation has been converted into lookup tables. In detail, Gaussian cumulative model has been used for approximating the AWGN BLER curves with three parameters which provides a close fit to the standard AWGN performances, in formula:
|
||||
|
||||
.. math::
|
||||
|
||||
CBLER_i = \frac{1}{2}\left[1-erf\left(\frac{x-b_{ECR}}{\sqrt{2}c_{ECR}} \right) \right]
|
||||
|
||||
where :math:`x` is the MI of the TB, :math:`b_{ECR}` represents the "transition center" and :math:`c_{ECR}` is related to the "transition width" of the Gaussian cumulative distribution for each Effective Code Rate (ECR) which is the actual transmission rate according to the channel coding and MCS. For limiting the computational complexity of the model we considered only a subset of the possible ECRs in fact we would have potentially 5076 possible ECRs (i.e., 27 MCSs and 188 CB sizes). On this respect, we will limit the CB sizes to some representative values (i.e., 40, 140, 256, 512, 1024, 2048, 4032, 6144), while for the others the worst one approximating the real one will be used (i.e., the smaller CB size value available respect to the real one). This choice is aligned to the typical performance of turbo codes, where the CB size is not strongly impacting on the BLER. However, it is to be notes that for CB sizes lower than 1000 bits the effect might be relevant (i.e., till 2 dB); therefore, we adopt this unbalanced sampling interval for having more precision where it is necessary. This behaviour is confirmed by the figures presented in the Annes Section.
|
||||
|
||||
|
||||
Link Layer Performance
|
||||
---------------------
|
||||
|
||||
On this respect, we reused part of the curves obtained within [PaduaPEM]_. In detail, we introduced the CB size dependency to the CB BLER curves with the support of the developers of [PaduaPEM]_ and of the LTE Vienna Simulator. In fact, the module released provides the link layer performance only for what concerns the MCSs (i.e, with a given fixed ECR). In detail the new error rate curves for each has been evaluated with a simulation campaign with the link layer simulator for a single link with AWGN noise and for CB size of 104, 140, 256, 512, 1024, 2048, 4032 and 6144. These curves has been mapped with the Gaussian cumulative model formula presented above for obtaining the correspondents :math:`b_{ECR}` and :math:`c_{ECR}` parameters.
|
||||
|
||||
|
||||
|
||||
Simulator Design
|
||||
----------------
|
||||
|
||||
The model implemented uses the curves for the LSM of the recently LTE PHY Error Model released in the ns3 community by the Signet Group [PaduaPEM]_ and the new ones generated for different CB sizes. The ``LteSpectrumPhy`` class is in charge of evaluating the TB BLER thanks to the methods provided by the ``LteMiErrorModel`` class, which is in charge of evaluating the TB BLER according to the vector of the perceived SINR per RB, the MCS and the size in order to proper model the segmentation of the TB in CBs. In order to obtain the vector of the perceived SINR two instances of ``LtePemSinrChunkProcessor`` (child of ``LteSinrChunkProcessor`` dedicated to evaluate the SINR for obtaining physical error performance) have been attached to UE downlink and eNB uplink ``LteSpectrumPhy`` modules for evaluating the error model distribution respectively of PDSCH (UE side) and ULSCH (eNB side).
|
||||
|
||||
The model can be disabled for working with a zero-losses channel by setting the ``PemEnabled`` attribute of the ``LteSpectrumPhy`` class (by default is active). This can be done according to the standard ns3 attribute system procedure, that is::
|
||||
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Test Environment
|
||||
----------------
|
||||
|
||||
The test suite ``lte-phy-error-model`` generates nine test cases with single eNB and a various number of UEs, all having the same Radio Bearer specification. Each test is designed for evaluating the error rate perceived by a specific TB size in order to verify that it corresponds to the expected values according to the BLER generated for CB size analog to the TB size. This means that, for instance, the test will check that the performance of a TB of :math:`N` bits is analogous to the one of a a CB size of :math:`N` bits by collecting the performance of a user which has been forced the generation of a such TB size according to the distance to eNB. In order to significantly test the BER at MAC level, we modified the Adaptive Modulation and Coding (AMC) module, the ``LteAmc`` class, for making it less robust to channel conditions by adding a configurable BER parameter (called ``Ber`` in the ns3 attribute system) which enable the selection of the desired BER at MAC level when choosing the MCS to be used. In detail, the AMC module has been forced to select the AMC considering a BER of 0.01 (instead of the standard value equal to 0.00005). We note that, these values do not reflect actual BER since they come from an analytical bound which do not consider all the transmission chain aspects; therefore the resulted BER might be different.
|
||||
|
||||
The parameters of the nine test cases are reported in the following:
|
||||
|
||||
#. 4 UEs placed 898 meters far from the eNB, which implies the use of MCS 2 (SINR of -2.21 dB) and a TB of 176 bits, that in turns produce a BER of 0.19 (see point A in figure :ref:`fig-mcs-2-test`).
|
||||
#. 3 UEs placed 900 meters far from the eNB, which implies the use of MCS 2 (SINR of -2.25 dB) and a TB of 328 bits, that in turns produce a BER of 0.09 (see point B in figure :ref:`fig-mcs-2-test`).
|
||||
#. 2 UEs placed 920 meters far from the eNB, which implies the use of MCS 2 (SINR of -2.61 dB) and a TB of 72 bits, that in turns produce a BER of 0.123 (see point D in figure :ref:`fig-mcs-2-test`).
|
||||
#. 1 UE placed 930 meters far from the eNB, which implies the use of MCS 2 (SINR of -2.79 dB) and a TB of 72 bits, that in turns produce a BER of 0.9 (see point D in figure :ref:`fig-mcs-2-test`).
|
||||
#. 1 UE placed 538 meters far from the eNB, which implies the use of MCS 12 (SINR of 4.19 dB) and a TB of 4776 bits, that in turns produce a BER of 0.017 (see point E in figure :ref:`fig-mcs-12-test`).
|
||||
#. 3 UEs placed 538 meters far from the eNB, which implies the use of MCS 12 (SINR of 4.19 dB) and a TB of 1608 bits, that in turns produce a BER of 0.23 (see point F in figure :ref:`fig-mcs-12-test`).
|
||||
#. 7 UEs placed 538 meters far from the eNB, which implies the use of MCS 12 (SINR of 4.19 dB) and a TB of 376 bits, that in turns produce a BER of 0.72 (see point G in figure :ref:`fig-mcs-12-test`).
|
||||
#. 1 UE placed 500 meters far from the eNB, which implies the use of MCS 14 (SINR of 5.53 dB) and a TB of 6248 bits (segmented in 2 CBs of 3136 bits each one), that in turns produce a BER of 0.18, since each CB has CBLER equal to 0.096 (see point H in figure :ref:`fig-mcs-14-test`).
|
||||
|
||||
|
||||
.. _fig-mcs-2-test:
|
||||
|
||||
.. figure:: figures/MCS_2_test.*
|
||||
:align: center
|
||||
|
||||
|
||||
BLER for tests 1, 2, 3, 4.
|
||||
|
||||
.. _fig-mcs-12-test:
|
||||
|
||||
.. figure:: figures/MCS_12_test.*
|
||||
:align: center
|
||||
|
||||
BLER for tests 5, 6, 7.
|
||||
|
||||
.. _fig-mcs-14-test:
|
||||
|
||||
.. figure:: figures/MCS_14_test.*
|
||||
:align: center
|
||||
|
||||
BLER for test 8.
|
||||
|
||||
The test verifies that in each case the expected number of packets received correct corresponds to a Bernoulli distribution with a confidence interval of 95%, where the probability of success in each trail is :math:`1-BER` and :math:`n` is the total number of packet sent.
|
||||
|
||||
|
||||
Annex
|
||||
-----
|
||||
|
||||
In this section the figures of the BLER of all the MCS are reported (blue lines) together with their correspondent mapping to the Gaussian cumulative distribution (red dashed lines).
|
||||
|
||||
.. _fig-mcs-1-4-ber:
|
||||
|
||||
.. figure:: figures/MCS_1_4.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 1, 2, 3 and 4.
|
||||
|
||||
|
||||
.. _fig-mcs-5-8-ber:
|
||||
|
||||
.. figure:: figures/MCS_5_8.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 5, 6, 7 and 8.
|
||||
|
||||
.. _fig-mcs-9-12-ber:
|
||||
|
||||
.. figure:: figures/MCS_9_12.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 9, 10, 11 and 12.
|
||||
|
||||
.. _fig-mcs-13-16-ber:
|
||||
|
||||
.. figure:: figures/MCS_13_16.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 13, 14, 15 and 16.
|
||||
|
||||
|
||||
.. _fig-mcs-17-20-ber:
|
||||
|
||||
.. figure:: figures/MCS_17_20.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 17, 17, 19 and 20.
|
||||
|
||||
.. _fig-mcs-21-24-ber:
|
||||
|
||||
.. figure:: figures/MCS_21_24.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 21, 22, 23 and 24.
|
||||
|
||||
.. _fig-mcs-25-27-ber:
|
||||
|
||||
.. figure:: figures/MCS_25_27.*
|
||||
:width: 900px
|
||||
:align: center
|
||||
:height: 700px
|
||||
|
||||
|
||||
BLER for MCS 25, 26 and 27.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. [PaduaPEM] http://mailman.isi.edu/pipermail/ns-developers/2011-November/009559.html
|
||||
|
||||
.. [Vienna] The Vienna LTE Simulators http://www.nt.tuwien.ac.at/about-us/staff/josep-colom-ikuno/lte-simulators/
|
||||
|
||||
.. [LozanoCost] Joan Olmos, Silvia Ruiz, Mario García-Lozano and David Martín-Sacristán, "Link Abstraction Models Based on Mutual Information for LTE Downlink", COST 2100 TD(10)11052 Report
|
||||
|
||||
.. [wimaxEmd] WiMAX Forum White Paper, WiMAX System Evaluation Methodology, July 2008.
|
||||
|
||||
.. [TS36.212] 3GPP TS 36.212 "E-UTRA Multiplexing and channel coding"
|
||||
@@ -312,6 +312,9 @@ LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
|
||||
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
|
||||
ulPhy->AddSinrChunkProcessor (p);
|
||||
|
||||
Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (ulPhy);
|
||||
ulPhy->AddSinrChunkProcessor (pPem);
|
||||
|
||||
dlPhy->SetChannel (m_downlinkChannel);
|
||||
ulPhy->SetChannel (m_uplinkChannel);
|
||||
@@ -401,6 +404,9 @@ LteHelper::InstallSingleUeDevice (Ptr<Node> n)
|
||||
|
||||
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
|
||||
dlPhy->AddSinrChunkProcessor (p);
|
||||
|
||||
Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (dlPhy);
|
||||
dlPhy->AddSinrChunkProcessor (pPem);
|
||||
|
||||
dlPhy->SetChannel (m_downlinkChannel);
|
||||
ulPhy->SetChannel (m_uplinkChannel);
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "lte-amc.h"
|
||||
#include <ns3/lte-amc.h>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/assert.h>
|
||||
#include <math.h>
|
||||
#include <ns3/spectrum-value.h>
|
||||
#include <ns3/double.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define log2(x) (log(x)/M_LN2)
|
||||
@@ -35,7 +36,7 @@ NS_LOG_COMPONENT_DEFINE ("LteAmc");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteAmc);
|
||||
|
||||
// from 3GPP R1-081483 "Conveying MCS and TB size via PDCCH"
|
||||
// file TBS_support.xls
|
||||
@@ -203,6 +204,29 @@ int TransportBlockSizeTable [110][27] = {
|
||||
};
|
||||
|
||||
|
||||
LteAmc::LteAmc ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LteAmc::~LteAmc ()
|
||||
{
|
||||
}
|
||||
|
||||
TypeId
|
||||
LteAmc::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::LteAmc")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<LteAmc> ()
|
||||
.AddAttribute ("Ber",
|
||||
"The requested BER in assigning MCS (default is 0.00005).",
|
||||
DoubleValue (0.00005),
|
||||
MakeDoubleAccessor (&LteAmc::m_ber),
|
||||
MakeDoubleChecker<double> ());
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
LteAmc::GetCqiFromSpectralEfficiency (double s)
|
||||
@@ -280,7 +304,7 @@ LteAmc::CreateCqiFeedbacks (const SpectrumValue& sinr)
|
||||
*/
|
||||
|
||||
double s = log2 ( 1 + ( sinr_ /
|
||||
( (-log (5.0 * 0.00005 )) / 1.5) ));
|
||||
( (-log (5.0 * m_ber )) / 1.5) ));
|
||||
|
||||
int cqi_ = GetCqiFromSpectralEfficiency (s);
|
||||
|
||||
@@ -288,7 +312,7 @@ LteAmc::CreateCqiFeedbacks (const SpectrumValue& sinr)
|
||||
<< ", sinr = " << sinr_
|
||||
<< " (=" << pow (10.0, sinr_ / 10.0) << " dB)"
|
||||
<< ", spectral efficiency =" << s
|
||||
<< ", CQI = " << cqi_ );
|
||||
<< ", CQI = " << cqi_ << ", BER = " << m_ber);
|
||||
|
||||
cqi.push_back (cqi_);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Original Author: Giuseppe Piro <g.piro@poliba.it>
|
||||
* Modified by: Nicola Baldo <nbaldo@cttc.es>
|
||||
* Modified by: Marco Miozzo <mmiozzo@cttc.es>
|
||||
*/
|
||||
|
||||
#ifndef AMCMODULE_H
|
||||
@@ -24,6 +25,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <ns3/ptr.h>
|
||||
#include <ns3/object.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -38,17 +40,22 @@ class SpectrumValue;
|
||||
* \note All the methods of this class are static, so you'll never
|
||||
* need to create and manage instances of this class.
|
||||
*/
|
||||
class LteAmc
|
||||
class LteAmc : public Object
|
||||
{
|
||||
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
LteAmc ();
|
||||
virtual ~LteAmc();
|
||||
|
||||
/**
|
||||
* \brief Get the Modulation anc Coding Scheme for
|
||||
* a CQI value
|
||||
* \param cqi the cqi value
|
||||
* \return the MCS value
|
||||
*/
|
||||
static int GetMcsFromCqi (int cqi);
|
||||
/*static*/ int GetMcsFromCqi (int cqi);
|
||||
|
||||
/**
|
||||
* \brief Get the Transport Block Size for a selected MCS and number of PRB (table 7.1.7.2.1-1 of 36.213)
|
||||
@@ -56,7 +63,7 @@ public:
|
||||
* \param nprb the no. of PRB
|
||||
* \return the Transport Block Size in bits
|
||||
*/
|
||||
static int GetTbSizeFromMcs (int mcs, int nprb);
|
||||
/*static*/ int GetTbSizeFromMcs (int mcs, int nprb);
|
||||
|
||||
/**
|
||||
* \brief Get the spectral efficiency value associated
|
||||
@@ -64,13 +71,13 @@ public:
|
||||
* \param cqi the cqi value
|
||||
* \return the spectral efficiency in (bit/s)/Hz
|
||||
*/
|
||||
static double GetSpectralEfficiencyFromCqi (int cqi);
|
||||
/*static*/ double GetSpectralEfficiencyFromCqi (int cqi);
|
||||
|
||||
/**
|
||||
* \brief Create a message with CQI feedback
|
||||
*
|
||||
*/
|
||||
static std::vector<int> CreateCqiFeedbacks (const SpectrumValue& sinr);
|
||||
/*static*/ std::vector<int> CreateCqiFeedbacks (const SpectrumValue& sinr);
|
||||
|
||||
/**
|
||||
* \brief Get a proper CQI for the spectrale efficiency value.
|
||||
@@ -79,7 +86,13 @@ public:
|
||||
* \param s the spectral efficiency
|
||||
* \return the CQI value
|
||||
*/
|
||||
static int GetCqiFromSpectralEfficiency (double s);
|
||||
/*static*/ int GetCqiFromSpectralEfficiency (double s);
|
||||
|
||||
private:
|
||||
|
||||
double m_ber;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -381,6 +381,14 @@ LteEnbPhy::StartSubFrame (void)
|
||||
else
|
||||
{
|
||||
(*it2).second->ReceiveIdealControlMessage (msg);
|
||||
// send info of TB to LteSpectrumPhy
|
||||
// translate to allocation map
|
||||
std::vector <int> rbMap;
|
||||
for (int i = dci->GetDci ().m_rbStart; i < dci->GetDci ().m_rbStart + dci->GetDci ().m_rbLen; i++)
|
||||
{
|
||||
rbMap.push_back (i);
|
||||
}
|
||||
m_uplinkSpectrumPhy->AddExpectedTb (dci->GetDci ().m_rnti, dci->GetDci ().m_tbSize, dci->GetDci ().m_mcs, rbMap);
|
||||
}
|
||||
}
|
||||
ctrlMsg.pop_front ();
|
||||
|
||||
456
src/lte/model/lte-mi-error-model.cc
Normal file
91
src/lte/model/lte-mi-error-model.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 SIGNET LAB. Department of Information Engineering (DEI), University of Padua
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Original Authors: Marco Mezzavilla <mezzavil@dei.unipd.it>
|
||||
* Giovanni Tomasi <tomasigv@gmail.com>
|
||||
* Integration in LENA and extension done by:
|
||||
* Marco Miozzo <marco.miozzo@cttc.es>
|
||||
*/
|
||||
|
||||
#ifndef LTE_MI_ERROR_MODEL_H
|
||||
#define LTE_MI_ERROR_MODEL_H
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <ns3/ptr.h>
|
||||
#include <stdint.h>
|
||||
#include <ns3/spectrum-value.h>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
const uint16_t MI_MAP_QPSK_SIZE = 411;
|
||||
const uint16_t MI_MAP_16QAM_SIZE = 601;
|
||||
const uint16_t MI_MAP_64QAM_SIZE = 676;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class provides the BLER estimation based on mutual information metrics
|
||||
*/
|
||||
class LteMiErrorModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
LteMiErrorModel (void);
|
||||
|
||||
~LteMiErrorModel (void);
|
||||
|
||||
/**
|
||||
* \brief find the mmib (mean mutual information per bit) for different modulations of the specified TB
|
||||
* \param sinr the perceived sinrs in the whole bandwidth
|
||||
* \param map the actives RBs for the TB
|
||||
* \param cms the MCS of the TB
|
||||
* \return the mmib
|
||||
*/
|
||||
static double Mib (SpectrumValue& sinr, std::vector<int> map, uint8_t mcs);
|
||||
/**
|
||||
* \brief map the mmib (mean mutual information per bit) for different MCS
|
||||
* \param mmib mean mutual information per bit of a code-block
|
||||
* \param mcs the MCS
|
||||
* \param cbSize the size of the CB
|
||||
* \return the bler
|
||||
*/
|
||||
static double MappingMiBler (double mib, uint8_t mcs, uint16_t cbSize);
|
||||
|
||||
/**
|
||||
* \brief run the error-model algorithm for the specified TB
|
||||
* \param modulation the modulations (qpsk, 16-qam, 64-qam)
|
||||
* \param code block-size and code-rate
|
||||
*/
|
||||
static double GetTbError (SpectrumValue& sinr, std::vector<int> map, uint16_t size, uint8_t mcs);
|
||||
|
||||
|
||||
//private:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* LTE_MI_ERROR_MODEL_H */
|
||||
@@ -83,4 +83,56 @@ LteCqiSinrChunkProcessor::End ()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LtePemSinrChunkProcessor::LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p)
|
||||
: m_phy (p)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p);
|
||||
NS_ASSERT (m_phy);
|
||||
}
|
||||
|
||||
|
||||
LtePemSinrChunkProcessor::~LtePemSinrChunkProcessor ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LtePemSinrChunkProcessor::Start ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_sumSinr = 0;
|
||||
m_totDuration = MicroSeconds (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LtePemSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << sinr << duration);
|
||||
if (m_sumSinr == 0)
|
||||
{
|
||||
m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
|
||||
}
|
||||
(*m_sumSinr) += sinr * duration.GetSeconds ();
|
||||
m_totDuration += duration;
|
||||
}
|
||||
|
||||
void
|
||||
LtePemSinrChunkProcessor::End ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (m_totDuration.GetSeconds () > 0)
|
||||
{
|
||||
m_phy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_WARN ("m_numSinr == 0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <ns3/nstime.h>
|
||||
#include <ns3/object.h>
|
||||
#include <ns3/lte-phy.h>
|
||||
#include <ns3/lte-spectrum-phy.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -71,6 +72,26 @@ private:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This SinrProcessor averages the calculated SINR over time for Phy error model
|
||||
*
|
||||
*/
|
||||
class LtePemSinrChunkProcessor : public LteSinrChunkProcessor
|
||||
{
|
||||
public:
|
||||
virtual ~LtePemSinrChunkProcessor ();
|
||||
LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p);
|
||||
virtual void Start ();
|
||||
virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration);
|
||||
virtual void End ();
|
||||
private:
|
||||
Ptr<SpectrumValue> m_sumSinr;
|
||||
Time m_totDuration;
|
||||
Ptr<LteSpectrumPhy> m_phy;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Nicola Baldo <nbaldo@cttc.es>
|
||||
* Giuseppe Piro <g.piro@poliba.it>
|
||||
* Marco Miozzo <marco.miozzo@cttc.es> (add physical error model)
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,6 +33,9 @@
|
||||
#include "lte-radio-bearer-tag.h"
|
||||
#include "lte-sinr-chunk-processor.h"
|
||||
#include "lte-phy-tag.h"
|
||||
#include <ns3/lte-mi-error-model.h>
|
||||
#include <ns3/lte-radio-bearer-tag.h>
|
||||
#include <ns3/boolean.h>
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
|
||||
|
||||
@@ -41,7 +45,8 @@ namespace ns3 {
|
||||
NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy);
|
||||
|
||||
LteSpectrumPhy::LteSpectrumPhy ()
|
||||
: m_state (IDLE)
|
||||
: m_state (IDLE),
|
||||
m_random (0.0, 1.0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_interference = CreateObject<LteInterference> ();
|
||||
@@ -51,6 +56,7 @@ LteSpectrumPhy::LteSpectrumPhy ()
|
||||
LteSpectrumPhy::~LteSpectrumPhy ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_expectedTbs.clear ();
|
||||
}
|
||||
|
||||
void LteSpectrumPhy::DoDispose ()
|
||||
@@ -108,6 +114,11 @@ LteSpectrumPhy::GetTypeId (void)
|
||||
.AddTraceSource ("RxEndError",
|
||||
"Trace fired when a previosuly started RX terminates with an error",
|
||||
MakeTraceSourceAccessor (&LteSpectrumPhy::m_phyRxEndErrorTrace))
|
||||
.AddAttribute ("PemEnabled",
|
||||
"Activate/Deactivate the error model (by default is active).",
|
||||
BooleanValue (true),
|
||||
MakeBooleanAccessor (&LteSpectrumPhy::m_pemEnabled),
|
||||
MakeBooleanChecker ());
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -407,6 +418,31 @@ LteSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> spectrumRxParams)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << sinr);
|
||||
m_sinrPerceived = sinr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map)
|
||||
{
|
||||
NS_LOG_LOGIC (this << " rnti: " << rnti << " size " << size << " mcs " << (uint16_t)mcs);
|
||||
expectedTbs_t::iterator it;
|
||||
it = m_expectedTbs.find (rnti);
|
||||
if (it != m_expectedTbs.end ())
|
||||
{
|
||||
// migth be a TB of an unreceived packet (due to high progpalosses)
|
||||
m_expectedTbs.erase (it);
|
||||
}
|
||||
// insert new entry
|
||||
tbInfo_t tbInfo = {size, mcs, map, false};
|
||||
m_expectedTbs.insert (std::pair<uint16_t, tbInfo_t> (rnti,tbInfo ));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteSpectrumPhy::EndRx ()
|
||||
{
|
||||
@@ -418,39 +454,58 @@ LteSpectrumPhy::EndRx ()
|
||||
// this will trigger CQI calculation and Error Model evaluation
|
||||
// as a side effect, the error model should update the error status of all TBs
|
||||
m_interference->EndRx ();
|
||||
|
||||
for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
|
||||
i != m_rxPacketBurstList.end (); ++i)
|
||||
NS_LOG_INFO (this << " No. of burts " << m_rxPacketBurstList.size ());
|
||||
NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
|
||||
expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
|
||||
while (itTb!=m_expectedTbs.end ())
|
||||
{
|
||||
// here we should determine whether this TB has been received
|
||||
// correctly or not
|
||||
bool tbRxOk = true;
|
||||
|
||||
if (tbRxOk)
|
||||
if (m_pemEnabled)
|
||||
{
|
||||
m_phyRxEndOkTrace (*i);
|
||||
|
||||
// forward each PDU in the PacketBurst separately to the MAC
|
||||
// WILD HACK: we currently don't model properly the aggregation
|
||||
// of PDUs into TBs. In reality, the PHY is concerned only with
|
||||
// TBs, and it should be left to the MAC to decompose the TB into PDUs
|
||||
for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin ();
|
||||
j != (*i)->End (); ++j)
|
||||
{
|
||||
if (!m_genericPhyRxEndOkCallback.IsNull ())
|
||||
{
|
||||
m_genericPhyRxEndOkCallback (*j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TB received with errors
|
||||
m_phyRxEndErrorTrace (*i);
|
||||
}
|
||||
double errorRate = LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs);
|
||||
(*itTb).second.corrupt = m_random.GetValue () > errorRate ? false : true;
|
||||
NS_LOG_DEBUG (this << "RNTI " << (*itTb).first << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " ErrorRate " << errorRate << " corrupted " << (*itTb).second.corrupt);
|
||||
}
|
||||
|
||||
// for (uint16_t i = 0; i < (*itTb).second.rbBitmap.size (); i++)
|
||||
// {
|
||||
// NS_LOG_DEBUG (this << " RB " << (*itTb).second.rbBitmap.at (i) << " SINR " << m_sinrPerceived[(*itTb).second.rbBitmap.at (i)]);
|
||||
// }
|
||||
itTb++;
|
||||
}
|
||||
|
||||
for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
|
||||
i != m_rxPacketBurstList.end (); ++i)
|
||||
{
|
||||
for (std::list<Ptr<Packet> >::const_iterator j = (*i)->Begin (); j != (*i)->End (); ++j)
|
||||
{
|
||||
// retrieve TB info of this packet
|
||||
LteRadioBearerTag tag;
|
||||
(*j)->PeekPacketTag (tag);
|
||||
itTb = m_expectedTbs.find (tag.GetRnti ());
|
||||
//(*j)->AddPacketTag (tag);
|
||||
NS_LOG_INFO (this << " Packet of " << tag.GetRnti ());
|
||||
if (itTb!=m_expectedTbs.end ())
|
||||
{
|
||||
if (!(*itTb).second.corrupt)
|
||||
{
|
||||
m_phyRxEndOkTrace (*j);
|
||||
|
||||
if (!m_genericPhyRxEndOkCallback.IsNull ())
|
||||
{
|
||||
m_genericPhyRxEndOkCallback (*j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TB received with errors
|
||||
m_phyRxEndErrorTrace (*j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ChangeState (IDLE);
|
||||
m_rxPacketBurstList.clear ();
|
||||
m_expectedTbs.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Nicola Baldo <nbaldo@cttc.es>
|
||||
* Giuseppe Piro <g.piro@poliba.it>
|
||||
* Modified by: Marco Miozzo <mmiozzo@cttc.es> (introduce physical error model)
|
||||
*/
|
||||
|
||||
#ifndef LTE_SPECTRUM_PHY_H
|
||||
@@ -35,9 +36,22 @@
|
||||
#include <ns3/generic-phy.h>
|
||||
#include <ns3/packet-burst.h>
|
||||
#include <ns3/lte-interference.h>
|
||||
#include <ns3/random-variable.h>
|
||||
#include <map>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
struct tbInfo_t
|
||||
{
|
||||
uint16_t size;
|
||||
uint8_t mcs;
|
||||
std::vector<int> rbBitmap;
|
||||
bool corrupt;
|
||||
};
|
||||
|
||||
typedef std::map<uint16_t, tbInfo_t> expectedTbs_t;
|
||||
|
||||
class LteNetDevice;
|
||||
|
||||
/**
|
||||
@@ -154,6 +168,23 @@ public:
|
||||
* \param p the new LteSinrChunkProcessor to be added to the processing chain
|
||||
*/
|
||||
void AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param rnti the rnti of the source of the TB
|
||||
* \param size the size of the TB
|
||||
* \param mcs the MCS of the TB
|
||||
* \param map the map of RB(s) used
|
||||
*/
|
||||
void AddExpectedTb (uint16_t rnti, uint16_t size, uint8_t mcs, std::vector<int> map);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param sinr vector of sinr perceived per each RB
|
||||
*/
|
||||
void UpdateSinrPerceived (const SpectrumValue& sinr);
|
||||
|
||||
private:
|
||||
void ChangeState (State newState);
|
||||
@@ -177,8 +208,8 @@ private:
|
||||
TracedCallback<Ptr<const PacketBurst> > m_phyTxStartTrace;
|
||||
TracedCallback<Ptr<const PacketBurst> > m_phyTxEndTrace;
|
||||
TracedCallback<Ptr<const PacketBurst> > m_phyRxStartTrace;
|
||||
TracedCallback<Ptr<const PacketBurst> > m_phyRxEndOkTrace;
|
||||
TracedCallback<Ptr<const PacketBurst> > m_phyRxEndErrorTrace;
|
||||
TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace;
|
||||
TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;
|
||||
|
||||
GenericPhyTxEndCallback m_genericPhyTxEndCallback;
|
||||
GenericPhyRxEndErrorCallback m_genericPhyRxEndErrorCallback;
|
||||
@@ -186,7 +217,13 @@ private:
|
||||
|
||||
Ptr<LteInterference> m_interference;
|
||||
|
||||
uint16_t m_cellId;
|
||||
uint16_t m_cellId;
|
||||
|
||||
expectedTbs_t m_expectedTbs;
|
||||
SpectrumValue m_sinrPerceived;
|
||||
|
||||
UniformVariable m_random;
|
||||
bool m_pemEnabled; // when true (default) the phy error model is enabled
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
|
||||
// ideal behavior
|
||||
m_a30CqiLast (MilliSeconds (0))
|
||||
{
|
||||
m_amc = CreateObject <LteAmc> ();
|
||||
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
|
||||
}
|
||||
|
||||
@@ -309,7 +310,7 @@ LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
std::vector<int> cqi = LteAmc::CreateCqiFeedbacks (sinr);
|
||||
std::vector<int> cqi = m_amc->CreateCqiFeedbacks (sinr);
|
||||
|
||||
// CREATE DlCqiIdealControlMessage
|
||||
Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
|
||||
@@ -433,6 +434,10 @@ LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
|
||||
}
|
||||
mask = (mask << 1);
|
||||
}
|
||||
|
||||
// send TB info to LteSpectrumPhy
|
||||
NS_LOG_DEBUG (this << " UE " << m_rnti << " DCI " << dci.m_rnti << " bimap " << dci.m_rbBitmap);
|
||||
m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (0), dci.m_mcs.at (0), dlRb); // SISO mode
|
||||
|
||||
SetSubChannelsForReception (dlRb);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <ns3/lte-amc.h>
|
||||
#include <ns3/lte-ue-phy-sap.h>
|
||||
#include <ns3/ptr.h>
|
||||
#include <ns3/lte-amc.h>
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
@@ -189,6 +190,8 @@ public:
|
||||
private:
|
||||
std::vector <int> m_subChannelsForTransmission;
|
||||
std::vector <int> m_subChannelsForReception;
|
||||
|
||||
Ptr<LteAmc> m_amc;
|
||||
|
||||
Time m_p10CqiPeriocity; /**< Wideband Periodic CQI: 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms */
|
||||
Time m_p10CqiLast;
|
||||
|
||||
@@ -215,6 +215,7 @@ PfFfMacScheduler::PfFfMacScheduler ()
|
||||
// WILD ACK: based on a m_macChTtiDelay = 1
|
||||
m_nextRntiUl (0)
|
||||
{
|
||||
m_amc = CreateObject <LteAmc> ();
|
||||
m_cschedSapProvider = new PfSchedulerMemberCschedSapProvider (this);
|
||||
m_schedSapProvider = new PfSchedulerMemberSchedSapProvider (this);
|
||||
}
|
||||
@@ -466,8 +467,8 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
if (LcActivePerFlow ((*it).first) > 0)
|
||||
{
|
||||
// this UE has data to transmit
|
||||
uint8_t mcs = LteAmc::GetMcsFromCqi (cqi);
|
||||
double achievableRate = ((LteAmc::GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
|
||||
uint8_t mcs = m_amc->GetMcsFromCqi (cqi);
|
||||
double achievableRate = ((m_amc->GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
|
||||
double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
|
||||
// NS_LOG_DEBUG (this << " RNTI " << (*it).first << " MCS " << (uint32_t)mcs << " achievableRate " << achievableRate << " avgThr " << (*it).second.lastAveragedThroughput << " RCQI " << rcqi);
|
||||
|
||||
@@ -554,8 +555,8 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
worstCqi = 1; // try with lowest MCS in RBG with no info on channel
|
||||
}
|
||||
// NS_LOG_DEBUG (this << " CQI " << (uint16_t)worstCqi);
|
||||
newDci.m_mcs.push_back (LteAmc::GetMcsFromCqi (worstCqi));
|
||||
int tbSize = (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (0), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
|
||||
newDci.m_mcs.push_back (m_amc->GetMcsFromCqi (worstCqi));
|
||||
int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), RgbPerRnti * rbgSize) / 8); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
|
||||
newDci.m_tbsSize.push_back (tbSize);
|
||||
|
||||
newDci.m_resAlloc = 0; // only allocation type 0 at this stage
|
||||
@@ -836,7 +837,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
double s = log2 ( 1 + (
|
||||
pow (10, minSinr / 10 ) /
|
||||
( (-log (5.0 * 0.00005 )) / 1.5) ));
|
||||
cqi = LteAmc::GetCqiFromSpectralEfficiency (s);
|
||||
cqi = m_amc->GetCqiFromSpectralEfficiency (s);
|
||||
if (cqi == 0)
|
||||
{
|
||||
it++;
|
||||
@@ -847,7 +848,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
}
|
||||
continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
|
||||
}
|
||||
uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi);
|
||||
uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
|
||||
// NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
|
||||
|
||||
}
|
||||
@@ -858,9 +859,8 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
{
|
||||
rbgAllocationMap.push_back ((*it).first);
|
||||
}
|
||||
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
|
||||
NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated);
|
||||
UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
|
||||
uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
|
||||
// NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize << " RbAlloc " << rbAllocated);
|
||||
uldci.m_ndi = 1;
|
||||
uldci.m_cceIndex = 0;
|
||||
uldci.m_aggrLevel = 1;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <ns3/nstime.h>
|
||||
#include <ns3/lte-amc.h>
|
||||
|
||||
|
||||
// value for SINR outside the range defined by FF-API, used to indicate that there
|
||||
@@ -140,6 +141,7 @@ private:
|
||||
|
||||
void UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size);
|
||||
void UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size);
|
||||
Ptr<LteAmc> m_amc;
|
||||
|
||||
/*
|
||||
* Vectors of UE's LC info
|
||||
|
||||
@@ -216,6 +216,7 @@ RrFfMacScheduler::RrFfMacScheduler ()
|
||||
m_nextRntiDl (0),
|
||||
m_nextRntiUl (0)
|
||||
{
|
||||
m_amc = CreateObject <LteAmc> ();
|
||||
m_cschedSapProvider = new RrSchedulerMemberCschedSapProvider (this);
|
||||
m_schedSapProvider = new RrSchedulerMemberSchedSapProvider (this);
|
||||
}
|
||||
@@ -510,13 +511,13 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
}
|
||||
else
|
||||
{
|
||||
newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*itCqi).second) );
|
||||
newDci.m_mcs.push_back ( m_amc->GetMcsFromCqi ((*itCqi).second) );
|
||||
}
|
||||
// group the LCs of this RNTI
|
||||
std::vector <struct RlcPduListElement_s> newRlcPduLe;
|
||||
// int totRbg = lcNum * rbgPerFlow;
|
||||
// totRbg = rbgNum / nTbs;
|
||||
int tbSize = (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * rbgSize) / 8);
|
||||
int tbSize = (m_amc->GetTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * rbgSize) / 8);
|
||||
NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " << rbgPerTb * rbgSize << " mcs " << (uint16_t) newDci.m_mcs.at (0));
|
||||
uint16_t rlcPduSize = tbSize / lcNum;
|
||||
for (int i = 0; i < lcNum ; i++)
|
||||
@@ -718,7 +719,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
( (-log (5.0 * 0.00005 )) / 1.5) ));
|
||||
|
||||
|
||||
cqi = LteAmc::GetCqiFromSpectralEfficiency (s);
|
||||
cqi = m_amc->GetCqiFromSpectralEfficiency (s);
|
||||
if (cqi == 0)
|
||||
{
|
||||
it++;
|
||||
@@ -729,7 +730,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
}
|
||||
continue; // CQI == 0 means "out of range" (see table 7.2.3-1 of 36.213)
|
||||
}
|
||||
uldci.m_mcs = LteAmc::GetMcsFromCqi (cqi);
|
||||
uldci.m_mcs = m_amc->GetMcsFromCqi (cqi);
|
||||
//NS_LOG_DEBUG (this << " UE " << (*it).first << " minsinr " << minSinr << " -> mcs " << (uint16_t)uldci.m_mcs);
|
||||
|
||||
}
|
||||
@@ -741,8 +742,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
rbgAllocationMap.push_back ((*it).first);
|
||||
}
|
||||
|
||||
uldci.m_tbSize = (LteAmc::GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8);
|
||||
UpdateUlRlcBufferInfo (uldci.m_rnti, uldci.m_tbSize);
|
||||
uldci.m_tbSize = (m_amc->GetTbSizeFromMcs (uldci.m_mcs, rbPerFlow) / 8); // MCS 0 -> UL-AMC TBD
|
||||
NS_LOG_DEBUG (this << " UE " << (*it).first << " startPRB " << (uint32_t)uldci.m_rbStart << " nPRB " << (uint32_t)uldci.m_rbLen << " CQI " << cqi << " MCS " << (uint32_t)uldci.m_mcs << " TBsize " << uldci.m_tbSize);
|
||||
uldci.m_ndi = 1;
|
||||
uldci.m_cceIndex = 0;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <ns3/lte-common.h>
|
||||
#include <ns3/lte-amc.h>
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
@@ -126,6 +127,8 @@ private:
|
||||
|
||||
void UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size);
|
||||
void UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size);
|
||||
|
||||
Ptr<LteAmc> m_amc;
|
||||
|
||||
/*
|
||||
* Vectors of UE's RLC info
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "ns3/double.h"
|
||||
#include <ns3/lte-enb-phy.h>
|
||||
#include <ns3/lte-ue-phy.h>
|
||||
#include <ns3/boolean.h>
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler");
|
||||
@@ -205,6 +206,8 @@ LenaPfFfMacSchedulerTestCase1::~LenaPfFfMacSchedulerTestCase1 ()
|
||||
void
|
||||
LenaPfFfMacSchedulerTestCase1::DoRun (void)
|
||||
{
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
|
||||
LogComponentDisableAll (LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
|
||||
|
||||
256
src/lte/test/lte-test-phy-error-model.cc
Normal file
@@ -0,0 +1,256 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Marco Miozzo <marco.miozzo@cttc.es>
|
||||
*/
|
||||
|
||||
#include <ns3/object.h>
|
||||
#include <ns3/spectrum-interference.h>
|
||||
#include <ns3/spectrum-error-model.h>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/test.h>
|
||||
#include <ns3/simulator.h>
|
||||
#include <ns3/packet.h>
|
||||
#include <ns3/ptr.h>
|
||||
#include <iostream>
|
||||
#include "ns3/rlc-stats-calculator.h"
|
||||
#include <ns3/buildings-mobility-model.h>
|
||||
#include <ns3/buildings-propagation-loss-model.h>
|
||||
#include "ns3/lte-test-phy-error-model.h"
|
||||
#include <ns3/eps-bearer.h>
|
||||
#include <ns3/node-container.h>
|
||||
#include <ns3/mobility-helper.h>
|
||||
#include <ns3/net-device-container.h>
|
||||
#include <ns3/lte-ue-net-device.h>
|
||||
#include <ns3/lte-enb-net-device.h>
|
||||
#include <ns3/lte-ue-rrc.h>
|
||||
#include <ns3/lte-helper.h>
|
||||
#include <ns3/string.h>
|
||||
#include <ns3/double.h>
|
||||
#include <ns3/lte-enb-phy.h>
|
||||
#include <ns3/lte-ue-phy.h>
|
||||
#include <ns3/config.h>
|
||||
#include <ns3/boolean.h>
|
||||
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaTestPhyErrorModel");
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
|
||||
LenaTestPhyErrorModelrSuite::LenaTestPhyErrorModelrSuite ()
|
||||
: TestSuite ("lte-phy-error-model", SYSTEM)
|
||||
{
|
||||
NS_LOG_INFO ("creating LenaTestPhyErrorModelTestCase");
|
||||
|
||||
// MCS 2 TB size of 256 bits BER 0.19 SINR -2.21
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (4, 898, 32, 0.19, 25));
|
||||
// MCS 2 TB size of 328 bits BER 0.09 SINR -2.25
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (3, 900, 41, 0.09, 18));
|
||||
// MCS 2 TB size of 520 bits BER 0.123 SINR -2.61
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (2, 920, 65, 0.123, 21));
|
||||
// MCS 2 TB size of 1080 bits BER 0.097 SINR -2.79
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 930, 135, 0.097, 19));
|
||||
// MCS 12 TB size of 4776 bits BER 0.017 SINR 6.22
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 538, 597, 0.017, 8));
|
||||
// MCS 12 TB size of 1608 bits BER 0.23 SINR 6.22
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (3, 538, 201, 0.23, 26));
|
||||
// MCS 12 TB size of 376 bits BER 0.72 SINR 6.22
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (7,538, 47, 0.72, 28));
|
||||
// MCS 14 TB size of 6248 bits (3136 x 2) BER 0.18 (0.096 x 2) SINR 5.53
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 500, 781, 0.18, 24));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static LenaTestPhyErrorModelrSuite lenaTestPhyErrorModelrSuite;
|
||||
|
||||
std::string
|
||||
LenaPhyErrorModelTestCase::BuildNameString (uint16_t nUser, uint16_t dist)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << nUser << " UEs, distance " << dist << " m";
|
||||
return oss.str ();
|
||||
}
|
||||
|
||||
LenaPhyErrorModelTestCase::LenaPhyErrorModelTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double berRef, uint16_t bernQuantile)
|
||||
: TestCase (BuildNameString (nUser, dist)),
|
||||
m_nUser (nUser),
|
||||
m_dist (dist),
|
||||
m_tbSize (tbSize),
|
||||
m_berRef (berRef),
|
||||
m_bernQuantile (bernQuantile)
|
||||
{
|
||||
}
|
||||
|
||||
LenaPhyErrorModelTestCase::~LenaPhyErrorModelTestCase ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LenaPhyErrorModelTestCase::DoRun (void)
|
||||
{
|
||||
|
||||
double ber = 0.01;
|
||||
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (ber));
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (true));
|
||||
|
||||
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteRlc", LOG_LEVEL_ALL);
|
||||
//
|
||||
// LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
|
||||
|
||||
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
|
||||
//
|
||||
// LogComponentEnable ("LtePropagationLossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("ShadowingLossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("PenetrationLossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("MultipathLossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("PathLossModel", LOG_LEVEL_ALL);
|
||||
//
|
||||
// LogComponentEnable ("LteNetDevice", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUeNetDevice", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
|
||||
|
||||
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("RlcStatsCalculator", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("BuildingsPropagationLossModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteMiErrorModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
|
||||
//
|
||||
LogComponentDisableAll (LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LenaTestPhyErrorModel", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize Simulation Scenario: 1 eNB and m_nUser UEs
|
||||
*/
|
||||
|
||||
Ptr<LteHelper> lena = CreateObject<LteHelper> ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
NodeContainer ueNodes;
|
||||
enbNodes.Create (1);
|
||||
ueNodes.Create (m_nUser);
|
||||
|
||||
// Install Mobility Model
|
||||
MobilityHelper mobility;
|
||||
mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
|
||||
mobility.Install (enbNodes);
|
||||
mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
|
||||
mobility.Install (ueNodes);
|
||||
|
||||
// remove random shadowing component
|
||||
lena->SetAttribute ("PathlossModel", StringValue ("ns3::BuildingsPropagationLossModel"));
|
||||
lena->SetPathlossModelAttribute ("ShadowSigmaOutdoor", DoubleValue (0.0));
|
||||
lena->SetPathlossModelAttribute ("ShadowSigmaIndoor", DoubleValue (0.0));
|
||||
lena->SetPathlossModelAttribute ("ShadowSigmaExtWalls", DoubleValue (0.0));
|
||||
|
||||
// Create Devices and install them in the Nodes (eNB and UE)
|
||||
NetDeviceContainer enbDevs;
|
||||
NetDeviceContainer ueDevs;
|
||||
lena->SetSchedulerType ("ns3::RrFfMacScheduler");
|
||||
|
||||
enbDevs = lena->InstallEnbDevice (enbNodes);
|
||||
ueDevs = lena->InstallUeDevice (ueNodes);
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lena->Attach (ueDevs, enbDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q);
|
||||
lena->ActivateEpsBearer (ueDevs, bearer, EpcTft::Default ());
|
||||
|
||||
|
||||
Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
|
||||
Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
|
||||
enbPhy->SetAttribute ("TxPower", DoubleValue (43.0));
|
||||
enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
|
||||
// place the HeNB over the default rooftop level (20 mt.)
|
||||
Ptr<BuildingsMobilityModel> mm = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
|
||||
mm->SetPosition (Vector (0.0, 0.0, 30.0));
|
||||
|
||||
// Set UEs' position and power
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
Ptr<BuildingsMobilityModel> mm = ueNodes.Get (i)->GetObject<BuildingsMobilityModel> ();
|
||||
mm->SetPosition (Vector (m_dist, 0.0, 1.0));
|
||||
Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
|
||||
Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
|
||||
uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
|
||||
uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
|
||||
}
|
||||
|
||||
lena->EnableRlcTraces ();
|
||||
double simulationTime = 1.000;
|
||||
Simulator::Stop (Seconds (simulationTime));
|
||||
|
||||
Ptr<RadioBearerStatsCalculator> rlcStats = lena->GetRlcStats ();
|
||||
rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
|
||||
|
||||
|
||||
Simulator::Run ();
|
||||
|
||||
/**
|
||||
* Check that the assignation is done in a RR fashion
|
||||
*/
|
||||
NS_LOG_INFO ("Test with " << m_nUser << " user(s) at distance " << m_dist << " expected BER " << m_berRef);
|
||||
std::vector <uint64_t> dlDataRxed;
|
||||
for (int i = 0; i < m_nUser; i++)
|
||||
{
|
||||
// get the imsi
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
// get the lcId
|
||||
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
|
||||
dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
|
||||
double txed = rlcStats->GetDlTxData (imsi, lcId);
|
||||
int n = txed / m_tbSize;
|
||||
int lambda = (double)dlDataRxed.at (i) / m_tbSize;
|
||||
double ber = 2.0 - ((double)dlDataRxed.at (i)/txed);
|
||||
double np = n-n*m_berRef;
|
||||
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " txed " << txed << " BER " << ber << " Err " << fabs (m_berRef - ber) << " lambda " << lambda << " np " << np << " difference " << abs(lambda - np) << " quantile " << m_bernQuantile);
|
||||
// the quantiles are evaluated offline according to a Bernoulli
|
||||
// ditribution with n equal to the number of packet sent and p equal
|
||||
// to the BER (see /reference/bernuolliDistribution.m for details)
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL (lambda, np, m_bernQuantile, " Unexpected BER distribution!");
|
||||
}
|
||||
|
||||
|
||||
Simulator::Destroy ();
|
||||
}
|
||||
|
||||
66
src/lte/test/lte-test-phy-error-model.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Marco Miozzo <marco.miozzo@cttc.es>
|
||||
*/
|
||||
|
||||
#ifndef LENA_TEST_PHY_ERROR_MODEL_H
|
||||
#define LENA_TEST_PHY_ERROR_MODEL_H
|
||||
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/test.h"
|
||||
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
|
||||
/**
|
||||
* This system test program creates different test cases with a single eNB and
|
||||
* several UEs, all having the same Radio Bearer specification. In each test
|
||||
* case, the UEs see the same SINR from the eNB; different test cases are
|
||||
* implemented obtained by using different SINR values and different numbers of
|
||||
* UEs. The test consists on ...
|
||||
*/
|
||||
class LenaPhyErrorModelTestCase : public TestCase
|
||||
{
|
||||
public:
|
||||
LenaPhyErrorModelTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double refBer, uint16_t bernQuantile);
|
||||
virtual ~LenaPhyErrorModelTestCase ();
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
static std::string BuildNameString (uint16_t nUser, uint16_t dist);
|
||||
uint16_t m_nUser;
|
||||
uint16_t m_dist;
|
||||
uint16_t m_tbSize;
|
||||
double m_berRef;
|
||||
uint16_t m_bernQuantile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class LenaTestPhyErrorModelrSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
LenaTestPhyErrorModelrSuite ();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LENA_TEST_PHY_ERROR_MODEL_H */
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "ns3/double.h"
|
||||
#include <ns3/lte-enb-phy.h>
|
||||
#include <ns3/lte-ue-phy.h>
|
||||
#include <ns3/boolean.h>
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaTestRrFfMacCheduler");
|
||||
@@ -54,8 +55,6 @@ LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
|
||||
{
|
||||
NS_LOG_INFO ("creating LenaRrFfMacSchedulerTestCase");
|
||||
|
||||
|
||||
AddTestCase (new LenaRrFfMacSchedulerTestCase (1,0,3000,1383000,1239000));
|
||||
|
||||
// DOWNLINK- DISTANCE 0 -> MCS 28 -> Itbs 26 (from table 7.1.7.2.1-1 of 36.213)
|
||||
// 1 user -> 24 PRB at Itbs 26 -> 2196 -> 2196000 bytes/sec
|
||||
@@ -191,6 +190,8 @@ LenaRrFfMacSchedulerTestCase::~LenaRrFfMacSchedulerTestCase ()
|
||||
void
|
||||
LenaRrFfMacSchedulerTestCase::DoRun (void)
|
||||
{
|
||||
Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
|
||||
LogComponentDisableAll (LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
|
||||
@@ -217,9 +218,10 @@ LenaRrFfMacSchedulerTestCase::DoRun (void)
|
||||
// LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL);
|
||||
|
||||
// LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LenaTestRrFfMacCheduler", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteHelper", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LenaTestRrFfMacCheduler", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteMiErrorModel", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LenaHelper", LOG_LEVEL_ALL);
|
||||
// LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
|
||||
|
||||
|
||||
/**
|
||||
@@ -311,8 +313,9 @@ LenaRrFfMacSchedulerTestCase::DoRun (void)
|
||||
uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
|
||||
// get the lcId
|
||||
uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
|
||||
double txed = rlcStats->GetUlTxData (imsi, lcId);
|
||||
ulDataRxed.push_back (rlcStats->GetUlRxData (imsi, lcId));
|
||||
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " lcid " << (uint16_t) lcId << " bytes txed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl);
|
||||
NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes txed " << (double)ulDataRxed.at (i) << " thr " << (double)ulDataRxed.at (i) / simulationTime << " ref " << m_thrRefUl << " txed " << txed / simulationTime);
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL ((double)ulDataRxed.at (i) / simulationTime, m_thrRefUl, m_thrRefUl * tolerance, " Unfair Throughput!");
|
||||
}
|
||||
|
||||
|
||||
25
src/lte/test/reference/bernuolliDistribution.m
Normal file
@@ -0,0 +1,25 @@
|
||||
% Generation of the quantiles of the Bernoulli distribution at 95%
|
||||
% related to phy error model test
|
||||
|
||||
n = 1000;
|
||||
p_vect = [0.19 0.09 0.123 0.097 0.017 0.23 0.72 0.18];
|
||||
for i=1:length(p_vect)
|
||||
p = p_vect(i)
|
||||
cdf = 0.0;
|
||||
kmin = 0.0;
|
||||
kmax = 0.0;
|
||||
lambda = n * p
|
||||
for k=1:n
|
||||
pk = bincoeff(n,k)* p^k * (1-p)^(n-k);
|
||||
cdf = cdf + pk;
|
||||
if cdf > 0.025 & kmin == 0.0
|
||||
kmin = lambda - k
|
||||
end
|
||||
if cdf > 0.975 & kmax == 0.0
|
||||
kmax = k - lambda
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ def build(bld):
|
||||
'model/epc-sgw-pgw-application.cc',
|
||||
'model/epc-tft.cc',
|
||||
'model/epc-tft-classifier.cc',
|
||||
'model/lte-mi-error-model.cc'
|
||||
]
|
||||
|
||||
module_test = bld.create_ns3_module_test_library('lte')
|
||||
@@ -86,6 +87,7 @@ def build(bld):
|
||||
'test/epc-test-s1u-uplink.cc',
|
||||
'test/test-lte-epc-e2e-data.cc',
|
||||
'test/test-lte-antenna.cc',
|
||||
'test/lte-test-phy-error-model.cc'
|
||||
]
|
||||
|
||||
headers = bld.new_task_gen(features=['ns3header'])
|
||||
@@ -156,13 +158,12 @@ def build(bld):
|
||||
'test/lte-test-ue-phy.h',
|
||||
'test/lte-test-rr-ff-mac-scheduler.h',
|
||||
'test/lte-test-pf-ff-mac-scheduler.h',
|
||||
'test/lte-test-entities.h',
|
||||
'test/lte-test-rlc-um-transmitter.h',
|
||||
'test/lte-test-rlc-am-transmitter.h',
|
||||
'test/lte-test-phy-error-model.h',
|
||||
'test/lte-test-pathloss-model.h',
|
||||
'test/epc-test-gtpu.h',
|
||||
'model/epc-tft.h',
|
||||
'model/epc-tft-classifier.h',
|
||||
'model/lte-mi-error-model.h'
|
||||
]
|
||||
|
||||
if (bld.env['ENABLE_EXAMPLES']):
|
||||
|
||||