--- a/src/lte/doc/Makefile Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/doc/Makefile Thu Jul 19 13:02:41 2012 +0200
@@ -21,7 +21,8 @@
$(FIGURES)/lte-enb-architecture.dia \
$(FIGURES)/lte-epc-e2e-data-protocol-stack.dia \
$(FIGURES)/lte-interference-test-scenario.dia \
- $(FIGURES)/lte-ue-architecture.dia
+ $(FIGURES)/lte-ue-architecture.dia \
+ $(FIGURES)/lte-subframe-structure.dia
# specify eps figures from which .png and .pdf figures need to be built
@@ -69,6 +70,7 @@
$(FIGURES)/lte-rlc-data-retx-ul.pdf_width = 10cm
$(FIGURES)/lte-phy-interference.pdf_width = 12cm
$(FIGURES)/auvmobility-classes.pdf_width = 10cm
+$(FIGURES)/lte-subframe-structure.pdf_width = 2in
IMAGES_SEQDIAG = \
Binary file src/lte/doc/source/figures/lte-phy-interference.pdf has changed
Binary file src/lte/doc/source/figures/lte-phy-interference.png has changed
Binary file src/lte/doc/source/figures/lte-subframe-structure.dia has changed
--- a/src/lte/doc/source/lte-design.rst Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/doc/source/lte-design.rst Thu Jul 19 13:02:41 2012 +0200
@@ -294,7 +294,7 @@
.. figure:: figures/epc-data-flow-dl.*
:align: center
- Data flow in the dowlink between the internet and the UE
+ Data flow in the downlink between the internet and the UE
To begin with, we consider the case of the downlink, which is depicted
in Figure :ref:`fig-epc-data-flow-dl`.
@@ -532,7 +532,7 @@
For certain bandwidth
values not all the RBs are usable, since the
group size is not a common divisor of the group. This is for instance the case
-when the bandwith is equal to 25 RBs, which results in a RBG size of 2 RBs, and
+when the bandwidth is equal to 25 RBs, which results in a RBG size of 2 RBs, and
therefore 1 RB will result not addressable.
In uplink the format of the DCIs is different, since only adjacent RBs
can be used because of the SC-FDMA modulation. As a consequence, all
@@ -1095,6 +1095,26 @@
inter cell intereference calculation and the simulation of uplink traffic, including both packet transmission and CQI generation.
+Subframe Structure
+^^^^^^^^^^^^^^^^^^
+
+The subframe is divided into control and data part as described in Figure :ref:`fig-lte-subframe-structure`.
+
+.. _fig-lte-subframe-structure:
+
+.. figure:: figures/lte-subframe-structure.*
+ :width: 50px
+
+ Lte subframe division.
+
+
+Considering the granularity of the simulator based on RB, the control and the reference signaling have to be consequently modeled considering this constraint. According to the standard [TS36.211]_, the downlink control frame starts at the beginning of each subframe and lasts up to three symbols across the whole system bandwidth, where the actual duration is provided by the Physical Control Format Indicator Channel (PCFICH). The information on the allocation are then mapped in the remaining resource up to the duration defined by the PCFICH, in the so called Physical Downlink Control Channel (PDCCH). A PDCCH transports a single message called Downlink Control Information (DCI) coming from the MAC layer, where the scheduler indicates the resource allocation for a specific user.
+The PCFICH and PDCCH are modeled with the transmission of the control frame of a fixed duration of 3/14 of milliseconds spanning in the whole available bandwidth, since the scheduler does not estimate the size of the control region. This implies that a single transmission block models the entire control frame with a fixed power (i.e., the one used for the PDSCH) across all the available RBs. According to this feature, this transmission represents also a valuable support for the Reference Signal (RS). This allows of having every TTI an evaluation of the interference scenario since all the eNB are transmitting (simultaneously) the control frame over the respective available bandwidths. We note that, the model does not include the power boosting since it does not reflect any improvement in the implemented model of the channel estimation.
+
+
+The Sounding Reference Signal (SRS) is modeled similar to the downlink control frame. The SRS is periodically placed in the last symbol of the subframe in the whole system bandwidth. The RRC module already includes an algorithm for dynamically assigning the periodicity as function of the actual number of UEs attached to a eNB according to the UE-specific procedure (see Section 8.2 of [TS36.213]_).
+
+
MAC to Channel delay
^^^^^^^^^^^^^^^^^^^^
@@ -1148,10 +1168,10 @@
-PHY Error Model
----------------
+Data 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).
+The simulator includes an error model of the data plane (i.e., PDSCH and PUSCH) 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 [ViennaLteSim]_ 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]_.
@@ -1288,9 +1308,21 @@
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));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
+
+Control Channels PHY Error Model
+--------------------------------
+
+The simulator includes the error model for downlink control channels (PCFICH and PDCCH), while in uplink it is assumed and ideal error-free channel. The model is based on the MIESM approach presented before for considering the effects of the frequency selective channel since most of the control channels span the whole available bandwidth.
+PCFICH + PDCCH Error Model
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The model adopted for the error distribution of these channels is based on an evaluation study carried out in the RAN4 of 3GPP, where different vendors investigated the demodulation performance of the PCFICH jointly with PDCCH. This is due to the fact that the PCFICH is the channel in charge of communicating to the UEs the actual dimension of the PDCCH (which spans between 1 and 3 symbols); therefore the correct decodification of the DCIs depends on the correct interpretation of both ones. In 3GPP this problem have been evaluated for improving the cell-edge performance _[FujitsuWhitePaper], where the interference among neighboring cells can be relatively high due to signal degradation. A similar problem has been notices in femto-cell scenario and, more in general, in HetNet scenarios the bottleneck has been detected mainly as the PCFICH channel _[Bharucha2011], where in case of many eNBs are deployed in the same service area, this channel may collide in frequency, making impossible the correct detection of the PDCCH channel, too.
+
+In the simulator, the SINR perceived during the reception has been estimated according to the MIESM model presented above in order to evaluate the error distribution of PCFICH and PDCCH. In detail, the SINR samples of all the RBs are included in the evaluation of the MI associated to the control frame and, according to this values, the effective SINR (eSINR) is obtained by inverting the MI evaluation process. It has to be noted that, in case of MIMO transmission, both PCFICH and the PDCCH use always the transmit diversity mode as defined by the standard. According to the eSINR perceived the decodification error probability can be estimated as function of the results presented in _[R4-081920]. In case an error occur, the DCIs discarded and therefore the UE will be not able to receive the correspondent Tbs, therefore resulting lost.
+
MIMO Model
----------
--- a/src/lte/doc/source/lte-references.rst Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/doc/source/lte-references.rst Thu Jul 19 13:02:41 2012 +0200
@@ -73,3 +73,15 @@
.. [Ikuno2010] J.C. Ikuno, M. Wrulich, M. Rupp, "System Level Simulation of LTE Networks," Vehicular Technology Conference (VTC 2010-Spring), 2010 IEEE 71st , vol., no., pp.1-5, 16-19 May 2010
+.. [Milos2012] J. Milos, "Performace Analysis Of PCFICH LTE Control Channel", Proceedings of the 19th Conference STUDENT EEICT 2012, Brno, CZ, 2012.
+
+.. [FujitsuWhitePaper] "Enhancing LTE Cell-Edge Performance via PDCCH ICIC".
+
+
+.. [Bharucha2011] Z. Bharucha, G. Auer, T. Abe, N. Miki, "Femto-to-Macro Control Channel Interference Mitigation via Cell ID Manipulation in LTE," Vehicular Technology Conference (VTC Fall), 2011 IEEE , vol., no., pp.1-6, 5-8 Sept. 2011
+
+.. [R4-081920] 3GPP R4-081920 `LTE PDCCH/PCFICH Demodulation Performance Results with Implementation Margin
+ <http://www.3gpp.org/ftp/tsg_ran/wg4_radio/TSGR4_48/Documents/R4-081920.zip>`_
+
+
+
--- a/src/lte/doc/source/lte-testing.rst Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/doc/source/lte-testing.rst Thu Jul 19 13:02:41 2012 +0200
@@ -368,7 +368,7 @@
--------------------
-The test suite ``lte-test-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 test suite ``lte-phy-error-model`` generates different test cases for evaluating both data and control error models. For what concern the data, the test consists of 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:
@@ -403,7 +403,15 @@
BLER for test 6.
-The test verifies that in each case the obtained number of packets received correctly falls within the 99.9% confidence interval (CI) of a Binomial distribution where the parameter :math:`p` is equal to :math:`1-BER`, the parameter :math:`n` is the total number of packets sent and the parameter :math:`k` is the number of packets correctly received. The value of the CI has been chosen for guaranteeing a sufficient margin on the errors due to the quantization of the MI values in the tables.
+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.
+
+The error model of PCFICH-PDDCH channels consists of 4 test cases with a single UE and several eNBs, where the UE is connected to only one eNB in order to have the remaining acting as interfering ones. The errors on data are disabled in order to verify only the ones due to erroneous decodification of PCFICH-PDCCH. The test verifies that the error on the data received respects the decodification error probability of the PCFICH-PDCCH with a tolerance of 0.1 due to the errors that might be produced in quantizing the MI and the error curve. As before, the system has been forced on working in a less conservative fashion in the AMC module for appreciating the results in border situations. The parameters of the 4 tests cases are reported in the following:
+
+ #. 2 eNBs placed 1078 meters far from the UE, which implies a SINR of -2.00 dB and a TB of 217 bits, that in turns produce a BER of 0.007.
+ #. 3 eNBs placed 1078 meters far from the UE, which implies a SINR of -4.00 dB and a TB of 217 bits, that in turns produce a BER of 0.045.
+ #. 4 eNBs placed 1078 meters far from the UE, which implies a SINR of -6.00 dB and a TB of 133 bits, that in turns produce a BER of 0.206.
+ #. 5 eNBs placed 1078 meters far from the UE, which implies a SINR of -7.00 dB and a TB of 81 bits, that in turns produce a BER of 0.343.
+
MIMO Model
--- a/src/lte/doc/source/lte-user.rst Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/doc/source/lte-user.rst Thu Jul 19 13:02:41 2012 +0200
@@ -438,6 +438,16 @@
This command will go through the lists of all nodes and of all buildings, determine for each user if it is indoor or outdoor, and if indoor it will also determine the building in which the user is located and the corresponding floor and number inside the building.
+PHY Error Model
+---------------
+
+The Physical error model consists of the data error model and the downlink control error model, both of them active by default. It is possible to deactivate them with the ns3 attribute system, in detail::
+
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
+
+
+
MIMO Model
----------
--- a/src/lte/helper/lte-helper.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/helper/lte-helper.cc Thu Jul 19 13:02:41 2012 +0200
@@ -318,11 +318,11 @@
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
- Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
- ulPhy->AddSinrChunkProcessor (p);
+ Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> ());
+ ulPhy->AddCtrlSinrChunkProcessor (pCtrl); // for evaluating SRS UL-CQI
- Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (ulPhy);
- ulPhy->AddSinrChunkProcessor (pPem);
+ Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (ulPhy, phy);
+ ulPhy->AddDataSinrChunkProcessor (pData); // for evaluating PUSCH UL-CQI
dlPhy->SetChannel (m_downlinkChannel);
ulPhy->SetChannel (m_uplinkChannel);
@@ -368,7 +368,8 @@
ulPhy->SetDevice (dev);
n->AddDevice (dev);
- ulPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
+ ulPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
+ ulPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteEnbPhy::ReceiveLteControlMessageList, phy));
rrc->SetForwardUpCallback (MakeCallback (&LteEnbNetDevice::Receive, dev));
NS_LOG_LOGIC ("set the propagation model frequencies");
@@ -410,11 +411,11 @@
Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
- Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
- dlPhy->AddSinrChunkProcessor (p);
+ Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> (), dlPhy);
+ dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
- Ptr<LtePemSinrChunkProcessor> pPem = Create<LtePemSinrChunkProcessor> (dlPhy);
- dlPhy->AddSinrChunkProcessor (pPem);
+ Ptr<LteDataSinrChunkProcessor> pData = Create<LteDataSinrChunkProcessor> (dlPhy);
+ dlPhy->AddDataSinrChunkProcessor (pData);
dlPhy->SetChannel (m_downlinkChannel);
ulPhy->SetChannel (m_uplinkChannel);
@@ -447,7 +448,8 @@
ulPhy->SetDevice (dev);
n->AddDevice (dev);
- dlPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
+ dlPhy->SetLtePhyRxDataEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
+ dlPhy->SetLtePhyRxCtrlEndOkCallback (MakeCallback (&LteUePhy::ReceiveLteControlMessageList, phy));
rrc->SetForwardUpCallback (MakeCallback (&LteUeNetDevice::Receive, dev));
return dev;
@@ -473,6 +475,7 @@
uint16_t rnti = enbRrc->AddUe (ueDevice->GetObject<LteUeNetDevice> ()->GetImsi ());
Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
ueRrc->ConfigureUe (rnti, enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId () );
+ //enbRrc->SetCellId (enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId ());
// attach UE to eNB
ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
@@ -485,12 +488,13 @@
//
// WILD HACK - should be done through PHY SAP, probably passing by RRC
+ NS_LOG_DEBUG ("!Attach eNB " << enbDevice->GetObject<LteEnbNetDevice> ()->GetCellId () << " with UE " << rnti);
uePhy->SetRnti (rnti);
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
enbDevice->GetObject<LteEnbNetDevice> ()->GetDlBandwidth ());
uePhy->DoSetEarfcn (enbDevice->GetObject<LteEnbNetDevice> ()->GetDlEarfcn (),
enbDevice->GetObject<LteEnbNetDevice> ()->GetUlEarfcn ());
-
+ enbRrc->ConfigureNewUe (rnti);
ueDevice->Start ();
m_downlinkChannel->AddRx (uePhy->GetDownlinkSpectrumPhy ());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/ff-mac-common.cc Thu Jul 19 13:02:41 2012 +0200
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 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 <mmiozzo@cttc.es>
+ */
+
+#include <ns3/ff-mac-common.h>
+
+namespace ns3 {
+
+
+VendorSpecificValue::~VendorSpecificValue ()
+{
+
+}
+
+
+} // namespace ns3
--- a/src/lte/model/ff-mac-common.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/ff-mac-common.h Thu Jul 19 13:02:41 2012 +0200
@@ -21,6 +21,11 @@
#ifndef FF_MAC_COMMON_H
#define FF_MAC_COMMON_H
+#include <ns3/simple-ref-count.h>
+#include <ns3/ptr.h>
+#include <vector>
+
+
/**
* Constants. See section 4.4
*/
@@ -49,6 +54,7 @@
#define MAX_SR_LIST 30
#define MAX_MAC_CE_LIST 30
+namespace ns3 {
enum Result_e
{
@@ -143,13 +149,22 @@
};
/**
+* \brief Base class for storing the values of vendor specific parameters
+*/
+struct VendorSpecificValue : public SimpleRefCount<VendorSpecificValue>
+{
+ virtual ~VendorSpecificValue ();
+
+};
+
+/**
* \brief See section 4.3.3 vendorSpecifiListElement
*/
struct VendorSpecificListElement_s
{
uint32_t m_type;
uint32_t m_length;
- void *m_value;
+ Ptr<VendorSpecificValue> m_value;
};
/**
@@ -464,5 +479,6 @@
uint8_t m_pagingSubframe;
};
+} // namespace ns3
#endif /* FF_MAC_COMMON_H */
--- a/src/lte/model/ff-mac-scheduler.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/ff-mac-scheduler.cc Thu Jul 19 13:02:41 2012 +0200
@@ -21,6 +21,8 @@
#include "ff-mac-scheduler.h"
#include <ns3/log.h>
+#include <ns3/enum.h>
+
NS_LOG_COMPONENT_DEFINE ("FfMacScheduler");
@@ -29,6 +31,13 @@
NS_OBJECT_ENSURE_REGISTERED (FfMacScheduler);
+FfMacScheduler::FfMacScheduler ()
+: m_ulCqiFilter (ALL_UL_CQI)
+{
+ NS_LOG_FUNCTION (this);
+}
+
+
FfMacScheduler::~FfMacScheduler ()
{
NS_LOG_FUNCTION (this);
@@ -44,10 +53,19 @@
FfMacScheduler::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::FfMacScheduler")
- .SetParent<Object> ();
+ .SetParent<Object> ()
+ .AddAttribute ("UlCqiFilter",
+ "The filter to apply on UL CQIs received",
+ EnumValue (FfMacScheduler::ALL_UL_CQI),
+ MakeEnumAccessor (&FfMacScheduler::m_ulCqiFilter),
+ MakeEnumChecker (FfMacScheduler::SRS_UL_CQI, "SRS_UL_CQI",
+ FfMacScheduler::PUSCH_UL_CQI, "PUSCH_UL_CQI",
+ FfMacScheduler::ALL_UL_CQI, "ALL_UL_CQI"))
+ ;
return tid;
}
+
} // namespace ns3
--- a/src/lte/model/ff-mac-scheduler.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/ff-mac-scheduler.h Thu Jul 19 13:02:41 2012 +0200
@@ -45,6 +45,22 @@
{
public:
/**
+ * The type of UL CQI to be filtered (ALL means accept all the CQI,
+ * where a new CQI of any type overwrite the old one, even of another type)
+ *
+ */
+ enum UlCqiFilter_t
+ {
+ SRS_UL_CQI,
+ PUSCH_UL_CQI,
+ ALL_UL_CQI
+ };
+ /**
+ * constructor
+ *
+ */
+ FfMacScheduler ();
+ /**
* destructor
*
*/
@@ -83,6 +99,11 @@
*/
virtual FfMacSchedSapProvider* GetFfMacSchedSapProvider () = 0;
+
+protected:
+
+ UlCqiFilter_t m_ulCqiFilter;
+
};
} // namespace ns3
--- a/src/lte/model/ideal-control-messages.cc Wed Jul 18 00:35:39 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
- *
- * 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: Giuseppe Piro <g.piro@poliba.it>
- * Marco Miozzo <marco.miozzo@cttc.es>
- */
-
-#include "ideal-control-messages.h"
-#include "ns3/address-utils.h"
-#include "ns3/uinteger.h"
-#include "ns3/log.h"
-#include "lte-net-device.h"
-#include "lte-ue-net-device.h"
-
-NS_LOG_COMPONENT_DEFINE ("IdealControlMessage");
-
-
-namespace ns3 {
-
-IdealControlMessage::IdealControlMessage (void)
- : m_source (0),
- m_destination (0)
-{
-}
-
-
-IdealControlMessage::~IdealControlMessage (void)
-{
- m_source = 0;
- m_destination = 0;
-}
-
-
-void
-IdealControlMessage::SetSourceDevice (Ptr<LteNetDevice> src)
-{
- m_source = src;
-}
-
-
-void
-IdealControlMessage::SetDestinationDevice (Ptr<LteNetDevice> dst)
-{
- m_destination = dst;
-}
-
-
-Ptr<LteNetDevice>
-IdealControlMessage::GetSourceDevice (void)
-{
- return m_source;
-}
-
-
-Ptr<LteNetDevice>
-IdealControlMessage::GetDestinationDevice (void)
-{
- return m_destination;
-}
-
-
-void
-IdealControlMessage::SetMessageType (IdealControlMessage::MessageType type)
-{
- m_type = type;
-}
-
-
-IdealControlMessage::MessageType
-IdealControlMessage::GetMessageType (void)
-{
- return m_type;
-}
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-DlDciIdealControlMessage::DlDciIdealControlMessage (void)
-{
- SetMessageType (IdealControlMessage::DL_DCI);
-}
-
-
-DlDciIdealControlMessage::~DlDciIdealControlMessage (void)
-{
-
-}
-
-void
-DlDciIdealControlMessage::SetDci (DlDciListElement_s dci)
-{
- m_dci = dci;
-
-}
-
-
-DlDciListElement_s
-DlDciIdealControlMessage::GetDci (void)
-{
- return m_dci;
-}
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-UlDciIdealControlMessage::UlDciIdealControlMessage (void)
-{
- SetMessageType (IdealControlMessage::UL_DCI);
-}
-
-
-UlDciIdealControlMessage::~UlDciIdealControlMessage (void)
-{
-
-}
-
-void
-UlDciIdealControlMessage::SetDci (UlDciListElement_s dci)
-{
- m_dci = dci;
-
-}
-
-
-UlDciListElement_s
-UlDciIdealControlMessage::GetDci (void)
-{
- return m_dci;
-}
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-DlCqiIdealControlMessage::DlCqiIdealControlMessage (void)
-{
- SetMessageType (IdealControlMessage::DL_CQI);
-}
-
-
-DlCqiIdealControlMessage::~DlCqiIdealControlMessage (void)
-{
-
-}
-
-void
-DlCqiIdealControlMessage::SetDlCqi (CqiListElement_s dlcqi)
-{
- m_dlCqi = dlcqi;
-
-}
-
-
-CqiListElement_s
-DlCqiIdealControlMessage::GetDlCqi (void)
-{
- return m_dlCqi;
-}
-
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-BsrIdealControlMessage::BsrIdealControlMessage (void)
-{
- SetMessageType (IdealControlMessage::BSR);
-}
-
-
-BsrIdealControlMessage::~BsrIdealControlMessage (void)
-{
-
-}
-
-void
-BsrIdealControlMessage::SetBsr (MacCeListElement_s bsr)
-{
- m_bsr = bsr;
-
-}
-
-
-MacCeListElement_s
-BsrIdealControlMessage::GetBsr (void)
-{
- return m_bsr;
-}
-
-
-} // namespace ns3
-
--- a/src/lte/model/ideal-control-messages.h Wed Jul 18 00:35:39 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
- *
- * 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: Giuseppe Piro <g.piro@poliba.it>
- * Author: Marco Miozzo <marco.miozzo@cttc.es>
- */
-
-#ifndef IDEAL_CONTROL_MESSAGES_H
-#define IDEAL_CONTROL_MESSAGES_H
-
-#include "ns3/ptr.h"
-#include "ns3/simple-ref-count.h"
-#include <list>
-
-namespace ns3 {
-
-class LteNetDevice;
-
-
-/**
- * \ingroup lte
- *
- * The IdealControlMessage provides a basic implementations for
- * control messages (such as PDCCH allocation map, CQI feedbacks)
- * that are exchanged among eNodeB and UEs.
- */
-class IdealControlMessage : public SimpleRefCount<IdealControlMessage>
-{
-public:
- /**
- * The type of the message
- */
- enum MessageType
- {
- CQI_FEEDBACKS, ALLOCATION_MAP,
- DL_DCI, UL_DCI, // Downlink/Uplink Data Control Indicator
- DL_CQI, UL_CQI, // Downlink/Uplink Channel Quality Indicator
- BSR // Buffer Status Report
- };
-
- IdealControlMessage (void);
- virtual ~IdealControlMessage (void);
-
- /**
- * \brief Set the source device of the message
- * \param src the device that sends the message
- */
- void SetSourceDevice (Ptr<LteNetDevice> src);
- /**
- * \brief Set the destination device of the message
- * \param dst the device that receives the message
- */
- void SetDestinationDevice (Ptr<LteNetDevice> dst);
-
- /**
- * \brief Get the source device of the message
- * \return the pointer to the device that sends the message
- */
- Ptr<LteNetDevice> GetSourceDevice (void);
- /**
- * \brief Get the destination device of the message
- * \return the pointer to the device that receives the message
- */
- Ptr<LteNetDevice> GetDestinationDevice (void);
-
- /**
- * \brief Set the type of the message
- * \param type the type of the message
- */
- void SetMessageType (MessageType type);
- /**
- * \brief Get the type of the message
- * \return the type of the message
- */
- MessageType GetMessageType (void);
-
-private:
- Ptr<LteNetDevice> m_source;
- Ptr<LteNetDevice> m_destination;
- MessageType m_type;
-};
-} // namespace ns3
-
-#endif /* IDEAL_CONTROL_MESSAGES_H */
-
-
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-#ifndef DL_DCI_IDEAL_CONTROL_MESSAGES_H
-#define DL_DCI_IDEAL_CONTROL_MESSAGES_H
-
-#include <ns3/object.h>
-#include <ns3/ff-mac-common.h>
-
-namespace ns3 {
-
-/**
- * \ingroup lte
- * The Downlink Data Control Indicator messages defines the RB allocation for the
- * users in the downlink
- */
-class DlDciIdealControlMessage : public IdealControlMessage
-{
-public:
- DlDciIdealControlMessage (void);
- virtual ~DlDciIdealControlMessage (void);
-
- /**
- * \brief add a DCI into the message
- * \param dci the dci
- */
- void SetDci (DlDciListElement_s dci);
-
- /**
- * \brief Get dic informations
- * \return dci messages
- */
- DlDciListElement_s GetDci (void);
-
-
-private:
- DlDciListElement_s m_dci;
-};
-} // namespace ns3
-
-#endif /* DL_DCI_IDEAL_CONTROL_MESSAGES_H */
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-#ifndef UL_DCI_IDEAL_CONTROL_MESSAGES_H
-#define UL_DCI_IDEAL_CONTROL_MESSAGES_H
-
-#include <ns3/object.h>
-#include <ns3/ff-mac-common.h>
-
-namespace ns3 {
-
-/**
- * \ingroup lte
- * The Uplink Data Control Indicator messages defines the RB allocation for the
- * users in the uplink
- */
-class UlDciIdealControlMessage : public IdealControlMessage
-{
-public:
- UlDciIdealControlMessage (void);
- virtual ~UlDciIdealControlMessage (void);
-
- /**
- * \brief add a DCI into the message
- * \param dci the dci
- */
- void SetDci (UlDciListElement_s dci);
-
- /**
- * \brief Get dic informations
- * \return dci messages
- */
- UlDciListElement_s GetDci (void);
-
-
-private:
- UlDciListElement_s m_dci;
-};
-} // namespace ns3
-
-#endif /* UL_DCI_IDEAL_CONTROL_MESSAGES_H */
-
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-
-#ifndef DLCQI_IDEAL_CONTROL_MESSAGES_H
-#define DLCQI_IDEAL_CONTROL_MESSAGES_H
-
-#include <ns3/object.h>
-#include <ns3/ff-mac-common.h>
-
-namespace ns3 {
-
-class LteNetDevice;
-
-/**
- * \ingroup lte
- * The downlink CqiIdealControlMessage defines an ideal list of
- * feedback about the channel quality sent by the UE to the eNodeB.
- */
-class DlCqiIdealControlMessage : public IdealControlMessage
-{
-public:
- DlCqiIdealControlMessage (void);
- virtual ~DlCqiIdealControlMessage (void);
-
- /**
- * \brief add a DL-CQI feedback record into the message.
- * \param dlcqi the DL cqi feedback
- */
- void SetDlCqi (CqiListElement_s dlcqi);
-
- /**
- * \brief Get DL cqi informations
- * \return dlcqi messages
- */
- CqiListElement_s GetDlCqi (void);
-
-
-private:
- CqiListElement_s m_dlCqi;
-};
-} // namespace ns3
-
-#endif /* DLCQI_IDEAL_CONTROL_MESSAGES_H */
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-#ifndef BSR_IDEAL_CONTROL_MESSAGES_H
-#define BSR_IDEAL_CONTROL_MESSAGES_H
-
-#include <ns3/object.h>
-#include <ns3/ff-mac-common.h>
-
-namespace ns3 {
-
-class LteNetDevice;
-
-/**
- * \ingroup lte
- * The uplink BsrIdealControlMessage defines the specific
- * extension of the CE element for reporting the buffer status report
- */
-class BsrIdealControlMessage : public IdealControlMessage
-{
-public:
- BsrIdealControlMessage (void);
- virtual ~BsrIdealControlMessage (void);
-
- /**
- * \brief add a BSR feedback record into the message.
- * \param bsr the BSR feedback
- */
- void SetBsr (MacCeListElement_s ulcqi);
-
- /**
- * \brief Get BSR informations
- * \return BSR message
- */
- MacCeListElement_s GetBsr (void);
-
-
-private:
- MacCeListElement_s m_bsr;
-
-
-};
-} // namespace ns3
-
-#endif /* BSR_IDEAL_CONTROL_MESSAGES_H */
-
--- a/src/lte/model/lte-common.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-common.h Thu Jul 19 13:02:41 2012 +0200
@@ -56,10 +56,24 @@
friend bool operator < (const ImsiLcidPair_t &a, const ImsiLcidPair_t &b);
};
+/**
+* \brief Parameters for configuring the UE
+*/
struct LteUeConfig_t
{
uint16_t m_rnti;
+ /**
+ * When false means that the message is inteded foro configuring a new UE
+ */
+ bool m_reconfigureFlag;
+ /**
+ * Transmission mode [1..7] (i.e., SISO, MIMO, etc.)
+ */
uint8_t m_transmissionMode;
+ /**
+ * Srs Configuration index for UE specific SRS, see section 8.2 of TS 36.213
+ */
+ uint16_t m_srsConfigurationIndex;
public:
LteUeConfig_t ();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-control-messages.cc Thu Jul 19 13:02:41 2012 +0200
@@ -0,0 +1,180 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
+ *
+ * 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: Giuseppe Piro <g.piro@poliba.it>
+ * Marco Miozzo <marco.miozzo@cttc.es>
+ */
+
+#include "lte-control-messages.h"
+#include "ns3/address-utils.h"
+#include "ns3/uinteger.h"
+#include "ns3/log.h"
+#include "lte-net-device.h"
+#include "lte-ue-net-device.h"
+
+NS_LOG_COMPONENT_DEFINE ("LteControlMessage");
+
+
+namespace ns3 {
+
+LteControlMessage::LteControlMessage (void)
+ : m_source (0),
+ m_destination (0)
+{
+}
+
+
+LteControlMessage::~LteControlMessage (void)
+{
+ m_source = 0;
+ m_destination = 0;
+}
+
+
+void
+LteControlMessage::SetMessageType (LteControlMessage::MessageType type)
+{
+ m_type = type;
+}
+
+
+LteControlMessage::MessageType
+LteControlMessage::GetMessageType (void)
+{
+ return m_type;
+}
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+DlDciLteControlMessage::DlDciLteControlMessage (void)
+{
+ SetMessageType (LteControlMessage::DL_DCI);
+}
+
+
+DlDciLteControlMessage::~DlDciLteControlMessage (void)
+{
+
+}
+
+void
+DlDciLteControlMessage::SetDci (DlDciListElement_s dci)
+{
+ m_dci = dci;
+
+}
+
+
+DlDciListElement_s
+DlDciLteControlMessage::GetDci (void)
+{
+ return m_dci;
+}
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+UlDciLteControlMessage::UlDciLteControlMessage (void)
+{
+ SetMessageType (LteControlMessage::UL_DCI);
+}
+
+
+UlDciLteControlMessage::~UlDciLteControlMessage (void)
+{
+
+}
+
+void
+UlDciLteControlMessage::SetDci (UlDciListElement_s dci)
+{
+ m_dci = dci;
+
+}
+
+
+UlDciListElement_s
+UlDciLteControlMessage::GetDci (void)
+{
+ return m_dci;
+}
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+DlCqiLteControlMessage::DlCqiLteControlMessage (void)
+{
+ SetMessageType (LteControlMessage::DL_CQI);
+}
+
+
+DlCqiLteControlMessage::~DlCqiLteControlMessage (void)
+{
+
+}
+
+void
+DlCqiLteControlMessage::SetDlCqi (CqiListElement_s dlcqi)
+{
+ m_dlCqi = dlcqi;
+
+}
+
+
+CqiListElement_s
+DlCqiLteControlMessage::GetDlCqi (void)
+{
+ return m_dlCqi;
+}
+
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+BsrLteControlMessage::BsrLteControlMessage (void)
+{
+ SetMessageType (LteControlMessage::BSR);
+}
+
+
+BsrLteControlMessage::~BsrLteControlMessage (void)
+{
+
+}
+
+void
+BsrLteControlMessage::SetBsr (MacCeListElement_s bsr)
+{
+ m_bsr = bsr;
+
+}
+
+
+MacCeListElement_s
+BsrLteControlMessage::GetBsr (void)
+{
+ return m_bsr;
+}
+
+
+} // namespace ns3
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-control-messages.h Thu Jul 19 13:02:41 2012 +0200
@@ -0,0 +1,257 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
+ *
+ * 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: Giuseppe Piro <g.piro@poliba.it>
+ * Author: Marco Miozzo <marco.miozzo@cttc.es>
+ */
+
+#ifndef LTE_CONTROL_MESSAGES_H
+#define LTE_CONTROL_MESSAGES_H
+
+#include "ns3/ptr.h"
+#include "ns3/simple-ref-count.h"
+#include <list>
+
+namespace ns3 {
+
+class LteNetDevice;
+
+
+/**
+ * \ingroup lte
+ *
+ * The LteControlMessage provides a basic implementations for
+ * control messages (such as PDCCH allocation map, CQI feedbacks)
+ * that are exchanged among eNodeB and UEs.
+ */
+class LteControlMessage : public SimpleRefCount<LteControlMessage>
+{
+public:
+ /**
+ * The type of the message
+ */
+ enum MessageType
+ {
+ DL_DCI, UL_DCI, // Downlink/Uplink Data Control Indicator
+ DL_CQI, UL_CQI, // Downlink/Uplink Channel Quality Indicator
+ BSR // Buffer Status Report
+ };
+
+ LteControlMessage (void);
+ virtual ~LteControlMessage (void);
+
+ /**
+ * \brief Set the type of the message
+ * \param type the type of the message
+ */
+ void SetMessageType (MessageType type);
+ /**
+ * \brief Get the type of the message
+ * \return the type of the message
+ */
+ MessageType GetMessageType (void);
+
+private:
+ Ptr<LteNetDevice> m_source;
+ Ptr<LteNetDevice> m_destination;
+ MessageType m_type;
+};
+} // namespace ns3
+
+#endif /* LTE_CONTROL_MESSAGES_H */
+
+
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+#ifndef DL_DCI_LTE_CONTROL_MESSAGES_H
+#define DL_DCI_LTE_CONTROL_MESSAGES_H
+
+#include <ns3/object.h>
+#include <ns3/ff-mac-common.h>
+
+namespace ns3 {
+
+/**
+ * \ingroup lte
+ * The Downlink Data Control Indicator messages defines the RB allocation for the
+ * users in the downlink
+ */
+class DlDciLteControlMessage : public LteControlMessage
+{
+public:
+ DlDciLteControlMessage (void);
+ virtual ~DlDciLteControlMessage (void);
+
+ /**
+ * \brief add a DCI into the message
+ * \param dci the dci
+ */
+ void SetDci (DlDciListElement_s dci);
+
+ /**
+ * \brief Get dic informations
+ * \return dci messages
+ */
+ DlDciListElement_s GetDci (void);
+
+
+private:
+ DlDciListElement_s m_dci;
+};
+} // namespace ns3
+
+#endif /* DL_DCI_LTE_CONTROL_MESSAGES_H */
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+#ifndef UL_DCI_LTE_CONTROL_MESSAGES_H
+#define UL_DCI_LTE_CONTROL_MESSAGES_H
+
+#include <ns3/object.h>
+#include <ns3/ff-mac-common.h>
+
+namespace ns3 {
+
+/**
+ * \ingroup lte
+ * The Uplink Data Control Indicator messages defines the RB allocation for the
+ * users in the uplink
+ */
+class UlDciLteControlMessage : public LteControlMessage
+{
+public:
+ UlDciLteControlMessage (void);
+ virtual ~UlDciLteControlMessage (void);
+
+ /**
+ * \brief add a DCI into the message
+ * \param dci the dci
+ */
+ void SetDci (UlDciListElement_s dci);
+
+ /**
+ * \brief Get dic informations
+ * \return dci messages
+ */
+ UlDciListElement_s GetDci (void);
+
+
+private:
+ UlDciListElement_s m_dci;
+};
+} // namespace ns3
+
+#endif /* UL_DCI_LTE_CONTROL_MESSAGES_H */
+
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+
+
+#ifndef DLCQI_LTE_CONTROL_MESSAGES_H
+#define DLCQI_LTE_CONTROL_MESSAGES_H
+
+#include <ns3/object.h>
+#include <ns3/ff-mac-common.h>
+
+namespace ns3 {
+
+class LteNetDevice;
+
+/**
+ * \ingroup lte
+ * The downlink CqiLteControlMessage defines an ideal list of
+ * feedback about the channel quality sent by the UE to the eNodeB.
+ */
+class DlCqiLteControlMessage : public LteControlMessage
+{
+public:
+ DlCqiLteControlMessage (void);
+ virtual ~DlCqiLteControlMessage (void);
+
+ /**
+ * \brief add a DL-CQI feedback record into the message.
+ * \param dlcqi the DL cqi feedback
+ */
+ void SetDlCqi (CqiListElement_s dlcqi);
+
+ /**
+ * \brief Get DL cqi informations
+ * \return dlcqi messages
+ */
+ CqiListElement_s GetDlCqi (void);
+
+
+private:
+ CqiListElement_s m_dlCqi;
+};
+} // namespace ns3
+
+#endif /* DLCQI_LTE_CONTROL_MESSAGES_H */
+
+
+// ----------------------------------------------------------------------------------------------------------
+
+#ifndef BSR_LTE_CONTROL_MESSAGES_H
+#define BSR_LTE_CONTROL_MESSAGES_H
+
+#include <ns3/object.h>
+#include <ns3/ff-mac-common.h>
+
+namespace ns3 {
+
+class LteNetDevice;
+
+/**
+ * \ingroup lte
+ * The uplink BsrLteControlMessage defines the specific
+ * extension of the CE element for reporting the buffer status report
+ */
+class BsrLteControlMessage : public LteControlMessage
+{
+public:
+ BsrLteControlMessage (void);
+ virtual ~BsrLteControlMessage (void);
+
+ /**
+ * \brief add a BSR feedback record into the message.
+ * \param bsr the BSR feedback
+ */
+ void SetBsr (MacCeListElement_s ulcqi);
+
+ /**
+ * \brief Get BSR informations
+ * \return BSR message
+ */
+ MacCeListElement_s GetBsr (void);
+
+
+private:
+ MacCeListElement_s m_bsr;
+
+
+};
+} // namespace ns3
+
+#endif /* LTE_CONTROL_MESSAGES_H */
+
--- a/src/lte/model/lte-enb-cmac-sap.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-cmac-sap.h Thu Jul 19 13:02:41 2012 +0200
@@ -26,7 +26,6 @@
#include <ns3/ff-mac-common.h>
#include <ns3/eps-bearer.h>
#include <ns3/lte-common.h>
-#include <ns3/ff-mac-csched-sap.h>
namespace ns3 {
@@ -98,7 +97,7 @@
*/
virtual void ReleaseLc (uint16_t rnti, uint8_t lcid) = 0;
- virtual void RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params) = 0;
+ virtual void UeUpdateConfigurationReq (LteUeConfig_t params) = 0;
};
--- a/src/lte/model/lte-enb-mac.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-mac.cc Thu Jul 19 13:02:41 2012 +0200
@@ -25,7 +25,7 @@
#include <ns3/packet.h>
#include "lte-amc.h"
-#include "ideal-control-messages.h"
+#include "lte-control-messages.h"
#include "lte-enb-net-device.h"
#include "lte-ue-net-device.h"
@@ -62,7 +62,7 @@
virtual void AddLc (LcInfo lcinfo, LteMacSapUser* msu);
virtual void ReconfigureLc (LcInfo lcinfo);
virtual void ReleaseLc (uint16_t rnti, uint8_t lcid);
- virtual void RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params);
+ virtual void UeUpdateConfigurationReq (LteUeConfig_t params);
private:
LteEnbMac* m_mac;
@@ -105,9 +105,9 @@
}
void
-EnbMacMemberLteEnbCmacSapProvider::RrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params)
+EnbMacMemberLteEnbCmacSapProvider::UeUpdateConfigurationReq (LteUeConfig_t params)
{
- m_mac->DoRrcUpdateConfigurationReq (params);
+ m_mac->DoUeUpdateConfigurationReq (params);
}
@@ -225,8 +225,8 @@
// inherited from LteEnbPhySapUser
virtual void ReceivePhyPdu (Ptr<Packet> p);
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
- virtual void UlCqiReport (UlCqi_s ulcqi);
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
+ virtual void UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi);
private:
LteEnbMac* m_mac;
@@ -250,13 +250,13 @@
}
void
-EnbMacMemberLteEnbPhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+EnbMacMemberLteEnbPhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
- m_mac->DoReceiveIdealControlMessage (msg);
+ m_mac->DoReceiveLteControlMessage (msg);
}
void
-EnbMacMemberLteEnbPhySapUser::UlCqiReport (UlCqi_s ulcqi)
+EnbMacMemberLteEnbPhySapUser::UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
{
m_mac->DoUlCqiReport (ulcqi);
}
@@ -407,8 +407,6 @@
// Get downlink transmission opportunities
-// uint32_t dlSchedFrameNo = (0x3FF & (m_frameNo >> 4));
-// uint32_t dlSchedSubframeNo = (0xF & m_subframeNo);
uint32_t dlSchedFrameNo = m_frameNo;
uint32_t dlSchedSubframeNo = m_subframeNo;
// NS_LOG_DEBUG (this << " sfn " << frameNo << " sbfn " << subframeNo);
@@ -428,32 +426,20 @@
// --- UPLINK ---
// Send UL-CQI info to the scheduler
- if (m_ulCqiReceived.size () > 0)
+ std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters>::iterator itCqi;
+ for (uint16_t i = 0; i < m_ulCqiReceived.size (); i++)
{
- FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqiInfoReq;
if (subframeNo>1)
{
- ulcqiInfoReq.m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
+ m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & frameNo) << 4) | (0xF & subframeNo);
}
else
{
- ulcqiInfoReq.m_sfnSf = ((0x3FF & (frameNo-1)) << 4) | (0xF & 10);
+ m_ulCqiReceived.at (i).m_sfnSf = ((0x3FF & (frameNo-1)) << 4) | (0xF & 10);
}
- int cqiNum = m_ulCqiReceived.size ();
- if (cqiNum >= 1)
- {
- ulcqiInfoReq.m_ulCqi = m_ulCqiReceived.at (cqiNum - 1);
- if (cqiNum > 1)
- {
- // empty old ul cqi
- while (m_ulCqiReceived.size () > 0)
- {
- m_ulCqiReceived.pop_back ();
- }
- }
- m_schedSapProvider->SchedUlCqiInfoReq (ulcqiInfoReq);
- }
+ m_schedSapProvider->SchedUlCqiInfoReq (m_ulCqiReceived.at (i));
}
+ m_ulCqiReceived.clear ();
// Send BSR reports to the scheduler
if (m_ulCeReceived.size () > 0)
@@ -477,7 +463,6 @@
}
else
{
-// ulSchedSubframeNo = (ulSchedSubframeNo + (2*m_macChTtiDelay)) % 11;
ulSchedSubframeNo = ulSchedSubframeNo + (m_macChTtiDelay+UL_PUSCH_TTIS_DELAY);
}
FfMacSchedSapProvider::SchedUlTriggerReqParameters ulparams;
@@ -494,7 +479,6 @@
// reset UL info
- //std::map <uint16_t,UlInfoListElement_s>::iterator it;
for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
{
for (uint16_t i = 0; i < (*it).second.m_ulReception.size (); i++)
@@ -507,30 +491,30 @@
}
void
-LteEnbMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteEnbMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
- if (msg->GetMessageType () == IdealControlMessage::DL_CQI)
+ if (msg->GetMessageType () == LteControlMessage::DL_CQI)
{
- Ptr<DlCqiIdealControlMessage> dlcqi = DynamicCast<DlCqiIdealControlMessage> (msg);
- ReceiveDlCqiIdealControlMessage (dlcqi);
+ Ptr<DlCqiLteControlMessage> dlcqi = DynamicCast<DlCqiLteControlMessage> (msg);
+ ReceiveDlCqiLteControlMessage (dlcqi);
}
- else if (msg->GetMessageType () == IdealControlMessage::BSR)
+ else if (msg->GetMessageType () == LteControlMessage::BSR)
{
- Ptr<BsrIdealControlMessage> bsr = DynamicCast<BsrIdealControlMessage> (msg);
+ Ptr<BsrLteControlMessage> bsr = DynamicCast<BsrLteControlMessage> (msg);
ReceiveBsrMessage (bsr->GetBsr ());
}
else
{
- NS_LOG_LOGIC (this << " IdealControlMessage not recognized");
+ NS_LOG_LOGIC (this << " LteControlMessage not recognized");
}
}
void
-LteEnbMac::DoUlCqiReport (UlCqi_s ulcqi)
+LteEnbMac::DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi)
{
- if (ulcqi.m_type == UlCqi_s::PUSCH)
+ if (ulcqi.m_ulCqi.m_type == UlCqi_s::PUSCH)
{
NS_LOG_DEBUG (this << " eNB rxed an PUSCH UL-CQI");
}
@@ -540,7 +524,7 @@
void
-LteEnbMac::ReceiveDlCqiIdealControlMessage (Ptr<DlCqiIdealControlMessage> msg)
+LteEnbMac::ReceiveDlCqiLteControlMessage (Ptr<DlCqiLteControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
@@ -756,9 +740,9 @@
}
}
// send the relative DCI
- Ptr<DlDciIdealControlMessage> msg = Create<DlDciIdealControlMessage> ();
+ Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
msg->SetDci (ind.m_buildDataList.at (i).m_dci);
- m_enbPhySapProvider->SendIdealControlMessage (msg);
+ m_enbPhySapProvider->SendLteControlMessage (msg);
}
// Fire the trace with the DL information
@@ -800,9 +784,9 @@
for (unsigned int i = 0; i < ind.m_dciList.size (); i++)
{
// send the correspondent ul dci
- Ptr<UlDciIdealControlMessage> msg = Create<UlDciIdealControlMessage> ();
+ Ptr<UlDciLteControlMessage> msg = Create<UlDciLteControlMessage> ();
msg->SetDci (ind.m_dciList.at (i));
- m_enbPhySapProvider->SendIdealControlMessage (msg);
+ m_enbPhySapProvider->SendLteControlMessage (msg);
}
// Fire the trace with the UL information
@@ -868,11 +852,12 @@
}
void
-LteEnbMac::DoRrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params)
+LteEnbMac::DoUeUpdateConfigurationReq (LteUeConfig_t params)
{
NS_LOG_FUNCTION (this);
// propagates to PHY layer
m_enbPhySapProvider->SetTransmissionMode (params.m_rnti, params.m_transmissionMode);
+ m_enbPhySapProvider->SetSrsConfigurationIndex (params.m_rnti, params.m_srsConfigurationIndex);
// propagates to scheduler
FfMacCschedSapProvider::CschedUeConfigReqParameters req;
req.m_rnti = params.m_rnti;
--- a/src/lte/model/lte-enb-mac.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-mac.h Thu Jul 19 13:02:41 2012 +0200
@@ -36,9 +36,9 @@
namespace ns3 {
-class DlCqiIdealControlMessage;
-class UlCqiIdealControlMessage;
-class PdcchMapIdealControlMessage;
+class DlCqiLteControlMessage;
+class UlCqiLteControlMessage;
+class PdcchMapLteControlMessage;
@@ -123,9 +123,9 @@
* \brief Receive a DL CQI ideal control message
* \param msg the DL CQI message
*/
- void ReceiveDlCqiIdealControlMessage (Ptr<DlCqiIdealControlMessage> msg);
+ void ReceiveDlCqiLteControlMessage (Ptr<DlCqiLteControlMessage> msg);
- void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ void DoReceiveLteControlMessage (Ptr<LteControlMessage> msg);
/**
* \brief Receive a CE element containing the buffer status report
@@ -133,7 +133,7 @@
*/
void ReceiveBsrMessage (MacCeListElement_s bsr);
- void DoUlCqiReport (UlCqi_s ulcqi);
+ void DoUlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi);
@@ -163,7 +163,7 @@
void DoSchedDlConfigInd (FfMacSchedSapUser::SchedDlConfigIndParameters ind);
void DoSchedUlConfigInd (FfMacSchedSapUser::SchedUlConfigIndParameters params);
- void DoRrcUpdateConfigurationReq (FfMacCschedSapProvider::CschedUeConfigReqParameters params);
+ void DoUeUpdateConfigurationReq (LteUeConfig_t params);
/**
* \brief Forwarded from LteEnbPhySapUser: trigger the start from a new frame
@@ -184,11 +184,10 @@
private:
private:
- // std::map <uint16_t, std::map <uint8_t,Ptr<LteMacSapUser> > > m_rlcAttached;
std::map <LteFlowId_t, LteMacSapUser*> m_rlcAttached;
std::vector <CqiListElement_s> m_dlCqiReceived; // DL-CQI received
- std::vector <UlCqi_s> m_ulCqiReceived; // UL-CQI received
+ std::vector <FfMacSchedSapProvider::SchedUlCqiInfoReqParameters> m_ulCqiReceived; // UL-CQI received
std::vector <MacCeListElement_s> m_ulCeReceived; // CE received (BSR up to now)
--- a/src/lte/model/lte-enb-net-device.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-net-device.cc Thu Jul 19 13:02:41 2012 +0200
@@ -277,6 +277,7 @@
NS_LOG_FUNCTION (this);
m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth);
+ m_rrc->SetCellId (m_cellId);
// Configuring directly for now, but ideally we should use the PHY
// SAP instead. Probably should handle this through the RRC.
--- a/src/lte/model/lte-enb-phy-sap.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-phy-sap.h Thu Jul 19 13:02:41 2012 +0200
@@ -25,10 +25,11 @@
#include <ns3/packet.h>
#include <ns3/ff-mac-common.h>
+#include <ns3/ff-mac-sched-sap.h>
namespace ns3 {
-class IdealControlMessage;
+class LteControlMessage;
/**
* Service Access Point (SAP) offered by the eNB-PHY to the eNB-MAC
@@ -59,6 +60,12 @@
* \param txMode the transmissionMode of the user
*/
virtual void SetTransmissionMode (uint16_t rnti, uint8_t txMode) = 0;
+
+ /**
+ * \param rnti the RNTI of the user
+ * \param txMode the SRS Configuration Index of the user
+ */
+ virtual void SetSrsConfigurationIndex (uint16_t rnti, uint16_t srsCi) = 0;
/**
*
@@ -68,10 +75,10 @@
virtual void SetCellId (uint16_t cellId) = 0;
/**
- * \brief Send SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+ * \brief Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
* \param msg the Ideal Control Message to send
*/
- virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+ virtual void SendLteControlMessage (Ptr<LteControlMessage> msg) = 0;
/**
* \brief Get the delay from MAC to Channel expressed in TTIs
@@ -110,16 +117,16 @@
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo) = 0;
/**
- * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+ * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
* \param msg the Ideal Control Message to receive
*/
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
/**
* \brief Returns to MAC level the UL-CQI evaluated
* \param ulcqi the UL-CQI (see FF MAC API 4.3.29)
*/
- virtual void UlCqiReport (UlCqi_s ulcqi) = 0;
+ virtual void UlCqiReport (FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi) = 0;
};
--- a/src/lte/model/lte-enb-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -30,10 +30,11 @@
#include "lte-enb-phy.h"
#include "lte-net-device.h"
#include "lte-spectrum-value-helper.h"
-#include "ideal-control-messages.h"
+#include "lte-control-messages.h"
#include "lte-enb-net-device.h"
#include "lte-enb-mac.h"
#include <ns3/lte-common.h>
+#include <ns3/lte-vendor-specific-parameters.h>
NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
@@ -55,9 +56,10 @@
virtual void SendMacPdu (Ptr<Packet> p);
virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
virtual void SetCellId (uint16_t cellId);
- virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
virtual uint8_t GetMacChTtiDelay ();
virtual void SetTransmissionMode (uint16_t rnti, uint8_t txMode);
+ virtual void SetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
private:
@@ -89,9 +91,9 @@
}
void
-EnbMemberLteEnbPhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+EnbMemberLteEnbPhySapProvider::SendLteControlMessage (Ptr<LteControlMessage> msg)
{
- m_phy->DoSendIdealControlMessage (msg);
+ m_phy->DoSendLteControlMessage (msg);
}
uint8_t
@@ -106,6 +108,12 @@
m_phy->DoSetTransmissionMode (rnti, txMode);
}
+void
+EnbMemberLteEnbPhySapProvider::SetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi)
+{
+ m_phy->DoSetSrsConfigurationIndex (rnti, srcCi);
+}
+
////////////////////////////////////////
// generic LteEnbPhy methods
@@ -125,7 +133,9 @@
LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
m_nrFrames (0),
- m_nrSubFrames (0)
+ m_nrSubFrames (0),
+ m_srsPeriodicity (0),
+ m_currentSrsOffset (0)
{
m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
@@ -175,6 +185,7 @@
{
NS_LOG_FUNCTION (this);
m_ueAttached.clear ();
+ m_srsUeOffset.clear ();
delete m_enbPhySapProvider;
LtePhy::DoDispose ();
}
@@ -237,14 +248,14 @@
{
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.push_back (pb);
- std::list<Ptr<IdealControlMessage> > l;
+ std::list<Ptr<LteControlMessage> > l;
m_controlMessagesQueue.push_back (l);
- std::list<UlDciIdealControlMessage> l1;
+ std::list<UlDciLteControlMessage> l1;
m_ulDciQueue.push_back (l1);
}
for (int i = 0; i < UL_PUSCH_TTIS_DELAY; i++)
{
- std::list<UlDciIdealControlMessage> l1;
+ std::list<UlDciLteControlMessage> l1;
m_ulDciQueue.push_back (l1);
}
}
@@ -340,7 +351,7 @@
void
-LteEnbPhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteEnbPhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
// queues the message (wait for MAC-PHY delay)
@@ -350,10 +361,23 @@
void
-LteEnbPhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteEnbPhy::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
+ NS_FATAL_ERROR ("Obsolete function");
NS_LOG_FUNCTION (this << msg);
- m_enbPhySapUser->ReceiveIdealControlMessage (msg);
+ m_enbPhySapUser->ReceiveLteControlMessage (msg);
+}
+
+void
+LteEnbPhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
+{
+ NS_LOG_FUNCTION (this);
+ std::list<Ptr<LteControlMessage> >::iterator it;
+ for (it = msgList.begin (); it != msgList.end(); it++)
+ {
+ m_enbPhySapUser->ReceiveLteControlMessage (*it);
+ }
+
}
@@ -376,55 +400,59 @@
NS_LOG_FUNCTION (this);
++m_nrSubFrames;
+ if (m_srsPeriodicity>0)
+ {
+ // might be 0 in case the eNB has no UEs attached
+ m_currentSrsOffset = (m_currentSrsOffset + 1) % m_srsPeriodicity;
+ }
NS_LOG_INFO ("-----sub frame " << m_nrSubFrames << "-----");
+
// update info on TB to be received
- std::list<UlDciIdealControlMessage> uldcilist = DequeueUlDci ();
- std::list<UlDciIdealControlMessage>::iterator dciIt = uldcilist.begin ();
+ std::list<UlDciLteControlMessage> uldcilist = DequeueUlDci ();
+ std::list<UlDciLteControlMessage>::iterator dciIt = uldcilist.begin ();
+ m_ulRntiRxed.clear ();
+ NS_LOG_DEBUG (this << " eNB Expected TBs " << uldcilist.size ());
for (dciIt = uldcilist.begin (); dciIt!=uldcilist.end (); dciIt++)
- {
- std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
- it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
-
- if (it2 == m_ueAttached.end ())
- {
- NS_LOG_ERROR ("UE not attached");
- }
- else
{
- // send info of TB to LteSpectrumPhy
- // translate to allocation map
- std::vector <int> rbMap;
- for (int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
- {
- rbMap.push_back (i);
- }
- m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/);
+ std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
+ it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
+
+ if (it2 == m_ueAttached.end ())
+ {
+ NS_LOG_ERROR ("UE not attached");
+ }
+ else
+ {
+ // send info of TB to LteSpectrumPhy
+ // translate to allocation map
+ std::vector <int> rbMap;
+ for (int i = (*dciIt).GetDci ().m_rbStart; i < (*dciIt).GetDci ().m_rbStart + (*dciIt).GetDci ().m_rbLen; i++)
+ {
+ rbMap.push_back (i);
+ }
+ m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/);
+ m_ulRntiRxed.push_back ((*dciIt).GetDci ().m_rnti);
+ }
}
- }
- // send the current burst of control messages
- std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
- std::vector <int> dlRb;
+ // process the current burst of control messages
+ std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
+ std::list<DlDciListElement_s> dlDci;
+ std::list<UlDciListElement_s> ulDci;
+// std::vector <int> dlRb;
+ m_dlDataRbMap.clear ();
if (ctrlMsg.size () > 0)
{
- std::list<Ptr<IdealControlMessage> >::iterator it;
+ std::list<Ptr<LteControlMessage> >::iterator it;
it = ctrlMsg.begin ();
while (it != ctrlMsg.end ())
{
- Ptr<IdealControlMessage> msg = (*it);
- if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+ Ptr<LteControlMessage> msg = (*it);
+ if (msg->GetMessageType () == LteControlMessage::DL_DCI)
{
- std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
- Ptr<DlDciIdealControlMessage> dci = DynamicCast<DlDciIdealControlMessage> (msg);
- it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
-
- if (it2 == m_ueAttached.end ())
- {
- NS_LOG_ERROR ("UE not attached");
- }
- else
- {
+ Ptr<DlDciLteControlMessage> dci = DynamicCast<DlDciLteControlMessage> (msg);
+ dlDci.push_back (dci->GetDci ());
// get the tx power spectral density according to DL-DCI(s)
// translate the DCI to Spectrum framework
uint32_t mask = 0x1;
@@ -434,44 +462,33 @@
{
for (int k = 0; k < GetRbgSize (); k++)
{
- dlRb.push_back ((i * GetRbgSize ()) + k);
+ m_dlDataRbMap.push_back ((i * GetRbgSize ()) + k);
//NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
}
}
mask = (mask << 1);
}
- (*it2).second->ReceiveIdealControlMessage (msg);
- }
}
- else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+ else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
{
- std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
- Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
-// QueueUlDci (*dci);
- it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
+ Ptr<UlDciLteControlMessage> dci = DynamicCast<UlDciLteControlMessage> (msg);
+ QueueUlDci (*dci);
+ ulDci.push_back (dci->GetDci ());
+ }
+ it++;
- if (it2 == m_ueAttached.end ())
- {
- NS_LOG_ERROR ("UE not attached");
- }
- else
- {
- (*it2).second->ReceiveIdealControlMessage (msg);
- QueueUlDci (*dci);
- }
- }
- ctrlMsg.pop_front ();
- it = ctrlMsg.begin ();
}
}
- // set the current tx power spectral density
- SetDownlinkSubChannels (dlRb);
- // send the current burts of packets
+
+ SendControlChannels (ctrlMsg);
+
+ // send data frame
Ptr<PacketBurst> pb = GetPacketBurst ();
if (pb)
{
- NS_LOG_LOGIC (this << " eNB start TX");
- m_downlinkSpectrumPhy->StartTx (pb);
+ Simulator::Schedule (Seconds (0.000214286), // ctrl frame fixed to 3 symbols
+ &LteEnbPhy::SendDataChannels,
+ this,pb);
}
// trigger the MAC
@@ -485,12 +502,42 @@
(*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
}
+
Simulator::Schedule (Seconds (GetTti ()),
&LteEnbPhy::EndSubFrame,
this);
}
+void
+LteEnbPhy::SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList)
+{
+ NS_LOG_FUNCTION (this << " eNB " << m_cellId << " start tx ctrl frame");
+ // set the current tx power spectral density (full bandwidth)
+ std::vector <int> dlRb;
+ for (uint8_t i = 0; i < m_dlBandwidth; i++)
+ {
+ dlRb.push_back (i);
+ }
+ SetDownlinkSubChannels (dlRb);
+ NS_LOG_LOGIC (this << " eNB start TX CTRL");
+ m_downlinkSpectrumPhy->StartTxDlCtrlFrame (ctrlMsgList);
+
+}
+
+void
+LteEnbPhy::SendDataChannels (Ptr<PacketBurst> pb)
+{
+ // set the current tx power spectral density
+ SetDownlinkSubChannels (m_dlDataRbMap);
+ // send the current burts of packets
+ NS_LOG_LOGIC (this << " eNB start TX DATA");
+ double dlDataFrame = 0.000785714; // 0.001 / 14 * 11 (fixed to 11 symbols)
+ std::list<Ptr<LteControlMessage> > ctrlMsgList;
+ ctrlMsgList.clear ();
+ m_downlinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsgList, dlDataFrame);
+}
+
void
LteEnbPhy::EndSubFrame (void)
@@ -516,20 +563,30 @@
void
-LteEnbPhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteEnbPhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
- m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr));
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi = CreateSrsCqiReport (sinr);
+ m_enbPhySapUser->UlCqiReport (ulcqi);
+}
+
+void
+LteEnbPhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this << sinr);
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi = CreatePuschCqiReport (sinr);
+ m_enbPhySapUser->UlCqiReport (ulcqi);
}
-UlCqi_s
-LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr)
+
+FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
+LteEnbPhy::CreatePuschCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this << sinr);
Values::const_iterator it;
- UlCqi_s ulcqi;
- ulcqi.m_type = UlCqi_s::PUSCH;
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi;
+ ulcqi.m_ulCqi.m_type = UlCqi_s::PUSCH;
int i = 0;
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
@@ -537,13 +594,43 @@
// NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
- ulcqi.m_sinr.push_back (sinrFp);
+ ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
i++;
}
return (ulcqi);
}
+
+FfMacSchedSapProvider::SchedUlCqiInfoReqParameters
+LteEnbPhy::CreateSrsCqiReport (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this << sinr);
+ Values::const_iterator it;
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters ulcqi;
+ ulcqi.m_ulCqi.m_type = UlCqi_s::SRS;
+ int i = 0;
+ for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
+ {
+ double sinrdb = 10 * log10 ((*it));
+ // NS_LOG_DEBUG ("ULCQI RB " << i << " value " << sinrdb);
+ // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
+ int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
+ ulcqi.m_ulCqi.m_sinr.push_back (sinrFp);
+ i++;
+ }
+ // Insert the user generated the srs as a vendor specific parameter
+ NS_LOG_DEBUG (this << " ENB RX UL-CQI of " << m_srsUeOffset.at (m_currentSrsOffset));
+ VendorSpecificListElement_s vsp;
+ vsp.m_type = SRS_CQI_RNTI_VSP;
+ vsp.m_length = sizeof(SrsCqiRntiVsp);
+ Ptr<SrsCqiRntiVsp> rnti = Create <SrsCqiRntiVsp> (m_srsUeOffset.at (m_currentSrsOffset));
+ vsp.m_value = rnti;
+ ulcqi.m_vendorSpecificList.push_back (vsp);
+ return (ulcqi);
+
+}
+
void
LteEnbPhy::DoSetTransmissionMode (uint16_t rnti, uint8_t txMode)
{
@@ -552,33 +639,61 @@
}
void
-LteEnbPhy::QueueUlDci (UlDciIdealControlMessage m)
+LteEnbPhy::QueueUlDci (UlDciLteControlMessage m)
{
NS_LOG_FUNCTION (this);
m_ulDciQueue.at (UL_PUSCH_TTIS_DELAY - 1).push_back (m);
}
-std::list<UlDciIdealControlMessage>
+std::list<UlDciLteControlMessage>
LteEnbPhy::DequeueUlDci (void)
{
NS_LOG_FUNCTION (this);
if (m_ulDciQueue.at (0).size ()>0)
{
- std::list<UlDciIdealControlMessage> ret = m_ulDciQueue.at (0);
+ std::list<UlDciLteControlMessage> ret = m_ulDciQueue.at (0);
m_ulDciQueue.erase (m_ulDciQueue.begin ());
- std::list<UlDciIdealControlMessage> l;
+ std::list<UlDciLteControlMessage> l;
m_ulDciQueue.push_back (l);
return (ret);
}
else
{
m_ulDciQueue.erase (m_ulDciQueue.begin ());
- std::list<UlDciIdealControlMessage> l;
+ std::list<UlDciLteControlMessage> l;
m_ulDciQueue.push_back (l);
- std::list<UlDciIdealControlMessage> emptylist;
+ std::list<UlDciLteControlMessage> emptylist;
return (emptylist);
}
}
+void
+LteEnbPhy::DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi)
+{
+ NS_LOG_FUNCTION (this);
+ uint16_t p = GetSrsPeriodicity (srcCi);
+ if (p!=m_srsPeriodicity)
+ {
+ // resize the array of offset -> re-initialize variables
+ m_srsUeOffset.clear ();
+ m_srsUeOffset.resize (p, 0);
+ m_srsPeriodicity = p;
+ m_currentSrsOffset = p - 1; // for starting from 0 next subframe
+ }
+
+ NS_LOG_DEBUG (this << " ENB SRS P " << m_srsPeriodicity << " RNTI " << rnti << " offset " << GetSrsSubframeOffset (srcCi) << " CI " << srcCi);
+ std::map <uint16_t,uint16_t>::iterator it = m_srsCounter.find (rnti);
+ if (it != m_srsCounter.end ())
+ {
+ (*it).second = GetSrsSubframeOffset (srcCi) + 1;
+ }
+ else
+ {
+ m_srsCounter.insert (std::pair<uint16_t, uint16_t> (rnti, GetSrsSubframeOffset (srcCi) + 1));
+ }
+ m_srsUeOffset.at (GetSrsSubframeOffset (srcCi)) = rnti;
+
+}
+
};
--- a/src/lte/model/lte-enb-phy.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-phy.h Thu Jul 19 13:02:41 2012 +0200
@@ -112,6 +112,10 @@
*/
virtual void DoSendMacPdu (Ptr<Packet> p);
+ virtual void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
+
+ virtual void DoSetSrsConfigurationIndex (uint16_t rnti, uint16_t srcCi);
+
virtual uint8_t DoGetMacChTtiDelay ();
@@ -130,41 +134,53 @@
void CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPhy> ue);
/**
- * \brief Send the control message
- * \param msg the message to send
- */
- // virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg); // legacy
- /**
* \brief Receive the control message
* \param msg the received message
*/
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
/**
* \brief Create the UL CQI feedback from SINR values perceived at
- * the physical layer with the signal received from eNB
+ * the physical layer with the PUSCH signal received from eNB
* \param sinr SINR values vector
*/
- UlCqi_s CreateUlCqiReport (const SpectrumValue& sinr);
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreatePuschCqiReport (const SpectrumValue& sinr);
+
+ /**
+ * \brief Create the UL CQI feedback from SINR values perceived at
+ * the physical layer with the SRS signal received from eNB
+ * \param sinr SINR values vector
+ */
+ FfMacSchedSapProvider::SchedUlCqiInfoReqParameters CreateSrsCqiReport (const SpectrumValue& sinr);
- void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
+ void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
bool AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy);
bool DeleteUePhy (uint16_t rnti);
- virtual void DoSetTransmissionMode (uint16_t rnti, uint8_t txMode);
+ /**
+ * \brief Send the PDCCH and PCFICH in the first 3 symbols
+ * \param ctrlMsgList the list of control messages of PDCCH
+ */
+ void SendControlChannels (std::list<Ptr<LteControlMessage> > ctrlMsgList);
+
+ /**
+ * \brief Send the PDSCH
+ * \param pb the PacketBurst to be sent
+ */
+ void SendDataChannels (Ptr<PacketBurst> pb);
/**
* \param m the UL-CQI to be queued
*/
- void QueueUlDci (UlDciIdealControlMessage m);
+ void QueueUlDci (UlDciLteControlMessage m);
/**
* \returns the list of UL-CQI to be processed
*/
- std::list<UlDciIdealControlMessage> DequeueUlDci (void);
+ std::list<UlDciLteControlMessage> DequeueUlDci (void);
/**
@@ -188,22 +204,37 @@
* \brief PhySpectrum received a new PHY-PDU
*/
void PhyPduReceived (Ptr<Packet> p);
+
+ /**
+ * \brief PhySpectrum received a new list of LteControlMessage
+ */
+ virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
// inherited from LtePhy
- virtual void GenerateCqiReport (const SpectrumValue& sinr);
+ virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+ virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
private:
std::map <uint16_t, Ptr<LteUePhy> > m_ueAttached;
- std::vector< std::list<UlDciIdealControlMessage> > m_ulDciQueue; // for storing info on future receptions
+ std::vector <int> m_dlDataRbMap;
+
+ std::vector< std::list<UlDciLteControlMessage> > m_ulDciQueue; // for storing info on future receptions
LteEnbPhySapProvider* m_enbPhySapProvider;
LteEnbPhySapUser* m_enbPhySapUser;
+
+ std::vector <uint16_t> m_ulRntiRxed;
uint32_t m_nrFrames;
uint32_t m_nrSubFrames;
+ uint16_t m_srsPeriodicity;
+ std::map <uint16_t,uint16_t> m_srsCounter;
+ std::vector <uint16_t> m_srsUeOffset;
+ uint16_t m_currentSrsOffset;
+
};
--- a/src/lte/model/lte-enb-rrc.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-rrc.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,7 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
- * Marco Miozzo <mmiozzo@cttc.es>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es>
+ * add transmission Mode and SRS related functionalities
*/
#include <ns3/fatal-error.h>
@@ -35,6 +36,8 @@
#include "ns3/object-map.h"
#include <ns3/ff-mac-csched-sap.h>
+#include <ns3/simulator.h>
+
// WILD HACK for UE-RRC direct communications
#include <ns3/node-list.h>
#include <ns3/node.h>
@@ -42,6 +45,7 @@
#include <ns3/lte-ue-rrc.h>
+
NS_LOG_COMPONENT_DEFINE ("LteEnbRrc");
namespace ns3 {
@@ -124,12 +128,24 @@
: m_lastAllocatedId (0)
{
m_imsi = 0;
+ m_srsConfigurationIndex = 0;
+ m_transmissionMode = 0;
}
UeInfo::UeInfo (uint64_t imsi)
: m_lastAllocatedId (0)
{
m_imsi = imsi;
+ m_srsConfigurationIndex = 0;
+ m_transmissionMode = 0;
+}
+
+UeInfo::UeInfo (uint64_t imsi, uint16_t srsConfIndex)
+: m_lastAllocatedId (0)
+{
+ m_imsi = imsi;
+ m_srsConfigurationIndex = srsConfIndex;
+ m_transmissionMode = 0;
}
@@ -158,6 +174,30 @@
return m_imsi;
}
+uint16_t
+UeInfo::GetSrsConfigurationIndex (void)
+{
+ return m_srsConfigurationIndex;
+}
+
+uint8_t
+UeInfo::GetTransmissionMode (void)
+{
+ return m_transmissionMode;
+}
+
+void
+UeInfo::SetSrsConfigurationIndex (uint16_t srsConfIndex)
+{
+ m_srsConfigurationIndex = srsConfIndex;
+}
+
+void
+UeInfo::SetTransmissionMode (uint8_t txMode)
+{
+ m_transmissionMode = txMode;
+}
+
uint8_t
UeInfo::AddRadioBearer (Ptr<LteRadioBearerInfo> rbi)
{
@@ -213,7 +253,10 @@
m_ffMacSchedSapProvider (0),
m_macSapProvider (0),
m_configured (false),
- m_lastAllocatedRnti (0)
+ m_lastAllocatedRnti (0),
+ m_srsCurrentPeriodicityId (0),
+ m_lastAllocatedConfigurationIndex (0),
+ m_reconfigureUes (false)
{
NS_LOG_FUNCTION (this);
m_cmacSapUser = new EnbRrcMemberLteEnbCmacSapUser (this);
@@ -388,12 +431,6 @@
lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ());
-
- // Transmission mode settings
- LteUeConfig_t ueConfig;
- ueConfig.m_rnti = rnti;
- ueConfig.m_transmissionMode = m_defaultTransmissionMode;
- DoRrcConfigurationUpdateInd (ueConfig);
return lcid;
}
@@ -461,6 +498,17 @@
// management of multiple UE info instances
// /////////////////////////////////////////
+// from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+#define SRS_ENTRIES 9
+uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
+uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+
+void
+LteEnbRrc::SetCellId (uint16_t cellId)
+{
+ m_cellId = cellId;
+}
uint16_t
LteEnbRrc::CreateUeInfo (uint64_t imsi)
@@ -473,14 +521,138 @@
if (m_ueMap.find (rnti) == m_ueMap.end ())
{
m_lastAllocatedRnti = rnti;
- m_ueMap.insert (std::pair<uint16_t, Ptr<UeInfo> > (rnti, CreateObject<UeInfo> (imsi)));
+ Ptr<UeInfo> ueInfo = CreateObject<UeInfo> (imsi, GetNewSrsConfigurationIndex ());
+ m_ueMap.insert (std::pair<uint16_t, Ptr<UeInfo> > (rnti, ueInfo));
+ NS_LOG_DEBUG (this << " New UE RNTI " << rnti << " cellId " << m_cellId << " srs CI " << ueInfo->GetSrsConfigurationIndex ());
return rnti;
}
}
}
+
return 0;
}
+uint16_t
+LteEnbRrc::GetNewSrsConfigurationIndex ()
+{
+ NS_LOG_FUNCTION (this << m_ueSrsConfigurationIndexSet.size ());
+ // SRS
+ if (m_srsCurrentPeriodicityId==0)
+ {
+ // no UEs -> init
+ m_ueSrsConfigurationIndexSet.insert (0);
+ m_lastAllocatedConfigurationIndex = 0;
+ m_srsCurrentPeriodicityId++;
+
+ return 0;
+ }
+ NS_ASSERT (m_srsCurrentPeriodicityId < SRS_ENTRIES);
+ NS_LOG_DEBUG (this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set " << m_ueSrsConfigurationIndexSet.size ());
+ if (m_ueSrsConfigurationIndexSet.size () == g_srsPeriodicity[m_srsCurrentPeriodicityId])
+ {
+// NS_LOG_DEBUG (this << " SRS reconfigure CIs " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " to " << g_srsPeriodicity[m_srsCurrentPeriodicityId+1] << " at " << Simulator::Now ());
+ // increase the current periocity for having enough CIs
+ m_ueSrsConfigurationIndexSet.clear ();
+ m_srsCurrentPeriodicityId++;
+ NS_ASSERT (m_srsCurrentPeriodicityId < SRS_ENTRIES);
+ // update all the UE's CI
+ uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
+ std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+ for (it = m_ueMap.begin (); it != m_ueMap.end (); it++)
+ {
+ (*it).second->SetSrsConfigurationIndex (srcCi);
+ m_ueSrsConfigurationIndexSet.insert (srcCi);
+ m_lastAllocatedConfigurationIndex = srcCi;
+ srcCi++;
+ // send update to peer RRC
+ LteUeConfig_t ueConfig;
+ ueConfig.m_rnti = (*it).first;
+ ueConfig.m_transmissionMode = (*it).second->GetTransmissionMode ();
+ ueConfig.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+ ueConfig.m_reconfigureFlag = false;
+ NS_LOG_DEBUG (this << "\t rnti "<<ueConfig.m_rnti<< " CI " << ueConfig.m_srsConfigurationIndex);
+ SendUeConfigurationUpdate (ueConfig);
+ }
+ m_ueSrsConfigurationIndexSet.insert (m_lastAllocatedConfigurationIndex + 1);
+ m_lastAllocatedConfigurationIndex++;
+ }
+ else
+ {
+ // find a CI from the available ones
+ std::set<uint16_t>::reverse_iterator rit = m_ueSrsConfigurationIndexSet.rbegin ();
+ NS_LOG_DEBUG (this << " lower bound " << (*rit) << " of " << g_srsCiHigh[m_srsCurrentPeriodicityId]);
+ if ((*rit) <= g_srsCiHigh[m_srsCurrentPeriodicityId])
+ {
+ // got it from the upper bound
+ m_lastAllocatedConfigurationIndex = (*rit) + 1;
+ m_ueSrsConfigurationIndexSet.insert (m_lastAllocatedConfigurationIndex);
+ }
+ else
+ {
+ // look for released ones
+ for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId]; srcCi < g_srsCiHigh[m_srsCurrentPeriodicityId]; srcCi++)
+ {
+ std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srcCi);
+ if (it==m_ueSrsConfigurationIndexSet.end ())
+ {
+ m_lastAllocatedConfigurationIndex = srcCi;
+ m_ueSrsConfigurationIndexSet.insert (srcCi);
+ break;
+ }
+ }
+ }
+ }
+ return m_lastAllocatedConfigurationIndex;
+
+}
+
+
+void
+LteEnbRrc::RemoveSrsConfigurationIndex (uint16_t srcCi)
+{
+ NS_LOG_FUNCTION (this << srcCi);
+ std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srcCi);
+ NS_ASSERT_MSG (it != m_ueSrsConfigurationIndexSet.end (), "request to remove unkwown SRS CI " << srcCi);
+ m_ueSrsConfigurationIndexSet.erase (it);
+ NS_ASSERT (m_srsCurrentPeriodicityId > 1);
+ if (m_ueSrsConfigurationIndexSet.size () < g_srsPeriodicity[m_srsCurrentPeriodicityId - 1])
+ {
+ // reduce the periodicity
+ m_ueSrsConfigurationIndexSet.clear ();
+ m_srsCurrentPeriodicityId--;
+ if (m_srsCurrentPeriodicityId==0)
+ {
+ // no active users : renitialize structures
+ m_lastAllocatedConfigurationIndex = 0;
+ }
+ else
+ {
+ // update all the UE's CI
+ uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
+ std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+ for (it = m_ueMap.begin (); it != m_ueMap.end (); it++)
+ {
+ (*it).second->SetSrsConfigurationIndex (srcCi);
+ m_ueSrsConfigurationIndexSet.insert (srcCi);
+ m_lastAllocatedConfigurationIndex = srcCi;
+ srcCi++;
+ // send update to peer RRC
+ LteUeConfig_t ueConfig;
+ ueConfig.m_rnti = (*it).first;
+ ueConfig.m_transmissionMode = (*it).second->GetTransmissionMode ();
+ ueConfig.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+ ueConfig.m_reconfigureFlag = false;
+ NS_LOG_DEBUG (this << "\t rnti "<<ueConfig.m_rnti<< " CI " << ueConfig.m_srsConfigurationIndex);
+ if (Simulator::Now ()!=Seconds(0))
+ {
+ // avoid multiple reconfiguration during initialization
+ SendUeConfigurationUpdate (ueConfig);
+ }
+ }
+ }
+ }
+}
+
Ptr<UeInfo>
LteEnbRrc::GetUeInfo (uint16_t rnti)
{
@@ -497,7 +669,9 @@
NS_LOG_FUNCTION (this << (uint32_t) rnti);
std::map <uint16_t, Ptr<UeInfo> >::iterator it = m_ueMap.find (rnti);
NS_ASSERT_MSG (it != m_ueMap.end (), "request to remove UE info with unknown rnti " << rnti);
+ RemoveSrsConfigurationIndex ((*it).second->GetSrsConfigurationIndex ());
m_ueMap.erase (it);
+ // remove SRS configuration index
}
@@ -505,10 +679,45 @@
LteEnbRrc::DoRrcConfigurationUpdateInd (LteUeConfig_t params)
{
NS_LOG_FUNCTION (this);
- // up tp now only for TxMode change
- // update the peer UE-RRC on the change
+ // at this stage used only by the scheduler for updating txMode
+ // retrieve UE info
+ std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+ it = m_ueMap.find (params.m_rnti);
+ NS_ASSERT_MSG (it!=m_ueMap.end (), "Unable to find UeInfo");
+ params.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+ // update Tx Mode info
+ (*it).second->SetTransmissionMode (params.m_transmissionMode);
+ params.m_reconfigureFlag = true;
+ // answer to MAC (and scheduler) and forward info to UEs
+ SendUeConfigurationUpdate (params);
+}
+
+void
+LteEnbRrc::ConfigureNewUe (uint16_t rnti)
+{
+ NS_LOG_FUNCTION (this);
+ // retrieve UE info
+ std::map<uint16_t, Ptr<UeInfo> >::iterator it;
+ it = m_ueMap.find (rnti);
+ NS_ASSERT_MSG (it!=m_ueMap.end (), "Unable to find UeInfo");
+ LteUeConfig_t params;
+ params.m_rnti = rnti;
+ params.m_srsConfigurationIndex = (*it).second->GetSrsConfigurationIndex ();
+ params.m_transmissionMode = (*it).second->GetTransmissionMode ();
+ params.m_reconfigureFlag = false;
+ // answer to MAC (and scheduler) and forward info to UEs
+ SendUeConfigurationUpdate (params);
+}
+
+void
+LteEnbRrc::SendUeConfigurationUpdate (LteUeConfig_t params)
+{
+ NS_LOG_FUNCTION (this);
+ // send LteUeConfig_t to MAC layer and peer RRCs
+ m_cmacSapProvider->UeUpdateConfigurationReq (params);
NodeList::Iterator listEnd = NodeList::End ();
bool done = false;
+ params.m_reconfigureFlag = false;
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
{
Ptr<Node> node = *i;
@@ -523,7 +732,7 @@
else
{
Ptr<LteUeRrc> ueRrc = uedev->GetRrc ();
- if (ueRrc->GetRnti () == params.m_rnti)
+ if ((ueRrc->GetRnti () == params.m_rnti)&&(ueRrc->GetCellId () == m_cellId))
{
ueRrc->DoRrcConfigurationUpdateInd (params);
done = true;
@@ -536,12 +745,6 @@
}
}
NS_ASSERT_MSG (done , " Unable to find peer UE-RRC, RNTI " << params.m_rnti);
- // answer to MAC (and scheduler)
- FfMacCschedSapProvider::CschedUeConfigReqParameters req;
- req.m_rnti = params.m_rnti;
- req.m_transmissionMode = params.m_transmissionMode;
- m_cmacSapProvider->RrcUpdateConfigurationReq (req);
-
}
--- a/src/lte/model/lte-enb-rrc.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-enb-rrc.h Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es>
+ * add transmission Mode and SRS related functionalities
*/
#ifndef LTE_ENB_RRC_H
@@ -28,6 +30,7 @@
#include <ns3/lte-pdcp-sap.h>
#include <map>
+#include <set>
namespace ns3 {
@@ -74,16 +77,23 @@
UeInfo (void);
UeInfo (uint64_t imsi);
+ UeInfo (uint64_t imsi, uint16_t srsConfIndex);
virtual ~UeInfo (void);
static TypeId GetTypeId (void);
uint64_t GetImsi (void);
+ uint16_t GetSrsConfigurationIndex (void);
+ uint8_t GetTransmissionMode (void);
+ void SetSrsConfigurationIndex (uint16_t srsConfIndex);
+ void SetTransmissionMode (uint8_t txMode);
private:
std::map <uint8_t, Ptr<LteRadioBearerInfo> > m_rbMap;
uint8_t m_lastAllocatedId;
uint64_t m_imsi;
+ uint16_t m_srsConfigurationIndex;
+ uint8_t m_transmissionMode;
};
@@ -166,6 +176,8 @@
* \return the C-RNTI of the newly added UE
*/
uint16_t AddUe (uint64_t imsi);
+
+ void SetCellId (uint16_t m_cellId);
/**
* remove a UE from the cell
@@ -218,11 +230,19 @@
*/
void SetForwardUpCallback (Callback <void, Ptr<Packet> > cb);
+ /**
+ * Configure the UE peer RRC with all the correspondet info
+ *
+ * \param rnti the RNTI of the UE to be configured
+ */
+ void ConfigureNewUe (uint16_t rnti);
+
private:
void DoReceiveRrcPdu (LtePdcpSapUser::ReceiveRrcPduParameters params);
void DoRrcConfigurationUpdateInd (LteUeConfig_t params);
+ void SendUeConfigurationUpdate (LteUeConfig_t params);
void DoNotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success);
LtePdcpSapProvider* GetLtePdcpSapProvider (uint16_t rnti, uint8_t lcid);
@@ -231,6 +251,8 @@
uint16_t CreateUeInfo (uint64_t imsi);
Ptr<UeInfo> GetUeInfo (uint16_t rnti);
void RemoveUeInfo (uint16_t rnti);
+ uint16_t GetNewSrsConfigurationIndex (void);
+ void RemoveSrsConfigurationIndex (uint16_t srcCi);
Callback <void, Ptr<Packet> > m_forwardUpCallback;
@@ -244,9 +266,17 @@
bool m_configured;
uint16_t m_lastAllocatedRnti;
- std::map<uint16_t, Ptr<UeInfo> > m_ueMap;
+ std::map<uint16_t, Ptr<UeInfo> > m_ueMap;
uint8_t m_defaultTransmissionMode;
+
+ uint16_t m_cellId;
+
+ // SRS related attributes
+ uint16_t m_srsCurrentPeriodicityId;
+ std::set<uint16_t> m_ueSrsConfigurationIndexSet;
+ uint16_t m_lastAllocatedConfigurationIndex;
+ bool m_reconfigureUes;
};
--- a/src/lte/model/lte-interference.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-interference.cc Thu Jul 19 13:02:41 2012 +0200
@@ -81,7 +81,7 @@
}
else
{
- NS_LOG_LOGIC ("additional signal");
+ NS_LOG_LOGIC ("additional signal" << *m_rxSignal);
// receiving multiple simultaneous signals, make sure they are synchronized
NS_ASSERT (m_lastChangeTime == Now ());
// make sure they use orthogonal resource blocks
--- a/src/lte/model/lte-mi-error-model.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-mi-error-model.cc Thu Jul 19 13:02:41 2012 +0200
@@ -46,7 +46,28 @@
NS_LOG_COMPONENT_DEFINE ("LteMiErrorModel");
namespace ns3 {
+
+ // PCFICH-PDCCH Error model based on 3GPP R4-081920 "LTE PDCCH/PCFICH
+ // Demodulation Performance Results with Implementation Margin"
+ double PdcchPcfichBlerCurveXaxis[PDCCH_PCFICH_CURVE_SIZE] = {
+ -10,-9.8,-9.6, -9.4, -9.2, -9.0, -8.8, -8.6, -8.4, -8.2, -8.0,
+ -7.8, -7.6, -7.4, -7.2, -7.0, -6.8, -6.6, -6.4, -6.2, -6.0,
+ -5.8, -5.6, -5.4, -5.2, -5.0, -4.8, -4.6, -4.4, -4.2, -4.0,
+ -3.8, -3.6, -3.4, -3.2, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0,
+ -1.8, -1.6, -1.4, -1.2, -1.0
+ };
+
+ double PdcchPcfichBlerCurveYaxis[PDCCH_PCFICH_CURVE_SIZE] = {
+ 0.922602, 0.871559, 0.82334, 0.777789, 0.734758, 0.694107, 0.655706,
+ 0.619429, 0.585159, 0.552785, 0.520927, 0.479229, 0.440869, 0.405579,
+ 0.373114, 0.343104, 0.309947,0.279994, 0.252936, 0.228492, 0.206048,
+ 0.181449, 0.159787, 0.140711, 0.123912, 0.109119, 0.0916184, 0.0769244,
+ 0.0645871, 0.0542285, 0.0454971, 0.037584, 0.0310472, 0.0256473,
+ 0.0211866, 0.0175023, 0.0144636, 0.0119524, 0.00987724, 0.00816236,
+ 0.00673821, 0.00532283, 0.00420476, 0.00332154, 0.00262385, 0.0020727
+
+ };
int TbsIndex[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, -1, -1};
@@ -470,6 +491,93 @@
return errorRate;
}
+
+double
+LteMiErrorModel::GetPcfichPdcchError (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (sinr);
+ double MI;
+ double MIsum = 0.0;
+ SpectrumValue sinrCopy = sinr;
+ Values::iterator sinrIt = sinrCopy.ValuesBegin ();
+ uint16_t rb = 0;
+ NS_ASSERT (sinrIt!=sinrCopy.ValuesEnd ());
+ while (sinrIt!=sinrCopy.ValuesEnd ())
+ {
+ double sinrLin = *sinrIt;
+ int tr = 0;
+ while ((tr<MI_MAP_QPSK_SIZE)&&(MI_map_qpsk_axis[tr] < sinrLin))
+ {
+ tr++;
+ }
+ if (sinrLin > MI_map_qpsk_axis[MI_MAP_QPSK_SIZE-1])
+ {
+ MI = 1;
+ }
+ else
+ {
+ NS_ASSERT_MSG (tr<MI_MAP_QPSK_SIZE, "MI map out of data");
+ MI = MI_map_qpsk[tr];
+ }
+// NS_LOG_DEBUG (" RB " << rb << " SINR " << 10*log10 (sinrLin) << " MI " << MI);
+ MIsum += MI;
+ sinrIt++;
+ rb++;
+ }
+ MI = MIsum / rb;
+ // return to the effective SINR value
+ int j = 0;
+ double esinr = 0.0;
+ while ((j<MI_MAP_QPSK_SIZE)&&(MI_map_qpsk[j] < MI))
+ {
+ j++;
+ }
+ if (MI > MI_map_qpsk[MI_MAP_QPSK_SIZE-1])
+ {
+ esinr = MI_map_qpsk_axis[MI_MAP_QPSK_SIZE-1];
+ }
+ else
+ {
+ NS_ASSERT_MSG (j<MI_MAP_QPSK_SIZE, "MI map out of data");
+ // take the closest value (when possible)
+ if (j>0)
+ {
+ if ((MI_map_qpsk[j]-MI)<(MI-MI_map_qpsk[j-1]))
+ {
+ esinr = MI_map_qpsk_axis[j];
+ }
+ else
+ {
+ esinr = MI_map_qpsk_axis[j-1];
+ }
+ }
+ else
+ {
+ esinr = MI_map_qpsk_axis[0];
+ }
+ }
+
+ double esirnDb = 10*log10 (esinr);
+// NS_LOG_DEBUG ("Effective SINR " << esirnDb << " max " << 10*log10 (MI_map_qpsk [MI_MAP_QPSK_SIZE-1]));
+ uint16_t i = 0;
+ double errorRate = 0.0;
+ while ((i<PDCCH_PCFICH_CURVE_SIZE)&&(PdcchPcfichBlerCurveXaxis[i] < esirnDb))
+ {
+ i++;
+ }
+ if (esirnDb > PdcchPcfichBlerCurveXaxis[PDCCH_PCFICH_CURVE_SIZE-1])
+ {
+ errorRate = 0.0;
+ }
+ else
+ {
+ NS_ASSERT_MSG (i<PDCCH_PCFICH_CURVE_SIZE, "PDCCH-PCFICH map out of data");
+ errorRate = PdcchPcfichBlerCurveYaxis[i];
+ }
+
+ return (errorRate);
+}
+
} // namespace ns3
--- a/src/lte/model/lte-mi-error-model.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-mi-error-model.h Thu Jul 19 13:02:41 2012 +0200
@@ -44,6 +44,7 @@
namespace ns3 {
+ const uint16_t PDCCH_PCFICH_CURVE_SIZE = 46;
const uint16_t MI_MAP_QPSK_SIZE = 766;
const uint16_t MI_MAP_16QAM_SIZE = 843;
const uint16_t MI_MAP_64QAM_SIZE = 725;
@@ -62,7 +63,7 @@
* \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
+ * \param mcs the MCS of the TB
* \return the mmib
*/
static double Mib (const SpectrumValue& sinr, const std::vector<int>& map, uint8_t mcs);
@@ -71,16 +72,26 @@
* \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
+ * \return the code block error rate
*/
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
+ * \param sinr the perceived sinrs in the whole bandwidth
+ * \param map the actives RBs for the TB
+ * \param size the size in bytes of the TB
+ * \param mcs the MCS of the TB
+ * \return the TB error rate
*/
static double GetTbError (const SpectrumValue& sinr, const std::vector<int>& map, uint16_t size, uint8_t mcs);
+
+ /**
+ * \brief run the error-model algorithm for the specified PCFICH+PDCCH channels
+ * \param sinr the perceived sinrs in the whole bandwidth
+ * \return the decodification error of the PCFICH+PDCCH channels
+ */
+ static double GetPcfichPdcchError (const SpectrumValue& sinr);
//private:
--- a/src/lte/model/lte-net-device.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-net-device.h Thu Jul 19 13:02:41 2012 +0200
@@ -28,7 +28,7 @@
#include <ns3/traced-callback.h>
#include <ns3/nstime.h>
#include <ns3/lte-phy.h>
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
namespace ns3 {
--- a/src/lte/model/lte-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -35,6 +35,7 @@
NS_OBJECT_ENSURE_REGISTERED (LtePhy);
+
LtePhy::LtePhy ()
{
NS_LOG_FUNCTION (this);
@@ -48,7 +49,8 @@
m_ulBandwidth (0),
m_dlBandwidth (0),
m_rbgSize (0),
- m_macChTtiDelay (0)
+ m_macChTtiDelay (0),
+ m_cellId (0)
{
NS_LOG_FUNCTION (this);
}
@@ -209,6 +211,43 @@
}
}
+
+uint16_t
+LtePhy::GetSrsPeriodicity (uint16_t srcCi) const
+{
+ // from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+ uint16_t SrsPeriodicity[9] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
+ uint16_t SrsCiLow[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+ uint16_t SrsCiHigh[9] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+ uint8_t i;
+ for (i = 8; i > 0; i --)
+ {
+ if ((srcCi>=SrsCiLow[i])&&(srcCi<=SrsCiHigh[i]))
+ {
+ break;
+ }
+ }
+ return SrsPeriodicity[i];
+}
+
+uint16_t
+LtePhy::GetSrsSubframeOffset (uint16_t srcCi) const
+{
+ // from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
+ uint16_t SrsSubframeOffset[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+ uint16_t SrsCiLow[9] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
+ uint16_t SrsCiHigh[9] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
+ uint8_t i;
+ for (i = 8; i > 0; i --)
+ {
+ if ((srcCi>=SrsCiLow[i])&&(srcCi<=SrsCiHigh[i]))
+ {
+ break;
+ }
+ }
+ return (srcCi - SrsSubframeOffset[i]);
+}
+
void
LtePhy::DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn)
{
@@ -248,30 +287,30 @@
void
-LtePhy::SetControlMessages (Ptr<IdealControlMessage> m)
+LtePhy::SetControlMessages (Ptr<LteControlMessage> m)
{
// In uplink the queue of control messages and packet are of different sizes
// for avoiding TTI cancellation due to synchronization of subframe triggers
m_controlMessagesQueue.at (m_controlMessagesQueue.size () - 1).push_back (m);
}
-std::list<Ptr<IdealControlMessage> >
+std::list<Ptr<LteControlMessage> >
LtePhy::GetControlMessages (void)
{
if (m_controlMessagesQueue.at (0).size () > 0)
{
- std::list<Ptr<IdealControlMessage> > ret = m_controlMessagesQueue.at (0);
+ std::list<Ptr<LteControlMessage> > ret = m_controlMessagesQueue.at (0);
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
- std::list<Ptr<IdealControlMessage> > newlist;
+ std::list<Ptr<LteControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
return (ret);
}
else
{
m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ());
- std::list<Ptr<IdealControlMessage> > newlist;
+ std::list<Ptr<LteControlMessage> > newlist;
m_controlMessagesQueue.push_back (newlist);
- std::list<Ptr<IdealControlMessage> > emptylist;
+ std::list<Ptr<LteControlMessage> > emptylist;
return (emptylist);
}
}
--- a/src/lte/model/lte-phy.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-phy.h Thu Jul 19 13:02:41 2012 +0200
@@ -39,7 +39,9 @@
class PacketBurst;
class LteNetDevice;
-class IdealControlMessage;
+class LteControlMessage;
+
+
/**
* \ingroup lte
@@ -154,10 +156,10 @@
void DoDispose ();
/**
- * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+ * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
* \param msg the Ideal Control Message to receive
*/
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+// virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
/**
@@ -193,6 +195,19 @@
* \returns the RB gruop size according to the bandwidth
*/
uint8_t GetRbgSize (void) const;
+
+
+ /**
+ * \returns the SRS periodicity (see Table 8.2-1 of 36.213)
+ * \param srcCi the SRS Configuration Index
+ */
+ uint16_t GetSrsPeriodicity (uint16_t srcCi) const;
+
+ /**
+ * \returns the SRS Subframe offset (see Table 8.2-1 of 36.213)
+ * \param srcCi the SRS Configuration Index
+ */
+ uint16_t GetSrsSubframeOffset (uint16_t srcCi) const;
/**
@@ -208,20 +223,28 @@
/**
* \param m the control message to be sent
*/
- void SetControlMessages (Ptr<IdealControlMessage> m);
+ void SetControlMessages (Ptr<LteControlMessage> m);
/**
* \returns the list of control messages to be sent
*/
- std::list<Ptr<IdealControlMessage> > GetControlMessages (void);
+ std::list<Ptr<LteControlMessage> > GetControlMessages (void);
/**
- * generate a CQI report based on the given SINR
+ * generate a CQI report based on the given SINR of Ctrl frame
*
* \param sinr the SINR vs frequency measured by the device
*/
- virtual void GenerateCqiReport (const SpectrumValue& sinr) = 0;
+ virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr) = 0;
+
+ /**
+ * generate a CQI report based on the given SINR of Data frame
+ * (used for PUSCH CQIs)
+ *
+ * \param sinr the SINR vs frequency measured by the device
+ */
+ virtual void GenerateDataCqiReport (const SpectrumValue& sinr) = 0;
@@ -246,7 +269,7 @@
uint16_t m_ulEarfcn;
std::vector< Ptr<PacketBurst> > m_packetBurstQueue;
- std::vector< std::list<Ptr<IdealControlMessage> > > m_controlMessagesQueue;
+ std::vector< std::list<Ptr<LteControlMessage> > > m_controlMessagesQueue;
uint8_t m_macChTtiDelay; // delay between MAC and channel layer in terms of TTIs
uint16_t m_cellId;
--- a/src/lte/model/lte-sinr-chunk-processor.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-sinr-chunk-processor.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by : Marco Miozzo <mmiozzo@cttc.es>
+ * (move from CQI to Ctrl and Data SINR Chunk processors
*/
@@ -33,22 +35,32 @@
}
-LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor (Ptr<LtePhy> p)
- : m_phy (p)
+LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor (Ptr<LtePhy> p)
+ : m_phy (p),
+ m_spectrumPhy (0)
{
NS_LOG_FUNCTION (this << p);
NS_ASSERT (m_phy);
}
+LteCtrlSinrChunkProcessor::LteCtrlSinrChunkProcessor (Ptr<LtePhy> p, Ptr<LteSpectrumPhy> s)
+: m_phy (p),
+ m_spectrumPhy (s)
+{
+ NS_LOG_FUNCTION (this << p);
+ NS_ASSERT (m_phy);
+ NS_ASSERT (m_spectrumPhy);
+}
-LteCqiSinrChunkProcessor::~LteCqiSinrChunkProcessor ()
+
+LteCtrlSinrChunkProcessor::~LteCtrlSinrChunkProcessor ()
{
NS_LOG_FUNCTION (this);
}
void
-LteCqiSinrChunkProcessor::Start ()
+LteCtrlSinrChunkProcessor::Start ()
{
NS_LOG_FUNCTION (this);
m_sumSinr = 0;
@@ -57,7 +69,7 @@
void
-LteCqiSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
+LteCtrlSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
{
NS_LOG_FUNCTION (this << sinr << duration);
if (m_sumSinr == 0)
@@ -69,12 +81,16 @@
}
void
-LteCqiSinrChunkProcessor::End ()
+LteCtrlSinrChunkProcessor::End ()
{
NS_LOG_FUNCTION (this);
if (m_totDuration.GetSeconds () > 0)
{
- m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ m_phy->GenerateCtrlCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ if (m_spectrumPhy)
+ {
+ m_spectrumPhy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ }
}
else
{
@@ -85,22 +101,34 @@
-LtePemSinrChunkProcessor::LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p)
-: m_phy (p)
+LteDataSinrChunkProcessor::LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> s, Ptr<LtePhy> p)
+: m_spectrumPhy (s),
+ m_phy (p)
{
NS_LOG_FUNCTION (this << p);
+ NS_ASSERT (m_spectrumPhy);
NS_ASSERT (m_phy);
}
+LteDataSinrChunkProcessor::LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> p)
+: m_spectrumPhy (p),
+ m_phy (0)
+{
+ NS_LOG_FUNCTION (this << p);
+ NS_ASSERT (m_spectrumPhy);
+
+}
-LtePemSinrChunkProcessor::~LtePemSinrChunkProcessor ()
+
+
+LteDataSinrChunkProcessor::~LteDataSinrChunkProcessor ()
{
NS_LOG_FUNCTION (this);
}
void
-LtePemSinrChunkProcessor::Start ()
+LteDataSinrChunkProcessor::Start ()
{
NS_LOG_FUNCTION (this);
m_sumSinr = 0;
@@ -109,7 +137,7 @@
void
-LtePemSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
+LteDataSinrChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
{
NS_LOG_FUNCTION (this << sinr << duration);
if (m_sumSinr == 0)
@@ -121,12 +149,16 @@
}
void
-LtePemSinrChunkProcessor::End ()
+LteDataSinrChunkProcessor::End ()
{
NS_LOG_FUNCTION (this);
if (m_totDuration.GetSeconds () > 0)
{
- m_phy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ m_spectrumPhy->UpdateSinrPerceived ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ if (m_phy)
+ {
+ m_phy->GenerateDataCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ }
}
else
{
--- a/src/lte/model/lte-sinr-chunk-processor.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-sinr-chunk-processor.h Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by : Marco Miozzo <mmiozzo@cttc.es>
+ * (move from CQI to Ctrl and Data SINR Chunk processors)
*/
@@ -53,14 +55,18 @@
/**
- * This SinrProcessor averages the calculated SINR over time.
+ * The LteCtrlSinrChunkProcessor averages the calculated SINR over time
+ * for the Ctrl frame and therefore in charge of generating the CQI starting
+ * from the reference signals and the sinr values used for evaluating the
+ * decodification error probability of the control channels (PCFICH + PDCCH)
*
*/
-class LteCqiSinrChunkProcessor : public LteSinrChunkProcessor
+class LteCtrlSinrChunkProcessor : public LteSinrChunkProcessor
{
public:
- virtual ~LteCqiSinrChunkProcessor ();
- LteCqiSinrChunkProcessor (Ptr<LtePhy> p);
+ virtual ~LteCtrlSinrChunkProcessor ();
+ LteCtrlSinrChunkProcessor (Ptr<LtePhy> p);
+ LteCtrlSinrChunkProcessor (Ptr<LtePhy> p, Ptr<LteSpectrumPhy> s);
virtual void Start ();
virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration);
virtual void End ();
@@ -68,26 +74,32 @@
Ptr<SpectrumValue> m_sumSinr;
Time m_totDuration;
Ptr<LtePhy> m_phy;
+ Ptr<LteSpectrumPhy> m_spectrumPhy;
};
/**
-* This SinrProcessor averages the calculated SINR over time for Phy error model
+* The LteDataSinrChunkProcessor averages the calculated SINR over time for
+* data frame and therefore in charge of generating the sinr values for
+* evaluating the errors of data packets. Might be used also for generating
+* CQI based on data in case any LtePhy is attached.
*
*/
-class LtePemSinrChunkProcessor : public LteSinrChunkProcessor
+class LteDataSinrChunkProcessor : public LteSinrChunkProcessor
{
public:
- virtual ~LtePemSinrChunkProcessor ();
- LtePemSinrChunkProcessor (Ptr<LteSpectrumPhy> p);
+ virtual ~LteDataSinrChunkProcessor ();
+ LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> p);
+ LteDataSinrChunkProcessor (Ptr<LteSpectrumPhy> s, Ptr<LtePhy> 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;
+ Ptr<LteSpectrumPhy> m_spectrumPhy;
+ Ptr<LtePhy> m_phy;
};
--- a/src/lte/model/lte-spectrum-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-spectrum-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -73,7 +73,8 @@
m_transmissionMode (0)
{
NS_LOG_FUNCTION (this);
- m_interference = CreateObject<LteInterference> ();
+ m_interferenceData = CreateObject<LteInterference> ();
+ m_interferenceCtrl = CreateObject<LteInterference> ();
for (uint8_t i = 0; i < 7; i++)
{
m_txModeGain.push_back (1.0);
@@ -94,11 +95,15 @@
m_channel = 0;
m_mobility = 0;
m_device = 0;
- m_interference->Dispose ();
- m_interference = 0;
- m_genericPhyTxEndCallback = MakeNullCallback< void, Ptr<const Packet> > ();
- m_genericPhyRxEndErrorCallback = MakeNullCallback< void > ();
- m_genericPhyRxEndOkCallback = MakeNullCallback< void, Ptr<Packet> > ();
+ m_interferenceData->Dispose ();
+ m_interferenceData = 0;
+ m_interferenceCtrl->Dispose ();
+ m_interferenceCtrl = 0;
+ m_ltePhyTxEndCallback = MakeNullCallback< void, Ptr<const Packet> > ();
+ m_ltePhyRxDataEndErrorCallback = MakeNullCallback< void > ();
+ m_ltePhyRxDataEndOkCallback = MakeNullCallback< void, Ptr<Packet> > ();
+ m_ltePhyRxCtrlEndOkCallback = MakeNullCallback< void, std::list<Ptr<LteControlMessage> > > ();
+ m_ltePhyRxCtrlEndErrorCallback = MakeNullCallback< void > ();
SpectrumPhy::DoDispose ();
}
@@ -109,8 +114,11 @@
case LteSpectrumPhy::IDLE:
os << "IDLE";
break;
- case LteSpectrumPhy::RX:
- os << "RX";
+ case LteSpectrumPhy::RX_DATA:
+ os << "RX_DATA";
+ break;
+ case LteSpectrumPhy::RX_CTRL:
+ os << "RX_CTRL";
break;
case LteSpectrumPhy::TX:
os << "TX";
@@ -143,10 +151,15 @@
.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).",
+ .AddAttribute ("DataErrorModelEnabled",
+ "Activate/Deactivate the error model of data (TBs of PDSCH and PUSCH) [by default is active].",
BooleanValue (true),
- MakeBooleanAccessor (&LteSpectrumPhy::m_pemEnabled),
+ MakeBooleanAccessor (&LteSpectrumPhy::m_dataErrorModelEnabled),
+ MakeBooleanChecker ())
+ .AddAttribute ("CtrlErrorModelEnabled",
+ "Activate/Deactivate the error model of control (PCFICH-PDCCH decodification) [by default is active].",
+ BooleanValue (true),
+ MakeBooleanAccessor (&LteSpectrumPhy::m_ctrlErrorModelEnabled),
MakeBooleanChecker ())
;
return tid;
@@ -215,34 +228,50 @@
NS_LOG_FUNCTION (this << noisePsd);
NS_ASSERT (noisePsd);
m_rxSpectrumModel = noisePsd->GetSpectrumModel ();
- m_interference->SetNoisePowerSpectralDensity (noisePsd);
+ m_interferenceData->SetNoisePowerSpectralDensity (noisePsd);
+ m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
}
void
-LteSpectrumPhy::SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c)
+LteSpectrumPhy::SetLtePhyTxEndCallback (LtePhyTxEndCallback c)
{
NS_LOG_FUNCTION (this);
- m_genericPhyTxEndCallback = c;
+ m_ltePhyTxEndCallback = c;
+}
+
+
+void
+LteSpectrumPhy::SetLtePhyRxDataEndErrorCallback (LtePhyRxDataEndErrorCallback c)
+{
+ NS_LOG_FUNCTION (this);
+ m_ltePhyRxDataEndErrorCallback = c;
}
void
-LteSpectrumPhy::SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c)
+LteSpectrumPhy::SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c)
{
NS_LOG_FUNCTION (this);
- m_genericPhyRxEndErrorCallback = c;
+ m_ltePhyRxDataEndOkCallback = c;
}
+void
+LteSpectrumPhy::SetLtePhyRxCtrlEndOkCallback (LtePhyRxCtrlEndOkCallback c)
+{
+ NS_LOG_FUNCTION (this);
+ m_ltePhyRxCtrlEndOkCallback = c;
+}
void
-LteSpectrumPhy::SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c)
+LteSpectrumPhy::SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c)
{
NS_LOG_FUNCTION (this);
- m_genericPhyRxEndOkCallback = c;
+ m_ltePhyRxCtrlEndErrorCallback = c;
}
+
Ptr<AntennaModel>
LteSpectrumPhy::GetRxAntenna ()
{
@@ -274,6 +303,7 @@
bool
LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
{
+ NS_LOG_WARN (this << " Obsolete Function");
NS_LOG_FUNCTION (this << pb);
NS_LOG_LOGIC (this << " state: " << m_state);
@@ -281,7 +311,8 @@
switch (m_state)
{
- case RX:
+ case RX_DATA:
+ case RX_CTRL:
NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
break;
@@ -311,26 +342,194 @@
ChangeState (TX);
NS_ASSERT (m_channel);
double tti = 0.001;
- Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
- txParams->duration = Seconds (tti);
- txParams->txPhy = GetObject<SpectrumPhy> ();
- txParams->txAntenna = m_antenna;
- txParams->psd = m_txPsd;
- txParams->packetBurst = pb;
- m_channel->StartTx (txParams);
+ Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
+ txParams->duration = Seconds (tti);
+ txParams->txPhy = GetObject<SpectrumPhy> ();
+ txParams->txAntenna = m_antenna;
+ txParams->psd = m_txPsd;
+ txParams->packetBurst = pb;
+ m_channel->StartTx (txParams);
Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this);
}
return false;
break;
default:
- NS_FATAL_ERROR ("uknown state");
+ NS_FATAL_ERROR ("unknown state");
return true;
break;
}
}
+bool
+LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration)
+{
+ NS_LOG_FUNCTION (this << pb);
+ NS_LOG_LOGIC (this << " state: " << m_state);
+
+ m_phyTxStartTrace (pb);
+
+ switch (m_state)
+ {
+ case RX_DATA:
+ case RX_CTRL:
+ NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+ break;
+
+ case TX:
+ NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+ break;
+
+ case IDLE:
+ {
+ /*
+ m_txPsd must be setted by the device, according to
+ (i) the available subchannel for transmission
+ (ii) the power transmission
+ */
+ NS_ASSERT (m_txPsd);
+ m_txPacketBurst = pb;
+
+ // we need to convey some PHY meta information to the receiver
+ // to be used for simulation purposes (e.g., the CellId). This
+ // is done by setting the ctrlMsgList parameter of
+ // LteSpectrumSignalParametersDataFrame
+ ChangeState (TX);
+ NS_ASSERT (m_channel);
+ Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
+ txParams->duration = Seconds (duration);
+ txParams->txPhy = GetObject<SpectrumPhy> ();
+ txParams->txAntenna = m_antenna;
+ txParams->psd = m_txPsd;
+ txParams->packetBurst = pb;
+ txParams->ctrlMsgList = ctrlMsgList;
+ txParams->cellId = m_cellId;
+ m_channel->StartTx (txParams);
+ Simulator::Schedule (Seconds (duration), &LteSpectrumPhy::EndTx, this);
+ }
+ return false;
+ break;
+
+ default:
+ NS_FATAL_ERROR ("unknown state");
+ return true;
+ break;
+ }
+}
+
+bool
+LteSpectrumPhy::StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgList)
+{
+ NS_LOG_FUNCTION (this << time);
+ NS_LOG_LOGIC (this << " state: " << m_state);
+
+// m_phyTxStartTrace (pb);
+
+ switch (m_state)
+ {
+ case RX_DATA:
+ case RX_CTRL:
+ NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+ break;
+
+ case TX:
+ NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+ break;
+
+ case IDLE:
+ {
+ /*
+ m_txPsd must be setted by the device, according to
+ (i) the available subchannel for transmission
+ (ii) the power transmission
+ */
+ NS_ASSERT (m_txPsd);
+
+ // we need to convey some PHY meta information to the receiver
+ // to be used for simulation purposes (e.g., the CellId). This
+ // is done by setting the cellId parameter of
+ // LteSpectrumSignalParametersDlCtrlFrame
+ ChangeState (TX);
+ NS_ASSERT (m_channel);
+ double dlCtrlFrame = 0.000214286; // 0.001 / 14 * 3 (fixed to 3 symbols)
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ txParams->duration = Seconds (dlCtrlFrame);
+ txParams->txPhy = GetObject<SpectrumPhy> ();
+ txParams->txAntenna = m_antenna;
+ txParams->psd = m_txPsd;
+ txParams->cellId = m_cellId;
+ txParams->ctrlMsgList = ctrlMsgList;
+ m_channel->StartTx (txParams);
+ Simulator::Schedule (Seconds (dlCtrlFrame), &LteSpectrumPhy::EndTx, this);
+ }
+ return false;
+ break;
+
+ default:
+ NS_FATAL_ERROR ("unknown state");
+ return true;
+ break;
+ }
+}
+
+
+bool
+LteSpectrumPhy::StartTxUlSrsFrame ()
+{
+ NS_LOG_FUNCTION (this << time);
+ NS_LOG_LOGIC (this << " state: " << m_state);
+
+ // m_phyTxStartTrace (pb);
+
+ switch (m_state)
+ {
+ case RX_DATA:
+ case RX_CTRL:
+ NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
+ break;
+
+ case TX:
+ NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
+ break;
+
+ case IDLE:
+ {
+ /*
+ m_txPsd must be setted by the device, according to
+ (i) the available subchannel for transmission
+ (ii) the power transmission
+ */
+ NS_ASSERT (m_txPsd);
+
+ // we need to convey some PHY meta information to the receiver
+ // to be used for simulation purposes (e.g., the CellId). This
+ // is done by setting the cellId parameter of
+ // LteSpectrumSignalParametersDlCtrlFrame
+ ChangeState (TX);
+ NS_ASSERT (m_channel);
+ double ulCtrlFrame = 0.000071429; // 0.001 / 14 * 1 (fixed to 1 symbols)
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ txParams->duration = Seconds (ulCtrlFrame);
+ txParams->txPhy = GetObject<SpectrumPhy> ();
+ txParams->txAntenna = m_antenna;
+ txParams->psd = m_txPsd;
+ txParams->cellId = m_cellId;
+ m_channel->StartTx (txParams);
+ Simulator::Schedule (Seconds (ulCtrlFrame), &LteSpectrumPhy::EndTx, this);
+ }
+ return false;
+ break;
+
+ default:
+ NS_FATAL_ERROR ("unknown state");
+ return true;
+ break;
+ }
+}
+
+
+
void
LteSpectrumPhy::EndTx ()
{
@@ -341,13 +540,13 @@
m_phyTxEndTrace (m_txPacketBurst);
- if (!m_genericPhyTxEndCallback.IsNull ())
+ if (!m_ltePhyTxEndCallback.IsNull ())
{
for (std::list<Ptr<Packet> >::const_iterator iter = m_txPacketBurst->Begin (); iter
!= m_txPacketBurst->End (); ++iter)
{
Ptr<Packet> packet = (*iter)->Copy ();
- m_genericPhyTxEndCallback (packet);
+ m_ltePhyTxEndCallback (packet);
}
}
@@ -361,85 +560,201 @@
{
NS_LOG_FUNCTION (this << spectrumRxParams);
NS_LOG_LOGIC (this << " state: " << m_state);
-
- // interference will happen regardless of the type of the signal (could be 3G, GSM, whatever)
+
Ptr <const SpectrumValue> rxPsd = spectrumRxParams->psd;
Time duration = spectrumRxParams->duration;
-
- m_interference->AddSignal (rxPsd, duration);
-
+
// the device might start RX only if the signal is of a type
// understood by this device - in this case, an LTE signal.
- Ptr<LteSpectrumSignalParameters> lteRxParams = DynamicCast<LteSpectrumSignalParameters> (spectrumRxParams);
- if (lteRxParams != 0)
+ Ptr<LteSpectrumSignalParametersDataFrame> lteDataRxParams = DynamicCast<LteSpectrumSignalParametersDataFrame> (spectrumRxParams);
+ if (lteDataRxParams != 0)
+ {
+ m_interferenceData->AddSignal (rxPsd, duration);
+ StartRxData (lteDataRxParams);
+ }
+ else
{
- switch (m_state)
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (spectrumRxParams);
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (spectrumRxParams);
+ if ((lteDlCtrlRxParams!=0)||(lteUlSrsRxParams!=0))
{
- case TX:
- NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
- break;
+ m_interferenceCtrl->AddSignal (rxPsd, duration);
+ StartRxCtrl (spectrumRxParams);
+ }
+ else
+ {
+ // other type of signal (could be 3G, GSM, whatever) -> interference
+ m_interferenceData->AddSignal (rxPsd, duration);
+ m_interferenceCtrl->AddSignal (rxPsd, duration);
+ }
+ }
+
+}
- case IDLE:
- case RX:
- // the behavior is similar when
- // we're IDLE or RX because we can receive more signals
- // simultaneously (e.g., at the eNB).
+void
+LteSpectrumPhy::StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params)
+{
+ NS_LOG_FUNCTION (this);
+ switch (m_state)
+ {
+ case TX:
+ NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
+ break;
+ case RX_CTRL:
+ NS_FATAL_ERROR ("cannot RX Data while receiving control");
+ break;
+ case IDLE:
+ case RX_DATA:
+ // the behavior is similar when
+ // we're IDLE or RX because we can receive more signals
+ // simultaneously (e.g., at the eNB).
+ {
+ // To check if we're synchronized to this signal, we check
+ // for the CellId which is reported in the
+ // LteSpectrumSignalParametersDataFrame
+ if (params->cellId == m_cellId)
+ {
+ NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << params->cellId << ")");
+ if ((m_rxPacketBurstList.empty ())&&(m_rxControlMessageList.empty ()))
+ {
+ NS_ASSERT (m_state == IDLE);
+ // first transmission, i.e., we're IDLE and we
+ // start RX
+ m_firstRxStart = Simulator::Now ();
+ m_firstRxDuration = params->duration;
+ NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration);
+ Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, this);
+ }
+ else
+ {
+ NS_ASSERT (m_state == RX_DATA);
+ // sanity check: if there are multiple RX events, they
+ // should occur at the same time and have the same
+ // duration, otherwise the interference calculation
+ // won't be correct
+ NS_ASSERT ((m_firstRxStart == Simulator::Now ())
+ && (m_firstRxDuration == params->duration));
+ }
+
+ ChangeState (RX_DATA);
+ if (params->packetBurst)
+ {
+ m_rxPacketBurstList.push_back (params->packetBurst);
+ m_interferenceData->StartRx (params->psd);
+
+ m_phyRxStartTrace (params->packetBurst);
+ }
+ NS_LOG_DEBUG (this << " insert msgs " << params->ctrlMsgList.size ());
+ m_rxControlMessageList.insert (m_rxControlMessageList.end (), params->ctrlMsgList.begin (), params->ctrlMsgList.end ());
+
+ NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+ }
+ else
+ {
+ NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
+ << params->cellId << ", m_cellId=" << m_cellId << ")");
+ }
+ }
+ break;
+
+ default:
+ NS_FATAL_ERROR ("unknown state");
+ break;
+ }
+
+ NS_LOG_LOGIC (this << " state: " << m_state);
+}
+
+
+
+void
+LteSpectrumPhy::StartRxCtrl (Ptr<SpectrumSignalParameters> params)
+{
+ NS_LOG_FUNCTION (this);
+ switch (m_state)
+ {
+ case TX:
+ NS_FATAL_ERROR ("cannot RX while TX: according to FDD channel access, the physical layer for transmission cannot be used for reception");
+ break;
+ case RX_DATA:
+ NS_FATAL_ERROR ("cannot RX data while receing control");
+ break;
+ case IDLE:
+ case RX_CTRL:
+ // the behavior is similar when
+ // we're IDLE or RX because we can receive more signals
+ // simultaneously (e.g., at the eNB).
+ {
+ // To check if we're synchronized to this signal, we check
+ // for the CellId which is reported in the
+ // LteSpectrumSignalParametersDlCtrlFrame
+ uint16_t cellId;
+ bool dl;
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (params);
+ if (lteDlCtrlRxParams!=0)
{
- // To check if we're synchronized to this signal, we check
- // for the CellId which is reported in the LtePhyTag
- NS_ASSERT (lteRxParams->packetBurst->Begin () != lteRxParams->packetBurst->End ());
- LtePhyTag tag;
- Ptr<Packet> firstPacketInBurst = *(lteRxParams->packetBurst->Begin ());
- firstPacketInBurst->RemovePacketTag (tag);
- if (tag.GetCellId () == m_cellId)
+ cellId = lteDlCtrlRxParams->cellId;
+ dl = true;
+ }
+ else
+ {
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> lteUlSrsRxParams = DynamicCast<LteSpectrumSignalParametersUlSrsFrame> (params);
+ cellId = lteUlSrsRxParams->cellId;
+ dl = false;
+ }
+ if (cellId == m_cellId)
+ {
+ NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << cellId << ")");
+ if (m_state == IDLE)
+ {
+ // first transmission, i.e., we're IDLE and we
+ // start RX
+ NS_ASSERT (m_rxControlMessageList.empty ());
+ m_firstRxStart = Simulator::Now ();
+ m_firstRxDuration = params->duration;
+ NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration);
+ if (dl==true)
{
- NS_LOG_LOGIC (this << " synchronized with this signal (cellId=" << tag.GetCellId () << ")");
- if (m_rxPacketBurstList.empty ())
- {
- NS_ASSERT (m_state == IDLE);
- // first transmission, i.e., we're IDLE and we
- // start RX
- m_firstRxStart = Simulator::Now ();
- m_firstRxDuration = duration;
- NS_LOG_LOGIC (this << " scheduling EndRx with delay " << duration);
- Simulator::Schedule (duration, &LteSpectrumPhy::EndRx, this);
- }
- else
- {
- NS_ASSERT (m_state == RX);
- // sanity check: if there are multiple RX events, they
- // should occur at the same time and have the same
- // duration, otherwise the interference calculation
- // won't be correct
- NS_ASSERT ((m_firstRxStart == Simulator::Now ())
- && (m_firstRxDuration == duration));
- }
-
- ChangeState (RX);
- m_interference->StartRx (rxPsd);
-
- m_phyRxStartTrace (lteRxParams->packetBurst);
-
- m_rxPacketBurstList.push_back (lteRxParams->packetBurst);
-
- NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+ // store the DCIs
+ m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
+ Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
}
else
{
- NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
- << tag.GetCellId () << ", m_cellId=" << m_cellId << ")");
+ Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxUlSrs, this);
}
}
- break;
+ else if (m_state == RX_CTRL)
+ {
+ // sanity check: if there are multiple RX events, they
+ // should occur at the same time and have the same
+ // duration, otherwise the interference calculation
+ // won't be correct
+ NS_ASSERT ((m_firstRxStart == Simulator::Now ())
+ && (m_firstRxDuration == params->duration));
+ }
+
+ ChangeState (RX_CTRL);
+ m_interferenceCtrl->StartRx (params->psd);
+
+// NS_LOG_LOGIC (this << " numSimultaneousRxEvents = " << m_rxPacketBurstList.size ());
+ }
+ else
+ {
+ NS_LOG_LOGIC (this << " not in sync with this signal (cellId="
+ << cellId << ", m_cellId=" << m_cellId << ")");
+ }
+ }
+ break;
+
+ default:
+ NS_FATAL_ERROR ("unknown state");
+ break;
+ }
+
+ NS_LOG_LOGIC (this << " state: " << m_state);
+}
- default:
- NS_FATAL_ERROR ("unknown state");
- break;
- }
-
- NS_LOG_LOGIC (this << " state: " << m_state);
- }
-}
void
LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr)
@@ -470,16 +785,16 @@
void
-LteSpectrumPhy::EndRx ()
+LteSpectrumPhy::EndRxData ()
{
NS_LOG_FUNCTION (this);
NS_LOG_LOGIC (this << " state: " << m_state);
- NS_ASSERT (m_state == RX);
+ NS_ASSERT (m_state == RX_DATA);
// 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 ();
+ m_interferenceData->EndRx ();
NS_LOG_DEBUG (this << " No. of burts " << m_rxPacketBurstList.size ());
NS_LOG_DEBUG (this << " Expected TBs " << m_expectedTbs.size ());
expectedTbs_t::iterator itTb = m_expectedTbs.begin ();
@@ -491,7 +806,7 @@
while (itTb!=m_expectedTbs.end ())
{
- if (m_pemEnabled)
+ if (m_dataErrorModelEnabled)
{
double errorRate = LteMiErrorModel::GetTbError (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs);
(*itTb).second.corrupt = m_random.GetValue () > errorRate ? false : true;
@@ -504,7 +819,6 @@
// }
itTb++;
}
-
for (std::list<Ptr<PacketBurst> >::const_iterator i = m_rxPacketBurstList.begin ();
i != m_rxPacketBurstList.end (); ++i)
{
@@ -524,9 +838,9 @@
{
m_phyRxEndOkTrace (*j);
- if (!m_genericPhyRxEndOkCallback.IsNull ())
+ if (!m_ltePhyRxDataEndOkCallback.IsNull ())
{
- m_genericPhyRxEndOkCallback (*j);
+ m_ltePhyRxDataEndOkCallback (*j);
}
}
else
@@ -537,21 +851,94 @@
}
}
}
+
+ if (!m_rxControlMessageList.empty ())
+ {
+ if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
+ {
+ m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
+ }
+ }
ChangeState (IDLE);
m_rxPacketBurstList.clear ();
+ m_rxControlMessageList.clear ();
m_expectedTbs.clear ();
}
+
+void
+LteSpectrumPhy::EndRxDlCtrl ()
+{
+ NS_LOG_FUNCTION (this);
+ NS_LOG_LOGIC (this << " state: " << m_state);
+
+ NS_ASSERT (m_state == RX_CTRL);
+
+ // 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_interferenceCtrl->EndRx ();
+ // apply transmission mode gain
+ NS_LOG_DEBUG (this << " txMode " << (uint16_t)m_transmissionMode << " gain " << m_txModeGain.at (m_transmissionMode));
+ NS_ASSERT (m_transmissionMode < m_txModeGain.size ());
+ if (m_transmissionMode>0)
+ {
+ // in case of MIMO, ctrl is always txed as TX diversity
+ m_sinrPerceived *= m_txModeGain.at (1);
+ }
+// m_sinrPerceived *= m_txModeGain.at (m_transmissionMode);
+ bool error = false;
+ if (m_ctrlErrorModelEnabled)
+ {
+ double errorRate = LteMiErrorModel::GetPcfichPdcchError (m_sinrPerceived);
+ errorRate = LteMiErrorModel::GetPcfichPdcchError (m_sinrPerceived);
+ error = m_random.GetValue () > errorRate ? false : true;
+ NS_LOG_DEBUG (this << " PCFICH-PDCCH Decodification, errorRate " << errorRate << " error " << error);
+ }
+
+ if (!error)
+ {
+ if (!m_ltePhyRxCtrlEndOkCallback.IsNull ())
+ {
+ m_ltePhyRxCtrlEndOkCallback (m_rxControlMessageList);
+ }
+ }
+ else
+ {
+ if (!m_ltePhyRxCtrlEndErrorCallback.IsNull ())
+ {
+ m_ltePhyRxCtrlEndErrorCallback ();
+ }
+ }
+ ChangeState (IDLE);
+ m_rxControlMessageList.clear ();
+}
+
+void
+LteSpectrumPhy::EndRxUlSrs ()
+{
+ NS_ASSERT (m_state == RX_CTRL);
+ ChangeState (IDLE);
+ m_interferenceCtrl->EndRx ();
+ // nothing to do (used only for SRS at this stage)
+}
+
void
LteSpectrumPhy::SetCellId (uint16_t cellId)
{
m_cellId = cellId;
}
+
void
-LteSpectrumPhy::AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+LteSpectrumPhy::AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
{
- m_interference->AddSinrChunkProcessor (p);
+ m_interferenceData->AddSinrChunkProcessor (p);
+}
+
+void
+LteSpectrumPhy::AddCtrlSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+{
+ m_interferenceCtrl->AddSinrChunkProcessor (p);
}
void
--- a/src/lte/model/lte-spectrum-phy.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-spectrum-phy.h Thu Jul 19 13:02:41 2012 +0200
@@ -38,6 +38,7 @@
#include <ns3/lte-interference.h>
#include <ns3/random-variable.h>
#include <map>
+#include <ns3/ff-mac-common.h>
namespace ns3 {
@@ -65,8 +66,54 @@
typedef std::map<TbId_t, tbInfo_t> expectedTbs_t;
+
class LteNetDevice;
class AntennaModel;
+class LteControlMessage;
+class LteSpectrumSignalParametersDataFrame;
+class LteSpectrumSignalParametersDlCtrlFrame;
+class LteSpectrumSignalParametersUlSrsFrame;
+
+
+/**
+* this method is invoked by the LteSpectrumPhy to notify the PHY that the
+* transmission of a given packet has been completed.
+*
+* @param packet the Packet whose TX has been completed.
+*/
+typedef Callback< void, Ptr<const Packet> > LtePhyTxEndCallback;
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX attempt has terminated without success
+*/
+typedef Callback< void > LtePhyRxDataEndErrorCallback;
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX attempt has been successfully completed.
+*
+* @param packet the received Packet
+*/
+typedef Callback< void, Ptr<Packet> > LtePhyRxDataEndOkCallback;
+
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX of a control frame attempt has been
+* successfully completed.
+*
+* @param packet the received Packet
+*/
+typedef Callback< void, std::list<Ptr<LteControlMessage> > > LtePhyRxCtrlEndOkCallback;
+
+/**
+* This method is used by the LteSpectrumPhy to notify the PHY that a
+* previously started RX of a control frame attempt has terminated
+* without success.
+*/
+typedef Callback< void > LtePhyRxCtrlEndErrorCallback;
+
+
/**
* \ingroup lte
@@ -88,7 +135,7 @@
*/
enum State
{
- IDLE, TX, RX
+ IDLE, TX, RX_DATA, RX_CTRL
};
// inherited from Object
@@ -104,6 +151,8 @@
Ptr<const SpectrumModel> GetRxSpectrumModel () const;
Ptr<AntennaModel> GetRxAntenna ();
void StartRx (Ptr<SpectrumSignalParameters> params);
+ void StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params);
+ void StartRxCtrl (Ptr<SpectrumSignalParameters> params);
/**
* set the Power Spectral Density of outgoing signals in W/Hz.
@@ -136,6 +185,43 @@
* started, false otherwise.
*/
bool StartTx (Ptr<PacketBurst> pb);
+
+ /**
+ * Start a transmission of data frame in DL and UL
+ *
+ *
+ * @param pb the burst of packets to be transmitted in PDSCH/PUSCH
+ * @param ctrlMsgList the list of LteControlMessage to send
+ * @param duration the duration of the data frame (in sec.)
+ *
+ * @return true if an error occurred and the transmission was not
+ * started, false otherwise.
+ */
+ bool StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration);
+
+ /**
+ * Start a transmission of control frame in DL
+ *
+ *
+ * @param dlDci the burst of DL-DCIs to be transmitted
+ * @param ulDci the burst of UL-DCIs to be transmitted
+ *
+ * @return true if an error occurred and the transmission was not
+ * started, false otherwise.
+ */
+ bool StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgList);
+
+
+ /**
+ * Start a transmission of control frame in UL
+ *
+ *
+ * @param pb the burst of control messages to be transmitted
+ *
+ * @return true if an error occurred and the transmission was not
+ * started, false otherwise.
+ */
+ bool StartTxUlSrsFrame ();
/**
@@ -144,7 +230,7 @@
*
* @param c the callback
*/
- void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c);
+ void SetLtePhyTxEndCallback (LtePhyTxEndCallback c);
/**
* set the callback for the end of a RX in error, as part of the
@@ -152,7 +238,7 @@
*
* @param c the callback
*/
- void SetGenericPhyRxEndErrorCallback (GenericPhyRxEndErrorCallback c);
+ void SetLtePhyRxDataEndErrorCallback (LtePhyRxDataEndErrorCallback c);
/**
* set the callback for the successful end of a RX, as part of the
@@ -160,7 +246,23 @@
*
* @param c the callback
*/
- void SetGenericPhyRxEndOkCallback (GenericPhyRxEndOkCallback c);
+ void SetLtePhyRxDataEndOkCallback (LtePhyRxDataEndOkCallback c);
+
+ /**
+ * set the callback for the successful end of a RX ctrl frame, as part
+ * of the interconnections betweenthe LteSpectrumPhy and the PHY
+ *
+ * @param c the callback
+ */
+ void SetLtePhyRxCtrlEndOkCallback (LtePhyRxCtrlEndOkCallback c);
+
+ /**
+ * set the callback for the erroneous end of a RX ctrl frame, as part
+ * of the interconnections betweenthe LteSpectrumPhy and the PHY
+ *
+ * @param c the callback
+ */
+ void SetLtePhyRxCtrlEndErrorCallback (LtePhyRxCtrlEndErrorCallback c);
/**
* \brief Set the state of the phy layer
@@ -177,11 +279,19 @@
/**
- *
- *
- * \param p the new LteSinrChunkProcessor to be added to the processing chain
- */
- void AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+ *
+ *
+ * \param p the new LteSinrChunkProcessor to be added to the data processing chain
+ */
+ void AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+
+
+ /**
+ *
+ *
+ * \param p the new LteSinrChunkProcessor to be added to the ctrl processing chain
+ */
+ void AddCtrlSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p);
/**
*
@@ -214,7 +324,9 @@
private:
void ChangeState (State newState);
void EndTx ();
- void EndRx ();
+ void EndRxData ();
+ void EndRxDlCtrl ();
+ void EndRxUlSrs ();
void SetTxModeGain (uint8_t txMode, double gain);
@@ -229,7 +341,11 @@
Ptr<SpectrumValue> m_txPsd;
Ptr<PacketBurst> m_txPacketBurst;
std::list<Ptr<PacketBurst> > m_rxPacketBurstList;
-
+
+ std::list<Ptr<LteControlMessage> > m_txControlMessageList;
+ std::list<Ptr<LteControlMessage> > m_rxControlMessageList;
+
+
State m_state;
Time m_firstRxStart;
Time m_firstRxDuration;
@@ -240,11 +356,15 @@
TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace;
TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;
- GenericPhyTxEndCallback m_genericPhyTxEndCallback;
- GenericPhyRxEndErrorCallback m_genericPhyRxEndErrorCallback;
- GenericPhyRxEndOkCallback m_genericPhyRxEndOkCallback;
+ LtePhyTxEndCallback m_ltePhyTxEndCallback;
+ LtePhyRxDataEndErrorCallback m_ltePhyRxDataEndErrorCallback;
+ LtePhyRxDataEndOkCallback m_ltePhyRxDataEndOkCallback;
+
+ LtePhyRxCtrlEndOkCallback m_ltePhyRxCtrlEndOkCallback;
+ LtePhyRxCtrlEndErrorCallback m_ltePhyRxCtrlEndErrorCallback;
- Ptr<LteInterference> m_interference;
+ Ptr<LteInterference> m_interferenceData;
+ Ptr<LteInterference> m_interferenceCtrl;
uint16_t m_cellId;
@@ -252,7 +372,8 @@
SpectrumValue m_sinrPerceived;
UniformVariable m_random;
- bool m_pemEnabled; // when true (default) the phy error model is enabled
+ bool m_dataErrorModelEnabled; // when true (default) the phy error model is enabled
+ bool m_ctrlErrorModelEnabled; // when true (default) the phy error model is enabled for DL ctrl frame
uint8_t m_transmissionMode; // for UEs: store the transmission mode
std::vector <double> m_txModeGain; // duplicate value of LteUePhy
--- a/src/lte/model/lte-spectrum-signal-parameters.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-spectrum-signal-parameters.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@cttc.es> (add data and ctrl diversity)
*/
#include <ns3/log.h>
#include <ns3/packet-burst.h>
#include <ns3/ptr.h>
-#include "lte-spectrum-signal-parameters.h"
+#include <ns3/lte-spectrum-signal-parameters.h>
+#include <ns3/lte-control-messages.h>
NS_LOG_COMPONENT_DEFINE ("LteSpectrumSignalParameters");
@@ -54,4 +56,99 @@
return lssp;
}
+
+
+LteSpectrumSignalParametersDataFrame::LteSpectrumSignalParametersDataFrame ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersDataFrame::LteSpectrumSignalParametersDataFrame (const LteSpectrumSignalParametersDataFrame& p)
+: SpectrumSignalParameters (p)
+{
+ NS_LOG_FUNCTION (this << &p);
+ cellId = p.cellId;
+ if (p.packetBurst)
+ {
+ packetBurst = p.packetBurst->Copy ();
+ }
+ ctrlMsgList = p.ctrlMsgList;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersDataFrame::Copy ()
+{
+ NS_LOG_FUNCTION (this);
+ // Ideally we would use:
+ // return Copy<LteSpectrumSignalParametersDataFrame> (*this);
+ // but for some reason it doesn't work. Another alternative is
+ // return Copy<LteSpectrumSignalParametersDataFrame> (this);
+ // but it causes a double creation of the object, hence it is less efficient.
+ // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+ Ptr<LteSpectrumSignalParametersDataFrame> lssp (new LteSpectrumSignalParametersDataFrame (*this), false);
+ return lssp;
+}
+
+
+
+LteSpectrumSignalParametersDlCtrlFrame::LteSpectrumSignalParametersDlCtrlFrame ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersDlCtrlFrame::LteSpectrumSignalParametersDlCtrlFrame (const LteSpectrumSignalParametersDlCtrlFrame& p)
+: SpectrumSignalParameters (p)
+{
+ NS_LOG_FUNCTION (this << &p);
+ cellId = p.cellId;
+ ctrlMsgList = p.ctrlMsgList;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersDlCtrlFrame::Copy ()
+{
+ NS_LOG_FUNCTION (this);
+ // Ideally we would use:
+ // return Copy<LteSpectrumSignalParametersDlCtrlFrame> (*this);
+ // but for some reason it doesn't work. Another alternative is
+ // return Copy<LteSpectrumSignalParametersDlCtrlFrame> (this);
+ // but it causes a double creation of the object, hence it is less efficient.
+ // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> lssp (new LteSpectrumSignalParametersDlCtrlFrame (*this), false);
+ return lssp;
+}
+
+
+LteSpectrumSignalParametersUlSrsFrame::LteSpectrumSignalParametersUlSrsFrame ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+LteSpectrumSignalParametersUlSrsFrame::LteSpectrumSignalParametersUlSrsFrame (const LteSpectrumSignalParametersUlSrsFrame& p)
+: SpectrumSignalParameters (p)
+{
+ NS_LOG_FUNCTION (this << &p);
+ cellId = p.cellId;
+}
+
+Ptr<SpectrumSignalParameters>
+LteSpectrumSignalParametersUlSrsFrame::Copy ()
+{
+ NS_LOG_FUNCTION (this);
+ // Ideally we would use:
+ // return Copy<LteSpectrumSignalParametersUlSrsFrame> (*this);
+ // but for some reason it doesn't work. Another alternative is
+ // return Copy<LteSpectrumSignalParametersUlSrsFrame> (this);
+ // but it causes a double creation of the object, hence it is less efficient.
+ // The solution below is copied from the implementation of Copy<> (Ptr<>) in ptr.h
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> lssp (new LteSpectrumSignalParametersUlSrsFrame (*this), false);
+ return lssp;
+}
+
+
+
+
+
+
+
} // namespace ns3
--- a/src/lte/model/lte-spectrum-signal-parameters.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-spectrum-signal-parameters.h Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@cttc.es> (add data and ctrl diversity)
*/
#ifndef LTE_SPECTRUM_SIGNAL_PARAMETERS_H
@@ -27,6 +28,8 @@
namespace ns3 {
class PacketBurst;
+class LteControlMessage;
+
/**
* \ingroup lte
@@ -55,6 +58,95 @@
Ptr<PacketBurst> packetBurst;
};
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte Data Frame (PDSCH), and eventually after some
+* control messages through other control channel embedded in PDSCH
+* (i.e. PBCH)
+*/
+struct LteSpectrumSignalParametersDataFrame : public SpectrumSignalParameters
+{
+
+ // inherited from SpectrumSignalParameters
+ virtual Ptr<SpectrumSignalParameters> Copy ();
+
+ /**
+ * default constructor
+ */
+ LteSpectrumSignalParametersDataFrame ();
+
+ /**
+ * copy constructor
+ */
+ LteSpectrumSignalParametersDataFrame (const LteSpectrumSignalParametersDataFrame& p);
+
+ /**
+ * The packet burst being transmitted with this signal
+ */
+ Ptr<PacketBurst> packetBurst;
+
+ std::list<Ptr<LteControlMessage> > ctrlMsgList;
+
+ uint16_t cellId;
+};
+
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte DL Ctrl Frame (RS, PCFICH and PDCCH)
+*/
+struct LteSpectrumSignalParametersDlCtrlFrame : public SpectrumSignalParameters
+{
+
+ // inherited from SpectrumSignalParameters
+ virtual Ptr<SpectrumSignalParameters> Copy ();
+
+ /**
+ * default constructor
+ */
+ LteSpectrumSignalParametersDlCtrlFrame ();
+
+ /**
+ * copy constructor
+ */
+ LteSpectrumSignalParametersDlCtrlFrame (const LteSpectrumSignalParametersDlCtrlFrame& p);
+
+
+ std::list<Ptr<LteControlMessage> > ctrlMsgList;
+
+ uint16_t cellId;
+};
+
+
+
+/**
+* \ingroup lte
+*
+* Signal parameters for Lte SRS Frame
+*/
+struct LteSpectrumSignalParametersUlSrsFrame : public SpectrumSignalParameters
+{
+
+ // inherited from SpectrumSignalParameters
+ virtual Ptr<SpectrumSignalParameters> Copy ();
+
+ /**
+ * default constructor
+ */
+ LteSpectrumSignalParametersUlSrsFrame ();
+
+ /**
+ * copy constructor
+ */
+ LteSpectrumSignalParametersUlSrsFrame (const LteSpectrumSignalParametersUlSrsFrame& p);
+
+ uint16_t cellId;
+};
+
+
} // namespace ns3
--- a/src/lte/model/lte-ue-mac.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-mac.cc Thu Jul 19 13:02:41 2012 +0200
@@ -30,7 +30,7 @@
#include "lte-ue-net-device.h"
#include "lte-radio-bearer-tag.h"
#include <ns3/ff-mac-common.h>
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
#include <ns3/simulator.h>
#include <ns3/lte-common.h>
@@ -136,7 +136,7 @@
// inherited from LtePhySapUser
virtual void ReceivePhyPdu (Ptr<Packet> p);
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
private:
LteUeMac* m_mac;
@@ -161,9 +161,9 @@
}
void
-UeMemberLteUePhySapUser::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+UeMemberLteUePhySapUser::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
- m_mac->DoReceiveIdealControlMessage (msg);
+ m_mac->DoReceiveLteControlMessage (msg);
}
@@ -310,9 +310,9 @@
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
// create the feedback to eNB
- Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
+ Ptr<BsrLteControlMessage> msg = Create<BsrLteControlMessage> ();
msg->SetBsr (bsr);
- m_uePhySapProvider->SendIdealControlMessage (msg);
+ m_uePhySapProvider->SendLteControlMessage (msg);
}
@@ -345,6 +345,7 @@
NS_LOG_FUNCTION (this << " txMode " << (uint8_t) params.m_transmissionMode);
// forward info to PHY layer
m_uePhySapProvider->SetTransmissionMode (params.m_transmissionMode);
+ m_uePhySapProvider->SetSrsConfigurationIndex (params.m_srsConfigurationIndex);
}
@@ -364,12 +365,12 @@
void
-LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUeMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
NS_LOG_FUNCTION (this);
- if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+ if (msg->GetMessageType () == LteControlMessage::UL_DCI)
{
- Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
+ Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
UlDciListElement_s dci = msg2->GetDci ();
std::map <uint8_t, uint64_t>::iterator itBsr;
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
@@ -409,7 +410,7 @@
}
else
{
- NS_LOG_FUNCTION (this << " IdealControlMessage not recognized");
+ NS_LOG_FUNCTION (this << " LteControlMessage not recognized");
}
}
--- a/src/lte/model/lte-ue-mac.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-mac.h Thu Jul 19 13:02:41 2012 +0200
@@ -85,7 +85,7 @@
// forwarded from PHY SAP
void DoReceivePhyPdu (Ptr<Packet> p);
- void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ void DoReceiveLteControlMessage (Ptr<LteControlMessage> msg);
void SendReportBufferStatus (void);
--- a/src/lte/model/lte-ue-phy-sap.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-phy-sap.h Thu Jul 19 13:02:41 2012 +0200
@@ -27,7 +27,7 @@
namespace ns3 {
-class IdealControlMessage;
+class LteControlMessage;
/**
* Service Access Point (SAP) offered by the UE-PHY to the UE-MAC
@@ -57,12 +57,17 @@
* \param txMode the transmissionMode of the user
*/
virtual void SetTransmissionMode (uint8_t txMode) = 0;
+
+ /**
+ * \param txMode the transmissionMode of the user
+ */
+ virtual void SetSrsConfigurationIndex (uint16_t srcCi) = 0;
/**
- * \brief Send SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+ * \brief Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
* \param msg the Ideal Control Message to send
*/
- virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+ virtual void SendLteControlMessage (Ptr<LteControlMessage> msg) = 0;
};
@@ -95,10 +100,10 @@
virtual void SubframeIndication (uint32_t frameNo, uint32_t subframeNo) = 0;
/**
- * \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
+ * \brief Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
* \param msg the Ideal Control Message to receive
*/
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg) = 0;
};
--- a/src/lte/model/lte-ue-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -55,8 +55,9 @@
// inherited from LtePhySapProvider
virtual void SendMacPdu (Ptr<Packet> p);
virtual void SetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
- virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void SendLteControlMessage (Ptr<LteControlMessage> msg);
virtual void SetTransmissionMode (uint8_t txMode);
+ virtual void SetSrsConfigurationIndex (uint16_t srcCi);
private:
LteUePhy* m_phy;
@@ -81,9 +82,9 @@
}
void
-UeMemberLteUePhySapProvider::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
+UeMemberLteUePhySapProvider::SendLteControlMessage (Ptr<LteControlMessage> msg)
{
- m_phy->DoSendIdealControlMessage (msg);
+ m_phy->DoSendLteControlMessage (msg);
}
void
@@ -92,7 +93,11 @@
m_phy->DoSetTransmissionMode (txMode);
}
-
+void
+UeMemberLteUePhySapProvider::SetSrsConfigurationIndex (uint16_t srcCi)
+{
+ m_phy->DoSetSrsConfigurationIndex (srcCi);
+}
////////////////////////////////////////
// generic LteUePhy methods
@@ -115,16 +120,18 @@
m_p10CqiLast (MilliSeconds (0)),
m_a30CqiPeriocity (MilliSeconds (1)),
// ideal behavior
- m_a30CqiLast (MilliSeconds (0))
+ m_a30CqiLast (MilliSeconds (0)),
+ m_rnti (0),
+ m_srsPeriodicity (0)
{
m_amc = CreateObject <LteAmc> ();
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
- m_macChTtiDelay = UL_PUSCH_TTIS_DELAY + 1; // +1 for avoiding UL/DL trigger synchronization remove 1 TTI of delay
+ m_macChTtiDelay = UL_PUSCH_TTIS_DELAY;
for (int i = 0; i < m_macChTtiDelay; i++)
{
Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
m_packetBurstQueue.push_back (pb);
- std::list<Ptr<IdealControlMessage> > l;
+ std::list<Ptr<LteControlMessage> > l;
m_controlMessagesQueue.push_back (l);
}
std::vector <int> ulRb;
@@ -343,30 +350,36 @@
}
void
-LteUePhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this);
// check periodic wideband CQI
if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
{
Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
- Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
- DoSendIdealControlMessage (msg);
+ Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
+ DoSendLteControlMessage (msg);
m_p10CqiLast = Simulator::Now ();
}
// check aperiodic high-layer configured subband CQI
if (Simulator::Now () > m_a30CqiLast + m_a30CqiPeriocity)
{
Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
- Ptr<DlCqiIdealControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
- DoSendIdealControlMessage (msg);
+ Ptr<DlCqiLteControlMessage> msg = CreateDlCqiFeedbackMessage (sinr);
+ DoSendLteControlMessage (msg);
m_a30CqiLast = Simulator::Now ();
}
}
+void
+LteUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+ // Not used by UE, CQI are based only on RS
+}
-Ptr<DlCqiIdealControlMessage>
+
+Ptr<DlCqiLteControlMessage>
LteUePhy::CreateDlCqiFeedbackMessage (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this);
@@ -379,8 +392,8 @@
- // CREATE DlCqiIdealControlMessage
- Ptr<DlCqiIdealControlMessage> msg = Create<DlCqiIdealControlMessage> ();
+ // CREATE DlCqiLteControlMessage
+ Ptr<DlCqiLteControlMessage> msg = Create<DlCqiLteControlMessage> ();
CqiListElement_s dlcqi;
std::vector<int> cqi;
if (Simulator::Now () > m_p10CqiLast + m_p10CqiPeriocity)
@@ -470,87 +483,103 @@
void
-LteUePhy::DoSendIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUePhy::DoSendLteControlMessage (Ptr<LteControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
Ptr<LteEnbNetDevice> remoteDevice = thisDevice->GetTargetEnb ();
- msg->SetSourceDevice (thisDevice);
- msg->SetDestinationDevice (remoteDevice);
SetControlMessages (msg);
}
void
-LteUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteUePhy::ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList)
{
- NS_LOG_FUNCTION (this << msg);
-
- if (msg->GetMessageType () == IdealControlMessage::DL_DCI)
+ NS_LOG_FUNCTION (this);
+
+ std::list<Ptr<LteControlMessage> >::iterator it;
+ for (it = msgList.begin (); it != msgList.end(); it++)
+ {
+ Ptr<LteControlMessage> msg = (*it);
+
+ if (msg->GetMessageType () == LteControlMessage::DL_DCI)
{
- Ptr<DlDciIdealControlMessage> msg2 = DynamicCast<DlDciIdealControlMessage> (msg);
-
+ Ptr<DlDciLteControlMessage> msg2 = DynamicCast<DlDciLteControlMessage> (msg);
+
DlDciListElement_s dci = msg2->GetDci ();
-
- if (dci.m_resAlloc != 0)
+ if (dci.m_rnti != m_rnti)
{
- NS_FATAL_ERROR ("Resource Allocation type not implemented");
+ // DCI not for me
+ continue;
}
-
+
+ if (dci.m_resAlloc != 0)
+ {
+ NS_FATAL_ERROR ("Resource Allocation type not implemented");
+ }
+
std::vector <int> dlRb;
-
+
// translate the DCI to Spectrum framework
uint32_t mask = 0x1;
for (int i = 0; i < 32; i++)
+ {
+ if (((dci.m_rbBitmap & mask) >> i) == 1)
{
- if (((dci.m_rbBitmap & mask) >> i) == 1)
- {
- for (int k = 0; k < GetRbgSize (); k++)
- {
- dlRb.push_back ((i * GetRbgSize ()) + k);
- //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
- }
- }
- mask = (mask << 1);
+ for (int k = 0; k < GetRbgSize (); k++)
+ {
+ dlRb.push_back ((i * GetRbgSize ()) + k);
+ //NS_LOG_DEBUG(this << "DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
+ }
}
+ mask = (mask << 1);
+ }
// send TB info to LteSpectrumPhy
- NS_LOG_DEBUG (this << " UE " << m_rnti << " DCI " << dci.m_rnti << " bitmap " << dci.m_rbBitmap);
+ NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap " << dci.m_rbBitmap);
for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
- {
- m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
- }
-
+ {
+ m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i);
+ }
+
SetSubChannelsForReception (dlRb);
-
-
+
+
}
- else if (msg->GetMessageType () == IdealControlMessage::UL_DCI)
+ else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
{
// set the uplink bandwidht according to the UL-CQI
NS_LOG_DEBUG (this << " UL DCI");
- Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
+ Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
UlDciListElement_s dci = msg2->GetDci ();
+ if (dci.m_rnti != m_rnti)
+ {
+ // DCI not for me
+ continue;
+ }
std::vector <int> ulRb;
for (int i = 0; i < dci.m_rbLen; i++)
- {
- ulRb.push_back (i + dci.m_rbStart);
- //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
- }
-
+ {
+ ulRb.push_back (i + dci.m_rbStart);
+ //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
+ }
+
QueueSubChannelsForTransmission (ulRb);
// pass the info to the MAC
- m_uePhySapUser->ReceiveIdealControlMessage (msg);
+ m_uePhySapUser->ReceiveLteControlMessage (msg);
}
- else
+ else
{
// pass the message to UE-MAC
- m_uePhySapUser->ReceiveIdealControlMessage (msg);
+ m_uePhySapUser->ReceiveLteControlMessage (msg);
}
+
+ }
+
+
+}
-}
-
void
LteUePhy::QueueSubChannelsForTransmission (std::vector <int> rbMap)
{
@@ -572,37 +601,70 @@
}
m_subChannelsForTransmissionQueue.at (m_macChTtiDelay-1).clear ();
-
- // send control messages
- std::list<Ptr<IdealControlMessage> > ctrlMsg = GetControlMessages ();
- if (ctrlMsg.size () > 0)
+ bool srs = false;
+ // check SRS periodicity
+ if (m_srsCounter==1)
{
- Ptr<LtePhy> phy = GetDevice ()->GetObject<LteUeNetDevice> ()->GetTargetEnb ()->GetPhy ();
- std::list<Ptr<IdealControlMessage> >::iterator it;
- it = ctrlMsg.begin ();
- while (it != ctrlMsg.end ())
- {
- Ptr<IdealControlMessage> msg = (*it);
- phy->ReceiveIdealControlMessage (msg);
- ctrlMsg.pop_front ();
- it = ctrlMsg.begin ();
- }
+ srs = true;
+ m_srsCounter = m_srsPeriodicity;
+ }
+ else
+ {
+ m_srsCounter--;
+ }
+ double dataFrame = 0.001 - 0.000071429; // 0.001 - 1 symbol for SRS
+ if (srs)
+ {
+ Simulator::Schedule (Seconds (0.000928572), // (0.001/14) * 13
+ &LteUePhy::SendSrs, this);
}
+
+ std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
// send packets in queue
// send the current burts of packets
Ptr<PacketBurst> pb = GetPacketBurst ();
if (pb)
{
- NS_LOG_LOGIC (this << " UE - start TX");
- m_uplinkSpectrumPhy->StartTx (pb);
+ NS_LOG_LOGIC (this << " UE - start TX PUSCH + PUCCH");
+ m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
}
+ else
+ {
+ // send only PUCCH (ideal: fake full bandwidth signal)
+ if (ctrlMsg.size ()>0)
+ {
+ std::vector <int> dlRb;
+ for (uint8_t i = 0; i < m_ulBandwidth; i++)
+ {
+ dlRb.push_back (i);
+ }
+ SetSubChannelsForTransmission (dlRb);
+ m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
+ }
+ }
+
// trigger the MAC
m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
}
+void
+LteUePhy::SendSrs ()
+{
+ NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << m_cellId);
+ // set the current tx power spectral density (full bandwidth)
+ std::vector <int> dlRb;
+ for (uint8_t i = 0; i < m_ulBandwidth; i++)
+ {
+ dlRb.push_back (i);
+ }
+ SetSubChannelsForTransmission (dlRb);
+ m_uplinkSpectrumPhy->StartTxUlSrsFrame ();
+}
+
+
void
LteUePhy::SetEnbCellId (uint16_t cellId)
@@ -630,6 +692,15 @@
m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
}
+void
+LteUePhy::DoSetSrsConfigurationIndex (uint16_t srcCi)
+{
+ NS_LOG_FUNCTION (this << srcCi);
+ m_srsPeriodicity = GetSrsPeriodicity (srcCi);
+ m_srsCounter = GetSrsSubframeOffset (srcCi) + 1;
+ NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << GetSrsSubframeOffset (srcCi) << " cellId " << m_cellId << " CI " << srcCi);
+}
+
void
LteUePhy::SetTxMode1Gain (double gain)
--- a/src/lte/model/lte-ue-phy.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-phy.h Thu Jul 19 13:02:41 2012 +0200
@@ -26,7 +26,7 @@
#include <ns3/lte-phy.h>
#include <ns3/ff-mac-common.h>
-#include <ns3/ideal-control-messages.h>
+#include <ns3/lte-control-messages.h>
#include <ns3/lte-amc.h>
#include <ns3/lte-ue-phy-sap.h>
#include <ns3/ptr.h>
@@ -151,17 +151,19 @@
* the physical layer with the signal received from eNB
* \param sinr SINR values vector
*/
- Ptr<DlCqiIdealControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
+ Ptr<DlCqiLteControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
// inherited from LtePhy
- virtual void GenerateCqiReport (const SpectrumValue& sinr);
+ virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+ virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
- virtual void DoSendIdealControlMessage (Ptr<IdealControlMessage> msg);
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
+ virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
virtual void DoSetTransmissionMode (uint8_t txMode);
+ virtual void DoSetSrsConfigurationIndex (uint16_t srcCi);
@@ -195,6 +197,12 @@
*/
void SetEnbCellId (uint16_t cellId);
+ /**
+ * \brief Send the SRS signal in the last symbols of the frame
+ */
+ void SendSrs ();
+
+
private:
@@ -235,6 +243,9 @@
uint8_t m_transmissionMode;
std::vector <double> m_txModeGain;
+
+ uint16_t m_srsPeriodicity;
+ uint16_t m_srsCounter;
};
--- a/src/lte/model/lte-ue-rrc.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/lte-ue-rrc.cc Thu Jul 19 13:02:41 2012 +0200
@@ -138,7 +138,7 @@
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("C-RNTI",
"Cell Radio Network Temporary Identifier",
- UintegerValue (1),
+ UintegerValue (0),
MakeUintegerAccessor (&LteUeRrc::m_rnti),
MakeUintegerChecker<uint16_t> ())
;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-vendor-specific-parameters.cc Thu Jul 19 13:02:41 2012 +0200
@@ -0,0 +1,46 @@
+/* -*- 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/lte-vendor-specific-parameters.h>
+#include <ns3/log.h>
+
+NS_LOG_COMPONENT_DEFINE ("LteVendorSpecificParameters");
+
+namespace ns3 {
+
+SrsCqiRntiVsp::SrsCqiRntiVsp (uint16_t rnti)
+: m_rnti (rnti)
+{
+
+}
+
+SrsCqiRntiVsp::~SrsCqiRntiVsp ()
+{
+
+}
+
+uint16_t
+SrsCqiRntiVsp::GetRnti ()
+{
+ return (m_rnti);
+}
+
+
+}; // namespace ns3
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/model/lte-vendor-specific-parameters.h Thu Jul 19 13:02:41 2012 +0200
@@ -0,0 +1,52 @@
+/* -*- 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 LTE_VENDOR_SPECIFIC_PARAMETERS
+#define LTE_VENDOR_SPECIFIC_PARAMETERS
+
+#include <ns3/ff-mac-common.h>
+
+
+#define SRS_CQI_RNTI_VSP 1
+
+
+namespace ns3 {
+
+/**
+* \brief Define the RNTI that has generated the
+*/
+class SrsCqiRntiVsp : public VendorSpecificValue
+{
+ public:
+ SrsCqiRntiVsp (uint16_t rnti);
+ virtual ~SrsCqiRntiVsp ();
+
+ uint16_t GetRnti ();
+
+ private:
+ uint16_t m_rnti;
+};
+
+
+
+}; // namespace ns3
+
+#endif /* LTE_VENDOR_SPECIFIC_PARAMETERS */
+
--- a/src/lte/model/pf-ff-mac-scheduler.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/pf-ff-mac-scheduler.cc Thu Jul 19 13:02:41 2012 +0200
@@ -28,6 +28,7 @@
#include <ns3/simulator.h>
#include <ns3/lte-amc.h>
#include <ns3/pf-ff-mac-scheduler.h>
+#include <ns3/lte-vendor-specific-parameters.h>
NS_LOG_COMPONENT_DEFINE ("PfFfMacScheduler");
@@ -294,14 +295,13 @@
NS_LOG_FUNCTION (this << " RNTI " << params.m_rnti << " txMode " << (uint16_t)params.m_transmissionMode);
std::map <uint16_t,uint8_t>::iterator it = m_uesTxMode.find (params.m_rnti);
if (it==m_uesTxMode.end ())
- {
- m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
- }
+ {
+ m_uesTxMode.insert (std::pair <uint16_t, double> (params.m_rnti, params.m_transmissionMode));
+ }
else
- {
- (*it).second = params.m_transmissionMode;
- }
- return;
+ {
+ (*it).second = params.m_transmissionMode;
+ }
return;
}
@@ -934,7 +934,7 @@
rbgAllocationMap.push_back ((*it).first);
}
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);
+ 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_ndi = 1;
uldci.m_cceIndex = 0;
@@ -1053,57 +1053,147 @@
NS_LOG_FUNCTION (this);
// NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// retrieve the allocation for this subframe
- std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
- std::map <uint16_t, std::vector <double> >::iterator itCqi;
- itMap = m_allocationMaps.find (params.m_sfnSf);
- if (itMap == m_allocationMaps.end ())
- {
- NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());
- return;
- }
- for (uint32_t i = 0; i < (*itMap).second.size (); i++)
+ switch (m_ulCqiFilter)
{
- // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
-// NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
- double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
- //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
- itCqi = m_ueCqi.find ((*itMap).second.at (i));
- if (itCqi == m_ueCqi.end ())
+ case FfMacScheduler::SRS_UL_CQI:
+ {
+ // filter all the CQIs that are not SRS based
+ if (params.m_ulCqi.m_type!=UlCqi_s::SRS)
+ {
+ return;
+ }
+ }
+ break;
+ case FfMacScheduler::PUSCH_UL_CQI:
{
- // create a new entry
- std::vector <double> newCqi;
+ // filter all the CQIs that are not SRS based
+ if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH)
+ {
+ return;
+ }
+ }
+ case FfMacScheduler::ALL_UL_CQI:
+ break;
+
+ default:
+ NS_FATAL_ERROR ("Unknown UL CQI type");
+ }
+
+ switch (params.m_ulCqi.m_type)
+ {
+ case UlCqi_s::PUSCH:
+ {
+ std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
+ std::map <uint16_t, std::vector <double> >::iterator itCqi;
+ itMap = m_allocationMaps.find (params.m_sfnSf);
+ if (itMap == m_allocationMaps.end ())
+ {
+ NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());
+ return;
+ }
+ for (uint32_t i = 0; i < (*itMap).second.size (); i++)
+ {
+ // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
+ // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
+ //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
+ itCqi = m_ueCqi.find ((*itMap).second.at (i));
+ if (itCqi == m_ueCqi.end ())
+ {
+ // create a new entry
+ std::vector <double> newCqi;
+ for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ {
+ if (i == j)
+ {
+ newCqi.push_back (sinr);
+ }
+ else
+ {
+ // initialize with NO_SINR value.
+ newCqi.push_back (NO_SINR);
+ }
+
+ }
+ m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
+ // generate correspondent timer
+ m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
+ }
+ else
+ {
+ // update the value
+ (*itCqi).second.at (i) = sinr;
+ // update correspondent timer
+ std::map <uint16_t, uint32_t>::iterator itTimers;
+ itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
+ (*itTimers).second = m_cqiTimersThreshold;
+
+ }
+
+ }
+ // remove obsolete info on allocation
+ m_allocationMaps.erase (itMap);
+ }
+ break;
+ case UlCqi_s::SRS:
+ {
+ // get the RNTI from vendor specific parameters
+ uint16_t rnti;
+ NS_ASSERT (params.m_vendorSpecificList.size () > 0);
+ for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
+ {
+ if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
+ {
+ Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
+ rnti = vsp->GetRnti ();
+ }
+ }
+ std::map <uint16_t, std::vector <double> >::iterator itCqi;
+ itCqi = m_ueCqi.find (rnti);
+ if (itCqi == m_ueCqi.end ())
+ {
+ // create a new entry
+ std::vector <double> newCqi;
+ for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ {
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
+ newCqi.push_back (sinr);
+ NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr);
+
+ }
+ m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
+ // generate correspondent timer
+ m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
+ }
+ else
+ {
+ // update the values
for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
{
- if (i == j)
- {
- newCqi.push_back (sinr);
- }
- else
- {
- // initialize with NO_SINR value.
- newCqi.push_back (NO_SINR);
- }
-
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
+ (*itCqi).second.at (j) = sinr;
+ NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr);
}
- m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
- // generate correspondent timer
- m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
- }
- else
- {
- // update the value
- (*itCqi).second.at (i) = sinr;
// update correspondent timer
std::map <uint16_t, uint32_t>::iterator itTimers;
- itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
+ itTimers = m_ueCqiTimers.find (rnti);
(*itTimers).second = m_cqiTimersThreshold;
}
-
- }
- // remove obsolete info on allocation
- m_allocationMaps.erase (itMap);
-
+
+
+ }
+ break;
+ case UlCqi_s::PUCCH_1:
+ case UlCqi_s::PUCCH_2:
+ case UlCqi_s::PRACH:
+ {
+ NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
+ }
+ break;
+ default:
+ NS_FATAL_ERROR ("Unknown type of UL-CQI");
+ }
return;
}
--- a/src/lte/model/rem-spectrum-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/rem-spectrum-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
+ * Modified by: Marco Miozzo <mmiozzo@cttc.es> convert to
+ * LteSpectrumSignalParametersDlCtrlFrame framework
*/
@@ -24,6 +26,7 @@
#include <ns3/double.h>
#include <ns3/simulator.h>
#include <ns3/trace-source-accessor.h>
+#include <ns3/lte-spectrum-signal-parameters.h>
#include <ns3/antenna-model.h>
#include "rem-spectrum-phy.h"
@@ -119,15 +122,19 @@
RemSpectrumPhy::StartRx (Ptr<SpectrumSignalParameters> params)
{
NS_LOG_FUNCTION ( this << params);
+
if (m_active)
- {
- double power = Integral (*(params->psd));
- NS_ASSERT_MSG (params->duration.GetMilliSeconds () == 1,
- "RemSpectrumPhy works only for LTE signals with duration of 1 ms");
- m_sumPower += power;
- if (power > m_referenceSignalPower)
+ {
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> lteDlCtrlRxParams = DynamicCast<LteSpectrumSignalParametersDlCtrlFrame> (params);
+ if (lteDlCtrlRxParams!=0)
{
- m_referenceSignalPower = power;
+ double power = Integral (*(params->psd));
+
+ m_sumPower += power;
+ if (power > m_referenceSignalPower)
+ {
+ m_referenceSignalPower = power;
+ }
}
}
}
--- a/src/lte/model/rr-ff-mac-scheduler.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/model/rr-ff-mac-scheduler.cc Thu Jul 19 13:02:41 2012 +0200
@@ -29,6 +29,7 @@
#include <ns3/rr-ff-mac-scheduler.h>
#include <ns3/simulator.h>
#include <ns3/lte-common.h>
+#include <ns3/lte-vendor-specific-parameters.h>
NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler");
@@ -539,7 +540,7 @@
// int totRbg = lcNum * rbgPerFlow;
// totRbg = rbgNum / nTbs;
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 " << rbgAllocated * rbgSize << "..." << (rbgAllocated* rbgSize) + (rbgPerTb * rbgSize) - 1 << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " layers " << nLayer);
+ NS_LOG_DEBUG (this << " DL - Allocate user " << newEl.m_rnti << " LCs " << (uint16_t)(*itLcRnti).second << " bytes " << tbSize << " PRBs " << rbgAllocated * rbgSize << "..." << (rbgAllocated* rbgSize) + (rbgPerTb * rbgSize) - 1 << " mcs " << (uint16_t) newDci.m_mcs.at (0) << " layers " << nLayer);
uint16_t rlcPduSize = tbSize / lcNum;
for (int i = 0; i < lcNum ; i++)
{
@@ -855,56 +856,146 @@
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG (this << " RX SFNID " << params.m_sfnSf);
// NS_LOG_DEBUG (this << " Actual sfn " << frameNo << " sbfn " << subframeNo << " sfnSf " << sfnSf);
- // retrieve the allocation for this subframe
- std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
- std::map <uint16_t, std::vector <double> >::iterator itCqi;
- itMap = m_allocationMaps.find (params.m_sfnSf);
- if (itMap == m_allocationMaps.end ())
+ switch (m_ulCqiFilter)
{
- NS_LOG_DEBUG (this << " Does not find info on allocation");
- return;
+ case FfMacScheduler::SRS_UL_CQI:
+ {
+ // filter all the CQIs that are not SRS based
+ if (params.m_ulCqi.m_type!=UlCqi_s::SRS)
+ {
+ return;
+ }
+ }
+ break;
+ case FfMacScheduler::PUSCH_UL_CQI:
+ {
+ // filter all the CQIs that are not SRS based
+ if (params.m_ulCqi.m_type!=UlCqi_s::PUSCH)
+ {
+ return;
+ }
+ }
+ case FfMacScheduler::ALL_UL_CQI:
+ break;
+
+ default:
+ NS_FATAL_ERROR ("Unknown UL CQI type");
}
- for (uint32_t i = 0; i < (*itMap).second.size (); i++)
+ switch (params.m_ulCqi.m_type)
{
- // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
- double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
-// NS_LOG_DEBUG (this << " RB " << i << "UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
- itCqi = m_ueCqi.find ((*itMap).second.at (i));
- if (itCqi == m_ueCqi.end ())
+ case UlCqi_s::PUSCH:
{
- // create a new entry
- std::vector <double> newCqi;
- for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ std::map <uint16_t, std::vector <uint16_t> >::iterator itMap;
+ std::map <uint16_t, std::vector <double> >::iterator itCqi;
+ itMap = m_allocationMaps.find (params.m_sfnSf);
+ if (itMap == m_allocationMaps.end ())
+ {
+ NS_LOG_DEBUG (this << " Does not find info on allocation, size : " << m_allocationMaps.size ());
+ return;
+ }
+ for (uint32_t i = 0; i < (*itMap).second.size (); i++)
{
- if (i == j)
+ // convert from fixed point notation Sxxxxxxxxxxx.xxx to double
+ // NS_LOG_INFO (this << " i " << i << " size " << params.m_ulCqi.m_sinr.size () << " mapSIze " << (*itMap).second.size ());
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (i));
+ //NS_LOG_DEBUG (this << " UE " << (*itMap).second.at (i) << " SINRfp " << params.m_ulCqi.m_sinr.at (i) << " sinrdb " << sinr);
+ itCqi = m_ueCqi.find ((*itMap).second.at (i));
+ if (itCqi == m_ueCqi.end ())
{
- newCqi.push_back (sinr);
+ // create a new entry
+ std::vector <double> newCqi;
+ for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ {
+ if (i == j)
+ {
+ newCqi.push_back (sinr);
+ }
+ else
+ {
+ // initialize with NO_SINR value.
+ newCqi.push_back (30.0);
+ }
+
+ }
+ m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
+ // generate correspondent timer
+ m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
}
else
{
- // initialize with maximum value according to the fixed point notation
- newCqi.push_back (30.0);
+ // update the value
+ (*itCqi).second.at (i) = sinr;
+ // update correspondent timer
+ std::map <uint16_t, uint32_t>::iterator itTimers;
+ itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
+ (*itTimers).second = m_cqiTimersThreshold;
+
}
-
+
}
- m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > ((*itMap).second.at (i), newCqi));
- // generate correspondent timer
- m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > ((*itMap).second.at (i), m_cqiTimersThreshold));
+ // remove obsolete info on allocation
+ m_allocationMaps.erase (itMap);
}
- else
+ break;
+ case UlCqi_s::SRS:
{
- // update the value
- (*itCqi).second.at (i) = sinr;
- // update correspondent timer
- std::map <uint16_t, uint32_t>::iterator itTimers;
- itTimers = m_ueCqiTimers.find ((*itMap).second.at (i));
- (*itTimers).second = m_cqiTimersThreshold;
+ // get the RNTI from vendor specific parameters
+ uint16_t rnti;
+ NS_ASSERT (params.m_vendorSpecificList.size () > 0);
+ for (uint16_t i = 0; i < params.m_vendorSpecificList.size (); i++)
+ {
+ if (params.m_vendorSpecificList.at (i).m_type == SRS_CQI_RNTI_VSP)
+ {
+ Ptr<SrsCqiRntiVsp> vsp = DynamicCast<SrsCqiRntiVsp> (params.m_vendorSpecificList.at (i).m_value);
+ rnti = vsp->GetRnti ();
+ }
+ }
+ std::map <uint16_t, std::vector <double> >::iterator itCqi;
+ itCqi = m_ueCqi.find (rnti);
+ if (itCqi == m_ueCqi.end ())
+ {
+ // create a new entry
+ std::vector <double> newCqi;
+ for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ {
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
+ newCqi.push_back (sinr);
+ NS_LOG_DEBUG (this << " RNTI " << rnti << " new SRS-CQI for RB " << j << " value " << sinr);
+
+ }
+ m_ueCqi.insert (std::pair <uint16_t, std::vector <double> > (rnti, newCqi));
+ // generate correspondent timer
+ m_ueCqiTimers.insert (std::pair <uint16_t, uint32_t > (rnti, m_cqiTimersThreshold));
+ }
+ else
+ {
+ // update the values
+ for (uint32_t j = 0; j < m_cschedCellConfig.m_ulBandwidth; j++)
+ {
+ double sinr = LteFfConverter::fpS11dot3toDouble (params.m_ulCqi.m_sinr.at (j));
+ (*itCqi).second.at (j) = sinr;
+ NS_LOG_DEBUG (this << " RNTI " << rnti << " update SRS-CQI for RB " << j << " value " << sinr);
+ }
+ // update correspondent timer
+ std::map <uint16_t, uint32_t>::iterator itTimers;
+ itTimers = m_ueCqiTimers.find (rnti);
+ (*itTimers).second = m_cqiTimersThreshold;
+
+ }
+
+
}
-
+ break;
+ case UlCqi_s::PUCCH_1:
+ case UlCqi_s::PUCCH_2:
+ case UlCqi_s::PRACH:
+ {
+ NS_FATAL_ERROR ("PfFfMacScheduler supports only PUSCH and SRS UL-CQIs");
+ }
+ break;
+ default:
+ NS_FATAL_ERROR ("Unknown type of UL-CQI");
}
- // remove obsolete info on allocation
- m_allocationMaps.erase (itMap);
-
return;
}
--- a/src/lte/test/lte-test-downlink-sinr.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-downlink-sinr.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ * Extend to Data and Ctrl frames
*/
#include "ns3/simulator.h"
@@ -23,14 +25,15 @@
#include "ns3/log.h"
#include "ns3/spectrum-test.h"
-
+#include "ns3/boolean.h"
#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-sinr-chunk-processor.h"
+#include "ns3/lte-test-ue-phy.h"
+#include "ns3/lte-test-sinr-chunk-processor.h"
#include "ns3/lte-spectrum-signal-parameters.h"
-#include "lte-test-downlink-sinr.h"
-#include "lte-test-ue-phy.h"
-
+#include "ns3/lte-test-downlink-sinr.h"
+#include <ns3/lte-control-messages.h>
+#include "ns3/lte-helper.h"
NS_LOG_COMPONENT_DEFINE ("LteDownlinkSinrTest");
@@ -79,7 +82,8 @@
(*theoreticalSinr1)[0] = 3.72589167251055;
(*theoreticalSinr1)[1] = 3.72255684126076;
- AddTestCase (new LteDownlinkSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
+ AddTestCase (new LteDownlinkDataSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
+ AddTestCase (new LteDownlinkCtrlSinrTestCase (rxPsd1, theoreticalSinr1, "sdBm = [-46 -48]"));
/**
* TX signal #2: Power Spectral Density (W/Hz) of the signal of interest = [-63 -61] dBm and BW = [20 22] MHz
@@ -92,7 +96,9 @@
(*theoreticalSinr2)[0] = 0.0743413124381667;
(*theoreticalSinr2)[1] = 0.1865697965291756;
- AddTestCase (new LteDownlinkSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+ AddTestCase (new LteDownlinkDataSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+ AddTestCase (new LteDownlinkCtrlSinrTestCase (rxPsd2, theoreticalSinr2, "sdBm = [-63 -61]"));
+
}
@@ -100,11 +106,11 @@
/**
- * TestCase
+ * TestCase Data
*/
-LteDownlinkSinrTestCase::LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
- : TestCase ("SINR calculation in downlink: " + name),
+LteDownlinkDataSinrTestCase::LteDownlinkDataSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
+ : TestCase ("SINR calculation in downlink Data frame: " + name),
m_sv (sv),
m_sm (sv->GetSpectrumModel ()),
m_sinr (sinr)
@@ -112,30 +118,33 @@
NS_LOG_INFO ("Creating LenaDownlinkSinrTestCase");
}
-LteDownlinkSinrTestCase::~LteDownlinkSinrTestCase ()
+LteDownlinkDataSinrTestCase::~LteDownlinkDataSinrTestCase ()
{
}
void
-LteDownlinkSinrTestCase::DoRun (void)
+LteDownlinkDataSinrTestCase::DoRun (void)
{
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
/**
* Instantiate a single receiving LteSpectrumPhy
*/
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
-
- dlPhy->SetCellId (100);
+ uint16_t cellId = 100;
+ dlPhy->SetCellId (cellId);
+ ulPhy->SetCellId (cellId);
- Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
- dlPhy->AddSinrChunkProcessor (chunkProcessor);
+ Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+ dlPhy->AddDataSinrChunkProcessor (chunkProcessor);
/**
- * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals.
- * One will be the signal of interest, i.e., the PhyTag of the first Packet in the Packet burst
- * will have the same CellId of the receiving PHY;
- * the others will have a different CellId and hence will be the interfering signals
+ * Generate several calls to LteSpectrumPhy::StartRx corresponding to
+ * several signals. One will be the signal of interest, i.e., the
+ * LteSpectrumSignalParametersDataFrame of the Packet burst
+ * will have the same CellId of the receiving PHY; the others will have
+ * a different CellId and hence will be the interfering signals
*/
// Number of packet bursts (1 data + 4 interferences)
@@ -149,9 +158,9 @@
// Packets
Ptr<Packet> pkt[numOfPbs][numOfPkts];
-
- // Phy tags
- LtePhyTag pktTag[numOfPbs];
+
+ // Packet bursts cellId
+ uint16_t pbCellId[numOfPbs];
/**
* Build packet burst
@@ -160,20 +169,13 @@
{
// Create packet burst
packetBursts[pb] = CreateObject<PacketBurst> ();
+ pbCellId[pb] = cellId * (pb + 1);
// Create packets and add them to the burst
for ( int i = 0 ; i < numOfPkts ; i++ )
{
pkt[pb][i] = Create<Packet> (1000);
- if ( i == 0 )
- {
- // Create phy tag (different for each packet burst)
- // and add to the first packet
- pktTag[pb] = LtePhyTag (100 * (pb + 1));
- pkt[pb][i]->AddPacketTag ( pktTag[pb] );
- }
-
packetBursts[pb]->AddPacket ( pkt[pb][i] );
}
}
@@ -215,40 +217,45 @@
*/
// eNB sends data to 2 UEs through 2 subcarriers
- Ptr<LteSpectrumSignalParameters> sp1 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> sp1 = Create<LteSpectrumSignalParametersDataFrame> ();
sp1->psd = m_sv;
sp1->txPhy = 0;
sp1->duration = ds;
sp1->packetBurst = packetBursts[0];
+ sp1->cellId = pbCellId[0];
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
- Ptr<LteSpectrumSignalParameters> ip1 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip1 = Create<LteSpectrumSignalParametersDataFrame> ();
ip1->psd = i1;
ip1->txPhy = 0;
ip1->duration = di1;
ip1->packetBurst = packetBursts[1];
+ ip1->cellId = pbCellId[1];
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
- Ptr<LteSpectrumSignalParameters> ip2 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip2 = Create<LteSpectrumSignalParametersDataFrame> ();
ip2->psd = i2;
ip2->txPhy = 0;
ip2->duration = di2;
ip2->packetBurst = packetBursts[2];
+ ip2->cellId = pbCellId[2];
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
- Ptr<LteSpectrumSignalParameters> ip3 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip3 = Create<LteSpectrumSignalParametersDataFrame> ();
ip3->psd = i3;
ip3->txPhy = 0;
ip3->duration = di3;
ip3->packetBurst = packetBursts[3];
+ ip3->cellId = pbCellId[3];
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
- Ptr<LteSpectrumSignalParameters> ip4 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip4 = Create<LteSpectrumSignalParametersDataFrame> ();
ip4->psd = i4;
ip4->txPhy = 0;
ip4->duration = di4;
ip4->packetBurst = packetBursts[4];
+ ip4->cellId = pbCellId[4];
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
Simulator::Stop (Seconds (5.0));
@@ -258,15 +265,182 @@
* Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
* to known values which have been calculated offline (with octave) for the generated signals
*/
- SpectrumValue calculatedSinr = uePhy->GetSinr ();
+ Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
- NS_LOG_INFO ("Theoretical SINR: " << *m_sinr);
- NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
+ NS_LOG_INFO ("Data Frame - Theoretical SINR: " << *m_sinr);
+ NS_LOG_INFO ("Data Frame - Calculated SINR: " << *calculatedSinr);
- NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+ NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
dlPhy->Dispose ();
Simulator::Destroy ();
}
-} // namespace ns3
+
+
+/**
+* TestCase CTRL
+*/
+
+LteDownlinkCtrlSinrTestCase::LteDownlinkCtrlSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name)
+: TestCase ("SINR calculation in downlink Ctrl Frame: " + name),
+m_sv (sv),
+m_sm (sv->GetSpectrumModel ()),
+m_sinr (sinr)
+{
+ NS_LOG_INFO ("Creating LenaDownlinkCtrlSinrTestCase");
+}
+
+LteDownlinkCtrlSinrTestCase::~LteDownlinkCtrlSinrTestCase ()
+{
+}
+void
+LteDownlinkCtrlSinrTestCase::DoRun (void)
+{
+ /**
+ * Instantiate a single receiving LteSpectrumPhy
+ */
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
+ Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
+ Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
+ uint16_t cellId = 100;
+ dlPhy->SetCellId (cellId);
+ ulPhy->SetCellId (cellId);
+
+ Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+ dlPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
+
+ /**
+ * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals. One will be the signal of interest, i.e., the
+ * LteSpectrumSignalParametersDlCtrlFrame of the first signal will have the
+ * same CellId of the receiving PHY; the others will have a different
+ * CellId and hence will be the interfering signals
+ */
+
+ // Number of ctrl bursts (1 data + 4 interferences)
+ int numOfUes = 5;
+
+ // Number of control messages in the list
+ int numOfCtrlMsgs = 10;
+
+ // control messages in the list
+ std::list<Ptr<LteControlMessage> > ctrlMsgList[numOfUes];
+
+ // signals cellId
+ uint16_t pbCellId[numOfUes];
+
+ /**
+ * Build ctrl msg lists
+ */
+ for ( int pb = 0 ; pb < numOfUes ; pb++ )
+ {
+ pbCellId[pb] = cellId * (pb + 1);
+
+ // Create ctrl msg and add them to the list
+ for ( int i = 0 ; i < numOfCtrlMsgs ; i++ )
+ {
+ Ptr<DlDciLteControlMessage> msg = Create<DlDciLteControlMessage> ();
+ DlDciListElement_s dci;
+ msg->SetDci (dci);
+ ctrlMsgList[pb].push_back (msg);
+ }
+ }
+
+
+ Ptr<SpectrumValue> noisePsd = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i1 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i2 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i3 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i4 = Create<SpectrumValue> (m_sm);
+
+ (*noisePsd)[0] = 5.000000000000e-19;
+ (*noisePsd)[1] = 4.545454545455e-19;
+
+ (*i1)[0] = 5.000000000000e-18;
+ (*i2)[0] = 5.000000000000e-16;
+ (*i3)[0] = 1.581138830084e-16;
+ (*i4)[0] = 7.924465962306e-17;
+ (*i1)[1] = 1.437398936440e-18;
+ (*i2)[1] = 5.722388235428e-16;
+ (*i3)[1] = 7.204059965732e-17;
+ (*i4)[1] = 5.722388235428e-17;
+
+ Time ts = Seconds (1);
+ Time ds = Seconds (1);
+ Time ti1 = Seconds (0);
+ Time di1 = Seconds (3);
+ Time ti2 = Seconds (0.7);
+ Time di2 = Seconds (1);
+ Time ti3 = Seconds (1.2);
+ Time di3 = Seconds (1);
+ Time ti4 = Seconds (1.5);
+ Time di4 = Seconds (0.1);
+
+ dlPhy->SetNoisePowerSpectralDensity (noisePsd);
+
+ /**
+ * Schedule the reception of the data signal plus the interference signals
+ */
+
+ // eNB sends data to 2 UEs through 2 subcarriers
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> sp1 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ sp1->psd = m_sv;
+ sp1->txPhy = 0;
+ sp1->duration = ds;
+ sp1->ctrlMsgList = ctrlMsgList[0];
+ sp1->cellId = pbCellId[0];
+ Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, dlPhy, sp1);
+
+
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip1 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ ip1->psd = i1;
+ ip1->txPhy = 0;
+ ip1->duration = di1;
+ ip1->ctrlMsgList = ctrlMsgList[1];
+ ip1->cellId = pbCellId[1];
+ Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, dlPhy, ip1);
+
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip2 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ ip2->psd = i2;
+ ip2->txPhy = 0;
+ ip2->duration = di2;
+ ip2->ctrlMsgList = ctrlMsgList[2];
+ ip2->cellId = pbCellId[2];
+ Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, dlPhy, ip2);
+
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip3 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ ip3->psd = i3;
+ ip3->txPhy = 0;
+ ip3->duration = di3;
+ ip3->ctrlMsgList = ctrlMsgList[3];
+ ip3->cellId = pbCellId[3];
+ Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, dlPhy, ip3);
+
+ Ptr<LteSpectrumSignalParametersDlCtrlFrame> ip4 = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
+ ip4->psd = i4;
+ ip4->txPhy = 0;
+ ip4->duration = di4;
+ ip4->ctrlMsgList = ctrlMsgList[4];
+ ip4->cellId = pbCellId[4];
+ Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, dlPhy, ip4);
+
+ Simulator::Stop (Seconds (5.0));
+ Simulator::Run ();
+
+ /**
+ * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
+ * to known values which have been calculated offline (with octave) for the generated signals
+ */
+ Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
+
+ NS_LOG_INFO ("Ctrl Frame - Theoretical SINR: " << *m_sinr);
+ NS_LOG_INFO ("Ctrl Frame - Calculated SINR: " << *calculatedSinr);
+
+ NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
+ dlPhy->Dispose ();
+ Simulator::Destroy ();
+}
+
+
+} // namespace
\ No newline at end of file
--- a/src/lte/test/lte-test-downlink-sinr.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-downlink-sinr.h Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ * Extend to Data and Ctrl frames
*/
#ifndef LTE_TEST_DOWNLINK_SINR_H
@@ -39,11 +41,11 @@
};
-class LteDownlinkSinrTestCase : public TestCase
+class LteDownlinkDataSinrTestCase : public TestCase
{
public:
- LteDownlinkSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
- virtual ~LteDownlinkSinrTestCase ();
+ LteDownlinkDataSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
+ virtual ~LteDownlinkDataSinrTestCase ();
private:
virtual void DoRun (void);
@@ -54,6 +56,19 @@
};
+class LteDownlinkCtrlSinrTestCase : public TestCase
+{
+ public:
+ LteDownlinkCtrlSinrTestCase (Ptr<SpectrumValue> sv, Ptr<SpectrumValue> sinr, std::string name);
+ virtual ~LteDownlinkCtrlSinrTestCase ();
+
+ private:
+ virtual void DoRun (void);
+
+ Ptr<SpectrumValue> m_sv;
+ Ptr<const SpectrumModel> m_sm;
+ Ptr<SpectrumValue> m_sinr;
+};
} // namespace ns3
--- a/src/lte/test/lte-test-interference.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-interference.cc Thu Jul 19 13:02:41 2012 +0200
@@ -24,9 +24,10 @@
#include "ns3/string.h"
#include "ns3/double.h"
#include <ns3/enum.h>
-
+#include "ns3/boolean.h"
#include "ns3/mobility-helper.h"
#include "ns3/lte-helper.h"
+#include "ns3/ff-mac-scheduler.h"
#include "ns3/lte-enb-phy.h"
#include "ns3/lte-enb-net-device.h"
@@ -113,6 +114,8 @@
void
LteInterferenceTestCase::DoRun (void)
{
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
@@ -153,6 +156,7 @@
NetDeviceContainer ueDevs1;
NetDeviceContainer ueDevs2;
lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler");
+ lteHelper->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI));
enbDevs = lteHelper->InstallEnbDevice (enbNodes);
ueDevs1 = lteHelper->InstallUeDevice (ueNodes1);
ueDevs2 = lteHelper->InstallUeDevice (ueNodes2);
@@ -172,11 +176,11 @@
Ptr<LtePhy> ue1Phy = ueDevs1.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testDlSinr1 = Create<LteTestSinrChunkProcessor> (ue1Phy);
- ue1Phy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr1);
+ ue1Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr1);
Ptr<LtePhy> enb1phy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testUlSinr1 = Create<LteTestSinrChunkProcessor> (enb1phy);
- enb1phy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr1);
+ enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr1);
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback (&LteTestDlSchedulingCallback, this));
@@ -189,11 +193,11 @@
Ptr<LtePhy> ue2Phy = ueDevs2.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testDlSinr2 = Create<LteTestSinrChunkProcessor> (ue2Phy);
- ue2Phy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr2);
+ ue2Phy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr2);
Ptr<LtePhy> enb2phy = enbDevs.Get (1)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testUlSinr2 = Create<LteTestSinrChunkProcessor> (enb2phy);
- enb1phy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr2);
+ enb1phy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr2);
Config::Connect ("/NodeList/1/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback (&LteTestDlSchedulingCallback, this));
@@ -247,7 +251,7 @@
* For first 5 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* because CQI feedback is still not available at the eNB.
*/
- if ( (frameNo > 1) && (subframeNo > 4) )
+ if ( (frameNo > 1) && (subframeNo > 6) )
{
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
}
--- a/src/lte/test/lte-test-link-adaptation.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-link-adaptation.cc Thu Jul 19 13:02:41 2012 +0200
@@ -201,7 +201,7 @@
// It will be used to test that the SNR is as intended
Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
- uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
+ uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testSinr);
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
MakeBoundCallback (&LteTestDlSchedulingCallback, this));
--- a/src/lte/test/lte-test-pathloss-model.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-pathloss-model.cc Thu Jul 19 13:02:41 2012 +0200
@@ -272,7 +272,7 @@
// It will be used to test that the SNR is as intended
//Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testSinr = Create<LteTestSinrChunkProcessor> (uePhy);
- uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testSinr);
+ uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testSinr);
// Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling",
// MakeBoundCallback (&LteTestPathlossDlSchedCallback, this));
--- a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc Thu Jul 19 13:02:41 2012 +0200
@@ -209,8 +209,8 @@
{
Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
- Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
- LogComponentDisableAll (LOG_LEVEL_ALL);
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); LogComponentDisableAll (LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
--- a/src/lte/test/lte-test-phy-error-model.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-phy-error-model.cc Thu Jul 19 13:02:41 2012 +0200
@@ -46,6 +46,7 @@
#include <ns3/boolean.h>
#include <ns3/enum.h>
#include <ns3/unused.h>
+#include <ns3/ff-mac-scheduler.h>
#include "lte-test-phy-error-model.h"
@@ -58,20 +59,32 @@
: TestSuite ("lte-phy-error-model", SYSTEM)
{
NS_LOG_INFO ("creating LenaTestPhyErrorModelTestCase");
+
+
+ // Tests on DL Control Channels (PCFICH+PDDCH)
+ // 1 interfering eNB SINR -2.0 BER 0.007 TB size 217
+ AddTestCase (new LenaDlCtrlPhyErrorModelTestCase (2, 1078, 217, 0.007));
+ // 2 interfering eNBs SINR -4.0 BER 0.037 TB size 217
+ AddTestCase (new LenaDlCtrlPhyErrorModelTestCase (3, 1040, 217, 0.045));
+ // 3 interfering eNBs SINR -6.0 BER 0.21 TB size 133
+ AddTestCase (new LenaDlCtrlPhyErrorModelTestCase (4, 1250, 133, 0.206));
+ // 4 interfering eNBs SINR -7.0 BER 0.34 TB size 133
+ AddTestCase (new LenaDlCtrlPhyErrorModelTestCase (5, 1260, 81, 0.343));
+ // Tests on DL/UL Data channels (PDSCH, PUSCH)
// MCS 2 TB size of 256 bits BER 0.33 SINR -5.51
- AddTestCase (new LenaPhyErrorModelTestCase (4, 1800, 32, 0.35, 50));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (4, 1800, 32, 0.35, 50));
// MCS 2 TB size of 528 bits BER 0.11 SINR -5.51
- AddTestCase (new LenaPhyErrorModelTestCase (2, 1800, 66, 0.11, 34));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (2, 1800, 66, 0.11, 34));
// MCS 2 TB size of 1088 bits BER 0.02 SINR -5.51
- AddTestCase (new LenaPhyErrorModelTestCase (1, 1800, 136, 0.02, 16));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (1, 1800, 136, 0.02, 16));
// MCS 12 TB size of 4800 bits BER 0.3 SINR 4.43
- AddTestCase (new LenaPhyErrorModelTestCase (1, 600, 600, 0.3, 48));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (1, 600, 600, 0.3, 48));
// MCS 12 TB size of 1632 bits BER 0.55 SINR 4.43
- AddTestCase (new LenaPhyErrorModelTestCase (3, 600, 204, 0.55, 52));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (3, 600, 204, 0.55, 52));
// MCS 16 TB size of 7272 bits (3648 x 3584) BER 0.14 SINR 8.48
// BER 0.14 = 1 - ((1-0.075)*(1-0.075))
- AddTestCase (new LenaPhyErrorModelTestCase (1, 470, 781, 0.14, 29));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (1, 470, 781, 0.14, 29));
@@ -80,14 +93,14 @@
static LenaTestPhyErrorModelrSuite lenaTestPhyErrorModelrSuite;
std::string
-LenaPhyErrorModelTestCase::BuildNameString (uint16_t nUser, uint16_t dist)
+LenaDataPhyErrorModelTestCase::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)
+LenaDataPhyErrorModelTestCase::LenaDataPhyErrorModelTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double berRef, uint16_t bernQuantile)
: TestCase (BuildNameString (nUser, dist)),
m_nUser (nUser),
m_dist (dist),
@@ -97,19 +110,19 @@
{
}
-LenaPhyErrorModelTestCase::~LenaPhyErrorModelTestCase ()
+LenaDataPhyErrorModelTestCase::~LenaDataPhyErrorModelTestCase ()
{
}
void
-LenaPhyErrorModelTestCase::DoRun (void)
+LenaDataPhyErrorModelTestCase::DoRun (void)
{
double ber = 0.03;
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (ber));
Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
- Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (true));
-
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true));
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
// LogComponentEnable ("LteUeRrc", LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL);
@@ -151,7 +164,7 @@
// LogComponentEnable ("LteAmc", LOG_LEVEL_ALL);
//
LogComponentDisableAll (LOG_LEVEL_ALL);
-
+
LogComponentEnable ("LenaTestPhyErrorModel", LOG_LEVEL_ALL);
@@ -184,6 +197,7 @@
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
lena->SetSchedulerType ("ns3::RrFfMacScheduler");
+ lena->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI));
enbDevs = lena->InstallEnbDevice (enbNodes);
ueDevs = lena->InstallUeDevice (ueNodes);
@@ -218,6 +232,7 @@
lena->EnableRlcTraces ();
double simulationTime = 1.000;
+
Simulator::Stop (Seconds (simulationTime));
Ptr<RadioBearerStatsCalculator> rlcStats = lena->GetRlcStats ();
@@ -229,6 +244,7 @@
/**
* Check that the assignation is done in a RR fashion
*/
+ NS_LOG_INFO ("\tTest downlink/uplink data shared channels (PDSCH and PUSCH)");
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++)
@@ -257,6 +273,184 @@
Simulator::Destroy ();
}
-} // namespace ns3
+
+
+
+std::string
+LenaDlCtrlPhyErrorModelTestCase::BuildNameString (uint16_t nEnb, uint16_t dist)
+{
+ std::ostringstream oss;
+ oss << nEnb << " eNBs, distance " << dist << " m";
+ return oss.str ();
+}
+LenaDlCtrlPhyErrorModelTestCase::LenaDlCtrlPhyErrorModelTestCase (uint16_t nEnb, uint16_t dist, uint16_t tbSize, double berRef)
+: TestCase (BuildNameString (nEnb, dist)),
+m_nEnb (nEnb),
+m_dist (dist),
+m_tbSize (tbSize),
+m_berRef (berRef)
+{
+}
+
+LenaDlCtrlPhyErrorModelTestCase::~LenaDlCtrlPhyErrorModelTestCase ()
+{
+}
+
+void
+LenaDlCtrlPhyErrorModelTestCase::DoRun (void)
+{
+
+ double ber = 0.03;
+ Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (ber));
+ Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (true));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
+ // 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 (m_nEnb);
+ ueNodes.Create (1);
+
+ // 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::HybridBuildingsPropagationLossModel"));
+ 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");
+ lena->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI));
+
+ enbDevs = lena->InstallEnbDevice (enbNodes);
+ ueDevs = lena->InstallUeDevice (ueNodes);
+
+ // Attach a UE to one eNB (the others are interfering ones)
+ 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 ());
+
+ // Set UEs' position and power
+ for (int i = 0; i < m_nEnb; i++)
+ {
+ // place the HeNB over the default rooftop level (20 mt.)
+ Ptr<BuildingsMobilityModel> mm = enbNodes.Get (i)->GetObject<BuildingsMobilityModel> ();
+ mm->SetPosition (Vector (0.0, 0.0, 30.0));
+ Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (i)->GetObject<LteEnbNetDevice> ();
+ Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
+ enbPhy->SetAttribute ("TxPower", DoubleValue (43.0));
+ enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
+ }
+
+ // Set UEs' position and power
+ Ptr<BuildingsMobilityModel> mm = ueNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
+ mm->SetPosition (Vector (m_dist, 0.0, 1.0));
+ Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (0)->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 ("\tTest downlink control channels (PCFICH+PDCCH)");
+ NS_LOG_INFO ("Test with " << m_nEnb << " eNB(s) at distance " << m_dist << " expected BER " << m_berRef);
+ std::vector <uint64_t> dlDataRxed;
+ int nUser = 1;
+ for (int i = 0; i < 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);
+ double ber = 1.0 - ((double)dlDataRxed.at (i)/txed);
+ NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " txed " << txed
+ << " BER " << ber << " Err " << fabs (m_berRef - ber));
+ NS_UNUSED (ber);
+ NS_TEST_ASSERT_MSG_EQ_TOL (ber, m_berRef, 0.1, " Unexpected BER distribution!");
+ }
+
+
+ Simulator::Destroy ();
+}
+
+
+} // namespace
--- a/src/lte/test/lte-test-phy-error-model.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-phy-error-model.h Thu Jul 19 13:02:41 2012 +0200
@@ -35,11 +35,11 @@
* implemented obtained by using different SINR values and different numbers of
* UEs. The test consists on ...
*/
-class LenaPhyErrorModelTestCase : public TestCase
+class LenaDataPhyErrorModelTestCase : public TestCase
{
public:
- LenaPhyErrorModelTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double refBer, uint16_t bernQuantile);
- virtual ~LenaPhyErrorModelTestCase ();
+ LenaDataPhyErrorModelTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double refBer, uint16_t bernQuantile);
+ virtual ~LenaDataPhyErrorModelTestCase ();
private:
virtual void DoRun (void);
@@ -54,6 +54,24 @@
+class LenaDlCtrlPhyErrorModelTestCase : public TestCase
+{
+ public:
+ LenaDlCtrlPhyErrorModelTestCase (uint16_t nEnbr, uint16_t dist, uint16_t tbSize, double refBer);
+ virtual ~LenaDlCtrlPhyErrorModelTestCase ();
+
+ private:
+ virtual void DoRun (void);
+ static std::string BuildNameString (uint16_t nUser, uint16_t dist);
+ uint16_t m_nEnb;
+ uint16_t m_dist;
+ uint16_t m_tbSize;
+ double m_berRef;
+
+};
+
+
+
class LenaTestPhyErrorModelrSuite : public TestSuite
{
public:
--- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc Thu Jul 19 13:02:41 2012 +0200
@@ -191,8 +191,8 @@
void
LenaRrFfMacSchedulerTestCase::DoRun (void)
{
- Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
- Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.00005));
LogComponentDisableAll (LOG_LEVEL_ALL);
// LogComponentEnable ("LteEnbRrc", LOG_LEVEL_ALL);
--- a/src/lte/test/lte-test-sinr-chunk-processor.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-sinr-chunk-processor.cc Thu Jul 19 13:02:41 2012 +0200
@@ -84,6 +84,7 @@
{
NS_LOG_FUNCTION (this);
+ NS_ASSERT (m_sinr);
return m_sinr;
}
--- a/src/lte/test/lte-test-ue-phy.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-ue-phy.cc Thu Jul 19 13:02:41 2012 +0200
@@ -78,7 +78,7 @@
}
void
-LteTestUePhy::GenerateCqiReport (const SpectrumValue& sinr)
+LteTestUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
{
NS_LOG_FUNCTION (this);
@@ -87,7 +87,16 @@
}
void
-LteTestUePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
+LteTestUePhy::GenerateDataCqiReport (const SpectrumValue& sinr)
+{
+ NS_LOG_FUNCTION (this);
+
+ // Store calculated SINR, it will be retrieved at the end of the test
+ m_sinr = sinr;
+}
+
+void
+LteTestUePhy::ReceiveLteControlMessage (Ptr<LteControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
}
--- a/src/lte/test/lte-test-ue-phy.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-ue-phy.h Thu Jul 19 13:02:41 2012 +0200
@@ -23,7 +23,7 @@
#include "ns3/lte-phy.h"
-#include "ns3/ideal-control-messages.h"
+#include "ns3/lte-control-messages.h"
namespace ns3 {
@@ -58,9 +58,11 @@
*/
virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
- virtual void GenerateCqiReport (const SpectrumValue& sinr);
+ virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
+
+ virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
- virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
+ virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
SpectrumValue GetSinr ();
--- a/src/lte/test/lte-test-uplink-sinr.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-uplink-sinr.cc Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ * Extend to Data and SRS frames
*/
#include "ns3/simulator.h"
@@ -25,11 +27,13 @@
#include "ns3/spectrum-test.h"
#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-sinr-chunk-processor.h"
+#include "ns3/lte-test-ue-phy.h"
+#include "ns3/lte-test-sinr-chunk-processor.h"
#include "ns3/lte-spectrum-signal-parameters.h"
-#include "lte-test-ue-phy.h"
-#include "lte-test-uplink-sinr.h"
+#include "ns3/lte-test-uplink-sinr.h"
+
+#include <ns3/lte-helper.h>
NS_LOG_COMPONENT_DEFINE ("LteUplinkSinrTest");
@@ -81,7 +85,9 @@
(*theoreticalSinr1)[0] = 3.72589167251055;
(*theoreticalSinr1)[1] = 3.72255684126076;
- AddTestCase (new LteUplinkSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
+ AddTestCase (new LteUplinkDataSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
+
+ AddTestCase (new LteUplinkSrsSinrTestCase (rxPsd1, rxPsd2, theoreticalSinr1, "sdBm = [-46 -inf] and [-inf -48]"));
/**
* TX signals #2: Power Spectral Density of the signals of interest = [-63 -inf] and [-inf -61] dBm and BW = [20 22] MHz
@@ -98,7 +104,9 @@
(*theoreticalSinr2)[0] = 0.0743413124381667;
(*theoreticalSinr2)[1] = 0.1865697965291756;
- AddTestCase (new LteUplinkSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
+ AddTestCase (new LteUplinkDataSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
+
+ AddTestCase (new LteUplinkSrsSinrTestCase (rxPsd3, rxPsd4, theoreticalSinr2, "sdBm = [-63 -inf] and [-inf -61]"));
}
@@ -106,25 +114,25 @@
/**
- * TestCase
+ * TestCase Data
*/
-LteUplinkSinrTestCase::LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
- : TestCase ("SINR calculation in uplink: " + name),
+LteUplinkDataSinrTestCase::LteUplinkDataSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
+ : TestCase ("SINR calculation in uplink data frame: " + name),
m_sv1 (sv1),
m_sv2 (sv2),
m_sm (sv1->GetSpectrumModel ()),
m_sinr (sinr)
{
- NS_LOG_INFO ("Creating LteUplinkSinrTestCase");
+ NS_LOG_INFO ("Creating LteUplinkDataSinrTestCase");
}
-LteUplinkSinrTestCase::~LteUplinkSinrTestCase ()
+LteUplinkDataSinrTestCase::~LteUplinkDataSinrTestCase ()
{
}
void
-LteUplinkSinrTestCase::DoRun (void)
+LteUplinkDataSinrTestCase::DoRun (void)
{
/**
* Instantiate a single receiving LteSpectrumPhy
@@ -132,18 +140,20 @@
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
-
- ulPhy->SetCellId (100);
+ uint16_t cellId = 100;
+ dlPhy->SetCellId (cellId);
+ ulPhy->SetCellId (cellId);
- Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
- ulPhy->AddSinrChunkProcessor (chunkProcessor);
+ Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+ ulPhy->AddDataSinrChunkProcessor (chunkProcessor);
/**
- * Generate several calls to LteSpectrumPhy::StartRx corresponding to several signals.
- * One will be the signal of interest, i.e., the PhyTag of the first Packet in the Packet burst
- * will have the same CellId of the receiving PHY;
- * the others will have a different CellId and hence will be the interfering signals
- */
+ * Generate several calls to LteSpectrumPhy::StartRx corresponding to
+ * several signals. One will be the signal of interest, i.e., the
+ * LteSpectrumSignalParametersDataFrame of the Packet burst
+ * will have the same CellId of the receiving PHY; the others will have
+ * a different CellId and hence will be the interfering signals
+ */
// Number of packet bursts (2 data + 4 interferences)
int numOfDataPbs = 2;
@@ -159,8 +169,9 @@
// Packets
Ptr<Packet> pkt[numOfPbs][numOfPkts];
- // Phy tags
- LtePhyTag pktTag[numOfPbs];
+ // Bursts cellId
+ uint16_t pbCellId[numOfPbs];
+
/**
@@ -171,20 +182,12 @@
{
// Create packet burst
packetBursts[pb] = CreateObject<PacketBurst> ();
-
+ pbCellId[pb] = cellId;
// Create packets and add them to the burst
for ( int i = 0 ; i < numOfPkts ; i++ )
{
pkt[pb][i] = Create<Packet> (1000);
- if ( i == 0 )
- {
- // Create phy tag (same for all data packet burst)
- // and add to the first packet
- pktTag[pb] = LtePhyTag (100);
- pkt[pb][i]->AddPacketTag ( pktTag[pb] );
- }
-
packetBursts[pb]->AddPacket ( pkt[pb][i] );
}
}
@@ -192,20 +195,13 @@
{
// Create packet burst
packetBursts[pb] = CreateObject<PacketBurst> ();
+ pbCellId[pb] = cellId * (pb + 1);
// Create packets and add them to the burst
for ( int i = 0 ; i < numOfPkts ; i++ )
{
pkt[pb][i] = Create<Packet> (1000);
- if ( i == 0 )
- {
- // Create phy tag (different for each packet burst)
- // and add to the first packet
- pktTag[pb] = LtePhyTag (100 * (pb + 1));
- pkt[pb][i]->AddPacketTag ( pktTag[pb] );
- }
-
packetBursts[pb]->AddPacket ( pkt[pb][i] );
}
}
@@ -247,47 +243,53 @@
*/
// 2 UEs send data to the eNB through 2 subcarriers
- Ptr<LteSpectrumSignalParameters> sp1 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> sp1 = Create<LteSpectrumSignalParametersDataFrame> ();
sp1->psd = m_sv1;
sp1->txPhy = 0;
sp1->duration = ds;
sp1->packetBurst = packetBursts[0];
+ sp1->cellId = pbCellId[0];
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp1);
- Ptr<LteSpectrumSignalParameters> sp2 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> sp2 = Create<LteSpectrumSignalParametersDataFrame> ();
sp2->psd = m_sv2;
sp2->txPhy = 0;
sp2->duration = ds;
sp2->packetBurst = packetBursts[1];
+ sp2->cellId = pbCellId[1];
Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp2);
- Ptr<LteSpectrumSignalParameters> ip1 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip1 = Create<LteSpectrumSignalParametersDataFrame> ();
ip1->psd = i1;
ip1->txPhy = 0;
ip1->duration = di1;
ip1->packetBurst = packetBursts[2];
+ ip1->cellId = pbCellId[2];
Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, ip1);
- Ptr<LteSpectrumSignalParameters> ip2 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip2 = Create<LteSpectrumSignalParametersDataFrame> ();
ip2->psd = i2;
ip2->txPhy = 0;
ip2->duration = di2;
ip2->packetBurst = packetBursts[3];
+ ip2->cellId = pbCellId[3];
Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, ip2);
- Ptr<LteSpectrumSignalParameters> ip3 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip3 = Create<LteSpectrumSignalParametersDataFrame> ();
ip3->psd = i3;
ip3->txPhy = 0;
ip3->duration = di3;
ip3->packetBurst = packetBursts[4];
+ ip3->cellId = pbCellId[4];
Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, ip3);
- Ptr<LteSpectrumSignalParameters> ip4 = Create<LteSpectrumSignalParameters> ();
+ Ptr<LteSpectrumSignalParametersDataFrame> ip4 = Create<LteSpectrumSignalParametersDataFrame> ();
ip4->psd = i4;
ip4->txPhy = 0;
ip4->duration = di4;
ip4->packetBurst = packetBursts[5];
+ ip4->cellId = pbCellId[5];
Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, ip4);
Simulator::Stop (Seconds (5.0));
@@ -297,16 +299,185 @@
* Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
* to known values which have been calculated offline (with octave) for the generated signals
*/
- SpectrumValue calculatedSinr = uePhy->GetSinr ();
+ Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
- NS_LOG_INFO ("Theoretical SINR: " << *m_sinr);
- NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
+ NS_LOG_INFO ("Data Frame - Theoretical SINR: " << *m_sinr);
+ NS_LOG_INFO ("Data Frame - Calculated SINR: " << *calculatedSinr);
- NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
+ NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
ulPhy->Dispose ();
Simulator::Destroy ();
}
-} // namespace ns3
+
+/**
+* TestCase Srs
+*/
+
+LteUplinkSrsSinrTestCase::LteUplinkSrsSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name)
+: TestCase ("SINR calculation in uplink srs frame: " + name),
+m_sv1 (sv1),
+m_sv2 (sv2),
+m_sm (sv1->GetSpectrumModel ()),
+m_sinr (sinr)
+{
+ NS_LOG_INFO ("Creating LteUplinkSrsSinrTestCase");
+}
+
+LteUplinkSrsSinrTestCase::~LteUplinkSrsSinrTestCase ()
+{
+}
+
+void
+LteUplinkSrsSinrTestCase::DoRun (void)
+{
+ /**
+ * Instantiate a single receiving LteSpectrumPhy
+ */
+
+ Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
+ lteHelper->EnableLogComponents ();
+ Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
+ Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
+ Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
+ uint16_t cellId = 100;
+ dlPhy->SetCellId (cellId);
+ ulPhy->SetCellId (cellId);
+
+ Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
+ ulPhy->AddCtrlSinrChunkProcessor (chunkProcessor);
+
+ /**
+ * Generate several calls to LteSpectrumPhy::StartRx corresponding to
+ * several signals.
+ * One will be the signal of interest, i.e., the
+ * LteSpectrumSignalParametersUlSrsFrame of the first signal will have the
+ * same CellId of the receiving PHY; the others will have a different
+ * CellId and hence will be the interfering signals
+ */
+
+ // Number of packet bursts (2 data + 4 interferences)
+ int numOfDataSignals = 2;
+ int numOfIntfSignals = 4;
+ int numOfSignals = numOfDataSignals + numOfIntfSignals;
+
+ uint16_t pbCellId[numOfSignals];
+
+
+
+ /**
+ * Build packet burst (Data and interference)
+ */
+ int pb = 0;
+ for ( int dataPb = 0 ; dataPb < numOfDataSignals ; dataPb++, pb++ )
+ {
+ pbCellId[pb] = cellId;
+
+ }
+ for ( int intfPb = 0 ; intfPb < numOfIntfSignals ; intfPb++, pb++ )
+ {
+
+ pbCellId[pb] = cellId * (pb + 1);
+ }
+
+
+ Ptr<SpectrumValue> noisePsd = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i1 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i2 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i3 = Create<SpectrumValue> (m_sm);
+ Ptr<SpectrumValue> i4 = Create<SpectrumValue> (m_sm);
+
+ (*noisePsd)[0] = 5.000000000000e-19;
+ (*noisePsd)[1] = 4.545454545455e-19;
+
+ (*i1)[0] = 5.000000000000e-18;
+ (*i2)[0] = 5.000000000000e-16;
+ (*i3)[0] = 1.581138830084e-16;
+ (*i4)[0] = 7.924465962306e-17;
+ (*i1)[1] = 1.437398936440e-18;
+ (*i2)[1] = 5.722388235428e-16;
+ (*i3)[1] = 7.204059965732e-17;
+ (*i4)[1] = 5.722388235428e-17;
+
+ Time ts = Seconds (1);
+ Time ds = Seconds (1);
+ Time ti1 = Seconds (0);
+ Time di1 = Seconds (3);
+ Time ti2 = Seconds (0.7);
+ Time di2 = Seconds (1);
+ Time ti3 = Seconds (1.2);
+ Time di3 = Seconds (1);
+ Time ti4 = Seconds (1.5);
+ Time di4 = Seconds (0.1);
+
+ ulPhy->SetNoisePowerSpectralDensity (noisePsd);
+
+ /**
+ * Schedule the reception of the data signals plus the interference signals
+ */
+
+ // 2 UEs send data to the eNB through 2 subcarriers
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> sp1 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ sp1->psd = m_sv1;
+ sp1->txPhy = 0;
+ sp1->duration = ds;
+ sp1->cellId = pbCellId[0];
+ Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp1);
+
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> sp2 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ sp2->psd = m_sv2;
+ sp2->txPhy = 0;
+ sp2->duration = ds;
+ sp2->cellId = pbCellId[1];
+ Simulator::Schedule (ts, &LteSpectrumPhy::StartRx, ulPhy, sp2);
+
+
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> ip1 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ ip1->psd = i1;
+ ip1->txPhy = 0;
+ ip1->duration = di1;
+ ip1->cellId = pbCellId[2];
+ Simulator::Schedule (ti1, &LteSpectrumPhy::StartRx, ulPhy, ip1);
+
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> ip2 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ ip2->psd = i2;
+ ip2->txPhy = 0;
+ ip2->duration = di2;
+ ip2->cellId = pbCellId[3];
+ Simulator::Schedule (ti2, &LteSpectrumPhy::StartRx, ulPhy, ip2);
+
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> ip3 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ ip3->psd = i3;
+ ip3->txPhy = 0;
+ ip3->duration = di3;
+ ip3->cellId = pbCellId[4];
+ Simulator::Schedule (ti3, &LteSpectrumPhy::StartRx, ulPhy, ip3);
+
+ Ptr<LteSpectrumSignalParametersUlSrsFrame> ip4 = Create<LteSpectrumSignalParametersUlSrsFrame> ();
+ ip4->psd = i4;
+ ip4->txPhy = 0;
+ ip4->duration = di4;
+ ip4->cellId = pbCellId[5];
+ Simulator::Schedule (ti4, &LteSpectrumPhy::StartRx, ulPhy, ip4);
+
+ Simulator::Stop (Seconds (5.0));
+ Simulator::Run ();
+
+ /**
+ * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
+ * to known values which have been calculated offline (with octave) for the generated signals
+ */
+ Ptr<SpectrumValue> calculatedSinr = chunkProcessor->GetSinr ();
+
+ NS_LOG_INFO ("SRS Frame - Theoretical SINR: " << *m_sinr);
+ NS_LOG_INFO ("SRS Frame - Calculated SINR: " << *calculatedSinr);
+
+ NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (*calculatedSinr, *m_sinr, 0.0000001, "Data Frame - Wrong SINR !");
+ ulPhy->Dispose ();
+ Simulator::Destroy ();
+
+}
+
+} //namespace
--- a/src/lte/test/lte-test-uplink-sinr.h Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/lte-test-uplink-sinr.h Thu Jul 19 13:02:41 2012 +0200
@@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manuel Requena <manuel.requena@cttc.es>
+ * Modified by Marco Miozzo <mmiozzo@ctt.es>
+ * Extend to Data and SRS frames
*/
#ifndef LTE_TEST_UPLINK_SINR_H
@@ -39,11 +41,11 @@
};
-class LteUplinkSinrTestCase : public TestCase
+class LteUplinkDataSinrTestCase : public TestCase
{
public:
- LteUplinkSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
- virtual ~LteUplinkSinrTestCase ();
+ LteUplinkDataSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
+ virtual ~LteUplinkDataSinrTestCase ();
private:
virtual void DoRun (void);
@@ -55,6 +57,22 @@
};
+class LteUplinkSrsSinrTestCase : public TestCase
+{
+ public:
+ LteUplinkSrsSinrTestCase (Ptr<SpectrumValue> sv1, Ptr<SpectrumValue> sv2, Ptr<SpectrumValue> sinr, std::string name);
+ virtual ~LteUplinkSrsSinrTestCase ();
+
+ private:
+ virtual void DoRun (void);
+
+ Ptr<SpectrumValue> m_sv1;
+ Ptr<SpectrumValue> m_sv2;
+ Ptr<const SpectrumModel> m_sm;
+ Ptr<SpectrumValue> m_sinr;
+};
+
+
#endif /* LTE_TEST_UPLINK_SINR_H */
} // namespace ns3
--- a/src/lte/test/test-lte-antenna.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/test-lte-antenna.cc Thu Jul 19 13:02:41 2012 +0200
@@ -23,6 +23,8 @@
#include "ns3/log.h"
#include "ns3/string.h"
#include "ns3/double.h"
+#include "ns3/enum.h"
+#include "ns3/boolean.h"
#include "ns3/test.h"
#include "ns3/mobility-helper.h"
#include "ns3/lte-helper.h"
@@ -31,6 +33,7 @@
#include "ns3/lte-ue-net-device.h"
#include "ns3/lte-enb-phy.h"
#include "ns3/lte-enb-net-device.h"
+#include "ns3/ff-mac-scheduler.h"
#include "lte-test-sinr-chunk-processor.h"
@@ -90,7 +93,8 @@
void
LteEnbAntennaTestCase::DoRun (void)
{
-
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
// use 0dB Pathloss, since we are testing only the antenna gain
@@ -117,6 +121,7 @@
NetDeviceContainer enbDevs;
NetDeviceContainer ueDevs;
lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler");
+ lteHelper->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI));
lteHelper->SetEnbAntennaModelType ("ns3::CosineAntennaModel");
lteHelper->SetEnbAntennaModelAttribute ("Orientation", DoubleValue (m_orientationDegrees));
lteHelper->SetEnbAntennaModelAttribute ("Beamwidth", DoubleValue (m_beamwidthDegrees));
@@ -137,11 +142,11 @@
// It will be used to test that the SNR is as intended
Ptr<LtePhy> uePhy = ueDevs.Get (0)->GetObject<LteUeNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testDlSinr = Create<LteTestSinrChunkProcessor> (uePhy);
- uePhy->GetDownlinkSpectrumPhy ()->AddSinrChunkProcessor (testDlSinr);
+ uePhy->GetDownlinkSpectrumPhy ()->AddDataSinrChunkProcessor (testDlSinr);
Ptr<LtePhy> enbphy = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ()->GetPhy ()->GetObject<LtePhy> ();
Ptr<LteTestSinrChunkProcessor> testUlSinr = Create<LteTestSinrChunkProcessor> (enbphy);
- enbphy->GetUplinkSpectrumPhy ()->AddSinrChunkProcessor (testUlSinr);
+ enbphy->GetUplinkSpectrumPhy ()->AddDataSinrChunkProcessor (testUlSinr);
Simulator::Stop (Seconds (0.020));
--- a/src/lte/test/test-lte-epc-e2e-data.cc Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/test/test-lte-epc-e2e-data.cc Thu Jul 19 13:02:41 2012 +0200
@@ -109,8 +109,8 @@
void
LteEpcE2eDataTestCase::DoRun ()
{
- Config::SetDefault ("ns3::LteSpectrumPhy::PemEnabled", BooleanValue (false));
- Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
Ptr<EpcHelper> epcHelper = CreateObject<EpcHelper> ();
lteHelper->SetEpcHelper (epcHelper);
--- a/src/lte/wscript Wed Jul 18 00:35:39 2012 -0400
+++ b/src/lte/wscript Thu Jul 19 13:02:41 2012 +0200
@@ -32,7 +32,7 @@
'model/lte-net-device.cc',
'model/lte-enb-net-device.cc',
'model/lte-ue-net-device.cc',
- 'model/ideal-control-messages.cc',
+ 'model/lte-control-messages.cc',
'helper/lte-helper.cc',
'helper/lte-stats-calculator.cc',
'helper/epc-helper.cc',
@@ -41,6 +41,7 @@
'helper/radio-environment-map-helper.cc',
'helper/lte-hex-grid-enb-topology-helper.cc',
'model/rem-spectrum-phy.cc',
+ 'model/ff-mac-common.cc',
'model/ff-mac-csched-sap.cc',
'model/ff-mac-sched-sap.cc',
'model/lte-mac-sap.cc',
@@ -63,7 +64,8 @@
'model/epc-sgw-pgw-application.cc',
'model/epc-tft.cc',
'model/epc-tft-classifier.cc',
- 'model/lte-mi-error-model.cc'
+ 'model/lte-mi-error-model.cc',
+ 'model/lte-vendor-specific-parameters.cc'
]
module_test = bld.create_ns3_module_test_library('lte')
@@ -127,7 +129,7 @@
'model/lte-net-device.h',
'model/lte-enb-net-device.h',
'model/lte-ue-net-device.h',
- 'model/ideal-control-messages.h',
+ 'model/lte-control-messages.h',
'helper/lte-helper.h',
'helper/lte-stats-calculator.h',
'helper/epc-helper.h',
@@ -157,6 +159,25 @@
'model/epc-gtpu-header.h',
'model/epc-enb-application.h',
'model/epc-sgw-pgw-application.h',
+ 'model/lte-vendor-specific-parameters.h',
+ 'test/lte-test-downlink-sinr.h',
+ 'test/lte-test-uplink-sinr.h',
+ 'test/lte-test-link-adaptation.h',
+ 'test/lte-test-interference.h',
+ 'test/lte-test-sinr-chunk-processor.h',
+ '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-phy-error-model.h',
+ 'test/lte-test-pathloss-model.h',
+ 'test/epc-test-gtpu.h',
+ 'test/lte-test-entities.h',
+ 'test/lte-simple-net-device.h',
+ 'test/lte-simple-helper.h',
+ 'test/lte-test-rlc-um-transmitter.h',
+ 'test/lte-test-rlc-am-transmitter.h',
+ 'test/lte-test-rlc-um-e2e.h',
+ 'test/lte-test-rlc-am-e2e.h',
'model/epc-tft.h',
'model/epc-tft-classifier.h',
'model/lte-mi-error-model.h',