--- a/src/lte/model/lte-enb-mac.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/model/lte-enb-mac.cc Fri Nov 02 17:12:55 2012 +0100
@@ -511,27 +511,10 @@
m_ulInfoListReceived.clear ();
}
-// std::map <uint16_t,UlInfoListElement_s>::iterator it;
-// for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
-// {
-// ulparams.m_ulInfoList.push_back ((*it).second);
-// }
m_schedSapProvider->SchedUlTriggerReq (ulparams);
-
-
+}
- // reset UL info
-// for (it = m_ulInfoListElements.begin (); it != m_ulInfoListElements.end (); it++)
-// {
-// for (uint16_t i = 0; i < (*it).second.m_ulReception.size (); i++)
-// {
-// (*it).second.m_ulReception.at (i) = 0;
-// }
-// (*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
-// (*it).second.m_tpc = 0;
-// }
-}
void
LteEnbMac::DoReceiveLteControlMessage (Ptr<LteControlMessage> msg)
--- a/src/lte/model/lte-mi-error-model.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/model/lte-mi-error-model.cc Fri Nov 02 17:12:55 2012 +0100
@@ -415,7 +415,7 @@
cbIndex++;
}
cbIndex--;
- NS_LOG_LOGIC (" ECR " << (uint16_t)ecrId << " CB size " << cbSize << " CB size curve " << cbMiSizeTable[cbIndex]);
+ NS_LOG_LOGIC (" ECRid " << (uint16_t)ecrId << " ECR " << BlerCurvesEcrMap[ecrId] << " CB size " << cbSize << " CB size curve " << cbMiSizeTable[cbIndex]);
b = bEcrTable[cbIndex][ecrId];
if (b<0.0)
@@ -683,7 +683,7 @@
{
// Modulation order 4
uint8_t i = MI_16QAM_MAX_ID;
- while ((BlerCurvesEcrMap[i]>Reff)&&(i>MI_QPSK_MAX_ID))
+ while ((BlerCurvesEcrMap[i]>Reff)&&(i>MI_QPSK_MAX_ID + 1))
{
i--;
}
@@ -693,7 +693,7 @@
{
// Modulation order 6
uint8_t i = MI_64QAM_MAX_ID;
- while ((BlerCurvesEcrMap[i]>Reff)&&(i>MI_16QAM_MAX_ID))
+ while ((BlerCurvesEcrMap[i]>Reff)&&(i>MI_16QAM_MAX_ID + 1))
{
i--;
}
--- a/src/lte/model/lte-spectrum-phy.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.cc Fri Nov 02 17:12:55 2012 +0100
@@ -837,23 +837,9 @@
TbStats_t tbStats = LteMiErrorModel::GetTbDecodificationStats (m_sinrPerceived, (*itTb).second.rbBitmap, (*itTb).second.size, (*itTb).second.mcs, harqInfoList);
(*itTb).second.mi = tbStats.mi;
(*itTb).second.corrupt = m_random->GetValue () > tbStats.tbler ? false : true;
- // DEBUG: force error for testing HARQ
-// if ((*itTb).second.downlink)
-// {
-// // if (((*itTb).second.harqProcessId == 0)&&(Simulator::Now ().GetNanoSeconds ()<=20000000))
-// if ((errors<4) && ((*itTb).second.harqProcessId == 0) && ( ((*itTb).first.m_rnti==1)||((*itTb).first.m_rnti==3)) )
-// {
-// (*itTb).second.corrupt = true;
-// errors++;
-// }
-// }
NS_LOG_DEBUG (this << "RNTI " << (*itTb).first.m_rnti << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " layer " << (uint16_t)(*itTb).first.m_layer << " TBLER " << tbStats.tbler << " corrupted " << (*itTb).second.corrupt);
}
-// for (uint16_t i = 0; i < (*itTb).second.rbBitmap.size (); i++)
-// {
-// NS_LOG_DEBUG (this << " RB " << (*itTb).second.rbBitmap.at (i) << " SINR " << m_sinrPerceived[(*itTb).second.rbBitmap.at (i)]);
-// }
itTb++;
}
std::map <uint16_t, DlInfoListElement_s> harqDlInfoMap;
--- a/src/lte/model/pf-ff-mac-scheduler.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/model/pf-ff-mac-scheduler.cc Fri Nov 02 17:12:55 2012 +0100
@@ -1380,7 +1380,7 @@
for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
{
- rbMap.at (j) = false;
+ rbMap.at (j) = true;
// store info on allocation for managing ul-cqi interpretation
rbgAllocationMap.at (j) = (*it).first;
NS_LOG_DEBUG ("\t " << j);
--- a/src/lte/model/rr-ff-mac-scheduler.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/model/rr-ff-mac-scheduler.cc Fri Nov 02 17:12:55 2012 +0100
@@ -1216,7 +1216,7 @@
for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++)
{
- rbMap.at (j) = false;
+ rbMap.at (j) = true;
// store info on allocation for managing ul-cqi interpretation
rbgAllocationMap.at (j) = (*it).first;
NS_LOG_DEBUG ("\t " << j);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/test/lte-test-harq.cc Fri Nov 02 17:12:55 2012 +0100
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Marco Miozzo <marco.miozzo@cttc.es>
+ */
+
+#include <ns3/object.h>
+#include <ns3/spectrum-interference.h>
+#include <ns3/spectrum-error-model.h>
+#include <ns3/log.h>
+#include <ns3/test.h>
+#include <ns3/simulator.h>
+#include <ns3/packet.h>
+#include <ns3/ptr.h>
+#include <iostream>
+#include <ns3/radio-bearer-stats-calculator.h>
+#include <ns3/buildings-mobility-model.h>
+#include <ns3/hybrid-buildings-propagation-loss-model.h>
+#include <ns3/eps-bearer.h>
+#include <ns3/node-container.h>
+#include <ns3/mobility-helper.h>
+#include <ns3/net-device-container.h>
+#include <ns3/lte-ue-net-device.h>
+#include <ns3/lte-enb-net-device.h>
+#include <ns3/lte-ue-rrc.h>
+#include <ns3/lte-helper.h>
+#include <ns3/string.h>
+#include <ns3/double.h>
+#include <ns3/lte-enb-phy.h>
+#include <ns3/lte-ue-phy.h>
+#include <ns3/config.h>
+#include <ns3/boolean.h>
+#include <ns3/enum.h>
+#include <ns3/unused.h>
+#include <ns3/ff-mac-scheduler.h>
+
+#include "lte-test-harq.h"
+
+NS_LOG_COMPONENT_DEFINE ("LenaTestHarq");
+
+namespace ns3 {
+
+
+LenaTestHarqSuite::LenaTestHarqSuite ()
+ : TestSuite ("lte-harq", SYSTEM)
+{
+ NS_LOG_INFO ("creating LenaTestHarqTestCase");
+
+
+ // Tests on DL/UL Data channels (PDSCH, PUSCH)
+ // MCS 0 TB size of 41 bytes SINR -17 expected throughput 19248 bytes
+ // TBLER 1st tx 1.0
+ // TBLER 2nd tx 0.23
+ AddTestCase (new LenaHarqTestCase (2, 4000, 41, 0.17, 19248));
+
+ // Tests on DL/UL Data channels (PDSCH, PUSCH)
+ // MCS 10 TB size of 469 bytes SINR 4 expected throughput 236096 bytes
+ // TBLER 1st tx 1.0
+ // TBLER 2nd tx 0.0138
+ AddTestCase (new LenaHarqTestCase (1, 640, 41, 0.02, 236096));
+
+
+
+}
+
+static LenaTestHarqSuite lenaTestHarqSuite;
+
+std::string
+LenaHarqTestCase::BuildNameString (uint16_t nUser, uint16_t dist)
+{
+ std::ostringstream oss;
+ oss << nUser << " UEs, distance " << dist << " m";
+ return oss.str ();
+}
+
+LenaHarqTestCase::LenaHarqTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double amcBer, double thrRef)
+ : TestCase (BuildNameString (nUser, dist)),
+ m_nUser (nUser),
+ m_dist (dist),
+ m_tbSize (tbSize),
+ m_amcBer (amcBer),
+ m_throughputRef (thrRef)
+{
+}
+
+LenaHarqTestCase::~LenaHarqTestCase ()
+{
+}
+
+void
+LenaHarqTestCase::DoRun (void)
+{
+
+ Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (m_amcBer));
+ Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
+ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false));
+ Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true));
+// Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", 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 ("LenaTestHarq", LOG_LEVEL_ALL);
+
+
+ /**
+ * Initialize Simulation Scenario: 1 eNB and m_nUser UEs
+ */
+
+ Ptr<LteHelper> lena = CreateObject<LteHelper> ();
+
+ // Create Nodes: eNodeB and UE
+ NodeContainer enbNodes;
+ NodeContainer ueNodes;
+ enbNodes.Create (1);
+ ueNodes.Create (m_nUser);
+
+ // Install Mobility Model
+ MobilityHelper mobility;
+ mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
+ mobility.Install (enbNodes);
+ mobility.SetMobilityModel ("ns3::BuildingsMobilityModel");
+ mobility.Install (ueNodes);
+
+ // remove random shadowing component
+ lena->SetAttribute ("PathlossModel", StringValue ("ns3::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 a eNB
+ lena->Attach (ueDevs, enbDevs.Get (0));
+
+ // Activate an EPS bearer
+ enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
+ EpsBearer bearer (q);
+ lena->ActivateDataRadioBearer (ueDevs, bearer);
+
+
+ Ptr<LteEnbNetDevice> lteEnbDev = enbDevs.Get (0)->GetObject<LteEnbNetDevice> ();
+ Ptr<LteEnbPhy> enbPhy = lteEnbDev->GetPhy ();
+ enbPhy->SetAttribute ("TxPower", DoubleValue (43.0));
+ enbPhy->SetAttribute ("NoiseFigure", DoubleValue (5.0));
+ // place the HeNB over the default rooftop level (20 mt.)
+ Ptr<BuildingsMobilityModel> mm = enbNodes.Get (0)->GetObject<BuildingsMobilityModel> ();
+ mm->SetPosition (Vector (0.0, 0.0, 30.0));
+
+ // Set UEs' position and power
+ for (int i = 0; i < m_nUser; i++)
+ {
+ Ptr<BuildingsMobilityModel> mm = ueNodes.Get (i)->GetObject<BuildingsMobilityModel> ();
+ mm->SetPosition (Vector (m_dist, 0.0, 1.0));
+ Ptr<LteUeNetDevice> lteUeDev = ueDevs.Get (i)->GetObject<LteUeNetDevice> ();
+ Ptr<LteUePhy> uePhy = lteUeDev->GetPhy ();
+ uePhy->SetAttribute ("TxPower", DoubleValue (23.0));
+ uePhy->SetAttribute ("NoiseFigure", DoubleValue (9.0));
+ }
+
+ lena->EnableRlcTraces ();
+ double simulationTime = 1.000;
+
+ Simulator::Stop (Seconds (simulationTime));
+
+ Ptr<RadioBearerStatsCalculator> rlcStats = lena->GetRlcStats ();
+ rlcStats->SetAttribute ("EpochDuration", TimeValue (Seconds (simulationTime)));
+
+
+ Simulator::Run ();
+
+ /**
+ * Check that the assignation is done in a RR fashion
+ */
+ NS_LOG_INFO ("\tTest on downlink data shared channels (PDSCH)");
+ NS_LOG_INFO ("Test with " << m_nUser << " user(s) at distance " << m_dist << " expected Thr " << m_throughputRef);
+ std::vector <uint64_t> dlDataRxed;
+ for (int i = 0; i < m_nUser; i++)
+ {
+ // get the imsi
+ uint64_t imsi = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetImsi ();
+ // get the lcId
+ uint8_t lcId = ueDevs.Get (i)->GetObject<LteUeNetDevice> ()->GetRrc ()->GetLcIdVector ().at (0);
+ dlDataRxed.push_back (rlcStats->GetDlRxData (imsi, lcId));
+ double txed = rlcStats->GetDlTxData (imsi, lcId);
+ double tolerance = 0.1;
+ NS_LOG_INFO ("\tUser " << i << " imsi " << imsi << " bytes rxed " << (double)dlDataRxed.at (i) << " txed " << txed << " thr Ref " << m_throughputRef << " Err " << (abs (txed - m_throughputRef)) / m_throughputRef);
+ // the quantiles are evaluated offline according to a Bernoulli
+ // ditribution with n equal to the number of packet sent and p equal
+ // to the BER (see /reference/bernuolliDistribution.m for details)
+ NS_TEST_ASSERT_MSG_EQ_TOL (txed, m_throughputRef, m_throughputRef * tolerance, " Unexpected Throughput!");
+ }
+
+
+ Simulator::Destroy ();
+}
+
+
+} // namespace
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lte/test/lte-test-harq.h Fri Nov 02 17:12:55 2012 +0100
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Marco Miozzo <marco.miozzo@cttc.es>
+ */
+
+#ifndef LENA_TEST_HARQ_H
+#define LENA_TEST_HARQ_H
+
+#include "ns3/simulator.h"
+#include "ns3/test.h"
+
+
+namespace ns3 {
+
+
+/**
+ * This system test program creates different test cases with a single eNB and
+ * several UEs, all having the same Radio Bearer specification. In each test
+ * case, the UEs see the same SINR from the eNB; different test cases are
+ * implemented obtained by using different SINR values and different numbers of
+ * UEs. The test consists on ...
+ */
+class LenaHarqTestCase : public TestCase
+{
+public:
+ LenaHarqTestCase (uint16_t nUser, uint16_t dist, uint16_t tbSize, double amcBer, double thrRef);
+ virtual ~LenaHarqTestCase ();
+
+private:
+ virtual void DoRun (void);
+ static std::string BuildNameString (uint16_t nUser, uint16_t dist);
+ uint16_t m_nUser;
+ uint16_t m_dist;
+ uint16_t m_tbSize;
+ double m_amcBer;
+ double m_throughputRef;
+
+};
+
+
+
+
+
+class LenaTestHarqSuite : public TestSuite
+{
+public:
+ LenaTestHarqSuite ();
+};
+
+
+
+
+} // namespace ns3
+
+
+#endif /* LENA_TEST_HARQ_H */
--- a/src/lte/test/lte-test-phy-error-model.cc Wed Oct 31 16:38:48 2012 +0100
+++ b/src/lte/test/lte-test-phy-error-model.cc Fri Nov 02 17:12:55 2012 +0100
@@ -73,7 +73,7 @@
// Tests on DL/UL Data channels (PDSCH, PUSCH)
// MCS 2 TB size of 256 bits BER 0.33 SINR -5.51
- AddTestCase (new LenaDataPhyErrorModelTestCase (4, 1800, 32, 0.35, 50));
+ AddTestCase (new LenaDataPhyErrorModelTestCase (4, 1800, 32, 0.33, 50));
// MCS 2 TB size of 528 bits BER 0.11 SINR -5.51
AddTestCase (new LenaDataPhyErrorModelTestCase (2, 1800, 66, 0.11, 34));
// MCS 2 TB size of 1088 bits BER 0.02 SINR -5.51